mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-06-08 01:22:02 +00:00
Fix compile with VS2008, disable XMLDocument::LoadFile()
This commit is contained in:
parent
3742a5f2f5
commit
5ba014640c
4 changed files with 104 additions and 7 deletions
87
ExternalLibs/minipstdint.h
Normal file
87
ExternalLibs/minipstdint.h
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
// Minimal stdint.h essentials, loosely based on Paul Hsieh's pstdint.h
|
||||||
|
// See http://www.azillionmonkeys.com/qed/pstdint.h for reference.
|
||||||
|
// This adds only the xint*_t types, xINT*_C() macros, and xINT*_MAX defines for older versions of visual studio.
|
||||||
|
// Might want to use the full pstdint.h instead if needed to support older compilers.
|
||||||
|
|
||||||
|
#ifndef _PSTDINT_H_INCLUDED
|
||||||
|
#define _PSTDINT_H_INCLUDED
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER < 1600
|
||||||
|
typedef signed __int8 int8_t;
|
||||||
|
typedef signed __int16 int16_t;
|
||||||
|
typedef signed __int32 int32_t;
|
||||||
|
typedef signed __int64 int64_t;
|
||||||
|
typedef unsigned __int8 uint8_t;
|
||||||
|
typedef unsigned __int16 uint16_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
# ifdef __cplusplus
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
typedef ::int8_t int8_t;
|
||||||
|
typedef ::int16_t int16_t;
|
||||||
|
typedef ::int32_t int32_t;
|
||||||
|
typedef ::int64_t int64_t;
|
||||||
|
typedef ::uint8_t uint8_t;
|
||||||
|
typedef ::uint16_t uint16_t;
|
||||||
|
typedef ::uint32_t uint32_t;
|
||||||
|
typedef ::uint64_t uint64_t;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# define INT8_C(v) ((int8_t)v)
|
||||||
|
# define UINT8_C(v) ((uint8_t)v)
|
||||||
|
# define INT16_C(v) ((int16_t)v)
|
||||||
|
# define UINT16_C(v) ((uint16_t)v)
|
||||||
|
# define INT32_C(v) ((int32_t)v)
|
||||||
|
# define UINT32_C(v) ((uint32_t)v)
|
||||||
|
# define UINT64_C(v) (v ## UI64)
|
||||||
|
# define INT64_C(v) (v ## I64)
|
||||||
|
#else
|
||||||
|
# ifdef __cplusplus
|
||||||
|
# include <cstdint>
|
||||||
|
# endif
|
||||||
|
# include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# if !defined (UINT64_MAX)
|
||||||
|
# define UINT64_MAX UINT64_C(18446744073709551615)
|
||||||
|
# endif
|
||||||
|
# if !defined (INT64_MAX)
|
||||||
|
# define INT64_MAX INT64_C(9223372036854775807)
|
||||||
|
# endif
|
||||||
|
# if !defined (UINT32_MAX)
|
||||||
|
# define UINT32_MAX UINT32_C(4294967295UL)
|
||||||
|
# endif
|
||||||
|
# if !defined (INT32_MAX)
|
||||||
|
# define INT32_MAX INT32_C(2147483647L)
|
||||||
|
# endif
|
||||||
|
#ifndef UINT16_MAX
|
||||||
|
# define UINT16_MAX 0xffff
|
||||||
|
#endif
|
||||||
|
#ifndef INT16_MAX
|
||||||
|
# define INT16_MAX 0x7fff
|
||||||
|
#endif
|
||||||
|
#ifndef UINT8_MAX
|
||||||
|
# define UINT8_MAX 0xff
|
||||||
|
#endif
|
||||||
|
#ifndef INT8_MAX
|
||||||
|
# define INT8_MAX 0x7f
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INT8_MIN
|
||||||
|
# define INT8_MIN INT8_C(0x80)
|
||||||
|
#endif
|
||||||
|
#ifndef INT16_MIN
|
||||||
|
# define INT16_MIN INT16_C(0x8000)
|
||||||
|
#endif
|
||||||
|
#ifndef INT32_MIN
|
||||||
|
# define INT32_MIN INT32_C(0x80000000)
|
||||||
|
#endif
|
||||||
|
#ifndef INT64_MIN
|
||||||
|
# define INT64_MIN INT64_C(0x8000000000000000)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -21,6 +21,8 @@ must not be misrepresented as being the original software.
|
||||||
distribution.
|
distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// MODIFICATION: Disabled LoadFile() functions to catch misuse - Aquaria uses its own VFS, not FILE* -- fg
|
||||||
|
|
||||||
#include "tinyxml2.h"
|
#include "tinyxml2.h"
|
||||||
|
|
||||||
#include <new> // yes, this one new style header, is in the Android SDK.
|
#include <new> // yes, this one new style header, is in the Android SDK.
|
||||||
|
@ -1961,7 +1963,7 @@ void XMLDocument::DeleteNode( XMLNode* node ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
XMLError XMLDocument::LoadFile( const char* filename )
|
XMLError XMLDocument::LoadFile( const char* filename )
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
@ -1974,7 +1976,7 @@ XMLError XMLDocument::LoadFile( const char* filename )
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
return _errorID;
|
return _errorID;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// This is likely overengineered template art to have a check that unsigned long value incremented
|
// This is likely overengineered template art to have a check that unsigned long value incremented
|
||||||
// by one still fits into size_t. If size_t type is larger than unsigned long type
|
// by one still fits into size_t. If size_t type is larger than unsigned long type
|
||||||
// (x86_64-w64-mingw32 target) then the check is redundant and gcc and clang emit
|
// (x86_64-w64-mingw32 target) then the check is redundant and gcc and clang emit
|
||||||
|
@ -1997,7 +1999,7 @@ struct LongFitsIntoSizeTMinusOne<false> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
XMLError XMLDocument::LoadFile( FILE* fp )
|
XMLError XMLDocument::LoadFile( FILE* fp )
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
@ -2042,7 +2044,7 @@ XMLError XMLDocument::LoadFile( FILE* fp )
|
||||||
Parse();
|
Parse();
|
||||||
return _errorID;
|
return _errorID;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
XMLError XMLDocument::SaveFile( const char* filename, bool compact )
|
XMLError XMLDocument::SaveFile( const char* filename, bool compact )
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,10 @@ must not be misrepresented as being the original software.
|
||||||
distribution.
|
distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// MODIFICATION: Disabled LoadFile() functions to catch misuse - Aquaria uses its own VFS, not FILE* -- fg
|
||||||
|
// MODIFICATION: Do not require stdint.h, use minipstdint.h instead -- fg
|
||||||
|
|
||||||
|
|
||||||
#ifndef TINYXML2_INCLUDED
|
#ifndef TINYXML2_INCLUDED
|
||||||
#define TINYXML2_INCLUDED
|
#define TINYXML2_INCLUDED
|
||||||
|
|
||||||
|
@ -40,7 +44,7 @@ distribution.
|
||||||
# include <cstdlib>
|
# include <cstdlib>
|
||||||
# include <cstring>
|
# include <cstring>
|
||||||
#endif
|
#endif
|
||||||
#include <stdint.h>
|
#include "minipstdint.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO: intern strings instead of allocation.
|
TODO: intern strings instead of allocation.
|
||||||
|
@ -1616,7 +1620,7 @@ public:
|
||||||
Returns XML_NO_ERROR (0) on success, or
|
Returns XML_NO_ERROR (0) on success, or
|
||||||
an errorID.
|
an errorID.
|
||||||
*/
|
*/
|
||||||
XMLError LoadFile( const char* filename );
|
//XMLError LoadFile( const char* filename );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load an XML file from disk. You are responsible
|
Load an XML file from disk. You are responsible
|
||||||
|
@ -1629,7 +1633,7 @@ public:
|
||||||
Returns XML_NO_ERROR (0) on success, or
|
Returns XML_NO_ERROR (0) on success, or
|
||||||
an errorID.
|
an errorID.
|
||||||
*/
|
*/
|
||||||
XMLError LoadFile( FILE* );
|
//XMLError LoadFile( FILE* );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Save the XML file to disk.
|
Save the XML file to disk.
|
||||||
|
|
|
@ -190,6 +190,10 @@
|
||||||
RelativePath="..\..\ExternalLibs\minihttp.h"
|
RelativePath="..\..\ExternalLibs\minihttp.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\ExternalLibs\minipstdint.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="glpng"
|
Name="glpng"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Add table
Reference in a new issue