From 07bc36322489703fe676ab8d5d2eeaf84826e7ee Mon Sep 17 00:00:00 2001 From: Zoe Clifford Date: Wed, 28 Feb 2024 13:26:10 -0800 Subject: [PATCH] string_view leads to char_traits which is not standard C++ (background in #1024). This triggers compilation failures with certain C++20 compiler configurations. To avoid this I moved the cast to the loop's body. --- libqpdf/QPDF_Name.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libqpdf/QPDF_Name.cc b/libqpdf/QPDF_Name.cc index 0e7f441a..0669a95b 100644 --- a/libqpdf/QPDF_Name.cc +++ b/libqpdf/QPDF_Name.cc @@ -3,8 +3,6 @@ #include #include -#include - QPDF_Name::QPDF_Name(std::string const& name) : QPDFValue(::ot_name, "name"), name(name) @@ -57,14 +55,12 @@ QPDF_Name::unparse() std::pair QPDF_Name::analyzeJSONEncoding(const std::string& name) { - std::basic_string_view view{ - reinterpret_cast(name.data()), name.size()}; - int tail = 0; // Number of continuation characters expected. bool tail2 = false; // Potential overlong 3 octet utf-8. bool tail3 = false; // potential overlong 4 octet bool needs_escaping = false; - for (auto const& c: view) { + for (auto it = name.begin(); it != name.end(); ++it) { + unsigned char c = static_cast(*it); if (tail) { if ((c & 0xc0) != 0x80) { return {false, false};