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

1825 Commits

Author SHA1 Message Date
Rosen Penev
e672b1c9f0
fix cygwin compilation 2021-05-06 23:25:29 -07:00
Arseny Kapoulkine
5df537f348
Merge pull request #419 from neheb/ranges
add empty method
2021-04-27 23:37:06 -07:00
Rosen Penev
c167259e60 add empty method
Simple and allows to avoid using std::distance.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-27 13:55:02 -07:00
Arseny Kapoulkine
5d58e94b6d
Merge pull request #418 from neheb/ranges
remove const from xml_node_iterator ++/--

Fixes #417.
2021-04-26 14:32:51 -07:00
Rosen Penev
ef257796db remove const from operator++/--
This prevents usage with C++20 ranges since it does not satisfy
std::weakly_incrementable.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-26 14:06:19 -07:00
Arseny Kapoulkine
08b3433180
Merge pull request #394 from zeux/cmake-yay
Don't define pugixml import target if it already exists
v1.11.4
2020-12-22 08:41:08 -08:00
Arseny Kapoulkine
06868c8f57 Don't define pugixml import target if it already exists
This fixes duplicate target definition errors when find_package(pugixml)
is called twice in a build.

Fixes #393.
2020-12-22 08:15:11 -08:00
Arseny Kapoulkine
0e3f1699ff
Merge pull request #391 from zeux/cmake-omg
Fix compatibility issue with CMake 3.10
v1.11.3
2020-12-18 09:52:06 -08:00
Arseny Kapoulkine
e2bc4f4af2 Fix compatibility issue with CMake 3.10
target_link_libraries/INTERFACE doesn't seem to work on CMake 3.10, but
directly setting the property does work.

Fixes #390.
2020-12-18 09:07:44 -08:00
Arseny Kapoulkine
907955280f
Merge pull request #389 from mathstuf/fix-alias-compat-target
cmake: avoid ALIAS target
v1.11.2
2020-12-14 19:47:56 -08:00
Ben Boeckel
4feab60bb7 cmake: avoid ALIAS target
This is not allowed on IMPORTED targets.
2020-12-10 12:02:01 -05:00
Arseny Kapoulkine
5a0fd5d85f docs: Rebuild HTML documentation v1.11.1 2020-12-04 16:31:20 -08:00
Arseny Kapoulkine
68a92aa972
Merge pull request #384 from mathstuf/update-1.11-release-notes
Update 1.11 release notes
2020-12-04 15:59:40 -08:00
Ben Boeckel
d1d415e666 docs: add a note about the new imported target name for CMake 2020-12-02 17:17:21 -05:00
Ben Boeckel
5063e87499 cmake: provide a compatibility target for users
For users using older pugixml releases, add an ALIAS target which works
with the new versions too.
2020-12-02 17:16:47 -05:00
Arseny Kapoulkine
7a9da11d8b scripts: Convert archive.py to Python 3
The changes are mostly mechanically converting str to bytes.
v1.11
2020-11-26 01:08:07 -08:00
Arseny Kapoulkine
a3ae05cc9f scripts: Remove deprecated iconUrl from NuGet package
The logo.svg link is dead anyway.
2020-11-26 01:01:57 -08:00
Arseny Kapoulkine
fe4bc946b2 Update copyright year to 2020 everywhere 2020-11-26 01:00:27 -08:00
Arseny Kapoulkine
632c042a35
Merge pull request #383 from zeux/next-release
Update version to 1.11 and update documentation
2020-11-25 14:37:35 -08:00
Arseny Kapoulkine
70bd6a6b0a Update version to 1.11 and update documentation 2020-11-25 10:18:42 -08:00
Arseny Kapoulkine
8afc1239a3 tests: Fix test fallout for MSVC6
One more XPath test falls prey to MSVC6 NaN comparison codegen issues.
2020-11-25 09:48:19 -08:00
Arseny Kapoulkine
5f97d5d66f Fix -Wshadow in remove_children()
child variable was shadowing xml_node::child
2020-11-25 09:28:26 -08:00
Arseny Kapoulkine
28aebf2b22
Merge pull request #382 from zeux/TheNicker-master
Fix MSVC deprecation warnings when using clang-cl
2020-11-25 09:19:24 -08:00
Arseny Kapoulkine
df42668e18 Cleanup code and feature detection
We now use open_file similarly to open_file_wide, and activate the
workaround for MSVC 2005+ since that's when the _s versions were added
in the first place.
2020-11-25 08:38:22 -08:00
Arseny Kapoulkine
30761e48df
Merge pull request #376 from jjmccollum/mingw-dll-fix
Added fix to pugixml_dll.rc so shared lib can be built with MinGW
2020-10-26 15:48:58 -07:00
James McCollum
24e454066d Added fix to pugixml_dll.rc so shared lib can be built with MinGW 2020-10-26 08:17:46 -04:00
Arseny Kapoulkine
c4bae8d818
Merge pull request #370 from zeux/xpath-rec
XPath: Fix stack overflow in functions with long argument lists
2020-09-11 13:06:44 -07:00
Arseny Kapoulkine
8e5b8e0f46 XPath: Fix stack overflow in functions with long argument lists
Function call arguments are stored in a list which is processed
recursively during optimize(). We now limit the depth of this construct
as well to make sure optimize() doesn't run out of stack space.
2020-09-11 09:50:41 -07:00
Arseny Kapoulkine
a3fad540a7
Merge pull request #369 from zeux/xpath-rec
XPath: Restrict AST depth to prevent stack overflow
2020-09-10 09:53:25 -07:00
Arseny Kapoulkine
20aef1cd4b Fix stack overflow in tests on MSVC x64
The default stack on MSVC/x64/debug is sufficient for 1692 nested
invocations only, whereas on clang/linux it's ~8K...

