0
0
mirror of https://github.com/zeux/pugixml.git synced 2025-01-13 09:17:59 +08:00

1824 Commits

Author SHA1 Message Date
Arseny Kapoulkine
c712dd84ba Specify std=c++11 explicitly in Travis configurations
That way the defaults in the Makefile only matter for local runs.
2016-01-26 21:43:48 -08:00
Arseny Kapoulkine
c3d27daf8e Merge pull request #83 from ogdf/use-real-standards-only
Add cxxstd Makefile argument for testing C++ standards
2016-01-26 20:28:10 -08:00
Stephan Beyer
e017a22fe0 Let Travis CI perform C++98-based tests 2016-01-26 22:14:58 +01:00
Stephan Beyer
6bbbdb7d7e Make cxxstd an argument to Makefile
This determines the used C++ standard.
If you do not want to use a specific C++ standard, use cxxstd=any.
The default is set to c++11.

The "define" PUGIXML_NO_CXX11 is removed from the Makefile
since it is not used in the code anyways.
2016-01-26 22:14:58 +01:00
Stephan Beyer
fb647f69a2 Let Travis CI use Ubuntu trusty
This allows to perform C++11-based tests on the Linux.
2016-01-26 21:53:16 +01:00
Stephan Beyer
fc9073289f test_parse.cpp: add newline to last line
This is necessary in order to comply with the C++03 standard.
2016-01-24 19:47:06 +01:00
Arseny Kapoulkine
e133764f33 Merge pull request #81 from ogdf/whitespace-issues
Fix whitespace issues
2016-01-24 08:56:06 -08:00
Stephan Beyer
f7aa65db8a Fix whitespace issues
Git warns when it finds "whitespace errors". This commit gets
rid of these whitespace errors for code and adoc files.
2016-01-24 14:05:44 +01:00
Arseny Kapoulkine
7f91301946 Change header format in non-compact mode to store page offset
This utilizes the fact that pages are of limited size so we can store offset
from the object to the page in a few bits - we currently use 24 although that's
excessive given that pages are limited to ~512k.

This has several benefits:

- Pages do not have to be 64b aligned any more - this simplifies allocation flow
and frees up 40-50 bytes from xml_document::_memory.

- Header now has 8 bits available for metadata for both compact and default mode
which makes it possible to store type as-is (allowing easy type extension and
removing one add/sub operation from type checks).

- One extra bit is easily available for future metadata extension (in addition
to the bit for type encoding that could be reclaimed if necessary).

- Allocators that return 4b-aligned memory on 64-bit platforms work fine if
misaligned reads are supported.

The downside is that there is one or two extra instructions on the allocation
path. This does not seem to hurt parsing performance.
2016-01-20 21:51:02 -08:00
Arseny Kapoulkine
7aef75f43d docs: Adjust as_int documentation to match implementation
Also remove the description of behavior for trailing non-numeric characters.
It's likely this will become a parse error in the future so better leave it
as unspecified for now.

Fixes #80.
2016-01-19 21:17:08 -08:00
Arseny Kapoulkine
c388dbeba4 Merge pull request #79 from zeux/embed-pcdata
Add parse_embed_pcdata flag

This flag determines if plain character data is be stored in the parent element's value. This significantly changes the structure of the document; this flag is only recommended for parsing documents with a lot of PCDATA nodes in a very memory-constrained environment.

Most high-level APIs continue to work; code that inspects DOM using first_child()/value() will have to be adapted.
2016-01-14 07:52:40 -08:00
Arseny Kapoulkine
4f3be76167 Preserve order semantics for child_value/text when using parse_embed_pcdata
The performance cost is probably negligible and this means we treat embedded
value as the first child consistently.
2016-01-12 20:41:37 -08:00
Arseny Kapoulkine
85238132d3 docs: Add parse_embed_pcdata documentation 2016-01-12 20:38:45 -08:00
Arseny Kapoulkine
71d3a797f4 Adjust parse_embed_pcdata documentation
Since round-tripping should not be a problem any more don't mention it.
2016-01-12 20:18:12 -08:00
Arseny Kapoulkine
fc6c8633dd tests: Add test for parse_embed_pcdata 2016-01-12 20:16:29 -08:00
Arseny Kapoulkine
bcddf36559 Only save first PCDATA contents in the element
This change fixes an important ordering issue - if element node has a PCDATA
child *after* other elements, it's impossible to tell which order the children
were in.

Since the goal of PCDATA embedding is to save memory when it's the only child,
only apply the optimization to the first child. This seems to fix all
roundtripping issues so the only caveat is that the DOM structure is different.
2016-01-12 20:01:44 -08:00
Arseny Kapoulkine
df2a0ad28b Implement output support for embedded PCDATA values
This is a bit awkward since preserving correct indentation structure requires
a bit of extra work, and the closing tag has to be written by _start function
to correctly process the rest of the tree.
2016-01-09 17:46:42 -08:00
Arseny Kapoulkine
85d8b225f2 Support XPath string value for parse_embed_pcdata 2016-01-08 08:41:38 -08:00
Arseny Kapoulkine
8b01f8923c Support xml_node::child_value/text for parse_embed_pcdata 2016-01-08 08:40:56 -08:00
Arseny Kapoulkine
2874f6f21d Add initial support for parse_embed_pcdata
When this flag is true, PCDATA value is saved to the parent element instead of
allocating a new node.

This prevents some documents from round-tripping since it loses information,
but can provide a significant memory reduction and parsing speedup for some
documents.
2016-01-08 08:37:26 -08:00
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