Commit 01969c78a8f93af26c71ecff7ce36511b17d46c7

Authored by Jay Berkenbilt
1 parent 98f25fdf

QPDFJob: move private members into Members

include/qpdf/QPDFJob.hh
... ... @@ -345,7 +345,7 @@ class QPDFJob
345 345  
346 346 enum password_mode_e { pm_bytes, pm_hex_bytes, pm_unicode, pm_auto };
347 347  
348   - public: // QXXXQ
  348 + public: // QXXXQ begin public
349 349 struct UnderOverlay
350 350 {
351 351 UnderOverlay(char const* which) :
... ... @@ -367,123 +367,10 @@ class QPDFJob
367 367 std::vector<int> from_pagenos;
368 368 std::vector<int> repeat_pagenos;
369 369 };
370   - private: // QXXXQ
371 370  
372   - enum remove_unref_e { re_auto, re_yes, re_no };
373   -
374   - std::shared_ptr<char> password;
375   - bool linearize;
376   - bool decrypt;
377   - int split_pages;
378   - bool progress;
379   - bool suppress_warnings;
380   - bool warnings_exit_zero;
381   - bool copy_encryption;
382   - std::string encryption_file;
383   - std::shared_ptr<char> encryption_file_password;
384   - bool encrypt;
385   - bool password_is_hex_key;
386   - bool suppress_password_recovery;
387   - password_mode_e password_mode;
388   - bool allow_insecure;
389   - bool allow_weak_crypto;
390   - std::string user_password;
391   - std::string owner_password;
392   - int keylen;
393   - bool r2_print;
394   - bool r2_modify;
395   - bool r2_extract;
396   - bool r2_annotate;
397   - bool r3_accessibility;
398   - bool r3_extract;
399   - bool r3_assemble;
400   - bool r3_annotate_and_form;
401   - bool r3_form_filling;
402   - bool r3_modify_other;
403   - qpdf_r3_print_e r3_print;
404   - bool force_V4;
405   - bool force_R5;
406   - bool cleartext_metadata;
407   - bool use_aes;
408   - bool stream_data_set;
409   - qpdf_stream_data_e stream_data_mode;
410   - bool compress_streams;
411   - bool compress_streams_set;
412   - bool recompress_flate;
413   - bool recompress_flate_set;
414   - int compression_level;
415   - qpdf_stream_decode_level_e decode_level;
416   - bool decode_level_set;
417   - bool normalize_set;
418   - bool normalize;
419   - bool suppress_recovery;
420   - bool object_stream_set;
421   - qpdf_object_stream_e object_stream_mode;
422   - bool ignore_xref_streams;
423   - bool qdf_mode;
424   - bool preserve_unreferenced_objects;
425   - remove_unref_e remove_unreferenced_page_resources;
426   - bool keep_files_open;
427   - bool keep_files_open_set;
428   - size_t keep_files_open_threshold;
429   - bool newline_before_endstream;
430   - std::string linearize_pass1;
431   - bool coalesce_contents;
432   - bool flatten_annotations;
433   - int flatten_annotations_required;
434   - int flatten_annotations_forbidden;
435   - bool generate_appearances;
436   - std::string min_version;
437   - std::string force_version;
438   - bool show_npages;
439   - bool deterministic_id;
440   - bool static_id;
441   - bool static_aes_iv;
442   - bool suppress_original_object_id;
443   - bool show_encryption;
444   - bool show_encryption_key;
445   - bool check_linearization;
446   - bool show_linearization;
447   - bool show_xref;
448   - bool show_trailer;
449   - int show_obj;
450   - int show_gen;
451   - bool show_raw_stream_data;
452   - bool show_filtered_stream_data;
453   - bool show_pages;
454   - bool show_page_images;
455   - size_t collate;
456   - bool flatten_rotation;
457   - bool list_attachments;
458   - std::string attachment_to_show;
459   - std::list<std::string> attachments_to_remove;
460   - std::list<AddAttachment> attachments_to_add;
461   - std::list<CopyAttachmentFrom> attachments_to_copy;
462   - bool json;
463   - std::set<std::string> json_keys;
464   - std::set<std::string> json_objects;
465   - bool check;
466   - bool optimize_images;
467   - bool externalize_inline_images;
468   - bool keep_inline_images;
469   - bool remove_page_labels;
470   - public: // QXXXQ
471 371 size_t oi_min_width;
472 372 size_t oi_min_height;
473 373 size_t oi_min_area;
474   - size_t ii_min_bytes;
475   - private: // QXXXQ
476   - UnderOverlay underlay;
477   - UnderOverlay overlay;
478   - UnderOverlay* under_overlay;
479   - std::vector<PageSpec> page_specs;
480   - std::map<std::string, RotationSpec> rotations;
481   - bool require_outfile;
482   - bool replace_input;
483   - bool check_is_encrypted;
484   - bool check_requires_password;
485   - std::shared_ptr<char> infilename;
486   - std::shared_ptr<char> outfilename;
487 374 // QXXXQ END-PUBLIC
488 375  
489 376 private:
... ... @@ -553,6 +440,8 @@ class QPDFJob
553 440 void doJSONEncrypt(QPDF& pdf, JSON& j);
554 441 void doJSONAttachments(QPDF& pdf, JSON& j);
555 442  
  443 + enum remove_unref_e { re_auto, re_yes, re_no };
  444 +
556 445 class Members
557 446 {
558 447 friend class QPDFJob;
... ... @@ -571,6 +460,114 @@ class QPDFJob
571 460 std::ostream* cerr;
572 461 unsigned long encryption_status;
573 462 bool verbose;
  463 + std::shared_ptr<char> password;
  464 + bool linearize;
  465 + bool decrypt;
  466 + int split_pages;
  467 + bool progress;
  468 + bool suppress_warnings;
  469 + bool warnings_exit_zero;
  470 + bool copy_encryption;
  471 + std::string encryption_file;
  472 + std::shared_ptr<char> encryption_file_password;
  473 + bool encrypt;
  474 + bool password_is_hex_key;
  475 + bool suppress_password_recovery;
  476 + password_mode_e password_mode;
  477 + bool allow_insecure;
  478 + bool allow_weak_crypto;
  479 + std::string user_password;
  480 + std::string owner_password;
  481 + int keylen;
  482 + bool r2_print;
  483 + bool r2_modify;
  484 + bool r2_extract;
  485 + bool r2_annotate;
  486 + bool r3_accessibility;
  487 + bool r3_extract;
  488 + bool r3_assemble;
  489 + bool r3_annotate_and_form;
  490 + bool r3_form_filling;
  491 + bool r3_modify_other;
  492 + qpdf_r3_print_e r3_print;
  493 + bool force_V4;
  494 + bool force_R5;
  495 + bool cleartext_metadata;
  496 + bool use_aes;
  497 + bool stream_data_set;
  498 + qpdf_stream_data_e stream_data_mode;
  499 + bool compress_streams;
  500 + bool compress_streams_set;
  501 + bool recompress_flate;
  502 + bool recompress_flate_set;
  503 + int compression_level;
  504 + qpdf_stream_decode_level_e decode_level;
  505 + bool decode_level_set;
  506 + bool normalize_set;
  507 + bool normalize;
  508 + bool suppress_recovery;
  509 + bool object_stream_set;
  510 + qpdf_object_stream_e object_stream_mode;
  511 + bool ignore_xref_streams;
  512 + bool qdf_mode;
  513 + bool preserve_unreferenced_objects;
  514 + remove_unref_e remove_unreferenced_page_resources;
  515 + bool keep_files_open;
  516 + bool keep_files_open_set;
  517 + size_t keep_files_open_threshold;
  518 + bool newline_before_endstream;
  519 + std::string linearize_pass1;
  520 + bool coalesce_contents;
  521 + bool flatten_annotations;
  522 + int flatten_annotations_required;
  523 + int flatten_annotations_forbidden;
  524 + bool generate_appearances;
  525 + std::string min_version;
  526 + std::string force_version;
  527 + bool show_npages;
  528 + bool deterministic_id;
  529 + bool static_id;
  530 + bool static_aes_iv;
  531 + bool suppress_original_object_id;
  532 + bool show_encryption;
  533 + bool show_encryption_key;
  534 + bool check_linearization;
  535 + bool show_linearization;
  536 + bool show_xref;
  537 + bool show_trailer;
  538 + int show_obj;
  539 + int show_gen;
  540 + bool show_raw_stream_data;
  541 + bool show_filtered_stream_data;
  542 + bool show_pages;
  543 + bool show_page_images;
  544 + size_t collate;
  545 + bool flatten_rotation;
  546 + bool list_attachments;
  547 + std::string attachment_to_show;
  548 + std::list<std::string> attachments_to_remove;
  549 + std::list<AddAttachment> attachments_to_add;
  550 + std::list<CopyAttachmentFrom> attachments_to_copy;
  551 + bool json;
  552 + std::set<std::string> json_keys;
  553 + std::set<std::string> json_objects;
  554 + bool check;
  555 + bool optimize_images;
  556 + bool externalize_inline_images;
  557 + bool keep_inline_images;
  558 + bool remove_page_labels;
  559 + size_t ii_min_bytes;
  560 + UnderOverlay underlay;
  561 + UnderOverlay overlay;
  562 + UnderOverlay* under_overlay;
  563 + std::vector<PageSpec> page_specs;
  564 + std::map<std::string, RotationSpec> rotations;
  565 + bool require_outfile;
  566 + bool replace_input;
  567 + bool check_is_encrypted;
  568 + bool check_requires_password;
  569 + std::shared_ptr<char> infilename;
  570 + std::shared_ptr<char> outfilename;
574 571 };
575 572 std::shared_ptr<Members> m;
576 573 };
... ...
libqpdf/QPDFJob.cc
... ... @@ -330,11 +330,7 @@ QPDFJob::Members::Members() :
330 330 cout(&std::cout),
331 331 cerr(&std::cerr),
332 332 encryption_status(0),
333   - verbose(false)
334   -{
335   -}
336   -
337   -QPDFJob::QPDFJob() :
  333 + verbose(false),
338 334 password(0),
339 335 linearize(false),
340 336 decrypt(false),
... ... @@ -419,17 +415,21 @@ QPDFJob::QPDFJob() :
419 415 externalize_inline_images(false),
420 416 keep_inline_images(false),
421 417 remove_page_labels(false),
422   - oi_min_width(128), // Default values for these
423   - oi_min_height(128), // oi flags are in --help
424   - oi_min_area(16384), // and in the manual.
425   - ii_min_bytes(1024), //
  418 + ii_min_bytes(1024), // QXXXQ comment with oi_*
426 419 underlay("underlay"),
427 420 overlay("overlay"),
428 421 under_overlay(0),
429 422 require_outfile(true),
430 423 replace_input(false),
431 424 check_is_encrypted(false),
432   - check_requires_password(false),
  425 + check_requires_password(false)
  426 +{
  427 +}
  428 +
  429 +QPDFJob::QPDFJob() :
  430 + oi_min_width(128), // Default values for these
  431 + oi_min_height(128), // oi flags are in --help
  432 + oi_min_area(16384), // and in the manual.
433 433 m(new Members())
434 434 {
435 435 }
... ... @@ -467,7 +467,6 @@ QPDFJob::config()
467 467 void
468 468 QPDFJob::parseRotationParameter(std::string const& parameter)
469 469 {
470   - QPDFJob& o = *this; // QXXXQ
471 470 std::string angle_str;
472 471 std::string range;
473 472 size_t colon = parameter.find(':');
... ... @@ -523,7 +522,7 @@ QPDFJob::parseRotationParameter(std::string const&amp; parameter)
523 522 {
524 523 angle = -angle;
525 524 }
526   - o.rotations[range] = RotationSpec(angle, (relative != 0));
  525 + m->rotations[range] = RotationSpec(angle, (relative != 0));
527 526 }
528 527 else
529 528 {
... ... @@ -548,16 +547,15 @@ QPDFJob::parseNumrange(char const* range, int max)
548 547 void
549 548 QPDFJob::run()
550 549 {
551   - QPDFJob& o = *this; // QXXXQ
552 550 std::shared_ptr<QPDF> pdf_ph;
553 551 try
554 552 {
555   - pdf_ph = processFile(o.infilename.get(), o.password.get());
  553 + pdf_ph = processFile(m->infilename.get(), m->password.get());
556 554 }
557 555 catch (QPDFExc& e)
558 556 {
559 557 if ((e.getErrorCode() == qpdf_e_password) &&
560   - (o.check_is_encrypted || o.check_requires_password))
  558 + (m->check_is_encrypted || m->check_requires_password))
561 559 {
562 560 // Allow --is-encrypted and --requires-password to
563 561 // work when an incorrect password is supplied.
... ... @@ -574,17 +572,17 @@ QPDFJob::run()
574 572 this->m->encryption_status = qpdf_es_encrypted;
575 573 }
576 574  
577   - if (o.check_is_encrypted || o.check_requires_password)
  575 + if (m->check_is_encrypted || m->check_requires_password)
578 576 {
579 577 return;
580 578 }
581 579 bool other_warnings = false;
582 580 std::vector<std::shared_ptr<QPDF>> page_heap;
583   - if (! o.page_specs.empty())
  581 + if (! m->page_specs.empty())
584 582 {
585 583 handlePageSpecs(pdf, other_warnings, page_heap);
586 584 }
587   - if (! o.rotations.empty())
  585 + if (! m->rotations.empty())
588 586 {
589 587 handleRotations(pdf);
590 588 }
... ... @@ -595,7 +593,7 @@ QPDFJob::run()
595 593 {
596 594 doInspection(pdf);
597 595 }
598   - else if (o.split_pages)
  596 + else if (m->split_pages)
599 597 {
600 598 doSplitPages(pdf, other_warnings);
601 599 }
... ... @@ -618,8 +616,7 @@ QPDFJob::hasWarnings()
618 616 bool
619 617 QPDFJob::createsOutput() const
620 618 {
621   - QPDFJob const& o = *this; // QXXXQ
622   - return ((o.outfilename != nullptr) || o.replace_input);
  619 + return ((m->outfilename != nullptr) || m->replace_input);
623 620 }
624 621  
625 622 void
... ... @@ -629,43 +626,43 @@ QPDFJob::checkConfiguration()
629 626 throw QPDFJob::ConfigError(msg);
630 627 };
631 628  
632   - QPDFJob& o = *this; // QXXXQ
633 629 // QXXXQ messages are CLI-centric
634   - if (o.replace_input)
  630 + if (m->replace_input)
635 631 {
636   - if (o.outfilename)
  632 + if (m->outfilename)
637 633 {
638 634 usage("--replace-input may not be used when"
639 635 " an output file is specified");
640 636 }
641   - else if (o.split_pages)
  637 + else if (m->split_pages)
642 638 {
643 639 usage("--split-pages may not be used with --replace-input");
644 640 }
645 641 }
646   - if (o.infilename == 0)
  642 + if (m->infilename == 0)
647 643 {
648 644 usage("an input file name is required");
649 645 }
650   - else if (o.require_outfile && (o.outfilename == 0) && (! o.replace_input))
  646 + else if (m->require_outfile &&
  647 + (m->outfilename == 0) && (! m->replace_input))
651 648 {
652 649 usage("an output file name is required; use - for standard output");
653 650 }
654   - else if ((! o.require_outfile) &&
655   - ((o.outfilename != 0) || o.replace_input))
  651 + else if ((! m->require_outfile) &&
  652 + ((m->outfilename != 0) || m->replace_input))
656 653 {
657 654 usage("no output file may be given for this option");
658 655 }
659   - if (o.check_requires_password && o.check_is_encrypted)
  656 + if (m->check_requires_password && m->check_is_encrypted)
660 657 {
661 658 usage("--requires-password and --is-encrypted may not be given"
662 659 " together");
663 660 }
664 661  
665   - if (o.encrypt && (! o.allow_insecure) &&
666   - (o.owner_password.empty() &&
667   - (! o.user_password.empty()) &&
668   - (o.keylen == 256)))
  662 + if (m->encrypt && (! m->allow_insecure) &&
  663 + (m->owner_password.empty() &&
  664 + (! m->user_password.empty()) &&
  665 + (m->keylen == 256)))
669 666 {
670 667 // Note that empty owner passwords for R < 5 are copied from
671 668 // the user password, so this lack of security is not an issue
... ... @@ -680,10 +677,10 @@ QPDFJob::checkConfiguration()
680 677 " before the -- that follows --encrypt.");
681 678 }
682 679  
683   - if (o.require_outfile && o.outfilename &&
684   - (strcmp(o.outfilename.get(), "-") == 0))
  680 + if (m->require_outfile && m->outfilename &&
  681 + (strcmp(m->outfilename.get(), "-") == 0))
