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

1716 Commits

Author SHA1 Message Date
jiangqucheng
ddd3cfa4bf #556 fix makefile err in some env 2023-03-16 05:05:16 +00:00
Arseny Kapoulkine
c2c61a5905 Add a cautionary comment to xml_node::children(name)
Fixes #538
2023-01-23 09:37:11 -08:00
Arseny Kapoulkine
95683943bb
Merge pull request #533 from DavidKorczynski/cifuzz-int
Add Github CIFuzz action
2022-11-21 11:15:36 +01:00
David Korczynski
7e8a42ee31 CI: decrease fuzzing time from 300s to 30s
Signed-off-by: David Korczynski <david@adalogics.com>
2022-11-20 14:42:49 -08:00
David Korczynski
5cfa7f90f1 Add Github CIFuzz action
Signed-off-by: David Korczynski <david@adalogics.com>
2022-11-18 15:40:54 -08:00
Arseny Kapoulkine
1dc3266fff docs: Add missing documentation for xml_node::attribute with hint
The feature was added in 2015 but somehow was never documented.
2022-11-08 16:49:34 -08:00
Arseny Kapoulkine
cb217f5a85
Merge pull request #530 from zeux/snprintf
Fix Xcode 14 sprintf deprecation warning
2022-11-06 15:09:53 -08:00
Arseny Kapoulkine
e11e0c965f Fix comment typo. 2022-11-06 13:47:53 -08:00
Arseny Kapoulkine
b6b747244e Adjust the workaround for -pedantic mode and fix tests 2022-11-06 10:21:35 -08:00
Arseny Kapoulkine
8be081fbbe Fix Xcode 14 sprintf deprecation warning
We use snprintf when stdc is set to C++11, however in C++98 mode we can't use variadic macros,
and Xcode 14 complains about the use of sprintf.

It should be safe however to use variadic macros on any remotely recent version of clang on Apple,
unless -pedantic is defined which warns against the use of variadic macros in C++98 mode...

