Commit 183e440789c0ff25c2fd932556b7b1d0a8c480d5
1 parent
74e76df0
In QPDFJob::UnderOverlay refactor password handling to use std::string directly
Replaced std::shared_ptr<char> with std::string for passwords in QPDFJob. This simplifies memory management and aligns the implementation with modern C++ standards, improving code readability and maintainability.
Showing
3 changed files
with
3 additions
and
3 deletions
include/qpdf/QPDFJob.hh
| @@ -451,7 +451,7 @@ class QPDFJob | @@ -451,7 +451,7 @@ class QPDFJob | ||
| 451 | 451 | ||
| 452 | std::string which; | 452 | std::string which; |
| 453 | std::string filename; | 453 | std::string filename; |
| 454 | - std::shared_ptr<char> password; | 454 | + std::string password; |
| 455 | std::string to_nr; | 455 | std::string to_nr; |
| 456 | std::string from_nr; | 456 | std::string from_nr; |
| 457 | std::string repeat_nr; | 457 | std::string repeat_nr; |
libqpdf/QPDFJob.cc
| @@ -1882,7 +1882,7 @@ QPDFJob::validateUnderOverlay(QPDF& pdf, UnderOverlay* uo) | @@ -1882,7 +1882,7 @@ QPDFJob::validateUnderOverlay(QPDF& pdf, UnderOverlay* uo) | ||
| 1882 | { | 1882 | { |
| 1883 | QPDFPageDocumentHelper main_pdh(pdf); | 1883 | QPDFPageDocumentHelper main_pdh(pdf); |
| 1884 | int main_npages = QIntC::to_int(main_pdh.getAllPages().size()); | 1884 | int main_npages = QIntC::to_int(main_pdh.getAllPages().size()); |
| 1885 | - processFile(uo->pdf, uo->filename.c_str(), uo->password.get(), true, false); | 1885 | + processFile(uo->pdf, uo->filename.data(), uo->password.data(), true, false); |
| 1886 | QPDFPageDocumentHelper uo_pdh(*(uo->pdf)); | 1886 | QPDFPageDocumentHelper uo_pdh(*(uo->pdf)); |
| 1887 | int uo_npages = QIntC::to_int(uo_pdh.getAllPages().size()); | 1887 | int uo_npages = QIntC::to_int(uo_pdh.getAllPages().size()); |
| 1888 | try { | 1888 | try { |
libqpdf/QPDFJob_config.cc
| @@ -1108,7 +1108,7 @@ QPDFJob::UOConfig::repeat(std::string const& parameter) | @@ -1108,7 +1108,7 @@ QPDFJob::UOConfig::repeat(std::string const& parameter) | ||
| 1108 | QPDFJob::UOConfig* | 1108 | QPDFJob::UOConfig* |
| 1109 | QPDFJob::UOConfig::password(std::string const& parameter) | 1109 | QPDFJob::UOConfig::password(std::string const& parameter) |
| 1110 | { | 1110 | { |
| 1111 | - config->o.m->under_overlay->password = QUtil::make_shared_cstr(parameter); | 1111 | + config->o.m->under_overlay->password = parameter; |
| 1112 | return this; | 1112 | return this; |
| 1113 | } | 1113 | } |
| 1114 | 1114 |