For now set the limit to be conservative.
2020-09-10 09:11:46 -07:00
Arseny Kapoulkine
c7090e6c33 Fix tests in wchar mode 2020-09-10 01:07:48 -07:00
Arseny Kapoulkine
1f84db837b XPath: Restrict AST depth to prevent stack overflow
XPath parser and execution engine isn't stackless; the depth of the
query controls the amount of C stack space required.

This change instruments places in the parser where the control flow can
recurse, requiring too much C stack space to produce an AST, or where a
stackless parse is used to produce arbitrarily deep AST which will
create issues for downstream processing.

As a result XPath parser should now be fuzz safe for malicious inputs.
2020-09-10 00:55:26 -07:00
Lior Lahav
c258fba6f1 Replaced fopen and _wfopen deprecated functions with the safer fopen_s and _wfopen_s 2020-07-21 22:37:16 +03:00
Arseny Kapoulkine
22401bafaf
Merge pull request #363 from c72578/2020-07-15_Fix_pkgconfig_lib_postfix
Fix debug postfix in pkgconfig file
2020-07-15 14:05:14 -07:00
Wolfgang Stöggl
8b074b171f Fix debug postfix in pkgconfig file
In case of USE_POSTFIX, the POSTFIX is dependent
on the CMAKE_BUILD_TYPE.
Use the correct POSTFIX also in the generated pugixml.pc file.

This results in the following contents of pugixml.pc:
- Release:
  Libs: -L${libdir} -lpugixml
- RelWithDebInfo
  Libs: -L${libdir} -lpugixml_r
- MinSizeRel:
  Libs: -L${libdir} -lpugixml_m
- Debug:
  Libs: -L${libdir} -lpugixml_d
2020-07-15 21:59:05 +02:00
Arseny Kapoulkine
d58115e581
Merge pull request #360 from julianxhokaxhiu/patch-1
[Cmake] Static build should not export APIs
2020-07-06 09:22:06 -07:00
Arseny Kapoulkine
45271c9c9c
Merge pull request #361 from zeux/ps-stderr
Fix PowerShell errors on stderr
2020-07-06 09:21:46 -07:00
Arseny Kapoulkine
f08768d9bf Fix PowerShell errors on stderr
PS invocation of code coverage upload gets triggered because of stderr
output from curl with progress report when uploading coverage.
2020-07-06 08:32:24 -07:00
Julian Xhokaxhiu
5fdc78b66b
[Cmake] Static build should not export APIs
Fixes #359
2020-07-06 10:22:21 +02:00
Arseny Kapoulkine
23ca940487 Work around a false positive in MSVC debug runtime checker
In some MSVC versions on x64 configurations, the hashing function
triggers this failure:

