0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-29 07:19:43 +08:00

789 Commits

Author SHA1 Message Date
Arseny Kapoulkine
757c494340 Improve XPath allocator performance
When allocating new pages, make sure that the page has at least 1/4 of the
base page size free. This makes sure that we can do small allocations after
big allocations (i.e. huge node lists) without doing a heap alloc.

This is important because XPath stack code always reclaims extra pages after
evaluating sub-expressions, so allocating a small chunk of memory and then
rolling the state back is a common case (filtering a node list using a
predicate usually does this).

A better solution involves smarter allocation rollback strategy, but the
implemented solution is simple and practical.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@999 99668b35-9821-0410-8761-19e4c4f06640
2014-06-01 19:12:36 +00:00
Arseny Kapoulkine
6d43ad2870 Add xpath_node_set::iterator that is the same as const_iterator.
Exposing true mutable iterators allows the user to violate sorting order
contract. However, some generic algorithms (i.e. Boost ForEach) require
iterator methods to be present.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@998 99668b35-9821-0410-8761-19e4c4f06640
2014-05-04 05:42:26 +00:00
Arseny Kapoulkine
9c5efaa074 tests: Fix Mac OS X compilation.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@997 99668b35-9821-0410-8761-19e4c4f06640
2014-04-02 05:29:19 +00:00
Arseny Kapoulkine
9f92eeba44 docs: Update release date to... today
git-svn-id: https://pugixml.googlecode.com/svn/trunk@994 99668b35-9821-0410-8761-19e4c4f06640
v1.4
2014-02-28 06:01:23 +00:00
Arseny Kapoulkine
2094a4fd3d docs: Regenerate HTML documentation
git-svn-id: https://pugixml.googlecode.com/svn/trunk@993 99668b35-9821-0410-8761-19e4c4f06640
2014-02-28 06:01:16 +00:00
Arseny Kapoulkine
6305ac11a8 docs: Fix samples compilation
git-svn-id: https://pugixml.googlecode.com/svn/trunk@992 99668b35-9821-0410-8761-19e4c4f06640
2014-02-28 06:01:13 +00:00
Arseny Kapoulkine
e33e1083ad tests: Fix WinCE compilation
git-svn-id: https://pugixml.googlecode.com/svn/trunk@991 99668b35-9821-0410-8761-19e4c4f06640
2014-02-26 22:37:40 +00:00
Arseny Kapoulkine
cfd30d903d Revert automatic support for header-only mode since it creates problems with qmake.
Qmake treats all files that are #include-d as header files, even if the #include is
guarded by an #ifdef. It looks like the only solution that allows for transparent
header-only support based on preprocessor define involves moving the actual source
into a separate header file and including this file in pugixml.cpp.

