From e28f4efb00d5040fa71532d76e63aa7ade105c99 Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 12:22:32 +0100 Subject: Replace deprecated C++ includes --- 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 +- 8 files changed, 9 insertions(+), 9 deletions(-) (limited to 'include') 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 { -- cgit v1.2.3-70-g09d2 From d0682f0f609e979ba085d93a1a0d8e0559f739bb Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 12:46:50 +0100 Subject: 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(-) (limited to 'include') 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; -- cgit v1.2.3-70-g09d2 From ba5a3567a262efdfc171decf481b716ea29743d6 Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 13:56:33 +0100 Subject: 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(-) (limited to 'include') 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&); -- cgit v1.2.3-70-g09d2 From e6577a1323cd813a92ddbc8841e1342c05de071a Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 14:25:46 +0100 Subject: 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(-) (limited to 'include') 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; -- cgit v1.2.3-70-g09d2