Commit Graph

312 Commits

Author SHA1 Message Date
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
Dmitry-Me 9fcb876d3b Fix null pointer dereference planted in PR287 and reported in PR288 2015-03-05 17:53:34 +03:00
Dmitry-Me 023846628d Add and make use of pre- and post-asserts in XMLDocument::Identify() 2015-03-03 16:02:13 +03:00
Dmitry-Me 6acc9a5469 Move declaration to actual first use 2015-01-15 13:27:47 +03:00
Dmitry-Me 30bdc9735b Pre-asserts to clarify buffer usage 2015-01-14 08:32:23 +03: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 7e67bc89de minor formatting changes 2015-01-12 14:05:12 -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
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
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 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 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 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 5f06297230 Merge pull request #248 from JayXon/simplifyParseName
Simplify ParseName
2014-12-26 16:18:46 -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
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
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 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 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
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
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
Dmitry-Me 1227d51ed0 Reuse const FindAttribute for non-const version thereof 2014-12-05 13:41:45 +03: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 2965880447 switch to using pointer, not reference 2014-11-27 22:31:11 -08: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 03494b189c Merge remote-tracking branch 'origin/master' into Dmitry-Me-properStrPairAssignment 2014-11-15 17:50:17 -08:00
Dmitry-Me 08b40dd8a5 Implement "move" equivalent of assignment operator for StrPair 2014-11-10 11:17:21 +03:00
Dmitry-Me 66d2a84715 Add pre-assert, fix comment 2014-11-08 15:24:52 +03:00
Lee Thomason f07b952296 fix issue 184. clean up xcode project. 2014-10-30 13:25:12 -07:00
Dmitry-Me d048f1e8e3 Bind reference to avoid repeated accesses by index 2014-10-01 10:30:16 +04:00
Dmitry-Me 097339a099 Remove unneeded virtual calls 2014-09-29 13:20:29 +04:00
Dmitry-Me 6d202ff20e Eliminate repeated virtual calls 2014-09-26 14:21:00 +04: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 331596e83c clean up the scope and names of the error code. 2014-09-11 14:56:43 -07:00
numatrumpet 003368429f ErrorNames is not implemented by vector<string> but *char[] 2014-09-08 16:36:28 +09:00
numatrumpet bb5ffac22d Using C++11, XMLUtil::ToErrorName(XMLError) returns the name of error type 2014-09-06 22:56:46 +09:00
Dmitry-Me 3659fe1d33 Move loop variable definition into loop headers 2014-09-04 11:33:49 +04:00
Dmitry-Me e3225b1c64 Convert DELETE_X macros into functions 2014-09-03 11:03:11 +04:00
Dmitry-Me b6b4e82626 Remove repeated virtual calls 2014-08-27 17:17:47 +04:00
Dmitry-Me ec19a0e513 Remove obsolete comment 2014-08-25 11:05:55 +04: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
Dmitry-Me 67a5bb0ac1 Assert when trying to adjust _start in "needs delete" mode. 2014-08-20 10:01:53 +04:00
Dmitry-Me 01578db56b Wrap fopen()/fopen_s() calls to avoid duplication 2014-08-19 10:18:48 +04:00
Dmitry-Me acb9c9c260 Check ftell() result for error code before using it. 2014-08-04 09:49:25 +04:00
Dmitry-Me 08e7f7be59 fgetc() is not required to clear the error indicator on success 2014-07-31 15:19:14 +04:00
pffang 91d34a0989 WinCE Compatibility Fix 2014-07-10 10:02:35 +08:00
Lee Thomason a0744c8dca fix implementation of much simpler visual studio printing 2014-03-16 10:32:27 -07:00
Thomas Roß 268c683fbd Use _vscprintf to calc length of expanded format string. 2014-03-13 23:35:16 +01:00
Uli Kusterer 613410095c Provide finer control over indentation inside the XMLPrinter. You'll have to subclass it to override its standard behaviour by overwriting CompactMode(). 2014-02-22 17:19:08 +01:00
Lee Thomason 7de26f7dc7 Merge remote-tracking branch 'origin/master' 2014-02-21 22:47:21 -08:00
Lee Thomason 82d3200571 clean up some error checking logic 2014-02-21 22:47:18 -08:00
Uli Kusterer 5d1d27e88b Keep indentation control fully inside the XMLPrinter. You'll have to subclass it to override its standard behaviour by overwriting CompactMode(). 2014-02-20 11:50:22 +01:00
Uli Kusterer 07ac762b80 SetBoolFirstChild now makes sure its bool is not wrapped onto its own line. 2014-02-01 15:06:50 +01:00
Uli Kusterer b85b4e0a60 Merge branch 'pernodecompactwhitespace'
* pernodecompactwhitespace:
  SetForceCompactMode() now also handles case of a single tag inside another correctly.
  Give tests a few more chances to fail, e.g. on tag sequences or attributes.
  Added SetForceCompactMode() for overriding the compact setting on a per-node level. All sub-nodes will be printed compact as well.

Conflicts:
	xmltest.cpp
2014-02-01 13:38:04 +01:00
Uli Kusterer ca412e87f2 SetForceCompactMode() now also handles case of a single tag inside another correctly. 2014-02-01 13:35:05 +01:00
Uli Kusterer d5c9e8b81d Added SetForceCompactMode() for overriding the compact setting on a per-node level. All sub-nodes will be printed compact as well. 2014-02-01 12:57:57 +01:00
Uli Kusterer 593a33d061 Added SetForceCompactMode() for overriding the compact setting on a per-node level. All sub-nodes will be printed compact as well. 2014-02-01 12:48:51 +01:00
Uli Kusterer 53fe47c74e Remove long long stuff again. 2014-01-27 01:47:30 +01:00
Uli Kusterer 35ce309f73 Urk, forgot to build this one after merging and goofed a bit. 2014-01-25 03:37:16 +01:00
Uli Kusterer 2861a7e63a Merge branch 'master' of https://github.com/leethomason/tinyxml2
Conflicts:
	tinyxml2.cpp
	xmltest.cpp
2014-01-25 03:12:21 +01:00
Lee Thomason 5bb2d8079b add variants of SetText() to support types 2014-01-24 10:42:57 -08:00
Uli Kusterer 664d05662e Support for 'long long' number values. 2014-01-21 12:24:47 +01:00
Uli Kusterer ff8e2041dd To bring BoolFirstChild() more in line with the other methods, reimplemented it in terms of a new QueryBoolFirstChild(). 2014-01-21 02:53:47 +01:00
Uli Kusterer c1c20bb196 Bools should really be implemented as self-closing <true /> and <false /> tags, not as 0/1 inside a tag, so removing those SetText variants again, in favor of SetBoolFirstChild() and BoolFirstChild() methods. 2014-01-21 02:23:20 +01:00
Uli Kusterer dcefa0e43f Add typed convenience setters for SetText(). 2014-01-21 01:36:41 +01:00
Uli Kusterer 869bb599c1 Make SetText() behave like the docs say. 2014-01-21 01:36:16 +01:00
Uli Kusterer 8fe342a872 Add SetText() as analog to GetText(). 2014-01-21 01:12:47 +01:00
Lee Thomason 44ce7930b7 Merge branch 'master' of https://github.com/leethomason/tinyxml2 2014-01-14 12:30:18 -08:00
Lee Thomason c3708ccf08 implement a fix to floating point precision as proposed by schuellc. 2014-01-14 12:30:03 -08:00
Daniel Marjamäki ba4b328b3d Fixed issue 147 (XMLDocument::LoadFile() may crash on non-regular file) 2014-01-10 21:37:27 +01:00
psi 690ba07bda you have to check len before accsessing "p". 2013-11-03 10:54:33 +09:00
Lee Thomason 3b7927efb5 formatting tweaks 2013-10-26 21:50:46 -07:00
Michael Daumling ed52328ced Insert() methods check for inserted XML to be in the same doc, and remove XML from old location if already inserted. 2013-10-23 07:47:29 +02:00
Michael Daumling 2162688ad3 Issue #134: Change 3 methods to not being inlined. They reference the StrPair class, which is not exported, thus creating linker problems with tinyxml2 in a DLL. 2013-10-22 17:03:37 +02:00
PKEuS 1bfb95488f Added depth as constructor argument to XMLPrinter. This way, XML files that are not written with XMLDocument can be properly indented.
Removed unused forward declaration
2013-08-04 14:04:09 +02:00
PKEuS 1c5f99e37c Fixed two cppcheck messages 2013-07-06 11:28:39 +02:00
Thomas Roß 6189231187 Initialize pointers to satisfy static code analyser. 2013-05-12 14:07:38 +02:00
Lee Thomason (grinliz) d6bd7360b8 fix floating point specifier and clean up a warning 2013-05-11 20:23:13 -07:00
Thomas Roß 1470edc595 Fixed compiler warning for x64 builds. 2013-05-10 15:44:12 +02:00
Lee Thomason (grinliz) d0a38c3a20 fix BOM preservation bugs. add new tests 2013-04-29 09:15:37 -07:00
Vasily Biryukov 1cfafd0d24 Fixed: LoadFile() returns XML_NO_ERROR for empty documents. 2013-04-20 14:12:33 +06:00
Andrew C. Martin 0fd8746f64 correct typos in comments / documentation 2013-03-09 20:09:45 -07:00
Lee Thomason (grinliz) 61cea67517 removing debug output 2013-02-01 19:13:13 -08:00
Lee Thomason (grinliz) ac83b4e278 adjust the size of the memory pools 2013-02-01 09:02:34 -08:00
Martinsh Shaiters a9d42b0dd3 Replace InitDocument() with Clear() and make it part of the API. 2013-01-30 11:19:39 +02:00
Martinsh Shaiters c6d02f48d5 Implement new utility functions for testing validity of name and token characters. 2013-01-26 22:43:54 +02:00
MortenMacFly 4ee49f1690 Eliminate warnings with GCC/MinGW 2013-01-14 20:03:14 +01:00
Jerome Martinez 242c3eaa33 Reverting std lib is in std:: namespace and using .h versions instead 2013-01-06 12:20:04 +01:00
Lee Thomason 5b0a677712 fix incorrect assert on unused memory 2012-11-19 13:54:42 -08:00
Lee Thomason 685b895172 trivial comment fix 2012-11-12 13:00:06 -08:00
Lee Thomason 8950b37aa0 Merge branch 'master' of https://github.com/leethomason/tinyxml2 2012-11-12 12:59:25 -08:00
Lee Thomason 2fa8172236 type XMLError. fix some comments 2012-11-09 12:37:46 -08:00
Kevin Wojniak 04c22d250a Enclose code in namespace instead of 'using namespace' to resolve conflict on Windows with MSXML. Fixes issue #37. 2012-11-08 11:02:22 -08:00
Jerome Martinez 7fbefab95d std lib is in std:: namespace only and array definition is not possible with an enum 2012-10-19 11:30:33 +02:00
Lee Thomason 1aa8fc4a1e fix up rename on windows 2012-10-13 20:01:30 -07:00
Lee Thomason 624d43fc05 finish switching to _ for member vars 2012-10-12 10:58:48 -07:00
Lee Thomason 120b3a62be switch StrPair() over to _ for member vars 2012-10-12 10:06:59 -07:00
Lee Thomason a9cf3f9f3f Switched to Artistic Style auto-formatting to allow integration of patches from other coding styles. 2012-10-11 16:56:51 -07:00
sniperbat a5716b787a nothing but just remove compile warning 2012-10-11 15:22:28 +08:00
Lee Thomason 3cd66ee850 fix a fopen bug: rb should be w 2012-09-25 13:22:41 -07:00
Lee Thomason (grinliz) fc6320e30a experimented with print f vs. g. increased version 2012-09-23 20:25:50 -07:00
Lee Thomason (grinliz) e2bcb32494 accept a nBytes argument for Parse() 2012-09-17 17:58:25 -07:00
Lee Thomason (grinliz) 2f1f6247e0 remove trailing spaces 2012-09-16 11:32:34 -07:00
Lee Thomason (grinliz) 6da5410110 changes for martell to clean up fopen 2012-09-09 22:05:49 -07:00
Lee Thomason (grinliz) 79869e77f9 changes for martell to clean up fopen 2012-09-09 22:04:52 -07:00
Lee Thomason (grinliz) 62d1c5a739 fix merge 2012-09-08 21:44:12 -07:00
Lee Thomason (grinliz) 5fbacbec06 fix name parsing to accept additional lead characters 2012-09-08 21:40:53 -07:00
Lee Thomason (grinliz) 491d587484 Merge branch 'master' into whitespace 2012-09-08 21:24:00 -07:00
Robert Reif 312a20fdd4 Add support to XMLDocument to save file in compact mode. 2012-09-08 19:33:57 -04:00
Martell 186476c665 Shut up visual studio 2012-09-06 16:41:46 +01:00
Lee Thomason (grinliz) bc1bfb7f27 added whitespace=collapse support. tests work. code needs review 2012-08-20 22:00:38 -07:00
PKEuS c28ba3aeab Fixed cppcheck warnings 2012-07-16 03:08:47 -07:00
Lee Thomason 21be882810 Moving string in/out into XMLUtil. Using that across the API. Supporting text queries of primitive types. 2012-07-15 17:27:22 -07:00
Lee Thomason 78a773ddd9 Fix attribute parsing to correctly handle white space 2012-07-02 10:10:19 -07:00
Lee Thomason (grinliz) 390e978da1 Fix infinite loop bug in ShallowEqual. Fix a warning with a re-interpret cast. Up version to 1.0.4 2012-07-01 21:22:53 -07:00
Lee Thomason a3efec0449 clean up some warnings 2012-06-15 14:30:44 -07:00
sniperbat 2590088631 Add compact mode to XMLPrinter, for printing without '\n' and space.
let output file smaller.
usage:
//------------------------------------------------
XMLPrinter printer;
printer->SetCompactMode( true ); //enable compact mode
doc->Print( &printer );
SomeFunction( printer.CStr() );
//------------------------------------------------
or
//------------------------------------------------
//enable at construction
XMLPrinter printer( file, true );         // to file
//XMLPrinter printer( NULL, true ); // to men
doc->Print( &printer );
SomeFunction( printer.CStr() );
//------------------------------------------------

The '\n' and space in Text or Attribute will be kept.
2012-05-28 17:22:07 +08:00
Lee Thomason ee87c620c8 possible missing header 2012-05-14 09:27:47 -07:00
Thomas Roß 7d7a9a37bd fixed VS2010 x64 compiler warnings about possible loss of data 2012-05-10 00:23:19 +02:00
Lee Thomason f68c438ee2 added new test for BOM, and added good defaults for NewDeclaration 2012-04-28 14:37:11 -07:00
Lee Thomason 9708885e5e minor cleanup to the parsing loop 2012-04-18 11:39:42 -07:00
Lee Thomason 5e3803cac3 Better attribute system. Removes redundant list searching of LinkAttribute. Faster parsing on initial read. Added badly needed missing test cases. 2012-04-16 08:57:05 -07:00
Ken Miller 81da1fb26b Made SaveFile symmetrical with LoadFile
Added overload taking a FILE pointer
Return error code (if any) instead of void
2012-04-09 23:32:26 -05:00