0
0
mirror of https://github.com/zeux/pugixml.git synced 2025-01-01 00:37:48 +08:00

1204 Commits

Author SHA1 Message Date
Arseny Kapoulkine
ad3b492c1a docs: Regenerate HTML documentation 2015-12-31 17:22:41 +03:00
Arseny Kapoulkine
5f58e9bd0c Update all license/copyright texts to 2016 2015-12-31 17:22:21 +03:00
Arseny Kapoulkine
af7177e77d docs: Use ISO-8601 for changelog dates 2015-12-31 17:11:54 +03:00
Arseny Kapoulkine
03b1b6a5c3 scripts: Fix default value for STATIC_CRT option
Also refactor to use the same case and run after common options.
2015-12-30 23:58:03 +03:00
Arseny Kapoulkine
6a22a28730 Merge pull request #70 from nirbar/master
scripts: Allow linking static CRT libraries on Windows

Use the solution from CMake FAQ to specify correct command-line arguments.
2015-12-30 23:54:58 +03:00
Arseny Kapoulkine
1bcf12402e Work around Clang Wstring-conversion warnings
(!"string") triggers the warning however (false && "string") does not.

Fixes #75.
2015-12-29 21:43:24 +03:00
nir.bar
3dadebf10e Merge branch 'master' of github.com:nirbar/pugixml 2015-12-03 13:19:52 +02:00
nir.bar
0d111976e1 Add CMake option on MSVC- STATIC_CRT 2015-12-03 12:33:44 +02:00
Arseny Kapoulkine
2cf599b310 Work around MinGW versions with non-C99 compliant headers
Apparently some MinGW distributions have a compiler that's recent enough to
support C++11 but limits.h header that incorrectly omits LLONG limits in
strict ANSI mode, since it guards the definitions with:

	#if !defined(__STRICT_ANSI__) && defined(__GNUC__)

We can just define these symbols ourselves in this specific case.

Fixes #66.
2015-11-13 09:09:43 -08:00
Arseny Kapoulkine
94c08f27c6 tests: Fix Borland C++ 5.4 compilation
The tests now compile fine but crash on the first floating-point exception
despite our attempts to disable them in main()...
2015-10-25 13:44:26 -07:00
Arseny Kapoulkine
fe58041a61 Fix Borland C++ 5.4 compilation
It does not have stdint.h and has some C++ parsing issues.
2015-10-25 12:57:43 -07:00
Arseny Kapoulkine
39149fd5bd Reduce Travis build matrix 2015-10-24 14:15:47 -07:00
Arseny Kapoulkine
0fe295aa9c Build NuGet package on AppVeyor 2015-10-23 11:11:49 -07:00
Arseny Kapoulkine
a3a9d53860 docs: Fix CDATA example
Fixes #61.
2015-10-19 20:55:39 -07:00
Arseny Kapoulkine
7d2842e670 docs: Add iOS to the list of supported platforms 2015-10-19 00:11:10 -07:00
Arseny Kapoulkine
5b2f014fc7 docs: Update packaging info 2015-10-18 21:01:14 -07:00
Arseny Kapoulkine
0c8024920f docs: Update release date v1.7 2015-10-18 20:13:52 -07:00
Arseny Kapoulkine
471f2260d0 docs: Rewrite Portability section 2015-10-18 18:23:17 -07:00
Arseny Kapoulkine
af3cd2e7b6 Add config=analyze 2015-10-18 18:00:17 -07:00
Arseny Kapoulkine
d27a64338e Add release build to Travis 2015-10-18 17:54:17 -07:00
Arseny Kapoulkine
e7f1e3d9dd Fix wchar mode 2015-10-18 17:52:45 -07:00
Arseny Kapoulkine
e45c173f73 Fix MWCW issue with compact mode 2015-10-18 16:10:30 -07:00
Arseny Kapoulkine
18483b024c Fix Borland C++ issues with compact mode 2015-10-18 16:09:31 -07:00
Arseny Kapoulkine
00d9f98ccc Work around DMC compilation error
For some reason reference to a fixed-size array works in two other places
but not in this one...
2015-10-18 15:58:16 -07:00
Arseny Kapoulkine
75a811a4f7 Fix 'cast increases required alignment of type' warnings
These show up when building with Wcast-align for ARM.
2015-10-18 15:51:02 -07:00
Arseny Kapoulkine
cd4eadcc2b Use -pedantic instead of -Wpedantic
Travis CI strikes once more.
2015-10-17 14:24:20 -07:00
Arseny Kapoulkine
3ac9555d8d Enable a few more warnings 2015-10-17 14:21:56 -07:00
Arseny Kapoulkine
65df1ef955 Fix XPath query move ctor/operator
It now also moves parse result.
2015-10-17 14:16:46 -07:00
Arseny Kapoulkine
cf8cfb30ce Fix 'signed/unsigned comparison' warning in wchar mode
Only happens on GCC 3.4 for some reason.
2015-10-17 12:58:04 -07:00
Arseny Kapoulkine
fd605bc9a7 tests: Fix GCC warning
Fix "this decimal constant is unsigned only in ISO C90".
2015-10-17 12:20:21 -07:00
Arseny Kapoulkine
1298c8db79 Fix -Wshadow warning 2015-10-17 12:14:04 -07:00
Arseny Kapoulkine
809f992f83 Fix MSVC6 header-only build
name_sentry dtor results in multiple symbol definition errors in MSVC6.
2015-10-17 10:51:20 -07:00
Arseny Kapoulkine
0e09571f21 Fix integer overflow detection with leading zeros
Since they don't contribute to the resulting value just skip them before
parsing. This matches the behavior of strtol/strtoll and results in more
intuitive behavior.
2015-10-17 10:33:50 -07:00
Arseny Kapoulkine
e8e54ea5de Use explicit tests in set_Name/set_value
Node type enum is not used as an array index anywhere else; the code is not
very readable and the value of this "optimization" is questionable.

