166 Commits
2.1.0 ... 3.0.0

Author SHA1 Message Date
Lee Thomason
1977a7258c setting the version to 3.0.0 2015-03-17 21:30:01 -07:00
Lee Thomason
b53aaa885d set the version to 2.3.0 2015-03-15 16:18:35 -07:00
Lee Thomason
245bee08d6 Merge pull request #296 from Dmitry-Me/assertForImpossibleCase
Assert for impossible case
2015-03-15 16:14:12 -07:00
Lee Thomason
80647bde2e Merge remote-tracking branch 'origin/master' 2015-03-15 16:12:51 -07:00
Lee Thomason
7265b763fc merge change; add extra assert 2015-03-15 16:11:47 -07:00
Lee Thomason
ed9aa5a48e Merge pull request #293 from Dmitry-Me/resolveIssue291
Resolve crash when printing malformed entities - issue 291
2015-03-15 16:06:42 -07:00
Dmitry-Me
33bb764d12 Assert for impossible case 2015-03-14 17:14:00 +03:00
Dmitry-Me
bab9b6d59c More asserts in numbers parsing 2015-03-14 16:41:46 +03:00
Dmitry-Me
6f51c803a1 Resolve crash when printing malformed entities - issue 291 2015-03-14 13:25:03 +03:00
Lee Thomason
0f922e7c9a Merge pull request #289 from Dmitry-Me/fixNullPointerDereference
Fix null pointer dereference planted in PR287 and reported in PR288
2015-03-05 10:36:31 -08:00
Dmitry-Me
9fcb876d3b Fix null pointer dereference planted in PR287 and reported in PR288 2015-03-05 17:53:34 +03:00
Lee Thomason
f12ece06fa Merge pull request #287 from Dmitry-Me/preAndPostAssertsInIdentify
Add and make use of pre- and post-asserts in XMLDocument::Identify()
2015-03-04 15:38:37 -08:00
Dmitry-Me
023846628d Add and make use of pre- and post-asserts in XMLDocument::Identify() 2015-03-03 16:02:13 +03:00
Lee Thomason
1354ffabb6 Merge pull request #284 from Dmitry-Me/testDocumentBeforeClearing
Test document had content to clear
2015-02-09 12:12:10 -08:00
Dmitry-Me
aaa4ceab5e Test document had content to clear 2015-02-06 16:00:46 +03:00
Lee Thomason
03824c305d Merge pull request #280 from Dmitry-Me/moveDeclarationToFirstUse
Move declaration to actual first use
2015-01-19 15:38:04 -08:00
Dmitry-Me
6acc9a5469 Move declaration to actual first use 2015-01-15 13:27:47 +03:00
Lee Thomason
b733c26bfe Merge pull request #278 from Dmitry-Me/wrongBoundConstraints
Use proper constraints for int variable
2015-01-13 21:45:29 -08:00
Lee Thomason
2875d842de Merge pull request #277 from Dmitry-Me/preAssertsToClarifyBufferUsage
Pre-asserts to clarify buffer usage
2015-01-13 21:44:54 -08:00
Lee Thomason
e94bde04d2 Merge pull request #276 from Dmitry-Me/removeRedundantParametersList
Remove redundant parameters list
2015-01-13 21:44:10 -08:00
Dmitry-Me
ed7a7dc985 Use proper constraints for int variable 2015-01-14 08:36:12 +03:00
Dmitry-Me
30bdc9735b Pre-asserts to clarify buffer usage 2015-01-14 08:32:23 +03:00
Dmitry-Me
9a5a48dbd2 Remove redundant parameters list 2015-01-14 08:27:32 +03:00
Lee Thomason
38b49ae042 Merge pull request #275 from Dmitry-Me/moreOverflowChecks
More overflow checks
2015-01-13 13:40:25 -08:00
Lee Thomason
d95716bd79 Merge pull request #273 from Dmitry-Me/moreChecksInUtfConversion
More checks inside UTF conversion
2015-01-13 13:39:46 -08:00
Lee Thomason
22f34982dc Merge pull request #271 from JayXon/optimizeLogo
lossless optimization on logo
2015-01-13 13:39:02 -08:00
Dmitry-Me
74fb870c36 More overflow checks 2015-01-13 10:27:36 +03:00
Lee Thomason
7e67bc89de minor formatting changes 2015-01-12 14:05:12 -08:00
Lee Thomason
ba7d9df976 Merge pull request #272 from Dmitry-Me/properTreatStrchrPostConditions
strchr() can only find what is was asked for
2015-01-12 13:58:15 -08:00
Dmitry-Me
bbaf1e1498 More checks inside UTF conversion 2015-01-12 14:07:10 +03:00
Dmitry-Me
9f56e12c16 strchr() can only find what is was asked for 2015-01-12 10:07:54 +03:00
JayXon
778b391286 lossless optimization on logo
was
325 KB (333,465 bytes)
now
209 KB (214,977 bytes)
2015-01-10 01:46:26 -05:00
Lee Thomason
d15686653a Merge pull request #269 from Dmitry-Me/makeFormattingConsistent
Fix formatting, get rid of useless if-else chain
2015-01-09 16:57:17 -08:00
Lee Thomason
f802660f7d Merge pull request #268 from Dmitry-Me/avoidRepeatedComparisons
Get rid of repeated comparisons
2015-01-09 16:56:40 -08:00
Lee Thomason
e4fe285427 Merge pull request #267 from Dmitry-Me/prohibitCopyAndAssignment
Prohibit copy and assigment where they are not supported
2015-01-09 16:55:27 -08:00
Lee Thomason
b389252931 Merge pull request #264 from Dmitry-Me/makeProhibitedStuffPrivate
Prohibited operations should be declared private
2015-01-09 16:55:07 -08:00
Lee Thomason
e53740ec6a Merge pull request #263 from Dmitry-Me/useProperConstCast
Use explicit const_cast
2015-01-09 14:29:05 -08:00
Dmitry-Me
257e11b25b Fix formatting, get rid of useless if-else chain 2015-01-09 15:50:47 +03:00
Dmitry-Me
3ae4f3eb3c Get rid of repeated comparisons 2015-01-09 15:44:16 +03:00
Dmitry-Me
3e0af3793e Prohibit copy and assigment where they are not supported 2015-01-09 15:30:00 +03:00
Dmitry-Me
f547a99619 Prohibited operations should be declared private 2015-01-09 15:17:09 +03:00
Dmitry-Me
e28be7530c Use explicit const_cast 2015-01-09 14:59:30 +03:00
Lee Thomason
3cebdc4fac clean up function names. clean up pointer 2015-01-05 17:16:28 -08:00
Lee Thomason
75b4e23957 Merge pull request #260 from Dmitry-Me/placeChecksInMoreNaturalOrder
Rearrange checks in more natural order
2015-01-05 17:07:50 -08:00
Lee Thomason
6e504e9baf Merge pull request #259 from Dmitry-Me/preAndPostAssertsInGetStr
Pointer asserts in GetStr()
2015-01-05 17:07:06 -08:00
Lee Thomason
59946f6f1a Merge pull request #258 from Dmitry-Me/clarifyIsNameStart
Clarify IsNameStartChar() - resolve issue 250
2015-01-05 17:06:30 -08:00
Lee Thomason
625402a01f Merge pull request #257 from Dmitry-Me/reusePreInsertMagic
Reuse pre-insert manipulations
2015-01-05 17:05:23 -08:00
Lee Thomason
56223ddaea Merge pull request #256 from Dmitry-Me/reuseParseAdjustments
Reuse code with pre-parse adjustments
2015-01-05 17:04:04 -08:00
Lee Thomason
deccff765f Merge pull request #254 from JayXon/onlyCheckElementPointerOnce
Only check ele pointer once
2015-01-05 17:00:43 -08:00
Dmitry-Me
7a7e5dc525 Rearrange checks in more natural order 2015-01-01 17:58:35 +03:00
Dmitry-Me
5ffa73e979 Pointer asserts in GetStr() 2015-01-01 17:47:40 +03:00
Dmitry-Me
ea617f9380 Clarify IsNameStartChar() - resolve issue 250 2015-01-01 16:32:01 +03:00
Dmitry-Me
74e394023a Reuse pre-insert manipulations 2015-01-01 16:26:17 +03:00
Dmitry-Me
97476b7b9e Reuse code with pre-parse adjustments 2015-01-01 16:15:57 +03:00
Lee Thomason
b4e81b014e Merge pull request #253 from Dmitry-Me/getRidOfC4127InAssert
Suppress C4127 in asserts
2014-12-26 16:25:14 -08:00
Lee Thomason
6d12b7bc3d Merge pull request #252 from Dmitry-Me/moreAdequateTestForEmpty
Better tests for empty document
2014-12-26 16:22:25 -08:00
Lee Thomason
5f06297230 Merge pull request #248 from JayXon/simplifyParseName
Simplify ParseName
2014-12-26 16:18:46 -08:00
Lee Thomason
9af6ccb3da fix whitespace conflict 2014-12-26 12:22:30 -08:00
Lee Thomason
78120c2a1e Merge pull request #249 from Dmitry-Me/unifySkipWhiteSpaceCallsAddAsserts
Unify SkipWhiteSpace()/ReadBOM() calls, add asserts
2014-12-26 12:22:55 -08:00
Lee Thomason
ac503ea88a Merge remote-tracking branch 'origin/master' 2014-12-26 12:20:18 -08:00
Lee Thomason
20806ce4e4 add an extra assert 2014-12-26 12:20:07 -08:00
JayXon
e4bf6e360d Only check ele pointer once 2014-12-26 01:00:24 -05:00
Dmitry-Me
4bcbf142a8 Suppress C4127 in asserts 2014-12-25 19:05:18 +03:00
Dmitry-Me
588bb8de49 Better tests for empty document 2014-12-25 18:59:18 +03:00
JayXon
ee525dba4d Simplify ParseName
Only the first char needs to be checked with IsNameStartChar, so check
it before the loop.
2014-12-24 04:01:42 -05:00
Dmitry-Me
bb836dce57 Unify SkipWhiteSpace()/ReadBOM() calls, add asserts 2014-12-24 11:54:05 +03:00
Lee Thomason
69242c4b9b Merge pull request #247 from Dmitry-Me/combineCheckWithDependentCall
Move the check into dependent call
2014-12-23 13:16:11 -08:00
Lee Thomason
ffee345723 Merge pull request #246 from Dmitry-Me/moveVariableDeclaration
Move variable declaration closer to where it's needed
2014-12-23 13:12:38 -08:00
Dmitry-Me
a092bc1f5a Move the check into dependent call 2014-12-23 17:57:05 +03:00
Dmitry-Me
5b4a5169e3 Move variable declaration closer to where it's needed 2014-12-23 17:36:28 +03:00
Lee Thomason
eaddfd8768 Merge pull request #245 from Dmitry-Me/ensureCapacityPreAsserts
Pre-asserts to ensure no overflow happens
2014-12-22 11:27:43 -08:00
Lee Thomason
4e5900c5e8 Merge pull request #244 from Dmitry-Me/unifyCharacterCasts
Unify character casts, reorganize checks
2014-12-22 11:26:52 -08:00
Lee Thomason
0b4bdd2a47 Merge pull request #243 from JayXon/simplify_node_logic
Simplify node logic
2014-12-22 11:22:47 -08:00
Dmitry-Me
9fae869124 Pre-asserts to ensure no overflow happens 2014-12-22 17:59:59 +03:00
Dmitry-Me
8b67d741d4 Unify character casts, reorganize checks 2014-12-22 11:35:12 +03:00
Lee Thomason
ebb0c8f904 fix compiler warning 2014-12-17 10:50:32 -08:00
Lee Thomason
7334f9efab fix a clang warning 2014-12-17 10:43:48 -08:00
Lee Thomason
cd011bc1b7 start working through memory bugs 2014-12-17 10:41:34 -08:00
JayXon
dbfdd8fdd5 Simplify node logic 2014-12-12 20:07:14 -05:00
Lee Thomason
ee2c46928e Merge pull request #240 from Dmitry-Me/simplifyNodeOwnershipTracking
Even more pointer pre-asserts
2014-12-12 15:37:22 -08:00
Dmitry-Me
ed2a407a88 Add more pointer pre-asserts 2014-12-12 10:38:48 +03:00
Lee Thomason
b38d29a8c5 Merge pull request #241 from Dmitry-Me/validatePoolBlockSizeBeforeAllocation
Validate pool block has the right size before calling placement new
2014-12-11 15:25:20 -08:00
Dmitry-Me
e6a95ce50e Validate pool block has the right size before calling placement new 2014-12-10 09:10:27 +03:00
Lee Thomason
f0e8fac4ee Merge pull request #239 from Dmitry-Me/addMorePointerAsserts
More pointer pre-asserts
2014-12-09 11:14:16 -08:00
Lee Thomason
489e5f30a2 Merge pull request #238 from Dmitry-Me/dontImplicitlyConvertErrorID
Should not check errorID with implicit conversion
2014-12-09 11:03:49 -08:00
Dmitry-Me
abb2d046d0 More pointers pre-asserts 2014-12-09 12:59:31 +03:00
Dmitry-Me
9bcd9c7674 Should not check errorID with implicit conversion 2014-12-09 10:58:14 +03:00
Lee Thomason
e6328b81f7 Merge pull request #237 from Dmitry-Me/resolveIssue176
Resolve issue 176
2014-12-08 11:56:17 -08:00
Dmitry-Me
a317bd66a6 Resolve issue 176 2014-12-08 10:35:37 +03:00
Lee Thomason
5c5307013a Merge pull request #235 from Dmitry-Me/reuseFindAttribute
Reuse const FindAttribute for non-const version thereof
2014-12-05 10:26:57 -08:00
Dmitry-Me
1227d51ed0 Reuse const FindAttribute for non-const version thereof 2014-12-05 13:41:45 +03:00
Lee Thomason
7254cf7e57 Merge pull request #234 from Dmitry-Me/errorCheckingNeverWorked
Error checking never actually checked anything
2014-11-28 13:54:55 -08:00
Dmitry-Me
ab37df8d67 Error checking never actually checked anything 2014-11-28 12:08:36 +03:00
Lee Thomason
2114e47453 Merge pull request #230 from antonindrawan/master
Compile TinyXml2 with the Dinkum C++ of QNX 6.5 and QNX 6.6.
2014-11-27 22:34:34 -08:00
Lee Thomason
18f5d7f133 Merge branch 'Dmitry-Me-properStrPairAssignment' 2014-11-27 22:31:37 -08:00
Lee Thomason
2965880447 switch to using pointer, not reference 2014-11-27 22:31:11 -08:00
Anton Indrawan
8a0006ceda Compile TinyXml2 with the Dinkum C++ of QNX 6.5 and QNX 6.6. Processed review comment from leethomason 2014-11-20 18:27:07 +01:00
Anton Indrawan
f59e2d6a89 Compile TinyXml2 with the Dinkum C++ of QNX 6.5 and QNX 6.6.
When we include c++ headers, we have to use explicit std::
2014-11-18 20:50:42 +01:00
Lee Thomason
f5d1d9ead2 Merge remote-tracking branch 'origin/master' 2014-11-15 17:56:08 -08:00
Lee Thomason
b2ec17dd5f very minor cleanup of commented out code 2014-11-15 17:55:40 -08:00
Lee Thomason
a94fc98396 Merge pull request #229 from xantares/test
Rename test, fixed cmake warning.
2014-11-15 17:55:14 -08:00
Lee Thomason
c82446c81e Merge pull request #228 from xantares/shared
Use BUILD_SHARED_LIBS cmake standard.
2014-11-15 17:55:04 -08:00
Lee Thomason
03494b189c Merge remote-tracking branch 'origin/master' into Dmitry-Me-properStrPairAssignment 2014-11-15 17:50:17 -08:00
Lee Thomason
575f190412 fix merge of operator= 2014-11-15 17:50:15 -08:00
Lee Thomason
327d5c142e Merge branch 'properStrPairAssignment' of https://github.com/Dmitry-Me/tinyxml2 into Dmitry-Me-properStrPairAssignment 2014-11-15 17:46:23 -08:00
Lee Thomason
92e521b431 add simple test for not-crashing 2014-11-15 17:45:51 -08:00
xantares
0b2c22bd46 Rename test, fixed cmake warning. 2014-11-14 19:46:18 +01:00
xantares
c8ec6fcab4 Use BUILD_SHARED_LIBS cmake standard. 2014-11-14 19:40:58 +01:00
Dmitry-Me
08b40dd8a5 Implement "move" equivalent of assignment operator for StrPair 2014-11-10 11:17:21 +03:00
Lee Thomason
1cd7e7422c Merge pull request #226 from Dmitry-Me/addPreAssertFixComment
Add pre-assert, fix comment
2014-11-08 16:58:16 -08:00
Dmitry-Me
66d2a84715 Add pre-assert, fix comment 2014-11-08 15:24:52 +03:00
Lee Thomason
97cfa03865 Merge pull request #221 from Dmitry-Me/reuseIsWhiteSpace
Reuse IsWhiteSpace(), move comment.
2014-10-31 15:55:20 -07:00
Dmitry-Me
fa20b227a3 Reuse IsWhiteSpace(), move comment. 2014-10-31 12:53:04 +03:00
Lee Thomason
0826e9632f Merge pull request #220 from tolga9009/patch-1
removing accidentally added newline
2014-10-30 16:49:10 -07:00
Tolga Cakir
78eee7299f removing accidentally added newline 2014-10-30 23:08:39 +01:00
Lee Thomason
4de01a9489 Merge pull request #218 from Dmitry-Me/enableLeakTracing
Enable dump of debug heap memory leaks
2014-10-30 14:17:34 -07:00
Lee Thomason
f07b952296 fix issue 184. clean up xcode project. 2014-10-30 13:25:12 -07:00
Dmitry-Me
99916599da Enable dump of debug heap memory leaks 2014-10-23 11:37:03 +04:00
Lee Thomason
d211bb1351 Merge pull request #216 from Dmitry-Me/removeRepeatedIndexAccesses
Bind reference to avoid repeated accesses by index
2014-10-01 14:22:38 -07:00
Dmitry-Me
d048f1e8e3 Bind reference to avoid repeated accesses by index 2014-10-01 10:30:16 +04:00
Lee Thomason
0895e78549 Merge pull request #215 from Dmitry-Me/duplicateVirtualCalls2
Remove unneeded virtual calls
2014-09-29 16:19:00 -07:00
Dmitry-Me
097339a099 Remove unneeded virtual calls 2014-09-29 13:20:29 +04:00
Lee Thomason
f2496f5824 Merge pull request #214 from Dmitry-Me/duplicateVirtualCalls
Eliminate repeated virtual calls
2014-09-27 15:58:19 -07:00
Lee Thomason
853de8169b Merge pull request #213 from Dmitry-Me/likelyWrongSignature
Function signature is most likely wrong
2014-09-27 15:57:53 -07:00
Lee Thomason
869f1487e2 Merge pull request #212 from Dmitry-Me/reuseConstForNonConst
Reuse const version for non-const one
2014-09-27 15:56:42 -07:00
Dmitry-Me
6d202ff20e Eliminate repeated virtual calls 2014-09-26 14:21:00 +04:00
Dmitry-Me
72bb0ecc39 Function signature is most likely wrong 2014-09-24 16:14:24 +04:00
Dmitry-Me
9de541f465 Reuse const version for non-const one 2014-09-24 14:21:36 +04:00
Lee Thomason
b0776aeead Merge pull request #210 from Dmitry-Me/removeUnneededCast
Remove unneeded cast, reduce duplication, move declarations to their fir...
2014-09-23 16:52:51 -07:00
Dmitry-Me
9fb2b0f42c Remove unneeded cast, reduce duplication, move declarations to their first use. 2014-09-23 17:27:39 +04:00
Lee Thomason
5321a0e21f setting the version to 2.2.0 2014-09-14 12:47:24 -07:00
Lee Thomason
c755667aa0 add an error message 2014-09-14 12:39:42 -07:00
Lee Thomason
331596e83c clean up the scope and names of the error code. 2014-09-11 14:56:43 -07:00
numatrumpet
cd8550c29c Without using preprocessor 2014-09-08 16:59:39 +09:00
numatrumpet
9f52ad5289 Makefile is recovered to original version 2014-09-08 16:41:33 +09:00
numatrumpet
003368429f ErrorNames is not implemented by vector<string> but *char[] 2014-09-08 16:36:28 +09:00
numatrumpet
8f5d3f8e80 make works correctly when using clang++ 2014-09-06 23:09:14 +09:00
numatrumpet
bb5ffac22d Using C++11, XMLUtil::ToErrorName(XMLError) returns the name of error type 2014-09-06 22:56:46 +09:00
Lee Thomason
fb732f97d4 Merge pull request #205 from Dmitry-Me/moveDefinitionsToLoopHeaders
Move loop variable definition into loop headers
2014-09-04 12:59:25 -07:00
Dmitry-Me
3659fe1d33 Move loop variable definition into loop headers 2014-09-04 11:33:49 +04:00
Lee Thomason
cf6d886903 Merge pull request #204 from Dmitry-Me/convertMacrosIntoFunctions
Convert DELETE_X macros into functions
2014-09-03 21:53:54 -07:00
Dmitry-Me
e3225b1c64 Convert DELETE_X macros into functions 2014-09-03 11:03:11 +04:00
Lee Thomason
30152836da Merge pull request #202 from Dmitry-Me/removeRepeatedVirtualCalls
Remove repeated virtual calls
2014-08-28 04:53:51 -07:00
Lee Thomason
83a6d8c373 Merge remote-tracking branch 'origin/master' 2014-08-27 14:45:53 -07:00
Lee Thomason
d526944e3c removed unused _accumulator 2014-08-27 14:45:35 -07:00
Dmitry-Me
b6b4e82626 Remove repeated virtual calls 2014-08-27 17:17:47 +04:00
Lee Thomason
59b9aaea43 Merge pull request #200 from Dmitry-Me/removeObsoleteComment
Remove obsolete comment
2014-08-25 13:46:37 -07:00
Dmitry-Me
ec19a0e513 Remove obsolete comment 2014-08-25 11:05:55 +04:00
Lee Thomason
b6ea923f0f Merge branch 'Dmitry-Me-makeCodeMoreDefensive' 2014-08-23 16:16:38 -07:00
Dmitry-Me
63f3de1a3c Make code more defensive
* initialize out-parameter for cases the callee fails to
* add assert for length being within range
* replace post-assert with pre-assert