This change fixes the problem for the builds that don't specify -pedantic, which is a problem for
another day.
2022-11-06 10:16:21 -08:00
Arseny Kapoulkine
a0e0643363
Merge pull request #526 from zeux/newver
Prepare for 1.13 release
v1.13
2022-10-28 16:53:25 -07:00
Arseny Kapoulkine
3bd1f452b5 Fix version check in test 2022-10-20 20:23:26 -07:00
Arseny Kapoulkine
c5b288d91a Update HTML documentation 2022-10-20 20:20:45 -07:00
Arseny Kapoulkine
0ef3da1e6e Update release notes and manual for 1.13
This includes a previously unnoticed link fix for xml_text::set
2022-10-20 20:18:08 -07:00
Arseny Kapoulkine
76dcd89427 Update version number in preparation for 1.13 2022-10-20 20:08:52 -07:00
Arseny Kapoulkine
43ef7e25d9
Merge pull request #525 from bruxisma/master
Fix exported symbols under clang-cl (Closes #503)
2022-10-20 19:49:48 -07:00
Izzy Muerte
ab8af53059 Fix exported symbols under clang-cl (Closes #503)
This also turns the define for PUGIXML_API into an `$<IF:>`, instead of an
`$<IF:>` with an empty true condition. If this is inadequate, I will
undo it, and place them on separate lines as they were before, but will
most likely use an inverse `$<NOT:>` instead of an `$<IF:>`.
2022-10-20 13:35:49 -07:00
Arseny Kapoulkine
86c9105154
Merge pull request #523 from zeux/ferrh
Fix error handling in xml_document::save_file
2022-10-09 09:08:50 -07:00
Arseny Kapoulkine
444963e269 Fix error handling in xml_document::save_file
There were two conditions under which xml_document::save_file could
previously return true even though the saving failed:

- The last write to the file was buffered in stdio buffer, and it's that
  last write that would fail due to lack of disk space
- The data has been written correctly but fclose failed to update file
  metadata, which can result in truncated size / missing inode updates.

This change fixes both by adjusting save_file to fflush before the check,
and also checking fclose results. Note that while fflush here is
technically redundant, because it's implied by fclose, we must check
ferror explicitly anyway, and so it feels a little cleaner to do most of
the error handling in save_file_impl, so that the changes of fclose()
failing are very slim.

Of course, neither change guarantees that the contents of the file are
going to be safe on disk following a power failure.
2022-10-07 22:13:04 -07:00
Arseny Kapoulkine
0cb4f02579 Final tweaks after #522
This cleans up xml_attribute::set_value to be uniform wrt
xml_node::set_value and xml_text::set_value - for now we duplicate the
body since the logic is trivial and this keeps debug performance
excellent.
2022-10-07 21:46:27 -07:00
Arseny Kapoulkine
c342266fae
Merge pull request #522 from Ferenc-/followup-on-pr-490
Followup on pr 490
2022-10-07 21:42:41 -07:00
Ferenc Géczi
39e169285c Add test for xml_attribute::set_value with size argument 2022-09-29 00:00:00 +00:00
Ferenc Géczi
1905284494 Add test for xml_node::set_value with size argument 2022-09-29 00:00:00 +00:00
Ferenc Géczi
d359402311 Add xml_text::set test with size set to substring 2022-09-29 00:00:00 +00:00
Ferenc Géczi
09e7cc9b1c Add test for xml_text::set with size argument 2022-09-29 00:00:00 +00:00
Ferenc Géczi
f327371219 Add overloads with size_t type argument
* xml_node::set_value(const char_t* rhs, size_t sz)
* xml_text::set(const char_t* rhs, size_t sz)

Signed-off-by: Ferenc Géczi <ferenc.gm@gmail.com>
2022-09-29 18:26:05 +00:00
Arseny Kapoulkine
bcf483c3b7
Merge pull request #492 from KDAB/fix-default-visibility
Correctly set default visibility on non-windows compilers
2022-09-27 12:53:06 -07:00
Milian Wolff
173a263490 Correctly set default visibility on non-windows compilers
This fixes compilation of pugixml with -fvisibility=hidden. Without
this patch, one would get lots of unresolved symbols when consuming
pugixml as a shared library.
2022-09-25 11:37:48 +02:00
Arseny Kapoulkine
521b2cd854 Add issue templates to try to route questions to Discussions 2022-09-02 21:42:25 -07:00
Arseny Kapoulkine
27bc68ab45
Merge pull request #506 from brandl-muc/nullptr_for_msvc
Enable usage of nullptr for MSVC 16 and newer (MSVS 2010)
2022-08-04 08:46:13 -07:00
Matthäus Brandl
f7de324855 Enable usage of nullptr for MSVC 16 and newer (MSVS 2010) 2022-08-04 16:59:37 +02:00
Arseny Kapoulkine
3b5c1fb022 tests: Fix MSVC 2005 build
... I forgot we still support platforms without C99, 23 years later.
2022-07-21 21:17:17 -07:00
Arseny Kapoulkine
ab8453c572 tests: Use snprintf instead of sprintf
sprintf now results in a deprecation warning in Xcode 14 beta.
2022-07-21 20:51:26 -07:00
Arseny Kapoulkine
2639dfd053
Merge pull request #477 from zeux/compactopt
Optimize compact mode
2022-05-31 20:00:01 -05:00
Arseny Kapoulkine
0401559dde
Merge pull request #498 from zeux/fix-oom-safer
Fix memory leak during OOM in convert_buffer
2022-05-16 20:50:07 -07:00
Arseny Kapoulkine
832a4f4914 Use more idiomatic code in this codebase 2022-05-16 19:14:29 -07:00
Arseny Kapoulkine
33a75c734b Fix memory leak during OOM in convert_buffer
This is the same fix as #497, but we're using auto_deleter instead
because if allocation function throws, we can't rely on an explicit call
to deallocate.

Comes along with two tests that validate the behavior.
2022-05-16 19:12:52 -07:00
Arseny Kapoulkine
ec851bb18d
Merge pull request #497 from TodorHryn/master
Fix memory leak
2022-05-16 19:05:29 -07:00
TodorHryn
6fbf32140b Fix memory leak 2022-05-16 13:21:20 +03:00
Viktor Govako
effc46f0ed Added bool set_value(const char_t* rhs, size_t sz). 2022-04-13 12:25:01 +03:00
Arseny Kapoulkine
363ebdde91
Merge pull request #482 from zeux/fix-msvc-test
tests: Fix MSVC 2022 build
2022-02-15 21:12:03 -08:00
Arseny Kapoulkine
c60ca94cdd tests: Fix MSVC 2022 build
Instead of trying to detect if we can safely use random shuffle simply reimplement it ourselves.
The quality of the RNG is not essential for these tests.
2022-02-15 20:23:05 -08:00
Arseny Kapoulkine
dd50fa5b45 Fix PUGIXML_VERSION macro
Also make sure the line shows up in grep when using the current version
number.

Fixes #478.
v1.12.1
2022-02-10 08:36:19 -08:00
Arseny Kapoulkine
2fa9158b4f Optimize compact mode: xml_text 2022-02-08 23:04:31 -08:00
Arseny Kapoulkine
fad2d5e4ef Optimize compact mode: xml_attribute/xml_node implementation 2022-02-08 23:00:17 -08:00
Arseny Kapoulkine
f388c465dd Optimize compact mode: reuse access in insert/remove 2022-02-08 22:44:31 -08:00
Arseny Kapoulkine
314baf6605 docs: Regenerate HTML documentation v1.12 2022-02-08 20:09:10 -08:00
Arseny Kapoulkine
eb918f2078 docs: Update manual with 1.12 changelog 2022-02-08 19:59:44 -08:00
Arseny Kapoulkine
25c4fb74a8 Update copyright year to 2022 2022-02-08 19:58:58 -08:00
Arseny Kapoulkine
c9e219c17b Update version to 1.12 2022-02-08 19:56:41 -08:00
Arseny Kapoulkine
9ba92a7fa7 Restore compatibility with WinCE
WinCE lacks most recent CRT additions to MSVC; we used to explicitly disable specific sections
of code, but it's more comprehensive to just specify that the CRT is from MSVC7 instead of MSVC8.

Fixes #401
2022-02-08 19:19:34 -08:00
Arseny Kapoulkine
6ce48ec379
Merge pull request #468 from appls/master
Add support for Visual Studio 2022 with Platform Toolset v143.
2022-02-08 12:43:53 -08:00
Arseny Kapoulkine
428606b3c1
Create SECURITY.md
Fixes #475
2022-02-06 09:13:33 -08:00
tobias
64de196ba9 Fix path. 2022-01-21 15:56:25 +01:00
tobias
bd90579718 Add missing build script and test script entries for appveyor. 2022-01-21 15:44:39 +01:00
tobias
16a4f382ac Add missing appveyor test config for Visual Studio 2022. 2022-01-21 15:30:45 +01:00
tobias
bc2448afbb Add support for Visual Studio 2022 with Platform Toolset v143. 2022-01-21 15:06:27 +01:00
Arseny Kapoulkine
9e382f9807
Merge pull request #436 from zeux/zeux-patch-1
Set CMP0091 CMake policy
2021-08-07 19:06:12 -07:00
Arseny Kapoulkine
f1fbd707f1
Set CMP0091 CMake policy
This allows the correct use of runtime library override.

Fixes #412
2021-08-07 09:57:21 -07:00
Arseny Kapoulkine
a5991972ba
Merge pull request #426 from bjornblissing/feature/cmake_pugiconfig
Add Cmake options for pugiconfig.hpp options

Fixes #387 
Closes #388
2021-08-07 09:54:18 -07:00
Arseny Kapoulkine
c624c7a8bd
Update CMakeLists.txt
Remove memory configuration options and rely on automatic detection of long long
2021-08-07 09:51:54 -07:00
Arseny Kapoulkine
8bd209fb8b docs: Update manual to be more explicit about save_file return
The function returns true on success and false on failure.
2021-07-09 17:27:01 -07:00
Arseny Kapoulkine
657619962f
Merge pull request #431 from justinkb/master
Fix include in test_document.cpp when building against libc++. The _GLIBCXX_HAVE_UNISTD_H relies on pugixml and its tests being built against libstdc++, with LLVM's libc++ this won't be defined
2021-06-30 14:28:44 -07:00
Paul Mulders
81274bb026 Fix include in test_document.cpp when building against libc++ 2021-06-30 23:07:54 +02:00
Arseny Kapoulkine
37eddaa0b2
Update .codecov.yml
Mark "project" check as information and disable "patch" check.
2021-06-30 13:11:45 -07:00
Björn Blissing
e7eae035ff Store definitions in variable to avoid duplication
Store compile definitions in variable to avoid duplicated generator
expressions.
2021-06-28 19:51:20 +02:00
Björn Blissing
52a7981b85 Make some compile definitions public
Moved needed defines to public section of target_compile_definitions.
2021-06-28 13:36:55 +02:00
Björn Blissing
92ac6ac1d9 Update github action to trigger defines via CMake
Use options via explicit CMake defines, instead of calling them from
the generic PUGI_BUILD_DEFINES variable.
2021-06-28 13:17:06 +02:00
Björn Blissing
50b103f127 Fix generator expressions 2021-06-28 13:17:06 +02:00
Björn Blissing
1cd65c7eb8 Move advanced memory settings into target defs.
Moved the advanced memory options into target_compile_definitions using
generator expressions.
2021-06-28 12:50:27 +02:00
Björn Blissing
f1946432ee Check for existence of long long 2021-06-28 12:50:27 +02:00
Björn Blissing
e2ba4f4014 Add options to build targets
Add custom options to the build targets via generator expressions.
2021-06-28 12:50:27 +02:00
Björn Blissing
5f49f2c657 Mark advanced options and removed redundant ones
Options marked as advanced are hidden by default in the CMake GUI.

The `PUGIXML_HEADER_ONLY` are redundant when during CMake builds, hence
removed.

The `PUGIXML_HAS_LONG_LONG` should be handled automatically and needs to
be rewritten, hence these options has been removed.
2021-06-28 12:50:27 +02:00
Björn Blissing
986b7ffd01 Add Cmake options for pugiconfig.hpp
Add Cmake options variables for each of the defines in pugiconfig.hpp.
2021-06-28 12:50:27 +02:00
Arseny Kapoulkine
06a516c73c
Merge pull request #428 from zeux/gha
Switch to GitHub Actions build from Travis CI
2021-06-27 20:08:57 -07:00
Arseny Kapoulkine
a6a63a1b50 gcov crashes on LLVM-produced coverage on Linux 2021-06-27 19:27:40 -07:00
Arseny Kapoulkine
5cff00e5ea Fix coverage build to include CXX define
Also it seems like we don't need to restrict coverage build to
Linux/clang?
2021-06-27 19:20:27 -07:00
Arseny Kapoulkine
0de580155d Don't run GHA workflow on push to branches
Also convert line endings to Unix.
2021-06-27 19:12:59 -07:00
Arseny Kapoulkine
e7b545b288 Remove custom job name for unix 2021-06-27 19:09:08 -07:00
Arseny Kapoulkine
3097a2c711 Switch to export and GH vars 2021-06-27 19:04:15 -07:00
Arseny Kapoulkine
8bd9a19a7e Change badge to GHA badge.
So long, Travis.
2021-06-27 19:01:06 -07:00
Arseny Kapoulkine
0b793a3126 Add GitHub Actions based build 2021-06-27 19:00:18 -07:00
Arseny Kapoulkine
7da44ddc5b
Merge pull request #399 from bjornblissing/feature/cmake_prefix
Add PUGIXML as prefix to CMake options
2021-06-22 14:32:00 -07:00
Björn Blissing
7b1b7ee16d Reverted to use of global BUILD_SHARED_LIBS option
This commit reverts back to exposing the global variable
BUILD_SHARED_LIBS.

Since building static libraries are the default for CMake
(i.e. BUILD_SHARED_LIBS=OFF) the option to build both static and shared
libraries were moved into a conditional option. So the option
PUGIXML_BUILD_SHARED_AND_STATIC is now only visible when the global
BUILD_SHARED_LIBS variable is set to ON.

The change also prevents the case were the user first enables
BUILD_SHARED_LIBS and then enables PUGIXML_BUILD_SHARED_AND_STATIC to
then again disable BUILD_SHARED_LIBS.
2021-06-19 12:51:27 +02:00
Björn Blissing
fc7928a4b7 Use target_compile_definitions for custom defines
Replace `add_definitions` with `target_compile_definitions` for
specified targets. Multiple options are separated using the
`separate_arguments` function, which converts any string using
space-separated arguments into a semicolon-separated list.
2021-06-19 11:22:31 +02:00
Björn Blissing
0f1e75a902 Re-introduced the custom build defines
The ability to use custom build defines were removed in commit:
1c5a0bb32583fd294022e68e66b541bf6ff71a67

This commit will reintroduce this feature, but using a prefixed variable
name.
2021-06-15 09:00:31 +02:00
Björn Blissing
91fde92fc2 Add PUGIXML as prefix to CMake options
Added PUGIXML as prefix to all CMake options to avoid naming collisions
with downstream projects.

Removed the cached variable BUILD_DEFINES, since it was unused.
2021-06-15 08:42:30 +02:00
Arseny Kapoulkine
5c4225b5c9 tests: Fix wchar_t build 2021-05-11 23:22:13 -07:00
Arseny Kapoulkine
8cece4b9fe Fix a bug in move construction when move source is empty
Previously when copying the allocator state we would copy an incorrect
root pointer into the document's current state; while this had a minimal
impact on the allocation state due to the fact that any new allocation
would need to create a new page, this used a potentially stale field of
the moved document when setting up new pages, which could create issues
in future uses of the pages.

This change fixes the core problem and also removes the use of the
_root->allocator from allocate_page since it's not clear why we need it
there in the first place.
2021-05-11 22:53:54 -07:00
Arseny Kapoulkine
56c9afa7c8 XPath: Improve recursion limit for deep chains of //
Since foo//bar//baz adds two nodes for each //, we need to increment the
depth by 2 on each iteration to limit the AST correctly.

Fixes the stack overflow found by cluster-fuzz (I suspect the issue
there is a bit deeper, but this part is definitely a bug and as such I'd
rather wait for the next test case for now).
2021-05-11 22:27:53 -07:00
Arseny Kapoulkine
791971ee59
Merge pull request #422 from neheb/patch-1
fix cygwin compilation
2021-05-07 00:35:47 -07:00
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