mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 03:52:17 +00:00
fixed some warnings, and added some asserts
svn path=/branches/xmlbuildsystem/; revision=12843
This commit is contained in:
parent
7d876c4d0c
commit
c6916243d1
4 changed files with 30 additions and 22 deletions
|
@ -197,10 +197,10 @@ XMLFile::close()
|
|||
}
|
||||
|
||||
bool
|
||||
XMLFile::open(const string& filename)
|
||||
XMLFile::open(const string& filename_)
|
||||
{
|
||||
close();
|
||||
FILE* f = fopen ( filename.c_str(), "rb" );
|
||||
FILE* f = fopen ( filename_.c_str(), "rb" );
|
||||
if ( !f )
|
||||
return false;
|
||||
unsigned long len = (unsigned long)filelen(f);
|
||||
|
@ -209,6 +209,7 @@ XMLFile::open(const string& filename)
|
|||
fclose ( f );
|
||||
_p = _buf.c_str();
|
||||
_end = _p + len;
|
||||
_filename = filename_;
|
||||
next_token();
|
||||
return true;
|
||||
}
|
||||
|
@ -456,8 +457,8 @@ XMLParse(XMLFile& f,
|
|||
{
|
||||
XMLAttribute* att;
|
||||
att = e->GetAttribute("href",true);
|
||||
if ( att )
|
||||
{
|
||||
assert(att);
|
||||
|
||||
string file ( path.Fixup(att->value,true) );
|
||||
string top_file ( Path::RelativeFromWorkingDirectory ( file ) );
|
||||
e->attributes.push_back ( new XMLAttribute ( "top_href", top_file ) );
|
||||
|
@ -476,7 +477,6 @@ XMLParse(XMLFile& f,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !bNeedEnd )
|
||||
{
|
||||
|
@ -519,7 +519,7 @@ XMLParse(XMLFile& f,
|
|||
if ( end_tag )
|
||||
{
|
||||
if ( e->name != e2->name )
|
||||
printf ( "end tag name mismatch\n" );
|
||||
printf ( "syntax error: end tag name mismatch\n" );
|
||||
delete e2;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -34,9 +34,10 @@ public:
|
|||
bool next_is_text();
|
||||
bool more_tokens();
|
||||
bool get_token(std::string& token);
|
||||
const std::string& filename() { return _filename; }
|
||||
|
||||
private:
|
||||
std::string _buf;
|
||||
std::string _buf, _filename;
|
||||
|
||||
const char *_p, *_end;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// module.cpp
|
||||
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
|
@ -19,9 +20,10 @@ Module::Module ( const XMLElement& moduleNode,
|
|||
|
||||
Module::~Module ()
|
||||
{
|
||||
for ( size_t i = 0; i < files.size(); i++ )
|
||||
size_t i;
|
||||
for ( i = 0; i < files.size(); i++ )
|
||||
delete files[i];
|
||||
for ( size_t i = 0; i < libraries.size(); i++ )
|
||||
for ( i = 0; i < libraries.size(); i++ )
|
||||
delete libraries[i];
|
||||
}
|
||||
|
||||
|
@ -40,6 +42,7 @@ void Module::ProcessXML ( const XMLElement& e,
|
|||
else if ( e.name == "directory" )
|
||||
{
|
||||
const XMLAttribute* att = e.GetAttribute ( "name", true );
|
||||
assert(att);
|
||||
subpath = path + "/" + att->value;
|
||||
}
|
||||
for ( size_t i = 0; i < e.subElements.size (); i++ )
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
|
@ -55,11 +56,13 @@ Project::ProcessXML ( const XMLElement& e, const string& path )
|
|||
name = att->value;
|
||||
|
||||
att = e.GetAttribute ( "makefile", true );
|
||||
assert(att);
|
||||
makefile = att->value;
|
||||
}
|
||||
else if ( e.name == "module" )
|
||||
{
|
||||
att = e.GetAttribute ( "name", true );
|
||||
assert(att);
|
||||
Module* module = new Module ( e, att->value, path );
|
||||
modules.push_back ( module );
|
||||
module->ProcessXML ( e, path );
|
||||
|
@ -68,6 +71,7 @@ Project::ProcessXML ( const XMLElement& e, const string& path )
|
|||
else if ( e.name == "directory" )
|
||||
{
|
||||
const XMLAttribute* att = e.GetAttribute ( "name", true );
|
||||
assert(att);
|
||||
subpath = path + "/" + att->value;
|
||||
}
|
||||
for ( size_t i = 0; i < e.subElements.size (); i++ )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue