fixed some warnings, and added some asserts Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp 2005-01-06 01:28:10 UTC (rev 12842) +++ branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp 2005-01-06 01:35:01 UTC (rev 12843) @@ -197,10 +197,10 @@
}
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 @@ fclose ( f ); _p = _buf.c_str(); _end = _p + len; + _filename = filename_; next_token(); return true; } @@ -456,24 +457,23 @@ { 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 ) ); + XMLFile fInc; + if ( !fInc.open ( file ) ) + throw FileNotFoundException ( file ); + else { - string file ( path.Fixup(att->value,true) ); - string top_file ( Path::RelativeFromWorkingDirectory ( file ) ); - e->attributes.push_back ( new XMLAttribute ( "top_href", top_file ) ); - XMLFile fInc; - if ( !fInc.open ( file ) ) - throw FileNotFoundException ( file ); - else + Path path2 ( path, att->value ); + for ( ;; ) { - Path path2 ( path, att->value ); - for ( ;; ) - { - XMLElement* e2 = XMLParse ( fInc, path2 ); - if ( !e2 ) - break; - e->AddSubElement ( e2 ); - } + XMLElement* e2 = XMLParse ( fInc, path2 ); + if ( !e2 ) + break; + e->AddSubElement ( e2 ); } } } @@ -519,7 +519,7 @@ 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; } _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.h --- branches/xmlbuildsystem/reactos/tools/rbuild/XML.h 2005-01-06 01:28:10 UTC (rev 12842) +++ branches/xmlbuildsystem/reactos/tools/rbuild/XML.h 2005-01-06 01:35:01 UTC (rev 12843) @@ -34,9 +34,10 @@
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; }; _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-06 01:28:10 UTC (rev 12842) +++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-06 01:35:01 UTC (rev 12843) @@ -1,6 +1,7 @@
// module.cpp
#include "pch.h" +#include <assert.h>
#include "rbuild.h"
@@ -19,9 +20,10 @@
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 @@ 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++ ) _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-06 01:28:10 UTC (rev 12842) +++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-06 01:35:01 UTC (rev 12843) @@ -1,5 +1,6 @@
#include "pch.h" +#include <assert.h>
#include "rbuild.h"
@@ -55,11 +56,13 @@ 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 @@ 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++ )