aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-01-22 23:53:57 +0100
committerJay Berkenbilt <ejb@ql.org>2022-01-30 19:11:03 +0100
commitee7824cf28536b8acf5f47aa76ced348df5f6d35 (patch)
tree18ed3f1f051e89a03df134a0b4adffcc3cb13eea /libqpdf
parent021db6f226191e536a84ba6a76590bf5743d5d62 (diff)
downloadqpdf-ee7824cf28536b8acf5f47aa76ced348df5f6d35.tar.zst
QPDFJob: convert encryption_file args to shared pointers
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFJob.cc8
-rw-r--r--libqpdf/QPDFJob_argv.cc2
2 files changed, 5 insertions, 5 deletions
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc
index e7ea3dad..5a832c21 100644
--- a/libqpdf/QPDFJob.cc
+++ b/libqpdf/QPDFJob.cc
@@ -327,7 +327,6 @@ QPDFJob::QPDFJob() :
suppress_warnings(false),
warnings_exit_zero(false),
copy_encryption(false),
- encryption_file(0),
encryption_file_password(0),
encrypt(false),
password_is_hex_key(false),
@@ -2603,11 +2602,11 @@ QPDFJob::handlePageSpecs(
// to the same underlying file with the same path to
// achieve the same affect.
char const* password = page_spec.password;
- if (o.encryption_file && (password == 0) &&
+ if ((! o.encryption_file.empty()) && (password == 0) &&
(page_spec.filename == o.encryption_file))
{
QTC::TC("qpdf", "qpdf pages encryption password");
- password = o.encryption_file_password;
+ password = o.encryption_file_password.get();
}
o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
cout << prefix << ": processing "
@@ -3221,7 +3220,8 @@ QPDFJob::setWriterOptions(QPDF& pdf, QPDFWriter& w)
if (o.copy_encryption)
{
std::shared_ptr<QPDF> encryption_pdf =
- processFile(o.encryption_file, o.encryption_file_password);
+ processFile(o.encryption_file.c_str(),
+ o.encryption_file_password.get());
w.copyEncryptionParameters(*encryption_pdf);
}
if (o.encrypt)
diff --git a/libqpdf/QPDFJob_argv.cc b/libqpdf/QPDFJob_argv.cc
index 44185e9a..17f163ef 100644
--- a/libqpdf/QPDFJob_argv.cc
+++ b/libqpdf/QPDFJob_argv.cc
@@ -347,7 +347,7 @@ ArgParser::argCopyEncryption(char* parameter)
void
ArgParser::argEncryptionFilePassword(char* parameter)
{
- o.encryption_file_password = parameter;
+ o.encryption_file_password = QUtil::make_shared_cstr(parameter);
}
void