summaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-05 14:26:32 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-05 17:24:56 +0100
commit8cf7f2bfb542b1583aa525611179d1a545f945d5 (patch)
tree2885cfc2c857c7c4578e648553246865fa4c5653 /libqpdf
parent5f3f78822b5d43e9b02082da5268d186ba7101c0 (diff)
downloadqpdf-8cf7f2bfb542b1583aa525611179d1a545f945d5.tar.zst
API contract: qpdf_get_qpdf_version() returns a static
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDF.cc5
-rw-r--r--libqpdf/qpdf-c.cc1
2 files changed, 5 insertions, 1 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index ce534d6e..565c73f6 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -26,7 +26,9 @@
#include <qpdf/QPDF_Stream.hh>
#include <qpdf/QPDF_Array.hh>
-std::string QPDF::qpdf_version(QPDF_VERSION);
+// This must be a fixed value. This API returns a const reference to
+// it, and the C API relies on its being static as well.
+std::string const QPDF::qpdf_version(QPDF_VERSION);
static char const* EMPTY_PDF =
"%PDF-1.3\n"
@@ -178,6 +180,7 @@ QPDF::StringDecrypter::decryptString(std::string& val)
std::string const&
QPDF::QPDFVersion()
{
+ // The C API relies on this being a static value.
return QPDF::qpdf_version;
}
diff --git a/libqpdf/qpdf-c.cc b/libqpdf/qpdf-c.cc
index 6f03a315..f03ed845 100644
--- a/libqpdf/qpdf-c.cc
+++ b/libqpdf/qpdf-c.cc
@@ -161,6 +161,7 @@ static QPDF_ERROR_CODE trap_errors(
char const* qpdf_get_qpdf_version()
{
QTC::TC("qpdf", "qpdf-c called qpdf_get_qpdf_version");
+ // The API guarantees that this is a static value.
return QPDF::QPDFVersion().c_str();
}