Commit fd17c8e3fe38a56abf50ce0edec1cde48d4f74cb
Committed by
GitHub
Merge pull request #963 from m-holger/tidy
Code tidy
Showing
148 changed files
with
400 additions
and
483 deletions
examples/pdf-bookmarks.cc
| ... | ... | @@ -5,8 +5,8 @@ |
| 5 | 5 | #include <qpdf/QTC.hh> |
| 6 | 6 | #include <qpdf/QUtil.hh> |
| 7 | 7 | #include <iostream> |
| 8 | -#include <stdlib.h> | |
| 9 | -#include <string.h> | |
| 8 | +#include <cstdlib> | |
| 9 | +#include <cstring> | |
| 10 | 10 | |
| 11 | 11 | // This program demonstrates extraction of bookmarks using the qpdf |
| 12 | 12 | // outlines API. Note that all the information shown by this program | ... | ... |
examples/pdf-count-strings.cc
| ... | ... | @@ -5,14 +5,12 @@ |
| 5 | 5 | // |
| 6 | 6 | |
| 7 | 7 | #include <iostream> |
| 8 | -#include <stdlib.h> | |
| 9 | -#include <string.h> | |
| 8 | +#include <cstdlib> | |
| 10 | 9 | |
| 11 | 10 | #include <qpdf/Pl_StdioFile.hh> |
| 12 | 11 | #include <qpdf/QPDF.hh> |
| 13 | 12 | #include <qpdf/QPDFObjectHandle.hh> |
| 14 | 13 | #include <qpdf/QPDFPageDocumentHelper.hh> |
| 15 | -#include <qpdf/QPDFPageObjectHelper.hh> | |
| 16 | 14 | #include <qpdf/QUtil.hh> |
| 17 | 15 | |
| 18 | 16 | static char const* whoami = nullptr; |
| ... | ... | @@ -32,9 +30,9 @@ class StringCounter: public QPDFObjectHandle::TokenFilter |
| 32 | 30 | count(0) |
| 33 | 31 | { |
| 34 | 32 | } |
| 35 | - virtual ~StringCounter() = default; | |
| 36 | - virtual void handleToken(QPDFTokenizer::Token const&); | |
| 37 | - virtual void handleEOF(); | |
| 33 | + ~StringCounter() override = default; | |
| 34 | + void handleToken(QPDFTokenizer::Token const&) override; | |
| 35 | + void handleEOF() override; | |
| 38 | 36 | int getCount() const; |
| 39 | 37 | |
| 40 | 38 | private: | ... | ... |
examples/pdf-create.cc
| ... | ... | @@ -12,13 +12,11 @@ |
| 12 | 12 | #include <qpdf/QPDF.hh> |
| 13 | 13 | #include <qpdf/QPDFObjectHandle.hh> |
| 14 | 14 | #include <qpdf/QPDFPageDocumentHelper.hh> |
| 15 | -#include <qpdf/QPDFPageObjectHelper.hh> | |
| 16 | 15 | #include <qpdf/QPDFWriter.hh> |
| 17 | 16 | #include <qpdf/QUtil.hh> |
| 18 | 17 | #include <iostream> |
| 19 | 18 | #include <memory> |
| 20 | -#include <stdlib.h> | |
| 21 | -#include <string.h> | |
| 19 | +#include <cstdlib> | |
| 22 | 20 | |
| 23 | 21 | static char const* whoami = nullptr; |
| 24 | 22 | |
| ... | ... | @@ -28,8 +26,8 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider |
| 28 | 26 | { |
| 29 | 27 | public: |
| 30 | 28 | ImageProvider(std::string const& color_space, std::string const& filter); |
| 31 | - virtual ~ImageProvider() = default; | |
| 32 | - virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline); | |
| 29 | + ~ImageProvider() override = default; | |
| 30 | + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override; | |
| 33 | 31 | size_t getWidth() const; |
| 34 | 32 | size_t getHeight() const; |
| 35 | 33 | |
| ... | ... | @@ -168,7 +166,7 @@ add_page( |
| 168 | 166 | // mode. Since we are not specifying, QPDFWriter will compress |
| 169 | 167 | // with /FlateDecode if we don't provide any other form of |
| 170 | 168 | // compression. |
| 171 | - ImageProvider* p = new ImageProvider(color_space, filter); | |
| 169 | + auto* p = new ImageProvider(color_space, filter); | |
| 172 | 170 | std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p); |
| 173 | 171 | size_t width = p->getWidth(); |
| 174 | 172 | size_t height = p->getHeight(); |
| ... | ... | @@ -288,7 +286,7 @@ check( |
| 288 | 286 | if (!this_errors) { |
| 289 | 287 | // Check image data |
| 290 | 288 | auto actual_data = image.getStreamData(qpdf_dl_all); |
| 291 | - ImageProvider* p = new ImageProvider(desired_color_space, "null"); | |
| 289 | + auto* p = new ImageProvider(desired_color_space, "null"); | |
| 292 | 290 | std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p); |
| 293 | 291 | Pl_Buffer b_p("get image data"); |
| 294 | 292 | provider->provideStreamData(QPDFObjGen(), &b_p); | ... | ... |
examples/pdf-custom-filter.cc
| ... | ... | @@ -48,9 +48,9 @@ class Pl_XOR: public Pipeline |
| 48 | 48 | |
| 49 | 49 | public: |
| 50 | 50 | Pl_XOR(char const* identifier, Pipeline* next, unsigned char key); |
| 51 | - virtual ~Pl_XOR() = default; | |
| 52 | - virtual void write(unsigned char const* data, size_t len) override; | |
| 53 | - virtual void finish() override; | |
| 51 | + ~Pl_XOR() override = default; | |
| 52 | + void write(unsigned char const* data, size_t len) override; | |
| 53 | + void finish() override; | |
| 54 | 54 | |
| 55 | 55 | private: |
| 56 | 56 | unsigned char key; |
| ... | ... | @@ -91,10 +91,10 @@ class SF_XORDecode: public QPDFStreamFilter |
| 91 | 91 | // filter, which just means QPDF assumes that it should not |
| 92 | 92 | // "uncompress" the stream by default. |
| 93 | 93 | public: |
| 94 | - virtual ~SF_XORDecode() = default; | |
| 95 | - virtual bool setDecodeParms(QPDFObjectHandle decode_parms) override; | |
| 96 | - virtual Pipeline* getDecodePipeline(Pipeline* next) override; | |
| 97 | - virtual bool isSpecializedCompression() override; | |
| 94 | + ~SF_XORDecode() override = default; | |
| 95 | + bool setDecodeParms(QPDFObjectHandle decode_parms) override; | |
| 96 | + Pipeline* getDecodePipeline(Pipeline* next) override; | |
| 97 | + bool isSpecializedCompression() override; | |
| 98 | 98 | |
| 99 | 99 | private: |
| 100 | 100 | unsigned char key; |
| ... | ... | @@ -199,8 +199,8 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider |
| 199 | 199 | |
| 200 | 200 | public: |
| 201 | 201 | StreamReplacer(QPDF* pdf); |
| 202 | - virtual ~StreamReplacer() = default; | |
| 203 | - virtual void | |
| 202 | + ~StreamReplacer() override = default; | |
| 203 | + void | |
| 204 | 204 | provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override; |
| 205 | 205 | |
| 206 | 206 | void registerStream( |
| ... | ... | @@ -409,7 +409,7 @@ process( |
| 409 | 409 | // Create a single StreamReplacer instance. The interface requires |
| 410 | 410 | // a std::shared_ptr in various places, so allocate a StreamReplacer |
| 411 | 411 | // and stash it in a std::shared_ptr. |
| 412 | - StreamReplacer* replacer = new StreamReplacer(&qpdf); | |
| 412 | + auto* replacer = new StreamReplacer(&qpdf); | |
| 413 | 413 | std::shared_ptr<QPDFObjectHandle::StreamDataProvider> p(replacer); |
| 414 | 414 | |
| 415 | 415 | for (auto& o: qpdf.getAllObjects()) { | ... | ... |
examples/pdf-double-page-size.cc
examples/pdf-filter-tokens.cc
| ... | ... | @@ -8,13 +8,11 @@ |
| 8 | 8 | #include <algorithm> |
| 9 | 9 | #include <deque> |
| 10 | 10 | #include <iostream> |
| 11 | -#include <stdlib.h> | |
| 12 | -#include <string.h> | |
| 11 | +#include <cstdlib> | |
| 13 | 12 | |
| 14 | 13 | #include <qpdf/QPDF.hh> |
| 15 | 14 | #include <qpdf/QPDFObjectHandle.hh> |
| 16 | 15 | #include <qpdf/QPDFPageDocumentHelper.hh> |
| 17 | -#include <qpdf/QPDFPageObjectHelper.hh> | |
| 18 | 16 | #include <qpdf/QPDFWriter.hh> |
| 19 | 17 | #include <qpdf/QUtil.hh> |
| 20 | 18 | |
| ... | ... | @@ -35,8 +33,8 @@ usage() |
| 35 | 33 | class StringReverser: public QPDFObjectHandle::TokenFilter |
| 36 | 34 | { |
| 37 | 35 | public: |
| 38 | - virtual ~StringReverser() = default; | |
| 39 | - virtual void handleToken(QPDFTokenizer::Token const&); | |
| 36 | + ~StringReverser() override = default; | |
| 37 | + void handleToken(QPDFTokenizer::Token const&) override; | |
| 40 | 38 | }; |
| 41 | 39 | |
| 42 | 40 | void |
| ... | ... | @@ -68,9 +66,9 @@ StringReverser::handleToken(QPDFTokenizer::Token const& token) |
| 68 | 66 | class ColorToGray: public QPDFObjectHandle::TokenFilter |
| 69 | 67 | { |
| 70 | 68 | public: |
| 71 | - virtual ~ColorToGray() = default; | |
| 72 | - virtual void handleToken(QPDFTokenizer::Token const&); | |
| 73 | - virtual void handleEOF(); | |
| 69 | + ~ColorToGray() override = default; | |
| 70 | + void handleToken(QPDFTokenizer::Token const&) override; | |
| 71 | + void handleEOF() override; | |
| 74 | 72 | |
| 75 | 73 | private: |
| 76 | 74 | bool isNumeric(QPDFTokenizer::token_type_e); | ... | ... |
examples/pdf-invert-images.cc
| ... | ... | @@ -6,8 +6,8 @@ |
| 6 | 6 | #include <qpdf/QPDFWriter.hh> |
| 7 | 7 | #include <qpdf/QUtil.hh> |
| 8 | 8 | #include <iostream> |
| 9 | -#include <stdlib.h> | |
| 10 | -#include <string.h> | |
| 9 | +#include <cstdlib> | |
| 10 | +#include <cstring> | |
| 11 | 11 | |
| 12 | 12 | static char const* whoami = nullptr; |
| 13 | 13 | |
| ... | ... | @@ -33,8 +33,8 @@ usage() |
| 33 | 33 | class ImageInverter: public QPDFObjectHandle::StreamDataProvider |
| 34 | 34 | { |
| 35 | 35 | public: |
| 36 | - virtual ~ImageInverter() = default; | |
| 37 | - virtual void | |
| 36 | + ~ImageInverter() override = default; | |
| 37 | + void | |
| 38 | 38 | provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override; |
| 39 | 39 | |
| 40 | 40 | void registerImage( |
| ... | ... | @@ -124,7 +124,7 @@ main(int argc, char* argv[]) |
| 124 | 124 | QPDF qpdf; |
| 125 | 125 | qpdf.processFile(infilename, password); |
| 126 | 126 | |
| 127 | - ImageInverter* inv = new ImageInverter; | |
| 127 | + auto* inv = new ImageInverter; | |
| 128 | 128 | auto p = std::shared_ptr<QPDFObjectHandle::StreamDataProvider>(inv); |
| 129 | 129 | |
| 130 | 130 | // For each page... | ... | ... |
examples/pdf-mod-info.cc
| ... | ... | @@ -6,9 +6,9 @@ |
| 6 | 6 | #include <qpdf/QTC.hh> |
| 7 | 7 | #include <qpdf/QUtil.hh> |
| 8 | 8 | #include <iostream> |
| 9 | -#include <stdio.h> | |
| 10 | -#include <stdlib.h> | |
| 11 | -#include <string.h> | |
| 9 | +#include <cstdio> | |
| 10 | +#include <cstdlib> | |
| 11 | +#include <cstring> | |
| 12 | 12 | |
| 13 | 13 | static char const* version = "1.1"; |
| 14 | 14 | static char const* whoami = nullptr; | ... | ... |
examples/pdf-name-number-tree.cc
examples/pdf-npages.cc
examples/pdf-overlay-page.cc
| ... | ... | @@ -4,8 +4,7 @@ |
| 4 | 4 | #include <qpdf/QPDFWriter.hh> |
| 5 | 5 | #include <qpdf/QUtil.hh> |
| 6 | 6 | #include <iostream> |
| 7 | -#include <stdlib.h> | |
| 8 | -#include <string.h> | |
| 7 | +#include <cstdlib> | |
| 9 | 8 | |
| 10 | 9 | // This program demonstrates use of form XObjects to overlay a page |
| 11 | 10 | // from one file onto all pages of another file. The qpdf program's | ... | ... |
examples/pdf-parse-content.cc
| 1 | 1 | #include <iostream> |
| 2 | -#include <stdlib.h> | |
| 3 | -#include <string.h> | |
| 2 | +#include <cstdlib> | |
| 4 | 3 | |
| 5 | 4 | #include <qpdf/QIntC.hh> |
| 6 | 5 | #include <qpdf/QPDF.hh> |
| ... | ... | @@ -23,10 +22,10 @@ usage() |
| 23 | 22 | class ParserCallbacks: public QPDFObjectHandle::ParserCallbacks |
| 24 | 23 | { |
| 25 | 24 | public: |
| 26 | - virtual ~ParserCallbacks() = default; | |
| 27 | - virtual void contentSize(size_t); | |
| 28 | - virtual void handleObject(QPDFObjectHandle, size_t offset, size_t length); | |
| 29 | - virtual void handleEOF(); | |
| 25 | + ~ParserCallbacks() override = default; | |
| 26 | + void contentSize(size_t) override; | |
| 27 | + void handleObject(QPDFObjectHandle, size_t offset, size_t length) override; | |
| 28 | + void handleEOF() override; | |
| 30 | 29 | }; |
| 31 | 30 | |
| 32 | 31 | void | ... | ... |
examples/pdf-set-form-values.cc
examples/pdf-split-pages.cc
examples/qpdf-job.cc
examples/qpdfjob-c-save-attachment.c
examples/qpdfjob-remove-annotations.cc
| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | |
| 5 | 5 | #include <cstdio> |
| 6 | 6 | #include <cstdlib> |
| 7 | -#include <cstring> | |
| 8 | 7 | #include <iostream> |
| 9 | 8 | |
| 10 | 9 | // This example demonstrates how we can use the QPDFJob createQPDF and writeQPDF |
| ... | ... | @@ -12,7 +11,7 @@ |
| 12 | 11 | // The example is a full copy of the qpdf program modified to allways remove all |
| 13 | 12 | // annotations from the final output. |
| 14 | 13 | |
| 15 | -static char const* whoami = 0; | |
| 14 | +static char const* whoami = nullptr; | |
| 16 | 15 | |
| 17 | 16 | static void |
| 18 | 17 | usageExit(std::string const& msg) | ... | ... |
fuzz/qpdf_fuzzer.cc
| ... | ... | @@ -14,13 +14,13 @@ |
| 14 | 14 | class DiscardContents: public QPDFObjectHandle::ParserCallbacks |
| 15 | 15 | { |
| 16 | 16 | public: |
| 17 | - virtual ~DiscardContents() = default; | |
| 18 | - virtual void | |
| 19 | - handleObject(QPDFObjectHandle) | |
| 17 | + ~DiscardContents() override = default; | |
| 18 | + void | |
| 19 | + handleObject(QPDFObjectHandle) override | |
| 20 | 20 | { |
| 21 | 21 | } |
| 22 | - virtual void | |
| 23 | - handleEOF() | |
| 22 | + void | |
| 23 | + handleEOF() override | |
| 24 | 24 | { |
| 25 | 25 | } |
| 26 | 26 | }; | ... | ... |
include/qpdf/Buffer.hh
include/qpdf/InputSource.hh
include/qpdf/JSON.hh
| ... | ... | @@ -369,8 +369,8 @@ class JSON |
| 369 | 369 | JSON_value(vt_dictionary) |
| 370 | 370 | { |
| 371 | 371 | } |
| 372 | - virtual ~JSON_dictionary() = default; | |
| 373 | - virtual void write(Pipeline*, size_t depth) const; | |
| 372 | + ~JSON_dictionary() override = default; | |
| 373 | + void write(Pipeline*, size_t depth) const override; | |
| 374 | 374 | std::map<std::string, JSON> members; |
| 375 | 375 | std::set<std::string> parsed_keys; |
| 376 | 376 | }; |
| ... | ... | @@ -380,15 +380,15 @@ class JSON |
| 380 | 380 | JSON_value(vt_array) |
| 381 | 381 | { |
| 382 | 382 | } |
| 383 | - virtual ~JSON_array() = default; | |
| 384 | - virtual void write(Pipeline*, size_t depth) const; | |
| 383 | + ~JSON_array() override = default; | |
| 384 | + void write(Pipeline*, size_t depth) const override; | |
| 385 | 385 | std::vector<JSON> elements; |
| 386 | 386 | }; |
| 387 | 387 | struct JSON_string: public JSON_value |
| 388 | 388 | { |
| 389 | 389 | JSON_string(std::string const& utf8); |
| 390 | - virtual ~JSON_string() = default; | |
| 391 | - virtual void write(Pipeline*, size_t depth) const; | |
| 390 | + ~JSON_string() override = default; | |
| 391 | + void write(Pipeline*, size_t depth) const override; | |
| 392 | 392 | std::string utf8; |
| 393 | 393 | std::string encoded; |
| 394 | 394 | }; |
| ... | ... | @@ -397,15 +397,15 @@ class JSON |
| 397 | 397 | JSON_number(long long val); |
| 398 | 398 | JSON_number(double val); |
| 399 | 399 | JSON_number(std::string const& val); |
| 400 | - virtual ~JSON_number() = default; | |
| 401 | - virtual void write(Pipeline*, size_t depth) const; | |
| 400 | + ~JSON_number() override = default; | |
| 401 | + void write(Pipeline*, size_t depth) const override; | |
| 402 | 402 | std::string encoded; |
| 403 | 403 | }; |
| 404 | 404 | struct JSON_bool: public JSON_value |
| 405 | 405 | { |
| 406 | 406 | JSON_bool(bool val); |
| 407 | - virtual ~JSON_bool() = default; | |
| 408 | - virtual void write(Pipeline*, size_t depth) const; | |
| 407 | + ~JSON_bool() override = default; | |
| 408 | + void write(Pipeline*, size_t depth) const override; | |
| 409 | 409 | bool value; |
| 410 | 410 | }; |
| 411 | 411 | struct JSON_null: public JSON_value |
| ... | ... | @@ -414,14 +414,14 @@ class JSON |
| 414 | 414 | JSON_value(vt_null) |
| 415 | 415 | { |
| 416 | 416 | } |
| 417 | - virtual ~JSON_null() = default; | |
| 418 | - virtual void write(Pipeline*, size_t depth) const; | |
| 417 | + ~JSON_null() override = default; | |
| 418 | + void write(Pipeline*, size_t depth) const override; | |
| 419 | 419 | }; |
| 420 | 420 | struct JSON_blob: public JSON_value |
| 421 | 421 | { |
| 422 | 422 | JSON_blob(std::function<void(Pipeline*)> fn); |
| 423 | - virtual ~JSON_blob() = default; | |
| 424 | - virtual void write(Pipeline*, size_t depth) const; | |
| 423 | + ~JSON_blob() override = default; | |
| 424 | + void write(Pipeline*, size_t depth) const override; | |
| 425 | 425 | std::function<void(Pipeline*)> fn; |
| 426 | 426 | }; |
| 427 | 427 | ... | ... |
include/qpdf/Pl_Buffer.hh
| ... | ... | @@ -43,13 +43,13 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline |
| 43 | 43 | { |
| 44 | 44 | public: |
| 45 | 45 | QPDF_DLL |
| 46 | - Pl_Buffer(char const* identifier, Pipeline* next = 0); | |
| 46 | + Pl_Buffer(char const* identifier, Pipeline* next = nullptr); | |
| 47 | 47 | QPDF_DLL |
| 48 | - virtual ~Pl_Buffer(); | |
| 48 | + ~Pl_Buffer() override; | |
| 49 | 49 | QPDF_DLL |
| 50 | - virtual void write(unsigned char const*, size_t); | |
| 50 | + void write(unsigned char const*, size_t) override; | |
| 51 | 51 | QPDF_DLL |
| 52 | - virtual void finish(); | |
| 52 | + void finish() override; | |
| 53 | 53 | |
| 54 | 54 | // Each call to getBuffer() resets this object -- see notes above. |
| 55 | 55 | // The caller is responsible for deleting the returned Buffer | ... | ... |
include/qpdf/Pl_DCT.hh
| ... | ... | @@ -57,7 +57,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline |
| 57 | 57 | JDIMENSION image_height, |
| 58 | 58 | int components, |
| 59 | 59 | J_COLOR_SPACE color_space, |
| 60 | - CompressConfig* config_callback = 0); | |
| 60 | + CompressConfig* config_callback = nullptr); | |
| 61 | 61 | |
| 62 | 62 | QPDF_DLL |
| 63 | 63 | virtual ~Pl_DCT(); |
| ... | ... | @@ -91,7 +91,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline |
| 91 | 91 | JDIMENSION image_height = 0, |
| 92 | 92 | int components = 1, |
| 93 | 93 | J_COLOR_SPACE color_space = JCS_GRAYSCALE, |
| 94 | - CompressConfig* config_callback = 0); | |
| 94 | + CompressConfig* config_callback = nullptr); | |
| 95 | 95 | Members(Members const&) = delete; |
| 96 | 96 | |
| 97 | 97 | action_e action; | ... | ... |
include/qpdf/Pl_QPDFTokenizer.hh
| ... | ... | @@ -51,7 +51,7 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline |
| 51 | 51 | Pl_QPDFTokenizer( |
| 52 | 52 | char const* identifier, |
| 53 | 53 | QPDFObjectHandle::TokenFilter* filter, |
| 54 | - Pipeline* next = 0); | |
| 54 | + Pipeline* next = nullptr); | |
| 55 | 55 | QPDF_DLL |
| 56 | 56 | virtual ~Pl_QPDFTokenizer(); |
| 57 | 57 | QPDF_DLL | ... | ... |
include/qpdf/Pl_StdioFile.hh
include/qpdf/QPDF.hh
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | #include <list> |
| 31 | 31 | #include <map> |
| 32 | 32 | #include <memory> |
| 33 | -#include <stdio.h> | |
| 33 | +#include <cstdio> | |
| 34 | 34 | #include <string> |
| 35 | 35 | #include <string_view> |
| 36 | 36 | #include <vector> |
| ... | ... | @@ -83,7 +83,7 @@ class QPDF |
| 83 | 83 | // interpreted as a raw encryption key. See comments on |
| 84 | 84 | // setPasswordIsHexKey for more information. |
| 85 | 85 | QPDF_DLL |
| 86 | - void processFile(char const* filename, char const* password = 0); | |
| 86 | + void processFile(char const* filename, char const* password = nullptr); | |
| 87 | 87 | |
| 88 | 88 | // Parse a PDF from a stdio FILE*. The FILE must be open in |
| 89 | 89 | // binary mode and must be seekable. It may be open read only. |
| ... | ... | @@ -96,7 +96,7 @@ class QPDF |
| 96 | 96 | char const* description, |
| 97 | 97 | FILE* file, |
| 98 | 98 | bool close_file, |
| 99 | - char const* password = 0); | |
| 99 | + char const* password = nullptr); | |
| 100 | 100 | |
| 101 | 101 | // Parse a PDF file loaded into a memory buffer. This works |
| 102 | 102 | // exactly like processFile except that the PDF file is in memory |
| ... | ... | @@ -107,14 +107,14 @@ class QPDF |
| 107 | 107 | char const* description, |
| 108 | 108 | char const* buf, |
| 109 | 109 | size_t length, |
| 110 | - char const* password = 0); | |
| 110 | + char const* password = nullptr); | |
| 111 | 111 | |
| 112 | 112 | // Parse a PDF file loaded from a custom InputSource. If you have |
| 113 | 113 | // your own method of retrieving a PDF file, you can subclass |
| 114 | 114 | // InputSource and use this method. |
| 115 | 115 | QPDF_DLL |
| 116 | 116 | void |
| 117 | - processInputSource(std::shared_ptr<InputSource>, char const* password = 0); | |
| 117 | + processInputSource(std::shared_ptr<InputSource>, char const* password = nullptr); | |
| 118 | 118 | |
| 119 | 119 | // Create a PDF from an input source that contains JSON as written |
| 120 | 120 | // by writeJSON (or qpdf --json-output, version 2 or higher). The | ... | ... |
include/qpdf/QPDFCryptoImpl.hh
include/qpdf/QPDFJob.hh
| ... | ... | @@ -497,7 +497,7 @@ class QPDFJob |
| 497 | 497 | |
| 498 | 498 | // Helper functions |
| 499 | 499 | static void usage(std::string const& msg); |
| 500 | - static JSON json_schema(int json_version, std::set<std::string>* keys = 0); | |
| 500 | + static JSON json_schema(int json_version, std::set<std::string>* keys = nullptr); | |
| 501 | 501 | static void parse_object_id( |
| 502 | 502 | std::string const& objspec, bool& trailer, int& obj, int& gen); |
| 503 | 503 | void parseRotationParameter(std::string const&); | ... | ... |
include/qpdf/QPDFObjectHandle.hh
| ... | ... | @@ -526,7 +526,7 @@ class QPDFObjectHandle |
| 526 | 526 | QPDF_DLL |
| 527 | 527 | void parsePageContents(ParserCallbacks* callbacks); |
| 528 | 528 | QPDF_DLL |
| 529 | - void filterPageContents(TokenFilter* filter, Pipeline* next = 0); | |
| 529 | + void filterPageContents(TokenFilter* filter, Pipeline* next = nullptr); | |
| 530 | 530 | // See comments for QPDFPageObjectHelper::pipeContents. |
| 531 | 531 | QPDF_DLL |
| 532 | 532 | void pipePageContents(Pipeline* p); |
| ... | ... | @@ -538,7 +538,7 @@ class QPDFObjectHandle |
| 538 | 538 | // contents. This can be used to apply a TokenFilter to a form |
| 539 | 539 | // XObject, whose data is in the same format as a content stream. |
| 540 | 540 | QPDF_DLL |
| 541 | - void filterAsContents(TokenFilter* filter, Pipeline* next = 0); | |
| 541 | + void filterAsContents(TokenFilter* filter, Pipeline* next = nullptr); | |
| 542 | 542 | // Called on a stream to parse the stream as page contents. This |
| 543 | 543 | // can be used to parse a form XObject. |
| 544 | 544 | QPDF_DLL | ... | ... |
include/qpdf/QPDFOutlineObjectHelper.hh
| ... | ... | @@ -42,7 +42,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper |
| 42 | 42 | { |
| 43 | 43 | // This must be cleared explicitly to avoid circular references |
| 44 | 44 | // that prevent cleanup of pointer holders. |
| 45 | - this->m->parent = 0; | |
| 45 | + this->m->parent = nullptr; | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // All constructors are private. You can only create one of these | ... | ... |
include/qpdf/QPDFPageObjectHelper.hh
| ... | ... | @@ -320,12 +320,12 @@ class QPDFPageObjectHelper: public QPDFObjectHelper |
| 320 | 320 | // examples/pdf-count-strings.cc for an example. |
| 321 | 321 | QPDF_DLL |
| 322 | 322 | void |
| 323 | - filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0); | |
| 323 | + filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); | |
| 324 | 324 | |
| 325 | 325 | // Old name -- calls filterContents() |
| 326 | 326 | QPDF_DLL |
| 327 | 327 | void filterPageContents( |
| 328 | - QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0); | |
| 328 | + QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); | |
| 329 | 329 | |
| 330 | 330 | // Pipe a page's contents through the given pipeline. This method |
| 331 | 331 | // works whether the contents are a single stream or an array of | ... | ... |
include/qpdf/QPDFTokenizer.hh
include/qpdf/QPDFWriter.hh
| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | #include <map> |
| 35 | 35 | #include <memory> |
| 36 | 36 | #include <set> |
| 37 | -#include <stdio.h> | |
| 37 | +#include <cstdio> | |
| 38 | 38 | #include <string> |
| 39 | 39 | #include <string_view> |
| 40 | 40 | #include <vector> |
| ... | ... | @@ -102,7 +102,7 @@ class QPDFWriter |
| 102 | 102 | QPDF_DLL |
| 103 | 103 | virtual ~FunctionProgressReporter(); |
| 104 | 104 | QPDF_DLL |
| 105 | - virtual void reportProgress(int) override; | |
| 105 | + void reportProgress(int) override; | |
| 106 | 106 | |
| 107 | 107 | private: |
| 108 | 108 | std::function<void(int)> handler; |
| ... | ... | @@ -539,7 +539,7 @@ class QPDFWriter |
| 539 | 539 | friend class QPDFWriter; |
| 540 | 540 | |
| 541 | 541 | public: |
| 542 | - PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = 0) : | |
| 542 | + PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = nullptr) : | |
| 543 | 543 | qw(qw), |
| 544 | 544 | bp(bp) |
| 545 | 545 | { | ... | ... |
include/qpdf/QUtil.hh
| ... | ... | @@ -30,9 +30,9 @@ |
| 30 | 30 | #include <list> |
| 31 | 31 | #include <memory> |
| 32 | 32 | #include <stdexcept> |
| 33 | -#include <stdio.h> | |
| 33 | +#include <cstdio> | |
| 34 | 34 | #include <string> |
| 35 | -#include <time.h> | |
| 35 | +#include <ctime> | |
| 36 | 36 | #include <vector> |
| 37 | 37 | |
| 38 | 38 | class RandomDataProvider; |
| ... | ... | @@ -245,7 +245,7 @@ namespace QUtil |
| 245 | 245 | // Returns true iff the variable is defined. If `value' is |
| 246 | 246 | // non-null, initializes it with the value of the variable. |
| 247 | 247 | QPDF_DLL |
| 248 | - bool get_env(std::string const& var, std::string* value = 0); | |
| 248 | + bool get_env(std::string const& var, std::string* value = nullptr); | |
| 249 | 249 | |
| 250 | 250 | QPDF_DLL |
| 251 | 251 | time_t get_current_time(); | ... | ... |
include/qpdf/RandomDataProvider.hh
libqpdf/BufferInputSource.cc
| ... | ... | @@ -2,10 +2,8 @@ |
| 2 | 2 | |
| 3 | 3 | #include <qpdf/QIntC.hh> |
| 4 | 4 | #include <algorithm> |
| 5 | -#include <limits> | |
| 6 | 5 | #include <sstream> |
| 7 | -#include <stdexcept> | |
| 8 | -#include <string.h> | |
| 6 | +#include <cstring> | |
| 9 | 7 | |
| 10 | 8 | BufferInputSource::BufferInputSource( |
| 11 | 9 | std::string const& description, Buffer* buf, bool own_memory) : | ... | ... |
libqpdf/FileInputSource.cc
libqpdf/InputSource.cc
libqpdf/InsecureRandomDataProvider.cc
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | #include <qpdf/QUtil.hh> |
| 4 | 4 | #include <qpdf/qpdf-config.h> |
| 5 | -#include <stdlib.h> | |
| 5 | +#include <cstdlib> | |
| 6 | 6 | |
| 7 | 7 | InsecureRandomDataProvider::InsecureRandomDataProvider() : |
| 8 | 8 | seeded_random(false) |
| ... | ... | @@ -24,7 +24,7 @@ InsecureRandomDataProvider::random() |
| 24 | 24 | // Seed the random number generator with something simple, but |
| 25 | 25 | // just to be interesting, don't use the unmodified current |
| 26 | 26 | // time. It would be better if this were a more secure seed. |
| 27 | - unsigned int seed = | |
| 27 | + auto seed = | |
| 28 | 28 | static_cast<unsigned int>(QUtil::get_current_time() ^ 0xcccc); |
| 29 | 29 | #ifdef HAVE_RANDOM |
| 30 | 30 | ::srandom(seed); | ... | ... |
libqpdf/JSON.cc
| ... | ... | @@ -294,7 +294,7 @@ JSON::addDictionaryMember(std::string const& key, JSON const& val) |
| 294 | 294 | bool |
| 295 | 295 | JSON::checkDictionaryKeySeen(std::string const& key) |
| 296 | 296 | { |
| 297 | - JSON_dictionary* obj = dynamic_cast<JSON_dictionary*>(this->m->value.get()); | |
| 297 | + auto* obj = dynamic_cast<JSON_dictionary*>(this->m->value.get()); | |
| 298 | 298 | if (nullptr == obj) { |
| 299 | 299 | throw std::logic_error( |
| 300 | 300 | "JSON::checkDictionaryKey called on non-dictionary"); |
| ... | ... | @@ -315,7 +315,7 @@ JSON::makeArray() |
| 315 | 315 | JSON |
| 316 | 316 | JSON::addArrayElement(JSON const& val) |
| 317 | 317 | { |
| 318 | - JSON_array* arr = dynamic_cast<JSON_array*>(this->m->value.get()); | |
| 318 | + auto* arr = dynamic_cast<JSON_array*>(this->m->value.get()); | |
| 319 | 319 | if (nullptr == arr) { |
| 320 | 320 | throw std::runtime_error("JSON::addArrayElement called on non-array"); |
| 321 | 321 | } |
| ... | ... | @@ -470,13 +470,13 @@ JSON::checkSchemaInternal( |
| 470 | 470 | std::list<std::string>& errors, |
| 471 | 471 | std::string prefix) |
| 472 | 472 | { |
| 473 | - JSON_array* this_arr = dynamic_cast<JSON_array*>(this_v); | |
| 474 | - JSON_dictionary* this_dict = dynamic_cast<JSON_dictionary*>(this_v); | |
| 473 | + auto* this_arr = dynamic_cast<JSON_array*>(this_v); | |
| 474 | + auto* this_dict = dynamic_cast<JSON_dictionary*>(this_v); | |
| 475 | 475 | |
| 476 | - JSON_array* sch_arr = dynamic_cast<JSON_array*>(sch_v); | |
| 477 | - JSON_dictionary* sch_dict = dynamic_cast<JSON_dictionary*>(sch_v); | |
| 476 | + auto* sch_arr = dynamic_cast<JSON_array*>(sch_v); | |
| 477 | + auto* sch_dict = dynamic_cast<JSON_dictionary*>(sch_v); | |
| 478 | 478 | |
| 479 | - JSON_string* sch_str = dynamic_cast<JSON_string*>(sch_v); | |
| 479 | + auto* sch_str = dynamic_cast<JSON_string*>(sch_v); | |
| 480 | 480 | |
| 481 | 481 | std::string err_prefix; |
| 482 | 482 | if (prefix.empty()) { | ... | ... |
libqpdf/MD5.cc
libqpdf/Pipeline.cc
libqpdf/Pl_AES_PDF.cc
libqpdf/Pl_ASCII85Decoder.cc
libqpdf/Pl_ASCIIHexDecoder.cc
| 1 | 1 | #include <qpdf/Pl_ASCIIHexDecoder.hh> |
| 2 | 2 | |
| 3 | 3 | #include <qpdf/QTC.hh> |
| 4 | -#include <ctype.h> | |
| 4 | +#include <cctype> | |
| 5 | 5 | #include <stdexcept> |
| 6 | -#include <string.h> | |
| 7 | 6 | |
| 8 | 7 | Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) : |
| 9 | 8 | Pipeline(identifier, next), |
| ... | ... | @@ -77,7 +76,7 @@ Pl_ASCIIHexDecoder::flush() |
| 77 | 76 | b[i] = this->inbuf[i] - '0'; |
| 78 | 77 | } |
| 79 | 78 | } |
| 80 | - unsigned char ch = static_cast<unsigned char>((b[0] << 4) + b[1]); | |
| 79 | + auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]); | |
| 81 | 80 | |
| 82 | 81 | QTC::TC( |
| 83 | 82 | "libtests", | ... | ... |
libqpdf/Pl_Base64.cc
libqpdf/Pl_Buffer.cc
| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | |
| 3 | 3 | #include <algorithm> |
| 4 | 4 | #include <stdexcept> |
| 5 | -#include <stdlib.h> | |
| 6 | -#include <string.h> | |
| 5 | +#include <cstdlib> | |
| 6 | +#include <cstring> | |
| 7 | 7 | |
| 8 | 8 | Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) : |
| 9 | 9 | Pipeline(identifier, next), |
| ... | ... | @@ -45,7 +45,7 @@ Pl_Buffer::getBuffer() |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | auto size = this->m->data.length(); |
| 48 | - Buffer* b = new Buffer(size); | |
| 48 | + auto* b = new Buffer(size); | |
| 49 | 49 | if (size > 0) { |
| 50 | 50 | unsigned char* p = b->getBuffer(); |
| 51 | 51 | memcpy(p, this->m->data.data(), size); | ... | ... |
libqpdf/Pl_DCT.cc
| ... | ... | @@ -2,12 +2,9 @@ |
| 2 | 2 | |
| 3 | 3 | #include <qpdf/QIntC.hh> |
| 4 | 4 | #include <qpdf/QTC.hh> |
| 5 | -#include <qpdf/QUtil.hh> | |
| 6 | 5 | |
| 7 | -#include <cstring> | |
| 8 | -#include <setjmp.h> | |
| 6 | +#include <csetjmp> | |
| 9 | 7 | #include <stdexcept> |
| 10 | -#include <stdlib.h> | |
| 11 | 8 | #include <string> |
| 12 | 9 | |
| 13 | 10 | #if BITS_IN_JSAMPLE != 8 |
| ... | ... | @@ -27,7 +24,7 @@ namespace |
| 27 | 24 | static void |
| 28 | 25 | error_handler(j_common_ptr cinfo) |
| 29 | 26 | { |
| 30 | - qpdf_jpeg_error_mgr* jerr = | |
| 27 | + auto* jerr = | |
| 31 | 28 | reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err); |
| 32 | 29 | char buf[JMSG_LENGTH_MAX]; |
| 33 | 30 | (*cinfo->err->format_message)(cinfo, buf); |
| ... | ... | @@ -170,7 +167,7 @@ static boolean |
| 170 | 167 | empty_pipeline_output_buffer(j_compress_ptr cinfo) |
| 171 | 168 | { |
| 172 | 169 | QTC::TC("libtests", "Pl_DCT empty_pipeline_output_buffer"); |
| 173 | - dct_pipeline_dest* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest); | |
| 170 | + auto* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest); | |
| 174 | 171 | dest->next->write(dest->buffer, dest->size); |
| 175 | 172 | dest->pub.next_output_byte = dest->buffer; |
| 176 | 173 | dest->pub.free_in_buffer = dest->size; |
| ... | ... | @@ -181,7 +178,7 @@ static void |
| 181 | 178 | term_pipeline_destination(j_compress_ptr cinfo) |
| 182 | 179 | { |
| 183 | 180 | QTC::TC("libtests", "Pl_DCT term_pipeline_destination"); |
| 184 | - dct_pipeline_dest* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest); | |
| 181 | + auto* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest); | |
| 185 | 182 | dest->next->write(dest->buffer, dest->size - dest->pub.free_in_buffer); |
| 186 | 183 | } |
| 187 | 184 | |
| ... | ... | @@ -195,7 +192,7 @@ jpeg_pipeline_dest( |
| 195 | 192 | reinterpret_cast<j_common_ptr>(cinfo), |
| 196 | 193 | JPOOL_PERMANENT, |
| 197 | 194 | sizeof(dct_pipeline_dest))); |
| 198 | - dct_pipeline_dest* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest); | |
| 195 | + auto* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest); | |
| 199 | 196 | dest->pub.init_destination = init_pipeline_destination; |
| 200 | 197 | dest->pub.empty_output_buffer = empty_pipeline_output_buffer; |
| 201 | 198 | dest->pub.term_destination = term_pipeline_destination; |
| ... | ... | @@ -264,7 +261,7 @@ jpeg_buffer_src(j_decompress_ptr cinfo, Buffer* buffer) |
| 264 | 261 | void |
| 265 | 262 | Pl_DCT::compress(void* cinfo_p, Buffer* b) |
| 266 | 263 | { |
| 267 | - struct jpeg_compress_struct* cinfo = | |
| 264 | + auto* cinfo = | |
| 268 | 265 | reinterpret_cast<jpeg_compress_struct*>(cinfo_p); |
| 269 | 266 | |
| 270 | 267 | #if ( \ |
| ... | ... | @@ -319,7 +316,7 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b) |
| 319 | 316 | void |
| 320 | 317 | Pl_DCT::decompress(void* cinfo_p, Buffer* b) |
| 321 | 318 | { |
| 322 | - struct jpeg_decompress_struct* cinfo = | |
| 319 | + auto* cinfo = | |
| 323 | 320 | reinterpret_cast<jpeg_decompress_struct*>(cinfo_p); |
| 324 | 321 | |
| 325 | 322 | #if ( \ | ... | ... |
libqpdf/Pl_Flate.cc
libqpdf/Pl_Function.cc
libqpdf/Pl_LZWDecoder.cc
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | #include <qpdf/QTC.hh> |
| 5 | 5 | #include <qpdf/QUtil.hh> |
| 6 | 6 | #include <stdexcept> |
| 7 | -#include <string.h> | |
| 7 | +#include <cstring> | |
| 8 | 8 | |
| 9 | 9 | Pl_LZWDecoder::Pl_LZWDecoder( |
| 10 | 10 | char const* identifier, Pipeline* next, bool early_code_change) : |
| ... | ... | @@ -189,7 +189,7 @@ Pl_LZWDecoder::handleCode(unsigned int code) |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if (code < 256) { |
| 192 | - unsigned char ch = static_cast<unsigned char>(code); | |
| 192 | + auto ch = static_cast<unsigned char>(code); | |
| 193 | 193 | getNext()->write(&ch, 1); |
| 194 | 194 | } else { |
| 195 | 195 | unsigned int idx = code - 258; | ... | ... |
libqpdf/Pl_OStream.cc
libqpdf/Pl_PNGFilter.cc
libqpdf/Pl_QPDFTokenizer.cc
libqpdf/Pl_RunLength.cc
| ... | ... | @@ -127,11 +127,11 @@ Pl_RunLength::flush_encode() |
| 127 | 127 | throw std::logic_error( |
| 128 | 128 | "Pl_RunLength: invalid length in flush_encode for run"); |
| 129 | 129 | } |
| 130 | - unsigned char ch = static_cast<unsigned char>(257 - this->m->length); | |
| 130 | + auto ch = static_cast<unsigned char>(257 - this->m->length); | |
| 131 | 131 | this->getNext()->write(&ch, 1); |
| 132 | 132 | this->getNext()->write(&this->m->buf[0], 1); |
| 133 | 133 | } else if (this->m->length > 0) { |
| 134 | - unsigned char ch = static_cast<unsigned char>(this->m->length - 1); | |
| 134 | + auto ch = static_cast<unsigned char>(this->m->length - 1); | |
| 135 | 135 | this->getNext()->write(&ch, 1); |
| 136 | 136 | this->getNext()->write(this->m->buf, this->m->length); |
| 137 | 137 | } | ... | ... |
libqpdf/Pl_SHA2.cc
libqpdf/Pl_StdioFile.cc
libqpdf/Pl_String.cc
libqpdf/Pl_TIFFPredictor.cc
libqpdf/QPDF.cc
| ... | ... | @@ -9,8 +9,8 @@ |
| 9 | 9 | #include <memory.h> |
| 10 | 10 | #include <regex> |
| 11 | 11 | #include <sstream> |
| 12 | -#include <stdlib.h> | |
| 13 | -#include <string.h> | |
| 12 | +#include <cstdlib> | |
| 13 | +#include <cstring> | |
| 14 | 14 | #include <vector> |
| 15 | 15 | |
| 16 | 16 | #include <qpdf/BufferInputSource.hh> |
| ... | ... | @@ -60,42 +60,42 @@ namespace |
| 60 | 60 | class InvalidInputSource: public InputSource |
| 61 | 61 | { |
| 62 | 62 | public: |
| 63 | - virtual ~InvalidInputSource() = default; | |
| 64 | - virtual qpdf_offset_t | |
| 63 | + ~InvalidInputSource() override = default; | |
| 64 | + qpdf_offset_t | |
| 65 | 65 | findAndSkipNextEOL() override |
| 66 | 66 | { |
| 67 | 67 | throwException(); |
| 68 | 68 | return 0; |
| 69 | 69 | } |
| 70 | - virtual std::string const& | |
| 70 | + std::string const& | |
| 71 | 71 | getName() const override |
| 72 | 72 | { |
| 73 | 73 | static std::string name("closed input source"); |
| 74 | 74 | return name; |
| 75 | 75 | } |
| 76 | - virtual qpdf_offset_t | |
| 76 | + qpdf_offset_t | |
| 77 | 77 | tell() override |
| 78 | 78 | { |
| 79 | 79 | throwException(); |
| 80 | 80 | return 0; |
| 81 | 81 | } |
| 82 | - virtual void | |
| 82 | + void | |
| 83 | 83 | seek(qpdf_offset_t offset, int whence) override |
| 84 | 84 | { |
| 85 | 85 | throwException(); |
| 86 | 86 | } |
| 87 | - virtual void | |
| 87 | + void | |
| 88 | 88 | rewind() override |
| 89 | 89 | { |
| 90 | 90 | throwException(); |
| 91 | 91 | } |
| 92 | - virtual size_t | |
| 92 | + size_t | |
| 93 | 93 | read(char* buffer, size_t length) override |
| 94 | 94 | { |
| 95 | 95 | throwException(); |
| 96 | 96 | return 0; |
| 97 | 97 | } |
| 98 | - virtual void | |
| 98 | + void | |
| 99 | 99 | unreadCh(char ch) override |
| 100 | 100 | { |
| 101 | 101 | throwException(); |
| ... | ... | @@ -264,7 +264,7 @@ QPDF::create() |
| 264 | 264 | void |
| 265 | 265 | QPDF::processFile(char const* filename, char const* password) |
| 266 | 266 | { |
| 267 | - FileInputSource* fi = new FileInputSource(filename); | |
| 267 | + auto* fi = new FileInputSource(filename); | |
| 268 | 268 | processInputSource(std::shared_ptr<InputSource>(fi), password); |
| 269 | 269 | } |
| 270 | 270 | |
| ... | ... | @@ -272,7 +272,7 @@ void |
| 272 | 272 | QPDF::processFile( |
| 273 | 273 | char const* description, FILE* filep, bool close_file, char const* password) |
| 274 | 274 | { |
| 275 | - FileInputSource* fi = new FileInputSource(description, filep, close_file); | |
| 275 | + auto* fi = new FileInputSource(description, filep, close_file); | |
| 276 | 276 | processInputSource(std::shared_ptr<InputSource>(fi), password); |
| 277 | 277 | } |
| 278 | 278 | |
| ... | ... | @@ -2537,7 +2537,7 @@ QPDF::getCompressibleObjGens() |
| 2537 | 2537 | if (obj.isStream()) { |
| 2538 | 2538 | QPDFObjectHandle dict = obj.getDict(); |
| 2539 | 2539 | std::set<std::string> keys = dict.getKeys(); |
| 2540 | - for (std::set<std::string>::reverse_iterator iter = keys.rbegin(); | |
| 2540 | + for (auto iter = keys.rbegin(); | |
| 2541 | 2541 | iter != keys.rend(); |
| 2542 | 2542 | ++iter) { |
| 2543 | 2543 | std::string const& key = *iter; |
| ... | ... | @@ -2553,7 +2553,7 @@ QPDF::getCompressibleObjGens() |
| 2553 | 2553 | } |
| 2554 | 2554 | } else if (obj.isDictionary()) { |
| 2555 | 2555 | std::set<std::string> keys = obj.getKeys(); |
| 2556 | - for (std::set<std::string>::reverse_iterator iter = keys.rbegin(); | |
| 2556 | + for (auto iter = keys.rbegin(); | |
| 2557 | 2557 | iter != keys.rend(); |
| 2558 | 2558 | ++iter) { |
| 2559 | 2559 | queue.push_front(obj.getKey(*iter)); | ... | ... |
libqpdf/QPDFAnnotationObjectHelper.cc
libqpdf/QPDFExc.cc
libqpdf/QPDFFormFieldObjectHelper.cc
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | #include <qpdf/QPDFAnnotationObjectHelper.hh> |
| 7 | 7 | #include <qpdf/QTC.hh> |
| 8 | 8 | #include <qpdf/QUtil.hh> |
| 9 | -#include <stdlib.h> | |
| 9 | +#include <cstdlib> | |
| 10 | 10 | |
| 11 | 11 | QPDFFormFieldObjectHelper::QPDFFormFieldObjectHelper(QPDFObjectHandle oh) : |
| 12 | 12 | QPDFObjectHelper(oh), |
| ... | ... | @@ -515,9 +515,9 @@ namespace |
| 515 | 515 | std::vector<std::string> const& opt, |
| 516 | 516 | double tf, |
| 517 | 517 | QPDFObjectHandle::Rectangle const& bbox); |
| 518 | - virtual ~ValueSetter() = default; | |
| 519 | - virtual void handleToken(QPDFTokenizer::Token const&); | |
| 520 | - virtual void handleEOF(); | |
| 518 | + ~ValueSetter() override = default; | |
| 519 | + void handleToken(QPDFTokenizer::Token const&) override; | |
| 520 | + void handleEOF() override; | |
| 521 | 521 | void writeAppearance(); |
| 522 | 522 | |
| 523 | 523 | private: |
| ... | ... | @@ -611,7 +611,7 @@ ValueSetter::writeAppearance() |
| 611 | 611 | // Write one or more lines, centered vertically, possibly with |
| 612 | 612 | // one row highlighted. |
| 613 | 613 | |
| 614 | - size_t max_rows = static_cast<size_t>((bbox.ury - bbox.lly) / tfh); | |
| 614 | + auto max_rows = static_cast<size_t>((bbox.ury - bbox.lly) / tfh); | |
| 615 | 615 | bool highlight = false; |
| 616 | 616 | size_t highlight_idx = 0; |
| 617 | 617 | |
| ... | ... | @@ -706,10 +706,10 @@ namespace |
| 706 | 706 | { |
| 707 | 707 | public: |
| 708 | 708 | TfFinder(); |
| 709 | - virtual ~TfFinder() | |
| 709 | + ~TfFinder() override | |
| 710 | 710 | { |
| 711 | 711 | } |
| 712 | - virtual void handleToken(QPDFTokenizer::Token const&); | |
| 712 | + void handleToken(QPDFTokenizer::Token const&) override; | |
| 713 | 713 | double getTf(); |
| 714 | 714 | std::string getFontName(); |
| 715 | 715 | std::string getDA(); | ... | ... |
libqpdf/QPDFJob.cc
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | #include <cstdio> |
| 4 | 4 | #include <cstdlib> |
| 5 | 5 | #include <cstring> |
| 6 | -#include <ctype.h> | |
| 6 | +#include <cctype> | |
| 7 | 7 | #include <fcntl.h> |
| 8 | 8 | #include <iostream> |
| 9 | 9 | #include <memory> |
| ... | ... | @@ -48,8 +48,8 @@ namespace |
| 48 | 48 | size_t oi_min_height, |
| 49 | 49 | size_t oi_min_area, |
| 50 | 50 | QPDFObjectHandle& image); |
| 51 | - virtual ~ImageOptimizer() = default; | |
| 52 | - virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline); | |
| 51 | + ~ImageOptimizer() override = default; | |
| 52 | + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override; | |
| 53 | 53 | std::shared_ptr<Pipeline> |
| 54 | 54 | makePipeline(std::string const& description, Pipeline* next); |
| 55 | 55 | bool evaluate(std::string const& description); |
| ... | ... | @@ -65,13 +65,13 @@ namespace |
| 65 | 65 | class DiscardContents: public QPDFObjectHandle::ParserCallbacks |
| 66 | 66 | { |
| 67 | 67 | public: |
| 68 | - virtual ~DiscardContents() = default; | |
| 69 | - virtual void | |
| 70 | - handleObject(QPDFObjectHandle) | |
| 68 | + ~DiscardContents() override = default; | |
| 69 | + void | |
| 70 | + handleObject(QPDFObjectHandle) override | |
| 71 | 71 | { |
| 72 | 72 | } |
| 73 | - virtual void | |
| 74 | - handleEOF() | |
| 73 | + void | |
| 74 | + handleEOF() override | |
| 75 | 75 | { |
| 76 | 76 | } |
| 77 | 77 | }; |
| ... | ... | @@ -98,8 +98,8 @@ namespace |
| 98 | 98 | filename(filename) |
| 99 | 99 | { |
| 100 | 100 | } |
| 101 | - virtual ~ProgressReporter() = default; | |
| 102 | - virtual void reportProgress(int); | |
| 101 | + ~ProgressReporter() override = default; | |
| 102 | + void reportProgress(int) override; | |
| 103 | 103 | |
| 104 | 104 | private: |
| 105 | 105 | Pipeline& p; | ... | ... |
libqpdf/QPDFJob_argv.cc
| ... | ... | @@ -3,12 +3,12 @@ |
| 3 | 3 | // See "HOW TO ADD A COMMAND-LINE ARGUMENT" in README-maintainer. |
| 4 | 4 | |
| 5 | 5 | #include <cstdio> |
| 6 | -#include <ctype.h> | |
| 6 | +#include <cctype> | |
| 7 | 7 | #include <iostream> |
| 8 | 8 | #include <memory> |
| 9 | 9 | #include <sstream> |
| 10 | -#include <stdlib.h> | |
| 11 | -#include <string.h> | |
| 10 | +#include <cstdlib> | |
| 11 | +#include <cstring> | |
| 12 | 12 | |
| 13 | 13 | #include <qpdf/QIntC.hh> |
| 14 | 14 | #include <qpdf/QPDFArgParser.hh> | ... | ... |
libqpdf/QPDFLogger.cc
| ... | ... | @@ -17,14 +17,14 @@ namespace |
| 17 | 17 | { |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - virtual void | |
| 20 | + void | |
| 21 | 21 | write(unsigned char const* data, size_t len) override |
| 22 | 22 | { |
| 23 | 23 | this->used = true; |
| 24 | 24 | getNext()->write(data, len); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - virtual void | |
| 27 | + void | |
| 28 | 28 | finish() override |
| 29 | 29 | { |
| 30 | 30 | getNext()->finish(); | ... | ... |
libqpdf/QPDFNameTreeObjectHelper.cc
| ... | ... | @@ -7,18 +7,18 @@ namespace |
| 7 | 7 | class NameTreeDetails: public NNTreeDetails |
| 8 | 8 | { |
| 9 | 9 | public: |
| 10 | - virtual std::string const& | |
| 10 | + std::string const& | |
| 11 | 11 | itemsKey() const override |
| 12 | 12 | { |
| 13 | 13 | static std::string k("/Names"); |
| 14 | 14 | return k; |
| 15 | 15 | } |
| 16 | - virtual bool | |
| 16 | + bool | |
| 17 | 17 | keyValid(QPDFObjectHandle oh) const override |
| 18 | 18 | { |
| 19 | 19 | return oh.isString(); |
| 20 | 20 | } |
| 21 | - virtual int | |
| 21 | + int | |
| 22 | 22 | compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override |
| 23 | 23 | { |
| 24 | 24 | if (!(keyValid(a) && keyValid(b))) { | ... | ... |
libqpdf/QPDFNumberTreeObjectHelper.cc
| ... | ... | @@ -8,18 +8,18 @@ namespace |
| 8 | 8 | class NumberTreeDetails: public NNTreeDetails |
| 9 | 9 | { |
| 10 | 10 | public: |
| 11 | - virtual std::string const& | |
| 11 | + std::string const& | |
| 12 | 12 | itemsKey() const override |
| 13 | 13 | { |
| 14 | 14 | static std::string k("/Nums"); |
| 15 | 15 | return k; |
| 16 | 16 | } |
| 17 | - virtual bool | |
| 17 | + bool | |
| 18 | 18 | keyValid(QPDFObjectHandle oh) const override |
| 19 | 19 | { |
| 20 | 20 | return oh.isInteger(); |
| 21 | 21 | } |
| 22 | - virtual int | |
| 22 | + int | |
| 23 | 23 | compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override |
| 24 | 24 | { |
| 25 | 25 | if (!(keyValid(a) && keyValid(b))) { | ... | ... |
libqpdf/QPDFObjectHandle.cc
| ... | ... | @@ -30,10 +30,10 @@ |
| 30 | 30 | |
| 31 | 31 | #include <algorithm> |
| 32 | 32 | #include <cstring> |
| 33 | -#include <ctype.h> | |
| 34 | -#include <limits.h> | |
| 33 | +#include <cctype> | |
| 34 | +#include <climits> | |
| 35 | 35 | #include <stdexcept> |
| 36 | -#include <stdlib.h> | |
| 36 | +#include <cstdlib> | |
| 37 | 37 | |
| 38 | 38 | using namespace std::literals; |
| 39 | 39 | |
| ... | ... | @@ -111,8 +111,8 @@ namespace |
| 111 | 111 | old_contents(old_contents) |
| 112 | 112 | { |
| 113 | 113 | } |
| 114 | - virtual ~CoalesceProvider() = default; | |
| 115 | - virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline); | |
| 114 | + ~CoalesceProvider() override = default; | |
| 115 | + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override; | |
| 116 | 116 | |
| 117 | 117 | private: |
| 118 | 118 | QPDFObjectHandle containing_page; |
| ... | ... | @@ -200,9 +200,9 @@ namespace |
| 200 | 200 | { |
| 201 | 201 | public: |
| 202 | 202 | LastChar(Pipeline* next); |
| 203 | - virtual ~LastChar() = default; | |
| 204 | - virtual void write(unsigned char const* data, size_t len); | |
| 205 | - virtual void finish(); | |
| 203 | + ~LastChar() override = default; | |
| 204 | + void write(unsigned char const* data, size_t len) override; | |
| 205 | + void finish() override; | |
| 206 | 206 | unsigned char getLastChar(); |
| 207 | 207 | |
| 208 | 208 | private: |
| ... | ... | @@ -1446,13 +1446,13 @@ namespace |
| 1446 | 1446 | { |
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | - virtual void | |
| 1449 | + void | |
| 1450 | 1450 | provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override |
| 1451 | 1451 | { |
| 1452 | 1452 | p1(pipeline); |
| 1453 | 1453 | } |
| 1454 | 1454 | |
| 1455 | - virtual bool | |
| 1455 | + bool | |
| 1456 | 1456 | provideStreamData( |
| 1457 | 1457 | QPDFObjGen const&, |
| 1458 | 1458 | Pipeline* pipeline, | ... | ... |
libqpdf/QPDFParser.cc
libqpdf/QPDFSystemError.cc
libqpdf/QPDFTokenizer.cc
| ... | ... | @@ -11,8 +11,8 @@ |
| 11 | 11 | #include <qpdf/QUtil.hh> |
| 12 | 12 | |
| 13 | 13 | #include <stdexcept> |
| 14 | -#include <stdlib.h> | |
| 15 | -#include <string.h> | |
| 14 | +#include <cstdlib> | |
| 15 | +#include <cstring> | |
| 16 | 16 | |
| 17 | 17 | static inline bool |
| 18 | 18 | is_delimiter(char ch) |
| ... | ... | @@ -35,8 +35,8 @@ namespace |
| 35 | 35 | str(str) |
| 36 | 36 | { |
| 37 | 37 | } |
| 38 | - virtual ~QPDFWordTokenFinder() = default; | |
| 39 | - virtual bool check(); | |
| 38 | + ~QPDFWordTokenFinder() override = default; | |
| 39 | + bool check() override; | |
| 40 | 40 | |
| 41 | 41 | private: |
| 42 | 42 | std::shared_ptr<InputSource> is; | ... | ... |
libqpdf/QPDFWriter.cc
| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | |
| 25 | 25 | #include <algorithm> |
| 26 | 26 | #include <stdexcept> |
| 27 | -#include <stdlib.h> | |
| 27 | +#include <cstdlib> | |
| 28 | 28 | |
| 29 | 29 | QPDFWriter::ProgressReporter::~ProgressReporter() |
| 30 | 30 | { |
| ... | ... | @@ -997,7 +997,7 @@ void |
| 997 | 997 | QPDFWriter::activatePipelineStack(PipelinePopper& pp) |
| 998 | 998 | { |
| 999 | 999 | std::string stack_id("stack " + std::to_string(this->m->next_stack_id)); |
| 1000 | - Pl_Count* c = | |
| 1000 | + auto* c = | |
| 1001 | 1001 | new Pl_Count(stack_id.c_str(), this->m->pipeline_stack.back()); |
| 1002 | 1002 | ++this->m->next_stack_id; |
| 1003 | 1003 | this->m->pipeline_stack.push_back(c); |
| ... | ... | @@ -1030,7 +1030,7 @@ QPDFWriter::PipelinePopper::~PipelinePopper() |
| 1030 | 1030 | qw->m->md5_pipeline = nullptr; |
| 1031 | 1031 | } |
| 1032 | 1032 | qw->m->pipeline_stack.pop_back(); |
| 1033 | - Pl_Buffer* buf = dynamic_cast<Pl_Buffer*>(p); | |
| 1033 | + auto* buf = dynamic_cast<Pl_Buffer*>(p); | |
| 1034 | 1034 | if (bp && buf) { |
| 1035 | 1035 | *bp = buf->getBufferSharedPointer(); |
| 1036 | 1036 | } | ... | ... |
libqpdf/QPDFXRefEntry.cc
libqpdf/QPDF_Array.cc
| ... | ... | @@ -83,7 +83,7 @@ QPDF_Array::copy(bool shallow) |
| 83 | 83 | return do_create(new QPDF_Array(*this)); |
| 84 | 84 | } else { |
| 85 | 85 | if (sparse) { |
| 86 | - QPDF_Array* result = new QPDF_Array(); | |
| 86 | + auto* result = new QPDF_Array(); | |
| 87 | 87 | result->sp_size = sp_size; |
| 88 | 88 | for (auto const& element: sp_elements) { |
| 89 | 89 | auto const& obj = element.second; | ... | ... |
libqpdf/QPDF_Name.cc
libqpdf/QPDF_Stream.cc
| ... | ... | @@ -27,10 +27,10 @@ namespace |
| 27 | 27 | { |
| 28 | 28 | public: |
| 29 | 29 | SF_Crypt() = default; |
| 30 | - virtual ~SF_Crypt() = default; | |
| 30 | + ~SF_Crypt() override = default; | |
| 31 | 31 | |
| 32 | - virtual bool | |
| 33 | - setDecodeParms(QPDFObjectHandle decode_parms) | |
| 32 | + bool | |
| 33 | + setDecodeParms(QPDFObjectHandle decode_parms) override | |
| 34 | 34 | { |
| 35 | 35 | if (decode_parms.isNull()) { |
| 36 | 36 | return true; |
| ... | ... | @@ -49,8 +49,8 @@ namespace |
| 49 | 49 | return filterable; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - virtual Pipeline* | |
| 53 | - getDecodePipeline(Pipeline*) | |
| 52 | + Pipeline* | |
| 53 | + getDecodePipeline(Pipeline*) override | |
| 54 | 54 | { |
| 55 | 55 | // Not used -- handled by pipeStreamData |
| 56 | 56 | return nullptr; |
| ... | ... | @@ -557,7 +557,7 @@ QPDF_Stream::pipeStreamData( |
| 557 | 557 | if (decode_pipeline) { |
| 558 | 558 | pipeline = decode_pipeline; |
| 559 | 559 | } |
| 560 | - Pl_Flate* flate = dynamic_cast<Pl_Flate*>(pipeline); | |
| 560 | + auto* flate = dynamic_cast<Pl_Flate*>(pipeline); | |
| 561 | 561 | if (flate != nullptr) { |
| 562 | 562 | flate->setWarnCallback( |
| 563 | 563 | [this](char const* msg, int code) { warn(msg); }); | ... | ... |
libqpdf/QPDF_String.cc
libqpdf/QPDF_encryption.cc
libqpdf/QPDF_json.cc
| ... | ... | @@ -242,13 +242,13 @@ class QPDF::JSONReactor: public JSON::Reactor |
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | virtual ~JSONReactor() = default; |
| 245 | - virtual void dictionaryStart() override; | |
| 246 | - virtual void arrayStart() override; | |
| 247 | - virtual void containerEnd(JSON const& value) override; | |
| 248 | - virtual void topLevelScalar() override; | |
| 249 | - virtual bool | |
| 245 | + void dictionaryStart() override; | |
| 246 | + void arrayStart() override; | |
| 247 | + void containerEnd(JSON const& value) override; | |
| 248 | + void topLevelScalar() override; | |
| 249 | + bool | |
| 250 | 250 | dictionaryItem(std::string const& key, JSON const& value) override; |
| 251 | - virtual bool arrayItem(JSON const& value) override; | |
| 251 | + bool arrayItem(JSON const& value) override; | |
| 252 | 252 | |
| 253 | 253 | bool anyErrors() const; |
| 254 | 254 | ... | ... |
libqpdf/QPDF_linearization.cc
libqpdf/QPDF_optimization.cc
| ... | ... | @@ -115,7 +115,7 @@ QPDF::optimize( |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | ObjUser root_ou = ObjUser(ObjUser::ou_root); |
| 118 | - QPDFObjGen root_og = QPDFObjGen(root.getObjGen()); | |
| 118 | + auto root_og = QPDFObjGen(root.getObjGen()); | |
| 119 | 119 | this->m->obj_user_to_objects[root_ou].insert(root_og); |
| 120 | 120 | this->m->object_to_obj_users[root_og].insert(root_ou); |
| 121 | 121 | ... | ... |
libqpdf/QTC.cc
libqpdf/QUtil.cc
| ... | ... | @@ -9,9 +9,8 @@ |
| 9 | 9 | #include <qpdf/QPDFSystemError.hh> |
| 10 | 10 | #include <qpdf/QTC.hh> |
| 11 | 11 | |
| 12 | -#include <cmath> | |
| 13 | -#include <ctype.h> | |
| 14 | -#include <errno.h> | |
| 12 | +#include <cctype> | |
| 13 | +#include <cerrno> | |
| 15 | 14 | #include <fcntl.h> |
| 16 | 15 | #include <fstream> |
| 17 | 16 | #include <iomanip> |
| ... | ... | @@ -22,9 +21,9 @@ |
| 22 | 21 | #include <set> |
| 23 | 22 | #include <sstream> |
| 24 | 23 | #include <stdexcept> |
| 25 | -#include <stdio.h> | |
| 26 | -#include <stdlib.h> | |
| 27 | -#include <string.h> | |
| 24 | +#include <cstdio> | |
| 25 | +#include <cstdlib> | |
| 26 | +#include <cstring> | |
| 28 | 27 | #ifndef QPDF_NO_WCHAR_T |
| 29 | 28 | # include <cwchar> |
| 30 | 29 | #endif |
| ... | ... | @@ -837,8 +836,8 @@ char* |
| 837 | 836 | QUtil::getWhoami(char* argv0) |
| 838 | 837 | { |
| 839 | 838 | char* whoami = nullptr; |
| 840 | - if (((whoami = strrchr(argv0, '/')) == NULL) && | |
| 841 | - ((whoami = strrchr(argv0, '\\')) == NULL)) { | |
| 839 | + if (((whoami = strrchr(argv0, '/')) == nullptr) && | |
| 840 | + ((whoami = strrchr(argv0, '\\')) == nullptr)) { | |
| 842 | 841 | whoami = argv0; |
| 843 | 842 | } else { |
| 844 | 843 | ++whoami; | ... | ... |
libqpdf/RC4.cc
libqpdf/qpdf-c.cc
| ... | ... | @@ -15,7 +15,6 @@ |
| 15 | 15 | #include <qpdf/qpdf-c_impl.hh> |
| 16 | 16 | #include <qpdf/qpdflogger-c_impl.hh> |
| 17 | 17 | |
| 18 | -#include <cstring> | |
| 19 | 18 | #include <functional> |
| 20 | 19 | #include <list> |
| 21 | 20 | #include <stdexcept> |
| ... | ... | @@ -107,7 +106,7 @@ qpdf_data |
| 107 | 106 | qpdf_init() |
| 108 | 107 | { |
| 109 | 108 | QTC::TC("qpdf", "qpdf-c called qpdf_init"); |
| 110 | - qpdf_data qpdf = new _qpdf_data(); | |
| 109 | + auto qpdf = new _qpdf_data(); | |
| 111 | 110 | qpdf->qpdf = QPDF::create(); |
| 112 | 111 | return qpdf; |
| 113 | 112 | } | ... | ... |
libqpdf/qpdf/BitStream.hh
libqpdf/qpdf/BitWriter.hh
libqpdf/qpdf/ContentNormalizer.hh
| ... | ... | @@ -7,8 +7,8 @@ class ContentNormalizer: public QPDFObjectHandle::TokenFilter |
| 7 | 7 | { |
| 8 | 8 | public: |
| 9 | 9 | ContentNormalizer(); |
| 10 | - virtual ~ContentNormalizer() = default; | |
| 11 | - virtual void handleToken(QPDFTokenizer::Token const&); | |
| 10 | + ~ContentNormalizer() override = default; | |
| 11 | + void handleToken(QPDFTokenizer::Token const&) override; | |
| 12 | 12 | |
| 13 | 13 | bool anyBadTokens() const; |
| 14 | 14 | bool lastTokenWasBad() const; | ... | ... |
libqpdf/qpdf/CryptoRandomDataProvider.hh
| ... | ... | @@ -7,8 +7,8 @@ class CryptoRandomDataProvider: public RandomDataProvider |
| 7 | 7 | { |
| 8 | 8 | public: |
| 9 | 9 | CryptoRandomDataProvider() = default; |
| 10 | - virtual ~CryptoRandomDataProvider() = default; | |
| 11 | - virtual void provideRandomData(unsigned char* data, size_t len); | |
| 10 | + ~CryptoRandomDataProvider() override = default; | |
| 11 | + void provideRandomData(unsigned char* data, size_t len) override; | |
| 12 | 12 | static RandomDataProvider* getInstance(); |
| 13 | 13 | }; |
| 14 | 14 | ... | ... |
libqpdf/qpdf/InsecureRandomDataProvider.hh
| ... | ... | @@ -7,8 +7,8 @@ class InsecureRandomDataProvider: public RandomDataProvider |
| 7 | 7 | { |
| 8 | 8 | public: |
| 9 | 9 | InsecureRandomDataProvider(); |
| 10 | - virtual ~InsecureRandomDataProvider() = default; | |
| 11 | - virtual void provideRandomData(unsigned char* data, size_t len); | |
| 10 | + ~InsecureRandomDataProvider() override = default; | |
| 11 | + void provideRandomData(unsigned char* data, size_t len) override; | |
| 12 | 12 | static RandomDataProvider* getInstance(); |
| 13 | 13 | |
| 14 | 14 | private: | ... | ... |
libqpdf/qpdf/OffsetInputSource.hh
| ... | ... | @@ -11,15 +11,15 @@ class OffsetInputSource: public InputSource |
| 11 | 11 | public: |
| 12 | 12 | OffsetInputSource( |
| 13 | 13 | std::shared_ptr<InputSource>, qpdf_offset_t global_offset); |
| 14 | - virtual ~OffsetInputSource() = default; | |
| 14 | + ~OffsetInputSource() override = default; | |
| 15 | 15 | |
| 16 | - virtual qpdf_offset_t findAndSkipNextEOL(); | |
| 17 | - virtual std::string const& getName() const; | |
| 18 | - virtual qpdf_offset_t tell(); | |
| 19 | - virtual void seek(qpdf_offset_t offset, int whence); | |
| 20 | - virtual void rewind(); | |
| 21 | - virtual size_t read(char* buffer, size_t length); | |
| 22 | - virtual void unreadCh(char ch); | |
| 16 | + qpdf_offset_t findAndSkipNextEOL() override; | |
| 17 | + std::string const& getName() const override; | |
| 18 | + qpdf_offset_t tell() override; | |
| 19 | + void seek(qpdf_offset_t offset, int whence) override; | |
| 20 | + void rewind() override; | |
| 21 | + size_t read(char* buffer, size_t length) override; | |
| 22 | + void unreadCh(char ch) override; | |
| 23 | 23 | |
| 24 | 24 | private: |
| 25 | 25 | std::shared_ptr<InputSource> proxied; | ... | ... |
libqpdf/qpdf/Pl_AES_PDF.hh
| ... | ... | @@ -18,10 +18,10 @@ class Pl_AES_PDF: public Pipeline |
| 18 | 18 | bool encrypt, |
| 19 | 19 | unsigned char const* key, |
| 20 | 20 | size_t key_bytes); |
| 21 | - virtual ~Pl_AES_PDF() = default; | |
| 21 | + ~Pl_AES_PDF() override = default; | |
| 22 | 22 | |
| 23 | - virtual void write(unsigned char const* data, size_t len); | |
| 24 | - virtual void finish(); | |
| 23 | + void write(unsigned char const* data, size_t len) override; | |
| 24 | + void finish() override; | |
| 25 | 25 | |
| 26 | 26 | // Use zero initialization vector; needed for AESV3 |
| 27 | 27 | void useZeroIV(); | ... | ... |
libqpdf/qpdf/Pl_ASCII85Decoder.hh
| ... | ... | @@ -7,9 +7,9 @@ class Pl_ASCII85Decoder: public Pipeline |
| 7 | 7 | { |
| 8 | 8 | public: |
| 9 | 9 | Pl_ASCII85Decoder(char const* identifier, Pipeline* next); |
| 10 | - virtual ~Pl_ASCII85Decoder() = default; | |
| 11 | - virtual void write(unsigned char const* buf, size_t len); | |
| 12 | - virtual void finish(); | |
| 10 | + ~Pl_ASCII85Decoder() override = default; | |
| 11 | + void write(unsigned char const* buf, size_t len) override; | |
| 12 | + void finish() override; | |
| 13 | 13 | |
| 14 | 14 | private: |
| 15 | 15 | void flush(); | ... | ... |
libqpdf/qpdf/Pl_ASCIIHexDecoder.hh
| ... | ... | @@ -7,9 +7,9 @@ class Pl_ASCIIHexDecoder: public Pipeline |
| 7 | 7 | { |
| 8 | 8 | public: |
| 9 | 9 | Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next); |
| 10 | - virtual ~Pl_ASCIIHexDecoder() = default; | |
| 11 | - virtual void write(unsigned char const* buf, size_t len); | |
| 12 | - virtual void finish(); | |
| 10 | + ~Pl_ASCIIHexDecoder() override = default; | |
| 11 | + void write(unsigned char const* buf, size_t len) override; | |
| 12 | + void finish() override; | |
| 13 | 13 | |
| 14 | 14 | private: |
| 15 | 15 | void flush(); | ... | ... |
libqpdf/qpdf/Pl_Base64.hh
| ... | ... | @@ -8,9 +8,9 @@ class Pl_Base64: public Pipeline |
| 8 | 8 | public: |
| 9 | 9 | enum action_e { a_encode, a_decode }; |
| 10 | 10 | Pl_Base64(char const* identifier, Pipeline* next, action_e); |
| 11 | - virtual ~Pl_Base64() = default; | |
| 12 | - virtual void write(unsigned char const* buf, size_t len) override; | |
| 13 | - virtual void finish() override; | |
| 11 | + ~Pl_Base64() override = default; | |
| 12 | + void write(unsigned char const* buf, size_t len) override; | |
| 13 | + void finish() override; | |
| 14 | 14 | |
| 15 | 15 | private: |
| 16 | 16 | void decode(unsigned char const* buf, size_t len); | ... | ... |
libqpdf/qpdf/Pl_PNGFilter.hh
| ... | ... | @@ -22,10 +22,10 @@ class Pl_PNGFilter: public Pipeline |
| 22 | 22 | unsigned int columns, |
| 23 | 23 | unsigned int samples_per_pixel = 1, |
| 24 | 24 | unsigned int bits_per_sample = 8); |
| 25 | - virtual ~Pl_PNGFilter() = default; | |
| 25 | + ~Pl_PNGFilter() override = default; | |
| 26 | 26 | |
| 27 | - virtual void write(unsigned char const* data, size_t len); | |
| 28 | - virtual void finish(); | |
| 27 | + void write(unsigned char const* data, size_t len) override; | |
| 28 | + void finish() override; | |
| 29 | 29 | |
| 30 | 30 | private: |
| 31 | 31 | void decodeSub(); | ... | ... |
libqpdf/qpdf/Pl_RC4.hh
| ... | ... | @@ -17,10 +17,10 @@ class Pl_RC4: public Pipeline |
| 17 | 17 | unsigned char const* key_data, |
| 18 | 18 | int key_len = -1, |
| 19 | 19 | size_t out_bufsize = def_bufsize); |
| 20 | - virtual ~Pl_RC4() = default; | |
| 20 | + ~Pl_RC4() override = default; | |
| 21 | 21 | |
| 22 | - virtual void write(unsigned char const* data, size_t len); | |
| 23 | - virtual void finish(); | |
| 22 | + void write(unsigned char const* data, size_t len) override; | |
| 23 | + void finish() override; | |
| 24 | 24 | |
| 25 | 25 | private: |
| 26 | 26 | std::shared_ptr<unsigned char> outbuf; | ... | ... |
libqpdf/qpdf/Pl_SHA2.hh
| ... | ... | @@ -20,10 +20,10 @@ |
| 20 | 20 | class Pl_SHA2: public Pipeline |
| 21 | 21 | { |
| 22 | 22 | public: |
| 23 | - Pl_SHA2(int bits = 0, Pipeline* next = 0); | |
| 24 | - virtual ~Pl_SHA2() = default; | |
| 25 | - virtual void write(unsigned char const*, size_t); | |
| 26 | - virtual void finish(); | |
| 23 | + Pl_SHA2(int bits = 0, Pipeline* next = nullptr); | |
| 24 | + ~Pl_SHA2() override = default; | |
| 25 | + void write(unsigned char const*, size_t) override; | |
| 26 | + void finish() override; | |
| 27 | 27 | void resetBits(int bits); |
| 28 | 28 | std::string getHexDigest(); |
| 29 | 29 | std::string getRawDigest(); | ... | ... |
libqpdf/qpdf/Pl_TIFFPredictor.hh
| ... | ... | @@ -18,10 +18,10 @@ class Pl_TIFFPredictor: public Pipeline |
| 18 | 18 | unsigned int columns, |
| 19 | 19 | unsigned int samples_per_pixel = 1, |
| 20 | 20 | unsigned int bits_per_sample = 8); |
| 21 | - virtual ~Pl_TIFFPredictor() = default; | |
| 21 | + ~Pl_TIFFPredictor() override = default; | |
| 22 | 22 | |
| 23 | - virtual void write(unsigned char const* data, size_t len); | |
| 24 | - virtual void finish(); | |
| 23 | + void write(unsigned char const* data, size_t len) override; | |
| 24 | + void finish() override; | |
| 25 | 25 | |
| 26 | 26 | private: |
| 27 | 27 | void processRow(); | ... | ... |
libqpdf/qpdf/QPDFArgParser.hh
| ... | ... | @@ -177,9 +177,9 @@ class QPDFArgParser |
| 177 | 177 | { |
| 178 | 178 | OptionEntry() : |
| 179 | 179 | parameter_needed(false), |
| 180 | - bare_arg_handler(0), | |
| 181 | - param_arg_handler(0), | |
| 182 | - invalid_choice_handler(0) | |
| 180 | + bare_arg_handler(nullptr), | |
| 181 | + param_arg_handler(nullptr), | |
| 182 | + invalid_choice_handler(nullptr) | |
| 183 | 183 | { |
| 184 | 184 | } |
| 185 | 185 | bool parameter_needed; | ... | ... |
libqpdf/qpdf/QPDFCrypto_openssl.hh
| ... | ... | @@ -39,7 +39,7 @@ class QPDFCrypto_openssl: public QPDFCryptoImpl |
| 39 | 39 | void RC4_process( |
| 40 | 40 | unsigned char const* in_data, |
| 41 | 41 | size_t len, |
| 42 | - unsigned char* out_data = 0) override; | |
| 42 | + unsigned char* out_data = nullptr) override; | |
| 43 | 43 | void RC4_finalize() override; |
| 44 | 44 | |
| 45 | 45 | void SHA2_init(int bits) override; | ... | ... |
libqpdf/qpdf/ResourceFinder.hh
| ... | ... | @@ -8,8 +8,8 @@ class ResourceFinder: public QPDFObjectHandle::ParserCallbacks |
| 8 | 8 | public: |
| 9 | 9 | ResourceFinder(); |
| 10 | 10 | virtual ~ResourceFinder() = default; |
| 11 | - virtual void handleObject(QPDFObjectHandle, size_t, size_t) override; | |
| 12 | - virtual void handleEOF() override; | |
| 11 | + void handleObject(QPDFObjectHandle, size_t, size_t) override; | |
| 12 | + void handleEOF() override; | |
| 13 | 13 | std::set<std::string> const& getNames() const; |
| 14 | 14 | std::map<std::string, std::map<std::string, std::set<size_t>>> const& |
| 15 | 15 | getNamesByResourceType() const; | ... | ... |
libqpdf/qpdf/SF_ASCII85Decode.hh
libqpdf/qpdf/SF_ASCIIHexDecode.hh
libqpdf/qpdf/SF_DCTDecode.hh
| ... | ... | @@ -11,7 +11,7 @@ class SF_DCTDecode: public QPDFStreamFilter |
| 11 | 11 | SF_DCTDecode() = default; |
| 12 | 12 | virtual ~SF_DCTDecode() = default; |
| 13 | 13 | |
| 14 | - virtual Pipeline* | |
| 14 | + Pipeline* | |
| 15 | 15 | getDecodePipeline(Pipeline* next) override |
| 16 | 16 | { |
| 17 | 17 | this->pipeline = std::make_shared<Pl_DCT>("DCT decode", next); |
| ... | ... | @@ -24,13 +24,13 @@ class SF_DCTDecode: public QPDFStreamFilter |
| 24 | 24 | return std::make_shared<SF_DCTDecode>(); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - virtual bool | |
| 27 | + bool | |
| 28 | 28 | isSpecializedCompression() override |
| 29 | 29 | { |
| 30 | 30 | return true; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - virtual bool | |
| 33 | + bool | |
| 34 | 34 | isLossyCompression() override |
| 35 | 35 | { |
| 36 | 36 | return true; | ... | ... |
libqpdf/qpdf/SF_RunLengthDecode.hh
| ... | ... | @@ -11,7 +11,7 @@ class SF_RunLengthDecode: public QPDFStreamFilter |
| 11 | 11 | SF_RunLengthDecode() = default; |
| 12 | 12 | virtual ~SF_RunLengthDecode() = default; |
| 13 | 13 | |
| 14 | - virtual Pipeline* | |
| 14 | + Pipeline* | |
| 15 | 15 | getDecodePipeline(Pipeline* next) override |
| 16 | 16 | { |
| 17 | 17 | this->pipeline = std::make_shared<Pl_RunLength>( |
| ... | ... | @@ -25,7 +25,7 @@ class SF_RunLengthDecode: public QPDFStreamFilter |
| 25 | 25 | return std::make_shared<SF_RunLengthDecode>(); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - virtual bool | |
| 28 | + bool | |
| 29 | 29 | isSpecializedCompression() override |
| 30 | 30 | { |
| 31 | 31 | return true; | ... | ... |
libqpdf/qpdfjob-c.cc
| 1 | 1 | #include <qpdf/qpdfjob-c.h> |
| 2 | 2 | |
| 3 | 3 | #include <qpdf/QPDFJob.hh> |
| 4 | -#include <qpdf/QPDFLogger.hh> | |
| 5 | 4 | #include <qpdf/QPDFUsage.hh> |
| 6 | 5 | #include <qpdf/QUtil.hh> |
| 7 | 6 | #include <qpdf/qpdf-c_impl.hh> |
| 8 | 7 | #include <qpdf/qpdflogger-c_impl.hh> |
| 9 | 8 | |
| 10 | 9 | #include <cstdio> |
| 11 | -#include <cstring> | |
| 12 | 10 | |
| 13 | 11 | struct _qpdfjob_handle |
| 14 | 12 | { | ... | ... |
libqpdf/qpdflogger-c.cc
libtests/aes.cc
| ... | ... | @@ -4,9 +4,9 @@ |
| 4 | 4 | #include <qpdf/QUtil.hh> |
| 5 | 5 | |
| 6 | 6 | #include <iostream> |
| 7 | -#include <stdio.h> | |
| 8 | -#include <stdlib.h> | |
| 9 | -#include <string.h> | |
| 7 | +#include <cstdio> | |
| 8 | +#include <cstdlib> | |
| 9 | +#include <cstring> | |
| 10 | 10 | |
| 11 | 11 | static void |
| 12 | 12 | usage() |
| ... | ... | @@ -29,9 +29,9 @@ main(int argc, char* argv[]) |
| 29 | 29 | { |
| 30 | 30 | bool encrypt = true; |
| 31 | 31 | bool cbc_mode = true; |
| 32 | - char* hexkey = 0; | |
| 33 | - char* infilename = 0; | |
| 34 | - char* outfilename = 0; | |
| 32 | + char* hexkey = nullptr; | |
| 33 | + char* infilename = nullptr; | |
| 34 | + char* outfilename = nullptr; | |
| 35 | 35 | bool zero_iv = false; |
| 36 | 36 | bool static_iv = false; |
| 37 | 37 | bool disable_padding = false; |
| ... | ... | @@ -65,7 +65,7 @@ main(int argc, char* argv[]) |
| 65 | 65 | usage(); |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | - if (outfilename == 0) { | |
| 68 | + if (outfilename == nullptr) { | |
| 69 | 69 | usage(); |
| 70 | 70 | } |
| 71 | 71 | |
| ... | ... | @@ -74,21 +74,21 @@ main(int argc, char* argv[]) |
| 74 | 74 | |
| 75 | 75 | FILE* infile = QUtil::safe_fopen(infilename, "rb"); |
| 76 | 76 | FILE* outfile = QUtil::safe_fopen(outfilename, "wb"); |
| 77 | - unsigned char* key = new unsigned char[keylen]; | |
| 77 | + auto* key = new unsigned char[keylen]; | |
| 78 | 78 | for (unsigned int i = 0; i < strlen(hexkey); i += 2) { |
| 79 | 79 | char t[3]; |
| 80 | 80 | t[0] = hexkey[i]; |
| 81 | 81 | t[1] = hexkey[i + 1]; |
| 82 | 82 | t[2] = '\0'; |
| 83 | 83 | |
| 84 | - long val = strtol(t, 0, 16); | |
| 84 | + long val = strtol(t, nullptr, 16); | |
| 85 | 85 | key[i / 2] = static_cast<unsigned char>(val); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile); | |
| 89 | - Pl_AES_PDF* aes = new Pl_AES_PDF("aes_128_cbc", out, encrypt, key, keylen); | |
| 88 | + auto* out = new Pl_StdioFile("stdout", outfile); | |
| 89 | + auto* aes = new Pl_AES_PDF("aes_128_cbc", out, encrypt, key, keylen); | |
| 90 | 90 | delete[] key; |
| 91 | - key = 0; | |
| 91 | + key = nullptr; | |
| 92 | 92 | if (!cbc_mode) { |
| 93 | 93 | aes->disableCBC(); |
| 94 | 94 | } | ... | ... |
libtests/arg_parser.cc
| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | |
| 3 | 3 | #include <qpdf/QPDFArgParser.hh> |
| 4 | 4 | #include <qpdf/QPDFUsage.hh> |
| 5 | -#include <qpdf/QUtil.hh> | |
| 6 | 5 | #include <cstring> |
| 7 | 6 | #include <iostream> |
| 8 | 7 | |
| ... | ... | @@ -52,7 +51,7 @@ ArgParser::initOptions() |
| 52 | 51 | ap.addBare("potato", b(&ArgParser::handlePotato)); |
| 53 | 52 | ap.addRequiredParameter("salad", p(&ArgParser::handleSalad), "tossed"); |
| 54 | 53 | ap.addOptionalParameter("moo", p(&ArgParser::handleMoo)); |
| 55 | - char const* choices[] = {"pig", "boar", "sow", 0}; | |
| 54 | + char const* choices[] = {"pig", "boar", "sow", nullptr}; | |
| 56 | 55 | ap.addChoices("oink", p(&ArgParser::handleOink), true, choices); |
| 57 | 56 | ap.selectHelpOptionTable(); |
| 58 | 57 | ap.addBare("version", [this]() { output("3.14159"); }); | ... | ... |
libtests/ascii85.cc
libtests/bits.cc
| ... | ... | @@ -4,8 +4,7 @@ |
| 4 | 4 | #include <qpdf/QIntC.hh> |
| 5 | 5 | #include <qpdf/QUtil.hh> |
| 6 | 6 | #include <iostream> |
| 7 | -#include <stdio.h> | |
| 8 | -#include <stdlib.h> | |
| 7 | +#include <cstdlib> | |
| 9 | 8 | |
| 10 | 9 | // See comments in bits_functions.hh |
| 11 | 10 | #define BITS_TESTING 1 |
| ... | ... | @@ -142,7 +141,7 @@ test() |
| 142 | 141 | |
| 143 | 142 | unsigned char ch = 0; |
| 144 | 143 | bit_offset = 7; |
| 145 | - Pl_Buffer* bp = new Pl_Buffer("buffer"); | |
| 144 | + auto* bp = new Pl_Buffer("buffer"); | |
| 146 | 145 | |
| 147 | 146 | test_write_bits(ch, bit_offset, 30UL, 5, bp); |
| 148 | 147 | test_write_bits(ch, bit_offset, 10UL, 4, bp); | ... | ... |
libtests/buffer.cc
libtests/closed_file_input_source.cc
libtests/cxx11.cc
libtests/dct_compress.cc
| ... | ... | @@ -3,9 +3,9 @@ |
| 3 | 3 | #include <qpdf/QUtil.hh> |
| 4 | 4 | |
| 5 | 5 | #include <iostream> |
| 6 | -#include <stdio.h> | |
| 7 | -#include <stdlib.h> | |
| 8 | -#include <string.h> | |
| 6 | +#include <cstdio> | |
| 7 | +#include <cstdlib> | |
| 8 | +#include <cstring> | |
| 9 | 9 | |
| 10 | 10 | static void |
| 11 | 11 | usage() |
| ... | ... | @@ -22,8 +22,8 @@ class Callback: public Pl_DCT::CompressConfig |
| 22 | 22 | called(false) |
| 23 | 23 | { |
| 24 | 24 | } |
| 25 | - virtual ~Callback() = default; | |
| 26 | - virtual void apply(jpeg_compress_struct*); | |
| 25 | + ~Callback() override = default; | |
| 26 | + void apply(jpeg_compress_struct*) override; | |
| 27 | 27 | bool called; |
| 28 | 28 | }; |
| 29 | 29 | ... | ... |
libtests/dct_uncompress.cc
libtests/flate.cc
| ... | ... | @@ -4,10 +4,8 @@ |
| 4 | 4 | #include <qpdf/Pl_StdioFile.hh> |
| 5 | 5 | #include <qpdf/QUtil.hh> |
| 6 | 6 | |
| 7 | -#include <errno.h> | |
| 8 | 7 | #include <iostream> |
| 9 | -#include <stdlib.h> | |
| 10 | -#include <string.h> | |
| 8 | +#include <cstdlib> | |
| 11 | 9 | |
| 12 | 10 | void |
| 13 | 11 | run(char const* filename) |
| ... | ... | @@ -30,7 +28,7 @@ run(char const* filename) |
| 30 | 28 | Pipeline* inf2 = new Pl_Flate("inf2", out2, Pl_Flate::a_inflate); |
| 31 | 29 | |
| 32 | 30 | // Count bytes written to o3 |
| 33 | - Pl_Count* count3 = new Pl_Count("count3", out3); | |
| 31 | + auto* count3 = new Pl_Count("count3", out3); | |
| 34 | 32 | |
| 35 | 33 | // Do both simultaneously |
| 36 | 34 | Pipeline* inf3 = new Pl_Flate("inf3", count3, Pl_Flate::a_inflate); | ... | ... |
libtests/hex.cc
libtests/input_source.cc
libtests/json_parse.cc
| 1 | 1 | #include <qpdf/FileInputSource.hh> |
| 2 | 2 | #include <qpdf/JSON.hh> |
| 3 | -#include <qpdf/QUtil.hh> | |
| 4 | 3 | #include <cstdlib> |
| 5 | 4 | #include <cstring> |
| 6 | 5 | #include <iostream> |
| ... | ... | @@ -12,13 +11,13 @@ namespace |
| 12 | 11 | { |
| 13 | 12 | public: |
| 14 | 13 | virtual ~Reactor() = default; |
| 15 | - virtual void dictionaryStart() override; | |
| 16 | - virtual void arrayStart() override; | |
| 17 | - virtual void containerEnd(JSON const& value) override; | |
| 18 | - virtual void topLevelScalar() override; | |
| 19 | - virtual bool | |
| 14 | + void dictionaryStart() override; | |
| 15 | + void arrayStart() override; | |
| 16 | + void containerEnd(JSON const& value) override; | |
| 17 | + void topLevelScalar() override; | |
| 18 | + bool | |
| 20 | 19 | dictionaryItem(std::string const& key, JSON const& value) override; |
| 21 | - virtual bool arrayItem(JSON const& value) override; | |
| 20 | + bool arrayItem(JSON const& value) override; | |
| 22 | 21 | |
| 23 | 22 | private: |
| 24 | 23 | void printItem(JSON const&); | ... | ... |
libtests/logger_c.c
libtests/lzw.cc
libtests/md5.cc
libtests/numrange.cc
libtests/pointer_holder.cc
| ... | ... | @@ -7,7 +7,6 @@ |
| 7 | 7 | |
| 8 | 8 | #include <iostream> |
| 9 | 9 | #include <list> |
| 10 | -#include <stdlib.h> | |
| 11 | 10 | |
| 12 | 11 | class Object |
| 13 | 12 | { |
| ... | ... | @@ -73,7 +72,7 @@ test_ph() |
| 73 | 72 | ObjectHolder oh0; |
| 74 | 73 | { |
| 75 | 74 | std::cout << "hello" << std::endl; |
| 76 | - Object* o1 = new Object; | |
| 75 | + auto* o1 = new Object; | |
| 77 | 76 | ObjectHolder oh1(o1); |
| 78 | 77 | std::cout << "oh1 refcount = " << oh1.getRefcount() << std::endl; |
| 79 | 78 | ObjectHolder oh2(oh1); |
| ... | ... | @@ -96,7 +95,7 @@ test_ph() |
| 96 | 95 | } |
| 97 | 96 | ol1.push_back(oh3); |
| 98 | 97 | ol1.push_back(oh3); |
| 99 | - Object* o3 = new Object; | |
| 98 | + auto* o3 = new Object; | |
| 100 | 99 | oh0 = o3; |
| 101 | 100 | PointerHolder<Object const> oh6(new Object()); |
| 102 | 101 | oh6->hello(); | ... | ... |
libtests/predictors.cc
| ... | ... | @@ -6,10 +6,9 @@ |
| 6 | 6 | #include <qpdf/QIntC.hh> |
| 7 | 7 | #include <qpdf/QUtil.hh> |
| 8 | 8 | |
| 9 | -#include <errno.h> | |
| 10 | 9 | #include <iostream> |
| 11 | -#include <stdlib.h> | |
| 12 | -#include <string.h> | |
| 10 | +#include <cstdlib> | |
| 11 | +#include <cstring> | |
| 13 | 12 | |
| 14 | 13 | void |
| 15 | 14 | run(char const* filename, |
| ... | ... | @@ -22,7 +21,7 @@ run(char const* filename, |
| 22 | 21 | FILE* in = QUtil::safe_fopen(filename, "rb"); |
| 23 | 22 | FILE* o1 = QUtil::safe_fopen("out", "wb"); |
| 24 | 23 | Pipeline* out = new Pl_StdioFile("out", o1); |
| 25 | - Pipeline* pl = 0; | |
| 24 | + Pipeline* pl = nullptr; | |
| 26 | 25 | if (strcmp(filter, "png") == 0) { |
| 27 | 26 | pl = new Pl_PNGFilter( |
| 28 | 27 | "png", | ... | ... |
libtests/qintc.cc
| 1 | 1 | #include <qpdf/assert_test.h> |
| 2 | 2 | |
| 3 | 3 | #include <qpdf/QIntC.hh> |
| 4 | -#include <stdint.h> | |
| 4 | +#include <cstdint> | |
| 5 | 5 | |
| 6 | 6 | #define try_convert(exp_pass, fn, i) \ |
| 7 | 7 | try_convert_real(#fn "(" #i ")", exp_pass, fn, i) |
| ... | ... | @@ -74,7 +74,7 @@ main() |
| 74 | 74 | uint64_t ul1 = 1099511627776LL; // Too big for 32-bit |
| 75 | 75 | uint64_t ul2 = 12345; // Fits into 32-bit |
| 76 | 76 | int32_t i2 = 81; // Fits in char and uchar |
| 77 | - signed char c1 = static_cast<signed char>('\xf7'); // Signed value when char | |
| 77 | + auto c1 = static_cast<signed char>('\xf7'); // Signed value when char | |
| 78 | 78 | char c2 = 'W'; // char; may be signed or unsigned |
| 79 | 79 | |
| 80 | 80 | // Verify i1 and u1 have same bit pattern | ... | ... |
libtests/qutil.cc
| ... | ... | @@ -3,15 +3,11 @@ |
| 3 | 3 | #include <qpdf/Pl_Buffer.hh> |
| 4 | 4 | #include <qpdf/QPDFSystemError.hh> |
| 5 | 5 | #include <qpdf/QUtil.hh> |
| 6 | -#include <fcntl.h> | |
| 7 | 6 | #include <fstream> |
| 8 | 7 | #include <iostream> |
| 9 | -#include <limits.h> | |
| 10 | -#include <locale> | |
| 11 | -#include <stdio.h> | |
| 12 | -#include <string.h> | |
| 13 | -#include <sys/stat.h> | |
| 14 | -#include <sys/types.h> | |
| 8 | +#include <climits> | |
| 9 | +#include <cstdio> | |
| 10 | +#include <cstring> | |
| 15 | 11 | |
| 16 | 12 | #ifdef _WIN32 |
| 17 | 13 | # include <io.h> |
| ... | ... | @@ -493,7 +489,7 @@ same_file_test() |
| 493 | 489 | assert_same_file("qutil.out", "qutil.out", true); |
| 494 | 490 | assert_same_file("qutil.out", "other-file", false); |
| 495 | 491 | assert_same_file("qutil.out", "", false); |
| 496 | - assert_same_file("qutil.out", 0, false); | |
| 492 | + assert_same_file("qutil.out", nullptr, false); | |
| 497 | 493 | assert_same_file("", "qutil.out", false); |
| 498 | 494 | } |
| 499 | 495 | ... | ... |
libtests/random.cc
| 1 | 1 | #include <qpdf/InsecureRandomDataProvider.hh> |
| 2 | 2 | #include <qpdf/QUtil.hh> |
| 3 | 3 | #include <qpdf/SecureRandomDataProvider.hh> |
| 4 | -#include <qpdf/qpdf-config.h> | |
| 5 | 4 | #include <iostream> |
| 6 | 5 | |
| 7 | 6 | class BogusRandomDataProvider: public RandomDataProvider |
| ... | ... | @@ -57,7 +56,7 @@ main() |
| 57 | 56 | if (!((buf[0] == 0) && (buf[1] == 1) && (buf[2] == 2) && (buf[3] == 3))) { |
| 58 | 57 | std::cout << "fail: bogus random didn't provide correct bytes\n"; |
| 59 | 58 | } |
| 60 | - QUtil::setRandomDataProvider(0); | |
| 59 | + QUtil::setRandomDataProvider(nullptr); | |
| 61 | 60 | if (QUtil::getRandomDataProvider() != orig_rdp) { |
| 62 | 61 | std::cout << "fail: passing null to setRandomDataProvider " |
| 63 | 62 | "didn't reset the random data provider\n"; | ... | ... |
libtests/rc4.cc
| ... | ... | @@ -6,9 +6,9 @@ |
| 6 | 6 | #include <qpdf/QUtil.hh> |
| 7 | 7 | |
| 8 | 8 | #include <iostream> |
| 9 | -#include <stdio.h> | |
| 10 | -#include <stdlib.h> | |
| 11 | -#include <string.h> | |
| 9 | +#include <cstdio> | |
| 10 | +#include <cstdlib> | |
| 11 | +#include <cstring> | |
| 12 | 12 | |
| 13 | 13 | static void |
| 14 | 14 | other_tests() |
| ... | ... | @@ -41,7 +41,7 @@ main(int argc, char* argv[]) |
| 41 | 41 | char* outfilename = argv[3]; |
| 42 | 42 | unsigned int hexkeylen = QIntC::to_uint(strlen(hexkey)); |
| 43 | 43 | unsigned int keylen = hexkeylen / 2; |
| 44 | - unsigned char* key = new unsigned char[keylen + 1]; | |
| 44 | + auto* key = new unsigned char[keylen + 1]; | |
| 45 | 45 | key[keylen] = '\0'; |
| 46 | 46 | |
| 47 | 47 | FILE* infile = QUtil::safe_fopen(infilename, "rb"); |
| ... | ... | @@ -51,14 +51,14 @@ main(int argc, char* argv[]) |
| 51 | 51 | t[1] = hexkey[i + 1]; |
| 52 | 52 | t[2] = '\0'; |
| 53 | 53 | |
| 54 | - long val = strtol(t, 0, 16); | |
| 54 | + long val = strtol(t, nullptr, 16); | |
| 55 | 55 | key[i / 2] = static_cast<unsigned char>(val); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | FILE* outfile = QUtil::safe_fopen(outfilename, "wb"); |
| 59 | - Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile); | |
| 59 | + auto* out = new Pl_StdioFile("stdout", outfile); | |
| 60 | 60 | // Use a small buffer size (64) for testing |
| 61 | - Pl_RC4* rc4 = new Pl_RC4("rc4", out, key, QIntC::to_int(keylen), 64U); | |
| 61 | + auto* rc4 = new Pl_RC4("rc4", out, key, QIntC::to_int(keylen), 64U); | |
| 62 | 62 | delete[] key; |
| 63 | 63 | |
| 64 | 64 | // 64 < buffer size < 512, buffer_size is not a power of 2 for testing | ... | ... |
libtests/runlength.cc
libtests/sha2.cc
qpdf/fix-qdf.cc
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | #include <regex> |
| 9 | 9 | #include <string_view> |
| 10 | 10 | |
| 11 | -static char const* whoami = 0; | |
| 11 | +static char const* whoami = nullptr; | |
| 12 | 12 | |
| 13 | 13 | static void |
| 14 | 14 | usage() |
| ... | ... | @@ -392,7 +392,7 @@ realmain(int argc, char* argv[]) |
| 392 | 392 | { |
| 393 | 393 | whoami = QUtil::getWhoami(argv[0]); |
| 394 | 394 | QUtil::setLineBuf(stdout); |
| 395 | - char const* filename = 0; | |
| 395 | + char const* filename = nullptr; | |
| 396 | 396 | if (argc > 2) { |
| 397 | 397 | usage(); |
| 398 | 398 | } else if ((argc > 1) && (strcmp(argv[1], "--version") == 0)) { |
| ... | ... | @@ -405,7 +405,7 @@ realmain(int argc, char* argv[]) |
| 405 | 405 | filename = argv[1]; |
| 406 | 406 | } |
| 407 | 407 | std::string input; |
| 408 | - if (filename == 0) { | |
| 408 | + if (filename == nullptr) { | |
| 409 | 409 | filename = "standard input"; |
| 410 | 410 | QUtil::binary_stdin(); |
| 411 | 411 | input = QUtil::read_file_into_string(stdin); | ... | ... |
qpdf/pdf_from_scratch.cc
| ... | ... | @@ -3,14 +3,13 @@ |
| 3 | 3 | #include <qpdf/QPDFObjectHandle.hh> |
| 4 | 4 | #include <qpdf/QPDFPageDocumentHelper.hh> |
| 5 | 5 | #include <qpdf/QPDFWriter.hh> |
| 6 | -#include <qpdf/QTC.hh> | |
| 7 | 6 | #include <qpdf/QUtil.hh> |
| 8 | 7 | #include <iostream> |
| 9 | -#include <stdio.h> | |
| 10 | -#include <stdlib.h> | |
| 11 | -#include <string.h> | |
| 8 | +#include <cstdio> | |
| 9 | +#include <cstdlib> | |
| 10 | +#include <cstring> | |
| 12 | 11 | |
| 13 | -static char const* whoami = 0; | |
| 12 | +static char const* whoami = nullptr; | |
| 14 | 13 | |
| 15 | 14 | void |
| 16 | 15 | usage() |
| ... | ... | @@ -87,7 +86,7 @@ int |
| 87 | 86 | main(int argc, char* argv[]) |
| 88 | 87 | { |
| 89 | 88 | QUtil::setLineBuf(stdout); |
| 90 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 89 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 91 | 90 | whoami = argv[0]; |
| 92 | 91 | } else { |
| 93 | 92 | ++whoami; | ... | ... |
qpdf/qpdf.cc
qpdf/qpdfjob-ctest.c
qpdf/test_driver.cc
| ... | ... | @@ -26,19 +26,18 @@ |
| 26 | 26 | #include <qpdf/QPDFWriter.hh> |
| 27 | 27 | #include <qpdf/QTC.hh> |
| 28 | 28 | #include <qpdf/QUtil.hh> |
| 29 | -#include <algorithm> | |
| 30 | 29 | #include <iostream> |
| 31 | -#include <limits.h> | |
| 30 | +#include <climits> | |
| 32 | 31 | #include <map> |
| 33 | 32 | #include <sstream> |
| 34 | -#include <stdio.h> | |
| 35 | -#include <stdlib.h> | |
| 36 | -#include <string.h> | |
| 33 | +#include <cstdio> | |
| 34 | +#include <cstdlib> | |
| 35 | +#include <cstring> | |
| 37 | 36 | |
| 38 | 37 | #define QPDF_OBJECT_NOWARN |
| 39 | 38 | #include <qpdf/QPDFObject.hh> |
| 40 | 39 | |
| 41 | -static char const* whoami = 0; | |
| 40 | +static char const* whoami = nullptr; | |
| 42 | 41 | |
| 43 | 42 | void |
| 44 | 43 | usage() |
| ... | ... | @@ -287,7 +286,7 @@ test_0_1(QPDF& pdf, char const* arg2) |
| 287 | 286 | qtest.pipeStreamData(out.get(), 0, qpdf_dl_none); |
| 288 | 287 | |
| 289 | 288 | std::cout << std::endl << "Uncompressed stream data:" << std::endl; |
| 290 | - if (qtest.pipeStreamData(0, 0, qpdf_dl_all)) { | |
| 289 | + if (qtest.pipeStreamData(nullptr, 0, qpdf_dl_all)) { | |
| 291 | 290 | std::cout.flush(); |
| 292 | 291 | QUtil::binary_stdout(); |
| 293 | 292 | out = std::make_shared<Pl_StdioFile>("filtered", stdout); |
| ... | ... | @@ -388,7 +387,7 @@ test_4(QPDF& pdf, char const* arg2) |
| 388 | 387 | } |
| 389 | 388 | |
| 390 | 389 | trailer.replaceKey("/Info", pdf.makeIndirectObject(qtest)); |
| 391 | - QPDFWriter w(pdf, 0); | |
| 390 | + QPDFWriter w(pdf, nullptr); | |
| 392 | 391 | w.setQDFMode(true); |
| 393 | 392 | w.setStaticID(true); |
| 394 | 393 | w.write(); |
| ... | ... | @@ -500,7 +499,7 @@ test_8(QPDF& pdf, char const* arg2) |
| 500 | 499 | auto b = p1.getBufferSharedPointer(); |
| 501 | 500 | // This is a bogus way to use StreamDataProvider, but it does |
| 502 | 501 | // adequately test its functionality. |
| 503 | - Provider* provider = new Provider(b); | |
| 502 | + auto* provider = new Provider(b); | |
| 504 | 503 | auto p = std::shared_ptr<QPDFObjectHandle::StreamDataProvider>(provider); |
| 505 | 504 | qstream.replaceStreamData( |
| 506 | 505 | p, |
| ... | ... | @@ -600,7 +599,7 @@ test_12(QPDF& pdf, char const* arg2) |
| 600 | 599 | # pragma GCC diagnostic push |
| 601 | 600 | # pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 602 | 601 | #endif |
| 603 | - pdf.setOutputStreams(0, 0); | |
| 602 | + pdf.setOutputStreams(nullptr, nullptr); | |
| 604 | 603 | #if (defined(__GNUC__) || defined(__clang__)) |
| 605 | 604 | # pragma GCC diagnostic pop |
| 606 | 605 | #endif |
| ... | ... | @@ -1010,7 +1009,7 @@ test_25(QPDF& pdf, char const* arg2) |
| 1010 | 1009 | // Copy qtest without crossing page boundaries. Should get O1 |
| 1011 | 1010 | // and O2 and their streams but not O3 or any other pages. |
| 1012 | 1011 | |
| 1013 | - assert(arg2 != 0); | |
| 1012 | + assert(arg2 != nullptr); | |
| 1014 | 1013 | { |
| 1015 | 1014 | // Make sure original PDF is out of scope when we write. |
| 1016 | 1015 | QPDF oldpdf; |
| ... | ... | @@ -1036,7 +1035,7 @@ test_26(QPDF& pdf, char const* arg2) |
| 1036 | 1035 | |
| 1037 | 1036 | { |
| 1038 | 1037 | // Make sure original PDF is out of scope when we write. |
| 1039 | - assert(arg2 != 0); | |
| 1038 | + assert(arg2 != nullptr); | |
| 1040 | 1039 | QPDF oldpdf; |
| 1041 | 1040 | oldpdf.processFile(arg2); |
| 1042 | 1041 | QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest"); |
| ... | ... | @@ -1069,7 +1068,7 @@ test_27(QPDF& pdf, char const* arg2) |
| 1069 | 1068 | pl.writeCStr("new data for stream\n"); |
| 1070 | 1069 | pl.finish(); |
| 1071 | 1070 | auto b = pl.getBufferSharedPointer(); |
| 1072 | - Provider* provider = new Provider(b); | |
| 1071 | + auto* provider = new Provider(b); | |
| 1073 | 1072 | p1 = decltype(p1)(provider); |
| 1074 | 1073 | } |
| 1075 | 1074 | // Create a stream that uses a provider in empty1 and copy it |
| ... | ... | @@ -1096,7 +1095,7 @@ test_27(QPDF& pdf, char const* arg2) |
| 1096 | 1095 | pl.writeCStr("more data for stream\n"); |
| 1097 | 1096 | pl.finish(); |
| 1098 | 1097 | auto b = pl.getBufferSharedPointer(); |
| 1099 | - Provider* provider = new Provider(b); | |
| 1098 | + auto* provider = new Provider(b); | |
| 1100 | 1099 | p2 = decltype(p2)(provider); |
| 1101 | 1100 | } |
| 1102 | 1101 | QPDF empty3; |
| ... | ... | @@ -1105,7 +1104,7 @@ test_27(QPDF& pdf, char const* arg2) |
| 1105 | 1104 | QPDFObjectHandle s3 = QPDFObjectHandle::newStream(&empty3); |
| 1106 | 1105 | s3.replaceStreamData( |
| 1107 | 1106 | p2, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull()); |
| 1108 | - assert(arg2 != 0); | |
| 1107 | + assert(arg2 != nullptr); | |
| 1109 | 1108 | QPDF oldpdf; |
| 1110 | 1109 | oldpdf.processFile(arg2); |
| 1111 | 1110 | QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest"); |
| ... | ... | @@ -1152,7 +1151,7 @@ static void |
| 1152 | 1151 | test_29(QPDF& pdf, char const* arg2) |
| 1153 | 1152 | { |
| 1154 | 1153 | // Detect mixed objects in QPDFWriter |
| 1155 | - assert(arg2 != 0); | |
| 1154 | + assert(arg2 != nullptr); | |
| 1156 | 1155 | auto other = QPDF::create(); |
| 1157 | 1156 | other->processFile(arg2); |
| 1158 | 1157 | // We need to create a QPDF with mixed ownership to exercise |
| ... | ... | @@ -1202,7 +1201,7 @@ test_29(QPDF& pdf, char const* arg2) |
| 1202 | 1201 | static void |
| 1203 | 1202 | test_30(QPDF& pdf, char const* arg2) |
| 1204 | 1203 | { |
| 1205 | - assert(arg2 != 0); | |
| 1204 | + assert(arg2 != nullptr); | |
| 1206 | 1205 | QPDF encrypted; |
| 1207 | 1206 | encrypted.processFile(arg2, "user"); |
| 1208 | 1207 | QPDFWriter w(pdf, "b.pdf"); |
| ... | ... | @@ -1434,7 +1433,7 @@ test_40(QPDF& pdf, char const* arg2) |
| 1434 | 1433 | // feature was implemented by Sahil Arora |
| 1435 | 1434 | // <sahilarora.535@gmail.com> as part of a Google Summer of |
| 1436 | 1435 | // Code project in 2017. |
| 1437 | - assert(arg2 != 0); | |
| 1436 | + assert(arg2 != nullptr); | |
| 1438 | 1437 | QPDFWriter w(pdf, arg2); |
| 1439 | 1438 | w.setPCLm(true); |
| 1440 | 1439 | w.setStaticID(true); |
| ... | ... | @@ -3559,11 +3558,11 @@ runtest(int n, char const* filename1, char const* arg2) |
| 3559 | 3558 | |
| 3560 | 3559 | QPDF pdf; |
| 3561 | 3560 | std::shared_ptr<char> file_buf; |
| 3562 | - FILE* filep = 0; | |
| 3561 | + FILE* filep = nullptr; | |
| 3563 | 3562 | if (n == 0) { |
| 3564 | 3563 | pdf.setAttemptRecovery(false); |
| 3565 | 3564 | } |
| 3566 | - if (((n == 35) || (n == 36)) && (arg2 != 0)) { | |
| 3565 | + if (((n == 35) || (n == 36)) && (arg2 != nullptr)) { | |
| 3567 | 3566 | // arg2 is password |
| 3568 | 3567 | pdf.processFile(filename1, arg2); |
| 3569 | 3568 | } else if (n == 45) { |
| ... | ... | @@ -3653,7 +3652,7 @@ int |
| 3653 | 3652 | main(int argc, char* argv[]) |
| 3654 | 3653 | { |
| 3655 | 3654 | QUtil::setLineBuf(stdout); |
| 3656 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 3655 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 3657 | 3656 | whoami = argv[0]; |
| 3658 | 3657 | } else { |
| 3659 | 3658 | ++whoami; | ... | ... |
qpdf/test_large_file.cc
| ... | ... | @@ -13,8 +13,8 @@ |
| 13 | 13 | #include <qpdf/QPDFWriter.hh> |
| 14 | 14 | #include <qpdf/QUtil.hh> |
| 15 | 15 | #include <iostream> |
| 16 | -#include <stdlib.h> | |
| 17 | -#include <string.h> | |
| 16 | +#include <cstdlib> | |
| 17 | +#include <cstring> | |
| 18 | 18 | |
| 19 | 19 | // Run "test_large_file write small a.pdf" to get a PDF file that you |
| 20 | 20 | // can look at in a reader. |
| ... | ... | @@ -35,7 +35,7 @@ |
| 35 | 35 | // reading the large file then allows us to verify large file support |
| 36 | 36 | // with confidence. |
| 37 | 37 | |
| 38 | -static char const* whoami = 0; | |
| 38 | +static char const* whoami = nullptr; | |
| 39 | 39 | |
| 40 | 40 | // Height should be a multiple of 10 |
| 41 | 41 | static size_t const nstripes = 10; |
| ... | ... | @@ -47,7 +47,7 @@ static size_t const npages = 200; |
| 47 | 47 | size_t stripesize = 0; |
| 48 | 48 | size_t width = 0; |
| 49 | 49 | size_t height = 0; |
| 50 | -static unsigned char* buf = 0; | |
| 50 | +static unsigned char* buf = nullptr; | |
| 51 | 51 | |
| 52 | 52 | static inline unsigned char |
| 53 | 53 | get_pixel_color(size_t n, size_t row) |
| ... | ... | @@ -73,7 +73,7 @@ class ImageChecker: public Pipeline |
| 73 | 73 | }; |
| 74 | 74 | |
| 75 | 75 | ImageChecker::ImageChecker(size_t n) : |
| 76 | - Pipeline("image checker", 0), | |
| 76 | + Pipeline("image checker", nullptr), | |
| 77 | 77 | n(n), |
| 78 | 78 | offset(0), |
| 79 | 79 | okay(true) |
| ... | ... | @@ -122,7 +122,7 @@ ImageProvider::ImageProvider(size_t n) : |
| 122 | 122 | void |
| 123 | 123 | ImageProvider::provideStreamData(int objid, int generation, Pipeline* pipeline) |
| 124 | 124 | { |
| 125 | - if (buf == 0) { | |
| 125 | + if (buf == nullptr) { | |
| 126 | 126 | buf = new unsigned char[width * stripesize]; |
| 127 | 127 | } |
| 128 | 128 | std::cout << "page " << n << " of " << npages << std::endl; |
| ... | ... | @@ -218,7 +218,7 @@ create_pdf(char const* filename) |
| 218 | 218 | image_dict.replaceKey("/BitsPerComponent", newInteger(8)); |
| 219 | 219 | image_dict.replaceKey("/Width", newInteger(width)); |
| 220 | 220 | image_dict.replaceKey("/Height", newInteger(height)); |
| 221 | - ImageProvider* p = new ImageProvider(pageno); | |
| 221 | + auto* p = new ImageProvider(pageno); | |
| 222 | 222 | std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p); |
| 223 | 223 | image.replaceStreamData( |
| 224 | 224 | provider, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull()); | ... | ... |
qpdf/test_pdf_doc_encoding.cc
| 1 | 1 | #include <qpdf/QPDFObjectHandle.hh> |
| 2 | 2 | #include <qpdf/QUtil.hh> |
| 3 | 3 | #include <iostream> |
| 4 | -#include <stdlib.h> | |
| 5 | -#include <string.h> | |
| 4 | +#include <cstdlib> | |
| 5 | +#include <cstring> | |
| 6 | 6 | |
| 7 | -static char const* whoami = 0; | |
| 7 | +static char const* whoami = nullptr; | |
| 8 | 8 | |
| 9 | 9 | void |
| 10 | 10 | usage() |
| ... | ... | @@ -16,7 +16,7 @@ usage() |
| 16 | 16 | int |
| 17 | 17 | main(int argc, char* argv[]) |
| 18 | 18 | { |
| 19 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 19 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 20 | 20 | whoami = argv[0]; |
| 21 | 21 | } else { |
| 22 | 22 | ++whoami; | ... | ... |
qpdf/test_pdf_unicode.cc
| 1 | 1 | #include <qpdf/QPDFObjectHandle.hh> |
| 2 | 2 | #include <qpdf/QUtil.hh> |
| 3 | 3 | #include <iostream> |
| 4 | -#include <stdlib.h> | |
| 5 | -#include <string.h> | |
| 4 | +#include <cstdlib> | |
| 5 | +#include <cstring> | |
| 6 | 6 | |
| 7 | -static char const* whoami = 0; | |
| 7 | +static char const* whoami = nullptr; | |
| 8 | 8 | |
| 9 | 9 | void |
| 10 | 10 | usage() |
| ... | ... | @@ -16,7 +16,7 @@ usage() |
| 16 | 16 | int |
| 17 | 17 | main(int argc, char* argv[]) |
| 18 | 18 | { |
| 19 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 19 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 20 | 20 | whoami = argv[0]; |
| 21 | 21 | } else { |
| 22 | 22 | ++whoami; | ... | ... |
qpdf/test_renumber.cc
| 1 | -#include <qpdf/Buffer.hh> | |
| 2 | 1 | #include <qpdf/Constants.h> |
| 3 | 2 | #include <qpdf/QPDF.hh> |
| 4 | 3 | #include <qpdf/QPDFObjGen.hh> |
| ... | ... | @@ -6,7 +5,6 @@ |
| 6 | 5 | #include <qpdf/QPDFWriter.hh> |
| 7 | 6 | #include <qpdf/QPDFXRefEntry.hh> |
| 8 | 7 | |
| 9 | -#include <algorithm> | |
| 10 | 8 | #include <cstdlib> |
| 11 | 9 | #include <iostream> |
| 12 | 10 | #include <set> | ... | ... |
qpdf/test_shell_glob.cc
qpdf/test_tokenizer.cc
| ... | ... | @@ -4,15 +4,14 @@ |
| 4 | 4 | #include <qpdf/QIntC.hh> |
| 5 | 5 | #include <qpdf/QPDF.hh> |
| 6 | 6 | #include <qpdf/QPDFPageDocumentHelper.hh> |
| 7 | -#include <qpdf/QPDFPageObjectHelper.hh> | |
| 8 | 7 | #include <qpdf/QPDFTokenizer.hh> |
| 9 | 8 | #include <qpdf/QUtil.hh> |
| 10 | 9 | #include <iostream> |
| 11 | -#include <stdio.h> | |
| 12 | -#include <stdlib.h> | |
| 13 | -#include <string.h> | |
| 10 | +#include <cstdio> | |
| 11 | +#include <cstdlib> | |
| 12 | +#include <cstring> | |
| 14 | 13 | |
| 15 | -static char const* whoami = 0; | |
| 14 | +static char const* whoami = nullptr; | |
| 16 | 15 | |
| 17 | 16 | void |
| 18 | 17 | usage() |
| ... | ... | @@ -92,7 +91,7 @@ tokenTypeName(QPDFTokenizer::token_type_e ttype) |
| 92 | 91 | case QPDFTokenizer::tt_inline_image: |
| 93 | 92 | return "inline-image"; |
| 94 | 93 | } |
| 95 | - return 0; | |
| 94 | + return nullptr; | |
| 96 | 95 | } |
| 97 | 96 | |
| 98 | 97 | static std::string |
| ... | ... | @@ -191,7 +190,7 @@ process(char const* filename, bool include_ignorable, size_t max_len) |
| 191 | 190 | std::shared_ptr<InputSource> is; |
| 192 | 191 | |
| 193 | 192 | // Tokenize file, skipping streams |
| 194 | - FileInputSource* fis = new FileInputSource(filename); | |
| 193 | + auto* fis = new FileInputSource(filename); | |
| 195 | 194 | is = std::shared_ptr<InputSource>(fis); |
| 196 | 195 | dump_tokens(is, "FILE", max_len, include_ignorable, true, false); |
| 197 | 196 | |
| ... | ... | @@ -204,7 +203,7 @@ process(char const* filename, bool include_ignorable, size_t max_len) |
| 204 | 203 | Pl_Buffer plb("buffer"); |
| 205 | 204 | page.pipeContents(&plb); |
| 206 | 205 | auto content_data = plb.getBufferSharedPointer(); |
| 207 | - BufferInputSource* bis = | |
| 206 | + auto* bis = | |
| 208 | 207 | new BufferInputSource("content data", content_data.get()); |
| 209 | 208 | is = std::shared_ptr<InputSource>(bis); |
| 210 | 209 | dump_tokens( |
| ... | ... | @@ -221,7 +220,7 @@ process(char const* filename, bool include_ignorable, size_t max_len) |
| 221 | 220 | if (obj.isStream() && obj.getDict().getKey("/Type").isName() && |
| 222 | 221 | obj.getDict().getKey("/Type").getName() == "/ObjStm") { |
| 223 | 222 | std::shared_ptr<Buffer> b = obj.getStreamData(qpdf_dl_specialized); |
| 224 | - BufferInputSource* bis = | |
| 223 | + auto* bis = | |
| 225 | 224 | new BufferInputSource("object stream data", b.get()); |
| 226 | 225 | is = std::shared_ptr<InputSource>(bis); |
| 227 | 226 | dump_tokens( |
| ... | ... | @@ -239,13 +238,13 @@ int |
| 239 | 238 | main(int argc, char* argv[]) |
| 240 | 239 | { |
| 241 | 240 | QUtil::setLineBuf(stdout); |
| 242 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 241 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 243 | 242 | whoami = argv[0]; |
| 244 | 243 | } else { |
| 245 | 244 | ++whoami; |
| 246 | 245 | } |
| 247 | 246 | |
| 248 | - char const* filename = 0; | |
| 247 | + char const* filename = nullptr; | |
| 249 | 248 | size_t max_len = 0; |
| 250 | 249 | bool include_ignorable = true; |
| 251 | 250 | for (int i = 1; i < argc; ++i) { |
| ... | ... | @@ -266,7 +265,7 @@ main(int argc, char* argv[]) |
| 266 | 265 | filename = argv[i]; |
| 267 | 266 | } |
| 268 | 267 | } |
| 269 | - if (filename == 0) { | |
| 268 | + if (filename == nullptr) { | |
| 270 | 269 | usage(); |
| 271 | 270 | } |
| 272 | 271 | ... | ... |
qpdf/test_unicode_filenames.cc
| ... | ... | @@ -6,13 +6,13 @@ |
| 6 | 6 | #endif |
| 7 | 7 | |
| 8 | 8 | #include <iostream> |
| 9 | -#include <stdio.h> | |
| 10 | -#include <stdlib.h> | |
| 9 | +#include <cstdio> | |
| 10 | +#include <cstdlib> | |
| 11 | 11 | |
| 12 | 12 | static void |
| 13 | 13 | do_copy(FILE* in, FILE* out) |
| 14 | 14 | { |
| 15 | - if ((in == 0) || (out == 0)) { | |
| 15 | + if ((in == nullptr) || (out == nullptr)) { | |
| 16 | 16 | std::cerr << "errors opening files" << std::endl; |
| 17 | 17 | exit(2); |
| 18 | 18 | } | ... | ... |
qpdf/test_xref.cc
zlib-flate/zlib-flate.cc
| ... | ... | @@ -5,11 +5,11 @@ |
| 5 | 5 | |
| 6 | 6 | #include <fcntl.h> |
| 7 | 7 | #include <iostream> |
| 8 | -#include <stdio.h> | |
| 9 | -#include <stdlib.h> | |
| 10 | -#include <string.h> | |
| 8 | +#include <cstdio> | |
| 9 | +#include <cstdlib> | |
| 10 | +#include <cstring> | |
| 11 | 11 | |
| 12 | -static char const* whoami = 0; | |
| 12 | +static char const* whoami = nullptr; | |
| 13 | 13 | |
| 14 | 14 | void |
| 15 | 15 | usage() |
| ... | ... | @@ -27,7 +27,7 @@ usage() |
| 27 | 27 | int |
| 28 | 28 | main(int argc, char* argv[]) |
| 29 | 29 | { |
| 30 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 30 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 31 | 31 | whoami = argv[0]; |
| 32 | 32 | } else { |
| 33 | 33 | ++whoami; | ... | ... |