Commit 03e67a28fed49594c4f20718ce17d4852b40c83d

Authored by Jay Berkenbilt
1 parent b42f3e1d

Move QTC::TC for qpdf to QPDFJob

All the coverage cases that used to be in qpdf.cc are now in
QPDFJob*.cc. It doesn't really matter, but better to follow the
convention of starting with the class that includes the coverage call.
libqpdf/QPDFJob.cc
@@ -141,7 +141,7 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next) @@ -141,7 +141,7 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next)
141 QPDFObjectHandle components_obj = dict.getKey("/BitsPerComponent"); 141 QPDFObjectHandle components_obj = dict.getKey("/BitsPerComponent");
142 if (! (components_obj.isInteger() && (components_obj.getIntValue() == 8))) 142 if (! (components_obj.isInteger() && (components_obj.getIntValue() == 8)))
143 { 143 {
144 - QTC::TC("qpdf", "qpdf image optimize bits per component"); 144 + QTC::TC("qpdf", "QPDFJob image optimize bits per component");
145 if (! description.empty()) 145 if (! description.empty())
146 { 146 {
147 o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) { 147 o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
@@ -194,7 +194,7 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next) @@ -194,7 +194,7 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next)
194 } 194 }
195 else 195 else
196 { 196 {
197 - QTC::TC("qpdf", "qpdf image optimize colorspace"); 197 + QTC::TC("qpdf", "QPDFJob image optimize colorspace");
198 if (! description.empty()) 198 if (! description.empty())
199 { 199 {
200 o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) { 200 o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
@@ -209,7 +209,7 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next) @@ -209,7 +209,7 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next)
209 ((this->oi_min_height > 0) && (h <= this->oi_min_height)) || 209 ((this->oi_min_height > 0) && (h <= this->oi_min_height)) ||
210 ((this->oi_min_area > 0) && ((w * h) <= this->oi_min_area))) 210 ((this->oi_min_area > 0) && ((w * h) <= this->oi_min_area)))
211 { 211 {
212 - QTC::TC("qpdf", "qpdf image optimize too small"); 212 + QTC::TC("qpdf", "QPDFJob image optimize too small");
213 if (! description.empty()) 213 if (! description.empty())
214 { 214 {
215 o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) { 215 o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
@@ -231,7 +231,7 @@ ImageOptimizer::evaluate(std::string const&amp; description) @@ -231,7 +231,7 @@ ImageOptimizer::evaluate(std::string const&amp; description)
231 { 231 {
232 if (! image.pipeStreamData(0, 0, qpdf_dl_specialized, true)) 232 if (! image.pipeStreamData(0, 0, qpdf_dl_specialized, true))
233 { 233 {
234 - QTC::TC("qpdf", "qpdf image optimize no pipeline"); 234 + QTC::TC("qpdf", "QPDFJob image optimize no pipeline");
235 o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) { 235 o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
236 cout << prefix << ": " << description 236 cout << prefix << ": " << description
237 << ": not optimizing because unable to decode data" 237 << ": not optimizing because unable to decode data"
@@ -255,7 +255,7 @@ ImageOptimizer::evaluate(std::string const&amp; description) @@ -255,7 +255,7 @@ ImageOptimizer::evaluate(std::string const&amp; description)
255 long long orig_length = image.getDict().getKey("/Length").getIntValue(); 255 long long orig_length = image.getDict().getKey("/Length").getIntValue();
256 if (c.getCount() >= orig_length) 256 if (c.getCount() >= orig_length)
257 { 257 {
258 - QTC::TC("qpdf", "qpdf image optimize no shrink"); 258 + QTC::TC("qpdf", "QPDFJob image optimize no shrink");
259 o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) { 259 o.doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
260 cout << prefix << ": " << description 260 cout << prefix << ": " << description
261 << ": not optimizing because DCT compression does not" 261 << ": not optimizing because DCT compression does not"
@@ -668,12 +668,12 @@ QPDFJob::getExitCode() const @@ -668,12 +668,12 @@ QPDFJob::getExitCode() const
668 { 668 {
669 if (this->m->encryption_status & qpdf_es_encrypted) 669 if (this->m->encryption_status & qpdf_es_encrypted)
670 { 670 {
671 - QTC::TC("qpdf", "qpdf check encrypted encrypted"); 671 + QTC::TC("qpdf", "QPDFJob check encrypted encrypted");
672 return 0; 672 return 0;
673 } 673 }
674 else 674 else
675 { 675 {
676 - QTC::TC("qpdf", "qpdf check encrypted not encrypted"); 676 + QTC::TC("qpdf", "QPDFJob check encrypted not encrypted");
677 return EXIT_IS_NOT_ENCRYPTED; 677 return EXIT_IS_NOT_ENCRYPTED;
678 } 678 }
679 } 679 }
@@ -683,18 +683,18 @@ QPDFJob::getExitCode() const @@ -683,18 +683,18 @@ QPDFJob::getExitCode() const
683 { 683 {
684 if (this->m->encryption_status & qpdf_es_password_incorrect) 684 if (this->m->encryption_status & qpdf_es_password_incorrect)
685 { 685 {
686 - QTC::TC("qpdf", "qpdf check password password incorrect"); 686 + QTC::TC("qpdf", "QPDFJob check password password incorrect");
687 return 0; 687 return 0;
688 } 688 }
689 else 689 else
690 { 690 {
691 - QTC::TC("qpdf", "qpdf check password password correct"); 691 + QTC::TC("qpdf", "QPDFJob check password password correct");
692 return EXIT_CORRECT_PASSWORD; 692 return EXIT_CORRECT_PASSWORD;
693 } 693 }
694 } 694 }
695 else 695 else
696 { 696 {
697 - QTC::TC("qpdf", "qpdf check password not encrypted"); 697 + QTC::TC("qpdf", "QPDFJob check password not encrypted");
698 return EXIT_IS_NOT_ENCRYPTED; 698 return EXIT_IS_NOT_ENCRYPTED;
699 } 699 }
700 } 700 }
@@ -782,7 +782,7 @@ QPDFJob::checkConfiguration() @@ -782,7 +782,7 @@ QPDFJob::checkConfiguration()
782 if ((! m->split_pages) && 782 if ((! m->split_pages) &&
783 QUtil::same_file(m->infilename.get(), m->outfilename.get())) 783 QUtil::same_file(m->infilename.get(), m->outfilename.get()))
784 { 784 {
785 - QTC::TC("qpdf", "qpdf same file error"); 785 + QTC::TC("qpdf", "QPDFJob same file error");
786 usage("input file and output file are the same;" 786 usage("input file and output file are the same;"
787 " use --replace-input to intentionally" 787 " use --replace-input to intentionally"
788 " overwrite the input file"); 788 " overwrite the input file");
@@ -1028,7 +1028,7 @@ QPDFJob::doShowObj(QPDF&amp; pdf) @@ -1028,7 +1028,7 @@ QPDFJob::doShowObj(QPDF&amp; pdf)
1028 if (filter && 1028 if (filter &&
1029 (! obj.pipeStreamData(0, 0, qpdf_dl_all))) 1029 (! obj.pipeStreamData(0, 0, qpdf_dl_all)))
1030 { 1030 {
1031 - QTC::TC("qpdf", "qpdf unable to filter"); 1031 + QTC::TC("qpdf", "QPDFJob unable to filter");
1032 obj.warnIfPossible("unable to filter stream data"); 1032 obj.warnIfPossible("unable to filter stream data");
1033 error = true; 1033 error = true;
1034 } 1034 }
@@ -1969,7 +1969,7 @@ QPDFJob::doInspection(QPDF&amp; pdf) @@ -1969,7 +1969,7 @@ QPDFJob::doInspection(QPDF&amp; pdf)
1969 } 1969 }
1970 if (m->show_npages) 1970 if (m->show_npages)
1971 { 1971 {
1972 - QTC::TC("qpdf", "qpdf npages"); 1972 + QTC::TC("qpdf", "QPDFJob npages");
1973 *(this->m->cout) << pdf.getRoot().getKey("/Pages"). 1973 *(this->m->cout) << pdf.getRoot().getKey("/Pages").
1974 getKey("/Count").getIntValue() << std::endl; 1974 getKey("/Count").getIntValue() << std::endl;
1975 } 1975 }
@@ -2067,7 +2067,7 @@ QPDFJob::doProcess( @@ -2067,7 +2067,7 @@ QPDFJob::doProcess(
2067 { 2067 {
2068 // Special case: handle --password-mode=hex-bytes for input 2068 // Special case: handle --password-mode=hex-bytes for input
2069 // password as well as output password 2069 // password as well as output password
2070 - QTC::TC("qpdf", "qpdf input password hex-bytes"); 2070 + QTC::TC("qpdf", "QPDFJob input password hex-bytes");
2071 ptemp = QUtil::hex_decode(password); 2071 ptemp = QUtil::hex_decode(password);
2072 password = ptemp.c_str(); 2072 password = ptemp.c_str();
2073 } 2073 }
@@ -2182,7 +2182,7 @@ QPDFJob::validateUnderOverlay(QPDF&amp; pdf, UnderOverlay* uo) @@ -2182,7 +2182,7 @@ QPDFJob::validateUnderOverlay(QPDF&amp; pdf, UnderOverlay* uo)
2182 { 2182 {
2183 if (uo->from_nr.empty()) 2183 if (uo->from_nr.empty())
2184 { 2184 {
2185 - QTC::TC("qpdf", "qpdf from_nr from repeat_nr"); 2185 + QTC::TC("qpdf", "QPDFJob from_nr from repeat_nr");
2186 uo->from_nr = uo->repeat_nr; 2186 uo->from_nr = uo->repeat_nr;
2187 } 2187 }
2188 uo->from_pagenos = 2188 uo->from_pagenos =
@@ -2244,7 +2244,7 @@ QPDFJob::doUnderOverlayForPage( @@ -2244,7 +2244,7 @@ QPDFJob::doUnderOverlayForPage(
2244 QPDFObjectHandle resources = dest_page.getAttribute("/Resources", true); 2244 QPDFObjectHandle resources = dest_page.getAttribute("/Resources", true);
2245 if (! resources.isDictionary()) 2245 if (! resources.isDictionary())
2246 { 2246 {
2247 - QTC::TC("qpdf", "qpdf overlay page with no resources"); 2247 + QTC::TC("qpdf", "QPDFJob overlay page with no resources");
2248 resources = QPDFObjectHandle::newDictionary(); 2248 resources = QPDFObjectHandle::newDictionary();
2249 dest_page.getObjectHandle().replaceKey("/Resources", resources); 2249 dest_page.getObjectHandle().replaceKey("/Resources", resources);
2250 } 2250 }
@@ -2668,7 +2668,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf) @@ -2668,7 +2668,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf)
2668 // This is a non-leaf node. 2668 // This is a non-leaf node.
2669 if (dict.hasKey("/Resources")) 2669 if (dict.hasKey("/Resources"))
2670 { 2670 {
2671 - QTC::TC("qpdf", "qpdf found resources in non-leaf"); 2671 + QTC::TC("qpdf", "QPDFJob found resources in non-leaf");
2672 doIfVerbose([&](std::ostream& cout, 2672 doIfVerbose([&](std::ostream& cout,
2673 std::string const& prefix) { 2673 std::string const& prefix) {
2674 cout << " found resources in non-leaf page node " 2674 cout << " found resources in non-leaf page node "
@@ -2692,7 +2692,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf) @@ -2692,7 +2692,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf)
2692 QPDFObjGen resources_og = resources.getObjGen(); 2692 QPDFObjGen resources_og = resources.getObjGen();
2693 if (resources_seen.count(resources_og)) 2693 if (resources_seen.count(resources_og))
2694 { 2694 {
2695 - QTC::TC("qpdf", "qpdf found shared resources in leaf"); 2695 + QTC::TC("qpdf", "QPDFJob found shared resources in leaf");
2696 doIfVerbose([&](std::ostream& cout, 2696 doIfVerbose([&](std::ostream& cout,
2697 std::string const& prefix) { 2697 std::string const& prefix) {
2698 cout << " found shared resources in leaf node " 2698 cout << " found shared resources in leaf node "
@@ -2714,7 +2714,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf) @@ -2714,7 +2714,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf)
2714 QPDFObjGen xobject_og = xobject.getObjGen(); 2714 QPDFObjGen xobject_og = xobject.getObjGen();
2715 if (resources_seen.count(xobject_og)) 2715 if (resources_seen.count(xobject_og))
2716 { 2716 {
2717 - QTC::TC("qpdf", "qpdf found shared xobject in leaf"); 2717 + QTC::TC("qpdf", "QPDFJob found shared xobject in leaf");
2718 doIfVerbose([&](std::ostream& cout, 2718 doIfVerbose([&](std::ostream& cout,
2719 std::string const& prefix) { 2719 std::string const& prefix) {
2720 cout << " found shared xobject in leaf node " 2720 cout << " found shared xobject in leaf node "
@@ -2802,7 +2802,7 @@ QPDFJob::handlePageSpecs( @@ -2802,7 +2802,7 @@ QPDFJob::handlePageSpecs(
2802 filenames.insert(page_spec.filename); 2802 filenames.insert(page_spec.filename);
2803 } 2803 }
2804 m->keep_files_open = (filenames.size() <= m->keep_files_open_threshold); 2804 m->keep_files_open = (filenames.size() <= m->keep_files_open_threshold);
2805 - QTC::TC("qpdf", "qpdf automatically set keep files open", 2805 + QTC::TC("qpdf", "QPDFJob automatically set keep files open",
2806 m->keep_files_open ? 0 : 1); 2806 m->keep_files_open ? 0 : 1);
2807 doIfVerbose([&](std::ostream& cout, std::string const& prefix) { 2807 doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2808 cout << prefix << ": selecting --keep-open-files=" 2808 cout << prefix << ": selecting --keep-open-files="
@@ -2837,7 +2837,7 @@ QPDFJob::handlePageSpecs( @@ -2837,7 +2837,7 @@ QPDFJob::handlePageSpecs(
2837 if ((! m->encryption_file.empty()) && (password == 0) && 2837 if ((! m->encryption_file.empty()) && (password == 0) &&
2838 (page_spec.filename == m->encryption_file)) 2838 (page_spec.filename == m->encryption_file))
2839 { 2839 {
2840 - QTC::TC("qpdf", "qpdf pages encryption password"); 2840 + QTC::TC("qpdf", "QPDFJob pages encryption password");
2841 password = m->encryption_file_password.get(); 2841 password = m->encryption_file_password.get();
2842 } 2842 }
2843 doIfVerbose([&](std::ostream& cout, std::string const& prefix) { 2843 doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
@@ -2848,14 +2848,14 @@ QPDFJob::handlePageSpecs( @@ -2848,14 +2848,14 @@ QPDFJob::handlePageSpecs(
2848 ClosedFileInputSource* cis = 0; 2848 ClosedFileInputSource* cis = 0;
2849 if (! m->keep_files_open) 2849 if (! m->keep_files_open)
2850 { 2850 {
2851 - QTC::TC("qpdf", "qpdf keep files open n"); 2851 + QTC::TC("qpdf", "QPDFJob keep files open n");
2852 cis = new ClosedFileInputSource(page_spec.filename.c_str()); 2852 cis = new ClosedFileInputSource(page_spec.filename.c_str());
2853 is = cis; 2853 is = cis;
2854 cis->stayOpen(true); 2854 cis->stayOpen(true);
2855 } 2855 }
2856 else 2856 else
2857 { 2857 {
2858 - QTC::TC("qpdf", "qpdf keep files open y"); 2858 + QTC::TC("qpdf", "QPDFJob keep files open y");
2859 FileInputSource* fis = new FileInputSource(); 2859 FileInputSource* fis = new FileInputSource();
2860 is = fis; 2860 is = fis;
2861 fis->setFilename(page_spec.filename.c_str()); 2861 fis->setFilename(page_spec.filename.c_str());
@@ -3005,7 +3005,7 @@ QPDFJob::handlePageSpecs( @@ -3005,7 +3005,7 @@ QPDFJob::handlePageSpecs(
3005 unsigned long long from_uuid = page_data.qpdf->getUniqueId(); 3005 unsigned long long from_uuid = page_data.qpdf->getUniqueId();
3006 if (copied_pages[from_uuid].count(to_copy_og)) 3006 if (copied_pages[from_uuid].count(to_copy_og))
3007 { 3007 {
3008 - QTC::TC("qpdf", "qpdf copy same page more than once", 3008 + QTC::TC("qpdf", "QPDFJob copy same page more than once",
3009 (page_data.qpdf == &pdf) ? 0 : 1); 3009 (page_data.qpdf == &pdf) ? 0 : 1);
3010 to_copy = to_copy.shallowCopyPage(); 3010 to_copy = to_copy.shallowCopyPage();
3011 } 3011 }
@@ -3043,11 +3043,11 @@ QPDFJob::handlePageSpecs( @@ -3043,11 +3043,11 @@ QPDFJob::handlePageSpecs(
3043 { 3043 {
3044 if (! this_file) 3044 if (! this_file)
3045 { 3045 {
3046 - QTC::TC("qpdf", "qpdf copy fields not this file"); 3046 + QTC::TC("qpdf", "QPDFJob copy fields not this file");
3047 } 3047 }
3048 else if (! first_copy_from_orig) 3048 else if (! first_copy_from_orig)
3049 { 3049 {
3050 - QTC::TC("qpdf", "qpdf copy fields non-first from orig"); 3050 + QTC::TC("qpdf", "QPDFJob copy fields non-first from orig");
3051 } 3051 }
3052 try 3052 try
3053 { 3053 {
@@ -3094,7 +3094,7 @@ QPDFJob::handlePageSpecs( @@ -3094,7 +3094,7 @@ QPDFJob::handlePageSpecs(
3094 { 3094 {
3095 for (auto field: this_afdh->getFormFieldsForPage(page)) 3095 for (auto field: this_afdh->getFormFieldsForPage(page))
3096 { 3096 {
3097 - QTC::TC("qpdf", "qpdf pages keeping field from original"); 3097 + QTC::TC("qpdf", "QPDFJob pages keeping field from original");
3098 referenced_fields.insert(field.getObjectHandle().getObjGen()); 3098 referenced_fields.insert(field.getObjectHandle().getObjGen());
3099 } 3099 }
3100 } 3100 }
@@ -3126,12 +3126,12 @@ QPDFJob::handlePageSpecs( @@ -3126,12 +3126,12 @@ QPDFJob::handlePageSpecs(
3126 } 3126 }
3127 if (new_fields.getArrayNItems() > 0) 3127 if (new_fields.getArrayNItems() > 0)
3128 { 3128 {
3129 - QTC::TC("qpdf", "qpdf keep some fields in pages"); 3129 + QTC::TC("qpdf", "QPDFJob keep some fields in pages");
3130 acroform.replaceKey("/Fields", new_fields); 3130 acroform.replaceKey("/Fields", new_fields);
3131 } 3131 }
3132 else 3132 else
3133 { 3133 {
3134 - QTC::TC("qpdf", "qpdf no more fields in pages"); 3134 + QTC::TC("qpdf", "QPDFJob no more fields in pages");
3135 pdf.getRoot().removeKey("/AcroForm"); 3135 pdf.getRoot().removeKey("/AcroForm");
3136 } 3136 }
3137 } 3137 }
@@ -3172,11 +3172,11 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password) @@ -3172,11 +3172,11 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password)
3172 switch (m->password_mode) 3172 switch (m->password_mode)
3173 { 3173 {
3174 case QPDFJob::pm_bytes: 3174 case QPDFJob::pm_bytes:
3175 - QTC::TC("qpdf", "qpdf password mode bytes"); 3175 + QTC::TC("qpdf", "QPDFJob password mode bytes");
3176 break; 3176 break;
3177 3177
3178 case QPDFJob::pm_hex_bytes: 3178 case QPDFJob::pm_hex_bytes:
3179 - QTC::TC("qpdf", "qpdf password mode hex-bytes"); 3179 + QTC::TC("qpdf", "QPDFJob password mode hex-bytes");
3180 password = QUtil::hex_decode(password); 3180 password = QUtil::hex_decode(password);
3181 break; 3181 break;
3182 3182
@@ -3198,7 +3198,7 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password) @@ -3198,7 +3198,7 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password)
3198 { 3198 {
3199 if (! is_valid_utf8) 3199 if (! is_valid_utf8)
3200 { 3200 {
3201 - QTC::TC("qpdf", "qpdf password not unicode"); 3201 + QTC::TC("qpdf", "QPDFJob password not unicode");
3202 throw std::runtime_error( 3202 throw std::runtime_error(
3203 "supplied password is not valid UTF-8"); 3203 "supplied password is not valid UTF-8");
3204 } 3204 }
@@ -3207,7 +3207,7 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password) @@ -3207,7 +3207,7 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password)
3207 std::string encoded; 3207 std::string encoded;
3208 if (! QUtil::utf8_to_pdf_doc(password, encoded)) 3208 if (! QUtil::utf8_to_pdf_doc(password, encoded))
3209 { 3209 {
3210 - QTC::TC("qpdf", "qpdf password not encodable"); 3210 + QTC::TC("qpdf", "QPDFJob password not encodable");
3211 throw std::runtime_error( 3211 throw std::runtime_error(
3212 "supplied password cannot be encoded for" 3212 "supplied password cannot be encoded for"
3213 " 40-bit or 128-bit encryption formats"); 3213 " 40-bit or 128-bit encryption formats");
@@ -3222,7 +3222,7 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password) @@ -3222,7 +3222,7 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password)
3222 std::string encoded; 3222 std::string encoded;
3223 if (QUtil::utf8_to_pdf_doc(password, encoded)) 3223 if (QUtil::utf8_to_pdf_doc(password, encoded))
3224 { 3224 {
3225 - QTC::TC("qpdf", "qpdf auto-encode password"); 3225 + QTC::TC("qpdf", "QPDFJob auto-encode password");
3226 doIfVerbose([&](std::ostream& cout, 3226 doIfVerbose([&](std::ostream& cout,
3227 std::string const& prefix) { 3227 std::string const& prefix) {
3228 cout 3228 cout
@@ -3236,7 +3236,7 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password) @@ -3236,7 +3236,7 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password)
3236 } 3236 }
3237 else 3237 else
3238 { 3238 {
3239 - QTC::TC("qpdf", "qpdf bytes fallback warning"); 3239 + QTC::TC("qpdf", "QPDFJob bytes fallback warning");
3240 *(this->m->cerr) 3240 *(this->m->cerr)
3241 << this->m->message_prefix << ": WARNING: " 3241 << this->m->message_prefix << ": WARNING: "
3242 << "supplied password looks like a Unicode" 3242 << "supplied password looks like a Unicode"
@@ -3251,7 +3251,7 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password) @@ -3251,7 +3251,7 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password)
3251 } 3251 }
3252 else if ((R >= 5) && (! is_valid_utf8)) 3252 else if ((R >= 5) && (! is_valid_utf8))
3253 { 3253 {
3254 - QTC::TC("qpdf", "qpdf invalid utf-8 in auto"); 3254 + QTC::TC("qpdf", "QPDFJob invalid utf-8 in auto");
3255 throw std::runtime_error( 3255 throw std::runtime_error(
3256 "supplied password is not a valid Unicode password," 3256 "supplied password is not a valid Unicode password,"
3257 " which is required for 256-bit encryption; to" 3257 " which is required for 256-bit encryption; to"
@@ -3313,7 +3313,7 @@ QPDFJob::setEncryptionOptions(QPDF&amp; pdf, QPDFWriter&amp; w) @@ -3313,7 +3313,7 @@ QPDFJob::setEncryptionOptions(QPDF&amp; pdf, QPDFWriter&amp; w)
3313 { 3313 {
3314 // Do not set warnings = true for this case as this does 3314 // Do not set warnings = true for this case as this does
3315 // not reflect a potential problem with the input file. 3315 // not reflect a potential problem with the input file.
3316 - QTC::TC("qpdf", "qpdf weak crypto warning"); 3316 + QTC::TC("qpdf", "QPDFJob weak crypto warning");
3317 *(this->m->cerr) 3317 *(this->m->cerr)
3318 << this->m->message_prefix 3318 << this->m->message_prefix
3319 << ": writing a file with RC4, a weak cryptographic algorithm" 3319 << ": writing a file with RC4, a weak cryptographic algorithm"
@@ -3501,7 +3501,7 @@ QPDFJob::doSplitPages(QPDF&amp; pdf, bool&amp; warnings) @@ -3501,7 +3501,7 @@ QPDFJob::doSplitPages(QPDF&amp; pdf, bool&amp; warnings)
3501 char* num_spot = strstr(const_cast<char*>(m->outfilename.get()), "%d"); 3501 char* num_spot = strstr(const_cast<char*>(m->outfilename.get()), "%d");
3502 if (num_spot != 0) 3502 if (num_spot != 0)
3503 { 3503 {
3504 - QTC::TC("qpdf", "qpdf split-pages %d"); 3504 + QTC::TC("qpdf", "QPDFJob split-pages %d");
3505 before = std::string(m->outfilename.get(), 3505 before = std::string(m->outfilename.get(),
3506 QIntC::to_size(num_spot - m->outfilename.get())); 3506 QIntC::to_size(num_spot - m->outfilename.get()));
3507 after = num_spot + 2; 3507 after = num_spot + 2;
@@ -3510,13 +3510,13 @@ QPDFJob::doSplitPages(QPDF&amp; pdf, bool&amp; warnings) @@ -3510,13 +3510,13 @@ QPDFJob::doSplitPages(QPDF&amp; pdf, bool&amp; warnings)
3510 (QUtil::str_compare_nocase( 3510 (QUtil::str_compare_nocase(
3511 m->outfilename.get() + len - 4, ".pdf") == 0)) 3511 m->outfilename.get() + len - 4, ".pdf") == 0))
3512 { 3512 {
3513 - QTC::TC("qpdf", "qpdf split-pages .pdf"); 3513 + QTC::TC("qpdf", "QPDFJob split-pages .pdf");
3514 before = std::string(m->outfilename.get(), len - 4) + "-"; 3514 before = std::string(m->outfilename.get(), len - 4) + "-";
3515 after = m->outfilename.get() + len - 4; 3515 after = m->outfilename.get() + len - 4;
3516 } 3516 }
3517 else 3517 else
3518 { 3518 {
3519 - QTC::TC("qpdf", "qpdf split-pages other"); 3519 + QTC::TC("qpdf", "QPDFJob split-pages other");
3520 before = std::string(m->outfilename.get()) + "-"; 3520 before = std::string(m->outfilename.get()) + "-";
3521 } 3521 }
3522 3522
@@ -3556,7 +3556,7 @@ QPDFJob::doSplitPages(QPDF&amp; pdf, bool&amp; warnings) @@ -3556,7 +3556,7 @@ QPDFJob::doSplitPages(QPDF&amp; pdf, bool&amp; warnings)
3556 auto new_page = added_page(outpdf, page); 3556 auto new_page = added_page(outpdf, page);
3557 if (out_afdh.get()) 3557 if (out_afdh.get())
3558 { 3558 {
3559 - QTC::TC("qpdf", "qpdf copy form fields in split_pages"); 3559 + QTC::TC("qpdf", "QPDFJob copy form fields in split_pages");
3560 try 3560 try
3561 { 3561 {
3562 out_afdh->fixCopiedAnnotations(new_page, page, afdh); 3562 out_afdh->fixCopiedAnnotations(new_page, page, afdh);
libqpdf/QPDFJob_argv.cc
@@ -248,12 +248,12 @@ ArgParser::argPagesPassword(char* parameter) @@ -248,12 +248,12 @@ ArgParser::argPagesPassword(char* parameter)
248 { 248 {
249 if (this->pages_password != nullptr) 249 if (this->pages_password != nullptr)
250 { 250 {
251 - QTC::TC("qpdf", "qpdf duplicated pages password"); 251 + QTC::TC("qpdf", "QPDFJob duplicated pages password");
252 usage("--password already specified for this file"); 252 usage("--password already specified for this file");
253 } 253 }
254 if (this->accumulated_args.size() != 1) 254 if (this->accumulated_args.size() != 1)
255 { 255 {
256 - QTC::TC("qpdf", "qpdf misplaced pages password"); 256 + QTC::TC("qpdf", "QPDFJob misplaced pages password");
257 usage("in --pages, --password must immediately follow a file name"); 257 usage("in --pages, --password must immediately follow a file name");
258 } 258 }
259 this->pages_password = parameter; 259 this->pages_password = parameter;
@@ -291,7 +291,7 @@ ArgParser::argPagesPositional(char* arg) @@ -291,7 +291,7 @@ ArgParser::argPagesPositional(char* arg)
291 if (arg == nullptr) 291 if (arg == nullptr)
292 { 292 {
293 // The filename or password was the last argument 293 // The filename or password was the last argument
294 - QTC::TC("qpdf", "qpdf pages range omitted at end", 294 + QTC::TC("qpdf", "QPDFJob pages range omitted at end",
295 this->pages_password == nullptr ? 0 : 1); 295 this->pages_password == nullptr ? 0 : 1);
296 } 296 }
297 else 297 else
@@ -312,11 +312,11 @@ ArgParser::argPagesPositional(char* arg) @@ -312,11 +312,11 @@ ArgParser::argPagesPositional(char* arg)
312 if (strcmp(range, ".") == 0) 312 if (strcmp(range, ".") == 0)
313 { 313 {
314 // "." means the input file. 314 // "." means the input file.
315 - QTC::TC("qpdf", "qpdf pages range omitted with ."); 315 + QTC::TC("qpdf", "QPDFJob pages range omitted with .");
316 } 316 }
317 else if (QUtil::file_can_be_opened(range)) 317 else if (QUtil::file_can_be_opened(range))
318 { 318 {
319 - QTC::TC("qpdf", "qpdf pages range omitted in middle"); 319 + QTC::TC("qpdf", "QPDFJob pages range omitted in middle");
320 // Yup, it's a file. 320 // Yup, it's a file.
321 } 321 }
322 else 322 else
qpdf/qpdf.testcov
@@ -105,7 +105,7 @@ QPDF found wrong endstream in recovery 0 @@ -105,7 +105,7 @@ QPDF found wrong endstream in recovery 0
105 QPDF_Stream pipeStreamData with null pipeline 0 105 QPDF_Stream pipeStreamData with null pipeline 0
106 QPDFWriter not recompressing /FlateDecode 0 106 QPDFWriter not recompressing /FlateDecode 0
107 QPDF_encryption xref stream from encrypted file 0 107 QPDF_encryption xref stream from encrypted file 0
108 -qpdf unable to filter 0 108 +QPDFJob unable to filter 0
109 QUtil non-trivial UTF-16 0 109 QUtil non-trivial UTF-16 0
110 QPDF xref overwrite object 0 110 QPDF xref overwrite object 0
111 QPDF decoding error warning 0 111 QPDF decoding error warning 0
@@ -226,7 +226,7 @@ QPDFWriter foreign object 0 @@ -226,7 +226,7 @@ QPDFWriter foreign object 0
226 QPDFWriter copy use_aes 1 226 QPDFWriter copy use_aes 1
227 QPDFObjectHandle indirect without context 0 227 QPDFObjectHandle indirect without context 0
228 QPDFObjectHandle trailing data in parse 0 228 QPDFObjectHandle trailing data in parse 0
229 -qpdf pages encryption password 0 229 +QPDFJob pages encryption password 0
230 QPDFTokenizer EOF reading token 0 230 QPDFTokenizer EOF reading token 0
231 QPDFTokenizer EOF reading appendable token 0 231 QPDFTokenizer EOF reading appendable token 0
232 QPDFWriter extra header text no newline 0 232 QPDFWriter extra header text no newline 0
@@ -255,9 +255,9 @@ QPDF not caching overridden objstm object 0 @@ -255,9 +255,9 @@ QPDF not caching overridden objstm object 0
255 QPDFWriter original obj non-zero gen 0 255 QPDFWriter original obj non-zero gen 0
256 QPDF_optimization indirect outlines 0 256 QPDF_optimization indirect outlines 0
257 QPDF xref space 2 257 QPDF xref space 2
258 -qpdf pages range omitted at end 1  
259 -qpdf pages range omitted in middle 0  
260 -qpdf npages 0 258 +QPDFJob pages range omitted at end 1
  259 +QPDFJob pages range omitted in middle 0
  260 +QPDFJob npages 0
261 QPDF already reserved object 0 261 QPDF already reserved object 0
262 QPDFWriter standard deterministic ID 1 262 QPDFWriter standard deterministic ID 1
263 QPDFWriter linearized deterministic ID 1 263 QPDFWriter linearized deterministic ID 1
@@ -272,10 +272,10 @@ QPDFObjectHandle no val for last key 0 @@ -272,10 +272,10 @@ QPDFObjectHandle no val for last key 0
272 QPDF resolve failure to null 0 272 QPDF resolve failure to null 0
273 QPDFWriter preserve unreferenced standard 0 273 QPDFWriter preserve unreferenced standard 0
274 QPDFObjectHandle errors in parsecontent 0 274 QPDFObjectHandle errors in parsecontent 0
275 -qpdf same file error 0  
276 -qpdf split-pages %d 0  
277 -qpdf split-pages .pdf 0  
278 -qpdf split-pages other 0 275 +QPDFJob same file error 0
  276 +QPDFJob split-pages %d 0
  277 +QPDFJob split-pages .pdf 0
  278 +QPDFJob split-pages other 0
279 QPDFTokenizer allowing bad token 0 279 QPDFTokenizer allowing bad token 0
280 QPDF ignore first space in xref entry 0 280 QPDF ignore first space in xref entry 0
281 QPDF ignore first extra space in xref entry 0 281 QPDF ignore first extra space in xref entry 0
@@ -349,9 +349,9 @@ QPDFAcroFormDocumentHelper non-dictionary field 0 @@ -349,9 +349,9 @@ QPDFAcroFormDocumentHelper non-dictionary field 0
349 QPDFAcroFormDocumentHelper loop 0 349 QPDFAcroFormDocumentHelper loop 0
350 QPDFAcroFormDocumentHelper field found 1 350 QPDFAcroFormDocumentHelper field found 1
351 QPDFAcroFormDocumentHelper annotation found 1 351 QPDFAcroFormDocumentHelper annotation found 1
352 -qpdf keep files open n 0  
353 -qpdf keep files open y 0  
354 -qpdf automatically set keep files open 1 352 +QPDFJob keep files open n 0
  353 +QPDFJob keep files open y 0
  354 +QPDFJob automatically set keep files open 1
355 QPDFPageLabelDocumentHelper skip first 0 355 QPDFPageLabelDocumentHelper skip first 0
356 QPDFOutlineObjectHelper direct dest 0 356 QPDFOutlineObjectHelper direct dest 0
357 QPDFOutlineObjectHelper action dest 0 357 QPDFOutlineObjectHelper action dest 0
@@ -392,24 +392,24 @@ QPDFFormFieldObjectHelper list found 0 @@ -392,24 +392,24 @@ QPDFFormFieldObjectHelper list found 0
392 QPDFFormFieldObjectHelper list first too low 0 392 QPDFFormFieldObjectHelper list first too low 0
393 QPDFFormFieldObjectHelper list last too high 0 393 QPDFFormFieldObjectHelper list last too high 0
394 QPDF detected dangling ref 0 394 QPDF detected dangling ref 0
395 -qpdf image optimize no pipeline 0  
396 -qpdf image optimize no shrink 0  
397 -qpdf image optimize too small 0 395 +QPDFJob image optimize no pipeline 0
  396 +QPDFJob image optimize no shrink 0
  397 +QPDFJob image optimize too small 0
398 QPDFFormFieldObjectHelper WinAnsi 0 398 QPDFFormFieldObjectHelper WinAnsi 0
399 QPDF pipe foreign encrypted stream 0 399 QPDF pipe foreign encrypted stream 0
400 QPDF copy foreign stream with provider 0 400 QPDF copy foreign stream with provider 0
401 QPDF copy foreign stream with buffer 0 401 QPDF copy foreign stream with buffer 0
402 QPDF immediate copy stream data 0 402 QPDF immediate copy stream data 0
403 -qpdf copy same page more than once 1 403 +QPDFJob copy same page more than once 1
404 QPDFPageObjectHelper bad token finding names 0 404 QPDFPageObjectHelper bad token finding names 0
405 -qpdf password mode bytes 0  
406 -qpdf password mode hex-bytes 0  
407 -qpdf password not unicode 0  
408 -qpdf password not encodable 0  
409 -qpdf auto-encode password 0  
410 -qpdf bytes fallback warning 0  
411 -qpdf invalid utf-8 in auto 0  
412 -qpdf input password hex-bytes 0 405 +QPDFJob password mode bytes 0
  406 +QPDFJob password mode hex-bytes 0
  407 +QPDFJob password not unicode 0
  408 +QPDFJob password not encodable 0
  409 +QPDFJob auto-encode password 0
  410 +QPDFJob bytes fallback warning 0
  411 +QPDFJob invalid utf-8 in auto 0
  412 +QPDFJob input password hex-bytes 0
413 QPDFPageDocumentHelper ignore annotation with no appearance 0 413 QPDFPageDocumentHelper ignore annotation with no appearance 0
414 QPDFFormFieldObjectHelper create AS from scratch 0 414 QPDFFormFieldObjectHelper create AS from scratch 0
415 QPDFFormFieldObjectHelper create AP from scratch 0 415 QPDFFormFieldObjectHelper create AP from scratch 0
@@ -417,7 +417,7 @@ QPDFFormFieldObjectHelper replaced BMC at EOF 0 @@ -417,7 +417,7 @@ QPDFFormFieldObjectHelper replaced BMC at EOF 0
417 QPDFFormFieldObjectHelper fallback Tf 0 417 QPDFFormFieldObjectHelper fallback Tf 0
418 QPDFPageObjectHelper non-trivial inheritance 0 418 QPDFPageObjectHelper non-trivial inheritance 0
419 QPDFPageObjectHelper copy shared attribute 1 419 QPDFPageObjectHelper copy shared attribute 1
420 -qpdf from_nr from repeat_nr 0 420 +QPDFJob from_nr from repeat_nr 0
421 QPDF resolve duplicated page object 0 421 QPDF resolve duplicated page object 0
422 QPDF handle direct page object 0 422 QPDF handle direct page object 0
423 QPDFTokenizer finder found wrong word 0 423 QPDFTokenizer finder found wrong word 0
@@ -425,8 +425,8 @@ QPDFTokenizer found EI by byte count 0 @@ -425,8 +425,8 @@ QPDFTokenizer found EI by byte count 0
425 QPDFTokenizer found EI after more than one try 0 425 QPDFTokenizer found EI after more than one try 0
426 QPDFPageObjectHelper externalize inline image 0 426 QPDFPageObjectHelper externalize inline image 0
427 QPDFPageObjectHelper keep inline image 0 427 QPDFPageObjectHelper keep inline image 0
428 -qpdf image optimize colorspace 0  
429 -qpdf image optimize bits per component 0 428 +QPDFJob image optimize colorspace 0
  429 +QPDFJob image optimize bits per component 0
430 QPDFWriter remove empty DecodeParms 0 430 QPDFWriter remove empty DecodeParms 0
431 QPDFObjectHandle uint returning 0 0 431 QPDFObjectHandle uint returning 0 0
432 QPDFObjectHandle int returning INT_MIN 0 432 QPDFObjectHandle int returning INT_MIN 0
@@ -443,13 +443,13 @@ QPDFWriter no encryption sig contents 0 @@ -443,13 +443,13 @@ QPDFWriter no encryption sig contents 0
443 QPDFPageObjectHelper colorspace lookup 0 443 QPDFPageObjectHelper colorspace lookup 0
444 QPDFWriter ignore XRef in qdf mode 0 444 QPDFWriter ignore XRef in qdf mode 0
445 QPDFPageObjectHelper filter form xobject 0 445 QPDFPageObjectHelper filter form xobject 0
446 -qpdf found resources in non-leaf 0  
447 -qpdf found shared resources in leaf 0  
448 -qpdf found shared xobject in leaf 0 446 +QPDFJob found resources in non-leaf 0
  447 +QPDFJob found shared resources in leaf 0
  448 +QPDFJob found shared xobject in leaf 0
449 QPDF copy foreign with data 1 449 QPDF copy foreign with data 1
450 QPDF copy foreign with foreign_stream 1 450 QPDF copy foreign with foreign_stream 1
451 QPDFObjectHandle need_newline 1 451 QPDFObjectHandle need_newline 1
452 -qpdf pages range omitted with . 0 452 +QPDFJob pages range omitted with . 0
453 qpdf-c invalid object handle 0 453 qpdf-c invalid object handle 0
454 qpdf-c called qpdf_oh_release 0 454 qpdf-c called qpdf_oh_release 0
455 qpdf-c called qpdf_oh_release_all 0 455 qpdf-c called qpdf_oh_release_all 0
@@ -573,10 +573,10 @@ QPDFPageObjectHelper flatten inherit rotate 0 @@ -573,10 +573,10 @@ QPDFPageObjectHelper flatten inherit rotate 0
573 QPDFAcroFormDocumentHelper copy annotation 3 573 QPDFAcroFormDocumentHelper copy annotation 3
574 QPDFAcroFormDocumentHelper field with parent 3 574 QPDFAcroFormDocumentHelper field with parent 3
575 QPDFAcroFormDocumentHelper modify ap matrix 0 575 QPDFAcroFormDocumentHelper modify ap matrix 0
576 -qpdf copy form fields in split_pages 0  
577 -qpdf keep some fields in pages 0  
578 -qpdf pages keeping field from original 0  
579 -qpdf no more fields in pages 0 576 +QPDFJob copy form fields in split_pages 0
  577 +QPDFJob keep some fields in pages 0
  578 +QPDFJob pages keeping field from original 0
  579 +QPDFJob no more fields in pages 0
580 QPDFObjectHandle merge reuse 0 580 QPDFObjectHandle merge reuse 0
581 QPDFObjectHandle merge generate 0 581 QPDFObjectHandle merge generate 0
582 QPDFFormFieldObjectHelper get font from /DR 0 582 QPDFFormFieldObjectHelper get font from /DR 0
@@ -587,15 +587,15 @@ QPDFAcroFormDocumentHelper ap conflict 0 @@ -587,15 +587,15 @@ QPDFAcroFormDocumentHelper ap conflict 0
587 QPDFAcroFormDocumentHelper ap rename 0 587 QPDFAcroFormDocumentHelper ap rename 0
588 QPDFAcroFormDocumentHelper /DA parse error 0 588 QPDFAcroFormDocumentHelper /DA parse error 0
589 QPDFAcroFormDocumentHelper AP parse error 0 589 QPDFAcroFormDocumentHelper AP parse error 0
590 -qpdf copy fields not this file 0  
591 -qpdf copy fields non-first from orig 0 590 +QPDFJob copy fields not this file 0
  591 +QPDFJob copy fields non-first from orig 0
592 QPDF resolve duplicated page in insert 0 592 QPDF resolve duplicated page in insert 0
593 QPDFWriter preserve object streams 1 593 QPDFWriter preserve object streams 1
594 QPDFWriter exclude from object stream 0 594 QPDFWriter exclude from object stream 0
595 QPDF_pages findPage not found 0 595 QPDF_pages findPage not found 0
596 -qpdf overlay page with no resources 0 596 +QPDFJob overlay page with no resources 0
597 QPDFObjectHandle check ownership 0 597 QPDFObjectHandle check ownership 0
598 -qpdf weak crypto warning 0 598 +QPDFJob weak crypto warning 0
599 qpdf-c called qpdf_oh_is_initialized 0 599 qpdf-c called qpdf_oh_is_initialized 0
600 qpdf-c registered progress reporter 0 600 qpdf-c registered progress reporter 0
601 qpdf-c called qpdf_oh_new_uninitialized 0 601 qpdf-c called qpdf_oh_new_uninitialized 0
@@ -621,13 +621,13 @@ qpdf-c called qpdf_oh_replace_stream_data 0 @@ -621,13 +621,13 @@ qpdf-c called qpdf_oh_replace_stream_data 0
621 qpdf-c silence oh errors 0 621 qpdf-c silence oh errors 0
622 qpdf-c called qpdf_oh_get_binary_string_value 0 622 qpdf-c called qpdf_oh_get_binary_string_value 0
623 qpdf-c called qpdf_oh_new_binary_string 0 623 qpdf-c called qpdf_oh_new_binary_string 0
624 -qpdf duplicated pages password 0  
625 -qpdf misplaced pages password 0  
626 -qpdf check encrypted encrypted 0  
627 -qpdf check encrypted not encrypted 0  
628 -qpdf check password password incorrect 0  
629 -qpdf check password password correct 0  
630 -qpdf check password not encrypted 0 624 +QPDFJob duplicated pages password 0
  625 +QPDFJob misplaced pages password 0
  626 +QPDFJob check encrypted encrypted 0
  627 +QPDFJob check encrypted not encrypted 0
  628 +QPDFJob check password password incorrect 0
  629 +QPDFJob check password password correct 0
  630 +QPDFJob check password not encrypted 0
631 QPDFJob_config password file 0 631 QPDFJob_config password file 0
632 QPDFJob_config password stdin 0 632 QPDFJob_config password stdin 0
633 QPDFJob json bare not empty 0 633 QPDFJob json bare not empty 0