Run-Time Check Failure #1 - A cast to a smaller data type has caused a
loss of data.  If this was intentional, you should mask the source of
the cast with the appropriate bitmask.

This is similar to the integer sanitizer - this code is valid C++ but
MSVC decides to warn about this nonetheless. Masking the pointer's low
32 bits fixes the issue.

Fixes #357.
2020-06-13 08:41:22 -07:00
Arseny Kapoulkine
a196b9b7e9
Merge pull request #353 from jhasse/nullptr-in-header
Use nullptr in pugixml.hpp if available, see #91
2020-05-11 10:26:05 -07:00
Jan Niklas Hasse
c2d90c49f9 Use nullptr in pugixml.hpp if available, see #91 2020-05-10 17:28:30 +02:00
Arseny Kapoulkine
f49d7acdfb Clarify the document element behavior.
pugixml currently unconditionally accepts documents with multiple
top-level element nodes in absence of parse_fragment. This is an
unfortunate omission; while it can be corrected, it will result in
regressions for some users, and it's trivial to perform the validity
check after the parse is done.

Because of this, for now we're just going to amend documentation here to
both highlight this in the W3C Conformance section, but also to more
strongly push users into realizing that there's just a single document
element (normally).

We might decide to change the behavior here to prohibit such documents
by default in the future, but for now a documentation change seems like
a better tradeoff.

Fixes #337
2020-05-02 09:47:34 -07:00
Arseny Kapoulkine
285776354d
Merge pull request #349 from KyleFromKitware/cmake-improvements
Various CMake improvements
2020-05-02 09:36:58 -07:00
Kyle Edwards
d272f11073 Export targets from build directory
This will allow projects to use pugixml from its build directory
rather than having to install it.
2020-04-27 16:02:56 -04:00
Arseny Kapoulkine
ef9cafa9ce
Merge pull request #348 from rip-nsk/source_and_header-only_linkage_options
Add "Include pugixml.cpp" and "Header Only" linkage options
2020-04-27 11:15:15 -07:00
Kyle Edwards
184e6ed916 Use COMPONENT arguments in install() commands 2020-04-27 13:47:58 -04:00
Kyle Edwards
8c74d8b198 Fix multiple-rules-for-target error
The old logic for BUILD_SHARED_LIBS and BUILD_SHARED_AND_STATIC_LIBS
would produce two targets with the same name and different build
rules. The Makefile generator tolerated this, but the Ninja generator
raised an error. Fix the logic so that only one shared and one static
target gets built, and make the pugixml target an ALIAS of the one
dictated by BUILD_SHARED_LIBS.
2020-04-27 13:47:58 -04:00
rip.nsk
ab86960e48 Add "Include pugixml.cpp" and "Header Only" linkage options 2020-04-24 17:56:46 -07:00
Arseny Kapoulkine
5e64076af9 Adjust node_copy_tree to be more explicit about invariants
The loop traverses the source tree and simultaneously builds up a copy
of it at destination. Short of race conditions, this code is safe -
however, it's not obvious that dit stays inside the destination tree.

This change adds a few assertions to help enforce/document these
invariants. One particular subtlety is that dit can actually *become*
null after we exit out of the loop, but it's guaranteed to only do so
once sit goes back to sn.

This is only possible when doing a full document copy - for some reason
we weren't using this for that (in reset(xml_document)), but we are now.

Fixes #314.
2020-02-19 21:02:33 -08:00
Arseny Kapoulkine
76c3914484 XPath: Remove the use of fallthrough switch cases
We were previously relying on non-standard comment detection that is
supported by gcc/clang to avoid warnings about implicit fallthrough.

This can be solved using attributes but using them requires a lot of
compiler-specific detection logic because not all versions of gcc/clang
support them.

We don't *really* need to rely on fallthrough here - the type conversion
block can be located *after* the AST type switch instead, which means
that any AST type that has type ambiguity can fall back to that in the
future.

