Commit Graph

800 Commits

Author SHA1 Message Date
halx99
a328bb527b Fix ci 2023-02-04 14:36:01 +08:00
halx99
f79549cc09 1.13 ABI compatible 2023-02-04 14:03:05 +08:00
halx99
aee049facc Merge 'zeux-master' into dev 2023-02-04 13:34:10 +08: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
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
76dcd89427 Update version number in preparation for 1.13 2022-10-20 20:08:52 -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
halx99
377a2a91fd c++20 compiler support 2022-10-05 10:58:55 +08:00
halx99
4bec1e8a9c C++20 compiler support 2022-10-05 10:49:18 +08: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
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
1c6a55f422 Use more idiomatic code in this codebase 2022-06-09 13:38:21 +08:00
Arseny Kapoulkine
7f2d74df4a 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-06-09 13:37:59 +08:00
TodorHryn
62e2407c86 Fix memory leak 2022-06-09 13:37:25 +08:00
Arseny Kapoulkine
2639dfd053
Merge pull request #477 from zeux/compactopt
Optimize compact mode
2022-05-31 20:00:01 -05: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
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
deal
ce19f19632
Merge branch 'zeux:master' into dev 2022-02-16 17:32:19 +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.
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
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
halx99
6c2bb13a44 Fix ci 2022-02-08 21:52:04 +08:00
halx99
d6fac0ac39 More string_view 2022-02-08 21:41:28 +08:00
halx99
c95044df05 Fix for compact mode 2021-12-24 14:01:46 +08:00
deal
3ceb703935
Update pugixml.cpp 2021-12-24 01:54:39 +08:00
halx99
d3a8b86f17 Add missing commit from shallow_copy branch 2021-12-23 21:14:51 +08:00
halx99
f0259eb00a Fix ci 2021-12-23 19:14:53 +08:00
halx99
32cccfe377 Use string_view for all dom APIs 2021-12-23 18:44:32 +08:00
halx99
b634ea55df Node copy avoid stringlen operation 2021-12-23 17:17:33 +08:00
halx99
7791e7dfbb Store length for setters 2021-12-23 16:55:08 +08:00
halx99
9129d7900c Fix ci 2021-12-23 16:15:30 +08:00
halx99
b025069fbe Fix for old compilers 2021-12-23 16:11:40 +08:00
deal
4e4af11838
Fix warnings on PUGIXML_WCHAR_MODE 2021-12-23 16:05:36 +08:00
halx99
69e24c7fdd Add string_view name & value getter with suffix for compatible 2021-12-23 15:45:20 +08:00
halx99
909b3b65f1 Add length field for name & value 2021-12-23 15:13:59 +08:00
halx99
bd0fd02860 Delete unused 2021-09-30 14:39:01 +08:00
halx99
15cec5f982 Fix logic 2021-09-30 14:36:42 +08:00
halx99
366113e72e Make logic more clearly 2021-09-30 13:27:39 +08:00
halx99
0d9a303991 Add shallow_copy support for improve performance of literal string 2021-09-30 13:00:58 +08:00
halx99
4852708894
Fix for non-cpp11 compiler 2021-09-30 11:42:35 +08:00