Let's not do it yet.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@990 99668b35-9821-0410-8761-19e4c4f06640
2014-02-25 03:52:10 +00:00
Arseny Kapoulkine
a5d621e1ed docs: Add parse_trim_pcdata documentation, change release date to March 1st.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@989 99668b35-9821-0410-8761-19e4c4f06640
2014-02-25 03:42:01 +00:00
Arseny Kapoulkine
5a4cedbe91 tests: Add tests for parse_trim_pcdata.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@988 99668b35-9821-0410-8761-19e4c4f06640
2014-02-25 03:41:57 +00:00
Arseny Kapoulkine
0a747e6c1a Add parse_trim_pcdata parse option.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@987 99668b35-9821-0410-8761-19e4c4f06640
2014-02-25 03:41:54 +00:00
Arseny Kapoulkine
cbd8131d09 Fix clang build.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@986 99668b35-9821-0410-8761-19e4c4f06640
2014-02-23 19:38:24 +00:00
Arseny Kapoulkine
934bddcfa6 Fix gap collapsing during PCDATA parsing for fragment mode.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@985 99668b35-9821-0410-8761-19e4c4f06640
2014-02-23 19:28:27 +00:00
Arseny Kapoulkine
bd960159dd tests: Write temporary files to executable folder.
Temp folder is the root folder on Windows; writing to the folder may require administrator rights.
We can't use current folder for temporaries because tests from different configurations can be running
in parallel, but executable folder is always safe since we only run each executable once.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@984 99668b35-9821-0410-8761-19e4c4f06640
2014-02-19 06:21:51 +00:00
Arseny Kapoulkine
cb99aa5065 Fix compilation warning for toolsets where wchar_t == char.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@983 99668b35-9821-0410-8761-19e4c4f06640
2014-02-12 04:38:57 +00:00
Arseny Kapoulkine
284f56f588 Add MSVC 12 (2013) to autotest list
git-svn-id: https://pugixml.googlecode.com/svn/trunk@982 99668b35-9821-0410-8761-19e4c4f06640
2014-02-12 04:38:54 +00:00
Arseny Kapoulkine
53ba699155 docs: Add parse_fragment to documentation and changelog
git-svn-id: https://pugixml.googlecode.com/svn/trunk@981 99668b35-9821-0410-8761-19e4c4f06640
2014-02-11 07:31:31 +00:00
Arseny Kapoulkine
47c15ad949 Implement document fragment parsing.
Introduce a notable behavior change in default parsing mode: documents without a
document element node are now considered invalid. This is technically a breaking change,
however the amount of documents it affects is very small, all parsed data still persists,
and lack of this check results in very confusing behavior in a number of cases.

In order to be able to parse documents without an element node, a fragment parsing flag is
introduced.

Parsing a buffer in fragment mode treats the buffer as a fragment of a valid XML.
As a consequence, top-level PCDATA is added to the tree; additionally, there are no
restrictions on the number of nodes -- so documents without a document element are considered
valid.

Due to the way parsing works internally, load_buffer_inplace occasionally can not preserve
the document contents if it's parsed in a fragment mode. While unfortunate, this problem is
fundamental; since the use case is relatively obscure, hopefully documenting this shortcoming
will be enough.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@980 99668b35-9821-0410-8761-19e4c4f06640
2014-02-11 06:45:27 +00:00
Arseny Kapoulkine
5fa25a878a Fix bogus Clang 3.4 warning
git-svn-id: https://pugixml.googlecode.com/svn/trunk@979 99668b35-9821-0410-8761-19e4c4f06640
2014-02-11 04:55:36 +00:00
Arseny Kapoulkine
f5a5f49802 Fix clang build.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@978 99668b35-9821-0410-8761-19e4c4f06640
2014-02-10 17:04:17 +00:00
Arseny Kapoulkine
79fb68ac41 Use a null-terminated buffer for parsing as often as possible.
Parsing used to work on a non null-terminated buffer, inserting a fake null terminator to increase performance.
This makes it impossible to implement fragment parsing that preserves PCDATA contents (as witnessed by some
tests for boundary conditions that actually depended on this behavior).

Since almost all uses result in us allocating an internal buffer anyway, the new policy is to make sure all buffers
that are allocated by pugixml are null-terminated - the only exception now is external calls to load_buffer_inplace
that don't trigger encoding conversion.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@977 99668b35-9821-0410-8761-19e4c4f06640
2014-02-10 16:57:04 +00:00
Arseny Kapoulkine
9ba26b94c7 Replace memory-management functions before every test.
In case a test sets memory-management functions to perform custom testing and fails midway,
all subsequent tests that rely on custom memory handling (i.e. threshold) can fail unexpectedly.
Setting up the functions before every test fixes this, making all tests self-contained.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@976 99668b35-9821-0410-8761-19e4c4f06640
2014-02-10 16:56:55 +00:00
Arseny Kapoulkine
9d9fd0a71f Rename parse to parse_tree and convert_buffer to convert_buffer_output to reduce overloading.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@975 99668b35-9821-0410-8761-19e4c4f06640
2014-02-10 16:56:35 +00:00
Arseny Kapoulkine
ce1d457fcd Update compatibility section of the manual
git-svn-id: https://pugixml.googlecode.com/svn/trunk@974 99668b35-9821-0410-8761-19e4c4f06640
2014-02-10 05:21:40 +00:00
Arseny Kapoulkine
acf9dee0dd Update PUGIXML_VERSION define
git-svn-id: https://pugixml.googlecode.com/svn/trunk@973 99668b35-9821-0410-8761-19e4c4f06640
2014-02-10 05:11:05 +00:00
Arseny Kapoulkine
26a7f35ca8 Fix .travis.yml script
git-svn-id: http://pugixml.googlecode.com/svn/trunk@972 99668b35-9821-0410-8761-19e4c4f06640
2014-02-09 22:02:48 +00:00
Arseny Kapoulkine
543fa8268d Add Makefile for building and running tests.
This expands and replaces the Travis-specific makefile by adding more options and correctly tracking header dependencies.
Also add wchar_t mode test to Travis configuration.