Fixes #331.
2020-02-19 07:50:59 -08:00
Arseny Kapoulkine
6fbe927575
Merge pull request #330 from LocutusOfBorg/patch-2
Update CMakeLists.txt to rename the static and shared libraries to pugixml
2020-02-07 23:08:22 -08:00
Gianfranco Costamagna
2c24e90c23
Update CMakeLists.txt to rename the static and shared libraries to pugixml
Don't call them pugixml-shared or pugixml-static, because this breaks pkgconfig calls and userspace tools.
2020-02-07 14:55:25 +01:00
Arseny Kapoulkine
546cafefa3 XPath: Add a clarification comment for ast_variable fallthrough 2020-02-01 07:48:45 -08:00
Arseny Kapoulkine
85a39b955d tests: Add a dedicated test for XPath variable conversion
This makes sure all conversions work as expected (note that no type can
be converted to node set so we don't check that).
2020-02-01 07:44:14 -08:00
Arseny Kapoulkine
41b6ff21c4
Merge pull request #316 from BotellaA/patch-1
Add POSITION_INDEPENDENT_CODE option
2019-12-20 08:13:28 -08:00
Arnaud Botella
aa2e0909ac
Add POSITION_INDEPENDENT_CODE option
Allow to use the static library in other dynamic librairies. This is a standard cmake option https://cmake.org/cmake/help/v3.11/prop_tgt/POSITION_INDEPENDENT_CODE.html#prop_tgt:POSITION_INDEPENDENT_CODE
2019-12-06 17:25:37 +01:00
Arseny Kapoulkine
53a30c6571 Cleanup first_element_by_path
Instead of performing a late null check that is redundant and only
needed to silence clang static analysis warning, we pick the context as
a root / self node. This way the code is a bit less redundant and the
static analyzer is happy.
2019-12-03 21:23:15 -08:00
Arseny Kapoulkine
2e8631d2eb
Merge pull request #313 from valeriyvan/nulldereference
Fixing possible null pointer dereference
2019-12-03 21:17:28 -08:00
Valeriy Van
cda8623468 Fixing possible null pointer dereference 2019-12-02 15:02:54 +01:00
Arseny Kapoulkine
51d177e938
Merge pull request #310 from amlucas/master
explicit casts for -Wconversions warnings in gcc
2019-11-27 17:50:21 +01:00
Lucas Amoudruz
78e98c446d explicit casts for -Wconversions warnings in gcc 2019-11-27 15:56:05 +01:00
Arseny Kapoulkine
fe5460c6dc
Merge pull request #305 from slurps-mad-rips/modern-cmake
Fix incorrect installation location for exported CMake targets
2019-10-17 22:07:54 -07:00
Isabella Muerte
99ad261611 🐛 Fix incorrect installation location for exported CMake targets 2019-10-17 21:44:48 -07:00
Arseny Kapoulkine
40be014e48
Merge pull request #303 from slurps-mad-rips/modern-cmake
Fix install locations for pkgconfig *and* cmake
2019-10-06 15:45:55 -07:00
Isabella Muerte
6949232bbd 🐛 Fix install locations for pkgconfig *and* cmake 2019-10-06 13:08:01 -07:00
Arseny Kapoulkine
fdd618f13a
Merge pull request #302 from slurps-mad-rips/modern-cmake
Modernize CMake
2019-10-06 12:44:43 -07:00
Isabella Muerte
3df5036344 🔥 Remove commented out CMake code 2019-10-06 12:33:03 -07:00
Isabella Muerte
ad93a373ab Adjust MSVC runtime settings as requested.
The block of code can be removed in the future if CMake 3.15 ever
becomes the minimum
2019-10-01 10:20:30 -07:00
Isabella Muerte
8a0aac18ea Update check command to output text on failure
Move pugixml-config.cmake.in to scripts/ to prevent polluting the root
2019-09-30 22:00:04 -07:00
Isabella Muerte
1c5a0bb325 Update CMake to modern approach
New Features:

pugixml-shared and pugixml-static are "always" available, but not always
built. This allows downstream projects to still use them, and to make
sure our configurations are correct regardless of if they are being
built. They are not always installed however.

pugixml-shared and pugixml-static have ALIAS libraries of
pugixml::shared and pugixml::static respectively. These names are also
respected in the `find_package(pugixml CONFIG)` generated files, so its
safe to use pugixml in a CMake project regardless of whether it is
installed locally, or if its a subproject via `add_subdirectory`.

pugixml will automatically select the correct library type based on
BUILD_SHARED_LIBS. A pugixml::pugixml ALIAS is also available.

CMAKE_MSVC_RUNTIME_LIBRARY from CMake 3.15 has been backported.

CMake will now rely on generator expressions (a powerful abstraction in
large projects with many subdirectories) for most work. This offloads
work from the single-threaded configure stage to the multithreaded
generation stage.

pugixml now uses CTest as the runner.

Some settings are automatically disabled if pugixml is used as a
subdirectory. These are still able to be manually set, but are hidden
from folks who choose to use CMake GUI.
2019-09-28 13:02:55 -07:00
Isabella Muerte
195dfe1d8d 🚧 Begin moving pugixml to modern(ish) CMake
⬆️ Bump CMake minimum to 3.4
🐛 pugixml no longer requires a C compiler to be found or set to
compile correctly. This speeds up configuration and building on windows.
🚧 Begin laying groundwork to backport MSVC_RUNTIME_LIBRARY
property
2019-09-28 10:47:15 -07:00
Tuan Anh Tran
b9b2aeecaf Custom precision (#300)
Fixes #285
2019-09-22 08:42:41 -07:00
Arseny Kapoulkine
6934b123d4 Move pugixml.rc to scripts/
This keeps src/ folder clean of auxiliary files only required for
special builds; note that CMakeLists.txt already depends on scripts/
(specifically for pkgconfig setup).
2019-09-21 09:21:13 -07:00
lady mesh
6fb765ca9d Add: Windows DLL version info header (#298)
Closes #294
2019-09-19 07:27:40 -07:00
Arseny Kapoulkine
6202519ca6 tests: Add memory safety tests for remove_children/attributes
The newly added tests make sure that during node/attribute destruction
we deallocate a few memory pages; this makes sure that we don't read
node data after it's being destroyed.

Also clean up formatting/style in the remove_* implementation a bit.
2019-09-17 20:34:40 -07:00
Tuan Anh Tran
fd7326fb91 feat: add remove_attributes() and remove_children() (#296)
These functions remove all attributes / child nodes in bulk which is faster than removing them one at a time.
2019-09-17 20:18:41 -07:00
Wolfgang Stöggl
ccb63a9186 Add LICENSE.md to RELEASE (#295) 2019-09-16 14:21:48 -07:00
Arseny Kapoulkine
5329ba03b5 scripts: Update NuGet package spec
Migrate from licenseUrl to license since licenseUrl is deprecated and
fix grammar for VS version list.
2019-09-15 17:56:15 -07:00
Arseny Kapoulkine
3c59df555b docs: Update documentation for 1.10 release
Update changelog and regenerate HTML documentation.
v1.10
2019-09-11 21:51:02 -07:00
Arseny Kapoulkine
c6607740a0 Never escape > in attribute values
According to XML spec, > sometimes needs to be escaped in PCDATA (when
it occurs as a ]]> pattern), but it doesn't need to be escaped in
attribute values.

Contributes to #272.
2019-09-11 21:35:03 -07:00
Arseny Kapoulkine
946de603b1 Don't escape attribute quotation symbol
When using double quotes for attributes, we don't need to escape '; when
using single quotes, we don't need to escape ".

This changes behavior to match 1.9 by default (where we don't escape ').

Contributes to #272.
2019-09-11 21:27:20 -07:00
Arseny Kapoulkine
44e4d7e40b Update version to 1.10
Note: this chang also updates PUGIXML_VERSION macro to allow for
double-digit minor versions; this preserves the continuity of versions
so PUGIXML_VERSION >= 190 will still work.
2019-09-11 21:09:50 -07:00
Joel Andres Granados
84e322738b Update nuget creation to VS2019 (#291)
Create visual studio projects that are vs2019 compliant.
* nuget_build.ps1 :
Introduce a new argument that will define how we implement the nuget
build. For now we accept 201{9,7.5.3} as possible argument values.

* pugixml_vs2019{,_static}.vcxproj :
Add two visual studio projects that build pugi with the latest SDK and
build tools

* appveyor.yml
- Add Visual Studio 2019 to build targets
- Add Visual Studio 201{9,3,5} to build_scripts. And call
  nuget_build.ps1 with a new argument.
- Add Visual Studio 2019 to the test_scripts.
2019-09-09 07:37:29 -07:00
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 `&quot;` and `&apos;`.
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