mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-12 19:04:48 +00:00
Revert "added partial VFS support - enough to read static data from any source"
This reverts commit fa3e9e7329
.
This commit is contained in:
parent
fa3e9e7329
commit
56c6833220
56 changed files with 608 additions and 4023 deletions
|
@ -22,8 +22,6 @@ must not be misrepresented as being the original software.
|
|||
distribution.
|
||||
*/
|
||||
|
||||
// hacked VFS support into this version.
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
|
@ -33,8 +31,6 @@ distribution.
|
|||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include "Core.h"
|
||||
|
||||
FILE* TiXmlFOpen( const char* filename, const char* mode );
|
||||
|
||||
bool TiXmlBase::condenseWhiteSpace = true;
|
||||
|
@ -927,11 +923,12 @@ bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding )
|
|||
value = filename;
|
||||
|
||||
// reading in binary mode so that tinyxml can normalize the EOL
|
||||
ttvfs::VFSFile* file = core->vfs.GetFile(value.c_str());
|
||||
FILE* file = TiXmlFOpen( value.c_str (), "rb" );
|
||||
|
||||
if ( file )
|
||||
{
|
||||
bool result = LoadFile( file, encoding );
|
||||
fclose( file );
|
||||
return result;
|
||||
}
|
||||
else
|
||||
|
@ -941,7 +938,7 @@ bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding )
|
|||
}
|
||||
}
|
||||
|
||||
bool TiXmlDocument::LoadFile( ttvfs::VFSFile* file, TiXmlEncoding encoding )
|
||||
bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding )
|
||||
{
|
||||
if ( !file )
|
||||
{
|
||||
|
@ -954,15 +951,10 @@ bool TiXmlDocument::LoadFile( ttvfs::VFSFile* file, TiXmlEncoding encoding )
|
|||
location.Clear();
|
||||
|
||||
// Get the file size, so we can pre-allocate the string. HUGE speed impact.
|
||||
char* buf = (char*)file->getBuf();
|
||||
|
||||
if ( !buf )
|
||||
{
|
||||
SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
return false;
|
||||
}
|
||||
|
||||
long length = file->size();
|
||||
long length = 0;
|
||||
fseek( file, 0, SEEK_END );
|
||||
length = ftell( file );
|
||||
fseek( file, 0, SEEK_SET );
|
||||
|
||||
// Strange case, but good to handle up front.
|
||||
if ( length <= 0 )
|
||||
|
@ -992,6 +984,15 @@ bool TiXmlDocument::LoadFile( ttvfs::VFSFile* file, TiXmlEncoding encoding )
|
|||
}
|
||||
*/
|
||||
|
||||
char* buf = new char[ length+1 ];
|
||||
buf[0] = 0;
|
||||
|
||||
if ( fread( buf, length, 1, file ) != 1 ) {
|
||||
delete [] buf;
|
||||
SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Process the buffer in place to normalize new lines. (See comment above.)
|
||||
// Copies from the 'p' to 'q' pointer, where p can advance faster if
|
||||
// a newline-carriage return is hit.
|
||||
|
@ -1030,16 +1031,13 @@ bool TiXmlDocument::LoadFile( ttvfs::VFSFile* file, TiXmlEncoding encoding )
|
|||
|
||||
Parse( buf, 0, encoding );
|
||||
|
||||
core->addVFSFileForDrop(file);
|
||||
|
||||
delete [] buf;
|
||||
return !Error();
|
||||
}
|
||||
|
||||
|
||||
bool TiXmlDocument::SaveFile( const char * filename ) const
|
||||
{
|
||||
// FG: TODO: use VFS stuff here as well
|
||||
|
||||
// The old c stuff lives on...
|
||||
FILE* fp = TiXmlFOpen( filename, "w" );
|
||||
if ( fp )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue