Commit Graph

432 Commits

Author SHA1 Message Date
Albert Hung
1d658f0d95 Fix format error of TIXML_SNPRINTF
The format "%x" is treated as an unsigned int by the GCC compiler. Use static_cast to cast the error to an unsigned int to match the "%x" type. Additionally, replace int(error) with static_cast<int>(error) to avoid the old-style cast warning.
2024-03-19 14:22:17 +08:00
Lee Thomason
6b6d1214a7 Merge branch 'work/dfaure/Wundef' of https://github.com/dfaure-kdab/tinyxml2 into dfaure-kdab-work/dfaure/Wundef 2023-11-21 12:35:56 -08:00
Lee Thomason
2d59aaf0da Merge branch 'master' of https://github.com/vimproved/tinyxml2 into vimproved-master 2023-11-21 12:16:06 -08:00
Lee Thomason
9d026527a4 Merge branch 'pedantic-whitespace' of https://github.com/kcsaul/tinyxml2 into kcsaul-pedantic-whitespace 2023-11-21 11:40:52 -08:00
David Faure
5080faafe6 Add missing "defined", to fix building with -Werror=undef 2023-09-17 21:39:55 +02:00
Violet Purcell
f439598036 Remove LFS64 calls and set _FILE_OFFSET_BITS=64
Musl 1.2.4 made the LFS64 interfaces only available when
_LARGEFILE64_SOURCE is defined, and they will be removed altogether in
Musl 1.2.5. This commit replaces the LFS64 calls with their non-LFS64
versions and defines _FILE_OFFSET_BITS=64, which makes all interfaces
64-bit.

Bug: https://bugs.gentoo.org/905999
2023-06-09 01:43:27 +00:00
Kevin Saul
98303bbda3 add pedantic whitespace mode 2023-05-28 21:36:28 +12:00
kb1sph
5926ec938a Added ChildElementCount()
Added the ChildElementCount function that was initially suggested by msteiger on sourceforge for the original tinyxml.  Modified to work with TinyXML-2.
2023-02-06 19:04:57 -05:00
Lee Thomason
94f52b5cbe Merge branch 'dinghao188-dev' of https://github.com/dinghao188/tinyxml2 into dinghao188-dinghao188-dev 2023-01-14 17:41:42 -08:00
Lee Thomason
7e310468f3 typo 2022-04-02 14:15:59 -07:00
Lee Thomason
953018ab93 fix android build 2022-04-02 14:14:20 -07:00
Lee Thomason
a2d675139b fix cygwin 2022-04-02 14:05:47 -07:00
Saran Tunyasuvunakool
4cc4145d7f Change argument names in tinyxml2.cpp to match those in tinyxml2.h.
Affected functions are `XMLElement::QueryUnsigned64Text` and `XMLDocument::Parse`.
2021-12-21 16:06:24 +00:00
Saran Tunyasuvunakool
6cc405853b Convert endings of lines 106-107 in tinyxml2.cpp to CRLF. 2021-12-21 16:05:29 +00:00
dinghao188
9efb6b0b66 fix assertion - Assertion '_elementPool.CurrentAllocs() == _elementPool.Untracked()' failed. 2021-09-17 17:49:01 +08:00
striker.sh
98233b604b Use fseeko and ftello on BSDs 2021-06-13 20:24:00 +02:00
Jonas Vautherin
41151ce211 Add defined(__ANDROID__) for fseeko defined and android-x86_64 2021-05-19 02:43:44 +02:00
Lee Thomason
91bfd4b7fc Merge pull request #827 from ngc92/ClearError
removed overhead of clear error
2020-12-30 10:35:45 -08:00
Lee Thomason
a9ed6746dd Merge pull request #838 from dfaure-kdab/Wundef
Add missing `defined`, detected by -Werror=undef
2020-12-30 10:18:44 -08:00
Lee Thomason
11376382fa Merge pull request #840 from dota17/master
skip comment node before get text
2020-12-30 10:18:16 -08:00
Will Pazner
d3a82c5e45 Fix format string errors in sscanf 2020-11-19 20:50:36 -08:00
dota17
d59fd15db6 skip comment node before get text 2020-10-22 15:16:34 +08:00
David Faure
b5d3b93e05 Add missing defined, detected by -Werror=undef 2020-10-09 09:59:50 +02:00
ngc92
2c6a41a92e removed overhead of clear error 2020-07-30 23:51:30 +03:00
Lee Thomason
2e6912bf8a Merge pull request #816 from a-lunkov/master
Suppress UndefinedBehaviorSanitizer warnings
2020-06-13 17:52:03 -07:00
Lee Thomason
1578df3bf8 Merge pull request #811 from hyperair/fix-first-line-indentation
XMLPrinter: Fix first line indentation
2020-06-13 17:38:20 -07:00
Lee Thomason
18468b8cc4 minor changes to hex parsing 2020-06-13 17:35:21 -07:00
Lee Thomason
c9c9d8cdfa Merge branch 'master' of https://github.com/netcan/tinyxml2 into netcan-master 2020-06-13 17:26:30 -07:00
a-lunkov
a953b9565d Suppress UndefinedBehaviorSanitizer warnings
I compiled tinyxml2 with the following changes to CMakeLists.txt:
-------------------------------------------------- ------------------------------------------
set (CMAKE_C_COMPILER "/ usr / local / bin / clang10")
set (CMAKE_CXX_COMPILER "/ usr / local / bin / clang ++ 10")
add_compile_options (-g)
add_compile_options (-fsanitize = address, undefined, integer, alignment, bool, builtin, bounds, enum, function, nonnull-attribute, null, object-size, pointer-overflow, return, returns-nonnull-attribute, unreachable, vla-bound , vptr)

