diff --git a/reactos/tools/rbuild/XML.cpp b/reactos/tools/rbuild/XML.cpp index 1193cdf0443..585b572c77a 100644 --- a/reactos/tools/rbuild/XML.cpp +++ b/reactos/tools/rbuild/XML.cpp @@ -15,11 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "pch.h" -#ifndef MAX_PATH -#define MAX_PATH _MAX_PATH -#endif +#ifdef _MSC_VER +#pragma warning ( disable : 4786 ) +#endif//_MSC_VER #ifdef WIN32 # include @@ -31,9 +30,12 @@ #include #include "XML.h" -#include "exception.h" #include "ssprintf.h" +#ifndef MAX_PATH +#define MAX_PATH _MAX_PATH +#endif + using std::string; using std::vector; @@ -46,6 +48,29 @@ static const char* WSEQ = " =\t\r\n"; string working_directory; +XMLException::XMLException ( + const std::string& location, + const char* format, ... ) +{ + va_list args; + va_start ( args, format ); + SetExceptionV ( location, format, args ); + va_end ( args ); +} + +void XMLException::SetExceptionV ( const std::string& location, const char* format, va_list args ) +{ + _e = location + ": " + ssvprintf(format,args); +} + +void XMLException::SetException ( const std::string& location, const char* format, ... ) +{ + va_list args; + va_start ( args, format ); + SetExceptionV ( location, format, args ); + va_end ( args ); +} + XMLIncludes::~XMLIncludes() { for ( size_t i = 0; i < this->size(); i++ ) @@ -56,7 +81,7 @@ void InitWorkingDirectory() { // store the current directory for path calculations - working_directory.resize ( _MAX_PATH ); + working_directory.resize ( MAX_PATH ); working_directory[0] = 0; getcwd ( &working_directory[0], working_directory.size() ); working_directory.resize ( strlen ( working_directory.c_str() ) ); @@ -70,18 +95,17 @@ unsigned long long filelen ( FILE* f ) { #ifdef WIN32 - return _filelengthi64 ( _fileno(f) ); + return _filelengthi64 ( _fileno(f) ); #else # ifdef __FreeBSD__ - struct stat file_stat; - if ( fstat(fileno(f), &file_stat) != 0 ) + struct stat file_stat; + if ( fstat(fileno(f), &file_stat) != 0 ) # else - struct stat64 file_stat; - if ( fstat64(fileno(f), &file_stat) != 0 ) + struct stat64 file_stat; + if ( fstat64(fileno(f), &file_stat) != 0 ) # endif // __FreeBSD__ - return 0; - return file_stat.st_size; - + return 0; + return file_stat.st_size; #endif // WIN32 } @@ -227,9 +251,10 @@ Path::RelativeFromDirectory ( } void -Path::Split ( vector& out, - const string& path, - bool include_last ) +Path::Split ( + vector& out, + const string& path, + bool include_last ) { string s ( path ); const char* prev = strtok ( &s[0], "/\\" ); @@ -263,7 +288,7 @@ XMLFile::close() } bool -XMLFile::open(const string& filename_) +XMLFile::open ( const string& filename_ ) { close(); FILE* f = fopen ( filename_.c_str(), "rb" ); @@ -297,7 +322,7 @@ XMLFile::next_is_text() } bool -XMLFile::more_tokens() +XMLFile::more_tokens () { return _p != _end; } @@ -305,7 +330,7 @@ XMLFile::more_tokens() // get_token() is used to return a token, and move the pointer // past the token bool -XMLFile::get_token(string& token) +XMLFile::get_token ( string& token ) { const char* tokend; if ( !strncmp ( _p, "