0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-31 00:13:01 +08:00

1259 Commits

Author SHA1 Message Date
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