git-svn-id: http://pugixml.googlecode.com/svn/trunk@971 99668b35-9821-0410-8761-19e4c4f06640
2014-02-09 21:56:30 +00:00
Arseny Kapoulkine
7b41dce85e Add README.md for GitHub
git-svn-id: http://pugixml.googlecode.com/svn/trunk@970 99668b35-9821-0410-8761-19e4c4f06640
2014-02-09 00:28:29 +00:00
Arseny Kapoulkine
09647e2b29 Add scripts for Travis CI
git-svn-id: http://pugixml.googlecode.com/svn/trunk@969 99668b35-9821-0410-8761-19e4c4f06640
2014-02-09 00:05:19 +00:00
Arseny Kapoulkine
0456f5deea Update version to 1.4 and copyright year to 2014.
Add tentative changelog for 1.4 to the documentation.
Since Google Code no longer allows file upload, replace download links with GitHub release links.



git-svn-id: http://pugixml.googlecode.com/svn/trunk@968 99668b35-9821-0410-8761-19e4c4f06640
2014-02-08 23:01:58 +00:00
Arseny Kapoulkine
2bd99cff86 Enable long long support for C++11 and for MSVC 2008+
git-svn-id: http://pugixml.googlecode.com/svn/trunk@967 99668b35-9821-0410-8761-19e4c4f06640
2014-02-08 21:59:14 +00:00
Arseny Kapoulkine
44d3ae5e90 docs: Add long long functions and configuration documentation
git-svn-id: http://pugixml.googlecode.com/svn/trunk@966 99668b35-9821-0410-8761-19e4c4f06640
2014-02-08 21:06:21 +00:00
Arseny Kapoulkine
8c1502e64f Add PUGIXML_HAS_LONG_LONG to pugiconfig.hpp
git-svn-id: http://pugixml.googlecode.com/svn/trunk@965 99668b35-9821-0410-8761-19e4c4f06640
2014-02-08 21:03:07 +00:00
Arseny Kapoulkine
6056ba2f89 Simplify header-only mode usage: it's sufficient to define PUGIXML_HEADER_ONLY anywhere now, source is automatically included
git-svn-id: http://pugixml.googlecode.com/svn/trunk@964 99668b35-9821-0410-8761-19e4c4f06640
2014-02-08 20:44:20 +00:00
Arseny Kapoulkine
0557a06764 Fix test suite stringizing macros to be C++11-compliant
git-svn-id: http://pugixml.googlecode.com/svn/trunk@963 99668b35-9821-0410-8761-19e4c4f06640
2014-02-08 20:39:25 +00:00
Arseny Kapoulkine
f9bbc39bd9 Implement long long support if PUGIXML_HAS_LONG_LONG is defined (autodetection is not implemented yet)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@962 99668b35-9821-0410-8761-19e4c4f06640
2014-02-08 20:36:09 +00:00
Arseny Kapoulkine
c3550de72b Ignore stream errors generated by a failing tellg() for non-seekable streams
git-svn-id: http://pugixml.googlecode.com/svn/trunk@961 99668b35-9821-0410-8761-19e4c4f06640
2014-01-27 04:06:35 +00:00
Arseny Kapoulkine
0938714fa0 Change xml_named_node_iterator to be bidirectional and to match xml_node_iterator in terms of internals
git-svn-id: http://pugixml.googlecode.com/svn/trunk@960 99668b35-9821-0410-8761-19e4c4f06640
2014-01-27 03:54:05 +00:00
Arseny Kapoulkine
4d8974f1fd Replace offsetof with sizeof since some compilers don't recognize offsetof as a compile-time constant expression
git-svn-id: http://pugixml.googlecode.com/svn/trunk@959 99668b35-9821-0410-8761-19e4c4f06640
2014-01-15 18:13:51 +00:00
Arseny Kapoulkine
7f6b062e9f Implement automatic hexadecimal decoding for xml_attribute::as_int and xml_text::as_int. This is effectively a form of strtol with base 0, but without octal support.
git-svn-id: http://pugixml.googlecode.com/svn/trunk@958 99668b35-9821-0410-8761-19e4c4f06640
2014-01-15 04:28:10 +00:00
arseny.kapoulkine@gmail.com
783af79264 Fix gcc-4.9 compilation warning when using -Wstrict-overflow
git-svn-id: http://pugixml.googlecode.com/svn/trunk@957 99668b35-9821-0410-8761-19e4c4f06640
2013-12-20 08:24:38 +00:00
arseny.kapoulkine@gmail.com
79109a8546 Fix gcc-4.8 compilation warning when using -Wstrict-overflow
git-svn-id: http://pugixml.googlecode.com/svn/trunk@956 99668b35-9821-0410-8761-19e4c4f06640
2013-11-26 04:34:41 +00:00
arseny.kapoulkine@gmail.com
48600c3a9d Fix _root checking inconsistency in xml_document::destroy
git-svn-id: http://pugixml.googlecode.com/svn/trunk@955 99668b35-9821-0410-8761-19e4c4f06640
2013-08-02 02:43:13 +00:00
arseny.kapoulkine@gmail.com
888934dac6 Clarify value() behavior in header comments; hopefully that'll help with value vs child_value confusion.
git-svn-id: http://pugixml.googlecode.com/svn/trunk@954 99668b35-9821-0410-8761-19e4c4f06640
2013-07-27 11:32:44 +00:00
arseny.kapoulkine@gmail.com
cac6b8720a Make sure newlines are consistent for both .zip and .tar.gz archives
git-svn-id: http://pugixml.googlecode.com/svn/trunk@953 99668b35-9821-0410-8761-19e4c4f06640
2013-07-20 05:55:22 +00:00
arseny.kapoulkine@gmail.com
63c0f55ee7 docs: Fix manual.xsl to work with newer xsltproc
git-svn-id: http://pugixml.googlecode.com/svn/trunk@950 99668b35-9821-0410-8761-19e4c4f06640
2013-07-10 06:10:03 +00:00
arseny.kapoulkine@gmail.com
e300701d3f docs: XPath select_single_node sample checks return value for clarity
git-svn-id: http://pugixml.googlecode.com/svn/trunk@949 99668b35-9821-0410-8761-19e4c4f06640
2013-07-10 04:47:25 +00:00
arseny.kapoulkine@gmail.com
4c57df7cb6 docs: Minor grammar fix
git-svn-id: http://pugixml.googlecode.com/svn/trunk@948 99668b35-9821-0410-8761-19e4c4f06640
2013-07-10 04:46:59 +00:00
arseny.kapoulkine@gmail.com
ff14ae6daf Fix documentation building on Linux
git-svn-id: http://pugixml.googlecode.com/svn/trunk@947 99668b35-9821-0410-8761-19e4c4f06640
2013-07-10 04:38:21 +00:00
arseny.kapoulkine@gmail.com
4e1add1a46 Fix invalid assertion in XPath: reallocation can result in allocating buffer of the same size due to pointer-sized alignment
git-svn-id: http://pugixml.googlecode.com/svn/trunk@946 99668b35-9821-0410-8761-19e4c4f06640
2013-03-20 02:44:05 +00:00