summaryrefslogtreecommitdiff
path: root/shared/tinyxml/xmltest.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:11:56 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:11:56 +0200
commit98ecf620f7de377dc8ae9ad7fbd1e3b24477e138 (patch)
treefaadc6d8822c20cd3bc6f50b2a98e6c580585949 /shared/tinyxml/xmltest.cpp
parent3.16 (diff)
downloadFreeFileSync-98ecf620f7de377dc8ae9ad7fbd1e3b24477e138.tar.gz
FreeFileSync-98ecf620f7de377dc8ae9ad7fbd1e3b24477e138.tar.bz2
FreeFileSync-98ecf620f7de377dc8ae9ad7fbd1e3b24477e138.zip
3.17
Diffstat (limited to 'shared/tinyxml/xmltest.cpp')
-rw-r--r--shared/tinyxml/xmltest.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/shared/tinyxml/xmltest.cpp b/shared/tinyxml/xmltest.cpp
index b4d3551c..7d920466 100644
--- a/shared/tinyxml/xmltest.cpp
+++ b/shared/tinyxml/xmltest.cpp
@@ -69,6 +69,19 @@ bool XmlTest( const char* testString, int expected, int found, bool noEcho )
}
+void NullLineEndings( char* p )
+{
+ while( p && *p )
+ {
+ if ( *p == '\n' || *p == '\r' )
+ {
+ *p = 0;
+ return;
+ }
+ ++p;
+ }
+}
+
//
// This file demonstrates some basic functionality of TinyXml.
// Note that the example is very contrived. It presumes you know
@@ -590,20 +603,30 @@ int main()
FILE* saved = fopen( "utf8testout.xml", "r" );
FILE* verify = fopen( "utf8testverify.xml", "r" );
+
+ //bool firstLineBOM=true;
if ( saved && verify )
{
while ( fgets( verifyBuf, 256, verify ) )
{
fgets( savedBuf, 256, saved );
- if ( strcmp( verifyBuf, savedBuf ) )
+ NullLineEndings( verifyBuf );
+ NullLineEndings( savedBuf );
+
+ if ( /*!firstLineBOM && */ strcmp( verifyBuf, savedBuf ) )
{
+ printf( "verify:%s<\n", verifyBuf );
+ printf( "saved :%s<\n", savedBuf );
okay = 0;
break;
}
+ //firstLineBOM = false;
}
+ }
+ if ( saved )
fclose( saved );
+ if ( verify )
fclose( verify );
- }
XmlTest( "UTF-8: Verified multi-language round trip.", 1, okay );
// On most Western machines, this is an element that contains
@@ -1327,6 +1350,13 @@ int main()
}
{
+ // This one must not result in an infinite loop
+ TiXmlDocument xml;
+ xml.Parse( "<infinite>loop" );
+ XmlTest( "Infinite loop test.", true, true );
+ }
+
+ {
// 1709904 - can not repro the crash
{
TiXmlDocument xml;
@@ -1355,6 +1385,7 @@ int main()
xml.Print(stdout);
}
*/
+
#if defined( WIN32 ) && defined( TUNE )
_CrtMemCheckpoint( &endMemState );
//_CrtMemDumpStatistics( &endMemState );
bgstack15