Also replace the loop with an equivalent memcpy() call
2014-08-21 12:33:19 +04:00
Lee Thomason
dc50a31758 Merge pull request #197 from Dmitry-Me/dontAdjustStartWhenNeedsDelete
Assert when trying to adjust _start in "needs delete" mode.
2014-08-20 10:03:43 -07:00
Dmitry-Me
67a5bb0ac1 Assert when trying to adjust _start in "needs delete" mode. 2014-08-20 10:01:53 +04:00
Lee Thomason
0b26702ac9 Merge pull request #196 from Dmitry-Me/wrapFopenCalls
Wrap fopen()/fopen_s() calls to avoid duplication
2014-08-19 11:18:52 -07:00
Dmitry-Me
01578db56b Wrap fopen()/fopen_s() calls to avoid duplication 2014-08-19 10:18:48 +04:00
Lee Thomason
2af5679b26 Merge pull request #194 from Dmitry-Me/fixCStyleCast
Replace C-style cast with static_cast
2014-08-17 14:55:39 -07:00
Dmitry-Me
5657176b61 Replace C-style cast with static_cast 2014-08-15 11:03:47 +04:00
Lee Thomason
73c822c201 Merge pull request #193 from Dmitry-Me/shouldCheckFtellForError
Check ftell() result for error code before using it.
2014-08-14 16:46:13 -07:00
Dmitry-Me
acb9c9c260 Check ftell() result for error code before using it. 2014-08-04 09:49:25 +04:00
Lee Thomason
fca00d0ebc Merge pull request #191 from Dmitry-Me/dontIgnoreFgetcReturnValue
fgetc() is not required to clear the error indicator on success
2014-08-03 11:17:04 -07:00
Dmitry-Me
08e7f7be59 fgetc() is not required to clear the error indicator on success 2014-07-31 15:19:14 +04:00
Lee Thomason
84bd9624c6 Merge pull request #190 from pffang/master
WinCE Compatibility Fix
2014-07-12 11:22:30 -07:00
pffang
91d34a0989 WinCE Compatibility Fix 2014-07-10 10:02:35 +08:00
Lee Thomason
cf33e37d25 Merge pull request #187 from amai2012/master
Fix compiler warning: extra ';' after member function definition
2014-05-20 13:56:47 -07:00
Alexander Mai
d740b64044 Fix compiler warning: extra ';' after member function definition 2014-05-20 22:04:42 +02:00
Lee Thomason
500fb6aa21 Merge pull request #181 from eserdem/master
Fixed _CRT_SECURE_NO_WARNINGS macro redefinition warning
2014-04-17 10:07:50 -07:00
Serhat Eser Erdem
ca5d684a2b Fixed _CRT_SECURE_NO_WARNINGS macro redefinition warning 2014-04-17 14:06:15 +02:00
8 changed files with 635 additions and 361 deletions

View File

@@ -10,8 +10,8 @@ include(GNUInstallDirs)
################################
# set lib version here
set(GENERIC_LIB_VERSION "2.1.0")
set(GENERIC_LIB_SOVERSION "2")
set(GENERIC_LIB_VERSION "3.0.0")
set(GENERIC_LIB_SOVERSION "3")
################################
@@ -46,33 +46,24 @@ endif(MSVC)
################################
# Add targets
set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries")
if(BUILD_STATIC_LIBS)
add_library(tinyxml2static STATIC tinyxml2.cpp tinyxml2.h)
set_target_properties(tinyxml2static PROPERTIES OUTPUT_NAME tinyxml2)
endif(BUILD_STATIC_LIBS)
add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h)
option(BUILD_SHARED_LIBS "build shared or static libraries" ON)
add_library(tinyxml2 tinyxml2.cpp tinyxml2.h)
set_target_properties(tinyxml2 PROPERTIES
COMPILE_DEFINITIONS "TINYXML2_EXPORT"
VERSION "${GENERIC_LIB_VERSION}"
SOVERSION "${GENERIC_LIB_SOVERSION}")
add_executable(test xmltest.cpp)
add_dependencies(test tinyxml2)
add_dependencies(test ${TARGET_DATA_COPY})
target_link_libraries(test tinyxml2)
add_executable(xmltest xmltest.cpp)
add_dependencies(xmltest tinyxml2)
add_dependencies(xmltest ${TARGET_DATA_COPY})
target_link_libraries(xmltest tinyxml2)
if(BUILD_STATIC_LIBS)
install(TARGETS tinyxml2 tinyxml2static
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
else(BUILD_STATIC_LIBS)
install(TARGETS tinyxml2
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(BUILD_STATIC_LIBS)
install(TARGETS tinyxml2
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
foreach(p LIB INCLUDE)
@@ -85,4 +76,4 @@ endforeach()
configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
#add_test(test ${SAMPLE_NAME} COMMAND $<TARGET_FILE:${SAMPLE_NAME}>)
#add_test(xmltest ${SAMPLE_NAME} COMMAND $<TARGET_FILE:${SAMPLE_NAME}>)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 KiB

After

Width:  |  Height:  |  Size: 210 KiB

2
dox
View File

@@ -38,7 +38,7 @@ PROJECT_NAME = "TinyXML-2"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 2.1.0
PROJECT_NUMBER = 3.0.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@@ -116,6 +116,8 @@ print( "Release note:" )
print( '1. Build. g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe' )
print( '2. Commit. git commit -am"setting the version to ' + versionStr + '"' )
print( '3. Tag. git tag ' + versionStr )
print( ' OR git tag -a ' + versionStr + ' -m <tag message>' )
print( 'Remember to "git push" both code and tag.' )
print( ' OR git tag -a ' + versionStr + ' -m [tag message]' )
print( 'Remember to "git push" both code and tag. For the tag:' )
print( 'git push origin [tagname]')

File diff suppressed because it is too large Load Diff

View File

@@ -14,7 +14,6 @@ not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
@@ -25,7 +24,7 @@ distribution.
#ifndef TINYXML2_INCLUDED
#define TINYXML2_INCLUDED
#if defined(ANDROID_NDK) || defined(__BORLANDC__)
#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)
# include <ctype.h>
# include <limits.h>
# include <stdio.h>
@@ -78,7 +77,8 @@ distribution.
#if defined(DEBUG)
# if defined(_MSC_VER)
# define TIXMLASSERT( x ) if ( !(x)) { __debugbreak(); } //if ( !(x)) WinDebugBreak()
# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like
# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); } //if ( !(x)) WinDebugBreak()
# elif defined (ANDROID_NDK)
# include <android/log.h>
# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); }
@@ -91,7 +91,7 @@ distribution.
#endif
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
// Microsoft visual studio, version 2005 and higher.
/*int _snprintf_s(
char *buffer,
@@ -109,6 +109,9 @@ inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... )
return result;
}
#define TIXML_SSCANF sscanf_s
#elif defined WINCE
#define TIXML_SNPRINTF _snprintf
#define TIXML_SSCANF sscanf
#else
// GCC version 3 and higher
//#warning( "Using sn* functions." )
@@ -119,8 +122,8 @@ inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... )
/* Versioning, past 1.0.14:
http://semver.org/
*/
static const int TIXML2_MAJOR_VERSION = 2;
static const int TIXML2_MINOR_VERSION = 1;
static const int TIXML2_MAJOR_VERSION = 3;
static const int TIXML2_MINOR_VERSION = 0;
static const int TIXML2_PATCH_VERSION = 0;
namespace tinyxml2
@@ -182,6 +185,8 @@ public:
char* ParseText( char* in, const char* endTag, int strFlags );
char* ParseName( char* in );
void TransferTo( StrPair* other );
private:
void Reset();
void CollapseWhitespace();
@@ -195,6 +200,9 @@ private:
int _flags;
char* _start;
char* _end;
StrPair( const StrPair& other ); // not supported
void operator=( StrPair& other ); // not supported, use TransferTo()
};
@@ -207,7 +215,7 @@ template <class T, int INIT>
class DynArray
{
public:
DynArray< T, INIT >() {
DynArray() {
_mem = _pool;
_allocated = INIT;
_size = 0;
@@ -224,11 +232,14 @@ public:
}
void Push( T t ) {
TIXMLASSERT( _size < INT_MAX );
EnsureCapacity( _size+1 );
_mem[_size++] = t;
}
T* PushArr( int count ) {
TIXMLASSERT( count >= 0 );
TIXMLASSERT( _size <= INT_MAX - count );
EnsureCapacity( _size+count );
T* ret = &_mem[_size];
_size += count;
@@ -236,6 +247,7 @@ public:
}
T Pop() {
TIXMLASSERT( _size > 0 );
return _mem[--_size];
}
@@ -258,12 +270,13 @@ public:
return _mem[i];
}
const T& PeekTop() const {
const T& PeekTop() const {
TIXMLASSERT( _size > 0 );
return _mem[ _size - 1];
}
int Size() const {
TIXMLASSERT( _size >= 0 );
return _size;
}
@@ -280,8 +293,13 @@ public:
}
private:
DynArray( const DynArray& ); // not supported
void operator=( const DynArray& ); // not supported
void EnsureCapacity( int cap ) {
TIXMLASSERT( cap > 0 );
if ( cap > _allocated ) {
TIXMLASSERT( cap <= INT_MAX / 2 );
int newAllocated = cap * 2;
T* newMem = new T[newAllocated];
memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs
@@ -314,6 +332,7 @@ public:
virtual void* Alloc() = 0;
virtual void Free( void* ) = 0;
virtual void SetTracked() = 0;
virtual void Clear() = 0;
};
@@ -326,10 +345,20 @@ class MemPoolT : public MemPool
public:
MemPoolT() : _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
~MemPoolT() {
Clear();
}
void Clear() {
// Delete the blocks.
for( int i=0; i<_blockPtrs.Size(); ++i ) {
delete _blockPtrs[i];
while( !_blockPtrs.Empty()) {
Block* b = _blockPtrs.Pop();
delete b;
}
_root = 0;
_currentAllocs = 0;
_nAllocs = 0;
_maxAllocs = 0;
_nUntracked = 0;
}
virtual int ItemSize() const {
@@ -362,12 +391,13 @@ public:
_nUntracked++;
return result;
}
virtual void Free( void* mem ) {
if ( !mem ) {
return;
}
--_currentAllocs;
Chunk* chunk = (Chunk*)mem;
Chunk* chunk = static_cast<Chunk*>( mem );
#ifdef DEBUG
memset( chunk, 0xfe, sizeof(Chunk) );
#endif
@@ -399,6 +429,9 @@ public:
enum { COUNT = (4*1024)/SIZE }; // Some compilers do not accept to use COUNT in private part if COUNT is private
private:
MemPoolT( const MemPoolT& ); // not supported
void operator=( const MemPoolT& ); // not supported
union Chunk {
Chunk* next;
char mem[SIZE];
@@ -477,6 +510,33 @@ public:
}
};
// WARNING: must match XMLDocument::_errorNames[]
enum XMLError {
XML_SUCCESS = 0,
XML_NO_ERROR = 0,
XML_NO_ATTRIBUTE,
XML_WRONG_ATTRIBUTE_TYPE,
XML_ERROR_FILE_NOT_FOUND,
XML_ERROR_FILE_COULD_NOT_BE_OPENED,
XML_ERROR_FILE_READ_ERROR,
XML_ERROR_ELEMENT_MISMATCH,
XML_ERROR_PARSING_ELEMENT,
XML_ERROR_PARSING_ATTRIBUTE,
XML_ERROR_IDENTIFYING_TAG,
XML_ERROR_PARSING_TEXT,
XML_ERROR_PARSING_CDATA,
XML_ERROR_PARSING_COMMENT,
XML_ERROR_PARSING_DECLARATION,
XML_ERROR_PARSING_UNKNOWN,
XML_ERROR_EMPTY_DOCUMENT,
XML_ERROR_MISMATCHED_ELEMENT,
XML_ERROR_PARSING,
XML_CAN_NOT_CONVERT_TEXT,
XML_NO_TEXT_NODE,
XML_ERROR_COUNT
};
/*
Utility functionality.
@@ -484,28 +544,33 @@ public:
class XMLUtil
{
public:
// Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't
// correct, but simple, and usually works.
static const char* SkipWhiteSpace( const char* p ) {
while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast<const unsigned char*>(p) ) ) {
TIXMLASSERT( p );
while( IsWhiteSpace(*p) ) {
++p;
}
TIXMLASSERT( p );
return p;
}
static char* SkipWhiteSpace( char* p ) {
while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast<unsigned char*>(p) ) ) {
++p;
}
return p;
return const_cast<char*>( SkipWhiteSpace( const_cast<const char*>(p) ) );
}
// Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't
// correct, but simple, and usually works.
static bool IsWhiteSpace( char p ) {
return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
}
inline static bool IsNameStartChar( unsigned char ch ) {
return ( ( ch < 128 ) ? isalpha( ch ) : 1 )
|| ch == ':'
|| ch == '_';
if ( ch >= 128 ) {
// This is a heuristic guess in attempt to not implement Unicode-aware isalpha()
return true;
}
if ( isalpha( ch ) ) {
return true;
}
return ch == ':' || ch == '_';
}
inline static bool IsNameChar( unsigned char ch ) {
@@ -516,10 +581,10 @@ public:
}
inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) {
int n = 0;
if ( p == q ) {
return true;
}
int n = 0;
while( *p && *q && *p == *q && n<nChar ) {
++p;
++q;
@@ -531,8 +596,8 @@ public:
return false;
}
inline static int IsUTF8Continuation( const char p ) {
return p & 0x80;
inline static bool IsUTF8Continuation( const char p ) {
return ( p & 0x80 ) != 0;
}
static const char* ReadBOM( const char* p, bool* hasBOM );
@@ -828,8 +893,6 @@ public:
protected:
XMLNode( XMLDocument* );
virtual ~XMLNode();
XMLNode( const XMLNode& ); // not supported
XMLNode& operator=( const XMLNode& ); // not supported
XMLDocument* _document;
XMLNode* _parent;
@@ -844,6 +907,11 @@ protected:
private:
MemPool* _memPool;
void Unlink( XMLNode* child );
static void DeleteNode( XMLNode* node );
void InsertChildPreamble( XMLNode* insertThis ) const;
XMLNode( const XMLNode& ); // not supported
XMLNode& operator=( const XMLNode& ); // not supported
};
@@ -889,11 +957,12 @@ public:
protected:
XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {}
virtual ~XMLText() {}
XMLText( const XMLText& ); // not supported
XMLText& operator=( const XMLText& ); // not supported
private:
bool _isCData;
XMLText( const XMLText& ); // not supported
XMLText& operator=( const XMLText& ); // not supported
};
@@ -918,10 +987,10 @@ public:
protected:
XMLComment( XMLDocument* doc );
virtual ~XMLComment();
XMLComment( const XMLComment& ); // not supported
XMLComment& operator=( const XMLComment& ); // not supported
private:
XMLComment( const XMLComment& ); // not supported
XMLComment& operator=( const XMLComment& ); // not supported
};
@@ -956,6 +1025,8 @@ public:
protected:
XMLDeclaration( XMLDocument* doc );
virtual ~XMLDeclaration();
private:
XMLDeclaration( const XMLDeclaration& ); // not supported
XMLDeclaration& operator=( const XMLDeclaration& ); // not supported
};
@@ -988,38 +1059,13 @@ public:
protected:
XMLUnknown( XMLDocument* doc );
virtual ~XMLUnknown();
private:
XMLUnknown( const XMLUnknown& ); // not supported
XMLUnknown& operator=( const XMLUnknown& ); // not supported
};
enum XMLError {
XML_NO_ERROR = 0,
XML_SUCCESS = 0,
XML_NO_ATTRIBUTE,
XML_WRONG_ATTRIBUTE_TYPE,
XML_ERROR_FILE_NOT_FOUND,
XML_ERROR_FILE_COULD_NOT_BE_OPENED,
XML_ERROR_FILE_READ_ERROR,
XML_ERROR_ELEMENT_MISMATCH,
XML_ERROR_PARSING_ELEMENT,
XML_ERROR_PARSING_ATTRIBUTE,
XML_ERROR_IDENTIFYING_TAG,
XML_ERROR_PARSING_TEXT,
XML_ERROR_PARSING_CDATA,
XML_ERROR_PARSING_COMMENT,
XML_ERROR_PARSING_DECLARATION,
XML_ERROR_PARSING_UNKNOWN,
XML_ERROR_EMPTY_DOCUMENT,
XML_ERROR_MISMATCHED_ELEMENT,
XML_ERROR_PARSING,
XML_CAN_NOT_CONVERT_TEXT,
XML_NO_TEXT_NODE
};
/** An attribute is a name-value pair. Elements have an arbitrary
number of attributes, each with a unique name.
@@ -1473,10 +1519,13 @@ private:
XMLElement( const XMLElement& ); // not supported
void operator=( const XMLElement& ); // not supported
XMLAttribute* FindAttribute( const char* name );
XMLAttribute* FindAttribute( const char* name ) {
return const_cast<XMLAttribute*>(const_cast<const XMLElement*>(this)->FindAttribute( name ));
}
XMLAttribute* FindOrCreateAttribute( const char* name );
//void LinkAttribute( XMLAttribute* attrib );
char* ParseAttributes( char* p );
static void DeleteAttribute( XMLAttribute* attribute );
enum { BUF_SIZE = 200 };
int _closingType;
@@ -1536,6 +1585,10 @@ public:
Load an XML file from disk. You are responsible
for providing and closing the FILE*.
NOTE: The file should be opened as binary ("rb")
not text in order for TinyXML-2 to correctly
do newline normalization.
Returns XML_NO_ERROR (0) on success, or
an errorID.
*/
@@ -1644,9 +1697,7 @@ public:
Delete a node associated with this document.
It will be unlinked from the DOM.
*/
void DeleteNode( XMLNode* node ) {
node->_parent->DeleteChild( node );
}
void DeleteNode( XMLNode* node );
void SetError( XMLError error, const char* str1, const char* str2 );
@@ -1658,6 +1709,8 @@ public:
XMLError ErrorID() const {
return _errorID;
}
const char* ErrorName() const;
/// Return a possibly helpful diagnostic location or string.
const char* GetErrorStr1() const {
return _errorStr1;
@@ -1698,6 +1751,10 @@ private:
MemPoolT< sizeof(XMLAttribute) > _attributePool;
MemPoolT< sizeof(XMLText) > _textPool;
MemPoolT< sizeof(XMLComment) > _commentPool;
static const char* _errorNames[XML_ERROR_COUNT];
void Parse();
};
@@ -1741,7 +1798,7 @@ private:
@verbatim
XMLHandle docHandle( &document );
XMLElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild().NextSibling().ToElement();
XMLElement* child2 = docHandle.FirstChildElement( "Document" ).FirstChildElement( "Element" ).FirstChildElement().NextSiblingElement();
if ( child2 )
{
// do something useful
@@ -1816,19 +1873,19 @@ public:
}
/// Safe cast to XMLElement. This can return null.
XMLElement* ToElement() {
return ( ( _node && _node->ToElement() ) ? _node->ToElement() : 0 );
return ( ( _node == 0 ) ? 0 : _node->ToElement() );
}
/// Safe cast to XMLText. This can return null.
XMLText* ToText() {
return ( ( _node && _node->ToText() ) ? _node->ToText() : 0 );
return ( ( _node == 0 ) ? 0 : _node->ToText() );
}
/// Safe cast to XMLUnknown. This can return null.
XMLUnknown* ToUnknown() {
return ( ( _node && _node->ToUnknown() ) ? _node->ToUnknown() : 0 );
return ( ( _node == 0 ) ? 0 : _node->ToUnknown() );
}
/// Safe cast to XMLDeclaration. This can return null.
XMLDeclaration* ToDeclaration() {
return ( ( _node && _node->ToDeclaration() ) ? _node->ToDeclaration() : 0 );
return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() );
}
private:
@@ -1888,16 +1945,16 @@ public:
return _node;
}
const XMLElement* ToElement() const {
return ( ( _node && _node->ToElement() ) ? _node->ToElement() : 0 );
return ( ( _node == 0 ) ? 0 : _node->ToElement() );
}
const XMLText* ToText() const {
return ( ( _node && _node->ToText() ) ? _node->ToText() : 0 );
return ( ( _node == 0 ) ? 0 : _node->ToText() );
}
const XMLUnknown* ToUnknown() const {
return ( ( _node && _node->ToUnknown() ) ? _node->ToUnknown() : 0 );
return ( ( _node == 0 ) ? 0 : _node->ToUnknown() );
}
const XMLDeclaration* ToDeclaration() const {
return ( ( _node && _node->ToDeclaration() ) ? _node->ToDeclaration() : 0 );
return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() );
}
private:
@@ -2031,7 +2088,7 @@ public:
}
protected:
virtual bool CompactMode( const XMLElement& ) { return _compactMode; };
virtual bool CompactMode( const XMLElement& ) { return _compactMode; }
/** Prints out the space before an element. You may override to change
the space and tabs used. A PrintSpace() override should call Print().
@@ -2039,7 +2096,7 @@ protected:
virtual void PrintSpace( int depth );
void Print( const char* format, ... );
void SealElement();
void SealElementIfJustOpened();
bool _elementJustOpened;
DynArray< const char*, 10 > _stack;
@@ -2061,9 +2118,6 @@ private:
bool _restrictedEntityFlag[ENTITY_RANGE];
DynArray< char, 20 > _buffer;
#ifdef _MSC_VER
DynArray< char, 20 > _accumulator;
#endif
};

View File

@@ -96,6 +96,9 @@
/* Begin PBXProject section */
037AE058151CCC5200E0F29F /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
};
buildConfigurationList = 037AE05B151CCC5200E0F29F /* Build configuration list for PBXProject "tinyxml2" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
@@ -134,6 +137,8 @@
buildSettings = {
CONFIGURATION_BUILD_DIR = "$(SYMROOT)/Debug";
COPY_PHASE_STRIP = NO;
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = DEBUG;
ONLY_ACTIVE_ARCH = YES;
SYMROOT = build;
};
name = Debug;
@@ -156,6 +161,7 @@
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
INSTALL_PATH = /usr/local/bin;
MACOSX_DEPLOYMENT_TARGET = "";
PREBINDING = NO;
PRODUCT_NAME = xmltest;
};
@@ -171,6 +177,7 @@
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_MODEL_TUNING = G5;
INSTALL_PATH = /usr/local/bin;
MACOSX_DEPLOYMENT_TARGET = "";
PREBINDING = NO;
PRODUCT_NAME = tinyxml2;
ZERO_LINK = NO;

View File

@@ -1,5 +1,7 @@
#if defined( _MSC_VER )
#define _CRT_SECURE_NO_WARNINGS // This test file is not intended to be secure.
#if !defined( _CRT_SECURE_NO_WARNINGS )
#define _CRT_SECURE_NO_WARNINGS // This test file is not intended to be secure.
#endif
#endif
#include "tinyxml2.h"
@@ -21,6 +23,7 @@
#endif
using namespace tinyxml2;
using namespace std;
int gPass = 0;
int gFail = 0;
@@ -277,6 +280,8 @@ int main( int argc, const char ** argv )
{
#if defined( _MSC_VER ) && defined( DEBUG )
_CrtMemCheckpoint( &startMemState );
// Enable MS Visual C++ debug heap memory leaks dump on exit
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
#endif
#if defined(_MSC_VER) || defined(MINGW32) || defined(__MINGW32__)
@@ -290,14 +295,18 @@ int main( int argc, const char ** argv )
mkdir( "resources/out/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
#endif
{
TIXMLASSERT( true );
}
if ( argc > 1 ) {
XMLDocument* doc = new XMLDocument();
clock_t startTime = clock();
doc->LoadFile( argv[1] );
clock_t loadTime = clock();
clock_t loadTime = clock();
int errorID = doc->ErrorID();
delete doc; doc = 0;
clock_t deleteTime = clock();
clock_t deleteTime = clock();
printf( "Test file '%s' loaded. ErrorID=%d\n", argv[1], errorID );
if ( !errorID ) {
@@ -858,12 +867,20 @@ int main( int argc, const char ** argv )
{
// Empty documents should return TIXML_XML_ERROR_PARSING_EMPTY, bug 1070717
const char* str = " ";
const char* str = "";
XMLDocument doc;
doc.Parse( str );
XMLTest( "Empty document error", XML_ERROR_EMPTY_DOCUMENT, doc.ErrorID() );
}
{
// Documents with all whitespaces should return TIXML_XML_ERROR_PARSING_EMPTY, bug 1070717
const char* str = " ";
XMLDocument doc;
doc.Parse( str );
XMLTest( "All whitespaces document error", XML_ERROR_EMPTY_DOCUMENT, doc.ErrorID() );
}
{
// Low entities
XMLDocument doc;
@@ -1151,6 +1168,7 @@ int main( int argc, const char ** argv )
{
XMLDocument doc;
doc.LoadFile( "resources/dream.xml" );
XMLTest( "Document has something to Clear()", doc.NoChildren(), false );
doc.Clear();
XMLTest( "Document Clear()'s", doc.NoChildren(), true );
}
@@ -1220,6 +1238,8 @@ int main( int argc, const char ** argv )
XMLDocument doc;
XMLError error = doc.LoadFile( "resources/empty.xml" );
XMLTest( "Loading an empty file", XML_ERROR_EMPTY_DOCUMENT, error );
XMLTest( "Loading an empty file and ErrorName as string", "XML_ERROR_EMPTY_DOCUMENT", doc.ErrorName() );
doc.PrintError();
}
{
@@ -1325,6 +1345,14 @@ int main( int argc, const char ** argv )
doc.Print();
}
{
// Test that it doesn't crash.
const char* xml = "<?xml version=\"1.0\"?><root><sample><field0><1</field0><field1>2</field1></sample></root>";
XMLDocument doc;
doc.Parse(xml);
doc.PrintError();
}
#if 1
// the question being explored is what kind of print to use:
// https://github.com/leethomason/tinyxml2/issues/63
@@ -1360,7 +1388,43 @@ int main( int argc, const char ** argv )
}
#endif
{
// Issue #184
// If it doesn't assert, it passes. Caused by objects
// getting created during parsing which are then
// inaccessible in the memory pools.
{
XMLDocument doc;
doc.Parse("<?xml version=\"1.0\" encoding=\"UTF-8\"?><test>");
}
{
XMLDocument doc;
doc.Parse("<?xml version=\"1.0\" encoding=\"UTF-8\"?><test>");
doc.Clear();
}
}
{
// If this doesn't assert in DEBUG, all is well.
tinyxml2::XMLDocument doc;
tinyxml2::XMLElement *pRoot = doc.NewElement("Root");
doc.DeleteNode(pRoot);
}
{
// Should not assert in DEBUG
XMLPrinter printer;
}
{
// Issue 291. Should not crash
const char* xml = "&#0</a>";
XMLDocument doc;
doc.Parse( xml );
XMLPrinter printer;
doc.Print( &printer );
}
// ----------- Performance tracking --------------
{
@@ -1413,12 +1477,10 @@ int main( int argc, const char ** argv )
#if defined( _MSC_VER ) && defined( DEBUG )
_CrtMemCheckpoint( &endMemState );
//_CrtMemDumpStatistics( &endMemState );
_CrtMemState diffMemState;
_CrtMemDifference( &diffMemState, &startMemState, &endMemState );
_CrtMemDumpStatistics( &diffMemState );
//printf( "new total=%d\n", gNewTotal );
#endif
printf ("\nPass %d, Fail %d\n", gPass, gFail);