bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) { // There was a really terrifying little bug here. The code: // value = filename // in the STL case, cause the assignment method of the std::string to // be called. What is strange, is that the std::string had the same // address as it's c_str() method, and so bad things happen. Looks // like a bug in the Microsoft STL implementation. // Add an extra string to avoid the crash. TIXML_STRING filename( _filename ); value = filename; // reading in binary mode so that tinyxml can normalize the EOL FILE* file = TiXmlFOpen( value.c_str (), "rb" ); if ( file ) { bool result = LoadFile( file, encoding ); fclose( file ); return result; } else { SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); return false; } }
bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) { TIXML_STRING filename( _filename ); value = filename; zp::IReadFile* pZFile = NULL; FILE* file = NULL; if (PxcUtil::zPackFOpen(_filename, &pZFile) == PxcUtil::EzPOpen_SimplePath) { // reading in binary mode so that tinyxml can normalize the EOL file = TiXmlFOpen( value.c_str (), "rb" ); } if ( pZFile || file ) { bool result = LoadFile( file, encoding, pZFile ); if (pZFile) zPackFClose(pZFile); else fclose( file ); return result; } else { SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); return false; } }
bool TiXmlDocument::SaveFile(const char * filename) const { // The old c stuff lives on... FILE* fp = TiXmlFOpen(filename, "w"); if (fp) { bool result = SaveFile(fp); fclose(fp); return result; } return false; }
bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) { TIXML_STRING filename( _filename ); value = filename; // reading in binary mode so that tinyxml can normalize the EOL FILE* file = TiXmlFOpen( value.c_str (), "rb" ); if ( file ) { bool result = LoadFile( file, encoding ); fclose( file ); return result; } else { SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); return false; } }
bool TiXmlDocument::SaveFile( const char * filename , bool bom ) { bool temp = useMicrosoftBOM; useMicrosoftBOM = bom; // The old c stuff lives on... FILE* fp = TiXmlFOpen( filename, "w" ); if ( fp ) { bool result = SaveFile( fp ); fclose( fp ); return result; } useMicrosoftBOM = temp; return false; }