The conditions are arranged so that in all normal cases the first comparison
returns true anyway.
2015-10-17 10:26:57 -07:00
Arseny Kapoulkine
122157eb0e Fix argument mismatch in integer parsing
The minneg argument is supposed to be the absolute value of the minimum negative
representable number. In case of two-complement arithmetic, it's the same as the
value itself but it's better to be explicit and negate the argument.
2015-10-17 10:14:52 -07:00
Arseny Kapoulkine
4230292830 Add compact_hash_table assertions 2015-10-17 10:13:40 -07:00
Arseny Kapoulkine
67702277e6 docs: Add a note about moving xpath_query 2015-10-17 08:59:41 -07:00
Arseny Kapoulkine
384db6ba29 Refactor output buffer encoding
Share the implementation for different encodings. We still need two functions
because endian_swap on uint8_t is ambiguous...
2015-10-12 09:15:01 -07:00
Arseny Kapoulkine
9aa28f1d05 docs: Regenerate HTML documentation 2015-10-10 13:51:34 -07:00
Arseny Kapoulkine
2ebd15b5d7 scripts: Use changelog URL as release notes 2015-10-10 13:51:01 -07:00
Arseny Kapoulkine
6b26a9a7f6 docs: Correct the acknowledgment section 2015-10-10 13:42:56 -07:00
Arseny Kapoulkine
f010cabb44 scripts: Use /Z7 for NuGet package
This avoids linker warning when building the final executable and we don't
have to package the .PDB file.
2015-10-10 13:32:40 -07:00
Arseny Kapoulkine
537aea56c6 tests: Fix version check :) 2015-10-10 13:07:53 -07:00
Arseny Kapoulkine
540424bd76 Add .gitignore 2015-10-10 13:05:04 -07:00
Arseny Kapoulkine
6fa0b39390 docs: Update changelog for 1.7 2015-10-10 13:04:06 -07:00
Arseny Kapoulkine
285fec31fc Fix 'make release' after clean checkout 2015-10-10 12:35:40 -07:00
Arseny Kapoulkine
0cfdba262e Update version to 1.7 2015-10-10 12:34:35 -07:00
Arseny Kapoulkine
99599f73e4 scripts: Fix NuGet description formatting 2015-10-10 11:53:58 -07:00
Arseny Kapoulkine
3147190f3d scripts: Cleanup NuGet packaging
Move pugixml project file for VS2015 to scripts/ and unify the output file
structure similar to old VS201x projects. Remove test projects and solution
since they are not required for building.

