From 7f043fe88ed8d7ce14a67cbfaf0c0b18015b8f9f Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 11:25:58 +0100 Subject: [PATCH 1/8] Remove unused include directives --- examples/pdf-count-strings.cc | 2 -- examples/pdf-create.cc | 2 -- examples/pdf-filter-tokens.cc | 2 -- examples/pdf-name-number-tree.cc | 1 - examples/pdf-overlay-page.cc | 1 - examples/pdf-parse-content.cc | 1 - examples/pdf-set-form-values.cc | 2 -- examples/qpdf-job.cc | 2 -- examples/qpdfjob-c-save-attachment.c | 1 - examples/qpdfjob-remove-annotations.cc | 1 - libqpdf/BufferInputSource.cc | 2 -- libqpdf/MD5.cc | 4 ---- libqpdf/Pipeline.cc | 2 -- libqpdf/Pl_AES_PDF.cc | 1 - libqpdf/Pl_ASCIIHexDecoder.cc | 1 - libqpdf/Pl_Base64.cc | 1 - libqpdf/Pl_DCT.cc | 3 --- libqpdf/Pl_Function.cc | 2 -- libqpdf/Pl_OStream.cc | 2 -- libqpdf/Pl_QPDFTokenizer.cc | 2 -- libqpdf/Pl_SHA2.cc | 1 - libqpdf/Pl_String.cc | 2 -- libqpdf/QPDFAnnotationObjectHelper.cc | 1 - libqpdf/QPDFExc.cc | 2 -- libqpdf/QPDFParser.cc | 1 - libqpdf/QPDFSystemError.cc | 1 - libqpdf/QPDFXRefEntry.cc | 1 - libqpdf/QPDF_Name.cc | 2 -- libqpdf/QPDF_String.cc | 1 - libqpdf/QPDF_linearization.cc | 1 - libqpdf/QUtil.cc | 1 - libqpdf/RC4.cc | 1 - libqpdf/qpdf-c.cc | 1 - libqpdf/qpdfjob-c.cc | 2 -- libqpdf/qpdflogger-c.cc | 1 - libtests/arg_parser.cc | 1 - libtests/bits.cc | 1 - libtests/closed_file_input_source.cc | 2 -- libtests/cxx11.cc | 1 - libtests/dct_uncompress.cc | 1 - libtests/flate.cc | 2 -- libtests/json_parse.cc | 1 - libtests/logger_c.c | 1 - libtests/pointer_holder.cc | 1 - libtests/predictors.cc | 1 - libtests/qutil.cc | 4 ---- libtests/random.cc | 1 - libtests/sha2.cc | 1 - qpdf/pdf_from_scratch.cc | 1 - qpdf/qpdf.cc | 1 - qpdf/qpdfjob-ctest.c | 1 - qpdf/test_driver.cc | 1 - qpdf/test_renumber.cc | 2 -- qpdf/test_shell_glob.cc | 1 - qpdf/test_tokenizer.cc | 1 - qpdf/test_xref.cc | 3 --- 56 files changed, 83 deletions(-) diff --git a/examples/pdf-count-strings.cc b/examples/pdf-count-strings.cc index 529f6bdc..09c4a1f5 100644 --- a/examples/pdf-count-strings.cc +++ b/examples/pdf-count-strings.cc @@ -6,13 +6,11 @@ #include #include -#include #include #include #include #include -#include #include static char const* whoami = nullptr; diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc index 527243a7..56af4a8d 100644 --- a/examples/pdf-create.cc +++ b/examples/pdf-create.cc @@ -12,13 +12,11 @@ #include #include #include -#include #include #include #include #include #include -#include static char const* whoami = nullptr; diff --git a/examples/pdf-filter-tokens.cc b/examples/pdf-filter-tokens.cc index a99ce70c..8824b391 100644 --- a/examples/pdf-filter-tokens.cc +++ b/examples/pdf-filter-tokens.cc @@ -9,12 +9,10 @@ #include #include #include -#include #include #include #include -#include #include #include diff --git a/examples/pdf-name-number-tree.cc b/examples/pdf-name-number-tree.cc index f9dcb0fc..e1dfde05 100644 --- a/examples/pdf-name-number-tree.cc +++ b/examples/pdf-name-number-tree.cc @@ -3,7 +3,6 @@ #include #include #include -#include #include static char const* whoami = nullptr; diff --git a/examples/pdf-overlay-page.cc b/examples/pdf-overlay-page.cc index 04a1e921..d40bf0e1 100644 --- a/examples/pdf-overlay-page.cc +++ b/examples/pdf-overlay-page.cc @@ -5,7 +5,6 @@ #include #include #include -#include // This program demonstrates use of form XObjects to overlay a page // from one file onto all pages of another file. The qpdf program's diff --git a/examples/pdf-parse-content.cc b/examples/pdf-parse-content.cc index 481633e6..85abcabc 100644 --- a/examples/pdf-parse-content.cc +++ b/examples/pdf-parse-content.cc @@ -1,6 +1,5 @@ #include #include -#include #include #include diff --git a/examples/pdf-set-form-values.cc b/examples/pdf-set-form-values.cc index 1398c0dd..281e139e 100644 --- a/examples/pdf-set-form-values.cc +++ b/examples/pdf-set-form-values.cc @@ -4,9 +4,7 @@ #include #include #include -#include #include -#include static char const* whoami = nullptr; diff --git a/examples/qpdf-job.cc b/examples/qpdf-job.cc index 614abbe6..c7131f77 100644 --- a/examples/qpdf-job.cc +++ b/examples/qpdf-job.cc @@ -1,8 +1,6 @@ -#include #include #include -#include #include // This program is a simple demonstration of different ways to use the diff --git a/examples/qpdfjob-c-save-attachment.c b/examples/qpdfjob-c-save-attachment.c index 39d1f69a..301bf635 100644 --- a/examples/qpdfjob-c-save-attachment.c +++ b/examples/qpdfjob-c-save-attachment.c @@ -1,4 +1,3 @@ -#include #include #include diff --git a/examples/qpdfjob-remove-annotations.cc b/examples/qpdfjob-remove-annotations.cc index dfab3f7b..fd8754d5 100644 --- a/examples/qpdfjob-remove-annotations.cc +++ b/examples/qpdfjob-remove-annotations.cc @@ -4,7 +4,6 @@ #include #include -#include #include // This example demonstrates how we can use the QPDFJob createQPDF and writeQPDF diff --git a/libqpdf/BufferInputSource.cc b/libqpdf/BufferInputSource.cc index 6402f639..005692ae 100644 --- a/libqpdf/BufferInputSource.cc +++ b/libqpdf/BufferInputSource.cc @@ -2,9 +2,7 @@ #include #include -#include #include -#include #include BufferInputSource::BufferInputSource( diff --git a/libqpdf/MD5.cc b/libqpdf/MD5.cc index 2119349c..57419374 100644 --- a/libqpdf/MD5.cc +++ b/libqpdf/MD5.cc @@ -4,10 +4,6 @@ #include #include -#include -#include -#include -#include #include MD5::MD5() diff --git a/libqpdf/Pipeline.cc b/libqpdf/Pipeline.cc index 3223ac7e..73bd1675 100644 --- a/libqpdf/Pipeline.cc +++ b/libqpdf/Pipeline.cc @@ -1,7 +1,5 @@ #include -#include - #include #include diff --git a/libqpdf/Pl_AES_PDF.cc b/libqpdf/Pl_AES_PDF.cc index acb6b3f6..89bde7ce 100644 --- a/libqpdf/Pl_AES_PDF.cc +++ b/libqpdf/Pl_AES_PDF.cc @@ -5,7 +5,6 @@ #include #include #include -#include #include bool Pl_AES_PDF::use_static_iv = false; diff --git a/libqpdf/Pl_ASCIIHexDecoder.cc b/libqpdf/Pl_ASCIIHexDecoder.cc index f1c4785b..48836f58 100644 --- a/libqpdf/Pl_ASCIIHexDecoder.cc +++ b/libqpdf/Pl_ASCIIHexDecoder.cc @@ -3,7 +3,6 @@ #include #include #include -#include Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) : Pipeline(identifier, next), diff --git a/libqpdf/Pl_Base64.cc b/libqpdf/Pl_Base64.cc index 6fb422c1..af5ff0bb 100644 --- a/libqpdf/Pl_Base64.cc +++ b/libqpdf/Pl_Base64.cc @@ -2,7 +2,6 @@ #include #include -#include #include #include diff --git a/libqpdf/Pl_DCT.cc b/libqpdf/Pl_DCT.cc index f7cc4b75..35587875 100644 --- a/libqpdf/Pl_DCT.cc +++ b/libqpdf/Pl_DCT.cc @@ -2,12 +2,9 @@ #include #include -#include -#include #include #include -#include #include #if BITS_IN_JSAMPLE != 8 diff --git a/libqpdf/Pl_Function.cc b/libqpdf/Pl_Function.cc index 853b4212..26551ac8 100644 --- a/libqpdf/Pl_Function.cc +++ b/libqpdf/Pl_Function.cc @@ -1,7 +1,5 @@ #include -#include -#include #include Pl_Function::Members::Members(writer_t fn) : diff --git a/libqpdf/Pl_OStream.cc b/libqpdf/Pl_OStream.cc index 137b6654..c9d4b1e6 100644 --- a/libqpdf/Pl_OStream.cc +++ b/libqpdf/Pl_OStream.cc @@ -1,7 +1,5 @@ #include -#include -#include #include Pl_OStream::Members::Members(std::ostream& os) : diff --git a/libqpdf/Pl_QPDFTokenizer.cc b/libqpdf/Pl_QPDFTokenizer.cc index 5e42d579..b5c3f75e 100644 --- a/libqpdf/Pl_QPDFTokenizer.cc +++ b/libqpdf/Pl_QPDFTokenizer.cc @@ -2,9 +2,7 @@ #include #include -#include #include -#include Pl_QPDFTokenizer::Members::Members() : filter(nullptr), diff --git a/libqpdf/Pl_SHA2.cc b/libqpdf/Pl_SHA2.cc index c54bd7ee..852e5db7 100644 --- a/libqpdf/Pl_SHA2.cc +++ b/libqpdf/Pl_SHA2.cc @@ -2,7 +2,6 @@ #include #include -#include #include Pl_SHA2::Pl_SHA2(int bits, Pipeline* next) : diff --git a/libqpdf/Pl_String.cc b/libqpdf/Pl_String.cc index d946a652..9b57ac2d 100644 --- a/libqpdf/Pl_String.cc +++ b/libqpdf/Pl_String.cc @@ -1,7 +1,5 @@ #include -#include -#include #include Pl_String::Members::Members(std::string& s) : diff --git a/libqpdf/QPDFAnnotationObjectHelper.cc b/libqpdf/QPDFAnnotationObjectHelper.cc index f22207de..c14d98f9 100644 --- a/libqpdf/QPDFAnnotationObjectHelper.cc +++ b/libqpdf/QPDFAnnotationObjectHelper.cc @@ -2,7 +2,6 @@ #include #include -#include #include #include diff --git a/libqpdf/QPDFExc.cc b/libqpdf/QPDFExc.cc index 6f1ef1a0..87fad72a 100644 --- a/libqpdf/QPDFExc.cc +++ b/libqpdf/QPDFExc.cc @@ -1,7 +1,5 @@ #include -#include - QPDFExc::QPDFExc( qpdf_error_code_e error_code, std::string const& filename, diff --git a/libqpdf/QPDFParser.cc b/libqpdf/QPDFParser.cc index 4c43e487..e56fcce3 100644 --- a/libqpdf/QPDFParser.cc +++ b/libqpdf/QPDFParser.cc @@ -16,7 +16,6 @@ #include #include #include -#include #include #include diff --git a/libqpdf/QPDFSystemError.cc b/libqpdf/QPDFSystemError.cc index 8d129bad..65fa3121 100644 --- a/libqpdf/QPDFSystemError.cc +++ b/libqpdf/QPDFSystemError.cc @@ -1,6 +1,5 @@ #include -#include #include QPDFSystemError::QPDFSystemError( diff --git a/libqpdf/QPDFXRefEntry.cc b/libqpdf/QPDFXRefEntry.cc index 77f641b0..0d66028c 100644 --- a/libqpdf/QPDFXRefEntry.cc +++ b/libqpdf/QPDFXRefEntry.cc @@ -2,7 +2,6 @@ #include #include -#include QPDFXRefEntry::QPDFXRefEntry() { diff --git a/libqpdf/QPDF_Name.cc b/libqpdf/QPDF_Name.cc index 2fa697cf..11b30086 100644 --- a/libqpdf/QPDF_Name.cc +++ b/libqpdf/QPDF_Name.cc @@ -1,8 +1,6 @@ #include #include -#include -#include QPDF_Name::QPDF_Name(std::string const& name) : QPDFValue(::ot_name, "name"), diff --git a/libqpdf/QPDF_String.cc b/libqpdf/QPDF_String.cc index c3148fa0..51742bdd 100644 --- a/libqpdf/QPDF_String.cc +++ b/libqpdf/QPDF_String.cc @@ -5,7 +5,6 @@ // DO NOT USE ctype -- it is locale dependent for some things, and // it's not worth the risk of including it in case it may accidentally // be used. -#include static bool is_iso_latin1_printable(char ch) diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc index 926353fa..5b72943a 100644 --- a/libqpdf/QPDF_linearization.cc +++ b/libqpdf/QPDF_linearization.cc @@ -13,7 +13,6 @@ #include #include -#include #include #include diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index 03301d9d..72b2a55f 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -9,7 +9,6 @@ #include #include -#include #include #include #include diff --git a/libqpdf/RC4.cc b/libqpdf/RC4.cc index 6fc25a86..2d1b783d 100644 --- a/libqpdf/RC4.cc +++ b/libqpdf/RC4.cc @@ -2,7 +2,6 @@ #include -#include RC4::RC4(unsigned char const* key_data, int key_len) : crypto(QPDFCryptoProvider::getImpl()) diff --git a/libqpdf/qpdf-c.cc b/libqpdf/qpdf-c.cc index 01987365..e7df8ac3 100644 --- a/libqpdf/qpdf-c.cc +++ b/libqpdf/qpdf-c.cc @@ -15,7 +15,6 @@ #include #include -#include #include #include #include diff --git a/libqpdf/qpdfjob-c.cc b/libqpdf/qpdfjob-c.cc index ddb33349..2e78672f 100644 --- a/libqpdf/qpdfjob-c.cc +++ b/libqpdf/qpdfjob-c.cc @@ -1,14 +1,12 @@ #include #include -#include #include #include #include #include #include -#include struct _qpdfjob_handle { diff --git a/libqpdf/qpdflogger-c.cc b/libqpdf/qpdflogger-c.cc index 2a6d1052..c713dfb4 100644 --- a/libqpdf/qpdflogger-c.cc +++ b/libqpdf/qpdflogger-c.cc @@ -4,7 +4,6 @@ #include #include -#include #include #include #include diff --git a/libtests/arg_parser.cc b/libtests/arg_parser.cc index 9e3e8da5..6b4c829f 100644 --- a/libtests/arg_parser.cc +++ b/libtests/arg_parser.cc @@ -2,7 +2,6 @@ #include #include -#include #include #include diff --git a/libtests/bits.cc b/libtests/bits.cc index 07870eb7..0db956e1 100644 --- a/libtests/bits.cc +++ b/libtests/bits.cc @@ -4,7 +4,6 @@ #include #include #include -#include #include // See comments in bits_functions.hh diff --git a/libtests/closed_file_input_source.cc b/libtests/closed_file_input_source.cc index e4c8ed36..23b15154 100644 --- a/libtests/closed_file_input_source.cc +++ b/libtests/closed_file_input_source.cc @@ -3,8 +3,6 @@ #include #include -#include -#include void check(std::string const& what, bool result) diff --git a/libtests/cxx11.cc b/libtests/cxx11.cc index ac18e13e..5f0dcc9a 100644 --- a/libtests/cxx11.cc +++ b/libtests/cxx11.cc @@ -1,6 +1,5 @@ #include -#include #include #include #include diff --git a/libtests/dct_uncompress.cc b/libtests/dct_uncompress.cc index 1ab22e97..5e1e9a33 100644 --- a/libtests/dct_uncompress.cc +++ b/libtests/dct_uncompress.cc @@ -5,7 +5,6 @@ #include #include #include -#include int main(int argc, char* argv[]) diff --git a/libtests/flate.cc b/libtests/flate.cc index 77fb440e..1170841b 100644 --- a/libtests/flate.cc +++ b/libtests/flate.cc @@ -4,10 +4,8 @@ #include #include -#include #include #include -#include void run(char const* filename) diff --git a/libtests/json_parse.cc b/libtests/json_parse.cc index 721b17de..ed69784e 100644 --- a/libtests/json_parse.cc +++ b/libtests/json_parse.cc @@ -1,6 +1,5 @@ #include #include -#include #include #include #include diff --git a/libtests/logger_c.c b/libtests/logger_c.c index 5c4c519a..c3fa0d8c 100644 --- a/libtests/logger_c.c +++ b/libtests/logger_c.c @@ -2,7 +2,6 @@ #include -#include #include #include diff --git a/libtests/pointer_holder.cc b/libtests/pointer_holder.cc index f03c4257..e5a58d17 100644 --- a/libtests/pointer_holder.cc +++ b/libtests/pointer_holder.cc @@ -7,7 +7,6 @@ #include #include -#include class Object { diff --git a/libtests/predictors.cc b/libtests/predictors.cc index a8f6c5d9..f0bde79a 100644 --- a/libtests/predictors.cc +++ b/libtests/predictors.cc @@ -6,7 +6,6 @@ #include #include -#include #include #include #include diff --git a/libtests/qutil.cc b/libtests/qutil.cc index 66264d19..b9012db9 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -3,15 +3,11 @@ #include #include #include -#include #include #include #include -#include #include #include -#include -#include #ifdef _WIN32 # include diff --git a/libtests/random.cc b/libtests/random.cc index ad7d105d..40ef7d47 100644 --- a/libtests/random.cc +++ b/libtests/random.cc @@ -1,7 +1,6 @@ #include #include #include -#include #include class BogusRandomDataProvider: public RandomDataProvider diff --git a/libtests/sha2.cc b/libtests/sha2.cc index 65b70c39..46ccd5c2 100644 --- a/libtests/sha2.cc +++ b/libtests/sha2.cc @@ -1,7 +1,6 @@ #include #include #include -#include #include static void diff --git a/qpdf/pdf_from_scratch.cc b/qpdf/pdf_from_scratch.cc index bdcdaae1..4e1c6553 100644 --- a/qpdf/pdf_from_scratch.cc +++ b/qpdf/pdf_from_scratch.cc @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc index ea7f338a..815a86b4 100644 --- a/qpdf/qpdf.cc +++ b/qpdf/qpdf.cc @@ -4,7 +4,6 @@ #include #include -#include #include static char const* whoami = 0; diff --git a/qpdf/qpdfjob-ctest.c b/qpdf/qpdfjob-ctest.c index 31f22d28..62da7fe5 100644 --- a/qpdf/qpdfjob-ctest.c +++ b/qpdf/qpdfjob-ctest.c @@ -2,7 +2,6 @@ #include #include -#include #include #ifndef QPDF_NO_WCHAR_T diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index 4a5d0ae8..39631d21 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/qpdf/test_renumber.cc b/qpdf/test_renumber.cc index 7edec21b..1b828128 100644 --- a/qpdf/test_renumber.cc +++ b/qpdf/test_renumber.cc @@ -1,4 +1,3 @@ -#include #include #include #include @@ -6,7 +5,6 @@ #include #include -#include #include #include #include diff --git a/qpdf/test_shell_glob.cc b/qpdf/test_shell_glob.cc index c2cfb422..492e117d 100644 --- a/qpdf/test_shell_glob.cc +++ b/qpdf/test_shell_glob.cc @@ -1,5 +1,4 @@ #include -#include #include int diff --git a/qpdf/test_tokenizer.cc b/qpdf/test_tokenizer.cc index f465cd46..83d3e1c8 100644 --- a/qpdf/test_tokenizer.cc +++ b/qpdf/test_tokenizer.cc @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include diff --git a/qpdf/test_xref.cc b/qpdf/test_xref.cc index d01ac046..6ecb9a00 100644 --- a/qpdf/test_xref.cc +++ b/qpdf/test_xref.cc @@ -1,11 +1,8 @@ #include -#include -#include #include #include #include -#include int main(int argc, char* argv[]) From e28f4efb00d5040fa71532d76e63aa7ade105c99 Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 12:22:32 +0100 Subject: [PATCH 2/8] Replace deprecated C++ includes --- examples/pdf-bookmarks.cc | 4 ++-- examples/pdf-count-strings.cc | 2 +- examples/pdf-create.cc | 2 +- examples/pdf-double-page-size.cc | 4 ++-- examples/pdf-filter-tokens.cc | 2 +- examples/pdf-invert-images.cc | 4 ++-- examples/pdf-mod-info.cc | 6 +++--- examples/pdf-npages.cc | 4 ++-- examples/pdf-overlay-page.cc | 2 +- examples/pdf-parse-content.cc | 2 +- examples/pdf-set-form-values.cc | 2 +- examples/pdf-split-pages.cc | 2 +- include/qpdf/Buffer.hh | 2 +- include/qpdf/InputSource.hh | 2 +- include/qpdf/Pl_StdioFile.hh | 2 +- include/qpdf/QPDF.hh | 2 +- include/qpdf/QPDFTokenizer.hh | 2 +- include/qpdf/QPDFWriter.hh | 2 +- include/qpdf/QUtil.hh | 4 ++-- include/qpdf/RandomDataProvider.hh | 2 +- libqpdf/BufferInputSource.cc | 2 +- libqpdf/FileInputSource.cc | 2 +- libqpdf/InputSource.cc | 2 +- libqpdf/InsecureRandomDataProvider.cc | 2 +- libqpdf/MD5.cc | 2 +- libqpdf/Pl_ASCII85Decoder.cc | 2 +- libqpdf/Pl_ASCIIHexDecoder.cc | 2 +- libqpdf/Pl_Buffer.cc | 4 ++-- libqpdf/Pl_DCT.cc | 2 +- libqpdf/Pl_Flate.cc | 4 ++-- libqpdf/Pl_LZWDecoder.cc | 2 +- libqpdf/Pl_PNGFilter.cc | 4 ++-- libqpdf/Pl_StdioFile.cc | 2 +- libqpdf/Pl_TIFFPredictor.cc | 4 ++-- libqpdf/QPDF.cc | 4 ++-- libqpdf/QPDFFormFieldObjectHelper.cc | 2 +- libqpdf/QPDFJob.cc | 2 +- libqpdf/QPDFJob_argv.cc | 6 +++--- libqpdf/QPDFObjectHandle.cc | 6 +++--- libqpdf/QPDFSystemError.cc | 2 +- libqpdf/QPDFTokenizer.cc | 4 ++-- libqpdf/QPDFWriter.cc | 2 +- libqpdf/QPDF_encryption.cc | 2 +- libqpdf/QPDF_linearization.cc | 4 ++-- libqpdf/QTC.cc | 2 +- libqpdf/QUtil.cc | 10 +++++----- libqpdf/qpdf/BitStream.hh | 2 +- libqpdf/qpdf/BitWriter.hh | 2 +- libtests/aes.cc | 6 +++--- libtests/ascii85.cc | 2 +- libtests/bits.cc | 2 +- libtests/buffer.cc | 2 +- libtests/closed_file_input_source.cc | 2 +- libtests/dct_compress.cc | 6 +++--- libtests/dct_uncompress.cc | 4 ++-- libtests/flate.cc | 2 +- libtests/hex.cc | 2 +- libtests/lzw.cc | 4 ++-- libtests/md5.cc | 2 +- libtests/predictors.cc | 4 ++-- libtests/qintc.cc | 2 +- libtests/qutil.cc | 6 +++--- libtests/rc4.cc | 6 +++--- libtests/runlength.cc | 6 +++--- libtests/sha2.cc | 2 +- qpdf/pdf_from_scratch.cc | 6 +++--- qpdf/test_driver.cc | 8 ++++---- qpdf/test_large_file.cc | 4 ++-- qpdf/test_pdf_doc_encoding.cc | 4 ++-- qpdf/test_pdf_unicode.cc | 4 ++-- qpdf/test_tokenizer.cc | 6 +++--- qpdf/test_unicode_filenames.cc | 4 ++-- zlib-flate/zlib-flate.cc | 6 +++--- 73 files changed, 121 insertions(+), 121 deletions(-) diff --git a/examples/pdf-bookmarks.cc b/examples/pdf-bookmarks.cc index b6f87e49..d507f559 100644 --- a/examples/pdf-bookmarks.cc +++ b/examples/pdf-bookmarks.cc @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include +#include // This program demonstrates extraction of bookmarks using the qpdf // outlines API. Note that all the information shown by this program diff --git a/examples/pdf-count-strings.cc b/examples/pdf-count-strings.cc index 09c4a1f5..584d630b 100644 --- a/examples/pdf-count-strings.cc +++ b/examples/pdf-count-strings.cc @@ -5,7 +5,7 @@ // #include -#include +#include #include #include diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc index 56af4a8d..7898479a 100644 --- a/examples/pdf-create.cc +++ b/examples/pdf-create.cc @@ -16,7 +16,7 @@ #include #include #include -#include +#include static char const* whoami = nullptr; diff --git a/examples/pdf-double-page-size.cc b/examples/pdf-double-page-size.cc index 1ebe71df..d1fb3344 100644 --- a/examples/pdf-double-page-size.cc +++ b/examples/pdf-double-page-size.cc @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include +#include static char const* whoami = nullptr; diff --git a/examples/pdf-filter-tokens.cc b/examples/pdf-filter-tokens.cc index 8824b391..173feb6a 100644 --- a/examples/pdf-filter-tokens.cc +++ b/examples/pdf-filter-tokens.cc @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include diff --git a/examples/pdf-invert-images.cc b/examples/pdf-invert-images.cc index 9ffb9c1f..06d74198 100644 --- a/examples/pdf-invert-images.cc +++ b/examples/pdf-invert-images.cc @@ -6,8 +6,8 @@ #include #include #include -#include -#include +#include +#include static char const* whoami = nullptr; diff --git a/examples/pdf-mod-info.cc b/examples/pdf-mod-info.cc index fa49738b..196ce979 100644 --- a/examples/pdf-mod-info.cc +++ b/examples/pdf-mod-info.cc @@ -6,9 +6,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include static char const* version = "1.1"; static char const* whoami = nullptr; diff --git a/examples/pdf-npages.cc b/examples/pdf-npages.cc index 3d34d489..e98d1365 100644 --- a/examples/pdf-npages.cc +++ b/examples/pdf-npages.cc @@ -1,6 +1,6 @@ #include -#include -#include +#include +#include #include #include diff --git a/examples/pdf-overlay-page.cc b/examples/pdf-overlay-page.cc index d40bf0e1..5c7bf46f 100644 --- a/examples/pdf-overlay-page.cc +++ b/examples/pdf-overlay-page.cc @@ -4,7 +4,7 @@ #include #include #include -#include +#include // This program demonstrates use of form XObjects to overlay a page // from one file onto all pages of another file. The qpdf program's diff --git a/examples/pdf-parse-content.cc b/examples/pdf-parse-content.cc index 85abcabc..49440418 100644 --- a/examples/pdf-parse-content.cc +++ b/examples/pdf-parse-content.cc @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/examples/pdf-set-form-values.cc b/examples/pdf-set-form-values.cc index 281e139e..d13f0608 100644 --- a/examples/pdf-set-form-values.cc +++ b/examples/pdf-set-form-values.cc @@ -4,7 +4,7 @@ #include #include #include -#include +#include static char const* whoami = nullptr; diff --git a/examples/pdf-split-pages.cc b/examples/pdf-split-pages.cc index 5d65853e..6a4f149b 100644 --- a/examples/pdf-split-pages.cc +++ b/examples/pdf-split-pages.cc @@ -12,7 +12,7 @@ #include #include -#include +#include #include static bool static_id = false; diff --git a/include/qpdf/Buffer.hh b/include/qpdf/Buffer.hh index c5d55da1..06615e2c 100644 --- a/include/qpdf/Buffer.hh +++ b/include/qpdf/Buffer.hh @@ -26,7 +26,7 @@ #include // unused -- remove in qpdf 12 (see #785) #include -#include +#include class Buffer { diff --git a/include/qpdf/InputSource.hh b/include/qpdf/InputSource.hh index 68a787c6..c66066fb 100644 --- a/include/qpdf/InputSource.hh +++ b/include/qpdf/InputSource.hh @@ -27,7 +27,7 @@ #include #include -#include +#include #include // Remember to use QPDF_DLL_CLASS on anything derived from InputSource diff --git a/include/qpdf/Pl_StdioFile.hh b/include/qpdf/Pl_StdioFile.hh index 1508af2b..d175d3c3 100644 --- a/include/qpdf/Pl_StdioFile.hh +++ b/include/qpdf/Pl_StdioFile.hh @@ -26,7 +26,7 @@ #include -#include +#include // // This pipeline is reusable. diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 4541db64..5567a686 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/qpdf/QPDFTokenizer.hh b/include/qpdf/QPDFTokenizer.hh index 79d0d3cd..4de7a637 100644 --- a/include/qpdf/QPDFTokenizer.hh +++ b/include/qpdf/QPDFTokenizer.hh @@ -28,7 +28,7 @@ #include // unused -- remove in qpdf 12 (see #785) #include -#include +#include #include class QPDFTokenizer diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh index c2896209..15b5579f 100644 --- a/include/qpdf/QPDFWriter.hh +++ b/include/qpdf/QPDFWriter.hh @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index 4d46f630..5291fe09 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -30,9 +30,9 @@ #include #include #include -#include +#include #include -#include +#include #include class RandomDataProvider; diff --git a/include/qpdf/RandomDataProvider.hh b/include/qpdf/RandomDataProvider.hh index 5023b4d0..d40bd1f1 100644 --- a/include/qpdf/RandomDataProvider.hh +++ b/include/qpdf/RandomDataProvider.hh @@ -23,7 +23,7 @@ #define RANDOMDATAPROVIDER_HH #include -#include // for size_t +#include // for size_t class QPDF_DLL_CLASS RandomDataProvider { diff --git a/libqpdf/BufferInputSource.cc b/libqpdf/BufferInputSource.cc index 005692ae..33ab44f6 100644 --- a/libqpdf/BufferInputSource.cc +++ b/libqpdf/BufferInputSource.cc @@ -3,7 +3,7 @@ #include #include #include -#include +#include BufferInputSource::BufferInputSource( std::string const& description, Buffer* buf, bool own_memory) : diff --git a/libqpdf/FileInputSource.cc b/libqpdf/FileInputSource.cc index 7c4d6d42..a5f0f4f0 100644 --- a/libqpdf/FileInputSource.cc +++ b/libqpdf/FileInputSource.cc @@ -3,7 +3,7 @@ #include #include #include -#include +#include FileInputSource::FileInputSource() : close_file(false), diff --git a/libqpdf/InputSource.cc b/libqpdf/InputSource.cc index 33ab44d1..3a4bb88a 100644 --- a/libqpdf/InputSource.cc +++ b/libqpdf/InputSource.cc @@ -3,7 +3,7 @@ #include #include #include -#include +#include void InputSource::setLastOffset(qpdf_offset_t offset) diff --git a/libqpdf/InsecureRandomDataProvider.cc b/libqpdf/InsecureRandomDataProvider.cc index cb67cada..90a548ee 100644 --- a/libqpdf/InsecureRandomDataProvider.cc +++ b/libqpdf/InsecureRandomDataProvider.cc @@ -2,7 +2,7 @@ #include #include -#include +#include InsecureRandomDataProvider::InsecureRandomDataProvider() : seeded_random(false) diff --git a/libqpdf/MD5.cc b/libqpdf/MD5.cc index 57419374..9668c982 100644 --- a/libqpdf/MD5.cc +++ b/libqpdf/MD5.cc @@ -4,7 +4,7 @@ #include #include -#include +#include MD5::MD5() { diff --git a/libqpdf/Pl_ASCII85Decoder.cc b/libqpdf/Pl_ASCII85Decoder.cc index 1e3d1b4f..e43b4a86 100644 --- a/libqpdf/Pl_ASCII85Decoder.cc +++ b/libqpdf/Pl_ASCII85Decoder.cc @@ -2,7 +2,7 @@ #include #include -#include +#include Pl_ASCII85Decoder::Pl_ASCII85Decoder(char const* identifier, Pipeline* next) : Pipeline(identifier, next), diff --git a/libqpdf/Pl_ASCIIHexDecoder.cc b/libqpdf/Pl_ASCIIHexDecoder.cc index 48836f58..5590efba 100644 --- a/libqpdf/Pl_ASCIIHexDecoder.cc +++ b/libqpdf/Pl_ASCIIHexDecoder.cc @@ -1,7 +1,7 @@ #include #include -#include +#include #include Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) : diff --git a/libqpdf/Pl_Buffer.cc b/libqpdf/Pl_Buffer.cc index ca29ef60..d942465d 100644 --- a/libqpdf/Pl_Buffer.cc +++ b/libqpdf/Pl_Buffer.cc @@ -2,8 +2,8 @@ #include #include -#include -#include +#include +#include Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) : Pipeline(identifier, next), diff --git a/libqpdf/Pl_DCT.cc b/libqpdf/Pl_DCT.cc index 35587875..c01398ad 100644 --- a/libqpdf/Pl_DCT.cc +++ b/libqpdf/Pl_DCT.cc @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/libqpdf/Pl_Flate.cc b/libqpdf/Pl_Flate.cc index 61873ffa..6bbcd1be 100644 --- a/libqpdf/Pl_Flate.cc +++ b/libqpdf/Pl_Flate.cc @@ -1,7 +1,7 @@ #include -#include -#include +#include +#include #include #include diff --git a/libqpdf/Pl_LZWDecoder.cc b/libqpdf/Pl_LZWDecoder.cc index 000fb64b..1c2d6807 100644 --- a/libqpdf/Pl_LZWDecoder.cc +++ b/libqpdf/Pl_LZWDecoder.cc @@ -4,7 +4,7 @@ #include #include #include -#include +#include Pl_LZWDecoder::Pl_LZWDecoder( char const* identifier, Pipeline* next, bool early_code_change) : diff --git a/libqpdf/Pl_PNGFilter.cc b/libqpdf/Pl_PNGFilter.cc index e2a9a0db..41088e1a 100644 --- a/libqpdf/Pl_PNGFilter.cc +++ b/libqpdf/Pl_PNGFilter.cc @@ -3,9 +3,9 @@ #include #include -#include +#include #include -#include +#include static int abs_diff(int a, int b) diff --git a/libqpdf/Pl_StdioFile.cc b/libqpdf/Pl_StdioFile.cc index dca16bf6..b83d0a9e 100644 --- a/libqpdf/Pl_StdioFile.cc +++ b/libqpdf/Pl_StdioFile.cc @@ -3,7 +3,7 @@ #include #include -#include +#include #include Pl_StdioFile::Members::Members(FILE* f) : diff --git a/libqpdf/Pl_TIFFPredictor.cc b/libqpdf/Pl_TIFFPredictor.cc index c29396db..45b6d396 100644 --- a/libqpdf/Pl_TIFFPredictor.cc +++ b/libqpdf/Pl_TIFFPredictor.cc @@ -5,9 +5,9 @@ #include #include -#include +#include #include -#include +#include #include Pl_TIFFPredictor::Pl_TIFFPredictor( diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index c7cc1370..bc88b5d6 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -9,8 +9,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/libqpdf/QPDFFormFieldObjectHelper.cc b/libqpdf/QPDFFormFieldObjectHelper.cc index e76e3121..93dc0e63 100644 --- a/libqpdf/QPDFFormFieldObjectHelper.cc +++ b/libqpdf/QPDFFormFieldObjectHelper.cc @@ -6,7 +6,7 @@ #include #include #include -#include +#include QPDFFormFieldObjectHelper::QPDFFormFieldObjectHelper(QPDFObjectHandle oh) : QPDFObjectHelper(oh), diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index fbaa53e5..14583104 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libqpdf/QPDFJob_argv.cc b/libqpdf/QPDFJob_argv.cc index 55696f5d..5534cd39 100644 --- a/libqpdf/QPDFJob_argv.cc +++ b/libqpdf/QPDFJob_argv.cc @@ -3,12 +3,12 @@ // See "HOW TO ADD A COMMAND-LINE ARGUMENT" in README-maintainer. #include -#include +#include #include #include #include -#include -#include +#include +#include #include #include diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index b3f208a5..e276bf4f 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -30,10 +30,10 @@ #include #include -#include -#include +#include +#include #include -#include +#include using namespace std::literals; diff --git a/libqpdf/QPDFSystemError.cc b/libqpdf/QPDFSystemError.cc index 65fa3121..ebd0d773 100644 --- a/libqpdf/QPDFSystemError.cc +++ b/libqpdf/QPDFSystemError.cc @@ -1,6 +1,6 @@ #include -#include +#include QPDFSystemError::QPDFSystemError( std::string const& description, int system_errno) : diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc index d8d457ab..d83080b2 100644 --- a/libqpdf/QPDFTokenizer.cc +++ b/libqpdf/QPDFTokenizer.cc @@ -11,8 +11,8 @@ #include #include -#include -#include +#include +#include static inline bool is_delimiter(char ch) diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index de1aa45b..56b4e1ef 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -24,7 +24,7 @@ #include #include -#include +#include QPDFWriter::ProgressReporter::~ProgressReporter() { diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc index 2e5ddefb..64ca10f1 100644 --- a/libqpdf/QPDF_encryption.cc +++ b/libqpdf/QPDF_encryption.cc @@ -17,7 +17,7 @@ #include #include -#include +#include static unsigned char const padding_string[] = { 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc index 5b72943a..eade317e 100644 --- a/libqpdf/QPDF_linearization.cc +++ b/libqpdf/QPDF_linearization.cc @@ -13,8 +13,8 @@ #include #include -#include -#include +#include +#include template static void diff --git a/libqpdf/QTC.cc b/libqpdf/QTC.cc index 8188846c..e537a0e1 100644 --- a/libqpdf/QTC.cc +++ b/libqpdf/QTC.cc @@ -3,7 +3,7 @@ #include #include #include -#include +#include static bool tc_active(char const* const scope) diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index 72b2a55f..4f9c1021 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -9,8 +9,8 @@ #include #include -#include -#include +#include +#include #include #include #include @@ -21,9 +21,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #ifndef QPDF_NO_WCHAR_T # include #endif diff --git a/libqpdf/qpdf/BitStream.hh b/libqpdf/qpdf/BitStream.hh index 14555c5d..b807f56c 100644 --- a/libqpdf/qpdf/BitStream.hh +++ b/libqpdf/qpdf/BitStream.hh @@ -3,7 +3,7 @@ #ifndef BITSTREAM_HH #define BITSTREAM_HH -#include +#include class BitStream { diff --git a/libqpdf/qpdf/BitWriter.hh b/libqpdf/qpdf/BitWriter.hh index ca237d47..33fdd8f4 100644 --- a/libqpdf/qpdf/BitWriter.hh +++ b/libqpdf/qpdf/BitWriter.hh @@ -3,7 +3,7 @@ #ifndef BITWRITER_HH #define BITWRITER_HH -#include +#include class Pipeline; diff --git a/libtests/aes.cc b/libtests/aes.cc index 3ad491cc..4541fffe 100644 --- a/libtests/aes.cc +++ b/libtests/aes.cc @@ -4,9 +4,9 @@ #include #include -#include -#include -#include +#include +#include +#include static void usage() diff --git a/libtests/ascii85.cc b/libtests/ascii85.cc index 2acc56ba..8d926898 100644 --- a/libtests/ascii85.cc +++ b/libtests/ascii85.cc @@ -2,7 +2,7 @@ #include #include -#include +#include int main() diff --git a/libtests/bits.cc b/libtests/bits.cc index 0db956e1..e63ebdd3 100644 --- a/libtests/bits.cc +++ b/libtests/bits.cc @@ -4,7 +4,7 @@ #include #include #include -#include +#include // See comments in bits_functions.hh #define BITS_TESTING 1 diff --git a/libtests/buffer.cc b/libtests/buffer.cc index f372e7b4..66eaa71c 100644 --- a/libtests/buffer.cc +++ b/libtests/buffer.cc @@ -7,7 +7,7 @@ #include #include #include -#include +#include static unsigned char* uc(char const* s) diff --git a/libtests/closed_file_input_source.cc b/libtests/closed_file_input_source.cc index 23b15154..183658a9 100644 --- a/libtests/closed_file_input_source.cc +++ b/libtests/closed_file_input_source.cc @@ -2,7 +2,7 @@ #include #include -#include +#include void check(std::string const& what, bool result) diff --git a/libtests/dct_compress.cc b/libtests/dct_compress.cc index ad8710b1..2f12aea7 100644 --- a/libtests/dct_compress.cc +++ b/libtests/dct_compress.cc @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include static void usage() diff --git a/libtests/dct_uncompress.cc b/libtests/dct_uncompress.cc index 5e1e9a33..6606e4a5 100644 --- a/libtests/dct_uncompress.cc +++ b/libtests/dct_uncompress.cc @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include int main(int argc, char* argv[]) diff --git a/libtests/flate.cc b/libtests/flate.cc index 1170841b..93c41f85 100644 --- a/libtests/flate.cc +++ b/libtests/flate.cc @@ -5,7 +5,7 @@ #include #include -#include +#include void run(char const* filename) diff --git a/libtests/hex.cc b/libtests/hex.cc index 9e708204..d239d202 100644 --- a/libtests/hex.cc +++ b/libtests/hex.cc @@ -2,7 +2,7 @@ #include #include -#include +#include int main() diff --git a/libtests/lzw.cc b/libtests/lzw.cc index 788d3dfc..412ce4c5 100644 --- a/libtests/lzw.cc +++ b/libtests/lzw.cc @@ -3,8 +3,8 @@ #include #include #include -#include -#include +#include +#include int main(int argc, char* argv[]) diff --git a/libtests/md5.cc b/libtests/md5.cc index 0fe4205e..27aaad51 100644 --- a/libtests/md5.cc +++ b/libtests/md5.cc @@ -3,7 +3,7 @@ #include #include #include -#include +#include static void test_string(char const* str) diff --git a/libtests/predictors.cc b/libtests/predictors.cc index f0bde79a..fd1cc2ad 100644 --- a/libtests/predictors.cc +++ b/libtests/predictors.cc @@ -7,8 +7,8 @@ #include #include -#include -#include +#include +#include void run(char const* filename, diff --git a/libtests/qintc.cc b/libtests/qintc.cc index f6c15f00..0cf3924f 100644 --- a/libtests/qintc.cc +++ b/libtests/qintc.cc @@ -1,7 +1,7 @@ #include #include -#include +#include #define try_convert(exp_pass, fn, i) \ try_convert_real(#fn "(" #i ")", exp_pass, fn, i) diff --git a/libtests/qutil.cc b/libtests/qutil.cc index b9012db9..a6f1282a 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -5,9 +5,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #ifdef _WIN32 # include diff --git a/libtests/rc4.cc b/libtests/rc4.cc index a6a1328e..874c11ff 100644 --- a/libtests/rc4.cc +++ b/libtests/rc4.cc @@ -6,9 +6,9 @@ #include #include -#include -#include -#include +#include +#include +#include static void other_tests() diff --git a/libtests/runlength.cc b/libtests/runlength.cc index 456e33a2..260ce5cb 100644 --- a/libtests/runlength.cc +++ b/libtests/runlength.cc @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include int main(int argc, char* argv[]) diff --git a/libtests/sha2.cc b/libtests/sha2.cc index 46ccd5c2..4be8956a 100644 --- a/libtests/sha2.cc +++ b/libtests/sha2.cc @@ -1,7 +1,7 @@ #include #include #include -#include +#include static void test( diff --git a/qpdf/pdf_from_scratch.cc b/qpdf/pdf_from_scratch.cc index 4e1c6553..1b172964 100644 --- a/qpdf/pdf_from_scratch.cc +++ b/qpdf/pdf_from_scratch.cc @@ -5,9 +5,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include static char const* whoami = 0; diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index 39631d21..673c6b58 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -27,12 +27,12 @@ #include #include #include -#include +#include #include #include -#include -#include -#include +#include +#include +#include #define QPDF_OBJECT_NOWARN #include diff --git a/qpdf/test_large_file.cc b/qpdf/test_large_file.cc index e8bea103..b30967c7 100644 --- a/qpdf/test_large_file.cc +++ b/qpdf/test_large_file.cc @@ -13,8 +13,8 @@ #include #include #include -#include -#include +#include +#include // Run "test_large_file write small a.pdf" to get a PDF file that you // can look at in a reader. diff --git a/qpdf/test_pdf_doc_encoding.cc b/qpdf/test_pdf_doc_encoding.cc index 5c67f59a..cd2e9b42 100644 --- a/qpdf/test_pdf_doc_encoding.cc +++ b/qpdf/test_pdf_doc_encoding.cc @@ -1,8 +1,8 @@ #include #include #include -#include -#include +#include +#include static char const* whoami = 0; diff --git a/qpdf/test_pdf_unicode.cc b/qpdf/test_pdf_unicode.cc index 38df6daa..b28edeaf 100644 --- a/qpdf/test_pdf_unicode.cc +++ b/qpdf/test_pdf_unicode.cc @@ -1,8 +1,8 @@ #include #include #include -#include -#include +#include +#include static char const* whoami = 0; diff --git a/qpdf/test_tokenizer.cc b/qpdf/test_tokenizer.cc index 83d3e1c8..8a58fc8e 100644 --- a/qpdf/test_tokenizer.cc +++ b/qpdf/test_tokenizer.cc @@ -7,9 +7,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include static char const* whoami = 0; diff --git a/qpdf/test_unicode_filenames.cc b/qpdf/test_unicode_filenames.cc index 3d9e8038..b2fd50f3 100644 --- a/qpdf/test_unicode_filenames.cc +++ b/qpdf/test_unicode_filenames.cc @@ -6,8 +6,8 @@ #endif #include -#include -#include +#include +#include static void do_copy(FILE* in, FILE* out) diff --git a/zlib-flate/zlib-flate.cc b/zlib-flate/zlib-flate.cc index f7d0c807..8f0f087a 100644 --- a/zlib-flate/zlib-flate.cc +++ b/zlib-flate/zlib-flate.cc @@ -5,9 +5,9 @@ #include #include -#include -#include -#include +#include +#include +#include static char const* whoami = 0; From d0682f0f609e979ba085d93a1a0d8e0559f739bb Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 12:46:50 +0100 Subject: [PATCH 3/8] Use nullptr instead of 0 or NULL --- examples/qpdfjob-remove-annotations.cc | 2 +- include/qpdf/Pl_Buffer.hh | 2 +- include/qpdf/Pl_DCT.hh | 4 ++-- include/qpdf/Pl_QPDFTokenizer.hh | 2 +- include/qpdf/QPDF.hh | 8 ++++---- include/qpdf/QPDFCryptoImpl.hh | 2 +- include/qpdf/QPDFJob.hh | 2 +- include/qpdf/QPDFObjectHandle.hh | 4 ++-- include/qpdf/QPDFOutlineObjectHelper.hh | 2 +- include/qpdf/QPDFPageObjectHelper.hh | 4 ++-- include/qpdf/QPDFWriter.hh | 2 +- include/qpdf/QUtil.hh | 2 +- libqpdf/QUtil.cc | 4 ++-- libqpdf/qpdf/Pl_SHA2.hh | 2 +- libqpdf/qpdf/QPDFArgParser.hh | 6 +++--- libqpdf/qpdf/QPDFCrypto_openssl.hh | 2 +- libtests/aes.cc | 12 ++++++------ libtests/arg_parser.cc | 2 +- libtests/numrange.cc | 2 +- libtests/predictors.cc | 2 +- libtests/qutil.cc | 2 +- libtests/random.cc | 2 +- libtests/rc4.cc | 2 +- qpdf/fix-qdf.cc | 6 +++--- qpdf/pdf_from_scratch.cc | 4 ++-- qpdf/qpdf.cc | 2 +- qpdf/test_driver.cc | 26 ++++++++++++------------- qpdf/test_large_file.cc | 8 ++++---- qpdf/test_pdf_doc_encoding.cc | 4 ++-- qpdf/test_pdf_unicode.cc | 4 ++-- qpdf/test_tokenizer.cc | 10 +++++----- qpdf/test_unicode_filenames.cc | 2 +- zlib-flate/zlib-flate.cc | 4 ++-- 33 files changed, 72 insertions(+), 72 deletions(-) diff --git a/examples/qpdfjob-remove-annotations.cc b/examples/qpdfjob-remove-annotations.cc index fd8754d5..5334e7dc 100644 --- a/examples/qpdfjob-remove-annotations.cc +++ b/examples/qpdfjob-remove-annotations.cc @@ -11,7 +11,7 @@ // The example is a full copy of the qpdf program modified to allways remove all // annotations from the final output. -static char const* whoami = 0; +static char const* whoami = nullptr; static void usageExit(std::string const& msg) diff --git a/include/qpdf/Pl_Buffer.hh b/include/qpdf/Pl_Buffer.hh index e2f71094..fcef0c56 100644 --- a/include/qpdf/Pl_Buffer.hh +++ b/include/qpdf/Pl_Buffer.hh @@ -43,7 +43,7 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline { public: QPDF_DLL - Pl_Buffer(char const* identifier, Pipeline* next = 0); + Pl_Buffer(char const* identifier, Pipeline* next = nullptr); QPDF_DLL virtual ~Pl_Buffer(); QPDF_DLL diff --git a/include/qpdf/Pl_DCT.hh b/include/qpdf/Pl_DCT.hh index 543967ec..9352091f 100644 --- a/include/qpdf/Pl_DCT.hh +++ b/include/qpdf/Pl_DCT.hh @@ -57,7 +57,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline JDIMENSION image_height, int components, J_COLOR_SPACE color_space, - CompressConfig* config_callback = 0); + CompressConfig* config_callback = nullptr); QPDF_DLL virtual ~Pl_DCT(); @@ -91,7 +91,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline JDIMENSION image_height = 0, int components = 1, J_COLOR_SPACE color_space = JCS_GRAYSCALE, - CompressConfig* config_callback = 0); + CompressConfig* config_callback = nullptr); Members(Members const&) = delete; action_e action; diff --git a/include/qpdf/Pl_QPDFTokenizer.hh b/include/qpdf/Pl_QPDFTokenizer.hh index ce3615ec..0b8cafc2 100644 --- a/include/qpdf/Pl_QPDFTokenizer.hh +++ b/include/qpdf/Pl_QPDFTokenizer.hh @@ -51,7 +51,7 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline Pl_QPDFTokenizer( char const* identifier, QPDFObjectHandle::TokenFilter* filter, - Pipeline* next = 0); + Pipeline* next = nullptr); QPDF_DLL virtual ~Pl_QPDFTokenizer(); QPDF_DLL diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 5567a686..03490af7 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -83,7 +83,7 @@ class QPDF // interpreted as a raw encryption key. See comments on // setPasswordIsHexKey for more information. QPDF_DLL - void processFile(char const* filename, char const* password = 0); + void processFile(char const* filename, char const* password = nullptr); // Parse a PDF from a stdio FILE*. The FILE must be open in // binary mode and must be seekable. It may be open read only. @@ -96,7 +96,7 @@ class QPDF char const* description, FILE* file, bool close_file, - char const* password = 0); + char const* password = nullptr); // Parse a PDF file loaded into a memory buffer. This works // exactly like processFile except that the PDF file is in memory @@ -107,14 +107,14 @@ class QPDF char const* description, char const* buf, size_t length, - char const* password = 0); + char const* password = nullptr); // Parse a PDF file loaded from a custom InputSource. If you have // your own method of retrieving a PDF file, you can subclass // InputSource and use this method. QPDF_DLL void - processInputSource(std::shared_ptr, char const* password = 0); + processInputSource(std::shared_ptr, char const* password = nullptr); // Create a PDF from an input source that contains JSON as written // by writeJSON (or qpdf --json-output, version 2 or higher). The diff --git a/include/qpdf/QPDFCryptoImpl.hh b/include/qpdf/QPDFCryptoImpl.hh index 5345b45b..3fd64d3a 100644 --- a/include/qpdf/QPDFCryptoImpl.hh +++ b/include/qpdf/QPDFCryptoImpl.hh @@ -80,7 +80,7 @@ class QPDF_DLL_CLASS QPDFCryptoImpl virtual void RC4_process( unsigned char const* in_data, size_t len, - unsigned char* out_data = 0) = 0; + unsigned char* out_data = nullptr) = 0; QPDF_DLL virtual void RC4_finalize() = 0; diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh index 2a82d61c..7396cd6a 100644 --- a/include/qpdf/QPDFJob.hh +++ b/include/qpdf/QPDFJob.hh @@ -497,7 +497,7 @@ class QPDFJob // Helper functions static void usage(std::string const& msg); - static JSON json_schema(int json_version, std::set* keys = 0); + static JSON json_schema(int json_version, std::set* keys = nullptr); static void parse_object_id( std::string const& objspec, bool& trailer, int& obj, int& gen); void parseRotationParameter(std::string const&); diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index ee424e39..198ca42e 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -526,7 +526,7 @@ class QPDFObjectHandle QPDF_DLL void parsePageContents(ParserCallbacks* callbacks); QPDF_DLL - void filterPageContents(TokenFilter* filter, Pipeline* next = 0); + void filterPageContents(TokenFilter* filter, Pipeline* next = nullptr); // See comments for QPDFPageObjectHelper::pipeContents. QPDF_DLL void pipePageContents(Pipeline* p); @@ -538,7 +538,7 @@ class QPDFObjectHandle // contents. This can be used to apply a TokenFilter to a form // XObject, whose data is in the same format as a content stream. QPDF_DLL - void filterAsContents(TokenFilter* filter, Pipeline* next = 0); + void filterAsContents(TokenFilter* filter, Pipeline* next = nullptr); // Called on a stream to parse the stream as page contents. This // can be used to parse a form XObject. QPDF_DLL diff --git a/include/qpdf/QPDFOutlineObjectHelper.hh b/include/qpdf/QPDFOutlineObjectHelper.hh index c8b82a80..507a4a51 100644 --- a/include/qpdf/QPDFOutlineObjectHelper.hh +++ b/include/qpdf/QPDFOutlineObjectHelper.hh @@ -42,7 +42,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper { // This must be cleared explicitly to avoid circular references // that prevent cleanup of pointer holders. - this->m->parent = 0; + this->m->parent = nullptr; } // All constructors are private. You can only create one of these diff --git a/include/qpdf/QPDFPageObjectHelper.hh b/include/qpdf/QPDFPageObjectHelper.hh index ebb9e87e..9f647c70 100644 --- a/include/qpdf/QPDFPageObjectHelper.hh +++ b/include/qpdf/QPDFPageObjectHelper.hh @@ -320,12 +320,12 @@ class QPDFPageObjectHelper: public QPDFObjectHelper // examples/pdf-count-strings.cc for an example. QPDF_DLL void - filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0); + filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); // Old name -- calls filterContents() QPDF_DLL void filterPageContents( - QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0); + QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); // Pipe a page's contents through the given pipeline. This method // works whether the contents are a single stream or an array of diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh index 15b5579f..8305974c 100644 --- a/include/qpdf/QPDFWriter.hh +++ b/include/qpdf/QPDFWriter.hh @@ -539,7 +539,7 @@ class QPDFWriter friend class QPDFWriter; public: - PipelinePopper(QPDFWriter* qw, std::shared_ptr* bp = 0) : + PipelinePopper(QPDFWriter* qw, std::shared_ptr* bp = nullptr) : qw(qw), bp(bp) { diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index 5291fe09..2f7f15b2 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -245,7 +245,7 @@ namespace QUtil // Returns true iff the variable is defined. If `value' is // non-null, initializes it with the value of the variable. QPDF_DLL - bool get_env(std::string const& var, std::string* value = 0); + bool get_env(std::string const& var, std::string* value = nullptr); QPDF_DLL time_t get_current_time(); diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index 4f9c1021..a542736d 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -836,8 +836,8 @@ char* QUtil::getWhoami(char* argv0) { char* whoami = nullptr; - if (((whoami = strrchr(argv0, '/')) == NULL) && - ((whoami = strrchr(argv0, '\\')) == NULL)) { + if (((whoami = strrchr(argv0, '/')) == nullptr) && + ((whoami = strrchr(argv0, '\\')) == nullptr)) { whoami = argv0; } else { ++whoami; diff --git a/libqpdf/qpdf/Pl_SHA2.hh b/libqpdf/qpdf/Pl_SHA2.hh index d5b2e547..99a19a37 100644 --- a/libqpdf/qpdf/Pl_SHA2.hh +++ b/libqpdf/qpdf/Pl_SHA2.hh @@ -20,7 +20,7 @@ class Pl_SHA2: public Pipeline { public: - Pl_SHA2(int bits = 0, Pipeline* next = 0); + Pl_SHA2(int bits = 0, Pipeline* next = nullptr); virtual ~Pl_SHA2() = default; virtual void write(unsigned char const*, size_t); virtual void finish(); diff --git a/libqpdf/qpdf/QPDFArgParser.hh b/libqpdf/qpdf/QPDFArgParser.hh index 89c7acc0..759ad148 100644 --- a/libqpdf/qpdf/QPDFArgParser.hh +++ b/libqpdf/qpdf/QPDFArgParser.hh @@ -177,9 +177,9 @@ class QPDFArgParser { OptionEntry() : parameter_needed(false), - bare_arg_handler(0), - param_arg_handler(0), - invalid_choice_handler(0) + bare_arg_handler(nullptr), + param_arg_handler(nullptr), + invalid_choice_handler(nullptr) { } bool parameter_needed; diff --git a/libqpdf/qpdf/QPDFCrypto_openssl.hh b/libqpdf/qpdf/QPDFCrypto_openssl.hh index eae69ab1..0d07b99b 100644 --- a/libqpdf/qpdf/QPDFCrypto_openssl.hh +++ b/libqpdf/qpdf/QPDFCrypto_openssl.hh @@ -39,7 +39,7 @@ class QPDFCrypto_openssl: public QPDFCryptoImpl void RC4_process( unsigned char const* in_data, size_t len, - unsigned char* out_data = 0) override; + unsigned char* out_data = nullptr) override; void RC4_finalize() override; void SHA2_init(int bits) override; diff --git a/libtests/aes.cc b/libtests/aes.cc index 4541fffe..5ae8152a 100644 --- a/libtests/aes.cc +++ b/libtests/aes.cc @@ -29,9 +29,9 @@ main(int argc, char* argv[]) { bool encrypt = true; bool cbc_mode = true; - char* hexkey = 0; - char* infilename = 0; - char* outfilename = 0; + char* hexkey = nullptr; + char* infilename = nullptr; + char* outfilename = nullptr; bool zero_iv = false; bool static_iv = false; bool disable_padding = false; @@ -65,7 +65,7 @@ main(int argc, char* argv[]) usage(); } } - if (outfilename == 0) { + if (outfilename == nullptr) { usage(); } @@ -81,14 +81,14 @@ main(int argc, char* argv[]) t[1] = hexkey[i + 1]; t[2] = '\0'; - long val = strtol(t, 0, 16); + long val = strtol(t, nullptr, 16); key[i / 2] = static_cast(val); } Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile); Pl_AES_PDF* aes = new Pl_AES_PDF("aes_128_cbc", out, encrypt, key, keylen); delete[] key; - key = 0; + key = nullptr; if (!cbc_mode) { aes->disableCBC(); } diff --git a/libtests/arg_parser.cc b/libtests/arg_parser.cc index 6b4c829f..c9474d55 100644 --- a/libtests/arg_parser.cc +++ b/libtests/arg_parser.cc @@ -51,7 +51,7 @@ ArgParser::initOptions() ap.addBare("potato", b(&ArgParser::handlePotato)); ap.addRequiredParameter("salad", p(&ArgParser::handleSalad), "tossed"); ap.addOptionalParameter("moo", p(&ArgParser::handleMoo)); - char const* choices[] = {"pig", "boar", "sow", 0}; + char const* choices[] = {"pig", "boar", "sow", nullptr}; ap.addChoices("oink", p(&ArgParser::handleOink), true, choices); ap.selectHelpOptionTable(); ap.addBare("version", [this]() { output("3.14159"); }); diff --git a/libtests/numrange.cc b/libtests/numrange.cc index c0bf5bd7..ded03324 100644 --- a/libtests/numrange.cc +++ b/libtests/numrange.cc @@ -4,7 +4,7 @@ static void test_numrange(char const* range) { - if (range == 0) { + if (range == nullptr) { std::cout << "null" << std::endl; } else { std::vector result = QUtil::parse_numrange(range, 15); diff --git a/libtests/predictors.cc b/libtests/predictors.cc index fd1cc2ad..d7825bc6 100644 --- a/libtests/predictors.cc +++ b/libtests/predictors.cc @@ -21,7 +21,7 @@ run(char const* filename, FILE* in = QUtil::safe_fopen(filename, "rb"); FILE* o1 = QUtil::safe_fopen("out", "wb"); Pipeline* out = new Pl_StdioFile("out", o1); - Pipeline* pl = 0; + Pipeline* pl = nullptr; if (strcmp(filter, "png") == 0) { pl = new Pl_PNGFilter( "png", diff --git a/libtests/qutil.cc b/libtests/qutil.cc index a6f1282a..be5b6b1b 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -489,7 +489,7 @@ same_file_test() assert_same_file("qutil.out", "qutil.out", true); assert_same_file("qutil.out", "other-file", false); assert_same_file("qutil.out", "", false); - assert_same_file("qutil.out", 0, false); + assert_same_file("qutil.out", nullptr, false); assert_same_file("", "qutil.out", false); } diff --git a/libtests/random.cc b/libtests/random.cc index 40ef7d47..899c264c 100644 --- a/libtests/random.cc +++ b/libtests/random.cc @@ -56,7 +56,7 @@ main() if (!((buf[0] == 0) && (buf[1] == 1) && (buf[2] == 2) && (buf[3] == 3))) { std::cout << "fail: bogus random didn't provide correct bytes\n"; } - QUtil::setRandomDataProvider(0); + QUtil::setRandomDataProvider(nullptr); if (QUtil::getRandomDataProvider() != orig_rdp) { std::cout << "fail: passing null to setRandomDataProvider " "didn't reset the random data provider\n"; diff --git a/libtests/rc4.cc b/libtests/rc4.cc index 874c11ff..ca4af91d 100644 --- a/libtests/rc4.cc +++ b/libtests/rc4.cc @@ -51,7 +51,7 @@ main(int argc, char* argv[]) t[1] = hexkey[i + 1]; t[2] = '\0'; - long val = strtol(t, 0, 16); + long val = strtol(t, nullptr, 16); key[i / 2] = static_cast(val); } diff --git a/qpdf/fix-qdf.cc b/qpdf/fix-qdf.cc index 34b3d3dc..1d46971c 100644 --- a/qpdf/fix-qdf.cc +++ b/qpdf/fix-qdf.cc @@ -8,7 +8,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; static void usage() @@ -392,7 +392,7 @@ realmain(int argc, char* argv[]) { whoami = QUtil::getWhoami(argv[0]); QUtil::setLineBuf(stdout); - char const* filename = 0; + char const* filename = nullptr; if (argc > 2) { usage(); } else if ((argc > 1) && (strcmp(argv[1], "--version") == 0)) { @@ -405,7 +405,7 @@ realmain(int argc, char* argv[]) filename = argv[1]; } std::string input; - if (filename == 0) { + if (filename == nullptr) { filename = "standard input"; QUtil::binary_stdin(); input = QUtil::read_file_into_string(stdin); diff --git a/qpdf/pdf_from_scratch.cc b/qpdf/pdf_from_scratch.cc index 1b172964..41e52f9c 100644 --- a/qpdf/pdf_from_scratch.cc +++ b/qpdf/pdf_from_scratch.cc @@ -9,7 +9,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -86,7 +86,7 @@ int main(int argc, char* argv[]) { QUtil::setLineBuf(stdout); - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami; diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc index 815a86b4..08e94d38 100644 --- a/qpdf/qpdf.cc +++ b/qpdf/qpdf.cc @@ -6,7 +6,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; static void usageExit(std::string const& msg) diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index 673c6b58..e9e7754c 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -37,7 +37,7 @@ #define QPDF_OBJECT_NOWARN #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -286,7 +286,7 @@ test_0_1(QPDF& pdf, char const* arg2) qtest.pipeStreamData(out.get(), 0, qpdf_dl_none); std::cout << std::endl << "Uncompressed stream data:" << std::endl; - if (qtest.pipeStreamData(0, 0, qpdf_dl_all)) { + if (qtest.pipeStreamData(nullptr, 0, qpdf_dl_all)) { std::cout.flush(); QUtil::binary_stdout(); out = std::make_shared("filtered", stdout); @@ -387,7 +387,7 @@ test_4(QPDF& pdf, char const* arg2) } trailer.replaceKey("/Info", pdf.makeIndirectObject(qtest)); - QPDFWriter w(pdf, 0); + QPDFWriter w(pdf, nullptr); w.setQDFMode(true); w.setStaticID(true); w.write(); @@ -599,7 +599,7 @@ test_12(QPDF& pdf, char const* arg2) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif - pdf.setOutputStreams(0, 0); + pdf.setOutputStreams(nullptr, nullptr); #if (defined(__GNUC__) || defined(__clang__)) # pragma GCC diagnostic pop #endif @@ -1009,7 +1009,7 @@ test_25(QPDF& pdf, char const* arg2) // Copy qtest without crossing page boundaries. Should get O1 // and O2 and their streams but not O3 or any other pages. - assert(arg2 != 0); + assert(arg2 != nullptr); { // Make sure original PDF is out of scope when we write. QPDF oldpdf; @@ -1035,7 +1035,7 @@ test_26(QPDF& pdf, char const* arg2) { // Make sure original PDF is out of scope when we write. - assert(arg2 != 0); + assert(arg2 != nullptr); QPDF oldpdf; oldpdf.processFile(arg2); QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest"); @@ -1104,7 +1104,7 @@ test_27(QPDF& pdf, char const* arg2) QPDFObjectHandle s3 = QPDFObjectHandle::newStream(&empty3); s3.replaceStreamData( p2, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull()); - assert(arg2 != 0); + assert(arg2 != nullptr); QPDF oldpdf; oldpdf.processFile(arg2); QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest"); @@ -1151,7 +1151,7 @@ static void test_29(QPDF& pdf, char const* arg2) { // Detect mixed objects in QPDFWriter - assert(arg2 != 0); + assert(arg2 != nullptr); auto other = QPDF::create(); other->processFile(arg2); // We need to create a QPDF with mixed ownership to exercise @@ -1201,7 +1201,7 @@ test_29(QPDF& pdf, char const* arg2) static void test_30(QPDF& pdf, char const* arg2) { - assert(arg2 != 0); + assert(arg2 != nullptr); QPDF encrypted; encrypted.processFile(arg2, "user"); QPDFWriter w(pdf, "b.pdf"); @@ -1433,7 +1433,7 @@ test_40(QPDF& pdf, char const* arg2) // feature was implemented by Sahil Arora // as part of a Google Summer of // Code project in 2017. - assert(arg2 != 0); + assert(arg2 != nullptr); QPDFWriter w(pdf, arg2); w.setPCLm(true); w.setStaticID(true); @@ -3558,11 +3558,11 @@ runtest(int n, char const* filename1, char const* arg2) QPDF pdf; std::shared_ptr file_buf; - FILE* filep = 0; + FILE* filep = nullptr; if (n == 0) { pdf.setAttemptRecovery(false); } - if (((n == 35) || (n == 36)) && (arg2 != 0)) { + if (((n == 35) || (n == 36)) && (arg2 != nullptr)) { // arg2 is password pdf.processFile(filename1, arg2); } else if (n == 45) { @@ -3652,7 +3652,7 @@ int main(int argc, char* argv[]) { QUtil::setLineBuf(stdout); - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami; diff --git a/qpdf/test_large_file.cc b/qpdf/test_large_file.cc index b30967c7..aea7c0c5 100644 --- a/qpdf/test_large_file.cc +++ b/qpdf/test_large_file.cc @@ -35,7 +35,7 @@ // reading the large file then allows us to verify large file support // with confidence. -static char const* whoami = 0; +static char const* whoami = nullptr; // Height should be a multiple of 10 static size_t const nstripes = 10; @@ -47,7 +47,7 @@ static size_t const npages = 200; size_t stripesize = 0; size_t width = 0; size_t height = 0; -static unsigned char* buf = 0; +static unsigned char* buf = nullptr; static inline unsigned char get_pixel_color(size_t n, size_t row) @@ -73,7 +73,7 @@ class ImageChecker: public Pipeline }; ImageChecker::ImageChecker(size_t n) : - Pipeline("image checker", 0), + Pipeline("image checker", nullptr), n(n), offset(0), okay(true) @@ -122,7 +122,7 @@ ImageProvider::ImageProvider(size_t n) : void ImageProvider::provideStreamData(int objid, int generation, Pipeline* pipeline) { - if (buf == 0) { + if (buf == nullptr) { buf = new unsigned char[width * stripesize]; } std::cout << "page " << n << " of " << npages << std::endl; diff --git a/qpdf/test_pdf_doc_encoding.cc b/qpdf/test_pdf_doc_encoding.cc index cd2e9b42..e7aba030 100644 --- a/qpdf/test_pdf_doc_encoding.cc +++ b/qpdf/test_pdf_doc_encoding.cc @@ -4,7 +4,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -16,7 +16,7 @@ usage() int main(int argc, char* argv[]) { - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami; diff --git a/qpdf/test_pdf_unicode.cc b/qpdf/test_pdf_unicode.cc index b28edeaf..325fcad8 100644 --- a/qpdf/test_pdf_unicode.cc +++ b/qpdf/test_pdf_unicode.cc @@ -4,7 +4,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -16,7 +16,7 @@ usage() int main(int argc, char* argv[]) { - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami; diff --git a/qpdf/test_tokenizer.cc b/qpdf/test_tokenizer.cc index 8a58fc8e..d9c09c0b 100644 --- a/qpdf/test_tokenizer.cc +++ b/qpdf/test_tokenizer.cc @@ -11,7 +11,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -91,7 +91,7 @@ tokenTypeName(QPDFTokenizer::token_type_e ttype) case QPDFTokenizer::tt_inline_image: return "inline-image"; } - return 0; + return nullptr; } static std::string @@ -238,13 +238,13 @@ int main(int argc, char* argv[]) { QUtil::setLineBuf(stdout); - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami; } - char const* filename = 0; + char const* filename = nullptr; size_t max_len = 0; bool include_ignorable = true; for (int i = 1; i < argc; ++i) { @@ -265,7 +265,7 @@ main(int argc, char* argv[]) filename = argv[i]; } } - if (filename == 0) { + if (filename == nullptr) { usage(); } diff --git a/qpdf/test_unicode_filenames.cc b/qpdf/test_unicode_filenames.cc index b2fd50f3..16478161 100644 --- a/qpdf/test_unicode_filenames.cc +++ b/qpdf/test_unicode_filenames.cc @@ -12,7 +12,7 @@ static void do_copy(FILE* in, FILE* out) { - if ((in == 0) || (out == 0)) { + if ((in == nullptr) || (out == nullptr)) { std::cerr << "errors opening files" << std::endl; exit(2); } diff --git a/zlib-flate/zlib-flate.cc b/zlib-flate/zlib-flate.cc index 8f0f087a..d1311c84 100644 --- a/zlib-flate/zlib-flate.cc +++ b/zlib-flate/zlib-flate.cc @@ -9,7 +9,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -27,7 +27,7 @@ usage() int main(int argc, char* argv[]) { - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami; From 41ec7eda54e2263eeb1aee4c3a0616c9c2777fb7 Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 13:24:10 +0100 Subject: [PATCH 4/8] Use auto when initialializing with new --- examples/pdf-create.cc | 4 ++-- examples/pdf-custom-filter.cc | 2 +- examples/pdf-invert-images.cc | 2 +- libqpdf/Pl_Buffer.cc | 2 +- libqpdf/QPDF.cc | 4 ++-- libqpdf/QPDFWriter.cc | 4 ++-- libqpdf/QPDF_Array.cc | 2 +- libqpdf/qpdf-c.cc | 2 +- libtests/aes.cc | 6 +++--- libtests/bits.cc | 2 +- libtests/flate.cc | 2 +- libtests/pointer_holder.cc | 4 ++-- libtests/rc4.cc | 6 +++--- qpdf/test_driver.cc | 6 +++--- qpdf/test_large_file.cc | 2 +- qpdf/test_tokenizer.cc | 6 +++--- 16 files changed, 28 insertions(+), 28 deletions(-) diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc index 7898479a..af7ec6b7 100644 --- a/examples/pdf-create.cc +++ b/examples/pdf-create.cc @@ -166,7 +166,7 @@ add_page( // mode. Since we are not specifying, QPDFWriter will compress // with /FlateDecode if we don't provide any other form of // compression. - ImageProvider* p = new ImageProvider(color_space, filter); + auto* p = new ImageProvider(color_space, filter); std::shared_ptr provider(p); size_t width = p->getWidth(); size_t height = p->getHeight(); @@ -286,7 +286,7 @@ check( if (!this_errors) { // Check image data auto actual_data = image.getStreamData(qpdf_dl_all); - ImageProvider* p = new ImageProvider(desired_color_space, "null"); + auto* p = new ImageProvider(desired_color_space, "null"); std::shared_ptr provider(p); Pl_Buffer b_p("get image data"); provider->provideStreamData(QPDFObjGen(), &b_p); diff --git a/examples/pdf-custom-filter.cc b/examples/pdf-custom-filter.cc index 2310a687..f6977a21 100644 --- a/examples/pdf-custom-filter.cc +++ b/examples/pdf-custom-filter.cc @@ -409,7 +409,7 @@ process( // Create a single StreamReplacer instance. The interface requires // a std::shared_ptr in various places, so allocate a StreamReplacer // and stash it in a std::shared_ptr. - StreamReplacer* replacer = new StreamReplacer(&qpdf); + auto* replacer = new StreamReplacer(&qpdf); std::shared_ptr p(replacer); for (auto& o: qpdf.getAllObjects()) { diff --git a/examples/pdf-invert-images.cc b/examples/pdf-invert-images.cc index 06d74198..89989885 100644 --- a/examples/pdf-invert-images.cc +++ b/examples/pdf-invert-images.cc @@ -124,7 +124,7 @@ main(int argc, char* argv[]) QPDF qpdf; qpdf.processFile(infilename, password); - ImageInverter* inv = new ImageInverter; + auto* inv = new ImageInverter; auto p = std::shared_ptr(inv); // For each page... diff --git a/libqpdf/Pl_Buffer.cc b/libqpdf/Pl_Buffer.cc index d942465d..ff200643 100644 --- a/libqpdf/Pl_Buffer.cc +++ b/libqpdf/Pl_Buffer.cc @@ -45,7 +45,7 @@ Pl_Buffer::getBuffer() } auto size = this->m->data.length(); - Buffer* b = new Buffer(size); + auto* b = new Buffer(size); if (size > 0) { unsigned char* p = b->getBuffer(); memcpy(p, this->m->data.data(), size); diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index bc88b5d6..3a4712e0 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -264,7 +264,7 @@ QPDF::create() void QPDF::processFile(char const* filename, char const* password) { - FileInputSource* fi = new FileInputSource(filename); + auto* fi = new FileInputSource(filename); processInputSource(std::shared_ptr(fi), password); } @@ -272,7 +272,7 @@ void QPDF::processFile( char const* description, FILE* filep, bool close_file, char const* password) { - FileInputSource* fi = new FileInputSource(description, filep, close_file); + auto* fi = new FileInputSource(description, filep, close_file); processInputSource(std::shared_ptr(fi), password); } diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 56b4e1ef..a5a54cc7 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -997,7 +997,7 @@ void QPDFWriter::activatePipelineStack(PipelinePopper& pp) { std::string stack_id("stack " + std::to_string(this->m->next_stack_id)); - Pl_Count* c = + auto* c = new Pl_Count(stack_id.c_str(), this->m->pipeline_stack.back()); ++this->m->next_stack_id; this->m->pipeline_stack.push_back(c); @@ -1030,7 +1030,7 @@ QPDFWriter::PipelinePopper::~PipelinePopper() qw->m->md5_pipeline = nullptr; } qw->m->pipeline_stack.pop_back(); - Pl_Buffer* buf = dynamic_cast(p); + auto* buf = dynamic_cast(p); if (bp && buf) { *bp = buf->getBufferSharedPointer(); } diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc index 3bd139b1..d0228361 100644 --- a/libqpdf/QPDF_Array.cc +++ b/libqpdf/QPDF_Array.cc @@ -83,7 +83,7 @@ QPDF_Array::copy(bool shallow) return do_create(new QPDF_Array(*this)); } else { if (sparse) { - QPDF_Array* result = new QPDF_Array(); + auto* result = new QPDF_Array(); result->sp_size = sp_size; for (auto const& element: sp_elements) { auto const& obj = element.second; diff --git a/libqpdf/qpdf-c.cc b/libqpdf/qpdf-c.cc index e7df8ac3..8f36195a 100644 --- a/libqpdf/qpdf-c.cc +++ b/libqpdf/qpdf-c.cc @@ -106,7 +106,7 @@ qpdf_data qpdf_init() { QTC::TC("qpdf", "qpdf-c called qpdf_init"); - qpdf_data qpdf = new _qpdf_data(); + auto qpdf = new _qpdf_data(); qpdf->qpdf = QPDF::create(); return qpdf; } diff --git a/libtests/aes.cc b/libtests/aes.cc index 5ae8152a..a981fc22 100644 --- a/libtests/aes.cc +++ b/libtests/aes.cc @@ -74,7 +74,7 @@ main(int argc, char* argv[]) FILE* infile = QUtil::safe_fopen(infilename, "rb"); FILE* outfile = QUtil::safe_fopen(outfilename, "wb"); - unsigned char* key = new unsigned char[keylen]; + auto* key = new unsigned char[keylen]; for (unsigned int i = 0; i < strlen(hexkey); i += 2) { char t[3]; t[0] = hexkey[i]; @@ -85,8 +85,8 @@ main(int argc, char* argv[]) key[i / 2] = static_cast(val); } - Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile); - Pl_AES_PDF* aes = new Pl_AES_PDF("aes_128_cbc", out, encrypt, key, keylen); + auto* out = new Pl_StdioFile("stdout", outfile); + auto* aes = new Pl_AES_PDF("aes_128_cbc", out, encrypt, key, keylen); delete[] key; key = nullptr; if (!cbc_mode) { diff --git a/libtests/bits.cc b/libtests/bits.cc index e63ebdd3..af715da8 100644 --- a/libtests/bits.cc +++ b/libtests/bits.cc @@ -141,7 +141,7 @@ test() unsigned char ch = 0; bit_offset = 7; - Pl_Buffer* bp = new Pl_Buffer("buffer"); + auto* bp = new Pl_Buffer("buffer"); test_write_bits(ch, bit_offset, 30UL, 5, bp); test_write_bits(ch, bit_offset, 10UL, 4, bp); diff --git a/libtests/flate.cc b/libtests/flate.cc index 93c41f85..9b64ca67 100644 --- a/libtests/flate.cc +++ b/libtests/flate.cc @@ -28,7 +28,7 @@ run(char const* filename) Pipeline* inf2 = new Pl_Flate("inf2", out2, Pl_Flate::a_inflate); // Count bytes written to o3 - Pl_Count* count3 = new Pl_Count("count3", out3); + auto* count3 = new Pl_Count("count3", out3); // Do both simultaneously Pipeline* inf3 = new Pl_Flate("inf3", count3, Pl_Flate::a_inflate); diff --git a/libtests/pointer_holder.cc b/libtests/pointer_holder.cc index e5a58d17..4b9d43cb 100644 --- a/libtests/pointer_holder.cc +++ b/libtests/pointer_holder.cc @@ -72,7 +72,7 @@ test_ph() ObjectHolder oh0; { std::cout << "hello" << std::endl; - Object* o1 = new Object; + auto* o1 = new Object; ObjectHolder oh1(o1); std::cout << "oh1 refcount = " << oh1.getRefcount() << std::endl; ObjectHolder oh2(oh1); @@ -95,7 +95,7 @@ test_ph() } ol1.push_back(oh3); ol1.push_back(oh3); - Object* o3 = new Object; + auto* o3 = new Object; oh0 = o3; PointerHolder oh6(new Object()); oh6->hello(); diff --git a/libtests/rc4.cc b/libtests/rc4.cc index ca4af91d..300c6201 100644 --- a/libtests/rc4.cc +++ b/libtests/rc4.cc @@ -41,7 +41,7 @@ main(int argc, char* argv[]) char* outfilename = argv[3]; unsigned int hexkeylen = QIntC::to_uint(strlen(hexkey)); unsigned int keylen = hexkeylen / 2; - unsigned char* key = new unsigned char[keylen + 1]; + auto* key = new unsigned char[keylen + 1]; key[keylen] = '\0'; FILE* infile = QUtil::safe_fopen(infilename, "rb"); @@ -56,9 +56,9 @@ main(int argc, char* argv[]) } FILE* outfile = QUtil::safe_fopen(outfilename, "wb"); - Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile); + auto* out = new Pl_StdioFile("stdout", outfile); // Use a small buffer size (64) for testing - Pl_RC4* rc4 = new Pl_RC4("rc4", out, key, QIntC::to_int(keylen), 64U); + auto* rc4 = new Pl_RC4("rc4", out, key, QIntC::to_int(keylen), 64U); delete[] key; // 64 < buffer size < 512, buffer_size is not a power of 2 for testing diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index e9e7754c..da1be6c0 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -499,7 +499,7 @@ test_8(QPDF& pdf, char const* arg2) auto b = p1.getBufferSharedPointer(); // This is a bogus way to use StreamDataProvider, but it does // adequately test its functionality. - Provider* provider = new Provider(b); + auto* provider = new Provider(b); auto p = std::shared_ptr(provider); qstream.replaceStreamData( p, @@ -1068,7 +1068,7 @@ test_27(QPDF& pdf, char const* arg2) pl.writeCStr("new data for stream\n"); pl.finish(); auto b = pl.getBufferSharedPointer(); - Provider* provider = new Provider(b); + auto* provider = new Provider(b); p1 = decltype(p1)(provider); } // Create a stream that uses a provider in empty1 and copy it @@ -1095,7 +1095,7 @@ test_27(QPDF& pdf, char const* arg2) pl.writeCStr("more data for stream\n"); pl.finish(); auto b = pl.getBufferSharedPointer(); - Provider* provider = new Provider(b); + auto* provider = new Provider(b); p2 = decltype(p2)(provider); } QPDF empty3; diff --git a/qpdf/test_large_file.cc b/qpdf/test_large_file.cc index aea7c0c5..cfd1c5db 100644 --- a/qpdf/test_large_file.cc +++ b/qpdf/test_large_file.cc @@ -218,7 +218,7 @@ create_pdf(char const* filename) image_dict.replaceKey("/BitsPerComponent", newInteger(8)); image_dict.replaceKey("/Width", newInteger(width)); image_dict.replaceKey("/Height", newInteger(height)); - ImageProvider* p = new ImageProvider(pageno); + auto* p = new ImageProvider(pageno); std::shared_ptr provider(p); image.replaceStreamData( provider, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull()); diff --git a/qpdf/test_tokenizer.cc b/qpdf/test_tokenizer.cc index d9c09c0b..507de459 100644 --- a/qpdf/test_tokenizer.cc +++ b/qpdf/test_tokenizer.cc @@ -190,7 +190,7 @@ process(char const* filename, bool include_ignorable, size_t max_len) std::shared_ptr is; // Tokenize file, skipping streams - FileInputSource* fis = new FileInputSource(filename); + auto* fis = new FileInputSource(filename); is = std::shared_ptr(fis); dump_tokens(is, "FILE", max_len, include_ignorable, true, false); @@ -203,7 +203,7 @@ process(char const* filename, bool include_ignorable, size_t max_len) Pl_Buffer plb("buffer"); page.pipeContents(&plb); auto content_data = plb.getBufferSharedPointer(); - BufferInputSource* bis = + auto* bis = new BufferInputSource("content data", content_data.get()); is = std::shared_ptr(bis); dump_tokens( @@ -220,7 +220,7 @@ process(char const* filename, bool include_ignorable, size_t max_len) if (obj.isStream() && obj.getDict().getKey("/Type").isName() && obj.getDict().getKey("/Type").getName() == "/ObjStm") { std::shared_ptr b = obj.getStreamData(qpdf_dl_specialized); - BufferInputSource* bis = + auto* bis = new BufferInputSource("object stream data", b.get()); is = std::shared_ptr(bis); dump_tokens( From 2fa581537b068e5ddcaee68fd7b92e290fc5fc53 Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 13:34:53 +0100 Subject: [PATCH 5/8] Use auto when initializing with a cast --- libqpdf/InsecureRandomDataProvider.cc | 2 +- libqpdf/JSON.cc | 14 +++++++------- libqpdf/Pl_ASCIIHexDecoder.cc | 2 +- libqpdf/Pl_DCT.cc | 12 ++++++------ libqpdf/Pl_LZWDecoder.cc | 2 +- libqpdf/Pl_RunLength.cc | 4 ++-- libqpdf/QPDFFormFieldObjectHelper.cc | 2 +- libqpdf/QPDF_Stream.cc | 2 +- libqpdf/QPDF_optimization.cc | 2 +- libtests/qintc.cc | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/libqpdf/InsecureRandomDataProvider.cc b/libqpdf/InsecureRandomDataProvider.cc index 90a548ee..ed62d6c7 100644 --- a/libqpdf/InsecureRandomDataProvider.cc +++ b/libqpdf/InsecureRandomDataProvider.cc @@ -24,7 +24,7 @@ InsecureRandomDataProvider::random() // Seed the random number generator with something simple, but // just to be interesting, don't use the unmodified current // time. It would be better if this were a more secure seed. - unsigned int seed = + auto seed = static_cast(QUtil::get_current_time() ^ 0xcccc); #ifdef HAVE_RANDOM ::srandom(seed); diff --git a/libqpdf/JSON.cc b/libqpdf/JSON.cc index fbf06f88..5f76f1ec 100644 --- a/libqpdf/JSON.cc +++ b/libqpdf/JSON.cc @@ -294,7 +294,7 @@ JSON::addDictionaryMember(std::string const& key, JSON const& val) bool JSON::checkDictionaryKeySeen(std::string const& key) { - JSON_dictionary* obj = dynamic_cast(this->m->value.get()); + auto* obj = dynamic_cast(this->m->value.get()); if (nullptr == obj) { throw std::logic_error( "JSON::checkDictionaryKey called on non-dictionary"); @@ -315,7 +315,7 @@ JSON::makeArray() JSON JSON::addArrayElement(JSON const& val) { - JSON_array* arr = dynamic_cast(this->m->value.get()); + auto* arr = dynamic_cast(this->m->value.get()); if (nullptr == arr) { throw std::runtime_error("JSON::addArrayElement called on non-array"); } @@ -470,13 +470,13 @@ JSON::checkSchemaInternal( std::list& errors, std::string prefix) { - JSON_array* this_arr = dynamic_cast(this_v); - JSON_dictionary* this_dict = dynamic_cast(this_v); + auto* this_arr = dynamic_cast(this_v); + auto* this_dict = dynamic_cast(this_v); - JSON_array* sch_arr = dynamic_cast(sch_v); - JSON_dictionary* sch_dict = dynamic_cast(sch_v); + auto* sch_arr = dynamic_cast(sch_v); + auto* sch_dict = dynamic_cast(sch_v); - JSON_string* sch_str = dynamic_cast(sch_v); + auto* sch_str = dynamic_cast(sch_v); std::string err_prefix; if (prefix.empty()) { diff --git a/libqpdf/Pl_ASCIIHexDecoder.cc b/libqpdf/Pl_ASCIIHexDecoder.cc index 5590efba..3548f33e 100644 --- a/libqpdf/Pl_ASCIIHexDecoder.cc +++ b/libqpdf/Pl_ASCIIHexDecoder.cc @@ -76,7 +76,7 @@ Pl_ASCIIHexDecoder::flush() b[i] = this->inbuf[i] - '0'; } } - unsigned char ch = static_cast((b[0] << 4) + b[1]); + auto ch = static_cast((b[0] << 4) + b[1]); QTC::TC( "libtests", diff --git a/libqpdf/Pl_DCT.cc b/libqpdf/Pl_DCT.cc index c01398ad..299b48b1 100644 --- a/libqpdf/Pl_DCT.cc +++ b/libqpdf/Pl_DCT.cc @@ -24,7 +24,7 @@ namespace static void error_handler(j_common_ptr cinfo) { - qpdf_jpeg_error_mgr* jerr = + auto* jerr = reinterpret_cast(cinfo->err); char buf[JMSG_LENGTH_MAX]; (*cinfo->err->format_message)(cinfo, buf); @@ -167,7 +167,7 @@ static boolean empty_pipeline_output_buffer(j_compress_ptr cinfo) { QTC::TC("libtests", "Pl_DCT empty_pipeline_output_buffer"); - dct_pipeline_dest* dest = reinterpret_cast(cinfo->dest); + auto* dest = reinterpret_cast(cinfo->dest); dest->next->write(dest->buffer, dest->size); dest->pub.next_output_byte = dest->buffer; dest->pub.free_in_buffer = dest->size; @@ -178,7 +178,7 @@ static void term_pipeline_destination(j_compress_ptr cinfo) { QTC::TC("libtests", "Pl_DCT term_pipeline_destination"); - dct_pipeline_dest* dest = reinterpret_cast(cinfo->dest); + auto* dest = reinterpret_cast(cinfo->dest); dest->next->write(dest->buffer, dest->size - dest->pub.free_in_buffer); } @@ -192,7 +192,7 @@ jpeg_pipeline_dest( reinterpret_cast(cinfo), JPOOL_PERMANENT, sizeof(dct_pipeline_dest))); - dct_pipeline_dest* dest = reinterpret_cast(cinfo->dest); + auto* dest = reinterpret_cast(cinfo->dest); dest->pub.init_destination = init_pipeline_destination; dest->pub.empty_output_buffer = empty_pipeline_output_buffer; dest->pub.term_destination = term_pipeline_destination; @@ -261,7 +261,7 @@ jpeg_buffer_src(j_decompress_ptr cinfo, Buffer* buffer) void Pl_DCT::compress(void* cinfo_p, Buffer* b) { - struct jpeg_compress_struct* cinfo = + auto* cinfo = reinterpret_cast(cinfo_p); #if ( \ @@ -316,7 +316,7 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b) void Pl_DCT::decompress(void* cinfo_p, Buffer* b) { - struct jpeg_decompress_struct* cinfo = + auto* cinfo = reinterpret_cast(cinfo_p); #if ( \ diff --git a/libqpdf/Pl_LZWDecoder.cc b/libqpdf/Pl_LZWDecoder.cc index 1c2d6807..3356ea4f 100644 --- a/libqpdf/Pl_LZWDecoder.cc +++ b/libqpdf/Pl_LZWDecoder.cc @@ -189,7 +189,7 @@ Pl_LZWDecoder::handleCode(unsigned int code) } if (code < 256) { - unsigned char ch = static_cast(code); + auto ch = static_cast(code); getNext()->write(&ch, 1); } else { unsigned int idx = code - 258; diff --git a/libqpdf/Pl_RunLength.cc b/libqpdf/Pl_RunLength.cc index 786e2e86..d60da70a 100644 --- a/libqpdf/Pl_RunLength.cc +++ b/libqpdf/Pl_RunLength.cc @@ -127,11 +127,11 @@ Pl_RunLength::flush_encode() throw std::logic_error( "Pl_RunLength: invalid length in flush_encode for run"); } - unsigned char ch = static_cast(257 - this->m->length); + auto ch = static_cast(257 - this->m->length); this->getNext()->write(&ch, 1); this->getNext()->write(&this->m->buf[0], 1); } else if (this->m->length > 0) { - unsigned char ch = static_cast(this->m->length - 1); + auto ch = static_cast(this->m->length - 1); this->getNext()->write(&ch, 1); this->getNext()->write(this->m->buf, this->m->length); } diff --git a/libqpdf/QPDFFormFieldObjectHelper.cc b/libqpdf/QPDFFormFieldObjectHelper.cc index 93dc0e63..7712cab2 100644 --- a/libqpdf/QPDFFormFieldObjectHelper.cc +++ b/libqpdf/QPDFFormFieldObjectHelper.cc @@ -611,7 +611,7 @@ ValueSetter::writeAppearance() // Write one or more lines, centered vertically, possibly with // one row highlighted. - size_t max_rows = static_cast((bbox.ury - bbox.lly) / tfh); + auto max_rows = static_cast((bbox.ury - bbox.lly) / tfh); bool highlight = false; size_t highlight_idx = 0; diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc index 8e2e16c5..4ceeab48 100644 --- a/libqpdf/QPDF_Stream.cc +++ b/libqpdf/QPDF_Stream.cc @@ -557,7 +557,7 @@ QPDF_Stream::pipeStreamData( if (decode_pipeline) { pipeline = decode_pipeline; } - Pl_Flate* flate = dynamic_cast(pipeline); + auto* flate = dynamic_cast(pipeline); if (flate != nullptr) { flate->setWarnCallback( [this](char const* msg, int code) { warn(msg); }); diff --git a/libqpdf/QPDF_optimization.cc b/libqpdf/QPDF_optimization.cc index 41204fbd..9130287a 100644 --- a/libqpdf/QPDF_optimization.cc +++ b/libqpdf/QPDF_optimization.cc @@ -115,7 +115,7 @@ QPDF::optimize( } ObjUser root_ou = ObjUser(ObjUser::ou_root); - QPDFObjGen root_og = QPDFObjGen(root.getObjGen()); + auto root_og = QPDFObjGen(root.getObjGen()); this->m->obj_user_to_objects[root_ou].insert(root_og); this->m->object_to_obj_users[root_og].insert(root_ou); diff --git a/libtests/qintc.cc b/libtests/qintc.cc index 0cf3924f..5b985644 100644 --- a/libtests/qintc.cc +++ b/libtests/qintc.cc @@ -74,7 +74,7 @@ main() uint64_t ul1 = 1099511627776LL; // Too big for 32-bit uint64_t ul2 = 12345; // Fits into 32-bit int32_t i2 = 81; // Fits in char and uchar - signed char c1 = static_cast('\xf7'); // Signed value when char + auto c1 = static_cast('\xf7'); // Signed value when char char c2 = 'W'; // char; may be signed or unsigned // Verify i1 and u1 have same bit pattern From 774d0d558e1cc3c3c58685a1f401fc6ff24d6e70 Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 13:35:41 +0100 Subject: [PATCH 6/8] Use auto when declaring iterators --- libqpdf/QPDF.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index 3a4712e0..056d79fc 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -2537,7 +2537,7 @@ QPDF::getCompressibleObjGens() if (obj.isStream()) { QPDFObjectHandle dict = obj.getDict(); std::set keys = dict.getKeys(); - for (std::set::reverse_iterator iter = keys.rbegin(); + for (auto iter = keys.rbegin(); iter != keys.rend(); ++iter) { std::string const& key = *iter; @@ -2553,7 +2553,7 @@ QPDF::getCompressibleObjGens() } } else if (obj.isDictionary()) { std::set keys = obj.getKeys(); - for (std::set::reverse_iterator iter = keys.rbegin(); + for (auto iter = keys.rbegin(); iter != keys.rend(); ++iter) { queue.push_front(obj.getKey(*iter)); From ba5a3567a262efdfc171decf481b716ea29743d6 Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 13:56:33 +0100 Subject: [PATCH 7/8] Remove redundant 'virtual' specifiers --- examples/pdf-custom-filter.cc | 12 ++++++------ examples/pdf-invert-images.cc | 2 +- include/qpdf/QPDFWriter.hh | 2 +- libqpdf/QPDF.cc | 14 +++++++------- libqpdf/QPDFLogger.cc | 4 ++-- libqpdf/QPDFNameTreeObjectHelper.cc | 6 +++--- libqpdf/QPDFNumberTreeObjectHelper.cc | 6 +++--- libqpdf/QPDFObjectHandle.cc | 4 ++-- libqpdf/QPDF_json.cc | 12 ++++++------ libqpdf/qpdf/Pl_Base64.hh | 4 ++-- libqpdf/qpdf/ResourceFinder.hh | 4 ++-- libqpdf/qpdf/SF_ASCII85Decode.hh | 2 +- libqpdf/qpdf/SF_ASCIIHexDecode.hh | 2 +- libqpdf/qpdf/SF_DCTDecode.hh | 6 +++--- libqpdf/qpdf/SF_RunLengthDecode.hh | 4 ++-- libtests/json_parse.cc | 12 ++++++------ 16 files changed, 48 insertions(+), 48 deletions(-) diff --git a/examples/pdf-custom-filter.cc b/examples/pdf-custom-filter.cc index f6977a21..30f02d5c 100644 --- a/examples/pdf-custom-filter.cc +++ b/examples/pdf-custom-filter.cc @@ -49,8 +49,8 @@ class Pl_XOR: public Pipeline public: Pl_XOR(char const* identifier, Pipeline* next, unsigned char key); virtual ~Pl_XOR() = default; - virtual void write(unsigned char const* data, size_t len) override; - virtual void finish() override; + void write(unsigned char const* data, size_t len) override; + void finish() override; private: unsigned char key; @@ -92,9 +92,9 @@ class SF_XORDecode: public QPDFStreamFilter // "uncompress" the stream by default. public: virtual ~SF_XORDecode() = default; - virtual bool setDecodeParms(QPDFObjectHandle decode_parms) override; - virtual Pipeline* getDecodePipeline(Pipeline* next) override; - virtual bool isSpecializedCompression() override; + bool setDecodeParms(QPDFObjectHandle decode_parms) override; + Pipeline* getDecodePipeline(Pipeline* next) override; + bool isSpecializedCompression() override; private: unsigned char key; @@ -200,7 +200,7 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider public: StreamReplacer(QPDF* pdf); virtual ~StreamReplacer() = default; - virtual void + void provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override; void registerStream( diff --git a/examples/pdf-invert-images.cc b/examples/pdf-invert-images.cc index 89989885..d714148c 100644 --- a/examples/pdf-invert-images.cc +++ b/examples/pdf-invert-images.cc @@ -34,7 +34,7 @@ class ImageInverter: public QPDFObjectHandle::StreamDataProvider { public: virtual ~ImageInverter() = default; - virtual void + void provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override; void registerImage( diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh index 8305974c..162d4f4e 100644 --- a/include/qpdf/QPDFWriter.hh +++ b/include/qpdf/QPDFWriter.hh @@ -102,7 +102,7 @@ class QPDFWriter QPDF_DLL virtual ~FunctionProgressReporter(); QPDF_DLL - virtual void reportProgress(int) override; + void reportProgress(int) override; private: std::function handler; diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index 056d79fc..dcfd5f46 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -61,41 +61,41 @@ namespace { public: virtual ~InvalidInputSource() = default; - virtual qpdf_offset_t + qpdf_offset_t findAndSkipNextEOL() override { throwException(); return 0; } - virtual std::string const& + std::string const& getName() const override { static std::string name("closed input source"); return name; } - virtual qpdf_offset_t + qpdf_offset_t tell() override { throwException(); return 0; } - virtual void + void seek(qpdf_offset_t offset, int whence) override { throwException(); } - virtual void + void rewind() override { throwException(); } - virtual size_t + size_t read(char* buffer, size_t length) override { throwException(); return 0; } - virtual void + void unreadCh(char ch) override { throwException(); diff --git a/libqpdf/QPDFLogger.cc b/libqpdf/QPDFLogger.cc index 7fe21c97..15d80aab 100644 --- a/libqpdf/QPDFLogger.cc +++ b/libqpdf/QPDFLogger.cc @@ -17,14 +17,14 @@ namespace { } - virtual void + void write(unsigned char const* data, size_t len) override { this->used = true; getNext()->write(data, len); } - virtual void + void finish() override { getNext()->finish(); diff --git a/libqpdf/QPDFNameTreeObjectHelper.cc b/libqpdf/QPDFNameTreeObjectHelper.cc index f388dccf..574bb097 100644 --- a/libqpdf/QPDFNameTreeObjectHelper.cc +++ b/libqpdf/QPDFNameTreeObjectHelper.cc @@ -7,18 +7,18 @@ namespace class NameTreeDetails: public NNTreeDetails { public: - virtual std::string const& + std::string const& itemsKey() const override { static std::string k("/Names"); return k; } - virtual bool + bool keyValid(QPDFObjectHandle oh) const override { return oh.isString(); } - virtual int + int compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override { if (!(keyValid(a) && keyValid(b))) { diff --git a/libqpdf/QPDFNumberTreeObjectHelper.cc b/libqpdf/QPDFNumberTreeObjectHelper.cc index 6443416d..08f790d4 100644 --- a/libqpdf/QPDFNumberTreeObjectHelper.cc +++ b/libqpdf/QPDFNumberTreeObjectHelper.cc @@ -8,18 +8,18 @@ namespace class NumberTreeDetails: public NNTreeDetails { public: - virtual std::string const& + std::string const& itemsKey() const override { static std::string k("/Nums"); return k; } - virtual bool + bool keyValid(QPDFObjectHandle oh) const override { return oh.isInteger(); } - virtual int + int compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override { if (!(keyValid(a) && keyValid(b))) { diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index e276bf4f..8b30f95b 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -1446,13 +1446,13 @@ namespace { } - virtual void + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override { p1(pipeline); } - virtual bool + bool provideStreamData( QPDFObjGen const&, Pipeline* pipeline, diff --git a/libqpdf/QPDF_json.cc b/libqpdf/QPDF_json.cc index 563e8e29..9e3cb3bb 100644 --- a/libqpdf/QPDF_json.cc +++ b/libqpdf/QPDF_json.cc @@ -242,13 +242,13 @@ class QPDF::JSONReactor: public JSON::Reactor } } virtual ~JSONReactor() = default; - virtual void dictionaryStart() override; - virtual void arrayStart() override; - virtual void containerEnd(JSON const& value) override; - virtual void topLevelScalar() override; - virtual bool + void dictionaryStart() override; + void arrayStart() override; + void containerEnd(JSON const& value) override; + void topLevelScalar() override; + bool dictionaryItem(std::string const& key, JSON const& value) override; - virtual bool arrayItem(JSON const& value) override; + bool arrayItem(JSON const& value) override; bool anyErrors() const; diff --git a/libqpdf/qpdf/Pl_Base64.hh b/libqpdf/qpdf/Pl_Base64.hh index 788bfd6d..0e490cfe 100644 --- a/libqpdf/qpdf/Pl_Base64.hh +++ b/libqpdf/qpdf/Pl_Base64.hh @@ -9,8 +9,8 @@ class Pl_Base64: public Pipeline enum action_e { a_encode, a_decode }; Pl_Base64(char const* identifier, Pipeline* next, action_e); virtual ~Pl_Base64() = default; - virtual void write(unsigned char const* buf, size_t len) override; - virtual void finish() override; + void write(unsigned char const* buf, size_t len) override; + void finish() override; private: void decode(unsigned char const* buf, size_t len); diff --git a/libqpdf/qpdf/ResourceFinder.hh b/libqpdf/qpdf/ResourceFinder.hh index d037e600..c4f5673b 100644 --- a/libqpdf/qpdf/ResourceFinder.hh +++ b/libqpdf/qpdf/ResourceFinder.hh @@ -8,8 +8,8 @@ class ResourceFinder: public QPDFObjectHandle::ParserCallbacks public: ResourceFinder(); virtual ~ResourceFinder() = default; - virtual void handleObject(QPDFObjectHandle, size_t, size_t) override; - virtual void handleEOF() override; + void handleObject(QPDFObjectHandle, size_t, size_t) override; + void handleEOF() override; std::set const& getNames() const; std::map>> const& getNamesByResourceType() const; diff --git a/libqpdf/qpdf/SF_ASCII85Decode.hh b/libqpdf/qpdf/SF_ASCII85Decode.hh index 0b77d2e4..f383364a 100644 --- a/libqpdf/qpdf/SF_ASCII85Decode.hh +++ b/libqpdf/qpdf/SF_ASCII85Decode.hh @@ -11,7 +11,7 @@ class SF_ASCII85Decode: public QPDFStreamFilter SF_ASCII85Decode() = default; virtual ~SF_ASCII85Decode() = default; - virtual Pipeline* + Pipeline* getDecodePipeline(Pipeline* next) override { this->pipeline = diff --git a/libqpdf/qpdf/SF_ASCIIHexDecode.hh b/libqpdf/qpdf/SF_ASCIIHexDecode.hh index 6454ce44..911f7370 100644 --- a/libqpdf/qpdf/SF_ASCIIHexDecode.hh +++ b/libqpdf/qpdf/SF_ASCIIHexDecode.hh @@ -11,7 +11,7 @@ class SF_ASCIIHexDecode: public QPDFStreamFilter SF_ASCIIHexDecode() = default; virtual ~SF_ASCIIHexDecode() = default; - virtual Pipeline* + Pipeline* getDecodePipeline(Pipeline* next) override { this->pipeline = diff --git a/libqpdf/qpdf/SF_DCTDecode.hh b/libqpdf/qpdf/SF_DCTDecode.hh index f9b1af3a..997ba89a 100644 --- a/libqpdf/qpdf/SF_DCTDecode.hh +++ b/libqpdf/qpdf/SF_DCTDecode.hh @@ -11,7 +11,7 @@ class SF_DCTDecode: public QPDFStreamFilter SF_DCTDecode() = default; virtual ~SF_DCTDecode() = default; - virtual Pipeline* + Pipeline* getDecodePipeline(Pipeline* next) override { this->pipeline = std::make_shared("DCT decode", next); @@ -24,13 +24,13 @@ class SF_DCTDecode: public QPDFStreamFilter return std::make_shared(); } - virtual bool + bool isSpecializedCompression() override { return true; } - virtual bool + bool isLossyCompression() override { return true; diff --git a/libqpdf/qpdf/SF_RunLengthDecode.hh b/libqpdf/qpdf/SF_RunLengthDecode.hh index a1c8c80a..9dec379d 100644 --- a/libqpdf/qpdf/SF_RunLengthDecode.hh +++ b/libqpdf/qpdf/SF_RunLengthDecode.hh @@ -11,7 +11,7 @@ class SF_RunLengthDecode: public QPDFStreamFilter SF_RunLengthDecode() = default; virtual ~SF_RunLengthDecode() = default; - virtual Pipeline* + Pipeline* getDecodePipeline(Pipeline* next) override { this->pipeline = std::make_shared( @@ -25,7 +25,7 @@ class SF_RunLengthDecode: public QPDFStreamFilter return std::make_shared(); } - virtual bool + bool isSpecializedCompression() override { return true; diff --git a/libtests/json_parse.cc b/libtests/json_parse.cc index ed69784e..31381ebf 100644 --- a/libtests/json_parse.cc +++ b/libtests/json_parse.cc @@ -11,13 +11,13 @@ namespace { public: virtual ~Reactor() = default; - virtual void dictionaryStart() override; - virtual void arrayStart() override; - virtual void containerEnd(JSON const& value) override; - virtual void topLevelScalar() override; - virtual bool + void dictionaryStart() override; + void arrayStart() override; + void containerEnd(JSON const& value) override; + void topLevelScalar() override; + bool dictionaryItem(std::string const& key, JSON const& value) override; - virtual bool arrayItem(JSON const& value) override; + bool arrayItem(JSON const& value) override; private: void printItem(JSON const&); From e6577a1323cd813a92ddbc8841e1342c05de071a Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 14:25:46 +0100 Subject: [PATCH 8/8] Replace 'virtual' specifier with 'override' --- examples/pdf-count-strings.cc | 6 ++--- examples/pdf-create.cc | 4 ++-- examples/pdf-custom-filter.cc | 6 ++--- examples/pdf-filter-tokens.cc | 10 ++++---- examples/pdf-invert-images.cc | 2 +- examples/pdf-parse-content.cc | 8 +++---- fuzz/qpdf_fuzzer.cc | 10 ++++---- include/qpdf/JSON.hh | 28 +++++++++++----------- include/qpdf/Pl_Buffer.hh | 6 ++--- libqpdf/QPDF.cc | 2 +- libqpdf/QPDFFormFieldObjectHelper.cc | 10 ++++---- libqpdf/QPDFJob.cc | 18 +++++++------- libqpdf/QPDFObjectHandle.cc | 10 ++++---- libqpdf/QPDFTokenizer.cc | 4 ++-- libqpdf/QPDF_Stream.cc | 10 ++++---- libqpdf/qpdf/ContentNormalizer.hh | 4 ++-- libqpdf/qpdf/CryptoRandomDataProvider.hh | 4 ++-- libqpdf/qpdf/InsecureRandomDataProvider.hh | 4 ++-- libqpdf/qpdf/OffsetInputSource.hh | 16 ++++++------- libqpdf/qpdf/Pl_AES_PDF.hh | 6 ++--- libqpdf/qpdf/Pl_ASCII85Decoder.hh | 6 ++--- libqpdf/qpdf/Pl_ASCIIHexDecoder.hh | 6 ++--- libqpdf/qpdf/Pl_Base64.hh | 2 +- libqpdf/qpdf/Pl_PNGFilter.hh | 6 ++--- libqpdf/qpdf/Pl_RC4.hh | 6 ++--- libqpdf/qpdf/Pl_SHA2.hh | 6 ++--- libqpdf/qpdf/Pl_TIFFPredictor.hh | 6 ++--- libtests/dct_compress.cc | 4 ++-- libtests/input_source.cc | 4 ++-- 29 files changed, 107 insertions(+), 107 deletions(-) diff --git a/examples/pdf-count-strings.cc b/examples/pdf-count-strings.cc index 584d630b..93676375 100644 --- a/examples/pdf-count-strings.cc +++ b/examples/pdf-count-strings.cc @@ -30,9 +30,9 @@ class StringCounter: public QPDFObjectHandle::TokenFilter count(0) { } - virtual ~StringCounter() = default; - virtual void handleToken(QPDFTokenizer::Token const&); - virtual void handleEOF(); + ~StringCounter() override = default; + void handleToken(QPDFTokenizer::Token const&) override; + void handleEOF() override; int getCount() const; private: diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc index af7ec6b7..64ae5cb8 100644 --- a/examples/pdf-create.cc +++ b/examples/pdf-create.cc @@ -26,8 +26,8 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider { public: ImageProvider(std::string const& color_space, std::string const& filter); - virtual ~ImageProvider() = default; - virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline); + ~ImageProvider() override = default; + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override; size_t getWidth() const; size_t getHeight() const; diff --git a/examples/pdf-custom-filter.cc b/examples/pdf-custom-filter.cc index 30f02d5c..d99c6ab2 100644 --- a/examples/pdf-custom-filter.cc +++ b/examples/pdf-custom-filter.cc @@ -48,7 +48,7 @@ class Pl_XOR: public Pipeline public: Pl_XOR(char const* identifier, Pipeline* next, unsigned char key); - virtual ~Pl_XOR() = default; + ~Pl_XOR() override = default; void write(unsigned char const* data, size_t len) override; void finish() override; @@ -91,7 +91,7 @@ class SF_XORDecode: public QPDFStreamFilter // filter, which just means QPDF assumes that it should not // "uncompress" the stream by default. public: - virtual ~SF_XORDecode() = default; + ~SF_XORDecode() override = default; bool setDecodeParms(QPDFObjectHandle decode_parms) override; Pipeline* getDecodePipeline(Pipeline* next) override; bool isSpecializedCompression() override; @@ -199,7 +199,7 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider public: StreamReplacer(QPDF* pdf); - virtual ~StreamReplacer() = default; + ~StreamReplacer() override = default; void provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override; diff --git a/examples/pdf-filter-tokens.cc b/examples/pdf-filter-tokens.cc index 173feb6a..a897ef65 100644 --- a/examples/pdf-filter-tokens.cc +++ b/examples/pdf-filter-tokens.cc @@ -33,8 +33,8 @@ usage() class StringReverser: public QPDFObjectHandle::TokenFilter { public: - virtual ~StringReverser() = default; - virtual void handleToken(QPDFTokenizer::Token const&); + ~StringReverser() override = default; + void handleToken(QPDFTokenizer::Token const&) override; }; void @@ -66,9 +66,9 @@ StringReverser::handleToken(QPDFTokenizer::Token const& token) class ColorToGray: public QPDFObjectHandle::TokenFilter { public: - virtual ~ColorToGray() = default; - virtual void handleToken(QPDFTokenizer::Token const&); - virtual void handleEOF(); + ~ColorToGray() override = default; + void handleToken(QPDFTokenizer::Token const&) override; + void handleEOF() override; private: bool isNumeric(QPDFTokenizer::token_type_e); diff --git a/examples/pdf-invert-images.cc b/examples/pdf-invert-images.cc index d714148c..fae305b1 100644 --- a/examples/pdf-invert-images.cc +++ b/examples/pdf-invert-images.cc @@ -33,7 +33,7 @@ usage() class ImageInverter: public QPDFObjectHandle::StreamDataProvider { public: - virtual ~ImageInverter() = default; + ~ImageInverter() override = default; void provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override; diff --git a/examples/pdf-parse-content.cc b/examples/pdf-parse-content.cc index 49440418..968c980b 100644 --- a/examples/pdf-parse-content.cc +++ b/examples/pdf-parse-content.cc @@ -22,10 +22,10 @@ usage() class ParserCallbacks: public QPDFObjectHandle::ParserCallbacks { public: - virtual ~ParserCallbacks() = default; - virtual void contentSize(size_t); - virtual void handleObject(QPDFObjectHandle, size_t offset, size_t length); - virtual void handleEOF(); + ~ParserCallbacks() override = default; + void contentSize(size_t) override; + void handleObject(QPDFObjectHandle, size_t offset, size_t length) override; + void handleEOF() override; }; void diff --git a/fuzz/qpdf_fuzzer.cc b/fuzz/qpdf_fuzzer.cc index c402a772..8d4534bd 100644 --- a/fuzz/qpdf_fuzzer.cc +++ b/fuzz/qpdf_fuzzer.cc @@ -14,13 +14,13 @@ class DiscardContents: public QPDFObjectHandle::ParserCallbacks { public: - virtual ~DiscardContents() = default; - virtual void - handleObject(QPDFObjectHandle) + ~DiscardContents() override = default; + void + handleObject(QPDFObjectHandle) override { } - virtual void - handleEOF() + void + handleEOF() override { } }; diff --git a/include/qpdf/JSON.hh b/include/qpdf/JSON.hh index 34333e93..3ff714ae 100644 --- a/include/qpdf/JSON.hh +++ b/include/qpdf/JSON.hh @@ -369,8 +369,8 @@ class JSON JSON_value(vt_dictionary) { } - virtual ~JSON_dictionary() = default; - virtual void write(Pipeline*, size_t depth) const; + ~JSON_dictionary() override = default; + void write(Pipeline*, size_t depth) const override; std::map members; std::set parsed_keys; }; @@ -380,15 +380,15 @@ class JSON JSON_value(vt_array) { } - virtual ~JSON_array() = default; - virtual void write(Pipeline*, size_t depth) const; + ~JSON_array() override = default; + void write(Pipeline*, size_t depth) const override; std::vector elements; }; struct JSON_string: public JSON_value { JSON_string(std::string const& utf8); - virtual ~JSON_string() = default; - virtual void write(Pipeline*, size_t depth) const; + ~JSON_string() override = default; + void write(Pipeline*, size_t depth) const override; std::string utf8; std::string encoded; }; @@ -397,15 +397,15 @@ class JSON JSON_number(long long val); JSON_number(double val); JSON_number(std::string const& val); - virtual ~JSON_number() = default; - virtual void write(Pipeline*, size_t depth) const; + ~JSON_number() override = default; + void write(Pipeline*, size_t depth) const override; std::string encoded; }; struct JSON_bool: public JSON_value { JSON_bool(bool val); - virtual ~JSON_bool() = default; - virtual void write(Pipeline*, size_t depth) const; + ~JSON_bool() override = default; + void write(Pipeline*, size_t depth) const override; bool value; }; struct JSON_null: public JSON_value @@ -414,14 +414,14 @@ class JSON JSON_value(vt_null) { } - virtual ~JSON_null() = default; - virtual void write(Pipeline*, size_t depth) const; + ~JSON_null() override = default; + void write(Pipeline*, size_t depth) const override; }; struct JSON_blob: public JSON_value { JSON_blob(std::function fn); - virtual ~JSON_blob() = default; - virtual void write(Pipeline*, size_t depth) const; + ~JSON_blob() override = default; + void write(Pipeline*, size_t depth) const override; std::function fn; }; diff --git a/include/qpdf/Pl_Buffer.hh b/include/qpdf/Pl_Buffer.hh index fcef0c56..ffc01d95 100644 --- a/include/qpdf/Pl_Buffer.hh +++ b/include/qpdf/Pl_Buffer.hh @@ -45,11 +45,11 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline QPDF_DLL Pl_Buffer(char const* identifier, Pipeline* next = nullptr); QPDF_DLL - virtual ~Pl_Buffer(); + ~Pl_Buffer() override; QPDF_DLL - virtual void write(unsigned char const*, size_t); + void write(unsigned char const*, size_t) override; QPDF_DLL - virtual void finish(); + void finish() override; // Each call to getBuffer() resets this object -- see notes above. // The caller is responsible for deleting the returned Buffer diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index dcfd5f46..09221394 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -60,7 +60,7 @@ namespace class InvalidInputSource: public InputSource { public: - virtual ~InvalidInputSource() = default; + ~InvalidInputSource() override = default; qpdf_offset_t findAndSkipNextEOL() override { diff --git a/libqpdf/QPDFFormFieldObjectHelper.cc b/libqpdf/QPDFFormFieldObjectHelper.cc index 7712cab2..4b95c91f 100644 --- a/libqpdf/QPDFFormFieldObjectHelper.cc +++ b/libqpdf/QPDFFormFieldObjectHelper.cc @@ -515,9 +515,9 @@ namespace std::vector const& opt, double tf, QPDFObjectHandle::Rectangle const& bbox); - virtual ~ValueSetter() = default; - virtual void handleToken(QPDFTokenizer::Token const&); - virtual void handleEOF(); + ~ValueSetter() override = default; + void handleToken(QPDFTokenizer::Token const&) override; + void handleEOF() override; void writeAppearance(); private: @@ -706,10 +706,10 @@ namespace { public: TfFinder(); - virtual ~TfFinder() + ~TfFinder() override { } - virtual void handleToken(QPDFTokenizer::Token const&); + void handleToken(QPDFTokenizer::Token const&) override; double getTf(); std::string getFontName(); std::string getDA(); diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index 14583104..0e5ad3ae 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -48,8 +48,8 @@ namespace size_t oi_min_height, size_t oi_min_area, QPDFObjectHandle& image); - virtual ~ImageOptimizer() = default; - virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline); + ~ImageOptimizer() override = default; + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override; std::shared_ptr makePipeline(std::string const& description, Pipeline* next); bool evaluate(std::string const& description); @@ -65,13 +65,13 @@ namespace class DiscardContents: public QPDFObjectHandle::ParserCallbacks { public: - virtual ~DiscardContents() = default; - virtual void - handleObject(QPDFObjectHandle) + ~DiscardContents() override = default; + void + handleObject(QPDFObjectHandle) override { } - virtual void - handleEOF() + void + handleEOF() override { } }; @@ -98,8 +98,8 @@ namespace filename(filename) { } - virtual ~ProgressReporter() = default; - virtual void reportProgress(int); + ~ProgressReporter() override = default; + void reportProgress(int) override; private: Pipeline& p; diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 8b30f95b..93d269d3 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -111,8 +111,8 @@ namespace old_contents(old_contents) { } - virtual ~CoalesceProvider() = default; - virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline); + ~CoalesceProvider() override = default; + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override; private: QPDFObjectHandle containing_page; @@ -200,9 +200,9 @@ namespace { public: LastChar(Pipeline* next); - virtual ~LastChar() = default; - virtual void write(unsigned char const* data, size_t len); - virtual void finish(); + ~LastChar() override = default; + void write(unsigned char const* data, size_t len) override; + void finish() override; unsigned char getLastChar(); private: diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc index d83080b2..1a14e3a9 100644 --- a/libqpdf/QPDFTokenizer.cc +++ b/libqpdf/QPDFTokenizer.cc @@ -35,8 +35,8 @@ namespace str(str) { } - virtual ~QPDFWordTokenFinder() = default; - virtual bool check(); + ~QPDFWordTokenFinder() override = default; + bool check() override; private: std::shared_ptr is; diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc index 4ceeab48..9cfb3ac4 100644 --- a/libqpdf/QPDF_Stream.cc +++ b/libqpdf/QPDF_Stream.cc @@ -27,10 +27,10 @@ namespace { public: SF_Crypt() = default; - virtual ~SF_Crypt() = default; + ~SF_Crypt() override = default; - virtual bool - setDecodeParms(QPDFObjectHandle decode_parms) + bool + setDecodeParms(QPDFObjectHandle decode_parms) override { if (decode_parms.isNull()) { return true; @@ -49,8 +49,8 @@ namespace return filterable; } - virtual Pipeline* - getDecodePipeline(Pipeline*) + Pipeline* + getDecodePipeline(Pipeline*) override { // Not used -- handled by pipeStreamData return nullptr; diff --git a/libqpdf/qpdf/ContentNormalizer.hh b/libqpdf/qpdf/ContentNormalizer.hh index ba1063e0..d423aa4c 100644 --- a/libqpdf/qpdf/ContentNormalizer.hh +++ b/libqpdf/qpdf/ContentNormalizer.hh @@ -7,8 +7,8 @@ class ContentNormalizer: public QPDFObjectHandle::TokenFilter { public: ContentNormalizer(); - virtual ~ContentNormalizer() = default; - virtual void handleToken(QPDFTokenizer::Token const&); + ~ContentNormalizer() override = default; + void handleToken(QPDFTokenizer::Token const&) override; bool anyBadTokens() const; bool lastTokenWasBad() const; diff --git a/libqpdf/qpdf/CryptoRandomDataProvider.hh b/libqpdf/qpdf/CryptoRandomDataProvider.hh index 89859e65..e402d944 100644 --- a/libqpdf/qpdf/CryptoRandomDataProvider.hh +++ b/libqpdf/qpdf/CryptoRandomDataProvider.hh @@ -7,8 +7,8 @@ class CryptoRandomDataProvider: public RandomDataProvider { public: CryptoRandomDataProvider() = default; - virtual ~CryptoRandomDataProvider() = default; - virtual void provideRandomData(unsigned char* data, size_t len); + ~CryptoRandomDataProvider() override = default; + void provideRandomData(unsigned char* data, size_t len) override; static RandomDataProvider* getInstance(); }; diff --git a/libqpdf/qpdf/InsecureRandomDataProvider.hh b/libqpdf/qpdf/InsecureRandomDataProvider.hh index 47a81afe..bab4e002 100644 --- a/libqpdf/qpdf/InsecureRandomDataProvider.hh +++ b/libqpdf/qpdf/InsecureRandomDataProvider.hh @@ -7,8 +7,8 @@ class InsecureRandomDataProvider: public RandomDataProvider { public: InsecureRandomDataProvider(); - virtual ~InsecureRandomDataProvider() = default; - virtual void provideRandomData(unsigned char* data, size_t len); + ~InsecureRandomDataProvider() override = default; + void provideRandomData(unsigned char* data, size_t len) override; static RandomDataProvider* getInstance(); private: diff --git a/libqpdf/qpdf/OffsetInputSource.hh b/libqpdf/qpdf/OffsetInputSource.hh index d8b08145..fdc1a404 100644 --- a/libqpdf/qpdf/OffsetInputSource.hh +++ b/libqpdf/qpdf/OffsetInputSource.hh @@ -11,15 +11,15 @@ class OffsetInputSource: public InputSource public: OffsetInputSource( std::shared_ptr, qpdf_offset_t global_offset); - virtual ~OffsetInputSource() = default; + ~OffsetInputSource() override = default; - virtual qpdf_offset_t findAndSkipNextEOL(); - virtual std::string const& getName() const; - virtual qpdf_offset_t tell(); - virtual void seek(qpdf_offset_t offset, int whence); - virtual void rewind(); - virtual size_t read(char* buffer, size_t length); - virtual void unreadCh(char ch); + qpdf_offset_t findAndSkipNextEOL() override; + std::string const& getName() const override; + qpdf_offset_t tell() override; + void seek(qpdf_offset_t offset, int whence) override; + void rewind() override; + size_t read(char* buffer, size_t length) override; + void unreadCh(char ch) override; private: std::shared_ptr proxied; diff --git a/libqpdf/qpdf/Pl_AES_PDF.hh b/libqpdf/qpdf/Pl_AES_PDF.hh index 18091583..b3fde312 100644 --- a/libqpdf/qpdf/Pl_AES_PDF.hh +++ b/libqpdf/qpdf/Pl_AES_PDF.hh @@ -18,10 +18,10 @@ class Pl_AES_PDF: public Pipeline bool encrypt, unsigned char const* key, size_t key_bytes); - virtual ~Pl_AES_PDF() = default; + ~Pl_AES_PDF() override = default; - virtual void write(unsigned char const* data, size_t len); - virtual void finish(); + void write(unsigned char const* data, size_t len) override; + void finish() override; // Use zero initialization vector; needed for AESV3 void useZeroIV(); diff --git a/libqpdf/qpdf/Pl_ASCII85Decoder.hh b/libqpdf/qpdf/Pl_ASCII85Decoder.hh index 667b56e9..dd5efd06 100644 --- a/libqpdf/qpdf/Pl_ASCII85Decoder.hh +++ b/libqpdf/qpdf/Pl_ASCII85Decoder.hh @@ -7,9 +7,9 @@ class Pl_ASCII85Decoder: public Pipeline { public: Pl_ASCII85Decoder(char const* identifier, Pipeline* next); - virtual ~Pl_ASCII85Decoder() = default; - virtual void write(unsigned char const* buf, size_t len); - virtual void finish(); + ~Pl_ASCII85Decoder() override = default; + void write(unsigned char const* buf, size_t len) override; + void finish() override; private: void flush(); diff --git a/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh b/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh index c71dcf00..5edf74f0 100644 --- a/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh +++ b/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh @@ -7,9 +7,9 @@ class Pl_ASCIIHexDecoder: public Pipeline { public: Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next); - virtual ~Pl_ASCIIHexDecoder() = default; - virtual void write(unsigned char const* buf, size_t len); - virtual void finish(); + ~Pl_ASCIIHexDecoder() override = default; + void write(unsigned char const* buf, size_t len) override; + void finish() override; private: void flush(); diff --git a/libqpdf/qpdf/Pl_Base64.hh b/libqpdf/qpdf/Pl_Base64.hh index 0e490cfe..a084a17f 100644 --- a/libqpdf/qpdf/Pl_Base64.hh +++ b/libqpdf/qpdf/Pl_Base64.hh @@ -8,7 +8,7 @@ class Pl_Base64: public Pipeline public: enum action_e { a_encode, a_decode }; Pl_Base64(char const* identifier, Pipeline* next, action_e); - virtual ~Pl_Base64() = default; + ~Pl_Base64() override = default; void write(unsigned char const* buf, size_t len) override; void finish() override; diff --git a/libqpdf/qpdf/Pl_PNGFilter.hh b/libqpdf/qpdf/Pl_PNGFilter.hh index 6cc34a9c..7ab7bf0d 100644 --- a/libqpdf/qpdf/Pl_PNGFilter.hh +++ b/libqpdf/qpdf/Pl_PNGFilter.hh @@ -22,10 +22,10 @@ class Pl_PNGFilter: public Pipeline unsigned int columns, unsigned int samples_per_pixel = 1, unsigned int bits_per_sample = 8); - virtual ~Pl_PNGFilter() = default; + ~Pl_PNGFilter() override = default; - virtual void write(unsigned char const* data, size_t len); - virtual void finish(); + void write(unsigned char const* data, size_t len) override; + void finish() override; private: void decodeSub(); diff --git a/libqpdf/qpdf/Pl_RC4.hh b/libqpdf/qpdf/Pl_RC4.hh index 07b8a1c4..49c943b9 100644 --- a/libqpdf/qpdf/Pl_RC4.hh +++ b/libqpdf/qpdf/Pl_RC4.hh @@ -17,10 +17,10 @@ class Pl_RC4: public Pipeline unsigned char const* key_data, int key_len = -1, size_t out_bufsize = def_bufsize); - virtual ~Pl_RC4() = default; + ~Pl_RC4() override = default; - virtual void write(unsigned char const* data, size_t len); - virtual void finish(); + void write(unsigned char const* data, size_t len) override; + void finish() override; private: std::shared_ptr outbuf; diff --git a/libqpdf/qpdf/Pl_SHA2.hh b/libqpdf/qpdf/Pl_SHA2.hh index 99a19a37..571271eb 100644 --- a/libqpdf/qpdf/Pl_SHA2.hh +++ b/libqpdf/qpdf/Pl_SHA2.hh @@ -21,9 +21,9 @@ class Pl_SHA2: public Pipeline { public: Pl_SHA2(int bits = 0, Pipeline* next = nullptr); - virtual ~Pl_SHA2() = default; - virtual void write(unsigned char const*, size_t); - virtual void finish(); + ~Pl_SHA2() override = default; + void write(unsigned char const*, size_t) override; + void finish() override; void resetBits(int bits); std::string getHexDigest(); std::string getRawDigest(); diff --git a/libqpdf/qpdf/Pl_TIFFPredictor.hh b/libqpdf/qpdf/Pl_TIFFPredictor.hh index 2b3bdb10..6bc48e72 100644 --- a/libqpdf/qpdf/Pl_TIFFPredictor.hh +++ b/libqpdf/qpdf/Pl_TIFFPredictor.hh @@ -18,10 +18,10 @@ class Pl_TIFFPredictor: public Pipeline unsigned int columns, unsigned int samples_per_pixel = 1, unsigned int bits_per_sample = 8); - virtual ~Pl_TIFFPredictor() = default; + ~Pl_TIFFPredictor() override = default; - virtual void write(unsigned char const* data, size_t len); - virtual void finish(); + void write(unsigned char const* data, size_t len) override; + void finish() override; private: void processRow(); diff --git a/libtests/dct_compress.cc b/libtests/dct_compress.cc index 2f12aea7..1f969982 100644 --- a/libtests/dct_compress.cc +++ b/libtests/dct_compress.cc @@ -22,8 +22,8 @@ class Callback: public Pl_DCT::CompressConfig called(false) { } - virtual ~Callback() = default; - virtual void apply(jpeg_compress_struct*); + ~Callback() override = default; + void apply(jpeg_compress_struct*) override; bool called; }; diff --git a/libtests/input_source.cc b/libtests/input_source.cc index 83744250..9ab41b5d 100644 --- a/libtests/input_source.cc +++ b/libtests/input_source.cc @@ -24,8 +24,8 @@ class Finder: public InputSource::Finder after(after) { } - virtual ~Finder() = default; - virtual bool check(); + ~Finder() override = default; + bool check() override; private: std::shared_ptr is;