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

1801 Commits

Author SHA1 Message Date
dantargz
a0db6e2185
Initial support for std::string_view (#633)
When PUGIXML_STRING_VIEW define is set and C++17 is available, add std::string_view support to a few functions. In the future, string view support will be enabled without the need for an extra define, but for now the support is opt-in to reduce compatibility risks.

PR is based on initial contribution by @brandl-muc.
2024-10-22 13:31:54 -07:00
Arseny Kapoulkine
3b17184379 docs: Work around asciidoc bug with TOC numbering
For some reason using a code import right before a header breaks
numbering on that header; fix by moving the import above text.
2024-09-12 09:49:35 -07:00
Arseny Kapoulkine
30cc354fe3
Merge pull request #621 from aral-matrix/master
xmldocument::save: use encoding interpreted by get_write_encoding in buffered_writer constructor
2024-07-08 09:35:57 -07:00
aral-matrix
2039e448cf use encoding interpreted by get_write_encoding in buffered_writer constructor 2024-07-07 11:19:52 +02:00
Arseny Kapoulkine
2d42114ed1
Merge pull request #620 from zeux/nostl-warnfix
Work around 'unreferenced function' warnings in NO_STL builds
2024-07-06 08:55:52 -07:00
Arseny Kapoulkine
c691c6b401 Work around 'unreferenced function' warnings in NO_STL builds
Normally, as_utf8_begin et al are used in STL functions but when STL is
disabled, these are only used if the target platform lacks first class
support for wchar_t FILE* APIs. With some warning levels we consequently
can get warnings about these functions not being referenced.

Not defining these in the first place is difficult because of the
complexity of the selection logic for open_file_wide so for now just
mark these as unused. The strange (void)& syntax is needed for MSVC to
not trigger another warning...

The workaround is narrowly scoped to avoid unforeseen compatibility issues.

Fixes #619.
2024-07-05 15:43:55 -07:00
Arseny Kapoulkine
ac0ef854e0 Clarify comments for xml_*::empty()
"empty" can be mistaken for "has no children" in case of xml_node in
particular; we now use both empty and null in the comment in hopes that
it may help.
2024-05-28 20:39:08 -07:00
Arseny Kapoulkine
7c66cf7b06 docs: Add C++20 ranges documentation
This doesn't require any implementation changes, as the existing support
for C++11 ranged for loops automatically makes nodes and node/attribute
range objects work as C++20 ranges.

Fixes #613.
2024-05-19 13:24:34 -07:00
Arseny Kapoulkine
f1d8c51ec8
Merge pull request #611 from kmilos/patch-1
Relative and absolute paths for a relocatable pkgconf file
2024-03-23 09:44:03 -07:00
Miloš Komarčević
08e38a4c14
Relative and absolute paths for a relocatable pkgconf file 2024-03-22 14:05:43 +01:00
Miloš Komarčević
6ab3fa418b
Update pugixml.pc.in 2024-03-22 14:00:34 +01:00
Arseny Kapoulkine
b2b4664030 docs: Adjust docs wrt parse_merge_pcdata x parse_embed_pcdata
parse_merge_pcdata expects to find node_pcdata nodes which aren't
present when parse_embed_pcdata is active. For now we mention this in
the documentation; changing this is possible in the future, but carries
a small performance penalty so it requires a specific use case.

Fixes #600
2024-01-26 09:23:26 -08:00
Arseny Kapoulkine
3cc2daf449 Update year to 2024 everywhere
... except .html files that will be regenerated later.
2024-01-26 09:18:48 -08:00
Arseny Kapoulkine
96aebcb8ae
Merge pull request #604 from zeux/ndk-warnfix
Fix -Wshorten-64-to-32 warning on Android NDK when targeting x86
2023-12-23 10:48:31 -08:00
Arseny Kapoulkine
86591a97c3 Extract length validation and conversion function into a templated function
Since there's no reasonable way for us to figure out what the type of
stat::st_size is on Android NDK without resorting to C++11 auto /
non-standard decltype extensions, we're going to resort to a templated
function that can deduce the length type. The rest of the validation and
conversion logic is preserved as is.
2023-12-23 09:30:57 -08:00
Arseny Kapoulkine
8fef4591be Fix -Wshorten-64-to-32 warning on Android NDK when targeting x86
stat.h defines struct stat to use long long on Android NDK when
targeting x86; off_t however is defined as long, which is 32-bit (unlike
other Unix-like platforms). This results in a narrowing conversion which
produces a warning, and can also result in silently reading a prefix of
a huge file instead of a clean "out of memory" error.

There's no way for us to preserve the type exactly but always widening
to long long should be safe; get_file_size will proceed to check if
length actually fits into size_t which is what we ultimately need, and
that overflow check will fail on files that are >4 GB in size.
2023-12-20 11:19:42 -08:00
Arseny Kapoulkine
cf466ce2a2
Merge pull request #595 from zeux/stl-defarg
Use cleaner references to STL classes
2023-11-16 12:42:22 -08:00
Arseny Kapoulkine
499750ad95
Merge pull request #596 from zeux/appvmp
AppVeyor build optimizations
2023-11-16 12:32:28 -08:00
Arseny Kapoulkine
cd420ab193 Use make -j2 for mingw builds on AppVeyor 2023-11-16 12:12:56 -08:00
Arseny Kapoulkine
d99aa003ba Restrict AppVeyor builds to master branch
This avoids duplicate builds on PRs submitted from a branch in the same
repository.
2023-11-16 12:09:18 -08:00
Arseny Kapoulkine
1e3d6f15f5 tests: Add /MP to AppVeyor builds to try to reduce build time 2023-11-16 11:27:40 -08:00
Arseny Kapoulkine
2e8a2a4e1c tests: Work around -Wself-move in new gcc
We do want to test self-move; fortunately, hiding the object reference
behind a separate pointer variable silences the warning.
2023-11-16 10:54:53 -08:00
Arseny Kapoulkine
0bd2848f33 Use cleaner references to STL classes
The explicit specification of default template arguments is repetitive
and dates back to the versions of pugixml that tried to forward-declare
all STL classes manually, which ran into issues with default arguments
in some STL versions.

We've since abandoned this idea and use <string>/<iosfwd> includes, as
such it should be fine to rely on default arguments.

Note: while we could use std::wstring, this had compatibility issues
with some very early versions of Android SDK. Out of abundance of
caution, we keep basic_i/ostream and basic_string in tact. We could use
std::string but we might need to replace these in char8 mode if that
ever gets merged.
2023-11-16 10:51:20 -08:00
Arseny Kapoulkine
43d7d568a7
Merge pull request #594 from SoapGentoo/Wuseless-cast
Fix `-Wuseless-cast`
2023-11-14 07:13:09 -08:00
David Seifert
44236fef2c
Fix -Wuseless-cast 2023-11-13 20:53:44 -08:00
Arseny Kapoulkine
6909df2478
Merge pull request #590 from zeux/sanfuzz
Update config=sanitize and fuzz targets
2023-10-22 11:18:08 -07:00
Arseny Kapoulkine
b15bc6bf1f Update config=sanitize and fuzz targets
We used to need to silence float-divide-by-zero and float-cast-overflow
sanitizers since clang used a finite valid floating point value range.
Fortunately, since clang-9 UBSAN properly handles various primitive
operations per IEEE-754 so we no longer need this workaround.

Also use fork=16 mode for fuzz targets to make it easier to run fuzzing
locally.
2023-10-22 10:07:52 -07:00
Arseny Kapoulkine
33f709379a
Merge pull request #551 from silvergasp/master
fuzzer: excersizes query code on xml doc
2023-10-21 12:29:22 -07:00
Arseny Kapoulkine
4d42ba7a60
Update fuzz_xpath.cpp
Remove unused variables
2023-10-21 11:20:03 -07:00
Arseny Kapoulkine
d75a081aa3
Update fuzz_xpath.cpp
Fix code style, no exceptions, other tweaks.
2023-10-21 11:11:11 -07:00
Arseny Kapoulkine
1ade1d4bea
Merge pull request #586 from PhilipBotha/fix/nullptr_const_zero
Replaced 0 with PUGIXML_NULL when a nullptr would have been needed.
2023-10-19 19:21:08 -07:00
Arseny Kapoulkine
94b19a3c45 Fix indentation changes 2023-10-15 19:25:56 -07:00
Arseny Kapoulkine
76dec417a6 Silence -Wzero-as-null-pointer-constant for clang
clang does not handle NULL the same way as gcc, so for now we silence
the warning.
2023-10-15 19:19:36 -07:00
Arseny Kapoulkine
6699559320 Replace 0 with NULL for some MSVC-specific code 2023-10-15 19:17:37 -07:00
Arseny Kapoulkine
dab3a2f858 Replace 0 with NULL for compact and wchar mode specific code 2023-10-15 19:13:34 -07:00
Arseny Kapoulkine
60d9656cb7 Replace PUGIXML_NULL with NULL and fix a couple extra stragglers 2023-10-15 19:10:34 -07:00
Philip
08b966e24f Fixed zero as nullptr constant in macro.
Removed white space that was changed.
2023-10-14 09:06:20 +02:00
Arseny Kapoulkine
2e357d19a3
Merge pull request #585 from ilya-lavrenov/install-rules
Added cmake option to disable install rules
2023-10-13 20:14:59 -07:00
Philip Botha
b138778fd9 Replaced 0 with PUGIXML_NULL when appropriate.
Added the suffix UZ to size_t.

Added fixed GCC warning about using const literal zero in place of nullptr (-Wzero-as-null-pointer-constant).
2023-10-12 15:49:18 +02:00
Ilya Lavrenov
3cfe51b72d Added cmake option to disable install rules 2023-10-12 02:15:05 +04:00
Arseny Kapoulkine
ef856bf975
Merge pull request #584 from richardapeters/master
build: only include CTest when building the pugixml tests
2023-10-06 06:14:27 -07:00
Richard Peters
efce4a8d7a Remove BUILD_TESTING as prerequisite for the PUGIXML_BUILD_TESTS; it was always set by including CTest, now CTest is conditionally included later on 2023-10-06 10:02:15 +02:00
Richard Peters
a468d5c438 Only include CTest when building the pugixml tests 2023-10-06 09:51:29 +02:00
Arseny Kapoulkine
db78afc2b7 Update version to 1.14 everywhere v1.14 latest 2023-09-07 11:55:13 -07:00
Arseny Kapoulkine
bd70bd7662 docs: Update release notes and regenerate HTML documentation
The large amount of changes seems to be due to asciidoctor now omitting
empty spans in formatted code.
2023-09-07 11:52:15 -07:00
Arseny Kapoulkine
1a9a41b0f4 Update copyright year (2022 => 2023) 2023-09-06 20:39:25 -07:00
Arseny Kapoulkine
1118066f0b
Merge pull request #576 from vineethkuttan/Merge-pcdata-#546
Implement parse_merge_pcdata
2023-09-06 08:01:56 -07:00
Arseny Kapoulkine
ff56985924 Rename merged to merged_pcdata for clarity. 2023-09-06 07:54:14 -07:00
Arseny Kapoulkine
30adb1713b Use memmove instead of strcat
strcat does not allow overlapping ranges; we didn't have a test for this
but now we do.

As an added bonus, this also means we only compute the length of each
fragment once now.
2023-09-05 22:43:55 -07:00
Arseny Kapoulkine
58616a29aa Avoid store-load penalty on cursor->parent
This reclaims the performance lost in PCDATA reorganization and gains a
little more on top of that.
2023-09-05 22:23:31 -07:00