Provide more accurate information in the package script and handle build
errors during package construction properly.
2015-10-10 11:42:25 -07:00
Arseny Kapoulkine
c356bb071f Merge branch 'master' of https://github.com/igagis/pugixml into nuget 2015-10-10 10:55:22 -07:00
Arseny Kapoulkine
3e9cf53ea7 tests: Add a test for empty xpath_query ctor 2015-10-09 20:53:02 -07:00
Arseny Kapoulkine
bfc0f346b4 Refactor utf_decoder classes
Instead of functions with different names (e.g. decode_utf8_block), split
utf_decoder class into multiple classes with ::process static function.

This makes it easier to share code for decoding different encodings.
2015-10-09 20:46:39 -07:00
Ivan Gagis
ea190c8bd2 changed nuget name to pugixml without lib prefix 2015-10-08 13:33:54 +03:00
Arseny Kapoulkine
8ebab20fa5 Use correct type for lead in decode_utf16_block
This does not affect correctness but makes code more uniform.
2015-10-07 23:35:23 -07:00
Arseny Kapoulkine
e51a1a38e8 Refactor decode_utfN_block and decode_latin1_block
Make sure the looping structure is the same as in decode_utf8_block.
2015-10-07 22:42:37 -07:00
Arseny Kapoulkine
9f0a57a8f4 Simplify file/stream loading flow
Instead of calling xml_document public functions just call implementation of
load_buffer_inplace_own. This makes it so we only call reset() once during
load_file/load.
2015-10-07 22:06:43 -07:00
igagis
1402820ed0 Delete ReadMe.txt 2015-10-07 22:06:52 +03:00
Ivan Gagis
48beabdb3f nuget package scripts 2015-10-07 22:03:12 +03:00
Ivan Gagis
b112341a64 VisualStudio 2015 solution added 2015-10-07 21:46:35 +03:00
Arseny Kapoulkine
6e5163ba3e tests: Add a copy of header-only test
This makes sure we get linking errors whenever a symbol is not marked as inline
in header-only mode.
2015-10-06 07:26:24 -07:00
Arseny Kapoulkine
299e0b07c9 Merge pull request #58 from Breush/patch-1
Fixed missing PUGI__FN
2015-10-06 07:22:32 -07:00
A. Breust
dd2166ee27 Fixed missing PUGI__FN 2015-10-06 15:13:34 +02:00
Arseny Kapoulkine
2cda053345 scripts: Enable C++11 in CMakeLists
We now make sure that in CMake builds we have long long support. This requires
CMake 3.1 for target_compile_features.

Fixes #53 (as long as packages use this CMake script... most of them do)
2015-09-23 08:41:42 -07:00
Arseny Kapoulkine
3229e67712 Fix parsing of integers that start with +
This matches the format strtol supports.
2015-09-21 00:35:57 -07:00
Arseny Kapoulkine
b0b84277fa Merge pull request #56 from zeux/travis-osx
Add OSX to Travis CI config
2015-09-20 12:01:10 -07:00
Arseny Kapoulkine
d2252c5634 build: Reduce the build matrix
We don't need to test gcc on OSX
2015-09-20 11:48:31 -07:00
Arseny Kapoulkine
2ae191fe6f build: Add OSX to Travis config 2015-09-20 11:31:58 -07:00
Arseny Kapoulkine
1b2c1914b2 Fix signed/unsigned warnings for MSVC 2015-09-20 10:58:51 -07:00
Arseny Kapoulkine
5b86a8f612 tests: Add tests for integer overflow during conversion
These tests are only testing attribute as_int in hopes that xml_text uses the
same underlying implementation (which it does).
2015-09-20 10:48:30 -07:00
Arseny Kapoulkine
ec0c9c5561 Implement custom string to integer conversion
This makes conversion significantly faster and removes more CRT dependencies;
in particular, to support long long pugixml only requires the type itself (and
the division operator...).

New implementation is up to 3x faster on short decimal numbers.

Note that unlike the old implementation, new implementation correctly handles
overflow and underflow and clamps the value to the representable range. This
means that there are some behavior changes - e.g. previously as_uint on "-1"
would return INT_MAX instead of 0.

In addition to CRT issues, for platforms with 64-bit long old implementation
incorrectly truncated from long to int or unsigned int, so even if CRT clamped
the values the result would have been incorrect.
2015-09-20 10:43:38 -07:00
Arseny Kapoulkine
bda55c818c Remove extra const from operator= declaration
This does not really matter too much but it's better to be consistent.
2015-09-20 00:48:40 -07:00
Arseny Kapoulkine
25cce38f50 Inline widen_ascii to get rid of an extra strlen call
Also since this function is only used once and is not defined in regular mode
to avoid warnings this simplifies code a bit.
2015-09-20 00:47:20 -07:00
Arseny Kapoulkine
9c539f92ab Eliminate redundant strlen calls during set_value/set
Since we use manual integer conversion we know the length of the string.

This makes set_value(int) ~30% faster for 4-digit numbers.
2015-09-20 00:43:37 -07:00
Arseny Kapoulkine
5750b7cc19 Force callers of strcpy_insitu to compute string length
This makes it possible to avoid calling strlen if we already know the string
size.
2015-09-20 00:19:30 -07:00
Arseny Kapoulkine
131c1a159c Implement integer to string conversion manually
This reduces the amount of non-standard C++ functionality pugixml may be using
by avoiding sprintf with %lld; additionally this implementation is significantly
faster (4-5x) than sprintf, mostly due to avoiding format string parsing and
stream setup that commonly happens in CRT implementations.

This comes at the expense of requiring long long division/remainder operations
if PUGIXML_USE_LONG_LONG is defined which will surely bite me one day.
2015-09-20 00:03:02 -07:00
Arseny Kapoulkine
234c2f3657 tests: Convert several files to Unix line endings
They were still using Windows EOL by mistake
2015-09-19 00:14:18 -07:00
Arseny Kapoulkine
d62b2541d7 Update README.md 2015-08-25 10:42:59 -07:00
Arseny Kapoulkine
abdba2235d build: Fix -o gcov option
Also upload just pugixml.cpp.gcov to codecov to avoid issues the script has
with old gcov.
2015-08-25 10:36:44 -07:00
Arseny Kapoulkine
c7acc6d1f4 build: Rework config=coverage to be more robust
Use find -exec instead of xargs to work around differences between xargs on OSX
and Linux.

Use -b option of gcov - for some reason gcov on Travis can't find .gcno files
otherwise (old version?).

And finally enable config=coverage again.
2015-08-25 09:57:21 -07:00
Arseny Kapoulkine
9865f042ed build: Disable config=coverage for now 2015-08-25 09:25:32 -07:00
Arseny Kapoulkine
ff85f2106c build: Actually use config=coverage 2015-08-25 08:18:13 -07:00
Arseny Kapoulkine
440116a75b build: Test codecov.io integration 2015-08-25 08:14:26 -07:00
Arseny Kapoulkine
1d854cd420 build: Simplify coverage configuration
Use -coverage option and keep NDEBUG off
2015-08-25 08:14:20 -07:00
Arseny Kapoulkine
ce4ac17780 docs: Clarify UTF-8 vs wchar_t memory efficiency 2015-08-14 07:55:24 -07:00
Arseny Kapoulkine
c55e551235 docs: Add PUGIXML_COMPACT documentation
Also add PUGIXML_COMPACT to pugiconfig.hpp
2015-08-14 07:55:24 -07:00
Arseny Kapoulkine
fd0467c568 Minor get_integer_base optimization
Remove an extra branch.
2015-08-14 07:55:24 -07:00
Arseny Kapoulkine
f738675f1d Fix two UB sanitizer false positives
Change the expression to reference the array element indirectly. The memory
block can be bigger than the structure so it's invalid to use static data[]
size for bounds checking.
2015-07-26 21:04:52 -07:00
Arseny Kapoulkine
bd7a8fa4bf XPath: Increase memory block alignment to 8 bytes
To be more precise, the memory block is now aligned to be able to reliably
allocate objects with both double and pointer fields. If there is a platform
with a 4-byte double and a 4-byte pointer, the memory block alignment there will
stay the same after this change.

Fixes #48.
2015-07-25 17:08:19 -04:00
Arseny Kapoulkine
e8fdd1303c tests: Fix test allocator to provide fundamental alignment
Previously test allocator only guaranteed alignment enough for a pointer.

On some platforms (e.g. SPARC) double has to be aligned to 8 bytes but pointers
can have a size of 4 bytes. This commit increases allocation header to fix that.

In practical terms the allocation header is now always 8 bytes.
2015-07-25 17:04:17 -04:00
Arseny Kapoulkine
66f242a4a9 XPath: Refactor block allocation
Extract memory page size and block alignment into named constants.
2015-07-25 17:01:30 -04:00
Arseny Kapoulkine
a562bf6d3c tests: Only enable page heap on x86/x64
This fixes tests in PUGIXML_NO_XPATH mode on SPARC64 (#48).

SPARC does not allow unaligned accesses - e.g. you can't read an unaligned int.
Normally pugixml does not perform unaligned integer/pointer accesses, but page
heap can allocate blocks that are not aligned so that we can detect a single-
byte read/write overrun.

Additionally, the hardcoded page size we're currently using is really system
specific - on SPARC the page size can be 8 Kb instead of 4 Kb so mprotect can
fail.
2015-07-25 14:19:08 -04:00
Arseny Kapoulkine
4460da54a1 XPath: Split optimize into optimize and optimize_self
This makes the code slightly more readable, but more importantly it fixes a
false positive in Clang static analyzer.

Fixes #47.
2015-07-22 21:07:44 -07:00
Arseny Kapoulkine
d4fedd6775 docs: Clarify hash_value behavior
Fixes #43.
2015-06-24 09:45:26 -07:00
Arseny Kapoulkine
238b786bfe Makefile now supports Xcode 7 ASAN
All other sanitizers are still unavailable so only enable them on non-OSX
systems.
2015-06-13 00:00:08 -07:00
Arseny Kapoulkine
d04df2a48b Fix Clang 3.7 compatibility
Apparently Clang 3.7 implements C++ DR 1748 that makes placement new with null
pointer undefined behavior. Which renders all C++ programs that rely on this
invalid. Which includes pugixml.

This is not very likely to happen in the wild because the allocations that are
subject to this in pugixml are relatively small, but tests break because of
this.

Fix the issue by adding null pointer checks (that are completely redundant in
all current compilers except Clang 3.7 but it's not like there is another
option).
2015-06-12 23:59:35 -07:00
Arseny Kapoulkine
97afc16ef2 tests: Add newline at the end of file 2015-05-22 20:20:03 -07:00
Arseny Kapoulkine
2a1aa9663b Fix MSVC7 compilation
Work around a name lookup bug by pulling auto_deleter name in the local
scope. We could also move auto_deleter to pugi:: namespace, but that
pollutes it unnecessarily for other compilers.
2015-05-22 18:05:30 -07:00
Arseny Kapoulkine
fc1dcab79d tests: Fix MSVC6 compilation 2015-05-22 08:43:36 -07:00
Arseny Kapoulkine
677e95010e Move default value handling into as_ functions
This makes get_value_* simpler and also works around DMC compilation issue.
2015-05-22 08:42:32 -07:00
Arseny Kapoulkine
243839012a XPath: Use strtod instead of atof
This makes code more consistent between wchar/utf8 mode.
2015-05-20 08:31:00 -07:00