mirror of https://github.com/AxioDL/tinyxml2.git
one successful return type. simplify build on vs2015
This commit is contained in:
parent
df4ffc00d6
commit
8553625730
16
tinyxml2.cpp
16
tinyxml2.cpp
|
@ -1286,7 +1286,7 @@ void XMLAttribute::SetName( const char* n )
|
||||||
XMLError XMLAttribute::QueryIntValue( int* value ) const
|
XMLError XMLAttribute::QueryIntValue( int* value ) const
|
||||||
{
|
{
|
||||||
if ( XMLUtil::ToInt( Value(), value )) {
|
if ( XMLUtil::ToInt( Value(), value )) {
|
||||||
return XML_NO_ERROR;
|
return XML_SUCCESS;
|
||||||
}
|
}
|
||||||
return XML_WRONG_ATTRIBUTE_TYPE;
|
return XML_WRONG_ATTRIBUTE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -1295,7 +1295,7 @@ XMLError XMLAttribute::QueryIntValue( int* value ) const
|
||||||
XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const
|
XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const
|
||||||
{
|
{
|
||||||
if ( XMLUtil::ToUnsigned( Value(), value )) {
|
if ( XMLUtil::ToUnsigned( Value(), value )) {
|
||||||
return XML_NO_ERROR;
|
return XML_SUCCESS;
|
||||||
}
|
}
|
||||||
return XML_WRONG_ATTRIBUTE_TYPE;
|
return XML_WRONG_ATTRIBUTE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -1304,7 +1304,7 @@ XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const
|
||||||
XMLError XMLAttribute::QueryBoolValue( bool* value ) const
|
XMLError XMLAttribute::QueryBoolValue( bool* value ) const
|
||||||
{
|
{
|
||||||
if ( XMLUtil::ToBool( Value(), value )) {
|
if ( XMLUtil::ToBool( Value(), value )) {
|
||||||
return XML_NO_ERROR;
|
return XML_SUCCESS;
|
||||||
}
|
}
|
||||||
return XML_WRONG_ATTRIBUTE_TYPE;
|
return XML_WRONG_ATTRIBUTE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -1313,7 +1313,7 @@ XMLError XMLAttribute::QueryBoolValue( bool* value ) const
|
||||||
XMLError XMLAttribute::QueryFloatValue( float* value ) const
|
XMLError XMLAttribute::QueryFloatValue( float* value ) const
|
||||||
{
|
{
|
||||||
if ( XMLUtil::ToFloat( Value(), value )) {
|
if ( XMLUtil::ToFloat( Value(), value )) {
|
||||||
return XML_NO_ERROR;
|
return XML_SUCCESS;
|
||||||
}
|
}
|
||||||
return XML_WRONG_ATTRIBUTE_TYPE;
|
return XML_WRONG_ATTRIBUTE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -1322,7 +1322,7 @@ XMLError XMLAttribute::QueryFloatValue( float* value ) const
|
||||||
XMLError XMLAttribute::QueryDoubleValue( double* value ) const
|
XMLError XMLAttribute::QueryDoubleValue( double* value ) const
|
||||||
{
|
{
|
||||||
if ( XMLUtil::ToDouble( Value(), value )) {
|
if ( XMLUtil::ToDouble( Value(), value )) {
|
||||||
return XML_NO_ERROR;
|
return XML_SUCCESS;
|
||||||
}
|
}
|
||||||
return XML_WRONG_ATTRIBUTE_TYPE;
|
return XML_WRONG_ATTRIBUTE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -1771,7 +1771,7 @@ XMLDocument::XMLDocument( bool processEntities, Whitespace whitespace ) :
|
||||||
XMLNode( 0 ),
|
XMLNode( 0 ),
|
||||||
_writeBOM( false ),
|
_writeBOM( false ),
|
||||||
_processEntities( processEntities ),
|
_processEntities( processEntities ),
|
||||||
_errorID( XML_NO_ERROR ),
|
_errorID(XML_SUCCESS),
|
||||||
_whitespace( whitespace ),
|
_whitespace( whitespace ),
|
||||||
_errorStr1( 0 ),
|
_errorStr1( 0 ),
|
||||||
_errorStr2( 0 ),
|
_errorStr2( 0 ),
|
||||||
|
@ -1795,7 +1795,7 @@ void XMLDocument::Clear()
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
const bool hadError = Error();
|
const bool hadError = Error();
|
||||||
#endif
|
#endif
|
||||||
_errorID = XML_NO_ERROR;
|
_errorID = XML_SUCCESS;
|
||||||
_errorStr1 = 0;
|
_errorStr1 = 0;
|
||||||
_errorStr2 = 0;
|
_errorStr2 = 0;
|
||||||
|
|
||||||
|
@ -2000,7 +2000,7 @@ XMLError XMLDocument::SaveFile( FILE* fp, bool compact )
|
||||||
{
|
{
|
||||||
// Clear any error from the last save, otherwise it will get reported
|
// Clear any error from the last save, otherwise it will get reported
|
||||||
// for *this* call.
|
// for *this* call.
|
||||||
SetError( XML_NO_ERROR, 0, 0 );
|
SetError(XML_SUCCESS, 0, 0);
|
||||||
XMLPrinter stream( fp, compact );
|
XMLPrinter stream( fp, compact );
|
||||||
Print( &stream );
|
Print( &stream );
|
||||||
return _errorID;
|
return _errorID;
|
||||||
|
|
|
@ -485,7 +485,6 @@ public:
|
||||||
// WARNING: must match XMLDocument::_errorNames[]
|
// WARNING: must match XMLDocument::_errorNames[]
|
||||||
enum XMLError {
|
enum XMLError {
|
||||||
XML_SUCCESS = 0,
|
XML_SUCCESS = 0,
|
||||||
XML_NO_ERROR = 0,
|
|
||||||
XML_NO_ATTRIBUTE,
|
XML_NO_ATTRIBUTE,
|
||||||
XML_WRONG_ATTRIBUTE_TYPE,
|
XML_WRONG_ATTRIBUTE_TYPE,
|
||||||
XML_ERROR_FILE_NOT_FOUND,
|
XML_ERROR_FILE_NOT_FOUND,
|
||||||
|
@ -1673,7 +1672,7 @@ public:
|
||||||
|
|
||||||
/// Return true if there was an error parsing the document.
|
/// Return true if there was an error parsing the document.
|
||||||
bool Error() const {
|
bool Error() const {
|
||||||
return _errorID != XML_NO_ERROR;
|
return _errorID != XML_SUCCESS;
|
||||||
}
|
}
|
||||||
/// Return the errorID.
|
/// Return the errorID.
|
||||||
XMLError ErrorID() const {
|
XMLError ErrorID() const {
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}</ProjectGuid>
|
<ProjectGuid>{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}</ProjectGuid>
|
||||||
<RootNamespace>test</RootNamespace>
|
<RootNamespace>test</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration">
|
||||||
|
@ -133,29 +134,25 @@
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'">
|
||||||
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
<IntDir>$(SolutionDir)$(Configuration)\</IntDir>
|
||||||
</PropertyGroup>
|
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'">
|
|
||||||
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
|
||||||
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
<IntDir>$(SolutionDir)$(Configuration)\</IntDir>
|
||||||
</PropertyGroup>
|
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
|
|
||||||
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'">
|
||||||
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
<IntDir>$(SolutionDir)$(Configuration)\</IntDir>
|
||||||
</PropertyGroup>
|
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'">
|
|
||||||
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
|
||||||
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
<IntDir>$(SolutionDir)$(Configuration)\</IntDir>
|
||||||
</PropertyGroup>
|
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
|
|
||||||
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'">
|
||||||
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
<ProjectGuid>{D1C528B6-AA02-4D29-9D61-DC08E317A70D}</ProjectGuid>
|
<ProjectGuid>{D1C528B6-AA02-4D29-9D61-DC08E317A70D}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>tinyxml2</RootNamespace>
|
<RootNamespace>tinyxml2</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration">
|
||||||
|
@ -140,13 +141,9 @@
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
|
||||||
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
|
||||||
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
@ -160,13 +157,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
|
||||||
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
|
||||||
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
|
10
xmltest.cpp
10
xmltest.cpp
|
@ -513,13 +513,13 @@ int main( int argc, const char ** argv )
|
||||||
double dVal;
|
double dVal;
|
||||||
|
|
||||||
result = ele->QueryDoubleAttribute( "attr0", &dVal );
|
result = ele->QueryDoubleAttribute( "attr0", &dVal );
|
||||||
XMLTest( "Query attribute: int as double", result, (int)XML_NO_ERROR );
|
XMLTest( "Query attribute: int as double", result, (int)XML_SUCCESS);
|
||||||
XMLTest( "Query attribute: int as double", (int)dVal, 1 );
|
XMLTest( "Query attribute: int as double", (int)dVal, 1 );
|
||||||
result = ele->QueryDoubleAttribute( "attr1", &dVal );
|
result = ele->QueryDoubleAttribute( "attr1", &dVal );
|
||||||
XMLTest( "Query attribute: double as double", result, (int)XML_NO_ERROR );
|
XMLTest( "Query attribute: double as double", result, (int)XML_SUCCESS);
|
||||||
XMLTest( "Query attribute: double as double", (int)dVal, 2 );
|
XMLTest( "Query attribute: double as double", (int)dVal, 2 );
|
||||||
result = ele->QueryIntAttribute( "attr1", &iVal );
|
result = ele->QueryIntAttribute( "attr1", &iVal );
|
||||||
XMLTest( "Query attribute: double as int", result, (int)XML_NO_ERROR );
|
XMLTest( "Query attribute: double as int", result, (int)XML_SUCCESS);
|
||||||
XMLTest( "Query attribute: double as int", iVal, 2 );
|
XMLTest( "Query attribute: double as int", iVal, 2 );
|
||||||
result = ele->QueryIntAttribute( "attr2", &iVal );
|
result = ele->QueryIntAttribute( "attr2", &iVal );
|
||||||
XMLTest( "Query attribute: not a number", result, (int)XML_WRONG_ATTRIBUTE_TYPE );
|
XMLTest( "Query attribute: not a number", result, (int)XML_WRONG_ATTRIBUTE_TYPE );
|
||||||
|
@ -1003,7 +1003,7 @@ int main( int argc, const char ** argv )
|
||||||
{
|
{
|
||||||
// This shouldn't crash.
|
// This shouldn't crash.
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
if(XML_NO_ERROR != doc.LoadFile( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ))
|
if(XML_SUCCESS != doc.LoadFile( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ))
|
||||||
{
|
{
|
||||||
doc.PrintError();
|
doc.PrintError();
|
||||||
}
|
}
|
||||||
|
@ -1256,7 +1256,7 @@ int main( int argc, const char ** argv )
|
||||||
static const char* xml_bom_preservation = "\xef\xbb\xbf<element/>\n";
|
static const char* xml_bom_preservation = "\xef\xbb\xbf<element/>\n";
|
||||||
{
|
{
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
XMLTest( "BOM preservation (parse)", XML_NO_ERROR, doc.Parse( xml_bom_preservation ), false );
|
XMLTest( "BOM preservation (parse)", XML_SUCCESS, doc.Parse( xml_bom_preservation ), false );
|
||||||
XMLPrinter printer;
|
XMLPrinter printer;
|
||||||
doc.Print( &printer );
|
doc.Print( &printer );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue