Commit bf255ccc896dc9cf54b13e0f60371f7429035b50

Authored by Jay Berkenbilt
1 parent 21c897aa

QPDFJob: convert password in two tables

generate_auto_job
... ... @@ -68,7 +68,6 @@ not_yet = set([
68 68 'modify',
69 69 'modify-other',
70 70 'object-streams',
71   - 'password',
72 71 'password-file',
73 72 'password-mode',
74 73 'print',
... ...
include/qpdf/QPDFJob.hh
... ... @@ -178,6 +178,7 @@ class QPDFJob
178 178 QPDF_DLL Config& oiMinHeight(char const* parameter);
179 179 QPDF_DLL Config& oiMinWidth(char const* parameter);
180 180 QPDF_DLL Config& optimizeImages();
  181 + QPDF_DLL Config& password(char const* parameter);
181 182 QPDF_DLL Config& passwordIsHexKey();
182 183 QPDF_DLL Config& preserveUnreferenced();
183 184 QPDF_DLL Config& preserveUnreferencedResources();
... ...
job.sums
1 1 # Generated by generate_auto_job
2   -generate_auto_job 8e2c467c47a66caef46497d96be461e7373e22124abe1bde3ef353bd99452609
  2 +generate_auto_job e18ae51cee2838fe44c37237a344fb48abe7a6d3f9cfa745d2f1dbc9c294e7b7
3 3 job.yml 55d272cca0657e1f96ca92f5253edb6c6e24e6ea19e37690446d2111adc13f91
4   -libqpdf/qpdf/auto_job_decl.hh ff9bbeec974f6a7e6ed2ba205e3d7f81fbe4f6224860a9ba37c30b817b951a90
  4 +libqpdf/qpdf/auto_job_decl.hh e9844137bf53345f2c6973378b314a2510ebce83ac8ceb378588cd6afdd87c06
5 5 libqpdf/qpdf/auto_job_help.hh 383eea80e2c185ef5295fc126246457a7ceeffea759fdb90bb2e6727532ea538
6   -libqpdf/qpdf/auto_job_init.hh 45e3d28708c7506a681477a7865fa39dcd10e93819875a8d5664d6629f6e5245
  6 +libqpdf/qpdf/auto_job_init.hh e65119793c329630aa243ff20907443f8eaf54c29d02737a598f29bba64b0bf5
7 7 libqpdf/qpdf/auto_job_schema.hh c91a4e182e088797b70dda94af03ca32d360f3564890132da2a8bdc3c4432423
8 8 manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d
9 9 manual/cli.rst 68122ff8179c10df3fe6d577adde4973c346f7866ba9a511bab5a6e6f292a6f1
... ...
libqpdf/QPDFJob_argv.cc
... ... @@ -186,12 +186,6 @@ ArgParser::argShowCrypto()
186 186 }
187 187  
188 188 void
189   -ArgParser::argPassword(char* parameter)
190   -{
191   - o.password = QUtil::make_shared_cstr(parameter);
192   -}
193   -
194   -void
195 189 ArgParser::argPasswordFile(char* parameter)
196 190 {
197 191 std::list<std::string> lines;
... ... @@ -895,13 +889,6 @@ ArgParser::argCopyAttPositional(char* arg)
895 889 }
896 890  
897 891 void
898   -ArgParser::argCopyAttPassword(char* parameter)
899   -{
900   - // QXXXQ @TRIVIAL
901   - c_copy_att->password(parameter);
902   -}
903   -
904   -void
905 892 ArgParser::argEndCopyAttachment()
906 893 {
907 894 c_copy_att->end();
... ...
libqpdf/QPDFJob_config.cc
... ... @@ -299,6 +299,13 @@ QPDFJob::Config::optimizeImages()
299 299 }
300 300  
301 301 QPDFJob::Config&
  302 +QPDFJob::Config::password(char const* parameter)
  303 +{
  304 + o.password = QUtil::make_shared_cstr(parameter);
  305 + return *this;
  306 +}
  307 +
  308 +QPDFJob::Config&
302 309 QPDFJob::Config::passwordIsHexKey()
303 310 {
304 311 o.password_is_hex_key = true;
... ... @@ -527,6 +534,8 @@ QPDFJob::CopyAttConfig::end()
527 534 {
528 535 if (this->caf.path.empty())
529 536 {
  537 + // QXXXQ usage, json, and config exceptions need to be unified
  538 + // in some fashion.
530 539 throw std::runtime_error("copy attachments: no path specified");
531 540 }
532 541 this->config.o.attachments_to_copy.push_back(this->caf);
... ...
libqpdf/qpdf/auto_job_decl.hh
... ... @@ -25,7 +25,6 @@ void argOverlay();
25 25 void argPages();
26 26 void argUnderlay();
27 27 void argJobJsonFile(char *);
28   -void argPassword(char *);
29 28 void argPasswordFile(char *);
30 29 void argRotate(char *);
31 30 void argShowObject(char *);
... ... @@ -75,5 +74,4 @@ void argAttMimetype(char *);
75 74 void argAttDescription(char *);
76 75 void argEndAttachment();
77 76 void argCopyAttPositional(char*);
78   -void argCopyAttPassword(char *);
79 77 void argEndCopyAttachment();
... ...
libqpdf/qpdf/auto_job_init.hh
... ... @@ -94,7 +94,7 @@ this-&gt;ap.addRequiredParameter(&quot;min-version&quot;, [this](char *x){c_main-&gt;minVersion(
94 94 this->ap.addRequiredParameter("oi-min-area", [this](char *x){c_main->oiMinArea(x);}, "minimum");
95 95 this->ap.addRequiredParameter("oi-min-height", [this](char *x){c_main->oiMinHeight(x);}, "minimum");
96 96 this->ap.addRequiredParameter("oi-min-width", [this](char *x){c_main->oiMinWidth(x);}, "minimum");
97   -this->ap.addRequiredParameter("password", p(&ArgParser::argPassword), "password");
  97 +this->ap.addRequiredParameter("password", [this](char *x){c_main->password(x);}, "password");
98 98 this->ap.addRequiredParameter("password-file", p(&ArgParser::argPasswordFile), "password");
99 99 this->ap.addRequiredParameter("remove-attachment", [this](char *x){c_main->removeAttachment(x);}, "attachment");
100 100 this->ap.addRequiredParameter("rotate", p(&ArgParser::argRotate), "[+|-]angle");
... ... @@ -153,7 +153,7 @@ this-&gt;ap.addRequiredParameter(&quot;description&quot;, p(&amp;ArgParser::argAttDescription), &quot;
153 153 this->ap.registerOptionTable("copy attachment", b(&ArgParser::argEndCopyAttachment));
154 154 this->ap.addPositional(p(&ArgParser::argCopyAttPositional));
155 155 this->ap.addRequiredParameter("prefix", [this](char *x){c_copy_att->prefix(x);}, "prefix");
156   -this->ap.addRequiredParameter("password", p(&ArgParser::argCopyAttPassword), "password");
  156 +this->ap.addRequiredParameter("password", [this](char *x){c_copy_att->password(x);}, "password");
157 157 this->ap.selectOptionTable("256-bit encryption");
158 158 this->ap.copyFromOtherTable("cleartext-metadata", "128-bit encryption");
159 159 this->ap.copyFromOtherTable("accessibility", "128-bit encryption");
... ...