aboutsummaryrefslogtreecommitdiffstats
path: root/include/qpdf/QUtil.hh
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-01-22 23:33:53 +0100
committerJay Berkenbilt <ejb@ql.org>2022-01-30 19:11:03 +0100
commit76c4f78b5cfd786b90069f7256252229444fdecd (patch)
treeb84a4a401b26fc84846343f28c28a91c35e9fa87 /include/qpdf/QUtil.hh
parent67f9d0b7d5857a73c974f5a54cd1abbe65231fce (diff)
downloadqpdf-76c4f78b5cfd786b90069f7256252229444fdecd.tar.zst
Add QUtil::make_shared_cstr
Replace most of the calls to QUtil::copy_string with this instead.
Diffstat (limited to 'include/qpdf/QUtil.hh')
-rw-r--r--include/qpdf/QUtil.hh7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh
index 5a064d5c..d23e3f85 100644
--- a/include/qpdf/QUtil.hh
+++ b/include/qpdf/QUtil.hh
@@ -30,6 +30,7 @@
#include <vector>
#include <stdexcept>
#include <functional>
+#include <memory>
#include <stdio.h>
#include <time.h>
@@ -151,9 +152,15 @@ namespace QUtil
QPDF_DLL
std::string path_basename(std::string const& filename);
+ // Returns a dynamically allocated copy of a string that the
+ // caller has to delete with delete[].
QPDF_DLL
char* copy_string(std::string const&);
+ // Returns a shared_ptr<char> with the correct deleter.
+ QPDF_DLL
+ std::shared_ptr<char> make_shared_cstr(std::string const&);
+
// Returns lower-case hex-encoded version of the string, treating
// each character in the input string as unsigned. The output
// string will be twice as long as the input string.