diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh index 0b85bd6..0cf2d71 100644 --- a/include/qpdf/QPDFJob.hh +++ b/include/qpdf/QPDFJob.hh @@ -591,7 +591,7 @@ class QPDFJob bool warnings{false}; unsigned long encryption_status{0}; bool verbose{false}; - std::shared_ptr password; + std::string password; bool linearize{false}; bool decrypt{false}; bool remove_restrictions{false}; @@ -602,7 +602,7 @@ class QPDFJob bool warnings_exit_zero{false}; bool copy_encryption{false}; std::string encryption_file; - std::shared_ptr encryption_file_password; + std::string encryption_file_password; bool encrypt{false}; bool password_is_hex_key{false}; bool suppress_password_recovery{false}; diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index 0bd4090..6205f3c 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -440,7 +440,7 @@ QPDFJob::createQPDF() checkConfiguration(); std::unique_ptr pdf_sp; try { - processFile(pdf_sp, m->infilename.data(), m->password.get(), true, true); + processFile(pdf_sp, m->infilename.data(), m->password.data(), true, true); } catch (QPDFExc& e) { if (e.getErrorCode() == qpdf_e_password) { // Allow certain operations to work when an incorrect password is supplied. @@ -2471,10 +2471,10 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector>& page_hea // different QPDF objects to the same underlying file with the same path to achieve the // same effect. char const* password = page_spec.password.get(); - if ((!m->encryption_file.empty()) && (password == nullptr) && - (page_spec.filename == m->encryption_file)) { + if (!m->encryption_file.empty() && password == nullptr && + page_spec.filename == m->encryption_file) { QTC::TC("qpdf", "QPDFJob pages encryption password"); - password = m->encryption_file_password.get(); + password = m->encryption_file_password.data(); } doIfVerbose([&](Pipeline& v, std::string const& prefix) { v << prefix << ": processing " << page_spec.filename << "\n"; @@ -2962,8 +2962,8 @@ QPDFJob::setWriterOptions(QPDFWriter& w) std::unique_ptr encryption_pdf; processFile( encryption_pdf, - m->encryption_file.c_str(), - m->encryption_file_password.get(), + m->encryption_file.data(), + m->encryption_file_password.data(), false, false); w.copyEncryptionParameters(*encryption_pdf); diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc index cfa878a..70c9f48 100644 --- a/libqpdf/QPDFJob_config.cc +++ b/libqpdf/QPDFJob_config.cc @@ -175,7 +175,7 @@ QPDFJob::Config::deterministicId() QPDFJob::Config* QPDFJob::Config::encryptionFilePassword(std::string const& parameter) { - o.m->encryption_file_password = QUtil::make_shared_cstr(parameter); + o.m->encryption_file_password = parameter; return this; } @@ -456,7 +456,7 @@ QPDFJob::Config::optimizeImages() QPDFJob::Config* QPDFJob::Config::password(std::string const& parameter) { - o.m->password = QUtil::make_shared_cstr(parameter); + o.m->password = parameter; return this; } @@ -697,7 +697,7 @@ QPDFJob::Config::passwordFile(std::string const& parameter) lines = QUtil::read_lines_from_file(parameter.c_str()); } if (!lines.empty()) { - o.m->password = QUtil::make_shared_cstr(lines.front()); + o.m->password = lines.front(); if (lines.size() > 1) { *QPDFLogger::defaultLogger()->getError()