set_source_files_properties (tinyxml2.cpp tinyxml2.h
                            PROPERTIES COMPILE_FLAGS -fsanitize = address, undefined, integer, alignment, bool, builtin, bounds, enum, function, nonnull-attribute, null, object-size, pointer-overflow, return, returns-nonnull-attribute, unreachable, vla-bound , vptr)
TARGET_LINK_LIBRARIES (tinyxml2 /usr/local/llvm10/lib/clang/10.0.0/lib/freebsd/libclang_rt.asan-x86_64.a /usr/local/llvm10/lib/clang/10.0.0/lib/freebsd/libang asan_cxx-x86_64.a /usr/local/llvm10/lib/clang/10.0.0/lib/freebsd/libclang_rt.ubsan_standalone-x86_64.a /usr/local/llvm10/lib/clang/10.0.0/lib/freebsd/ libclang_rt.ubsan_standalone_cxx-x86_64.a -lpthread)
-------------------------------------------------- ------------------------------------------
(Sorry for the dirty code.)

And launched the xmltest utility:
-------------------------------------------------- ------------------------------------------
/home/qqq/17_tinyxml2/tinyxml2-master/tinyxml2.cpp:237:37: runtime error: implicit conversion from type 'char' of value -48 (8-bit, signed) to type 'unsigned char' changed the value to 208 (8-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/qqq/17_tinyxml2/tinyxml2-master/tinyxml2.cpp:237:37 in
/home/qqq/17_tinyxml2/tinyxml2-master/tinyxml2.cpp:243:40: runtime error: implicit conversion from type 'char' of value -96 (8-bit, signed) to type 'unsigned char' changed the value to 160 (8-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/qqq/17_tinyxml2/tinyxml2-master/tinyxml2.cpp:243:40 in
/home/qqq/17_tinyxml2/tinyxml2-master/tinyxml2.cpp:1912:39: runtime error: implicit conversion from type 'char' of value -48 (8-bit, signed) to type 'unsigned char' changed the value to 208 (8-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/qqq/17_tinyxml2/tinyxml2-master/tinyxml2.cpp:1912:39 in
-------------------------------------------------- ------------------------------------------
2020-05-13 18:24:08 +03:00
Lee Thomason
bfbcc0333d Merge pull request #809 from a-lunkov/patch-1
Fix for build with FreeBSD
2020-03-31 15:09:26 -07:00
Chow Loong Jin
6a514399c2 XMLPrinter: Fix first line indentation
Fix indentation of first line when called with !compactMode.
2020-03-26 17:04:41 +08:00
a-lunkov
63fb154ad3 Update tinyxml2.cpp 2020-03-24 14:30:52 +03:00
John Senneker
1fdee25d11 Sharpened check for 64-bit Unix when defining fseek/ftell macros.
This fixes the issues with VxWorks, as mentioned by @razr in #786.
2020-03-17 14:11:25 -04:00
Lee Thomason
67271b1fd2 Merge pull request #787 from jsenn/feature/large-file-support
Added support for files larger than ~2GB
2020-03-10 14:21:04 -07:00
John Senneker
a9f29b74d9 Fixed warning caused by sloppy conversion between signed/unsigned types.
Also, the comparison between size_t max and the actual file size is done
as an unsigned long long, since that type is guaranteed to be at least
64 bits, even on a 32-bit architecture.
2020-03-02 11:04:57 -05:00
netcan
dfb45cb73b support IntText(),UnsignedText(),Int64Text() for hex value 2020-03-02 22:26:03 +08:00
Lee Thomason
bbbb8c9a90 Merge branch 'master' of github.com:leethomason/tinyxml2 2020-03-01 17:11:07 -08:00
Lee Thomason
e444268103 add convenience methods 2020-03-01 17:10:38 -08:00
Lee Thomason
6ac05b2b9a Merge branch 'push' of https://github.com/ngc92/tinyxml2 into ngc92-push 2020-03-01 17:01:33 -08:00
Lee Thomason
655b15c078 Merge pull request #781 from daniel347x/patch-1
Change constants used in 'ToBool' to support MSVC
2020-03-01 16:53:40 -08:00
Lee Thomason
20f2d5eec7 Merge pull request #773 from Alanscut/fix_issue712
fix issue#712
2020-03-01 16:47:19 -08:00
ngc92
e620245043 PushNewChild* family of convenience functions 2019-12-03 16:25:53 +01:00
John Senneker
d58436c4bd Fixed bug caused by type checking code in LoadFile.
Since the file offset is now represented in all cases as a `long long`,
the previous check comparing the sizes of `unsigned long` and `size_t`
no longer makes sense.
2019-11-19 11:40:43 -05:00
John Senneker
bf59a2d4c8 Added support for files larger than ~2GB.
This implements #786.

TinyXML reads the entire file into a pre-allocated buffer in memory. To
get the buffer size, it uses `fseek()` to seek to the end of the file,
and `ftell()` to get the current byte offset. But because `ftell()`
returns a 32-bit signed value, it can only represent byte offsets, hence
file sizes, up to about 2GB.

To get around this, `fseek` and `ftell` have been replaced by the
`TIXML_FSEEK` and `TIXML_FTELL` macros, respectively, which will resolve
to 64-bit versions of these functions on platforms that have them.
2019-11-19 11:00:52 -05:00
Dan Nissenbaum
d7455034ea Change constants used in 'ToBool' to support MSVC
The tokens `TRUE` and `FALSE` are defined in current versions of MSVC, breaking compilation of tinyxml2.cpp in MSVC due to the use of these tokens as variable names in the function `XMLUtil::ToBool`.

Simply changing the variable names to something else resolves the problem.
2019-10-24 23:57:45 -04:00
Alanscut
ad7bdf9ed2 fix issue#712 2019-09-21 15:51:14 +08:00
orbitcowboy
73f5409b62 Improved const correctness. There are no functional changes intended. 2019-08-14 09:30:30 +02:00
Lee Thomason
5bf58f0d1f Merge pull request #753 from orbitcowboy/master
Fixed -Wold-style-cast warnings from g++.
2019-08-10 17:53:39 -07:00
Lee Thomason
c3601c62f6 Merge branch 'cugone-master' 2019-08-10 17:50:53 -07:00
Lee Thomason
effdf95f8c add test cases 2019-08-10 17:49:42 -07:00