0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-26 21:04:25 +08:00

1541 Commits

Author SHA1 Message Date
Wolfgang Stöggl
fdf0295753 Fix minor typos (#286)
- Typos were found by codespell v1.15.0
2019-08-21 07:46:11 -07:00
Arseny Kapoulkine
a556845555 tests: Work around test warnings in clang-7
Self-assignment generates a Wself-assign-overloaded warning.
2019-08-21 07:45:27 -07:00
Matan Nassau
4f6e7454fd fix cmake option USE_POSTFIX (#283)
appending the suffix to the build product need not be a function of
whether CMAKE_CONFIGURATION_TYPES is set.  for example, having two ninja
build trees---one for debug and another for release---is a fine use-case
for USE_POSTFIX.
2019-08-04 13:15:10 -07:00
Artur Leonov
c5752917c7 fix running tests (#280) 2019-07-25 19:14:39 -07:00
m-naumann
5a867cb1e3 Add support for using single quotes to enclose attribute values
This change adds format_attribute_single_quote flag that uses single quotes (`'`) instead of double quotes (`"`) for formatting attribute values.

Internal quotation marks are escaped using `"` and `'`.
2019-06-18 19:51:10 -07:00
Arseny Kapoulkine
fcb7c8d3e5
Merge pull request #276 from denchat/patch-1
std::random_shuffle is removed in current standard
2019-06-09 11:55:36 -07:00
denchat
86e0fe1980
Fix forgotten indentation 2019-06-10 00:35:17 +07:00
denchat
1312a46d91
std::random_shuffle is removed in current standard
use <random> 's generator and std::shuffle instead
2019-06-10 00:14:21 +07:00
Arseny Kapoulkine
7247a823b7 XPath: Add missing inline/PUGI__FN specifiers
Also split one-liner if/for loops for better readability and coverage.
2019-03-17 07:14:11 -07:00
Arseny Kapoulkine
cdd5d92f26
Merge pull request #265 from zeux/nocontrib
Remove contrib folder
2019-03-16 18:26:28 -07:00
Arseny Kapoulkine
29f3177d10 Remove contrib from Makefile and readme.txt 2019-03-13 23:17:23 -07:00
Arseny Kapoulkine
434c4a4d41 Remove contrib folder
This change removes contrib folder since it doesn't seem very useful;
Natvis scripts can and should go to scripts/ along with project files.

foreach.hpp is supporting a severely outdated BOOST_FOREACH construct;
in C++11 ranged for loop can be used with xml_node::children/attributes,
and BOOST_FOREACH can work with these as well.

foreach.hpp was also accidentally licensed as public domain which isn't
very helpful when the actual library is MIT. We could fix the license
but it seems better to just remove it.

Fixes #264.
2019-03-13 21:30:10 -07:00
Arseny Kapoulkine
8bf806c035 tests: Move control char tests to test_write.cpp
Also fix code style.
2019-03-09 06:58:07 -08:00
Arseny Kapoulkine
b01569918a docs: Regenerate HTML documentation
Includes wording fixes and format_skip_control_chars
2019-03-09 06:55:55 -08:00
Arseny Kapoulkine
b9a0d7ff23
Merge pull request #263 from Yanpas/fix_char_esc
format_skip_control_chars
2019-03-09 06:54:48 -08:00
Yan Pas
138976fd95 unit test and doc 2019-03-08 19:17:19 +03:00
Yan Pashkovsky
66e1b4e03e format_skip_control_chars 2019-03-07 17:54:30 +03:00
WheretIB
36e274d949 Visual Studio Natvis visualization for compact mode 2019-02-28 04:29:56 -08:00
Arseny Kapoulkine
12e8b699ce tests: Expand out-of-memory union tests
We now have two tests: one tests behavior when we run out of space when
appending the node set (in which case the append fails), another one
tests behavior when we run out of space when filtering the node set (in
which case the set still contains redundant data).
2019-02-26 23:57:58 -08:00
Arseny Kapoulkine
c55ea3bc1e XPath: Make remove_duplicates generate stable order
Given an unsorted sequence, remove_duplicates would sort it using the
pointer value of attributes/nodes and then remove consecutive
duplicates.

This was problematic because it meant that the result of XPath queries
was dependent on the memory allocation pattern. While it's technically
incorrect to rely on the order, this results in easy to miss bugs.

This is particularly common when XPath queries use union operators -
although we also will call remove_duplicates in other cases.

This change reworks the code to use a hash set instead, using the same
hash function we use for compact storage. To make sure it performs well,
we allocate enough buckets for count * 1.5 (assuming all elements are
unique); since each bucket is a single pointer unlike xpath_node which
is two pointers, we need somewhere between size * 0.75 and size * 1.5
temporary storage.

The resulting filtering is stable - we remove elements that we have seen
before but we don't change the order - and is actually significantly
faster than sorting was.

With a large union operation, before this change it took ~56 ms per 100
query invocations to remove duplicates, and after this change it takes
~20ms.

Fixes #254.
2019-02-26 23:57:58 -08:00
Arseny Kapoulkine
930a701f1f tests: Disable flaky test
This test is very sensitive to the particular implementation of union
aggregation; for now lets disable this.

We need a more robust way to test union allocation failures.
2019-02-26 22:15:34 -08:00
Arseny Kapoulkine
93c7bacb29 XPath: Create set for a|b in order before duplicate filtering
This does not change the result of a union operation [substantially], but
it means that we now give a list to remove_duplicates that has more natural
ordering.

If remove_duplicates didn't sort the array, we'd have union operations
resulting in a consistent predictable order.

Contributes to #254.
2019-02-26 21:39:52 -08:00
Arseny Kapoulkine
d902709da2 Refactor CMakeLists.txt support for multiple targets
We now have a ${LIBRARY} variable that we can either use directly or in
a foreach loop to be able to process either pugixml or pugixml-static
and pugixml-shared targets.

Also fixes incorrect shared library assignment when
BUILD_SHARED_AND_STATIC_LIBS is defined, and only links the static
library in for make check.
2019-02-06 08:15:27 -08:00
basti171
1d59e4d9d8 make pugixml build static and shared via cmake (#257) 2019-02-06 07:39:23 -08:00
Arseny Kapoulkine
160c1c23d9
docs: Improve null node comparison wording
Change confusing wording: null nodes compare as equal to null handles, the previous wording implied that each null handle is unique
2019-01-25 16:42:25 -08:00
Arseny Kapoulkine
b67ef29c08 docs: Draw attention to the fact that you have to compile pugixml.cpp
This may or may not make it more clear that pugixml.cpp has to be
compiled - either as one of the projects or as a standalone project via
CMake et al - for it to work by default.

Fixes #256.
2019-01-19 18:25:25 -08:00
Arseny Kapoulkine
9fcae40bb5 Happy New Year! 2019-01-01 23:05:04 +03:00
Millian Poquet
b3db08ffcc pkg-config: Use CMake GnuInstallDirs FULL vars
Fixes an installation problem in Nix packages, as non-FULL variables are
already absolute paths in this case.
2018-12-10 11:12:36 -08:00
Arseny Kapoulkine
ba84465d2e Move unreachable line handling to Makefile
This allows us to reuse this code for MinGW builds.

Additionally disable coverage step for Linux clang - it looks like
Travis has a mismatch in the version of gcov info between clang and gcov
which causes gcov to crash - somehow this crash isn't picked up as a
build error.
2018-12-10 11:12:13 -08:00
Arseny Kapoulkine
2da1524977 Add PUGIXML_WCHAR_MODE configuration to MinGW tests
We are currently only testing UTF8 mode which means we don't have code
coverage for some UTF->UTF decoding paths.
2018-12-09 17:20:02 -08:00
Arseny Kapoulkine
7d0d8ee79f Update .travis.yml
This is a dummy commit to trigger codecov build
2018-12-09 16:31:22 -08:00
Arseny Kapoulkine
4b57d09882 Add support for MinGW builds on AppVeyor
Use cygwin to build coverage build and upload coverage data to codecov.
2018-12-09 16:16:59 -08:00
Arseny Kapoulkine
7664bbf9af tests: Only use load_file_special_folder test on macOS
The behavior on Linux is very different between kernel versions, and it
triggers an unexpected OOM during sanitizer runs because somehow the
size is reported to be LONG_MAX. It's not clear that it helps us cover
any paths we don't cover otherwise - it would be nice to be able to test
failing to load a multi-gigabyte file on a 32-bit system, but we can't
do this easily atm anyway.
2018-11-27 08:07:31 -08:00
Arseny Kapoulkine
1a9c3f66db Enable config=sanitize in Travis CI
This commit changes sanitize configuration to fail on the first error
and ignore floating-point division and overflow "errors" that trigger
when we test the corresponding functionality. This makes it possible to
run this on all commits - if new UB or memory safety issues are introduced,
asan/ubsan will catch them.
2018-11-27 08:07:31 -08:00
Arseny Kapoulkine
f9a2a7d19e Fix Wdouble-promotion warnings
We had a few places in test code and library source where we used an
implicit float->double cast; while it should preserve the value exactly,
gcc/clang implement this warning to make sure uses of double are intentional.

This change also adds the warning to Makefile to make sure we don't
regress on this warning.

Fixes #243.
2018-11-23 23:39:22 -08:00
Arseny Kapoulkine
aac75cd299 Escape TAB character in attribute values with &#09;
This change modifies the table entries for ctx_special_attr to treat TAB
character as special, which makes the output code escape it.

Before this change, trying to use TAB in an attribute value would output
it verbatim; during subsequent parsing, pugixml - and other compliant
parsers - would apply attribute-value normalization, turning the TAB
into a space and losing the original value.

Using &#09; fixes this; if an input document has &#09; in an attribute
value, that gets unescaped into \t during parsing and escaped back into
&#09; during output, which means we can now roundtrip values like this.

Fixes #242.
2018-11-19 22:26:21 -08:00
cecilios
7d2436ec2f Add coverity annotations 2018-11-16 15:25:12 -08:00
Arseny Kapoulkine
fa686f004a Update all URLs to pugixml.org to https:// 2018-11-12 12:28:54 -08:00
Wolfgang Stöggl
d3dd79d54d Update URL to https in pugixml.pc.in 2018-11-12 07:49:54 -08:00
Arseny Kapoulkine
d9fadc7464 XPath: Workaround Coverity false positive
Coverity hits a similar false positive to what clang static analyzer hit
- it assumes that since optimize() checks _right for being nullptr,
optimize_self() might hit _right=nullptr in the ast_op_equal case which
is impossible.

Contributes to #236.
2018-10-23 21:40:18 -07:00
Dan Lipsa
273fa0ab26 Remove warning in Visual Studio (#235)
The following warning is removed:
Visual Studio 14.0
1. warning C4275: non dll-interface class 'std::exception' used as
   base for dll-interface class 'vtkpugixml::xpath_exception'
2018-10-16 08:43:32 -07:00
Arseny Kapoulkine
81c82588bd Work around clang --analyze warnings
clang doesn't understand the invariants guaranteed for specific AST node
types and, when seeing null pointer checks in optimize(), assumes any
pointers in the node might be null. Work around this by adding explicit
- redundant - null pointer checks.
2018-09-24 20:38:09 -07:00
Arseny Kapoulkine
e3b5e9ce3c XPath: Refactor xpath_node_set short buffer optimization
This change replaces xpath_node_set single element storage with a
single-element array in hopes that this would silence Coverity false
positive about getting a singleton pointer.

Additionally, it refactors _assign member to unify small and large
buffer codepaths since they are basically identical.

Fixes #233 (hopefully)
2018-09-24 20:19:31 -07:00
Arseny Kapoulkine
1a96777b11 tests: Fix XPath denorm tests on Intel compiler
Intel compiler by default sets flush-to-zero flags which causes our
denorm test to produce 0.0. So make sure that denorms work on FPU before
testing the string output.

Fixes #218.
2018-08-13 22:06:57 -07:00
Arseny Kapoulkine
cb4a74d5e5 Minor CMakeLists.txt cleanup
Instead of hardcoding SOVERSION, use CMake variables to set it up.

Closes #220.
2018-08-13 21:38:44 -07:00
Vyacheslav Egorov
c51214f21e Visual Studio Natvis visualization (#227)
* Visual Studio Natvis visualization

* Changed string format to remove separate natvis file for wide character mode

* Display any node type with name and value if any of them are available
2018-08-07 17:03:37 -07:00
Arseny Kapoulkine
6b9c07e6ed tests: Allow document_load_file_special_folder to load empty document
On some Debian systems it looks like we *can* open the current folder as
a file and read its contents, but parsing the result produces an empty
document. We now handle this case as well.

Fixes #225.
2018-07-30 07:32:09 -07:00
Arseny Kapoulkine
514478d1f8 Fix version comment; 190 = 1.9.0 (major.minor.patch)
Fixes #224.
2018-07-28 08:08:45 -07:00
Arseny Kapoulkine
f3139f4c04 Add .gitattributes file
This makes sure the contents of tests/data/ folder does not go through
newline conversion, which breaks tests that rely on some files having LF
and some files having CR+LF.

Fixes #222.
2018-07-23 23:13:02 -07:00
Arseny Kapoulkine
699143c5d4 scripts: Set file permissions when building .zip archive
It looks like zipfile module by default uses the permission mask 0,
which after unpacking on Unix-based systems leads to the files being
inaccessible.

We now explicitly set file mask to rw-r--r-- to match .tar.gz defaults.

Fixes #217.
2018-07-22 18:57:10 -07:00