685 682 {
686   - if (o.split_pages)
  683 + if (m->split_pages)
687 684 {
688 685 usage("--split-pages may not be used when"
689 686 " writing to standard output");
... ... @@ -693,15 +690,15 @@ QPDFJob::checkConfiguration()
693 690 usage("--verbose may not be used when"
694 691 " writing to standard output");
695 692 }
696   - if (o.progress)
  693 + if (m->progress)
697 694 {
698 695 usage("--progress may not be used when"
699 696 " writing to standard output");
700 697 }
701 698 }
702 699  
703   - if ((! o.split_pages) &&
704   - QUtil::same_file(o.infilename.get(), o.outfilename.get()))
  700 + if ((! m->split_pages) &&
  701 + QUtil::same_file(m->infilename.get(), m->outfilename.get()))
705 702 {
706 703 QTC::TC("qpdf", "qpdf same file error");
707 704 usage("input file and output file are the same;"
... ... @@ -712,25 +709,25 @@ QPDFJob::checkConfiguration()
712 709 bool
713 710 QPDFJob::suppressWarnings()
714 711 {
715   - return this->suppress_warnings;
  712 + return this->m->suppress_warnings;
716 713 }
717 714  
718 715 bool
719 716 QPDFJob::warningsExitZero()
720 717 {
721   - return this->warnings_exit_zero;
  718 + return this->m->warnings_exit_zero;
722 719 }
723 720  
724 721 bool
725 722 QPDFJob::checkRequiresPassword()
726 723 {
727   - return this->check_requires_password;
  724 + return this->m->check_requires_password;
728 725 }
729 726  
730 727 bool
731 728 QPDFJob::checkIsEncrypted()
732 729 {
733   - return this->check_is_encrypted;
  730 + return this->m->check_is_encrypted;
734 731 }
735 732  
736 733 unsigned long
... ... @@ -742,20 +739,19 @@ QPDFJob::getEncryptionStatus()
742 739 void
743 740 QPDFJob::setQPDFOptions(QPDF& pdf)
744 741 {
745   - QPDFJob& o = *this; // QXXXQ
746   - if (o.ignore_xref_streams)
  742 + if (m->ignore_xref_streams)
747 743 {
748 744 pdf.setIgnoreXRefStreams(true);
749 745 }
750   - if (o.suppress_recovery)
  746 + if (m->suppress_recovery)
751 747 {
752 748 pdf.setAttemptRecovery(false);
753 749 }
754   - if (o.password_is_hex_key)
  750 + if (m->password_is_hex_key)
755 751 {
756 752 pdf.setPasswordIsHexKey(true);
757 753 }
758   - if (o.suppress_warnings)
  754 + if (m->suppress_warnings)
759 755 {
760 756 pdf.setSuppressWarnings(true);
761 757 }
... ... @@ -794,7 +790,6 @@ static std::string show_encryption_method(QPDF::encryption_method_e method)
794 790 void
795 791 QPDFJob::showEncryption(QPDF& pdf)
796 792 {
797   - QPDFJob& o = *this; // QXXXQ
798 793 // Extract /P from /Encrypt
799 794 int R = 0;
800 795 int P = 0;
... ... @@ -815,7 +810,7 @@ QPDFJob::showEncryption(QPDF&amp; pdf)
815 810 std::string user_password = pdf.getTrimmedUserPassword();
816 811 std::string encryption_key = pdf.getEncryptionKey();
817 812 cout << "User password = " << user_password << std::endl;
818   - if (o.show_encryption_key)
  813 + if (m->show_encryption_key)
819 814 {
820 815 cout << "Encryption key = "
821 816 << QUtil::hex_encode(encryption_key) << std::endl;
... ... @@ -861,7 +856,6 @@ QPDFJob::showEncryption(QPDF&amp; pdf)
861 856 void
862 857 QPDFJob::doCheck(QPDF& pdf)
863 858 {
864   - QPDFJob& o = *this; // QXXXQ
865 859 // Code below may set okay to false but not to true.
866 860 // We assume okay until we prove otherwise but may
867 861 // continue to perform additional checks after finding
... ... @@ -869,7 +863,7 @@ QPDFJob::doCheck(QPDF&amp; pdf)
869 863 bool okay = true;
870 864 bool warnings = false;
871 865 auto& cout = *this->m->cout;
872   - cout << "checking " << o.infilename << std::endl;
  866 + cout << "checking " << m->infilename << std::endl;
873 867 try
874 868 {
875 869 int extension_level = pdf.getExtensionLevel();
... ... @@ -957,22 +951,21 @@ QPDFJob::doCheck(QPDF&amp; pdf)
957 951 void
958 952 QPDFJob::doShowObj(QPDF& pdf)
959 953 {
960   - QPDFJob& o = *this; // QXXXQ
961 954 QPDFObjectHandle obj;
962   - if (o.show_trailer)
  955 + if (m->show_trailer)
963 956 {
964 957 obj = pdf.getTrailer();
965 958 }
966 959 else
967 960 {
968   - obj = pdf.getObjectByID(o.show_obj, o.show_gen);
  961 + obj = pdf.getObjectByID(m->show_obj, m->show_gen);
969 962 }
970 963 bool error = false;
971 964 if (obj.isStream())
972 965 {
973   - if (o.show_raw_stream_data || o.show_filtered_stream_data)
  966 + if (m->show_raw_stream_data || m->show_filtered_stream_data)
974 967 {
975   - bool filter = o.show_filtered_stream_data;
  968 + bool filter = m->show_filtered_stream_data;
976 969 if (filter &&
977 970 (! obj.pipeStreamData(0, 0, qpdf_dl_all)))
978 971 {
... ... @@ -986,7 +979,7 @@ QPDFJob::doShowObj(QPDF&amp; pdf)
986 979 Pl_StdioFile out("stdout", stdout);
987 980 obj.pipeStreamData(
988 981 &out,
989   - (filter && o.normalize) ? qpdf_ef_normalize : 0,
  982 + (filter && m->normalize) ? qpdf_ef_normalize : 0,
990 983 filter ? qpdf_dl_all : qpdf_dl_none);
991 984 }
992 985 }
... ... @@ -1011,7 +1004,6 @@ QPDFJob::doShowObj(QPDF&amp; pdf)
1011 1004 void
1012 1005 QPDFJob::doShowPages(QPDF& pdf)
1013 1006 {
1014   - QPDFJob& o = *this; // QXXXQ
1015 1007 QPDFPageDocumentHelper dh(pdf);
1016 1008 std::vector<QPDFPageObjectHelper> pages = dh.getAllPages();
1017 1009 int pageno = 0;
... ... @@ -1026,7 +1018,7 @@ QPDFJob::doShowPages(QPDF&amp; pdf)
1026 1018 cout << "page " << pageno << ": "
1027 1019 << page.getObjectID() << " "
1028 1020 << page.getGeneration() << " R" << std::endl;
1029   - if (o.show_page_images)
  1021 + if (m->show_page_images)
1030 1022 {
1031 1023 std::map<std::string, QPDFObjectHandle> images = ph.getImages();
1032 1024 if (! images.empty())
... ... @@ -1062,7 +1054,6 @@ QPDFJob::doShowPages(QPDF&amp; pdf)
1062 1054 void
1063 1055 QPDFJob::doListAttachments(QPDF& pdf)
1064 1056 {
1065   - QPDFJob& o = *this; // QXXXQ
1066 1057 QPDFEmbeddedFileDocumentHelper efdh(pdf);
1067 1058 if (efdh.hasEmbeddedFiles())
1068 1059 {
... ... @@ -1074,26 +1065,26 @@ QPDFJob::doListAttachments(QPDF&amp; pdf)
1074 1065 << key << " -> "
1075 1066 << efoh->getEmbeddedFileStream().getObjGen()
1076 1067 << std::endl;
1077   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  1068 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
1078 1069 auto desc = efoh->getDescription();
1079 1070 if (! desc.empty())
1080 1071 {
1081 1072 cout << " description: " << desc << std::endl;
1082 1073 }
1083 1074 cout << " preferred name: " << efoh->getFilename()
1084   - << std::endl;
  1075 + << std::endl;
1085 1076 cout << " all names:" << std::endl;
1086 1077 for (auto const& i2: efoh->getFilenames())
1087 1078 {
1088 1079 cout << " " << i2.first << " -> " << i2.second
1089   - << std::endl;
  1080 + << std::endl;
1090 1081 }
1091 1082 cout << " all data streams:" << std::endl;
1092 1083 for (auto i2: efoh->getEmbeddedFileStreams().ditems())
1093 1084 {
1094 1085 cout << " " << i2.first << " -> "
1095   - << i2.second.getObjGen()
1096   - << std::endl;
  1086 + << i2.second.getObjGen()
  1087 + << std::endl;
1097 1088 }
1098 1089 });
1099 1090 }
... ... @@ -1101,20 +1092,19 @@ QPDFJob::doListAttachments(QPDF&amp; pdf)
1101 1092 else
1102 1093 {
1103 1094 *(this->m->cout)
1104   - << o.infilename << " has no embedded files" << std::endl;
  1095 + << m->infilename << " has no embedded files" << std::endl;
1105 1096 }
1106 1097 }
1107 1098  
1108 1099 void
1109 1100 QPDFJob::doShowAttachment(QPDF& pdf)
1110 1101 {
1111   - QPDFJob& o = *this; // QXXXQ
1112 1102 QPDFEmbeddedFileDocumentHelper efdh(pdf);
1113   - auto fs = efdh.getEmbeddedFile(o.attachment_to_show);
  1103 + auto fs = efdh.getEmbeddedFile(m->attachment_to_show);
1114 1104 if (! fs)
1115 1105 {
1116 1106 throw std::runtime_error(
1117   - "attachment " + o.attachment_to_show + " not found");
  1107 + "attachment " + m->attachment_to_show + " not found");
1118 1108 }
1119 1109 auto efs = fs->getEmbeddedFileStream();
1120 1110 QUtil::binary_stdout();
... ... @@ -1146,9 +1136,8 @@ QPDFJob::parse_object_id(std::string const&amp; objspec,
1146 1136 std::set<QPDFObjGen>
1147 1137 QPDFJob::getWantedJSONObjects()
1148 1138 {
1149   - QPDFJob& o = *this; // QXXXQ
1150 1139 std::set<QPDFObjGen> wanted_og;
1151   - for (auto const& iter: o.json_objects)
  1140 + for (auto const& iter: m->json_objects)
1152 1141 {
1153 1142 bool trailer;
1154 1143 int obj = 0;
... ... @@ -1165,14 +1154,13 @@ QPDFJob::getWantedJSONObjects()
1165 1154 void
1166 1155 QPDFJob::doJSONObjects(QPDF& pdf, JSON& j)
1167 1156 {
1168   - QPDFJob& o = *this; // QXXXQ
1169 1157 // Add all objects. Do this first before other code below modifies
1170 1158 // things by doing stuff like calling
1171 1159 // pushInheritedAttributesToPage.
1172   - bool all_objects = o.json_objects.empty();
  1160 + bool all_objects = m->json_objects.empty();
1173 1161 std::set<QPDFObjGen> wanted_og = getWantedJSONObjects();
1174 1162 JSON j_objects = j.addDictionaryMember("objects", JSON::makeDictionary());
1175   - if (all_objects || o.json_objects.count("trailer"))
  1163 + if (all_objects || m->json_objects.count("trailer"))
1176 1164 {
1177 1165 j_objects.addDictionaryMember(
1178 1166 "trailer", pdf.getTrailer().getJSON(true));
... ... @@ -1192,10 +1180,9 @@ QPDFJob::doJSONObjects(QPDF&amp; pdf, JSON&amp; j)
1192 1180 void
1193 1181 QPDFJob::doJSONObjectinfo(QPDF& pdf, JSON& j)
1194 1182 {
1195   - QPDFJob& o = *this; // QXXXQ
1196 1183 // Do this first before other code below modifies things by doing
1197 1184 // stuff like calling pushInheritedAttributesToPage.
1198   - bool all_objects = o.json_objects.empty();
  1185 + bool all_objects = m->json_objects.empty();
1199 1186 std::set<QPDFObjGen> wanted_og = getWantedJSONObjects();
1200 1187 JSON j_objectinfo = j.addDictionaryMember(
1201 1188 "objectinfo", JSON::makeDictionary());
... ... @@ -1227,7 +1214,6 @@ QPDFJob::doJSONObjectinfo(QPDF&amp; pdf, JSON&amp; j)
1227 1214 void
1228 1215 QPDFJob::doJSONPages(QPDF& pdf, JSON& j)
1229 1216 {
1230   - QPDFJob& o = *this; // QXXXQ
1231 1217 JSON j_pages = j.addDictionaryMember("pages", JSON::makeArray());
1232 1218 QPDFPageDocumentHelper pdh(pdf);
1233 1219 QPDFPageLabelDocumentHelper pldh(pdf);
... ... @@ -1282,7 +1268,7 @@ QPDFJob::doJSONPages(QPDF&amp; pdf, JSON&amp; j)
1282 1268 j_image.addDictionaryMember(
1283 1269 "filterable",
1284 1270 JSON::makeBool(
1285   - image.pipeStreamData(0, 0, o.decode_level, true)));
  1271 + image.pipeStreamData(0, 0, m->decode_level, true)));
1286 1272 }
1287 1273 j_page.addDictionaryMember("images", j_images);
1288 1274 JSON j_contents = j_page.addDictionaryMember(
... ... @@ -1502,7 +1488,6 @@ QPDFJob::doJSONAcroform(QPDF&amp; pdf, JSON&amp; j)
1502 1488 void
1503 1489 QPDFJob::doJSONEncrypt(QPDF& pdf, JSON& j)
1504 1490 {
1505   - QPDFJob& o = *this; // QXXXQ
1506 1491 int R = 0;
1507 1492 int P = 0;
1508 1493 int V = 0;
... ... @@ -1562,7 +1547,7 @@ QPDFJob::doJSONEncrypt(QPDF&amp; pdf, JSON&amp; j)
1562 1547 {
1563 1548 std::string encryption_key = pdf.getEncryptionKey();
1564 1549 bits = QIntC::to_int(encryption_key.length() * 8);
1565   - if (o.show_encryption_key)
  1550 + if (m->show_encryption_key)
1566 1551 {
1567 1552 key = JSON::makeString(QUtil::hex_encode(encryption_key));
1568 1553 }
... ... @@ -1570,11 +1555,11 @@ QPDFJob::doJSONEncrypt(QPDF&amp; pdf, JSON&amp; j)
1570 1555 j_parameters.addDictionaryMember("bits", JSON::makeInt(bits));
1571 1556 j_parameters.addDictionaryMember("key", key);
1572 1557 auto fix_method = [is_encrypted](QPDF::encryption_method_e& m) {
1573   - if (is_encrypted && m == QPDF::e_none)
1574   - {
1575   - m = QPDF::e_rc4;
1576   - }
1577   - };
  1558 + if (is_encrypted && m == QPDF::e_none)
  1559 + {
  1560 + m = QPDF::e_rc4;
  1561 + }
  1562 + };
1578 1563 fix_method(stream_method);
1579 1564 fix_method(string_method);
1580 1565 fix_method(file_method);
... ... @@ -1820,7 +1805,6 @@ QPDFJob::json_schema(std::set&lt;std::string&gt;* keys)
1820 1805 void
1821 1806 QPDFJob::doJSON(QPDF& pdf)
1822 1807 {
1823   - QPDFJob& o = *this; // QXXXQ
1824 1808 JSON j = JSON::makeDictionary();
1825 1809 // This version is updated every time a non-backward-compatible
1826 1810 // change is made to the JSON format. Clients of the JSON are to
... ... @@ -1830,64 +1814,64 @@ QPDFJob::doJSON(QPDF&amp; pdf)
1830 1814 JSON j_params = j.addDictionaryMember(
1831 1815 "parameters", JSON::makeDictionary());
1832 1816 std::string decode_level_str;
1833   - switch (o.decode_level)
1834   - {
1835   - case qpdf_dl_none:
1836   - decode_level_str = "none";
1837   - break;
1838   - case qpdf_dl_generalized:
1839   - decode_level_str = "generalized";
1840   - break;
1841   - case qpdf_dl_specialized:
1842   - decode_level_str = "specialized";
1843   - break;
1844   - case qpdf_dl_all:
1845   - decode_level_str = "all";
1846   - break;
  1817 + switch (m->decode_level)
  1818 + {
  1819 + case qpdf_dl_none:
  1820 + decode_level_str = "none";
  1821 + break;
  1822 + case qpdf_dl_generalized:
  1823 + decode_level_str = "generalized";
  1824 + break;
  1825 + case qpdf_dl_specialized:
  1826 + decode_level_str = "specialized";
  1827 + break;
  1828 + case qpdf_dl_all:
  1829 + decode_level_str = "all";
  1830 + break;
1847 1831 }
1848 1832 j_params.addDictionaryMember(
1849 1833 "decodelevel", JSON::makeString(decode_level_str));
1850 1834  
1851   - bool all_keys = o.json_keys.empty();
  1835 + bool all_keys = m->json_keys.empty();
1852 1836 // The list of selectable top-level keys id duplicated in the
1853 1837 // following places: job.yml, QPDFJob::json_schema, and
1854 1838 // QPDFJob::doJSON.
1855   - if (all_keys || o.json_keys.count("objects"))
  1839 + if (all_keys || m->json_keys.count("objects"))
1856 1840 {
1857 1841 doJSONObjects(pdf, j);
1858 1842 }
1859   - if (all_keys || o.json_keys.count("objectinfo"))
  1843 + if (all_keys || m->json_keys.count("objectinfo"))
1860 1844 {
1861 1845 doJSONObjectinfo(pdf, j);
1862 1846 }
1863   - if (all_keys || o.json_keys.count("pages"))
  1847 + if (all_keys || m->json_keys.count("pages"))
1864 1848 {
1865 1849 doJSONPages(pdf, j);
1866 1850 }
1867   - if (all_keys || o.json_keys.count("pagelabels"))
  1851 + if (all_keys || m->json_keys.count("pagelabels"))
1868 1852 {
1869 1853 doJSONPageLabels(pdf, j);
1870 1854 }
1871   - if (all_keys || o.json_keys.count("outlines"))
  1855 + if (all_keys || m->json_keys.count("outlines"))
1872 1856 {
1873 1857 doJSONOutlines(pdf, j);
1874 1858 }
1875   - if (all_keys || o.json_keys.count("acroform"))
  1859 + if (all_keys || m->json_keys.count("acroform"))
1876 1860 {
1877 1861 doJSONAcroform(pdf, j);
1878 1862 }
1879   - if (all_keys || o.json_keys.count("encrypt"))
  1863 + if (all_keys || m->json_keys.count("encrypt"))
1880 1864 {
1881 1865 doJSONEncrypt(pdf, j);
1882 1866 }
1883   - if (all_keys || o.json_keys.count("attachments"))
  1867 + if (all_keys || m->json_keys.count("attachments"))
1884 1868 {
1885 1869 doJSONAttachments(pdf, j);
1886 1870 }
1887 1871  
1888 1872 // Check against schema
1889 1873  
1890   - JSON schema = json_schema(&o.json_keys);
  1874 + JSON schema = json_schema(&m->json_keys);
1891 1875 std::list<std::string> errors;
1892 1876 if (! j.checkSchema(schema, errors))
1893 1877 {
... ... @@ -1910,38 +1894,37 @@ ideally with the file that caused the error and the output below. Thanks!\n\
1910 1894 void
1911 1895 QPDFJob::doInspection(QPDF& pdf)
1912 1896 {
1913   - QPDFJob& o = *this; // QXXXQ
1914   - if (o.check)
  1897 + if (m->check)
1915 1898 {
1916 1899 doCheck(pdf);
1917 1900 }
1918   - if (o.json)
  1901 + if (m->json)
1919 1902 {
1920 1903 doJSON(pdf);
1921 1904 }
1922   - if (o.show_npages)
  1905 + if (m->show_npages)
1923 1906 {
1924 1907 QTC::TC("qpdf", "qpdf npages");
1925 1908 *(this->m->cout) << pdf.getRoot().getKey("/Pages").
1926 1909 getKey("/Count").getIntValue() << std::endl;
1927 1910 }
1928   - if (o.show_encryption)
  1911 + if (m->show_encryption)
1929 1912 {
1930 1913 showEncryption(pdf);
1931 1914 }
1932   - if (o.check_linearization)
  1915 + if (m->check_linearization)
1933 1916 {
1934 1917 if (pdf.checkLinearization())
1935 1918 {
1936 1919 *(this->m->cout)
1937   - << o.infilename << ": no linearization errors" << std::endl;
  1920 + << m->infilename << ": no linearization errors" << std::endl;
1938 1921 }
1939 1922 else
1940 1923 {
1941 1924 this->m->warnings = true;
1942 1925 }
1943 1926 }
1944   - if (o.show_linearization)
  1927 + if (m->show_linearization)
1945 1928 {
1946 1929 if (pdf.isLinearized())
1947 1930 {
... ... @@ -1950,26 +1933,26 @@ QPDFJob::doInspection(QPDF&amp; pdf)
1950 1933 else
1951 1934 {
1952 1935 *(this->m->cout)
1953   - << o.infilename << " is not linearized" << std::endl;
  1936 + << m->infilename << " is not linearized" << std::endl;
1954 1937 }
1955 1938 }
1956   - if (o.show_xref)
  1939 + if (m->show_xref)
1957 1940 {
1958 1941 pdf.showXRefTable();
1959 1942 }
1960   - if ((o.show_obj > 0) || o.show_trailer)
  1943 + if ((m->show_obj > 0) || m->show_trailer)
1961 1944 {
1962 1945 doShowObj(pdf);
1963 1946 }
1964   - if (o.show_pages)
  1947 + if (m->show_pages)
1965 1948 {
1966 1949 doShowPages(pdf);
1967 1950 }
1968   - if (o.list_attachments)
  1951 + if (m->list_attachments)
1969 1952 {
1970 1953 doListAttachments(pdf);
1971 1954 }
1972   - if (! o.attachment_to_show.empty())
  1955 + if (! m->attachment_to_show.empty())
1973 1956 {
1974 1957 doShowAttachment(pdf);
1975 1958 }
... ... @@ -2002,7 +1985,6 @@ QPDFJob::doProcess(
2002 1985 std::function<void(QPDF*, char const*)> fn,
2003 1986 char const* password, bool empty)
2004 1987 {
2005   - QPDFJob& o = *this; // QXXXQ
2006 1988 // If a password has been specified but doesn't work, try other
2007 1989 // passwords that are equivalent in different character encodings.
2008 1990 // This makes it possible to open PDF files that were encrypted
... ... @@ -2014,9 +1996,9 @@ QPDFJob::doProcess(
2014 1996 // good chance we'd succeed here.
2015 1997  
2016 1998 std::string ptemp;
2017   - if (password && (! o.password_is_hex_key))
  1999 + if (password && (! m->password_is_hex_key))
2018 2000 {
2019   - if (o.password_mode == QPDFJob::pm_hex_bytes)
  2001 + if (m->password_mode == QPDFJob::pm_hex_bytes)
2020 2002 {
2021 2003 // Special case: handle --password-mode=hex-bytes for input
2022 2004 // password as well as output password
... ... @@ -2025,8 +2007,8 @@ QPDFJob::doProcess(
2025 2007 password = ptemp.c_str();
2026 2008 }
2027 2009 }
2028   - if ((password == 0) || empty || o.password_is_hex_key ||
2029   - o.suppress_password_recovery)
  2010 + if ((password == 0) || empty || m->password_is_hex_key ||
  2011 + m->suppress_password_recovery)
2030 2012 {
2031 2013 // There is no password, or we're not doing recovery, so just
2032 2014 // do the normal processing with the supplied password.
... ... @@ -2078,7 +2060,7 @@ QPDFJob::doProcess(
2078 2060 if (! warned)
2079 2061 {
2080 2062 warned = true;
2081   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2063 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2082 2064 cout << prefix << ": supplied password didn't work;"
2083 2065 << " trying other passwords based on interpreting"
2084 2066 << " password with different string encodings"
... ... @@ -2156,7 +2138,7 @@ QPDFJob::validateUnderOverlay(QPDF&amp; pdf, UnderOverlay* uo)
2156 2138  
2157 2139 static QPDFAcroFormDocumentHelper* get_afdh_for_qpdf(
2158 2140 std::map<unsigned long long,
2159   - std::shared_ptr<QPDFAcroFormDocumentHelper>>& afdh_map,
  2141 + std::shared_ptr<QPDFAcroFormDocumentHelper>>& afdh_map,
2160 2142 QPDF* q)
2161 2143 {
2162 2144 auto uid = q->getUniqueId();
... ... @@ -2178,7 +2160,6 @@ QPDFJob::doUnderOverlayForPage(
2178 2160 QPDFPageObjectHelper& dest_page,
2179 2161 bool before)
2180 2162 {
2181   - QPDFJob& o = *this; // QXXXQ
2182 2163 int pageno = 1 + QIntC::to_int(page_idx);
2183 2164 if (! pagenos.count(pageno))
2184 2165 {
... ... @@ -2206,7 +2187,7 @@ QPDFJob::doUnderOverlayForPage(
2206 2187 iter != pagenos[pageno].end(); ++iter)
2207 2188 {
2208 2189 int from_pageno = *iter;
2209   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2190 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2210 2191 cout << " " << uo.which << " " << from_pageno << std::endl;
2211 2192 });
2212 2193 auto from_page = pages.at(QIntC::to_size(from_pageno - 1));
... ... @@ -2282,46 +2263,45 @@ static void get_uo_pagenos(QPDFJob::UnderOverlay&amp; uo,
2282 2263 void
2283 2264 QPDFJob::handleUnderOverlay(QPDF& pdf)
2284 2265 {
2285   - QPDFJob& o = *this; // QXXXQ
2286   - validateUnderOverlay(pdf, &o.underlay);
2287   - validateUnderOverlay(pdf, &o.overlay);
2288   - if ((nullptr == o.underlay.pdf.get()) &&
2289   - (nullptr == o.overlay.pdf.get()))
  2266 + validateUnderOverlay(pdf, &m->underlay);
  2267 + validateUnderOverlay(pdf, &m->overlay);
  2268 + if ((nullptr == m->underlay.pdf.get()) &&
  2269 + (nullptr == m->overlay.pdf.get()))
2290 2270 {
2291 2271 return;
2292 2272 }
2293 2273 std::map<int, std::vector<int> > underlay_pagenos;
2294   - get_uo_pagenos(o.underlay, underlay_pagenos);
  2274 + get_uo_pagenos(m->underlay, underlay_pagenos);
2295 2275 std::map<int, std::vector<int> > overlay_pagenos;
2296   - get_uo_pagenos(o.overlay, overlay_pagenos);
  2276 + get_uo_pagenos(m->overlay, overlay_pagenos);
2297 2277 std::map<int, QPDFObjectHandle> underlay_fo;
2298 2278 std::map<int, QPDFObjectHandle> overlay_fo;
2299 2279 std::vector<QPDFPageObjectHelper> upages;
2300   - if (o.underlay.pdf.get())
  2280 + if (m->underlay.pdf.get())
2301 2281 {
2302   - upages = QPDFPageDocumentHelper(*(o.underlay.pdf)).getAllPages();
  2282 + upages = QPDFPageDocumentHelper(*(m->underlay.pdf)).getAllPages();
2303 2283 }
2304 2284 std::vector<QPDFPageObjectHelper> opages;
2305   - if (o.overlay.pdf.get())
  2285 + if (m->overlay.pdf.get())
2306 2286 {
2307   - opages = QPDFPageDocumentHelper(*(o.overlay.pdf)).getAllPages();
  2287 + opages = QPDFPageDocumentHelper(*(m->overlay.pdf)).getAllPages();
2308 2288 }
2309 2289  
2310 2290 QPDFPageDocumentHelper main_pdh(pdf);
2311 2291 std::vector<QPDFPageObjectHelper> main_pages = main_pdh.getAllPages();
2312 2292 size_t main_npages = main_pages.size();
2313   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2293 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2314 2294 cout << prefix << ": processing underlay/overlay" << std::endl;
2315 2295 });
2316 2296 for (size_t i = 0; i < main_npages; ++i)
2317 2297 {
2318   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2298 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2319 2299 cout << " page " << 1+i << std::endl;
2320 2300 });
2321   - doUnderOverlayForPage(pdf, o.underlay, underlay_pagenos, i,
  2301 + doUnderOverlayForPage(pdf, m->underlay, underlay_pagenos, i,
2322 2302 underlay_fo, upages, main_pages.at(i),
2323 2303 true);
2324   - doUnderOverlayForPage(pdf, o.overlay, overlay_pagenos, i,
  2304 + doUnderOverlayForPage(pdf, m->overlay, overlay_pagenos, i,
2325 2305 overlay_fo, opages, main_pages.at(i),
2326 2306 false);
2327 2307 }
... ... @@ -2339,11 +2319,10 @@ static void maybe_set_pagemode(QPDF&amp; pdf, std::string const&amp; pagemode)
2339 2319 void
2340 2320 QPDFJob::addAttachments(QPDF& pdf)
2341 2321 {
2342   - QPDFJob& o = *this; // QXXXQ
2343 2322 maybe_set_pagemode(pdf, "/UseAttachments");
2344 2323 QPDFEmbeddedFileDocumentHelper efdh(pdf);
2345 2324 std::vector<std::string> duplicated_keys;
2346   - for (auto const& to_add: o.attachments_to_add)
  2325 + for (auto const& to_add: m->attachments_to_add)
2347 2326 {
2348 2327 if ((! to_add.replace) && efdh.getEmbeddedFile(to_add.key))
2349 2328 {
... ... @@ -2366,7 +2345,7 @@ QPDFJob::addAttachments(QPDF&amp; pdf)
2366 2345 }
2367 2346  
2368 2347 efdh.replaceEmbeddedFile(to_add.key, fs);
2369   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2348 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2370 2349 cout << prefix << ": attached " << to_add.path
2371 2350 << " as " << to_add.filename
2372 2351 << " with key " << to_add.key << std::endl;
... ... @@ -2395,13 +2374,12 @@ QPDFJob::addAttachments(QPDF&amp; pdf)
2395 2374 void
2396 2375 QPDFJob::copyAttachments(QPDF& pdf)
2397 2376 {
2398   - QPDFJob& o = *this; // QXXXQ
2399 2377 maybe_set_pagemode(pdf, "/UseAttachments");
2400 2378 QPDFEmbeddedFileDocumentHelper efdh(pdf);
2401 2379 std::vector<std::string> duplicates;
2402   - for (auto const& to_copy: o.attachments_to_copy)
  2380 + for (auto const& to_copy: m->attachments_to_copy)
2403 2381 {
2404   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2382 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2405 2383 cout << prefix << ": copying attachments from "
2406 2384 << to_copy.path << std::endl;
2407 2385 });
... ... @@ -2423,8 +2401,8 @@ QPDFJob::copyAttachments(QPDF&amp; pdf)
2423 2401 iter.second->getObjectHandle());
2424 2402 efdh.replaceEmbeddedFile(
2425 2403 new_key, QPDFFileSpecObjectHelper(new_fs_oh));
2426   - o.doIfVerbose([&](std::ostream& cout,
2427   - std::string const& prefix) {
  2404 + doIfVerbose([&](std::ostream& cout,
  2405 + std::string const& prefix) {
2428 2406 cout << " " << iter.first << " -> " << new_key
2429 2407 << std::endl;
2430 2408 });
... ... @@ -2469,18 +2447,18 @@ QPDFJob::handleTransformations(QPDF&amp; pdf)
2469 2447 afdh = std::make_shared<QPDFAcroFormDocumentHelper>(pdf);
2470 2448 }
2471 2449 };
2472   - if (o.externalize_inline_images ||
2473   - (o.optimize_images && (! o.keep_inline_images)))
  2450 + if (m->externalize_inline_images ||
  2451 + (m->optimize_images && (! m->keep_inline_images)))
2474 2452 {
2475 2453 std::vector<QPDFPageObjectHelper> pages = dh.getAllPages();
2476 2454 for (std::vector<QPDFPageObjectHelper>::iterator iter = pages.begin();
2477 2455 iter != pages.end(); ++iter)
2478 2456 {
2479 2457 QPDFPageObjectHelper& ph(*iter);
2480   - ph.externalizeInlineImages(o.ii_min_bytes);
  2458 + ph.externalizeInlineImages(m->ii_min_bytes);
2481 2459 }
2482 2460 }
2483   - if (o.optimize_images)
  2461 + if (m->optimize_images)
2484 2462 {
2485 2463 int pageno = 0;
2486 2464 std::vector<QPDFPageObjectHelper> pages = dh.getAllPages();
... ... @@ -2514,17 +2492,17 @@ QPDFJob::handleTransformations(QPDF&amp; pdf)
2514 2492 }
2515 2493 }
2516 2494 }
2517   - if (o.generate_appearances)
  2495 + if (m->generate_appearances)
2518 2496 {
2519 2497 make_afdh();
2520 2498 afdh->generateAppearancesIfNeeded();
2521 2499 }
2522   - if (o.flatten_annotations)
  2500 + if (m->flatten_annotations)
2523 2501 {
2524   - dh.flattenAnnotations(o.flatten_annotations_required,
2525   - o.flatten_annotations_forbidden);
  2502 + dh.flattenAnnotations(m->flatten_annotations_required,
  2503 + m->flatten_annotations_forbidden);
2526 2504 }
2527   - if (o.coalesce_contents)
  2505 + if (m->coalesce_contents)
2528 2506 {
2529 2507 std::vector<QPDFPageObjectHelper> pages = dh.getAllPages();
2530 2508 for (std::vector<QPDFPageObjectHelper>::iterator iter = pages.begin();
... ... @@ -2533,7 +2511,7 @@ QPDFJob::handleTransformations(QPDF&amp; pdf)
2533 2511 (*iter).coalesceContentStreams();
2534 2512 }
2535 2513 }
2536   - if (o.flatten_rotation)
  2514 + if (m->flatten_rotation)
2537 2515 {
2538 2516 make_afdh();
2539 2517 for (auto& page: dh.getAllPages())
... ... @@ -2541,19 +2519,19 @@ QPDFJob::handleTransformations(QPDF&amp; pdf)
2541 2519 page.flattenRotation(afdh.get());
2542 2520 }
2543 2521 }
2544   - if (o.remove_page_labels)
  2522 + if (m->remove_page_labels)
2545 2523 {
2546 2524 pdf.getRoot().removeKey("/PageLabels");
2547 2525 }
2548   - if (! o.attachments_to_remove.empty())
  2526 + if (! m->attachments_to_remove.empty())
2549 2527 {
2550 2528 QPDFEmbeddedFileDocumentHelper efdh(pdf);
2551   - for (auto const& key: o.attachments_to_remove)
  2529 + for (auto const& key: m->attachments_to_remove)
2552 2530 {
2553 2531 if (efdh.removeEmbeddedFile(key))
2554 2532 {
2555   - o.doIfVerbose([&](std::ostream& cout,
2556   - std::string const& prefix) {
  2533 + doIfVerbose([&](std::ostream& cout,
  2534 + std::string const& prefix) {
2557 2535 cout << prefix <<
2558 2536 ": removed attachment " << key << std::endl;
2559 2537 });
... ... @@ -2564,11 +2542,11 @@ QPDFJob::handleTransformations(QPDF&amp; pdf)
2564 2542 }
2565 2543 }
2566 2544 }
2567   - if (! o.attachments_to_add.empty())
  2545 + if (! m->attachments_to_add.empty())
2568 2546 {
2569 2547 addAttachments(pdf);
2570 2548 }
2571   - if (! o.attachments_to_copy.empty())
  2549 + if (! m->attachments_to_copy.empty())
2572 2550 {
2573 2551 copyAttachments(pdf);
2574 2552 }
... ... @@ -2577,12 +2555,11 @@ QPDFJob::handleTransformations(QPDF&amp; pdf)
2577 2555 bool
2578 2556 QPDFJob::shouldRemoveUnreferencedResources(QPDF& pdf)
2579 2557 {
2580   - QPDFJob& o = *this; // QXXXQ
2581   - if (o.remove_unreferenced_page_resources == QPDFJob::re_no)
  2558 + if (m->remove_unreferenced_page_resources == QPDFJob::re_no)
2582 2559 {
2583 2560 return false;
2584 2561 }
2585   - else if (o.remove_unreferenced_page_resources == QPDFJob::re_yes)
  2562 + else if (m->remove_unreferenced_page_resources == QPDFJob::re_yes)
2586 2563 {
2587 2564 return true;
2588 2565 }
... ... @@ -2600,7 +2577,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf)
2600 2577 std::set<QPDFObjGen> resources_seen; // shared resources detection
2601 2578 std::set<QPDFObjGen> nodes_seen; // loop detection
2602 2579  
2603   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2580 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2604 2581 cout << prefix << ": " << pdf.getFilename()
2605 2582 << ": checking for shared resources" << std::endl;
2606 2583 });
... ... @@ -2625,8 +2602,8 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf)
2625 2602 if (dict.hasKey("/Resources"))
2626 2603 {
2627 2604 QTC::TC("qpdf", "qpdf found resources in non-leaf");
2628   - o.doIfVerbose([&](std::ostream& cout,
2629   - std::string const& prefix) {
  2605 + doIfVerbose([&](std::ostream& cout,
  2606 + std::string const& prefix) {
2630 2607 cout << " found resources in non-leaf page node "
2631 2608 << og.getObj() << " " << og.getGen()
2632 2609 << std::endl;
... ... @@ -2649,8 +2626,8 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf)
2649 2626 if (resources_seen.count(resources_og))
2650 2627 {
2651 2628 QTC::TC("qpdf", "qpdf found shared resources in leaf");
2652   - o.doIfVerbose([&](std::ostream& cout,
2653   - std::string const& prefix) {
  2629 + doIfVerbose([&](std::ostream& cout,
  2630 + std::string const& prefix) {
2654 2631 cout << " found shared resources in leaf node "
2655 2632 << og.getObj() << " " << og.getGen()
2656 2633 << ": "
... ... @@ -2671,8 +2648,8 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf)
2671 2648 if (resources_seen.count(xobject_og))
2672 2649 {
2673 2650 QTC::TC("qpdf", "qpdf found shared xobject in leaf");
2674   - o.doIfVerbose([&](std::ostream& cout,
2675   - std::string const& prefix) {
  2651 + doIfVerbose([&](std::ostream& cout,
  2652 + std::string const& prefix) {
2676 2653 cout << " found shared xobject in leaf node "
2677 2654 << og.getObj() << " " << og.getGen()
2678 2655 << ": "
... ... @@ -2704,7 +2681,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf)
2704 2681 }
2705 2682 }
2706 2683  
2707   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2684 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2708 2685 cout << prefix << ": no shared resources found" << std::endl;
2709 2686 });
2710 2687 return false;
... ... @@ -2732,38 +2709,37 @@ QPDFJob::handlePageSpecs(
2732 2709 QPDF& pdf, bool& warnings,
2733 2710 std::vector<std::shared_ptr<QPDF>>& page_heap)
2734 2711 {
2735   - QPDFJob& o = *this; // QXXXQ
2736 2712 // Parse all page specifications and translate them into lists of
2737 2713 // actual pages.
2738 2714  
2739 2715 // Handle "." as a shortcut for the input file
2740   - for (std::vector<QPDFJob::PageSpec>::iterator iter = o.page_specs.begin();
2741   - iter != o.page_specs.end(); ++iter)
  2716 + for (std::vector<QPDFJob::PageSpec>::iterator iter = m->page_specs.begin();
  2717 + iter != m->page_specs.end(); ++iter)
2742 2718 {
2743 2719 QPDFJob::PageSpec& page_spec = *iter;
2744 2720 if (page_spec.filename == ".")
2745 2721 {
2746   - page_spec.filename = o.infilename.get();
  2722 + page_spec.filename = m->infilename.get();
2747 2723 }
2748 2724 }
2749 2725  
2750   - if (! o.keep_files_open_set)
  2726 + if (! m->keep_files_open_set)
2751 2727 {
2752 2728 // Count the number of distinct files to determine whether we
2753 2729 // should keep files open or not. Rather than trying to code
2754 2730 // some portable heuristic based on OS limits, just hard-code
2755 2731 // this at a given number and allow users to override.
2756 2732 std::set<std::string> filenames;
2757   - for (auto& page_spec: o.page_specs)
  2733 + for (auto& page_spec: m->page_specs)
2758 2734 {
2759 2735 filenames.insert(page_spec.filename);
2760 2736 }
2761   - o.keep_files_open = (filenames.size() <= o.keep_files_open_threshold);
  2737 + m->keep_files_open = (filenames.size() <= m->keep_files_open_threshold);
2762 2738 QTC::TC("qpdf", "qpdf automatically set keep files open",
2763   - o.keep_files_open ? 0 : 1);
2764   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2739 + m->keep_files_open ? 0 : 1);
  2740 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2765 2741 cout << prefix << ": selecting --keep-open-files="
2766   - << (o.keep_files_open ? "y" : "n")
  2742 + << (m->keep_files_open ? "y" : "n")
2767 2743 << std::endl;
2768 2744 });
2769 2745 }
... ... @@ -2771,11 +2747,11 @@ QPDFJob::handlePageSpecs(
2771 2747 // Create a QPDF object for each file that we may take pages from.
2772 2748 std::map<std::string, QPDF*> page_spec_qpdfs;
2773 2749 std::map<std::string, ClosedFileInputSource*> page_spec_cfis;
2774   - page_spec_qpdfs[o.infilename.get()] = &pdf;
  2750 + page_spec_qpdfs[m->infilename.get()] = &pdf;
2775 2751 std::vector<QPDFPageData> parsed_specs;
2776 2752 std::map<unsigned long long, std::set<QPDFObjGen> > copied_pages;
2777   - for (std::vector<QPDFJob::PageSpec>::iterator iter = o.page_specs.begin();
2778   - iter != o.page_specs.end(); ++iter)
  2753 + for (std::vector<QPDFJob::PageSpec>::iterator iter = m->page_specs.begin();
  2754 + iter != m->page_specs.end(); ++iter)
2779 2755 {
2780 2756 QPDFJob::PageSpec& page_spec = *iter;
2781 2757 if (page_spec_qpdfs.count(page_spec.filename) == 0)
... ... @@ -2791,19 +2767,19 @@ QPDFJob::handlePageSpecs(
2791 2767 // to the same underlying file with the same path to
2792 2768 // achieve the same affect.
2793 2769 char const* password = page_spec.password.get();
2794   - if ((! o.encryption_file.empty()) && (password == 0) &&
2795   - (page_spec.filename == o.encryption_file))
  2770 + if ((! m->encryption_file.empty()) && (password == 0) &&
  2771 + (page_spec.filename == m->encryption_file))
2796 2772 {
2797 2773 QTC::TC("qpdf", "qpdf pages encryption password");
2798   - password = o.encryption_file_password.get();
  2774 + password = m->encryption_file_password.get();
2799 2775 }
2800   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2776 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2801 2777 cout << prefix << ": processing "
2802 2778 << page_spec.filename << std::endl;
2803 2779 });
2804 2780 PointerHolder<InputSource> is;
2805 2781 ClosedFileInputSource* cis = 0;
2806   - if (! o.keep_files_open)
  2782 + if (! m->keep_files_open)
2807 2783 {
2808 2784 QTC::TC("qpdf", "qpdf keep files open n");
2809 2785 cis = new ClosedFileInputSource(page_spec.filename.c_str());
... ... @@ -2836,7 +2812,7 @@ QPDFJob::handlePageSpecs(
2836 2812 }
2837 2813  
2838 2814 std::map<unsigned long long, bool> remove_unreferenced;
2839   - if (o.remove_unreferenced_page_resources != QPDFJob::re_no)
  2815 + if (m->remove_unreferenced_page_resources != QPDFJob::re_no)
2840 2816 {
2841 2817 for (std::map<std::string, QPDF*>::iterator iter =
2842 2818 page_spec_qpdfs.begin();
... ... @@ -2868,7 +2844,7 @@ QPDFJob::handlePageSpecs(
2868 2844 // without changing their object numbers. This enables other
2869 2845 // things in the original file, such as outlines, to continue to
2870 2846 // work.
2871   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2847 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2872 2848 cout << prefix
2873 2849 << ": removing unreferenced pages from primary input"
2874 2850 << std::endl;
... ... @@ -2882,7 +2858,7 @@ QPDFJob::handlePageSpecs(
2882 2858 dh.removePage(*iter);
2883 2859 }
2884 2860  
2885   - if (o.collate && (parsed_specs.size() > 1))
  2861 + if (m->collate && (parsed_specs.size() > 1))
2886 2862 {
2887 2863 // Collate the pages by selecting one page from each spec in
2888 2864 // order. When a spec runs out of pages, stop selecting from
... ... @@ -2897,7 +2873,7 @@ QPDFJob::handlePageSpecs(
2897 2873 for (size_t i = 0; i < nspecs; ++i)
2898 2874 {
2899 2875 QPDFPageData& page_data = parsed_specs.at(i);
2900   - for (size_t j = 0; j < o.collate; ++j)
  2876 + for (size_t j = 0; j < m->collate; ++j)
2901 2877 {
2902 2878 if (cur_page + j < page_data.selected_pages.size())
2903 2879 {
... ... @@ -2909,7 +2885,7 @@ QPDFJob::handlePageSpecs(
2909 2885 }
2910 2886 }
2911 2887 }
2912   - cur_page += o.collate;
  2888 + cur_page += m->collate;
2913 2889 }
2914 2890 parsed_specs = new_parsed_specs;
2915 2891 }
... ... @@ -2942,7 +2918,7 @@ QPDFJob::handlePageSpecs(
2942 2918 {
2943 2919 any_page_labels = true;
2944 2920 }
2945   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  2921 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2946 2922 cout << prefix << ": adding pages from "
2947 2923 << page_data.filename << std::endl;
2948 2924 });
... ... @@ -3098,13 +3074,12 @@ QPDFJob::handlePageSpecs(
3098 3074 void
3099 3075 QPDFJob::handleRotations(QPDF& pdf)
3100 3076 {
3101   - QPDFJob& o = *this; // QXXXQ
3102 3077 QPDFPageDocumentHelper dh(pdf);
3103 3078 std::vector<QPDFPageObjectHelper> pages = dh.getAllPages();
3104 3079 int npages = QIntC::to_int(pages.size());
3105 3080 for (std::map<std::string, QPDFJob::RotationSpec>::iterator iter =
3106   - o.rotations.begin();
3107   - iter != o.rotations.end(); ++iter)
  3081 + m->rotations.begin();
  3082 + iter != m->rotations.end(); ++iter)
3108 3083 {
3109 3084 std::string const& range = (*iter).first;
3110 3085 QPDFJob::RotationSpec const& rspec = (*iter).second;
... ... @@ -3127,8 +3102,7 @@ QPDFJob::handleRotations(QPDF&amp; pdf)
3127 3102 void
3128 3103 QPDFJob::maybeFixWritePassword(int R, std::string& password)
3129 3104 {
3130   - QPDFJob& o = *this; // QXXXQ
3131   - switch (o.password_mode)
  3105 + switch (m->password_mode)
3132 3106 {
3133 3107 case QPDFJob::pm_bytes:
3134 3108 QTC::TC("qpdf", "qpdf password mode bytes");
... ... @@ -3153,7 +3127,7 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password)
3153 3127 {
3154 3128 return;
3155 3129 }
3156   - if (o.password_mode == QPDFJob::pm_unicode)
  3130 + if (m->password_mode == QPDFJob::pm_unicode)
3157 3131 {
3158 3132 if (! is_valid_utf8)
3159 3133 {
... ... @@ -3182,8 +3156,8 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password)
3182 3156 if (QUtil::utf8_to_pdf_doc(password, encoded))
3183 3157 {
3184 3158 QTC::TC("qpdf", "qpdf auto-encode password");
3185   - o.doIfVerbose([&](std::ostream& cout,
3186   - std::string const& prefix) {
  3159 + doIfVerbose([&](std::ostream& cout,
  3160 + std::string const& prefix) {
3187 3161 cout
3188 3162 << prefix
3189 3163 << ": automatically converting Unicode"
... ... @@ -3226,15 +3200,14 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password)
3226 3200 void
3227 3201 QPDFJob::setEncryptionOptions(QPDF& pdf, QPDFWriter& w)
3228 3202 {
3229   - QPDFJob& o = *this; // QXXXQ
3230 3203 int R = 0;
3231   - if (o.keylen == 40)
  3204 + if (m->keylen == 40)
3232 3205 {
3233 3206 R = 2;
3234 3207 }
3235   - else if (o.keylen == 128)
  3208 + else if (m->keylen == 128)
3236 3209 {
3237   - if (o.force_V4 || o.cleartext_metadata || o.use_aes)
  3210 + if (m->force_V4 || m->cleartext_metadata || m->use_aes)
3238 3211 {
3239 3212 R = 4;
3240 3213 }
... ... @@ -3243,9 +3216,9 @@ QPDFJob::setEncryptionOptions(QPDF&amp; pdf, QPDFWriter&amp; w)
3243 3216 R = 3;
3244 3217 }
3245 3218 }
3246   - else if (o.keylen == 256)
  3219 + else if (m->keylen == 256)
3247 3220 {
3248   - if (o.force_R5)
  3221 + if (m->force_R5)
3249 3222 {
3250 3223 R = 5;
3251 3224 }
... ... @@ -3258,18 +3231,18 @@ QPDFJob::setEncryptionOptions(QPDF&amp; pdf, QPDFWriter&amp; w)
3258 3231 {
3259 3232 throw std::logic_error("bad encryption keylen");
3260 3233 }
3261   - if ((R > 3) && (o.r3_accessibility == false))
  3234 + if ((R > 3) && (m->r3_accessibility == false))
3262 3235 {
3263 3236 *(this->m->cerr)
3264 3237 << this->m->message_prefix
3265 3238 << ": -accessibility=n is ignored for modern"
3266 3239 << " encryption formats" << std::endl;
3267 3240 }
3268   - maybeFixWritePassword(R, o.user_password);
3269   - maybeFixWritePassword(R, o.owner_password);
3270   - if ((R < 4) || ((R == 4) && (! o.use_aes)))
  3241 + maybeFixWritePassword(R, m->user_password);
  3242 + maybeFixWritePassword(R, m->owner_password);
  3243 + if ((R < 4) || ((R == 4) && (! m->use_aes)))
3271 3244 {
3272   - if (! o.allow_weak_crypto)
  3245 + if (! m->allow_weak_crypto)
3273 3246 {
3274 3247 // Do not set warnings = true for this case as this does
3275 3248 // not reflect a potential problem with the input file.
... ... @@ -3290,40 +3263,40 @@ QPDFJob::setEncryptionOptions(QPDF&amp; pdf, QPDFWriter&amp; w)
3290 3263 {
3291 3264 case 2:
3292 3265 w.setR2EncryptionParameters(
3293   - o.user_password.c_str(), o.owner_password.c_str(),
3294   - o.r2_print, o.r2_modify, o.r2_extract, o.r2_annotate);
  3266 + m->user_password.c_str(), m->owner_password.c_str(),
  3267 + m->r2_print, m->r2_modify, m->r2_extract, m->r2_annotate);
3295 3268 break;
3296 3269 case 3:
3297 3270 w.setR3EncryptionParameters(
3298   - o.user_password.c_str(), o.owner_password.c_str(),
3299   - o.r3_accessibility, o.r3_extract,
3300   - o.r3_assemble, o.r3_annotate_and_form,
3301   - o.r3_form_filling, o.r3_modify_other,
3302   - o.r3_print);
  3271 + m->user_password.c_str(), m->owner_password.c_str(),
  3272 + m->r3_accessibility, m->r3_extract,
  3273 + m->r3_assemble, m->r3_annotate_and_form,
  3274 + m->r3_form_filling, m->r3_modify_other,
  3275 + m->r3_print);
3303 3276 break;
3304 3277 case 4:
3305 3278 w.setR4EncryptionParameters(
3306   - o.user_password.c_str(), o.owner_password.c_str(),
3307   - o.r3_accessibility, o.r3_extract,
3308   - o.r3_assemble, o.r3_annotate_and_form,
3309   - o.r3_form_filling, o.r3_modify_other,
3310   - o.r3_print, !o.cleartext_metadata, o.use_aes);
  3279 + m->user_password.c_str(), m->owner_password.c_str(),
  3280 + m->r3_accessibility, m->r3_extract,
  3281 + m->r3_assemble, m->r3_annotate_and_form,
  3282 + m->r3_form_filling, m->r3_modify_other,
  3283 + m->r3_print, !m->cleartext_metadata, m->use_aes);
3311 3284 break;
3312 3285 case 5:
3313 3286 w.setR5EncryptionParameters(
3314   - o.user_password.c_str(), o.owner_password.c_str(),
3315   - o.r3_accessibility, o.r3_extract,
3316   - o.r3_assemble, o.r3_annotate_and_form,
3317   - o.r3_form_filling, o.r3_modify_other,
3318   - o.r3_print, !o.cleartext_metadata);
  3287 + m->user_password.c_str(), m->owner_password.c_str(),
  3288 + m->r3_accessibility, m->r3_extract,
  3289 + m->r3_assemble, m->r3_annotate_and_form,
  3290 + m->r3_form_filling, m->r3_modify_other,
  3291 + m->r3_print, !m->cleartext_metadata);
3319 3292 break;
3320 3293 case 6:
3321 3294 w.setR6EncryptionParameters(
3322   - o.user_password.c_str(), o.owner_password.c_str(),
3323   - o.r3_accessibility, o.r3_extract,
3324   - o.r3_assemble, o.r3_annotate_and_form,
3325   - o.r3_form_filling, o.r3_modify_other,
3326   - o.r3_print, !o.cleartext_metadata);
  3295 + m->user_password.c_str(), m->owner_password.c_str(),
  3296 + m->r3_accessibility, m->r3_extract,
  3297 + m->r3_assemble, m->r3_annotate_and_form,
  3298 + m->r3_form_filling, m->r3_modify_other,
  3299 + m->r3_print, !m->cleartext_metadata);
3327 3300 break;
3328 3301 default:
3329 3302 throw std::logic_error("bad encryption R value");
... ... @@ -3349,137 +3322,135 @@ static void parse_version(std::string const&amp; full_version_string,
3349 3322 void
3350 3323 QPDFJob::setWriterOptions(QPDF& pdf, QPDFWriter& w)
3351 3324 {
3352   - QPDFJob& o = *this; // QXXXQ
3353   - if (o.compression_level >= 0)
  3325 + if (m->compression_level >= 0)
3354 3326 {
3355   - Pl_Flate::setCompressionLevel(o.compression_level);
  3327 + Pl_Flate::setCompressionLevel(m->compression_level);
3356 3328 }
3357   - if (o.qdf_mode)
  3329 + if (m->qdf_mode)
3358 3330 {
3359 3331 w.setQDFMode(true);
3360 3332 }
3361   - if (o.preserve_unreferenced_objects)
  3333 + if (m->preserve_unreferenced_objects)
3362 3334 {
3363 3335 w.setPreserveUnreferencedObjects(true);
3364 3336 }
3365   - if (o.newline_before_endstream)
  3337 + if (m->newline_before_endstream)
3366 3338 {
3367 3339 w.setNewlineBeforeEndstream(true);
3368 3340 }
3369   - if (o.normalize_set)
  3341 + if (m->normalize_set)
3370 3342 {
3371   - w.setContentNormalization(o.normalize);
  3343 + w.setContentNormalization(m->normalize);
3372 3344 }
3373   - if (o.stream_data_set)
  3345 + if (m->stream_data_set)
3374 3346 {
3375   - w.setStreamDataMode(o.stream_data_mode);
  3347 + w.setStreamDataMode(m->stream_data_mode);
3376 3348 }
3377   - if (o.compress_streams_set)
  3349 + if (m->compress_streams_set)
3378 3350 {
3379   - w.setCompressStreams(o.compress_streams);
  3351 + w.setCompressStreams(m->compress_streams);
3380 3352 }
3381   - if (o.recompress_flate_set)
  3353 + if (m->recompress_flate_set)
3382 3354 {
3383   - w.setRecompressFlate(o.recompress_flate);
  3355 + w.setRecompressFlate(m->recompress_flate);
3384 3356 }
3385   - if (o.decode_level_set)
  3357 + if (m->decode_level_set)
3386 3358 {
3387   - w.setDecodeLevel(o.decode_level);
  3359 + w.setDecodeLevel(m->decode_level);
3388 3360 }
3389   - if (o.decrypt)
  3361 + if (m->decrypt)
3390 3362 {
3391 3363 w.setPreserveEncryption(false);
3392 3364 }
3393   - if (o.deterministic_id)
  3365 + if (m->deterministic_id)
3394 3366 {
3395 3367 w.setDeterministicID(true);
3396 3368 }
3397   - if (o.static_id)
  3369 + if (m->static_id)
3398 3370 {
3399 3371 w.setStaticID(true);
3400 3372 }
3401   - if (o.static_aes_iv)
  3373 + if (m->static_aes_iv)
3402 3374 {
3403 3375 w.setStaticAesIV(true);
3404 3376 }
3405   - if (o.suppress_original_object_id)
  3377 + if (m->suppress_original_object_id)
3406 3378 {
3407 3379 w.setSuppressOriginalObjectIDs(true);
3408 3380 }
3409   - if (o.copy_encryption)
  3381 + if (m->copy_encryption)
3410 3382 {
3411 3383 std::shared_ptr<QPDF> encryption_pdf =
3412   - processFile(o.encryption_file.c_str(),
3413   - o.encryption_file_password.get());
  3384 + processFile(m->encryption_file.c_str(),
  3385 + m->encryption_file_password.get());
3414 3386 w.copyEncryptionParameters(*encryption_pdf);
3415 3387 }
3416   - if (o.encrypt)
  3388 + if (m->encrypt)
3417 3389 {
3418 3390 setEncryptionOptions(pdf, w);
3419 3391 }
3420   - if (o.linearize)
  3392 + if (m->linearize)
3421 3393 {
3422 3394 w.setLinearization(true);
3423 3395 }
3424   - if (! o.linearize_pass1.empty())
  3396 + if (! m->linearize_pass1.empty())
3425 3397 {
3426   - w.setLinearizationPass1Filename(o.linearize_pass1);
  3398 + w.setLinearizationPass1Filename(m->linearize_pass1);
3427 3399 }
3428   - if (o.object_stream_set)
  3400 + if (m->object_stream_set)
3429 3401 {
3430   - w.setObjectStreamMode(o.object_stream_mode);
  3402 + w.setObjectStreamMode(m->object_stream_mode);
3431 3403 }
3432   - if (! o.min_version.empty())
  3404 + if (! m->min_version.empty())
3433 3405 {
3434 3406 std::string version;
3435 3407 int extension_level = 0;
3436   - parse_version(o.min_version, version, extension_level);
  3408 + parse_version(m->min_version, version, extension_level);
3437 3409 w.setMinimumPDFVersion(version, extension_level);
3438 3410 }
3439   - if (! o.force_version.empty())
  3411 + if (! m->force_version.empty())
3440 3412 {
3441 3413 std::string version;
3442 3414 int extension_level = 0;
3443   - parse_version(o.force_version, version, extension_level);
  3415 + parse_version(m->force_version, version, extension_level);
3444 3416 w.forcePDFVersion(version, extension_level);
3445 3417 }
3446   - if (o.progress && o.outfilename)
  3418 + if (m->progress && m->outfilename)
3447 3419 {
3448 3420 w.registerProgressReporter(
3449 3421 new ProgressReporter(
3450 3422 *(this->m->cout), this->m->message_prefix,
3451   - o.outfilename.get()));
  3423 + m->outfilename.get()));
3452 3424 }
3453 3425 }
3454 3426  
3455 3427 void
3456 3428 QPDFJob::doSplitPages(QPDF& pdf, bool& warnings)
3457 3429 {
3458   - QPDFJob& o = *this; // QXXXQ
3459 3430 // Generate output file pattern
3460 3431 std::string before;
3461 3432 std::string after;
3462   - size_t len = strlen(o.outfilename.get());
3463   - char* num_spot = strstr(const_cast<char*>(o.outfilename.get()), "%d");
  3433 + size_t len = strlen(m->outfilename.get());
  3434 + char* num_spot = strstr(const_cast<char*>(m->outfilename.get()), "%d");
3464 3435 if (num_spot != 0)
3465 3436 {
3466 3437 QTC::TC("qpdf", "qpdf split-pages %d");
3467   - before = std::string(o.outfilename.get(),
3468   - QIntC::to_size(num_spot - o.outfilename.get()));
  3438 + before = std::string(m->outfilename.get(),
  3439 + QIntC::to_size(num_spot - m->outfilename.get()));
3469 3440 after = num_spot + 2;
3470 3441 }
3471 3442 else if ((len >= 4) &&
3472 3443 (QUtil::str_compare_nocase(
3473   - o.outfilename.get() + len - 4, ".pdf") == 0))
  3444 + m->outfilename.get() + len - 4, ".pdf") == 0))
3474 3445 {
3475 3446 QTC::TC("qpdf", "qpdf split-pages .pdf");
3476   - before = std::string(o.outfilename.get(), len - 4) + "-";
3477   - after = o.outfilename.get() + len - 4;
  3447 + before = std::string(m->outfilename.get(), len - 4) + "-";
  3448 + after = m->outfilename.get() + len - 4;
3478 3449 }
3479 3450 else
3480 3451 {
3481 3452 QTC::TC("qpdf", "qpdf split-pages other");
3482   - before = std::string(o.outfilename.get()) + "-";
  3453 + before = std::string(m->outfilename.get()) + "-";
3483 3454 }
3484 3455  
3485 3456 if (shouldRemoveUnreferencedResources(pdf))
... ... @@ -3492,10 +3463,10 @@ QPDFJob::doSplitPages(QPDF&amp; pdf, bool&amp; warnings)
3492 3463 std::vector<QPDFObjectHandle> const& pages = pdf.getAllPages();
3493 3464 size_t pageno_len = QUtil::uint_to_string(pages.size()).length();
3494 3465 size_t num_pages = pages.size();
3495   - for (size_t i = 0; i < num_pages; i += QIntC::to_size(o.split_pages))
  3466 + for (size_t i = 0; i < num_pages; i += QIntC::to_size(m->split_pages))
3496 3467 {
3497 3468 size_t first = i + 1;
3498   - size_t last = i + QIntC::to_size(o.split_pages);
  3469 + size_t last = i + QIntC::to_size(m->split_pages);
3499 3470 if (last > num_pages)
3500 3471 {
3501 3472 last = num_pages;
... ... @@ -3507,7 +3478,7 @@ QPDFJob::doSplitPages(QPDF&amp; pdf, bool&amp; warnings)
3507 3478 {
3508 3479 out_afdh = std::make_shared<QPDFAcroFormDocumentHelper>(outpdf);
3509 3480 }
3510   - if (o.suppress_warnings)
  3481 + if (m->suppress_warnings)
3511 3482 {
3512 3483 outpdf.setSuppressWarnings(true);
3513 3484 }
... ... @@ -3548,13 +3519,13 @@ QPDFJob::doSplitPages(QPDF&amp; pdf, bool&amp; warnings)
3548 3519 }
3549 3520 std::string page_range =
3550 3521 QUtil::uint_to_string(first, QIntC::to_int(pageno_len));
3551   - if (o.split_pages > 1)
  3522 + if (m->split_pages > 1)
3552 3523 {
3553 3524 page_range += "-" +
3554 3525 QUtil::uint_to_string(last, QIntC::to_int(pageno_len));
3555 3526 }
3556 3527 std::string outfile = before + page_range + after;
3557   - if (QUtil::same_file(o.infilename.get(), outfile.c_str()))
  3528 + if (QUtil::same_file(m->infilename.get(), outfile.c_str()))
3558 3529 {
3559 3530 throw std::runtime_error(
3560 3531 "split pages would overwrite input file with " + outfile);
... ... @@ -3562,7 +3533,7 @@ QPDFJob::doSplitPages(QPDF&amp; pdf, bool&amp; warnings)
3562 3533 QPDFWriter w(outpdf, outfile.c_str());
3563 3534 setWriterOptions(outpdf, w);
3564 3535 w.write();
3565   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  3536 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
3566 3537 cout << prefix << ": wrote file " << outfile << std::endl;
3567 3538 });
3568 3539 if (outpdf.anyWarnings())
... ... @@ -3575,51 +3546,50 @@ QPDFJob::doSplitPages(QPDF&amp; pdf, bool&amp; warnings)
3575 3546 void
3576 3547 QPDFJob::writeOutfile(QPDF& pdf)
3577 3548 {
3578   - QPDFJob& o = *this; // QXXXQ
3579 3549 std::shared_ptr<char> temp_out;
3580   - if (o.replace_input)
  3550 + if (m->replace_input)
3581 3551 {
3582 3552 // Append but don't prepend to the path to generate a
3583 3553 // temporary name. This saves us from having to split the path
3584 3554 // by directory and non-directory.
3585 3555 temp_out = QUtil::make_shared_cstr(
3586   - std::string(o.infilename.get()) + ".~qpdf-temp#");
3587   - // o.outfilename will be restored to 0 before temp_out
  3556 + std::string(m->infilename.get()) + ".~qpdf-temp#");
  3557 + // m->outfilename will be restored to 0 before temp_out
3588 3558 // goes out of scope.
3589   - o.outfilename = temp_out;
  3559 + m->outfilename = temp_out;
3590 3560 }
3591   - else if (strcmp(o.outfilename.get(), "-") == 0)
  3561 + else if (strcmp(m->outfilename.get(), "-") == 0)
3592 3562 {
3593   - o.outfilename = 0;
  3563 + m->outfilename = 0;
3594 3564 }
3595 3565 {
3596 3566 // Private scope so QPDFWriter will close the output file
3597   - QPDFWriter w(pdf, o.outfilename.get());
  3567 + QPDFWriter w(pdf, m->outfilename.get());
3598 3568 setWriterOptions(pdf, w);
3599 3569 w.write();
3600 3570 }
3601   - if (o.outfilename)
  3571 + if (m->outfilename)
3602 3572 {
3603   - o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
3604   - cout << prefix << ": wrote file " << o.outfilename << std::endl;
  3573 + doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
  3574 + cout << prefix << ": wrote file " << m->outfilename << std::endl;
3605 3575 });
3606 3576 }
3607   - if (o.replace_input)
  3577 + if (m->replace_input)
3608 3578 {
3609   - o.outfilename = 0;
  3579 + m->outfilename = 0;
3610 3580 }
3611   - if (o.replace_input)
  3581 + if (m->replace_input)
3612 3582 {
3613 3583 // We must close the input before we can rename files
3614 3584 pdf.closeInputSource();
3615   - std::string backup = std::string(o.infilename.get()) + ".~qpdf-orig";
  3585 + std::string backup = std::string(m->infilename.get()) + ".~qpdf-orig";
3616 3586 bool warnings = pdf.anyWarnings();
3617 3587 if (! warnings)
3618 3588 {
3619 3589 backup.append(1, '#');
3620 3590 }
3621   - QUtil::rename_file(o.infilename.get(), backup.c_str());
3622   - QUtil::rename_file(temp_out.get(), o.infilename.get());
  3591 + QUtil::rename_file(m->infilename.get(), backup.c_str());
  3592 + QUtil::rename_file(temp_out.get(), m->infilename.get());
3623 3593 if (warnings)
3624 3594 {
3625 3595 *(this->m->cerr)
... ...
libqpdf/QPDFJob_config.cc
... ... @@ -11,9 +11,9 @@ static void usage(std::string const&amp; msg)
11 11 QPDFJob::Config&
12 12 QPDFJob::Config::inputFile(char const* filename)
13 13 {
14   - if (o.infilename == 0)
  14 + if (o.m->infilename == 0)
15 15 {
16   - o.infilename = QUtil::make_shared_cstr(filename);
  16 + o.m->infilename = QUtil::make_shared_cstr(filename);
17 17 }
18 18 else
19 19 {
... ... @@ -25,7 +25,7 @@ QPDFJob::Config::inputFile(char const* filename)
25 25 QPDFJob::Config&
26 26 QPDFJob::Config::emptyInput()
27 27 {
28   - if (o.infilename == 0)
  28 + if (o.m->infilename == 0)
29 29 {
30 30 // QXXXQ decide whether to fix this or just leave the comment:
31 31 // Various places in QPDFJob.cc know that the empty string for
... ... @@ -35,7 +35,7 @@ QPDFJob::Config::emptyInput()
35 35 // --empty. This probably isn't worth blocking or coding
36 36 // around, but it would be better if we had a tighter way of
37 37 // knowing that the input file is empty.
38   - o.infilename = QUtil::make_shared_cstr("");
  38 + o.m->infilename = QUtil::make_shared_cstr("");
39 39 }
40 40 else
41 41 {
... ... @@ -48,9 +48,9 @@ QPDFJob::Config::emptyInput()
48 48 QPDFJob::Config&
49 49 QPDFJob::Config::outputFile(char const* filename)
50 50 {
51   - if ((o.outfilename == 0) && (! o.replace_input))
  51 + if ((o.m->outfilename == 0) && (! o.m->replace_input))
52 52 {
53   - o.outfilename = QUtil::make_shared_cstr(filename);
  53 + o.m->outfilename = QUtil::make_shared_cstr(filename);
54 54 }
55 55 else
56 56 {
... ... @@ -62,9 +62,9 @@ QPDFJob::Config::outputFile(char const* filename)
62 62 QPDFJob::Config&
63 63 QPDFJob::Config::replaceInput()
64 64 {
65   - if ((o.outfilename == 0) && (! o.replace_input))
  65 + if ((o.m->outfilename == 0) && (! o.m->replace_input))
66 66 {
67   - o.replace_input = true;
  67 + o.m->replace_input = true;
68 68 }
69 69 else
70 70 {
... ... @@ -77,30 +77,30 @@ QPDFJob::Config::replaceInput()
77 77 QPDFJob::Config&
78 78 QPDFJob::Config::allowWeakCrypto()
79 79 {
80   - o.allow_weak_crypto = true;
  80 + o.m->allow_weak_crypto = true;
81 81 return *this;
82 82 }
83 83  
84 84 QPDFJob::Config&
85 85 QPDFJob::Config::check()
86 86 {
87   - o.check = true;
88   - o.require_outfile = false;
  87 + o.m->check = true;
  88 + o.m->require_outfile = false;
89 89 return *this;
90 90 }
91 91  
92 92 QPDFJob::Config&
93 93 QPDFJob::Config::checkLinearization()
94 94 {
95   - o.check_linearization = true;
96   - o.require_outfile = false;
  95 + o.m->check_linearization = true;
  96 + o.m->require_outfile = false;
97 97 return *this;
98 98 }
99 99  
100 100 QPDFJob::Config&
101 101 QPDFJob::Config::coalesceContents()
102 102 {
103   - o.coalesce_contents = true;
  103 + o.m->coalesce_contents = true;
104 104 return *this;
105 105 }
106 106  
... ... @@ -109,83 +109,83 @@ QPDFJob::Config::collate(char const* parameter)
109 109 {
110 110 auto n = ((parameter == 0) ? 1 :
111 111 QUtil::string_to_uint(parameter));
112   - o.collate = QIntC::to_size(n);
  112 + o.m->collate = QIntC::to_size(n);
113 113 return *this;
114 114 }
115 115  
116 116 QPDFJob::Config&
117 117 QPDFJob::Config::compressStreams(char const* parameter)
118 118 {
119   - o.compress_streams_set = true;
120   - o.compress_streams = (strcmp(parameter, "y") == 0);
  119 + o.m->compress_streams_set = true;
  120 + o.m->compress_streams = (strcmp(parameter, "y") == 0);
121 121 return *this;
122 122 }
123 123  
124 124 QPDFJob::Config&
125 125 QPDFJob::Config::compressionLevel(char const* parameter)
126 126 {
127   - o.compression_level = QUtil::string_to_int(parameter);
  127 + o.m->compression_level = QUtil::string_to_int(parameter);
128 128 return *this;
129 129 }
130 130  
131 131 QPDFJob::Config&
132 132 QPDFJob::Config::copyEncryption(char const* parameter)
133 133 {
134   - o.encryption_file = parameter;
135   - o.copy_encryption = true;
136   - o.encrypt = false;
137   - o.decrypt = false;
  134 + o.m->encryption_file = parameter;
  135 + o.m->copy_encryption = true;
  136 + o.m->encrypt = false;
  137 + o.m->decrypt = false;
138 138 return *this;
139 139 }
140 140  
141 141 QPDFJob::Config&
142 142 QPDFJob::Config::decrypt()
143 143 {
144   - o.decrypt = true;
145   - o.encrypt = false;
146   - o.copy_encryption = false;
  144 + o.m->decrypt = true;
  145 + o.m->encrypt = false;
  146 + o.m->copy_encryption = false;
147 147 return *this;
148 148 }
149 149  
150 150 QPDFJob::Config&
151 151 QPDFJob::Config::deterministicId()
152 152 {
153   - o.deterministic_id = true;
  153 + o.m->deterministic_id = true;
154 154 return *this;
155 155 }
156 156  
157 157 QPDFJob::Config&
158 158 QPDFJob::Config::encryptionFilePassword(char const* parameter)
159 159 {
160   - o.encryption_file_password = QUtil::make_shared_cstr(parameter);
  160 + o.m->encryption_file_password = QUtil::make_shared_cstr(parameter);
161 161 return *this;
162 162 }
163 163  
164 164 QPDFJob::Config&
165 165 QPDFJob::Config::externalizeInlineImages()
166 166 {
167   - o.externalize_inline_images = true;
  167 + o.m->externalize_inline_images = true;
168 168 return *this;
169 169 }
170 170  
171 171 QPDFJob::Config&
172 172 QPDFJob::Config::filteredStreamData()
173 173 {
174   - o.show_filtered_stream_data = true;
  174 + o.m->show_filtered_stream_data = true;
175 175 return *this;
176 176 }
177 177  
178 178 QPDFJob::Config&
179 179 QPDFJob::Config::flattenAnnotations(char const* parameter)
180 180 {
181   - o.flatten_annotations = true;
  181 + o.m->flatten_annotations = true;
182 182 if (strcmp(parameter, "screen") == 0)
183 183 {
184   - o.flatten_annotations_forbidden |= an_no_view;
  184 + o.m->flatten_annotations_forbidden |= an_no_view;
185 185 }
186 186 else if (strcmp(parameter, "print") == 0)
187 187 {
188   - o.flatten_annotations_required |= an_print;
  188 + o.m->flatten_annotations_required |= an_print;
189 189 }
190 190 return *this;
191 191 }
... ... @@ -193,145 +193,145 @@ QPDFJob::Config::flattenAnnotations(char const* parameter)
193 193 QPDFJob::Config&
194 194 QPDFJob::Config::flattenRotation()
195 195 {
196   - o.flatten_rotation = true;
  196 + o.m->flatten_rotation = true;
197 197 return *this;
198 198 }
199 199  
200 200 QPDFJob::Config&
201 201 QPDFJob::Config::forceVersion(char const* parameter)
202 202 {
203   - o.force_version = parameter;
  203 + o.m->force_version = parameter;
204 204 return *this;
205 205 }
206 206  
207 207 QPDFJob::Config&
208 208 QPDFJob::Config::generateAppearances()
209 209 {
210   - o.generate_appearances = true;
  210 + o.m->generate_appearances = true;
211 211 return *this;
212 212 }
213 213  
214 214 QPDFJob::Config&
215 215 QPDFJob::Config::ignoreXrefStreams()
216 216 {
217   - o.ignore_xref_streams = true;
  217 + o.m->ignore_xref_streams = true;
218 218 return *this;
219 219 }
220 220  
221 221 QPDFJob::Config&
222 222 QPDFJob::Config::iiMinBytes(char const* parameter)
223 223 {
224   - o.ii_min_bytes = QUtil::string_to_uint(parameter);
  224 + o.m->ii_min_bytes = QUtil::string_to_uint(parameter);
225 225 return *this;
226 226 }
227 227  
228 228 QPDFJob::Config&
229 229 QPDFJob::Config::isEncrypted()
230 230 {
231   - o.check_is_encrypted = true;
232   - o.require_outfile = false;
  231 + o.m->check_is_encrypted = true;
  232 + o.m->require_outfile = false;
233 233 return *this;
234 234 }
235 235  
236 236 QPDFJob::Config&
237 237 QPDFJob::Config::json()
238 238 {
239   - o.json = true;
240   - o.require_outfile = false;
  239 + o.m->json = true;
  240 + o.m->require_outfile = false;
241 241 return *this;
242 242 }
243 243  
244 244 QPDFJob::Config&
245 245 QPDFJob::Config::jsonKey(char const* parameter)
246 246 {
247   - o.json_keys.insert(parameter);
  247 + o.m->json_keys.insert(parameter);
248 248 return *this;
249 249 }
250 250  
251 251 QPDFJob::Config&
252 252 QPDFJob::Config::jsonObject(char const* parameter)
253 253 {
254   - o.json_objects.insert(parameter);
  254 + o.m->json_objects.insert(parameter);
255 255 return *this;
256 256 }
257 257  
258 258 QPDFJob::Config&
259 259 QPDFJob::Config::keepFilesOpen(char const* parameter)
260 260 {
261   - o.keep_files_open_set = true;
262   - o.keep_files_open = (strcmp(parameter, "y") == 0);
  261 + o.m->keep_files_open_set = true;
  262 + o.m->keep_files_open = (strcmp(parameter, "y") == 0);
263 263 return *this;
264 264 }
265 265  
266 266 QPDFJob::Config&
267 267 QPDFJob::Config::keepFilesOpenThreshold(char const* parameter)
268 268 {
269   - o.keep_files_open_threshold = QUtil::string_to_uint(parameter);
  269 + o.m->keep_files_open_threshold = QUtil::string_to_uint(parameter);
270 270 return *this;
271 271 }
272 272  
273 273 QPDFJob::Config&
274 274 QPDFJob::Config::keepInlineImages()
275 275 {
276   - o.keep_inline_images = true;
  276 + o.m->keep_inline_images = true;
277 277 return *this;
278 278 }
279 279  
280 280 QPDFJob::Config&
281 281 QPDFJob::Config::linearize()
282 282 {
283   - o.linearize = true;
  283 + o.m->linearize = true;
284 284 return *this;
285 285 }
286 286  
287 287 QPDFJob::Config&
288 288 QPDFJob::Config::linearizePass1(char const* parameter)
289 289 {
290   - o.linearize_pass1 = parameter;
  290 + o.m->linearize_pass1 = parameter;
291 291 return *this;
292 292 }
293 293  
294 294 QPDFJob::Config&
295 295 QPDFJob::Config::listAttachments()
296 296 {
297   - o.list_attachments = true;
298   - o.require_outfile = false;
  297 + o.m->list_attachments = true;
  298 + o.m->require_outfile = false;
299 299 return *this;
300 300 }
301 301  
302 302 QPDFJob::Config&
303 303 QPDFJob::Config::minVersion(char const* parameter)
304 304 {
305   - o.min_version = parameter;
  305 + o.m->min_version = parameter;
306 306 return *this;
307 307 }
308 308  
309 309 QPDFJob::Config&
310 310 QPDFJob::Config::newlineBeforeEndstream()
311 311 {
312   - o.newline_before_endstream = true;
  312 + o.m->newline_before_endstream = true;
313 313 return *this;
314 314 }
315 315  
316 316 QPDFJob::Config&
317 317 QPDFJob::Config::noOriginalObjectIds()
318 318 {
319   - o.suppress_original_object_id = true;
  319 + o.m->suppress_original_object_id = true;
320 320 return *this;
321 321 }
322 322  
323 323 QPDFJob::Config&
324 324 QPDFJob::Config::noWarn()
325 325 {
326   - o.suppress_warnings = true;
  326 + o.m->suppress_warnings = true;
327 327 return *this;
328 328 }
329 329  
330 330 QPDFJob::Config&
331 331 QPDFJob::Config::normalizeContent(char const* parameter)
332 332 {
333   - o.normalize_set = true;
334   - o.normalize = (strcmp(parameter, "y") == 0);
  333 + o.m->normalize_set = true;
  334 + o.m->normalize = (strcmp(parameter, "y") == 0);
335 335 return *this;
336 336 }
337 337  
... ... @@ -359,141 +359,141 @@ QPDFJob::Config::oiMinWidth(char const* parameter)
359 359 QPDFJob::Config&
360 360 QPDFJob::Config::optimizeImages()
361 361 {
362   - o.optimize_images = true;
  362 + o.m->optimize_images = true;
363 363 return *this;
364 364 }
365 365  
366 366 QPDFJob::Config&
367 367 QPDFJob::Config::password(char const* parameter)
368 368 {
369   - o.password = QUtil::make_shared_cstr(parameter);
  369 + o.m->password = QUtil::make_shared_cstr(parameter);
370 370 return *this;
371 371 }
372 372  
373 373 QPDFJob::Config&
374 374 QPDFJob::Config::passwordIsHexKey()
375 375 {
376   - o.password_is_hex_key = true;
  376 + o.m->password_is_hex_key = true;
377 377 return *this;
378 378 }
379 379  
380 380 QPDFJob::Config&
381 381 QPDFJob::Config::preserveUnreferenced()
382 382 {
383   - o.preserve_unreferenced_objects = true;
  383 + o.m->preserve_unreferenced_objects = true;
384 384 return *this;
385 385 }
386 386  
387 387 QPDFJob::Config&
388 388 QPDFJob::Config::preserveUnreferencedResources()
389 389 {
390   - o.remove_unreferenced_page_resources = QPDFJob::re_no;
  390 + o.m->remove_unreferenced_page_resources = QPDFJob::re_no;
391 391 return *this;
392 392 }
393 393  
394 394 QPDFJob::Config&
395 395 QPDFJob::Config::progress()
396 396 {
397   - o.progress = true;
  397 + o.m->progress = true;
398 398 return *this;
399 399 }
400 400  
401 401 QPDFJob::Config&
402 402 QPDFJob::Config::qdf()
403 403 {
404   - o.qdf_mode = true;
  404 + o.m->qdf_mode = true;
405 405 return *this;
406 406 }
407 407  
408 408 QPDFJob::Config&
409 409 QPDFJob::Config::rawStreamData()
410 410 {
411   - o.show_raw_stream_data = true;
  411 + o.m->show_raw_stream_data = true;
412 412 return *this;
413 413 }
414 414  
415 415 QPDFJob::Config&
416 416 QPDFJob::Config::recompressFlate()
417 417 {
418   - o.recompress_flate_set = true;
419   - o.recompress_flate = true;
  418 + o.m->recompress_flate_set = true;
  419 + o.m->recompress_flate = true;
420 420 return *this;
421 421 }
422 422  
423 423 QPDFJob::Config&
424 424 QPDFJob::Config::removeAttachment(char const* parameter)
425 425 {
426   - o.attachments_to_remove.push_back(parameter);
  426 + o.m->attachments_to_remove.push_back(parameter);
427 427 return *this;
428 428 }
429 429  
430 430 QPDFJob::Config&
431 431 QPDFJob::Config::removePageLabels()
432 432 {
433   - o.remove_page_labels = true;
  433 + o.m->remove_page_labels = true;
434 434 return *this;
435 435 }
436 436  
437 437 QPDFJob::Config&
438 438 QPDFJob::Config::requiresPassword()
439 439 {
440   - o.check_requires_password = true;
441   - o.require_outfile = false;
  440 + o.m->check_requires_password = true;
  441 + o.m->require_outfile = false;
442 442 return *this;
443 443 }
444 444  
445 445 QPDFJob::Config&
446 446 QPDFJob::Config::showAttachment(char const* parameter)
447 447 {
448   - o.attachment_to_show = parameter;
449   - o.require_outfile = false;
  448 + o.m->attachment_to_show = parameter;
  449 + o.m->require_outfile = false;
450 450 return *this;
451 451 }
452 452  
453 453 QPDFJob::Config&
454 454 QPDFJob::Config::showEncryption()
455 455 {
456   - o.show_encryption = true;
457   - o.require_outfile = false;
  456 + o.m->show_encryption = true;
  457 + o.m->require_outfile = false;
458 458 return *this;
459 459 }
460 460  
461 461 QPDFJob::Config&
462 462 QPDFJob::Config::showEncryptionKey()
463 463 {
464   - o.show_encryption_key = true;
  464 + o.m->show_encryption_key = true;
465 465 return *this;
466 466 }
467 467  
468 468 QPDFJob::Config&
469 469 QPDFJob::Config::showLinearization()
470 470 {
471   - o.show_linearization = true;
472   - o.require_outfile = false;
  471 + o.m->show_linearization = true;
  472 + o.m->require_outfile = false;
473 473 return *this;
474 474 }
475 475  
476 476 QPDFJob::Config&
477 477 QPDFJob::Config::showNpages()
478 478 {
479   - o.show_npages = true;
480   - o.require_outfile = false;
  479 + o.m->show_npages = true;
  480 + o.m->require_outfile = false;
481 481 return *this;
482 482 }
483 483  
484 484 QPDFJob::Config&
485 485 QPDFJob::Config::showPages()
486 486 {
487   - o.show_pages = true;
488   - o.require_outfile = false;
  487 + o.m->show_pages = true;
  488 + o.m->require_outfile = false;
489 489 return *this;
490 490 }
491 491  
492 492 QPDFJob::Config&
493 493 QPDFJob::Config::showXref()
494 494 {
495   - o.show_xref = true;
496   - o.require_outfile = false;
  495 + o.m->show_xref = true;
  496 + o.m->require_outfile = false;
497 497 return *this;
498 498 }
499 499  
... ... @@ -502,35 +502,35 @@ QPDFJob::Config::splitPages(char const* parameter)
502 502 {
503 503 int n = ((parameter == 0) ? 1 :
504 504 QUtil::string_to_int(parameter));
505   - o.split_pages = n;
  505 + o.m->split_pages = n;
506 506 return *this;
507 507 }
508 508  
509 509 QPDFJob::Config&
510 510 QPDFJob::Config::staticAesIv()
511 511 {
512   - o.static_aes_iv = true;
  512 + o.m->static_aes_iv = true;
513 513 return *this;
514 514 }
515 515  
516 516 QPDFJob::Config&
517 517 QPDFJob::Config::staticId()
518 518 {
519   - o.static_id = true;
  519 + o.m->static_id = true;
520 520 return *this;
521 521 }
522 522  
523 523 QPDFJob::Config&
524 524 QPDFJob::Config::suppressPasswordRecovery()
525 525 {
526   - o.suppress_password_recovery = true;
  526 + o.m->suppress_password_recovery = true;
527 527 return *this;
528 528 }
529 529  
530 530 QPDFJob::Config&
531 531 QPDFJob::Config::suppressRecovery()
532 532 {
533   - o.suppress_recovery = true;
  533 + o.m->suppress_recovery = true;
534 534 return *this;
535 535 }
536 536  
... ... @@ -544,14 +544,14 @@ QPDFJob::Config::verbose()
544 544 QPDFJob::Config&
545 545 QPDFJob::Config::warningExit0()
546 546 {
547   - o.warnings_exit_zero = true;
  547 + o.m->warnings_exit_zero = true;
548 548 return *this;
549 549 }
550 550  
551 551 QPDFJob::Config&
552 552 QPDFJob::Config::withImages()
553 553 {
554   - o.show_page_images = true;
  554 + o.m->show_page_images = true;
555 555 return *this;
556 556 }
557 557  
... ... @@ -571,7 +571,7 @@ QPDFJob::Config::passwordFile(char const* parameter)
571 571 }
572 572 if (lines.size() >= 1)
573 573 {
574   - o.password = QUtil::make_shared_cstr(lines.front());
  574 + o.m->password = QUtil::make_shared_cstr(lines.front());
575 575  
576 576 if (lines.size() > 1)
577 577 {
... ... @@ -588,19 +588,19 @@ QPDFJob::Config::passwordMode(char const* parameter)
588 588 {
589 589 if (strcmp(parameter, "bytes") == 0)
590 590 {
591   - o.password_mode = QPDFJob::pm_bytes;
  591 + o.m->password_mode = QPDFJob::pm_bytes;
592 592 }
593 593 else if (strcmp(parameter, "hex-bytes") == 0)
594 594 {
595   - o.password_mode = QPDFJob::pm_hex_bytes;
  595 + o.m->password_mode = QPDFJob::pm_hex_bytes;
596 596 }
597 597 else if (strcmp(parameter, "unicode") == 0)
598 598 {
599   - o.password_mode = QPDFJob::pm_unicode;
  599 + o.m->password_mode = QPDFJob::pm_unicode;
600 600 }
601 601 else if (strcmp(parameter, "auto") == 0)
602 602 {
603   - o.password_mode = QPDFJob::pm_auto;
  603 + o.m->password_mode = QPDFJob::pm_auto;
604 604 }
605 605 else
606 606 {
... ... @@ -612,18 +612,18 @@ QPDFJob::Config::passwordMode(char const* parameter)
612 612 QPDFJob::Config&
613 613 QPDFJob::Config::streamData(char const* parameter)
614 614 {
615   - o.stream_data_set = true;
  615 + o.m->stream_data_set = true;
616 616 if (strcmp(parameter, "compress") == 0)
617 617 {
618   - o.stream_data_mode = qpdf_s_compress;
  618 + o.m->stream_data_mode = qpdf_s_compress;
619 619 }
620 620 else if (strcmp(parameter, "preserve") == 0)
621 621 {
622   - o.stream_data_mode = qpdf_s_preserve;
  622 + o.m->stream_data_mode = qpdf_s_preserve;
623 623 }
624 624 else if (strcmp(parameter, "uncompress") == 0)
625 625 {
626   - o.stream_data_mode = qpdf_s_uncompress;
  626 + o.m->stream_data_mode = qpdf_s_uncompress;
627 627 }
628 628 else
629 629 {
... ... @@ -637,22 +637,22 @@ QPDFJob::Config::streamData(char const* parameter)
637 637 QPDFJob::Config&
638 638 QPDFJob::Config::decodeLevel(char const* parameter)
639 639 {
640   - o.decode_level_set = true;
  640 + o.m->decode_level_set = true;
641 641 if (strcmp(parameter, "none") == 0)
642 642 {
643   - o.decode_level = qpdf_dl_none;
  643 + o.m->decode_level = qpdf_dl_none;
644 644 }
645 645 else if (strcmp(parameter, "generalized") == 0)
646 646 {
647   - o.decode_level = qpdf_dl_generalized;
  647 + o.m->decode_level = qpdf_dl_generalized;
648 648 }
649 649 else if (strcmp(parameter, "specialized") == 0)
650 650 {
651   - o.decode_level = qpdf_dl_specialized;
  651 + o.m->decode_level = qpdf_dl_specialized;
652 652 }
653 653 else if (strcmp(parameter, "all") == 0)
654 654 {
655   - o.decode_level = qpdf_dl_all;
  655 + o.m->decode_level = qpdf_dl_all;
656 656 }
657 657 else
658 658 {
... ... @@ -666,18 +666,18 @@ QPDFJob::Config::decodeLevel(char const* parameter)
666 666 QPDFJob::Config&
667 667 QPDFJob::Config::objectStreams(char const* parameter)
668 668 {
669   - o.object_stream_set = true;
  669 + o.m->object_stream_set = true;
670 670 if (strcmp(parameter, "disable") == 0)
671 671 {
672   - o.object_stream_mode = qpdf_o_disable;
  672 + o.m->object_stream_mode = qpdf_o_disable;
673 673 }
674 674 else if (strcmp(parameter, "preserve") == 0)
675 675 {
676   - o.object_stream_mode = qpdf_o_preserve;
  676 + o.m->object_stream_mode = qpdf_o_preserve;
677 677 }
678 678 else if (strcmp(parameter, "generate") == 0)
679 679 {
680   - o.object_stream_mode = qpdf_o_generate;
  680 + o.m->object_stream_mode = qpdf_o_generate;
681 681 }
682 682 else
683 683 {
... ... @@ -693,15 +693,15 @@ QPDFJob::Config::removeUnreferencedResources(char const* parameter)
693 693 {
694 694 if (strcmp(parameter, "auto") == 0)
695 695 {
696   - o.remove_unreferenced_page_resources = QPDFJob::re_auto;
  696 + o.m->remove_unreferenced_page_resources = QPDFJob::re_auto;
697 697 }
698 698 else if (strcmp(parameter, "yes") == 0)
699 699 {
700   - o.remove_unreferenced_page_resources = QPDFJob::re_yes;
  700 + o.m->remove_unreferenced_page_resources = QPDFJob::re_yes;
701 701 }
702 702 else if (strcmp(parameter, "no") == 0)
703 703 {
704   - o.remove_unreferenced_page_resources = QPDFJob::re_no;
  704 + o.m->remove_unreferenced_page_resources = QPDFJob::re_no;
705 705 }
706 706 else
707 707 {
... ... @@ -715,8 +715,9 @@ QPDFJob::Config::removeUnreferencedResources(char const* parameter)
715 715 QPDFJob::Config&
716 716 QPDFJob::Config::showObject(char const* parameter)
717 717 {
718   - QPDFJob::parse_object_id(parameter, o.show_trailer, o.show_obj, o.show_gen);
719   - o.require_outfile = false;
  718 + QPDFJob::parse_object_id(
  719 + parameter, o.m->show_trailer, o.m->show_obj, o.m->show_gen);
  720 + o.m->require_outfile = false;
720 721 return *this;
721 722 }
722 723  
... ... @@ -786,7 +787,7 @@ QPDFJob::CopyAttConfig::end()
786 787 {
787 788 usage("copy attachments: no path specified");
788 789 }
789   - this->config.o.attachments_to_copy.push_back(this->caf);
  790 + this->config.o.m->attachments_to_copy.push_back(this->caf);
790 791 return this->config;
791 792 }
792 793  
... ... @@ -900,7 +901,7 @@ QPDFJob::AttConfig::end()
900 901 this->att.moddate = now;
901 902 }
902 903  
903   - this->config.o.attachments_to_add.push_back(this->att);
  904 + this->config.o.m->attachments_to_add.push_back(this->att);
904 905 return this->config;
905 906 }
906 907  
... ... @@ -912,7 +913,7 @@ QPDFJob::PagesConfig::PagesConfig(Config&amp; c) :
912 913 std::shared_ptr<QPDFJob::PagesConfig>
913 914 QPDFJob::Config::pages()
914 915 {
915   - if (! o.page_specs.empty())
  916 + if (! o.m->page_specs.empty())
916 917 {
917 918 usage("--pages may only be specified one time");
918 919 }
... ... @@ -922,7 +923,7 @@ QPDFJob::Config::pages()
922 923 QPDFJob::Config&
923 924 QPDFJob::PagesConfig::end()
924 925 {
925   - if (this->config.o.page_specs.empty())
  926 + if (this->config.o.m->page_specs.empty())
926 927 {
927 928 usage("--pages: no page specifications given");
928 929 }
... ... @@ -934,7 +935,7 @@ QPDFJob::PagesConfig::pageSpec(std::string const&amp; filename,
934 935 char const* password,
935 936 std::string const& range)
936 937 {
937   - this->config.o.page_specs.push_back(
  938 + this->config.o.m->page_specs.push_back(
938 939 QPDFJob::PageSpec(filename, password, range));
939 940 return *this;
940 941 }
... ... @@ -942,14 +943,14 @@ QPDFJob::PagesConfig::pageSpec(std::string const&amp; filename,
942 943 std::shared_ptr<QPDFJob::UOConfig>
943 944 QPDFJob::Config::overlay()
944 945 {
945   - o.under_overlay = &o.overlay;
  946 + o.m->under_overlay = &o.m->overlay;
946 947 return std::shared_ptr<UOConfig>(new UOConfig(*this));
947 948 }
948 949  
949 950 std::shared_ptr<QPDFJob::UOConfig>
950 951 QPDFJob::Config::underlay()
951 952 {
952   - o.under_overlay = &o.underlay;
  953 + o.m->under_overlay = &o.m->underlay;
953 954 return std::shared_ptr<UOConfig>(new UOConfig(*this));
954 955 }
955 956  
... ... @@ -961,24 +962,24 @@ QPDFJob::UOConfig::UOConfig(Config&amp; c) :
961 962 QPDFJob::Config&
962 963 QPDFJob::UOConfig::end()
963 964 {
964   - if (config.o.under_overlay->filename.empty())
  965 + if (config.o.m->under_overlay->filename.empty())
965 966 {
966   - usage(config.o.under_overlay->which + " file not specified");
  967 + usage(config.o.m->under_overlay->which + " file not specified");
967 968 }
968   - config.o.under_overlay = 0;
  969 + config.o.m->under_overlay = 0;
969 970 return this->config;
970 971 }
971 972  
972 973 QPDFJob::UOConfig&
973 974 QPDFJob::UOConfig::path(char const* parameter)
974 975 {
975   - if (! config.o.under_overlay->filename.empty())
  976 + if (! config.o.m->under_overlay->filename.empty())
976 977 {
977   - usage(config.o.under_overlay->which + " file already specified");
  978 + usage(config.o.m->under_overlay->which + " file already specified");
978 979 }
979 980 else
980 981 {
981   - config.o.under_overlay->filename = parameter;
  982 + config.o.m->under_overlay->filename = parameter;
982 983 }
983 984 return *this;
984 985 }
... ... @@ -987,7 +988,7 @@ QPDFJob::UOConfig&amp;
987 988 QPDFJob::UOConfig::to(char const* parameter)
988 989 {
989 990 config.o.parseNumrange(parameter, 0);
990   - config.o.under_overlay->to_nr = parameter;
  991 + config.o.m->under_overlay->to_nr = parameter;
991 992 return *this;
992 993 }
993 994  
... ... @@ -998,7 +999,7 @@ QPDFJob::UOConfig::from(char const* parameter)
998 999 {
999 1000 config.o.parseNumrange(parameter, 0);
1000 1001 }
1001   - config.o.under_overlay->from_nr = parameter;
  1002 + config.o.m->under_overlay->from_nr = parameter;
1002 1003 return *this;
1003 1004 }
1004 1005  
... ... @@ -1009,14 +1010,14 @@ QPDFJob::UOConfig::repeat(char const* parameter)
1009 1010 {
1010 1011 config.o.parseNumrange(parameter, 0);
1011 1012 }
1012   - config.o.under_overlay->repeat_nr = parameter;
  1013 + config.o.m->under_overlay->repeat_nr = parameter;
1013 1014 return *this;
1014 1015 }
1015 1016  
1016 1017 QPDFJob::UOConfig&
1017 1018 QPDFJob::UOConfig::password(char const* parameter)
1018 1019 {
1019   - config.o.under_overlay->password = QUtil::make_shared_cstr(parameter);
  1020 + config.o.m->under_overlay->password = QUtil::make_shared_cstr(parameter);
1020 1021 return *this;
1021 1022 }
1022 1023  
... ... @@ -1025,13 +1026,13 @@ QPDFJob::Config::encrypt(int keylen,
1025 1026 std::string const& user_password,
1026 1027 std::string const& owner_password)
1027 1028 {
1028   - o.keylen = keylen;
  1029 + o.m->keylen = keylen;
1029 1030 if (keylen == 256)
1030 1031 {
1031   - o.use_aes = true;
  1032 + o.m->use_aes = true;
1032 1033 }
1033   - o.user_password = user_password;
1034   - o.owner_password = owner_password;
  1034 + o.m->user_password = user_password;
  1035 + o.m->owner_password = owner_password;
1035 1036 return std::shared_ptr<EncConfig>(new EncConfig(*this));
1036 1037 }
1037 1038  
... ... @@ -1043,36 +1044,36 @@ QPDFJob::EncConfig::EncConfig(Config&amp; c) :
1043 1044 QPDFJob::Config&
1044 1045 QPDFJob::EncConfig::end()
1045 1046 {
1046   - config.o.encrypt = true;
1047   - config.o.decrypt = false;
1048   - config.o.copy_encryption = false;
  1047 + config.o.m->encrypt = true;
  1048 + config.o.m->decrypt = false;
  1049 + config.o.m->copy_encryption = false;
1049 1050 return this->config;
1050 1051 }
1051 1052  
1052 1053 QPDFJob::EncConfig&
1053 1054 QPDFJob::EncConfig::allowInsecure()
1054 1055 {
1055   - config.o.allow_insecure = true;
  1056 + config.o.m->allow_insecure = true;
1056 1057 return *this;
1057 1058 }
1058 1059  
1059 1060 QPDFJob::EncConfig&
1060 1061 QPDFJob::EncConfig::accessibility(char const* parameter)
1061 1062 {
1062   - config.o.r3_accessibility = (strcmp(parameter, "y") == 0);
  1063 + config.o.m->r3_accessibility = (strcmp(parameter, "y") == 0);
1063 1064 return *this;
1064 1065 }
1065 1066  
1066 1067 QPDFJob::EncConfig&
1067 1068 QPDFJob::EncConfig::extract(char const* parameter)
1068 1069 {
1069   - if (config.o.keylen == 40)
  1070 + if (config.o.m->keylen == 40)
1070 1071 {
1071   - config.o.r2_extract = (strcmp(parameter, "y") == 0);
  1072 + config.o.m->r2_extract = (strcmp(parameter, "y") == 0);
1072 1073 }
1073 1074 else
1074 1075 {
1075   - config.o.r3_extract = (strcmp(parameter, "y") == 0);
  1076 + config.o.m->r3_extract = (strcmp(parameter, "y") == 0);
1076 1077 }
1077 1078 return *this;
1078 1079 }
... ... @@ -1080,21 +1081,21 @@ QPDFJob::EncConfig::extract(char const* parameter)
1080 1081 QPDFJob::EncConfig&
1081 1082 QPDFJob::EncConfig::print(char const* parameter)
1082 1083 {
1083   - if (config.o.keylen == 40)
  1084 + if (config.o.m->keylen == 40)
1084 1085 {
1085   - config.o.r2_print = (strcmp(parameter, "y") == 0);
  1086 + config.o.m->r2_print = (strcmp(parameter, "y") == 0);
1086 1087 }
1087 1088 else if (strcmp(parameter, "full") == 0)
1088 1089 {
1089   - config.o.r3_print = qpdf_r3p_full;
  1090 + config.o.m->r3_print = qpdf_r3p_full;
1090 1091 }
1091 1092 else if (strcmp(parameter, "low") == 0)
1092 1093 {
1093   - config.o.r3_print = qpdf_r3p_low;
  1094 + config.o.m->r3_print = qpdf_r3p_low;
1094 1095 }
1095 1096 else if (strcmp(parameter, "none") == 0)
1096 1097 {
1097   - config.o.r3_print = qpdf_r3p_none;
  1098 + config.o.m->r3_print = qpdf_r3p_none;
1098 1099 }
1099 1100 else
1100 1101 {
... ... @@ -1106,44 +1107,44 @@ QPDFJob::EncConfig::print(char const* parameter)
1106 1107 QPDFJob::EncConfig&
1107 1108 QPDFJob::EncConfig::modify(char const* parameter)
1108 1109 {
1109   - if (config.o.keylen == 40)
  1110 + if (config.o.m->keylen == 40)
1110 1111 {
1111   - config.o.r2_modify = (strcmp(parameter, "y") == 0);
  1112 + config.o.m->r2_modify = (strcmp(parameter, "y") == 0);
1112 1113 }
1113 1114 else if (strcmp(parameter, "all") == 0)
1114 1115 {
1115   - config.o.r3_assemble = true;
1116   - config.o.r3_annotate_and_form = true;
1117   - config.o.r3_form_filling = true;
1118   - config.o.r3_modify_other = true;
  1116 + config.o.m->r3_assemble = true;
  1117 + config.o.m->r3_annotate_and_form = true;
  1118 + config.o.m->r3_form_filling = true;
  1119 + config.o.m->r3_modify_other = true;
1119 1120 }
1120 1121 else if (strcmp(parameter, "annotate") == 0)
1121 1122 {
1122   - config.o.r3_assemble = true;
1123   - config.o.r3_annotate_and_form = true;
1124   - config.o.r3_form_filling = true;
1125   - config.o.r3_modify_other = false;
  1123 + config.o.m->r3_assemble = true;
  1124 + config.o.m->r3_annotate_and_form = true;
  1125 + config.o.m->r3_form_filling = true;
  1126 + config.o.m->r3_modify_other = false;
1126 1127 }
1127 1128 else if (strcmp(parameter, "form") == 0)
1128 1129 {
1129   - config.o.r3_assemble = true;
1130   - config.o.r3_annotate_and_form = false;
1131   - config.o.r3_form_filling = true;
1132   - config.o.r3_modify_other = false;
  1130 + config.o.m->r3_assemble = true;
  1131 + config.o.m->r3_annotate_and_form = false;
  1132 + config.o.m->r3_form_filling = true;
  1133 + config.o.m->r3_modify_other = false;
1133 1134 }
1134 1135 else if (strcmp(parameter, "assembly") == 0)
1135 1136 {
1136   - config.o.r3_assemble = true;
1137   - config.o.r3_annotate_and_form = false;
1138   - config.o.r3_form_filling = false;
1139   - config.o.r3_modify_other = false;
  1137 + config.o.m->r3_assemble = true;
  1138 + config.o.m->r3_annotate_and_form = false;
  1139 + config.o.m->r3_form_filling = false;
  1140 + config.o.m->r3_modify_other = false;
1140 1141 }
1141 1142 else if (strcmp(parameter, "none") == 0)
1142 1143 {
1143   - config.o.r3_assemble = false;
1144   - config.o.r3_annotate_and_form = false;
1145   - config.o.r3_form_filling = false;
1146   - config.o.r3_modify_other = false;
  1144 + config.o.m->r3_assemble = false;
  1145 + config.o.m->r3_annotate_and_form = false;
  1146 + config.o.m->r3_form_filling = false;
  1147 + config.o.m->r3_modify_other = false;
1147 1148 }
1148 1149 else
1149 1150 {
... ... @@ -1155,27 +1156,27 @@ QPDFJob::EncConfig::modify(char const* parameter)
1155 1156 QPDFJob::EncConfig&
1156 1157 QPDFJob::EncConfig::cleartextMetadata()
1157 1158 {
1158   - config.o.cleartext_metadata = true;
  1159 + config.o.m->cleartext_metadata = true;
1159 1160 return *this;
1160 1161 }
1161 1162  
1162 1163 QPDFJob::EncConfig&
1163 1164 QPDFJob::EncConfig::assemble(char const* parameter)
1164 1165 {
1165   - config.o.r3_assemble = (strcmp(parameter, "y") == 0);
  1166 + config.o.m->r3_assemble = (strcmp(parameter, "y") == 0);
1166 1167 return *this;
1167 1168 }
1168 1169  
1169 1170 QPDFJob::EncConfig&
1170 1171 QPDFJob::EncConfig::annotate(char const* parameter)
1171 1172 {
1172   - if (config.o.keylen == 40)
  1173 + if (config.o.m->keylen == 40)
1173 1174 {
1174   - config.o.r2_annotate = (strcmp(parameter, "y") == 0);
  1175 + config.o.m->r2_annotate = (strcmp(parameter, "y") == 0);
1175 1176 }
1176 1177 else
1177 1178 {
1178   - config.o.r3_annotate_and_form = (strcmp(parameter, "y") == 0);
  1179 + config.o.m->r3_annotate_and_form = (strcmp(parameter, "y") == 0);
1179 1180 }
1180 1181 return *this;
1181 1182 }
... ... @@ -1183,34 +1184,34 @@ QPDFJob::EncConfig::annotate(char const* parameter)
1183 1184 QPDFJob::EncConfig&
1184 1185 QPDFJob::EncConfig::form(char const* parameter)
1185 1186 {
1186   - config.o.r3_form_filling = (strcmp(parameter, "y") == 0);
  1187 + config.o.m->r3_form_filling = (strcmp(parameter, "y") == 0);
1187 1188 return *this;
1188 1189 }
1189 1190  
1190 1191 QPDFJob::EncConfig&
1191 1192 QPDFJob::EncConfig::modifyOther(char const* parameter)
1192 1193 {
1193   - config.o.r3_modify_other = (strcmp(parameter, "y") == 0);
  1194 + config.o.m->r3_modify_other = (strcmp(parameter, "y") == 0);
1194 1195 return *this;
1195 1196 }
1196 1197  
1197 1198 QPDFJob::EncConfig&
1198 1199 QPDFJob::EncConfig::useAes(char const* parameter)
1199 1200 {
1200   - config.o.use_aes = (strcmp(parameter, "y") == 0);
  1201 + config.o.m->use_aes = (strcmp(parameter, "y") == 0);
1201 1202 return *this;
1202 1203 }
1203 1204  
1204 1205 QPDFJob::EncConfig&
1205 1206 QPDFJob::EncConfig::forceV4()
1206 1207 {
1207   - config.o.force_V4 = true;
  1208 + config.o.m->force_V4 = true;
1208 1209 return *this;
1209 1210 }
1210 1211  
1211 1212 QPDFJob::EncConfig&
1212 1213 QPDFJob::EncConfig::forceR5()
1213 1214 {
1214   - config.o.force_R5 = true;
  1215 + config.o.m->force_R5 = true;
1215 1216 return *this;
1216 1217 }
... ...