- Explicitly ignore strcpy_insitu return value in node_copy_string; if it
fails, we must be out of memory and we leave the relevant destination
fields empty, similarly to other OOMs during copying
- Use the same code for eval_number of string/node set; these are slightly
different semantically, as eval_string is an implicit conversion, but the
code ends up the same.
Closes#674, #675.
klockworks reports that var->name() may be NULL; it can never be NULL
for a valid variable, but this check costs us nothing to add so we might
as well add it.
- In remove_duplicates, `sizeof(void**)` was used improperly for
allocation and memsetting instead of `void*`; these are equivalent but
the extra pointer is redundant.
- Remove `var_deref_model` silencing annotation, as it is now redundant
due to changes in 709ba74b24
Previously, calling xml_document::load_string on an empty buffer
resulted in a single byte allocation for the buffer copy; this
allocation was redundant as no data was parsed, so we now add the same
early-out that already exists in xml_parser::parse to load_buffer_impl.
This was originally intended as a safety measure to avoid mixing
packages built via AppVeyor vs packages built via other means, but this
just creates friction because of the need to edit the version field
before publishing the package.
Add CMake option PUGIXML_BUILD_APPLE_FRAMEWORKS to build PugiXML as Apple Frameworks.
This is needed to be able to create iOS-derived compatible app bundles which need to embed PugiXML as framework, as using dylibs is prohibited by Apple.
Improve supply chain security by including a SBOM file with substituted values.
This will be used to construct a composite platform SBOM.
Signed-off-by: Richard Hughes <richard@hughsie.com>
This was worded somewhat confusingly; we should be explicit that it's
okay to access multiple documents concurrently as long as access to each
one is serialized.
We only set this when C++ version or requirement flag is not overridden
externally to be able to rely on CMake automatically downgrading the
standard version when the compiler doesn't support it.
CXX_STANDARD 17 also requires CMake 3.8 or later; on earlier versions we
use the old behavior and set C++11.
To avoid increasing the build matrix we enable this unconditionally for
VS2019 and VS2022 to be able to test std::string_view. Note that we
already test VS2022 without this flag on GHA so this should catch any
regressions.
The PUGIXML_STRING_VIEW define is no longer necessary but
_HAS_STRING_VIEW can be enabled manually if the compiler supports it
without advertising C++17 support.
Instead of opting in std::string_view support via PUGIXML_STRING_VIEW
define, always enable it when C++17 is supported; this still requires
enabling C++17 support in the compiler, which this change doesn't
attempt to do yet.
We now document PUGIXML_HAS_STRING_VIEW and PUGIXML_STRING_VIEW (the latter will be removed in the future) configuration as well as string_view_t type and overloads.
Makefile also had to be fixed to recognize the version properly after pugixml.hpp changes.
This means that by default we inherit the default language version
supported by the compiler; this will help with string_view testing
in the future as it will "just work" out of the box once the define is
set.
This should also automatically enable CI coverage for string_view; C++11
is still explicitly tested in CI via cxxstd=c++11.
Even if the compiler supports C++17, we define CMAKE_CXX_STANDARD as 11
by default which implicitly disables string_view support; for now warn
in this case.
Add remaining overloads and supporting unit tests. This concludes the initial phase of std::string_view support; for now the support is still opt-in via PUGIXML_STRING_VIEW define, but that will become unnecessary (enabled-by-default) in a future version.
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.