From 26a652b37ed8626edd1e94807b93482f0e8b2cad Mon Sep 17 00:00:00 2001 From: lixiaoyong Date: Fri, 10 May 2024 00:53:02 +0800 Subject: [PATCH] Tune QUtil::hex_encode (cherry picked from commit 49d49ab687e8bd763f1e145b296148a14464cf74) --- 0001-Tune-QUtil-hex_encode.patch | 33 ++++++++++++++++++++++++++++++++ qpdf.spec | 9 +++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 0001-Tune-QUtil-hex_encode.patch diff --git a/0001-Tune-QUtil-hex_encode.patch b/0001-Tune-QUtil-hex_encode.patch new file mode 100644 index 0000000..a9ae8c6 --- /dev/null +++ b/0001-Tune-QUtil-hex_encode.patch @@ -0,0 +1,33 @@ +From ae800361fefb6d30d054f5d90af310c85765b044 Mon Sep 17 00:00:00 2001 +From: m-holger +Date: Thu, 22 Sep 2022 20:13:51 +0100 +Subject: [PATCH] Tune QUtil::hex_encode + +Reference: https://github.com/qpdf/qpdf/commit/ae800361fefb6d30d054f5d90af310c85765b044 +--- + libqpdf/QUtil.cc | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc +index 98a8f318..bcf4aa4e 100644 +--- a/libqpdf/QUtil.cc ++++ b/libqpdf/QUtil.cc +@@ -769,10 +769,12 @@ QUtil::make_unique_cstr(std::string const& str) + std::string + QUtil::hex_encode(std::string const& input) + { ++ static auto constexpr hexchars = "0123456789abcdef"; + std::string result; +- for (unsigned int i = 0; i < input.length(); ++i) { +- result += QUtil::int_to_string_base( +- QIntC::to_int(static_cast(input.at(i))), 16, 2); ++ result.reserve(2 * input.length()); ++ for (const char c: input) { ++ result += hexchars[static_cast(c) >> 4]; ++ result += hexchars[c & 0x0f]; + } + return result; + } +-- +2.39.3 + diff --git a/qpdf.spec b/qpdf.spec index 1eb618c..795526e 100644 --- a/qpdf.spec +++ b/qpdf.spec @@ -1,11 +1,13 @@ Name: qpdf Version: 11.1.0 -Release: 2 +Release: 3 Summary: A command-line program to transform PDF files License: (Artistic 2.0 or ASL 2.0) and MIT URL: http://qpdf.sourceforge.net/ Source0: http://downloads.sourceforge.net/sourceforge/qpdf/qpdf-%{version}.tar.gz +Patch0001: 0001-Tune-QUtil-hex_encode.patch + BuildRequires: gcc gcc-c++ zlib-devel libjpeg-turbo-devel pcre-devel BuildRequires: perl-interpreter perl-generators perl(Digest::MD5) BuildRequires: cmake gnutls-devel @@ -37,7 +39,7 @@ Obsoletes: %{name}-doc < %{version}-%{release} This package contains some man help and other files for %{name}. %prep -%setup -q +%autosetup -n %{name}-%{version} -p1 %build export CFLAGS="${RPM_OPT_FLAGS}" @@ -86,6 +88,9 @@ rm -rf %{buildroot}/usr/lib64/libqpdf.a %{_mandir}/man1/* %changelog +* Fri May 10 2024 lixiaoyong - 11.1.0-3 +- Tune QUtil::hex_encode + * Mon Mar 06 2023 wangkai - 11.1.0-2 - Add BIND_NOW,PIE,SP secure compilation options -- Gitee