Commit 0b538ec8779a81d499865a82ffcb4f02f4471743
Committed by
GitHub
Merge pull request #982 from m-holger/cltidy
Apply various Clang-Tidy rules
Showing
111 changed files
with
484 additions
and
644 deletions
examples/pdf-count-strings.cc
| @@ -26,17 +26,14 @@ usage() | @@ -26,17 +26,14 @@ usage() | ||
| 26 | class StringCounter: public QPDFObjectHandle::TokenFilter | 26 | class StringCounter: public QPDFObjectHandle::TokenFilter |
| 27 | { | 27 | { |
| 28 | public: | 28 | public: |
| 29 | - StringCounter() : | ||
| 30 | - count(0) | ||
| 31 | - { | ||
| 32 | - } | 29 | + StringCounter() = default; |
| 33 | ~StringCounter() override = default; | 30 | ~StringCounter() override = default; |
| 34 | void handleToken(QPDFTokenizer::Token const&) override; | 31 | void handleToken(QPDFTokenizer::Token const&) override; |
| 35 | void handleEOF() override; | 32 | void handleEOF() override; |
| 36 | int getCount() const; | 33 | int getCount() const; |
| 37 | 34 | ||
| 38 | private: | 35 | private: |
| 39 | - int count; | 36 | + int count{0}; |
| 40 | }; | 37 | }; |
| 41 | 38 | ||
| 42 | void | 39 | void |
examples/pdf-create.cc
| @@ -31,47 +31,43 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider | @@ -31,47 +31,43 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider | ||
| 31 | size_t getHeight() const; | 31 | size_t getHeight() const; |
| 32 | 32 | ||
| 33 | private: | 33 | private: |
| 34 | - size_t width; | ||
| 35 | - size_t stripe_height; | 34 | + size_t width{400}; |
| 35 | + size_t stripe_height{80}; | ||
| 36 | std::string color_space; | 36 | std::string color_space; |
| 37 | std::string filter; | 37 | std::string filter; |
| 38 | - size_t n_stripes; | 38 | + size_t n_stripes{6}; |
| 39 | std::vector<std::string> stripes; | 39 | std::vector<std::string> stripes; |
| 40 | - J_COLOR_SPACE j_color_space; | 40 | + J_COLOR_SPACE j_color_space{JCS_UNKNOWN}; |
| 41 | }; | 41 | }; |
| 42 | 42 | ||
| 43 | ImageProvider::ImageProvider(std::string const& color_space, std::string const& filter) : | 43 | ImageProvider::ImageProvider(std::string const& color_space, std::string const& filter) : |
| 44 | - width(400), | ||
| 45 | - stripe_height(80), | ||
| 46 | color_space(color_space), | 44 | color_space(color_space), |
| 47 | - filter(filter), | ||
| 48 | - n_stripes(6), | ||
| 49 | - j_color_space(JCS_UNKNOWN) | 45 | + filter(filter) |
| 50 | { | 46 | { |
| 51 | if (color_space == "/DeviceCMYK") { | 47 | if (color_space == "/DeviceCMYK") { |
| 52 | j_color_space = JCS_CMYK; | 48 | j_color_space = JCS_CMYK; |
| 53 | - stripes.push_back(std::string("\xff\x00\x00\x00", 4)); | ||
| 54 | - stripes.push_back(std::string("\x00\xff\x00\x00", 4)); | ||
| 55 | - stripes.push_back(std::string("\x00\x00\xff\x00", 4)); | ||
| 56 | - stripes.push_back(std::string("\xff\x00\xff\x00", 4)); | ||
| 57 | - stripes.push_back(std::string("\xff\xff\x00\x00", 4)); | ||
| 58 | - stripes.push_back(std::string("\x00\x00\x00\xff", 4)); | 49 | + stripes.emplace_back("\xff\x00\x00\x00", 4); |
| 50 | + stripes.emplace_back("\x00\xff\x00\x00", 4); | ||
| 51 | + stripes.emplace_back("\x00\x00\xff\x00", 4); | ||
| 52 | + stripes.emplace_back("\xff\x00\xff\x00", 4); | ||
| 53 | + stripes.emplace_back("\xff\xff\x00\x00", 4); | ||
| 54 | + stripes.emplace_back("\x00\x00\x00\xff", 4); | ||
| 59 | } else if (color_space == "/DeviceRGB") { | 55 | } else if (color_space == "/DeviceRGB") { |
| 60 | j_color_space = JCS_RGB; | 56 | j_color_space = JCS_RGB; |
| 61 | - stripes.push_back(std::string("\xff\x00\x00", 3)); | ||
| 62 | - stripes.push_back(std::string("\x00\xff\x00", 3)); | ||
| 63 | - stripes.push_back(std::string("\x00\x00\xff", 3)); | ||
| 64 | - stripes.push_back(std::string("\xff\x00\xff", 3)); | ||
| 65 | - stripes.push_back(std::string("\xff\xff\x00", 3)); | ||
| 66 | - stripes.push_back(std::string("\x00\x00\x00", 3)); | 57 | + stripes.emplace_back("\xff\x00\x00", 3); |
| 58 | + stripes.emplace_back("\x00\xff\x00", 3); | ||
| 59 | + stripes.emplace_back("\x00\x00\xff", 3); | ||
| 60 | + stripes.emplace_back("\xff\x00\xff", 3); | ||
| 61 | + stripes.emplace_back("\xff\xff\x00", 3); | ||
| 62 | + stripes.emplace_back("\x00\x00\x00", 3); | ||
| 67 | } else if (color_space == "/DeviceGray") { | 63 | } else if (color_space == "/DeviceGray") { |
| 68 | j_color_space = JCS_GRAYSCALE; | 64 | j_color_space = JCS_GRAYSCALE; |
| 69 | - stripes.push_back(std::string("\xee", 1)); | ||
| 70 | - stripes.push_back(std::string("\xcc", 1)); | ||
| 71 | - stripes.push_back(std::string("\x99", 1)); | ||
| 72 | - stripes.push_back(std::string("\x66", 1)); | ||
| 73 | - stripes.push_back(std::string("\x33", 1)); | ||
| 74 | - stripes.push_back(std::string("\x00", 1)); | 65 | + stripes.emplace_back("\xee", 1); |
| 66 | + stripes.emplace_back("\xcc", 1); | ||
| 67 | + stripes.emplace_back("\x99", 1); | ||
| 68 | + stripes.emplace_back("\x66", 1); | ||
| 69 | + stripes.emplace_back("\x33", 1); | ||
| 70 | + stripes.emplace_back("\x00", 1); | ||
| 75 | } | 71 | } |
| 76 | } | 72 | } |
| 77 | 73 | ||
| @@ -335,13 +331,13 @@ create_pdf(char const* filename) | @@ -335,13 +331,13 @@ create_pdf(char const* filename) | ||
| 335 | ">>"_qpdf); | 331 | ">>"_qpdf); |
| 336 | 332 | ||
| 337 | std::vector<std::string> color_spaces; | 333 | std::vector<std::string> color_spaces; |
| 338 | - color_spaces.push_back("/DeviceCMYK"); | ||
| 339 | - color_spaces.push_back("/DeviceRGB"); | ||
| 340 | - color_spaces.push_back("/DeviceGray"); | 334 | + color_spaces.emplace_back("/DeviceCMYK"); |
| 335 | + color_spaces.emplace_back("/DeviceRGB"); | ||
| 336 | + color_spaces.emplace_back("/DeviceGray"); | ||
| 341 | std::vector<std::string> filters; | 337 | std::vector<std::string> filters; |
| 342 | - filters.push_back("null"); | ||
| 343 | - filters.push_back("/DCTDecode"); | ||
| 344 | - filters.push_back("/RunLengthDecode"); | 338 | + filters.emplace_back("null"); |
| 339 | + filters.emplace_back("/DCTDecode"); | ||
| 340 | + filters.emplace_back("/RunLengthDecode"); | ||
| 345 | QPDFPageDocumentHelper dh(pdf); | 341 | QPDFPageDocumentHelper dh(pdf); |
| 346 | for (auto const& color_space: color_spaces) { | 342 | for (auto const& color_space: color_spaces) { |
| 347 | for (auto const& filter: filters) { | 343 | for (auto const& filter: filters) { |
include/qpdf/BufferInputSource.hh
| @@ -32,21 +32,21 @@ class QPDF_DLL_CLASS BufferInputSource: public InputSource | @@ -32,21 +32,21 @@ class QPDF_DLL_CLASS BufferInputSource: public InputSource | ||
| 32 | QPDF_DLL | 32 | QPDF_DLL |
| 33 | BufferInputSource(std::string const& description, std::string const& contents); | 33 | BufferInputSource(std::string const& description, std::string const& contents); |
| 34 | QPDF_DLL | 34 | QPDF_DLL |
| 35 | - virtual ~BufferInputSource(); | 35 | + ~BufferInputSource() override; |
| 36 | QPDF_DLL | 36 | QPDF_DLL |
| 37 | - virtual qpdf_offset_t findAndSkipNextEOL(); | 37 | + qpdf_offset_t findAndSkipNextEOL() override; |
| 38 | QPDF_DLL | 38 | QPDF_DLL |
| 39 | - virtual std::string const& getName() const; | 39 | + std::string const& getName() const override; |
| 40 | QPDF_DLL | 40 | QPDF_DLL |
| 41 | - virtual qpdf_offset_t tell(); | 41 | + qpdf_offset_t tell() override; |
| 42 | QPDF_DLL | 42 | QPDF_DLL |
| 43 | - virtual void seek(qpdf_offset_t offset, int whence); | 43 | + void seek(qpdf_offset_t offset, int whence) override; |
| 44 | QPDF_DLL | 44 | QPDF_DLL |
| 45 | - virtual void rewind(); | 45 | + void rewind() override; |
| 46 | QPDF_DLL | 46 | QPDF_DLL |
| 47 | - virtual size_t read(char* buffer, size_t length); | 47 | + size_t read(char* buffer, size_t length) override; |
| 48 | QPDF_DLL | 48 | QPDF_DLL |
| 49 | - virtual void unreadCh(char ch); | 49 | + void unreadCh(char ch) override; |
| 50 | 50 | ||
| 51 | private: | 51 | private: |
| 52 | bool own_memory; | 52 | bool own_memory; |
include/qpdf/ClosedFileInputSource.hh
| @@ -37,21 +37,21 @@ class QPDF_DLL_CLASS ClosedFileInputSource: public InputSource | @@ -37,21 +37,21 @@ class QPDF_DLL_CLASS ClosedFileInputSource: public InputSource | ||
| 37 | QPDF_DLL | 37 | QPDF_DLL |
| 38 | ClosedFileInputSource(char const* filename); | 38 | ClosedFileInputSource(char const* filename); |
| 39 | QPDF_DLL | 39 | QPDF_DLL |
| 40 | - virtual ~ClosedFileInputSource(); | 40 | + ~ClosedFileInputSource() override; |
| 41 | QPDF_DLL | 41 | QPDF_DLL |
| 42 | - virtual qpdf_offset_t findAndSkipNextEOL(); | 42 | + qpdf_offset_t findAndSkipNextEOL() override; |
| 43 | QPDF_DLL | 43 | QPDF_DLL |
| 44 | - virtual std::string const& getName() const; | 44 | + std::string const& getName() const override; |
| 45 | QPDF_DLL | 45 | QPDF_DLL |
| 46 | - virtual qpdf_offset_t tell(); | 46 | + qpdf_offset_t tell() override; |
| 47 | QPDF_DLL | 47 | QPDF_DLL |
| 48 | - virtual void seek(qpdf_offset_t offset, int whence); | 48 | + void seek(qpdf_offset_t offset, int whence) override; |
| 49 | QPDF_DLL | 49 | QPDF_DLL |
| 50 | - virtual void rewind(); | 50 | + void rewind() override; |
| 51 | QPDF_DLL | 51 | QPDF_DLL |
| 52 | - virtual size_t read(char* buffer, size_t length); | 52 | + size_t read(char* buffer, size_t length) override; |
| 53 | QPDF_DLL | 53 | QPDF_DLL |
| 54 | - virtual void unreadCh(char ch); | 54 | + void unreadCh(char ch) override; |
| 55 | 55 | ||
| 56 | // The file stays open between calls to stayOpen(true) and stayOpen(false). You can use this to | 56 | // The file stays open between calls to stayOpen(true) and stayOpen(false). You can use this to |
| 57 | // surround multiple operations on a single ClosedFileInputSource to reduce the overhead of a | 57 | // surround multiple operations on a single ClosedFileInputSource to reduce the overhead of a |
include/qpdf/FileInputSource.hh
| @@ -35,21 +35,21 @@ class QPDF_DLL_CLASS FileInputSource: public InputSource | @@ -35,21 +35,21 @@ class QPDF_DLL_CLASS FileInputSource: public InputSource | ||
| 35 | QPDF_DLL | 35 | QPDF_DLL |
| 36 | void setFile(char const* description, FILE* filep, bool close_file); | 36 | void setFile(char const* description, FILE* filep, bool close_file); |
| 37 | QPDF_DLL | 37 | QPDF_DLL |
| 38 | - virtual ~FileInputSource(); | 38 | + ~FileInputSource() override; |
| 39 | QPDF_DLL | 39 | QPDF_DLL |
| 40 | - virtual qpdf_offset_t findAndSkipNextEOL(); | 40 | + qpdf_offset_t findAndSkipNextEOL() override; |
| 41 | QPDF_DLL | 41 | QPDF_DLL |
| 42 | - virtual std::string const& getName() const; | 42 | + std::string const& getName() const override; |
| 43 | QPDF_DLL | 43 | QPDF_DLL |
| 44 | - virtual qpdf_offset_t tell(); | 44 | + qpdf_offset_t tell() override; |
| 45 | QPDF_DLL | 45 | QPDF_DLL |
| 46 | - virtual void seek(qpdf_offset_t offset, int whence); | 46 | + void seek(qpdf_offset_t offset, int whence) override; |
| 47 | QPDF_DLL | 47 | QPDF_DLL |
| 48 | - virtual void rewind(); | 48 | + void rewind() override; |
| 49 | QPDF_DLL | 49 | QPDF_DLL |
| 50 | - virtual size_t read(char* buffer, size_t length); | 50 | + size_t read(char* buffer, size_t length) override; |
| 51 | QPDF_DLL | 51 | QPDF_DLL |
| 52 | - virtual void unreadCh(char ch); | 52 | + void unreadCh(char ch) override; |
| 53 | 53 | ||
| 54 | private: | 54 | private: |
| 55 | FileInputSource(FileInputSource const&) = delete; | 55 | FileInputSource(FileInputSource const&) = delete; |
include/qpdf/InputSource.hh
| @@ -33,8 +33,7 @@ class QPDF_DLL_CLASS InputSource | @@ -33,8 +33,7 @@ class QPDF_DLL_CLASS InputSource | ||
| 33 | { | 33 | { |
| 34 | public: | 34 | public: |
| 35 | QPDF_DLL | 35 | QPDF_DLL |
| 36 | - InputSource() : | ||
| 37 | - last_offset(0) | 36 | + InputSource() |
| 38 | { | 37 | { |
| 39 | } | 38 | } |
| 40 | QPDF_DLL | 39 | QPDF_DLL |
| @@ -86,7 +85,7 @@ class QPDF_DLL_CLASS InputSource | @@ -86,7 +85,7 @@ class QPDF_DLL_CLASS InputSource | ||
| 86 | inline void loadBuffer(); | 85 | inline void loadBuffer(); |
| 87 | 86 | ||
| 88 | protected: | 87 | protected: |
| 89 | - qpdf_offset_t last_offset; | 88 | + qpdf_offset_t last_offset{0}; |
| 90 | 89 | ||
| 91 | private: | 90 | private: |
| 92 | class QPDF_DLL_PRIVATE Members | 91 | class QPDF_DLL_PRIVATE Members |
include/qpdf/Pl_Concatenate.hh
| @@ -32,13 +32,13 @@ class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline | @@ -32,13 +32,13 @@ class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline | ||
| 32 | QPDF_DLL | 32 | QPDF_DLL |
| 33 | Pl_Concatenate(char const* identifier, Pipeline* next); | 33 | Pl_Concatenate(char const* identifier, Pipeline* next); |
| 34 | QPDF_DLL | 34 | QPDF_DLL |
| 35 | - virtual ~Pl_Concatenate(); | 35 | + ~Pl_Concatenate() override; |
| 36 | 36 | ||
| 37 | QPDF_DLL | 37 | QPDF_DLL |
| 38 | - virtual void write(unsigned char const* data, size_t len); | 38 | + void write(unsigned char const* data, size_t len) override; |
| 39 | 39 | ||
| 40 | QPDF_DLL | 40 | QPDF_DLL |
| 41 | - virtual void finish(); | 41 | + void finish() override; |
| 42 | 42 | ||
| 43 | // At the very end, call manualFinish to actually finish the rest of the pipeline. | 43 | // At the very end, call manualFinish to actually finish the rest of the pipeline. |
| 44 | QPDF_DLL | 44 | QPDF_DLL |
include/qpdf/Pl_Count.hh
| @@ -30,11 +30,11 @@ class QPDF_DLL_CLASS Pl_Count: public Pipeline | @@ -30,11 +30,11 @@ class QPDF_DLL_CLASS Pl_Count: public Pipeline | ||
| 30 | QPDF_DLL | 30 | QPDF_DLL |
| 31 | Pl_Count(char const* identifier, Pipeline* next); | 31 | Pl_Count(char const* identifier, Pipeline* next); |
| 32 | QPDF_DLL | 32 | QPDF_DLL |
| 33 | - virtual ~Pl_Count(); | 33 | + ~Pl_Count() override; |
| 34 | QPDF_DLL | 34 | QPDF_DLL |
| 35 | - virtual void write(unsigned char const*, size_t); | 35 | + void write(unsigned char const*, size_t) override; |
| 36 | QPDF_DLL | 36 | QPDF_DLL |
| 37 | - virtual void finish(); | 37 | + void finish() override; |
| 38 | // Returns the number of bytes written | 38 | // Returns the number of bytes written |
| 39 | QPDF_DLL | 39 | QPDF_DLL |
| 40 | qpdf_offset_t getCount() const; | 40 | qpdf_offset_t getCount() const; |
include/qpdf/Pl_DCT.hh
| @@ -56,12 +56,12 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline | @@ -56,12 +56,12 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline | ||
| 56 | CompressConfig* config_callback = nullptr); | 56 | CompressConfig* config_callback = nullptr); |
| 57 | 57 | ||
| 58 | QPDF_DLL | 58 | QPDF_DLL |
| 59 | - virtual ~Pl_DCT(); | 59 | + ~Pl_DCT() override; |
| 60 | 60 | ||
| 61 | QPDF_DLL | 61 | QPDF_DLL |
| 62 | - virtual void write(unsigned char const* data, size_t len); | 62 | + void write(unsigned char const* data, size_t len) override; |
| 63 | QPDF_DLL | 63 | QPDF_DLL |
| 64 | - virtual void finish(); | 64 | + void finish() override; |
| 65 | 65 | ||
| 66 | private: | 66 | private: |
| 67 | QPDF_DLL_PRIVATE | 67 | QPDF_DLL_PRIVATE |
include/qpdf/Pl_Discard.hh
| @@ -31,11 +31,11 @@ class QPDF_DLL_CLASS Pl_Discard: public Pipeline | @@ -31,11 +31,11 @@ class QPDF_DLL_CLASS Pl_Discard: public Pipeline | ||
| 31 | QPDF_DLL | 31 | QPDF_DLL |
| 32 | Pl_Discard(); | 32 | Pl_Discard(); |
| 33 | QPDF_DLL | 33 | QPDF_DLL |
| 34 | - virtual ~Pl_Discard(); | 34 | + ~Pl_Discard() override; |
| 35 | QPDF_DLL | 35 | QPDF_DLL |
| 36 | - virtual void write(unsigned char const*, size_t); | 36 | + void write(unsigned char const*, size_t) override; |
| 37 | QPDF_DLL | 37 | QPDF_DLL |
| 38 | - virtual void finish(); | 38 | + void finish() override; |
| 39 | 39 | ||
| 40 | private: | 40 | private: |
| 41 | class QPDF_DLL_PRIVATE Members | 41 | class QPDF_DLL_PRIVATE Members |
include/qpdf/Pl_Flate.hh
| @@ -40,12 +40,12 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline | @@ -40,12 +40,12 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline | ||
| 40 | action_e action, | 40 | action_e action, |
| 41 | unsigned int out_bufsize = def_bufsize); | 41 | unsigned int out_bufsize = def_bufsize); |
| 42 | QPDF_DLL | 42 | QPDF_DLL |
| 43 | - virtual ~Pl_Flate(); | 43 | + ~Pl_Flate() override; |
| 44 | 44 | ||
| 45 | QPDF_DLL | 45 | QPDF_DLL |
| 46 | - virtual void write(unsigned char const* data, size_t len); | 46 | + void write(unsigned char const* data, size_t len) override; |
| 47 | QPDF_DLL | 47 | QPDF_DLL |
| 48 | - virtual void finish(); | 48 | + void finish() override; |
| 49 | 49 | ||
| 50 | // Globally set compression level from 1 (fastest, least | 50 | // Globally set compression level from 1 (fastest, least |
| 51 | // compression) to 9 (slowest, most compression). Use -1 to set | 51 | // compression) to 9 (slowest, most compression). Use -1 to set |
include/qpdf/Pl_Function.hh
| @@ -54,12 +54,12 @@ class QPDF_DLL_CLASS Pl_Function: public Pipeline | @@ -54,12 +54,12 @@ class QPDF_DLL_CLASS Pl_Function: public Pipeline | ||
| 54 | Pl_Function(char const* identifier, Pipeline* next, writer_c_char_t fn, void* udata); | 54 | Pl_Function(char const* identifier, Pipeline* next, writer_c_char_t fn, void* udata); |
| 55 | 55 | ||
| 56 | QPDF_DLL | 56 | QPDF_DLL |
| 57 | - virtual ~Pl_Function(); | 57 | + ~Pl_Function() override; |
| 58 | 58 | ||
| 59 | QPDF_DLL | 59 | QPDF_DLL |
| 60 | - virtual void write(unsigned char const* buf, size_t len); | 60 | + void write(unsigned char const* buf, size_t len) override; |
| 61 | QPDF_DLL | 61 | QPDF_DLL |
| 62 | - virtual void finish(); | 62 | + void finish() override; |
| 63 | 63 | ||
| 64 | private: | 64 | private: |
| 65 | class QPDF_DLL_PRIVATE Members | 65 | class QPDF_DLL_PRIVATE Members |
include/qpdf/Pl_OStream.hh
| @@ -36,12 +36,12 @@ class QPDF_DLL_CLASS Pl_OStream: public Pipeline | @@ -36,12 +36,12 @@ class QPDF_DLL_CLASS Pl_OStream: public Pipeline | ||
| 36 | QPDF_DLL | 36 | QPDF_DLL |
| 37 | Pl_OStream(char const* identifier, std::ostream& os); | 37 | Pl_OStream(char const* identifier, std::ostream& os); |
| 38 | QPDF_DLL | 38 | QPDF_DLL |
| 39 | - virtual ~Pl_OStream(); | 39 | + ~Pl_OStream() override; |
| 40 | 40 | ||
| 41 | QPDF_DLL | 41 | QPDF_DLL |
| 42 | - virtual void write(unsigned char const* buf, size_t len); | 42 | + void write(unsigned char const* buf, size_t len) override; |
| 43 | QPDF_DLL | 43 | QPDF_DLL |
| 44 | - virtual void finish(); | 44 | + void finish() override; |
| 45 | 45 | ||
| 46 | private: | 46 | private: |
| 47 | class QPDF_DLL_PRIVATE Members | 47 | class QPDF_DLL_PRIVATE Members |
include/qpdf/Pl_QPDFTokenizer.hh
| @@ -45,11 +45,11 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline | @@ -45,11 +45,11 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline | ||
| 45 | Pl_QPDFTokenizer( | 45 | Pl_QPDFTokenizer( |
| 46 | char const* identifier, QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); | 46 | char const* identifier, QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); |
| 47 | QPDF_DLL | 47 | QPDF_DLL |
| 48 | - virtual ~Pl_QPDFTokenizer(); | 48 | + ~Pl_QPDFTokenizer() override; |
| 49 | QPDF_DLL | 49 | QPDF_DLL |
| 50 | - virtual void write(unsigned char const* buf, size_t len); | 50 | + void write(unsigned char const* buf, size_t len) override; |
| 51 | QPDF_DLL | 51 | QPDF_DLL |
| 52 | - virtual void finish(); | 52 | + void finish() override; |
| 53 | 53 | ||
| 54 | private: | 54 | private: |
| 55 | class QPDF_DLL_PRIVATE Members | 55 | class QPDF_DLL_PRIVATE Members |
include/qpdf/Pl_RunLength.hh
| @@ -29,12 +29,12 @@ class QPDF_DLL_CLASS Pl_RunLength: public Pipeline | @@ -29,12 +29,12 @@ class QPDF_DLL_CLASS Pl_RunLength: public Pipeline | ||
| 29 | QPDF_DLL | 29 | QPDF_DLL |
| 30 | Pl_RunLength(char const* identifier, Pipeline* next, action_e action); | 30 | Pl_RunLength(char const* identifier, Pipeline* next, action_e action); |
| 31 | QPDF_DLL | 31 | QPDF_DLL |
| 32 | - virtual ~Pl_RunLength(); | 32 | + ~Pl_RunLength() override; |
| 33 | 33 | ||
| 34 | QPDF_DLL | 34 | QPDF_DLL |
| 35 | - virtual void write(unsigned char const* data, size_t len); | 35 | + void write(unsigned char const* data, size_t len) override; |
| 36 | QPDF_DLL | 36 | QPDF_DLL |
| 37 | - virtual void finish(); | 37 | + void finish() override; |
| 38 | 38 | ||
| 39 | private: | 39 | private: |
| 40 | QPDF_DLL_PRIVATE | 40 | QPDF_DLL_PRIVATE |
include/qpdf/Pl_StdioFile.hh
| @@ -36,12 +36,12 @@ class QPDF_DLL_CLASS Pl_StdioFile: public Pipeline | @@ -36,12 +36,12 @@ class QPDF_DLL_CLASS Pl_StdioFile: public Pipeline | ||
| 36 | QPDF_DLL | 36 | QPDF_DLL |
| 37 | Pl_StdioFile(char const* identifier, FILE* f); | 37 | Pl_StdioFile(char const* identifier, FILE* f); |
| 38 | QPDF_DLL | 38 | QPDF_DLL |
| 39 | - virtual ~Pl_StdioFile(); | 39 | + ~Pl_StdioFile() override; |
| 40 | 40 | ||
| 41 | QPDF_DLL | 41 | QPDF_DLL |
| 42 | - virtual void write(unsigned char const* buf, size_t len); | 42 | + void write(unsigned char const* buf, size_t len) override; |
| 43 | QPDF_DLL | 43 | QPDF_DLL |
| 44 | - virtual void finish(); | 44 | + void finish() override; |
| 45 | 45 | ||
| 46 | private: | 46 | private: |
| 47 | class QPDF_DLL_PRIVATE Members | 47 | class QPDF_DLL_PRIVATE Members |
include/qpdf/Pl_String.hh
| @@ -41,12 +41,12 @@ class QPDF_DLL_CLASS Pl_String: public Pipeline | @@ -41,12 +41,12 @@ class QPDF_DLL_CLASS Pl_String: public Pipeline | ||
| 41 | QPDF_DLL | 41 | QPDF_DLL |
| 42 | Pl_String(char const* identifier, Pipeline* next, std::string& s); | 42 | Pl_String(char const* identifier, Pipeline* next, std::string& s); |
| 43 | QPDF_DLL | 43 | QPDF_DLL |
| 44 | - virtual ~Pl_String(); | 44 | + ~Pl_String() override; |
| 45 | 45 | ||
| 46 | QPDF_DLL | 46 | QPDF_DLL |
| 47 | - virtual void write(unsigned char const* buf, size_t len); | 47 | + void write(unsigned char const* buf, size_t len) override; |
| 48 | QPDF_DLL | 48 | QPDF_DLL |
| 49 | - virtual void finish(); | 49 | + void finish() override; |
| 50 | 50 | ||
| 51 | private: | 51 | private: |
| 52 | class QPDF_DLL_PRIVATE Members | 52 | class QPDF_DLL_PRIVATE Members |
include/qpdf/QPDF.hh
| @@ -942,8 +942,8 @@ class QPDF | @@ -942,8 +942,8 @@ class QPDF | ||
| 942 | { | 942 | { |
| 943 | public: | 943 | public: |
| 944 | CopiedStreamDataProvider(QPDF& destination_qpdf); | 944 | CopiedStreamDataProvider(QPDF& destination_qpdf); |
| 945 | - virtual ~CopiedStreamDataProvider() = default; | ||
| 946 | - virtual bool provideStreamData( | 945 | + ~CopiedStreamDataProvider() override = default; |
| 946 | + bool provideStreamData( | ||
| 947 | QPDFObjGen const& og, | 947 | QPDFObjGen const& og, |
| 948 | Pipeline* pipeline, | 948 | Pipeline* pipeline, |
| 949 | bool suppress_warnings, | 949 | bool suppress_warnings, |
| @@ -963,8 +963,8 @@ class QPDF | @@ -963,8 +963,8 @@ class QPDF | ||
| 963 | 963 | ||
| 964 | public: | 964 | public: |
| 965 | StringDecrypter(QPDF* qpdf, QPDFObjGen const& og); | 965 | StringDecrypter(QPDF* qpdf, QPDFObjGen const& og); |
| 966 | - virtual ~StringDecrypter() = default; | ||
| 967 | - virtual void decryptString(std::string& val); | 966 | + ~StringDecrypter() override = default; |
| 967 | + void decryptString(std::string& val) override; | ||
| 968 | 968 | ||
| 969 | private: | 969 | private: |
| 970 | QPDF* qpdf; | 970 | QPDF* qpdf; |
| @@ -1150,58 +1150,32 @@ class QPDF | @@ -1150,58 +1150,32 @@ class QPDF | ||
| 1150 | // PDF 1.4: Table F.4 | 1150 | // PDF 1.4: Table F.4 |
| 1151 | struct HPageOffsetEntry | 1151 | struct HPageOffsetEntry |
| 1152 | { | 1152 | { |
| 1153 | - HPageOffsetEntry() : | ||
| 1154 | - delta_nobjects(0), | ||
| 1155 | - delta_page_length(0), | ||
| 1156 | - nshared_objects(0), | ||
| 1157 | - delta_content_offset(0), | ||
| 1158 | - delta_content_length(0) | ||
| 1159 | - { | ||
| 1160 | - } | ||
| 1161 | - | ||
| 1162 | - int delta_nobjects; // 1 | ||
| 1163 | - qpdf_offset_t delta_page_length; // 2 | ||
| 1164 | - int nshared_objects; // 3 | 1153 | + int delta_nobjects{0}; // 1 |
| 1154 | + qpdf_offset_t delta_page_length{0}; // 2 | ||
| 1165 | // vectors' sizes = nshared_objects | 1155 | // vectors' sizes = nshared_objects |
| 1166 | - std::vector<int> shared_identifiers; // 4 | ||
| 1167 | - std::vector<int> shared_numerators; // 5 | ||
| 1168 | - qpdf_offset_t delta_content_offset; // 6 | ||
| 1169 | - qpdf_offset_t delta_content_length; // 7 | 1156 | + int nshared_objects{0}; // 3 |
| 1157 | + std::vector<int> shared_identifiers; // 4 | ||
| 1158 | + std::vector<int> shared_numerators; // 5 | ||
| 1159 | + qpdf_offset_t delta_content_offset{0}; // 6 | ||
| 1160 | + qpdf_offset_t delta_content_length{0}; // 7 | ||
| 1170 | }; | 1161 | }; |
| 1171 | 1162 | ||
| 1172 | // PDF 1.4: Table F.3 | 1163 | // PDF 1.4: Table F.3 |
| 1173 | struct HPageOffset | 1164 | struct HPageOffset |
| 1174 | { | 1165 | { |
| 1175 | - HPageOffset() : | ||
| 1176 | - min_nobjects(0), | ||
| 1177 | - first_page_offset(0), | ||
| 1178 | - nbits_delta_nobjects(0), | ||
| 1179 | - min_page_length(0), | ||
| 1180 | - nbits_delta_page_length(0), | ||
| 1181 | - min_content_offset(0), | ||
| 1182 | - nbits_delta_content_offset(0), | ||
| 1183 | - min_content_length(0), | ||
| 1184 | - nbits_delta_content_length(0), | ||
| 1185 | - nbits_nshared_objects(0), | ||
| 1186 | - nbits_shared_identifier(0), | ||
| 1187 | - nbits_shared_numerator(0), | ||
| 1188 | - shared_denominator(0) | ||
| 1189 | - { | ||
| 1190 | - } | ||
| 1191 | - | ||
| 1192 | - int min_nobjects; // 1 | ||
| 1193 | - qpdf_offset_t first_page_offset; // 2 | ||
| 1194 | - int nbits_delta_nobjects; // 3 | ||
| 1195 | - int min_page_length; // 4 | ||
| 1196 | - int nbits_delta_page_length; // 5 | ||
| 1197 | - int min_content_offset; // 6 | ||
| 1198 | - int nbits_delta_content_offset; // 7 | ||
| 1199 | - int min_content_length; // 8 | ||
| 1200 | - int nbits_delta_content_length; // 9 | ||
| 1201 | - int nbits_nshared_objects; // 10 | ||
| 1202 | - int nbits_shared_identifier; // 11 | ||
| 1203 | - int nbits_shared_numerator; // 12 | ||
| 1204 | - int shared_denominator; // 13 | 1166 | + int min_nobjects{0}; // 1 |
| 1167 | + qpdf_offset_t first_page_offset{0}; // 2 | ||
| 1168 | + int nbits_delta_nobjects{0}; // 3 | ||
| 1169 | + int min_page_length{0}; // 4 | ||
| 1170 | + int nbits_delta_page_length{0}; // 5 | ||
| 1171 | + int min_content_offset{0}; // 6 | ||
| 1172 | + int nbits_delta_content_offset{0}; // 7 | ||
| 1173 | + int min_content_length{0}; // 8 | ||
| 1174 | + int nbits_delta_content_length{0}; // 9 | ||
| 1175 | + int nbits_nshared_objects{0}; // 10 | ||
| 1176 | + int nbits_shared_identifier{0}; // 11 | ||
| 1177 | + int nbits_shared_numerator{0}; // 12 | ||
| 1178 | + int shared_denominator{0}; // 13 | ||
| 1205 | // vector size is npages | 1179 | // vector size is npages |
| 1206 | std::vector<HPageOffsetEntry> entries; | 1180 | std::vector<HPageOffsetEntry> entries; |
| 1207 | }; | 1181 | }; |
| @@ -1209,40 +1183,22 @@ class QPDF | @@ -1209,40 +1183,22 @@ class QPDF | ||
| 1209 | // PDF 1.4: Table F.6 | 1183 | // PDF 1.4: Table F.6 |
| 1210 | struct HSharedObjectEntry | 1184 | struct HSharedObjectEntry |
| 1211 | { | 1185 | { |
| 1212 | - HSharedObjectEntry() : | ||
| 1213 | - delta_group_length(0), | ||
| 1214 | - signature_present(0), | ||
| 1215 | - nobjects_minus_one(0) | ||
| 1216 | - { | ||
| 1217 | - } | ||
| 1218 | - | ||
| 1219 | // Item 3 is a 128-bit signature (unsupported by Acrobat) | 1186 | // Item 3 is a 128-bit signature (unsupported by Acrobat) |
| 1220 | - int delta_group_length; // 1 | ||
| 1221 | - int signature_present; // 2 -- always 0 | ||
| 1222 | - int nobjects_minus_one; // 4 -- always 0 | 1187 | + int delta_group_length{0}; // 1 |
| 1188 | + int signature_present{0}; // 2 -- always 0 | ||
| 1189 | + int nobjects_minus_one{0}; // 4 -- always 0 | ||
| 1223 | }; | 1190 | }; |
| 1224 | 1191 | ||
| 1225 | // PDF 1.4: Table F.5 | 1192 | // PDF 1.4: Table F.5 |
| 1226 | struct HSharedObject | 1193 | struct HSharedObject |
| 1227 | { | 1194 | { |
| 1228 | - HSharedObject() : | ||
| 1229 | - first_shared_obj(0), | ||
| 1230 | - first_shared_offset(0), | ||
| 1231 | - nshared_first_page(0), | ||
| 1232 | - nshared_total(0), | ||
| 1233 | - nbits_nobjects(0), | ||
| 1234 | - min_group_length(0), | ||
| 1235 | - nbits_delta_group_length(0) | ||
| 1236 | - { | ||
| 1237 | - } | ||
| 1238 | - | ||
| 1239 | - int first_shared_obj; // 1 | ||
| 1240 | - qpdf_offset_t first_shared_offset; // 2 | ||
| 1241 | - int nshared_first_page; // 3 | ||
| 1242 | - int nshared_total; // 4 | ||
| 1243 | - int nbits_nobjects; // 5 | ||
| 1244 | - int min_group_length; // 6 | ||
| 1245 | - int nbits_delta_group_length; // 7 | 1195 | + int first_shared_obj{0}; // 1 |
| 1196 | + qpdf_offset_t first_shared_offset{0}; // 2 | ||
| 1197 | + int nshared_first_page{0}; // 3 | ||
| 1198 | + int nshared_total{0}; // 4 | ||
| 1199 | + int nbits_nobjects{0}; // 5 | ||
| 1200 | + int min_group_length{0}; // 6 | ||
| 1201 | + int nbits_delta_group_length{0}; // 7 | ||
| 1246 | // vector size is nshared_total | 1202 | // vector size is nshared_total |
| 1247 | std::vector<HSharedObjectEntry> entries; | 1203 | std::vector<HSharedObjectEntry> entries; |
| 1248 | }; | 1204 | }; |
| @@ -1250,18 +1206,10 @@ class QPDF | @@ -1250,18 +1206,10 @@ class QPDF | ||
| 1250 | // PDF 1.4: Table F.9 | 1206 | // PDF 1.4: Table F.9 |
| 1251 | struct HGeneric | 1207 | struct HGeneric |
| 1252 | { | 1208 | { |
| 1253 | - HGeneric() : | ||
| 1254 | - first_object(0), | ||
| 1255 | - first_object_offset(0), | ||
| 1256 | - nobjects(0), | ||
| 1257 | - group_length(0) | ||
| 1258 | - { | ||
| 1259 | - } | ||
| 1260 | - | ||
| 1261 | - int first_object; // 1 | ||
| 1262 | - qpdf_offset_t first_object_offset; // 2 | ||
| 1263 | - int nobjects; // 3 | ||
| 1264 | - int group_length; // 4 | 1209 | + int first_object{0}; // 1 |
| 1210 | + qpdf_offset_t first_object_offset{0}; // 2 | ||
| 1211 | + int nobjects{0}; // 3 | ||
| 1212 | + int group_length{0}; // 4 | ||
| 1265 | }; | 1213 | }; |
| 1266 | 1214 | ||
| 1267 | // Other linearization data structures | 1215 | // Other linearization data structures |
| @@ -1269,26 +1217,14 @@ class QPDF | @@ -1269,26 +1217,14 @@ class QPDF | ||
| 1269 | // Initialized from Linearization Parameter dictionary | 1217 | // Initialized from Linearization Parameter dictionary |
| 1270 | struct LinParameters | 1218 | struct LinParameters |
| 1271 | { | 1219 | { |
| 1272 | - LinParameters() : | ||
| 1273 | - file_size(0), | ||
| 1274 | - first_page_object(0), | ||
| 1275 | - first_page_end(0), | ||
| 1276 | - npages(0), | ||
| 1277 | - xref_zero_offset(0), | ||
| 1278 | - first_page(0), | ||
| 1279 | - H_offset(0), | ||
| 1280 | - H_length(0) | ||
| 1281 | - { | ||
| 1282 | - } | ||
| 1283 | - | ||
| 1284 | - qpdf_offset_t file_size; // /L | ||
| 1285 | - int first_page_object; // /O | ||
| 1286 | - qpdf_offset_t first_page_end; // /E | ||
| 1287 | - int npages; // /N | ||
| 1288 | - qpdf_offset_t xref_zero_offset; // /T | ||
| 1289 | - int first_page; // /P | ||
| 1290 | - qpdf_offset_t H_offset; // offset of primary hint stream | ||
| 1291 | - qpdf_offset_t H_length; // length of primary hint stream | 1220 | + qpdf_offset_t file_size{0}; // /L |
| 1221 | + int first_page_object{0}; // /O | ||
| 1222 | + qpdf_offset_t first_page_end{0}; // /E | ||
| 1223 | + int npages{0}; // /N | ||
| 1224 | + qpdf_offset_t xref_zero_offset{0}; // /T | ||
| 1225 | + int first_page{0}; // /P | ||
| 1226 | + qpdf_offset_t H_offset{0}; // offset of primary hint stream | ||
| 1227 | + qpdf_offset_t H_length{0}; // length of primary hint stream | ||
| 1292 | }; | 1228 | }; |
| 1293 | 1229 | ||
| 1294 | // Computed hint table value data structures. These tables contain the computed values on which | 1230 | // Computed hint table value data structures. These tables contain the computed values on which |
| @@ -1304,14 +1240,8 @@ class QPDF | @@ -1304,14 +1240,8 @@ class QPDF | ||
| 1304 | 1240 | ||
| 1305 | struct CHPageOffsetEntry | 1241 | struct CHPageOffsetEntry |
| 1306 | { | 1242 | { |
| 1307 | - CHPageOffsetEntry() : | ||
| 1308 | - nobjects(0), | ||
| 1309 | - nshared_objects(0) | ||
| 1310 | - { | ||
| 1311 | - } | ||
| 1312 | - | ||
| 1313 | - int nobjects; | ||
| 1314 | - int nshared_objects; | 1243 | + int nobjects{0}; |
| 1244 | + int nshared_objects{0}; | ||
| 1315 | // vectors' sizes = nshared_objects | 1245 | // vectors' sizes = nshared_objects |
| 1316 | std::vector<int> shared_identifiers; | 1246 | std::vector<int> shared_identifiers; |
| 1317 | }; | 1247 | }; |
| @@ -1335,16 +1265,9 @@ class QPDF | @@ -1335,16 +1265,9 @@ class QPDF | ||
| 1335 | // PDF 1.4: Table F.5 | 1265 | // PDF 1.4: Table F.5 |
| 1336 | struct CHSharedObject | 1266 | struct CHSharedObject |
| 1337 | { | 1267 | { |
| 1338 | - CHSharedObject() : | ||
| 1339 | - first_shared_obj(0), | ||
| 1340 | - nshared_first_page(0), | ||
| 1341 | - nshared_total(0) | ||
| 1342 | - { | ||
| 1343 | - } | ||
| 1344 | - | ||
| 1345 | - int first_shared_obj; | ||
| 1346 | - int nshared_first_page; | ||
| 1347 | - int nshared_total; | 1268 | + int first_shared_obj{0}; |
| 1269 | + int nshared_first_page{0}; | ||
| 1270 | + int nshared_total{0}; | ||
| 1348 | // vector size is nshared_total | 1271 | // vector size is nshared_total |
| 1349 | std::vector<CHSharedObjectEntry> entries; | 1272 | std::vector<CHSharedObjectEntry> entries; |
| 1350 | }; | 1273 | }; |
| @@ -1385,9 +1308,9 @@ class QPDF | @@ -1385,9 +1308,9 @@ class QPDF | ||
| 1385 | checker(checker) | 1308 | checker(checker) |
| 1386 | { | 1309 | { |
| 1387 | } | 1310 | } |
| 1388 | - virtual ~PatternFinder() = default; | ||
| 1389 | - virtual bool | ||
| 1390 | - check() | 1311 | + ~PatternFinder() override = default; |
| 1312 | + bool | ||
| 1313 | + check() override | ||
| 1391 | { | 1314 | { |
| 1392 | return (this->qpdf.*checker)(); | 1315 | return (this->qpdf.*checker)(); |
| 1393 | } | 1316 | } |
include/qpdf/QPDFAcroFormDocumentHelper.hh
| @@ -71,7 +71,7 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper | @@ -71,7 +71,7 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper | ||
| 71 | QPDF_DLL | 71 | QPDF_DLL |
| 72 | QPDFAcroFormDocumentHelper(QPDF&); | 72 | QPDFAcroFormDocumentHelper(QPDF&); |
| 73 | QPDF_DLL | 73 | QPDF_DLL |
| 74 | - virtual ~QPDFAcroFormDocumentHelper() = default; | 74 | + ~QPDFAcroFormDocumentHelper() override = default; |
| 75 | 75 | ||
| 76 | // This class lazily creates an internal cache of the mapping among form fields, annotations, | 76 | // This class lazily creates an internal cache of the mapping among form fields, annotations, |
| 77 | // and pages. Methods within this class preserve the validity of this cache. However, if you | 77 | // and pages. Methods within this class preserve the validity of this cache. However, if you |
include/qpdf/QPDFAnnotationObjectHelper.hh
| @@ -30,7 +30,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper | @@ -30,7 +30,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper | ||
| 30 | QPDF_DLL | 30 | QPDF_DLL |
| 31 | QPDFAnnotationObjectHelper(QPDFObjectHandle); | 31 | QPDFAnnotationObjectHelper(QPDFObjectHandle); |
| 32 | QPDF_DLL | 32 | QPDF_DLL |
| 33 | - virtual ~QPDFAnnotationObjectHelper() = default; | 33 | + ~QPDFAnnotationObjectHelper() override = default; |
| 34 | 34 | ||
| 35 | // This class provides helper methods for annotations. More functionality will likely be added | 35 | // This class provides helper methods for annotations. More functionality will likely be added |
| 36 | // in the future. | 36 | // in the future. |
include/qpdf/QPDFEFStreamObjectHelper.hh
| @@ -35,7 +35,7 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper | @@ -35,7 +35,7 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper | ||
| 35 | QPDF_DLL | 35 | QPDF_DLL |
| 36 | QPDFEFStreamObjectHelper(QPDFObjectHandle); | 36 | QPDFEFStreamObjectHelper(QPDFObjectHandle); |
| 37 | QPDF_DLL | 37 | QPDF_DLL |
| 38 | - virtual ~QPDFEFStreamObjectHelper() = default; | 38 | + ~QPDFEFStreamObjectHelper() override = default; |
| 39 | 39 | ||
| 40 | // Date parameters are strings that conform to the PDF spec for date/time strings, which is | 40 | // Date parameters are strings that conform to the PDF spec for date/time strings, which is |
| 41 | // "D:yyyymmddhhmmss<z>" where <z> is either "Z" for UTC or "-hh'mm'" or "+hh'mm'" for timezone | 41 | // "D:yyyymmddhhmmss<z>" where <z> is either "Z" for UTC or "-hh'mm'" or "+hh'mm'" for timezone |
include/qpdf/QPDFEmbeddedFileDocumentHelper.hh
| @@ -39,7 +39,7 @@ class QPDFEmbeddedFileDocumentHelper: public QPDFDocumentHelper | @@ -39,7 +39,7 @@ class QPDFEmbeddedFileDocumentHelper: public QPDFDocumentHelper | ||
| 39 | QPDF_DLL | 39 | QPDF_DLL |
| 40 | QPDFEmbeddedFileDocumentHelper(QPDF&); | 40 | QPDFEmbeddedFileDocumentHelper(QPDF&); |
| 41 | QPDF_DLL | 41 | QPDF_DLL |
| 42 | - virtual ~QPDFEmbeddedFileDocumentHelper() = default; | 42 | + ~QPDFEmbeddedFileDocumentHelper() override = default; |
| 43 | 43 | ||
| 44 | QPDF_DLL | 44 | QPDF_DLL |
| 45 | bool hasEmbeddedFiles() const; | 45 | bool hasEmbeddedFiles() const; |
include/qpdf/QPDFExc.hh
| @@ -37,7 +37,7 @@ class QPDF_DLL_CLASS QPDFExc: public std::runtime_error | @@ -37,7 +37,7 @@ class QPDF_DLL_CLASS QPDFExc: public std::runtime_error | ||
| 37 | qpdf_offset_t offset, | 37 | qpdf_offset_t offset, |
| 38 | std::string const& message); | 38 | std::string const& message); |
| 39 | QPDF_DLL | 39 | QPDF_DLL |
| 40 | - virtual ~QPDFExc() noexcept = default; | 40 | + ~QPDFExc() noexcept override = default; |
| 41 | 41 | ||
| 42 | // To get a complete error string, call what(), provided by std::exception. The accessors below | 42 | // To get a complete error string, call what(), provided by std::exception. The accessors below |
| 43 | // return the original values used to create the exception. Only the error code and message are | 43 | // return the original values used to create the exception. Only the error code and message are |
include/qpdf/QPDFFileSpecObjectHelper.hh
| @@ -35,7 +35,7 @@ class QPDFFileSpecObjectHelper: public QPDFObjectHelper | @@ -35,7 +35,7 @@ class QPDFFileSpecObjectHelper: public QPDFObjectHelper | ||
| 35 | QPDF_DLL | 35 | QPDF_DLL |
| 36 | QPDFFileSpecObjectHelper(QPDFObjectHandle); | 36 | QPDFFileSpecObjectHelper(QPDFObjectHandle); |
| 37 | QPDF_DLL | 37 | QPDF_DLL |
| 38 | - virtual ~QPDFFileSpecObjectHelper() = default; | 38 | + ~QPDFFileSpecObjectHelper() override = default; |
| 39 | 39 | ||
| 40 | QPDF_DLL | 40 | QPDF_DLL |
| 41 | std::string getDescription(); | 41 | std::string getDescription(); |
include/qpdf/QPDFFormFieldObjectHelper.hh
| @@ -37,7 +37,7 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper | @@ -37,7 +37,7 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper | ||
| 37 | QPDF_DLL | 37 | QPDF_DLL |
| 38 | QPDFFormFieldObjectHelper(QPDFObjectHandle); | 38 | QPDFFormFieldObjectHelper(QPDFObjectHandle); |
| 39 | QPDF_DLL | 39 | QPDF_DLL |
| 40 | - virtual ~QPDFFormFieldObjectHelper() = default; | 40 | + ~QPDFFormFieldObjectHelper() override = default; |
| 41 | 41 | ||
| 42 | QPDF_DLL | 42 | QPDF_DLL |
| 43 | bool isNull(); | 43 | bool isNull(); |
include/qpdf/QPDFJob.hh
| @@ -145,11 +145,6 @@ class QPDFJob | @@ -145,11 +145,6 @@ class QPDFJob | ||
| 145 | 145 | ||
| 146 | struct AddAttachment | 146 | struct AddAttachment |
| 147 | { | 147 | { |
| 148 | - AddAttachment() : | ||
| 149 | - replace(false) | ||
| 150 | - { | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | std::string path; | 148 | std::string path; |
| 154 | std::string key; | 149 | std::string key; |
| 155 | std::string filename; | 150 | std::string filename; |
| @@ -157,7 +152,7 @@ class QPDFJob | @@ -157,7 +152,7 @@ class QPDFJob | ||
| 157 | std::string moddate; | 152 | std::string moddate; |
| 158 | std::string mimetype; | 153 | std::string mimetype; |
| 159 | std::string description; | 154 | std::string description; |
| 160 | - bool replace; | 155 | + bool replace{false}; |
| 161 | }; | 156 | }; |
| 162 | 157 | ||
| 163 | struct PageSpec | 158 | struct PageSpec |
include/qpdf/QPDFNameTreeObjectHelper.hh
| @@ -50,7 +50,7 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper | @@ -50,7 +50,7 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper | ||
| 50 | static QPDFNameTreeObjectHelper newEmpty(QPDF&, bool auto_repair = true); | 50 | static QPDFNameTreeObjectHelper newEmpty(QPDF&, bool auto_repair = true); |
| 51 | 51 | ||
| 52 | QPDF_DLL | 52 | QPDF_DLL |
| 53 | - virtual ~QPDFNameTreeObjectHelper(); | 53 | + ~QPDFNameTreeObjectHelper() override; |
| 54 | 54 | ||
| 55 | // Return whether the name tree has an explicit entry for this name. | 55 | // Return whether the name tree has an explicit entry for this name. |
| 56 | QPDF_DLL | 56 | QPDF_DLL |
include/qpdf/QPDFNumberTreeObjectHelper.hh
| @@ -44,7 +44,7 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper | @@ -44,7 +44,7 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper | ||
| 44 | QPDFNumberTreeObjectHelper(QPDFObjectHandle, QPDF&, bool auto_repair = true); | 44 | QPDFNumberTreeObjectHelper(QPDFObjectHandle, QPDF&, bool auto_repair = true); |
| 45 | 45 | ||
| 46 | QPDF_DLL | 46 | QPDF_DLL |
| 47 | - virtual ~QPDFNumberTreeObjectHelper(); | 47 | + ~QPDFNumberTreeObjectHelper() override; |
| 48 | 48 | ||
| 49 | // Create an empty number tree | 49 | // Create an empty number tree |
| 50 | QPDF_DLL | 50 | QPDF_DLL |
include/qpdf/QPDFObjGen.hh
include/qpdf/QPDFOutlineDocumentHelper.hh
| @@ -41,7 +41,7 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper | @@ -41,7 +41,7 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper | ||
| 41 | QPDF_DLL | 41 | QPDF_DLL |
| 42 | QPDFOutlineDocumentHelper(QPDF&); | 42 | QPDFOutlineDocumentHelper(QPDF&); |
| 43 | QPDF_DLL | 43 | QPDF_DLL |
| 44 | - virtual ~QPDFOutlineDocumentHelper() = default; | 44 | + ~QPDFOutlineDocumentHelper() override = default; |
| 45 | 45 | ||
| 46 | QPDF_DLL | 46 | QPDF_DLL |
| 47 | bool hasOutlines(); | 47 | bool hasOutlines(); |
include/qpdf/QPDFOutlineObjectHelper.hh
| @@ -34,7 +34,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper | @@ -34,7 +34,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper | ||
| 34 | { | 34 | { |
| 35 | public: | 35 | public: |
| 36 | QPDF_DLL | 36 | QPDF_DLL |
| 37 | - virtual ~QPDFOutlineObjectHelper() | 37 | + ~QPDFOutlineObjectHelper() override |
| 38 | { | 38 | { |
| 39 | // This must be cleared explicitly to avoid circular references that prevent cleanup of | 39 | // This must be cleared explicitly to avoid circular references that prevent cleanup of |
| 40 | // shared pointers. | 40 | // shared pointers. |
| @@ -81,7 +81,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper | @@ -81,7 +81,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper | ||
| 81 | static QPDFOutlineObjectHelper | 81 | static QPDFOutlineObjectHelper |
| 82 | create(QPDFObjectHandle oh, QPDFOutlineDocumentHelper& dh, int depth) | 82 | create(QPDFObjectHandle oh, QPDFOutlineDocumentHelper& dh, int depth) |
| 83 | { | 83 | { |
| 84 | - return QPDFOutlineObjectHelper(oh, dh, depth); | 84 | + return {oh, dh, depth}; |
| 85 | } | 85 | } |
| 86 | }; | 86 | }; |
| 87 | 87 |
include/qpdf/QPDFPageDocumentHelper.hh
| @@ -37,7 +37,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper | @@ -37,7 +37,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper | ||
| 37 | QPDF_DLL | 37 | QPDF_DLL |
| 38 | QPDFPageDocumentHelper(QPDF&); | 38 | QPDFPageDocumentHelper(QPDF&); |
| 39 | QPDF_DLL | 39 | QPDF_DLL |
| 40 | - virtual ~QPDFPageDocumentHelper() = default; | 40 | + ~QPDFPageDocumentHelper() override = default; |
| 41 | 41 | ||
| 42 | // Traverse page tree, and return all /Page objects wrapped in QPDFPageObjectHelper objects. | 42 | // Traverse page tree, and return all /Page objects wrapped in QPDFPageObjectHelper objects. |
| 43 | // Unlike with QPDF::getAllPages, the vector of pages returned by this call is not affected by | 43 | // Unlike with QPDF::getAllPages, the vector of pages returned by this call is not affected by |
include/qpdf/QPDFPageLabelDocumentHelper.hh
| @@ -44,7 +44,7 @@ class QPDFPageLabelDocumentHelper: public QPDFDocumentHelper | @@ -44,7 +44,7 @@ class QPDFPageLabelDocumentHelper: public QPDFDocumentHelper | ||
| 44 | QPDF_DLL | 44 | QPDF_DLL |
| 45 | QPDFPageLabelDocumentHelper(QPDF&); | 45 | QPDFPageLabelDocumentHelper(QPDF&); |
| 46 | QPDF_DLL | 46 | QPDF_DLL |
| 47 | - virtual ~QPDFPageLabelDocumentHelper() = default; | 47 | + ~QPDFPageLabelDocumentHelper() override = default; |
| 48 | 48 | ||
| 49 | QPDF_DLL | 49 | QPDF_DLL |
| 50 | bool hasPageLabels(); | 50 | bool hasPageLabels(); |
include/qpdf/QPDFPageObjectHelper.hh
| @@ -39,7 +39,7 @@ class QPDFPageObjectHelper: public QPDFObjectHelper | @@ -39,7 +39,7 @@ class QPDFPageObjectHelper: public QPDFObjectHelper | ||
| 39 | QPDF_DLL | 39 | QPDF_DLL |
| 40 | QPDFPageObjectHelper(QPDFObjectHandle); | 40 | QPDFPageObjectHelper(QPDFObjectHandle); |
| 41 | QPDF_DLL | 41 | QPDF_DLL |
| 42 | - virtual ~QPDFPageObjectHelper() = default; | 42 | + ~QPDFPageObjectHelper() override = default; |
| 43 | 43 | ||
| 44 | // PAGE ATTRIBUTES | 44 | // PAGE ATTRIBUTES |
| 45 | 45 |
include/qpdf/QPDFSystemError.hh
| @@ -32,7 +32,7 @@ class QPDF_DLL_CLASS QPDFSystemError: public std::runtime_error | @@ -32,7 +32,7 @@ class QPDF_DLL_CLASS QPDFSystemError: public std::runtime_error | ||
| 32 | QPDF_DLL | 32 | QPDF_DLL |
| 33 | QPDFSystemError(std::string const& description, int system_errno); | 33 | QPDFSystemError(std::string const& description, int system_errno); |
| 34 | QPDF_DLL | 34 | QPDF_DLL |
| 35 | - virtual ~QPDFSystemError() noexcept = default; | 35 | + ~QPDFSystemError() noexcept override = default; |
| 36 | 36 | ||
| 37 | // To get a complete error string, call what(), provided by std::exception. The accessors below | 37 | // To get a complete error string, call what(), provided by std::exception. The accessors below |
| 38 | // return the original values used to create the exception. | 38 | // return the original values used to create the exception. |
include/qpdf/QPDFUsage.hh
| @@ -30,7 +30,7 @@ class QPDF_DLL_CLASS QPDFUsage: public std::runtime_error | @@ -30,7 +30,7 @@ class QPDF_DLL_CLASS QPDFUsage: public std::runtime_error | ||
| 30 | QPDF_DLL | 30 | QPDF_DLL |
| 31 | QPDFUsage(std::string const& msg); | 31 | QPDFUsage(std::string const& msg); |
| 32 | QPDF_DLL | 32 | QPDF_DLL |
| 33 | - virtual ~QPDFUsage() noexcept = default; | 33 | + ~QPDFUsage() noexcept override = default; |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | #endif // QPDFUSAGE_HH | 36 | #endif // QPDFUSAGE_HH |
include/qpdf/QPDFWriter.hh
| @@ -92,7 +92,7 @@ class QPDFWriter | @@ -92,7 +92,7 @@ class QPDFWriter | ||
| 92 | QPDF_DLL | 92 | QPDF_DLL |
| 93 | FunctionProgressReporter(std::function<void(int)>); | 93 | FunctionProgressReporter(std::function<void(int)>); |
| 94 | QPDF_DLL | 94 | QPDF_DLL |
| 95 | - virtual ~FunctionProgressReporter(); | 95 | + ~FunctionProgressReporter() override; |
| 96 | QPDF_DLL | 96 | QPDF_DLL |
| 97 | void reportProgress(int) override; | 97 | void reportProgress(int) override; |
| 98 | 98 |
libqpdf/ClosedFileInputSource.cc
| @@ -9,7 +9,7 @@ ClosedFileInputSource::ClosedFileInputSource(char const* filename) : | @@ -9,7 +9,7 @@ ClosedFileInputSource::ClosedFileInputSource(char const* filename) : | ||
| 9 | { | 9 | { |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | -ClosedFileInputSource::~ClosedFileInputSource() | 12 | +ClosedFileInputSource::~ClosedFileInputSource() // NOLINT (modernize-use-equals-default) |
| 13 | { | 13 | { |
| 14 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 14 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 15 | } | 15 | } |
libqpdf/InputSource.cc
| @@ -37,7 +37,7 @@ InputSource::readLine(size_t max_line_length) | @@ -37,7 +37,7 @@ InputSource::readLine(size_t max_line_length) | ||
| 37 | if (line_length < max_line_length) { | 37 | if (line_length < max_line_length) { |
| 38 | buf[line_length] = '\0'; | 38 | buf[line_length] = '\0'; |
| 39 | } | 39 | } |
| 40 | - return std::string(buf); | 40 | + return {buf}; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | bool | 43 | bool |
libqpdf/JSON.cc
| @@ -269,7 +269,7 @@ JSON::encode_string(std::string const& str) | @@ -269,7 +269,7 @@ JSON::encode_string(std::string const& str) | ||
| 269 | JSON | 269 | JSON |
| 270 | JSON::makeDictionary() | 270 | JSON::makeDictionary() |
| 271 | { | 271 | { |
| 272 | - return JSON(std::make_unique<JSON_dictionary>()); | 272 | + return {std::make_unique<JSON_dictionary>()}; |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | JSON | 275 | JSON |
| @@ -299,7 +299,7 @@ JSON::checkDictionaryKeySeen(std::string const& key) | @@ -299,7 +299,7 @@ JSON::checkDictionaryKeySeen(std::string const& key) | ||
| 299 | JSON | 299 | JSON |
| 300 | JSON::makeArray() | 300 | JSON::makeArray() |
| 301 | { | 301 | { |
| 302 | - return JSON(std::make_unique<JSON_array>()); | 302 | + return {std::make_unique<JSON_array>()}; |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | JSON | 305 | JSON |
| @@ -320,43 +320,43 @@ JSON::addArrayElement(JSON const& val) | @@ -320,43 +320,43 @@ JSON::addArrayElement(JSON const& val) | ||
| 320 | JSON | 320 | JSON |
| 321 | JSON::makeString(std::string const& utf8) | 321 | JSON::makeString(std::string const& utf8) |
| 322 | { | 322 | { |
| 323 | - return JSON(std::make_unique<JSON_string>(utf8)); | 323 | + return {std::make_unique<JSON_string>(utf8)}; |
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | JSON | 326 | JSON |
| 327 | JSON::makeInt(long long int value) | 327 | JSON::makeInt(long long int value) |
| 328 | { | 328 | { |
| 329 | - return JSON(std::make_unique<JSON_number>(value)); | 329 | + return {std::make_unique<JSON_number>(value)}; |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | JSON | 332 | JSON |
| 333 | JSON::makeReal(double value) | 333 | JSON::makeReal(double value) |
| 334 | { | 334 | { |
| 335 | - return JSON(std::make_unique<JSON_number>(value)); | 335 | + return {std::make_unique<JSON_number>(value)}; |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | JSON | 338 | JSON |
| 339 | JSON::makeNumber(std::string const& encoded) | 339 | JSON::makeNumber(std::string const& encoded) |
| 340 | { | 340 | { |
| 341 | - return JSON(std::make_unique<JSON_number>(encoded)); | 341 | + return {std::make_unique<JSON_number>(encoded)}; |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | JSON | 344 | JSON |
| 345 | JSON::makeBool(bool value) | 345 | JSON::makeBool(bool value) |
| 346 | { | 346 | { |
| 347 | - return JSON(std::make_unique<JSON_bool>(value)); | 347 | + return {std::make_unique<JSON_bool>(value)}; |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | JSON | 350 | JSON |
| 351 | JSON::makeNull() | 351 | JSON::makeNull() |
| 352 | { | 352 | { |
| 353 | - return JSON(std::make_unique<JSON_null>()); | 353 | + return {std::make_unique<JSON_null>()}; |
| 354 | } | 354 | } |
| 355 | 355 | ||
| 356 | JSON | 356 | JSON |
| 357 | JSON::makeBlob(std::function<void(Pipeline*)> fn) | 357 | JSON::makeBlob(std::function<void(Pipeline*)> fn) |
| 358 | { | 358 | { |
| 359 | - return JSON(std::make_unique<JSON_blob>(fn)); | 359 | + return {std::make_unique<JSON_blob>(fn)}; |
| 360 | } | 360 | } |
| 361 | 361 | ||
| 362 | bool | 362 | bool |
| @@ -588,14 +588,7 @@ namespace | @@ -588,14 +588,7 @@ namespace | ||
| 588 | JSONParser(InputSource& is, JSON::Reactor* reactor) : | 588 | JSONParser(InputSource& is, JSON::Reactor* reactor) : |
| 589 | is(is), | 589 | is(is), |
| 590 | reactor(reactor), | 590 | reactor(reactor), |
| 591 | - lex_state(ls_top), | ||
| 592 | - bytes(0), | ||
| 593 | - p(buf), | ||
| 594 | - u_count(0), | ||
| 595 | - offset(0), | ||
| 596 | - done(false), | ||
| 597 | - parser_state(ps_top), | ||
| 598 | - dict_key_offset(0) | 591 | + p(buf) |
| 599 | { | 592 | { |
| 600 | } | 593 | } |
| 601 | 594 | ||
| @@ -665,20 +658,20 @@ namespace | @@ -665,20 +658,20 @@ namespace | ||
| 665 | 658 | ||
| 666 | InputSource& is; | 659 | InputSource& is; |
| 667 | JSON::Reactor* reactor; | 660 | JSON::Reactor* reactor; |
| 668 | - lex_state_e lex_state; | 661 | + lex_state_e lex_state{ls_top}; |
| 669 | char buf[16384]; | 662 | char buf[16384]; |
| 670 | - size_t bytes; | 663 | + size_t bytes{0}; |
| 671 | char const* p; | 664 | char const* p; |
| 672 | - qpdf_offset_t u_count; | 665 | + qpdf_offset_t u_count{0}; |
| 673 | unsigned long u_value{0}; | 666 | unsigned long u_value{0}; |
| 674 | - qpdf_offset_t offset; | ||
| 675 | - bool done; | 667 | + qpdf_offset_t offset{0}; |
| 668 | + bool done{false}; | ||
| 676 | std::string token; | 669 | std::string token; |
| 677 | qpdf_offset_t token_start{0}; | 670 | qpdf_offset_t token_start{0}; |
| 678 | - parser_state_e parser_state; | 671 | + parser_state_e parser_state{ps_top}; |
| 679 | std::vector<StackFrame> stack; | 672 | std::vector<StackFrame> stack; |
| 680 | std::string dict_key; | 673 | std::string dict_key; |
| 681 | - qpdf_offset_t dict_key_offset; | 674 | + qpdf_offset_t dict_key_offset{0}; |
| 682 | }; | 675 | }; |
| 683 | } // namespace | 676 | } // namespace |
| 684 | 677 | ||
| @@ -1282,7 +1275,7 @@ JSONParser::handleToken() | @@ -1282,7 +1275,7 @@ JSONParser::handleToken() | ||
| 1282 | 1275 | ||
| 1283 | case ps_top: | 1276 | case ps_top: |
| 1284 | if (!(item.isDictionary() || item.isArray())) { | 1277 | if (!(item.isDictionary() || item.isArray())) { |
| 1285 | - stack.push_back({ps_done, item}); | 1278 | + stack.emplace_back(ps_done, item); |
| 1286 | parser_state = ps_done; | 1279 | parser_state = ps_done; |
| 1287 | return; | 1280 | return; |
| 1288 | } | 1281 | } |
| @@ -1311,7 +1304,7 @@ JSONParser::handleToken() | @@ -1311,7 +1304,7 @@ JSONParser::handleToken() | ||
| 1311 | } | 1304 | } |
| 1312 | 1305 | ||
| 1313 | if (item.isDictionary() || item.isArray()) { | 1306 | if (item.isDictionary() || item.isArray()) { |
| 1314 | - stack.push_back({parser_state, item}); | 1307 | + stack.emplace_back(parser_state, item); |
| 1315 | // Calling container start method is postponed until after adding the containers to their | 1308 | // Calling container start method is postponed until after adding the containers to their |
| 1316 | // parent containers, if any. This makes it much easier to keep track of the current nesting | 1309 | // parent containers, if any. This makes it much easier to keep track of the current nesting |
| 1317 | // level. | 1310 | // level. |
libqpdf/NNTree.cc
| @@ -319,7 +319,7 @@ NNTreeIterator::split(QPDFObjectHandle to_split, std::list<PathElement>::iterato | @@ -319,7 +319,7 @@ NNTreeIterator::split(QPDFObjectHandle to_split, std::list<PathElement>::iterato | ||
| 319 | auto next = this->path.begin(); | 319 | auto next = this->path.begin(); |
| 320 | next->node = first_node; | 320 | next->node = first_node; |
| 321 | } | 321 | } |
| 322 | - this->path.push_front(PathElement(to_split, 0)); | 322 | + this->path.emplace_front(to_split, 0); |
| 323 | parent = this->path.begin(); | 323 | parent = this->path.begin(); |
| 324 | to_split = first_node; | 324 | to_split = first_node; |
| 325 | } | 325 | } |
| @@ -578,7 +578,7 @@ NNTreeIterator::setItemNumber(QPDFObjectHandle const& node, int n) | @@ -578,7 +578,7 @@ NNTreeIterator::setItemNumber(QPDFObjectHandle const& node, int n) | ||
| 578 | void | 578 | void |
| 579 | NNTreeIterator::addPathElement(QPDFObjectHandle const& node, int kid_number) | 579 | NNTreeIterator::addPathElement(QPDFObjectHandle const& node, int kid_number) |
| 580 | { | 580 | { |
| 581 | - this->path.push_back(PathElement(node, kid_number)); | 581 | + this->path.emplace_back(node, kid_number); |
| 582 | } | 582 | } |
| 583 | 583 | ||
| 584 | bool | 584 | bool |
| @@ -591,7 +591,7 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty) | @@ -591,7 +591,7 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty) | ||
| 591 | bool failed = false; | 591 | bool failed = false; |
| 592 | 592 | ||
| 593 | QPDFObjGen::set seen; | 593 | QPDFObjGen::set seen; |
| 594 | - for (auto i: this->path) { | 594 | + for (auto const& i: this->path) { |
| 595 | seen.add(i.node); | 595 | seen.add(i.node); |
| 596 | } | 596 | } |
| 597 | while (!failed) { | 597 | while (!failed) { |
| @@ -689,7 +689,7 @@ NNTreeImpl::begin() | @@ -689,7 +689,7 @@ NNTreeImpl::begin() | ||
| 689 | NNTreeImpl::iterator | 689 | NNTreeImpl::iterator |
| 690 | NNTreeImpl::end() | 690 | NNTreeImpl::end() |
| 691 | { | 691 | { |
| 692 | - return iterator(*this); | 692 | + return {*this}; |
| 693 | } | 693 | } |
| 694 | 694 | ||
| 695 | NNTreeImpl::iterator | 695 | NNTreeImpl::iterator |
libqpdf/Pl_Buffer.cc
| @@ -11,7 +11,7 @@ Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) : | @@ -11,7 +11,7 @@ Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) : | ||
| 11 | { | 11 | { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | -Pl_Buffer::~Pl_Buffer() | 14 | +Pl_Buffer::~Pl_Buffer() // NOLINT (modernize-use-equals-default) |
| 15 | { | 15 | { |
| 16 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 16 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 17 | } | 17 | } |
libqpdf/Pl_Concatenate.cc
| @@ -5,7 +5,7 @@ Pl_Concatenate::Pl_Concatenate(char const* identifier, Pipeline* next) : | @@ -5,7 +5,7 @@ Pl_Concatenate::Pl_Concatenate(char const* identifier, Pipeline* next) : | ||
| 5 | { | 5 | { |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | -Pl_Concatenate::~Pl_Concatenate() | 8 | +Pl_Concatenate::~Pl_Concatenate() // NOLINT (modernize-use-equals-default) |
| 9 | { | 9 | { |
| 10 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 10 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 11 | } | 11 | } |
libqpdf/Pl_Count.cc
| @@ -14,7 +14,7 @@ Pl_Count::Pl_Count(char const* identifier, Pipeline* next) : | @@ -14,7 +14,7 @@ Pl_Count::Pl_Count(char const* identifier, Pipeline* next) : | ||
| 14 | { | 14 | { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | -Pl_Count::~Pl_Count() | 17 | +Pl_Count::~Pl_Count() // NOLINT (modernize-use-equals-default) |
| 18 | { | 18 | { |
| 19 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 19 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 20 | } | 20 | } |
libqpdf/Pl_DCT.cc
| @@ -75,7 +75,7 @@ Pl_DCT::Pl_DCT( | @@ -75,7 +75,7 @@ Pl_DCT::Pl_DCT( | ||
| 75 | { | 75 | { |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | -Pl_DCT::~Pl_DCT() | 78 | +Pl_DCT::~Pl_DCT() // NOLINT (modernize-use-equals-default) |
| 79 | { | 79 | { |
| 80 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 80 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 81 | } | 81 | } |
libqpdf/Pl_Discard.cc
| @@ -7,7 +7,7 @@ Pl_Discard::Pl_Discard() : | @@ -7,7 +7,7 @@ Pl_Discard::Pl_Discard() : | ||
| 7 | { | 7 | { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | -Pl_Discard::~Pl_Discard() | 10 | +Pl_Discard::~Pl_Discard() // NOLINT (modernize-use-equals-default) |
| 11 | { | 11 | { |
| 12 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 12 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 13 | } | 13 | } |
libqpdf/Pl_Flate.cc
| @@ -58,7 +58,7 @@ Pl_Flate::Pl_Flate( | @@ -58,7 +58,7 @@ Pl_Flate::Pl_Flate( | ||
| 58 | { | 58 | { |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | -Pl_Flate::~Pl_Flate() | 61 | +Pl_Flate::~Pl_Flate() // NOLINT (modernize-use-equals-default) |
| 62 | { | 62 | { |
| 63 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 63 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 64 | } | 64 | } |
libqpdf/Pl_Function.cc
| @@ -39,7 +39,7 @@ Pl_Function::Pl_Function(char const* identifier, Pipeline* next, writer_c_char_t | @@ -39,7 +39,7 @@ Pl_Function::Pl_Function(char const* identifier, Pipeline* next, writer_c_char_t | ||
| 39 | }; | 39 | }; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | -Pl_Function::~Pl_Function() | 42 | +Pl_Function::~Pl_Function() // NOLINT (modernize-use-equals-default) |
| 43 | { | 43 | { |
| 44 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 44 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 45 | } | 45 | } |
libqpdf/Pl_OStream.cc
| @@ -13,7 +13,7 @@ Pl_OStream::Pl_OStream(char const* identifier, std::ostream& os) : | @@ -13,7 +13,7 @@ Pl_OStream::Pl_OStream(char const* identifier, std::ostream& os) : | ||
| 13 | { | 13 | { |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | -Pl_OStream::~Pl_OStream() | 16 | +Pl_OStream::~Pl_OStream() // NOLINT (modernize-use-equals-default) |
| 17 | { | 17 | { |
| 18 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 18 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 19 | } | 19 | } |
libqpdf/Pl_QPDFTokenizer.cc
| @@ -21,7 +21,7 @@ Pl_QPDFTokenizer::Pl_QPDFTokenizer( | @@ -21,7 +21,7 @@ Pl_QPDFTokenizer::Pl_QPDFTokenizer( | ||
| 21 | m->tokenizer.includeIgnorable(); | 21 | m->tokenizer.includeIgnorable(); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | -Pl_QPDFTokenizer::~Pl_QPDFTokenizer() | 24 | +Pl_QPDFTokenizer::~Pl_QPDFTokenizer() // NOLINT (modernize-use-equals-default) |
| 25 | { | 25 | { |
| 26 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 26 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 27 | } | 27 | } |
libqpdf/Pl_RunLength.cc
| @@ -16,7 +16,7 @@ Pl_RunLength::Pl_RunLength(char const* identifier, Pipeline* next, action_e acti | @@ -16,7 +16,7 @@ Pl_RunLength::Pl_RunLength(char const* identifier, Pipeline* next, action_e acti | ||
| 16 | { | 16 | { |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | -Pl_RunLength::~Pl_RunLength() | 19 | +Pl_RunLength::~Pl_RunLength() // NOLINT (modernize-use-equals-default) |
| 20 | { | 20 | { |
| 21 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 21 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 22 | } | 22 | } |
libqpdf/Pl_StdioFile.cc
| @@ -17,7 +17,7 @@ Pl_StdioFile::Pl_StdioFile(char const* identifier, FILE* f) : | @@ -17,7 +17,7 @@ Pl_StdioFile::Pl_StdioFile(char const* identifier, FILE* f) : | ||
| 17 | { | 17 | { |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | -Pl_StdioFile::~Pl_StdioFile() | 20 | +Pl_StdioFile::~Pl_StdioFile() // NOLINT (modernize-use-equals-default) |
| 21 | { | 21 | { |
| 22 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 22 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 23 | } | 23 | } |
libqpdf/Pl_String.cc
| @@ -13,7 +13,7 @@ Pl_String::Pl_String(char const* identifier, Pipeline* next, std::string& s) : | @@ -13,7 +13,7 @@ Pl_String::Pl_String(char const* identifier, Pipeline* next, std::string& s) : | ||
| 13 | { | 13 | { |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | -Pl_String::~Pl_String() | 16 | +Pl_String::~Pl_String() // NOLINT (modernize-use-equals-default) |
| 17 | { | 17 | { |
| 18 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 18 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 19 | } | 19 | } |
libqpdf/QPDF.cc
| @@ -840,7 +840,7 @@ QPDF::read_xrefTable(qpdf_offset_t xref_offset) | @@ -840,7 +840,7 @@ QPDF::read_xrefTable(qpdf_offset_t xref_offset) | ||
| 840 | } | 840 | } |
| 841 | if (type == 'f') { | 841 | if (type == 'f') { |
| 842 | // Save deleted items until after we've checked the XRefStm, if any. | 842 | // Save deleted items until after we've checked the XRefStm, if any. |
| 843 | - deleted_items.push_back(QPDFObjGen(toI(i), f2)); | 843 | + deleted_items.emplace_back(toI(i), f2); |
| 844 | } else { | 844 | } else { |
| 845 | insertXrefEntry(toI(i), 1, f1, f2); | 845 | insertXrefEntry(toI(i), 1, f1, f2); |
| 846 | } | 846 | } |
| @@ -2207,7 +2207,7 @@ QPDF::getVersionAsPDFVersion() | @@ -2207,7 +2207,7 @@ QPDF::getVersionAsPDFVersion() | ||
| 2207 | minor = QUtil::string_to_int(match[2].str().c_str()); | 2207 | minor = QUtil::string_to_int(match[2].str().c_str()); |
| 2208 | } | 2208 | } |
| 2209 | 2209 | ||
| 2210 | - return PDFVersion(major, minor, extension_level); | 2210 | + return {major, minor, extension_level}; |
| 2211 | } | 2211 | } |
| 2212 | 2212 | ||
| 2213 | std::string | 2213 | std::string |
| @@ -2478,7 +2478,7 @@ QPDF::damagedPDF( | @@ -2478,7 +2478,7 @@ QPDF::damagedPDF( | ||
| 2478 | qpdf_offset_t offset, | 2478 | qpdf_offset_t offset, |
| 2479 | std::string const& message) | 2479 | std::string const& message) |
| 2480 | { | 2480 | { |
| 2481 | - return QPDFExc(qpdf_e_damaged_pdf, input->getName(), object, offset, message); | 2481 | + return {qpdf_e_damaged_pdf, input->getName(), object, offset, message}; |
| 2482 | } | 2482 | } |
| 2483 | 2483 | ||
| 2484 | // Return an exception of type qpdf_e_damaged_pdf. The object is taken from | 2484 | // Return an exception of type qpdf_e_damaged_pdf. The object is taken from |
| @@ -2494,7 +2494,7 @@ QPDF::damagedPDF( | @@ -2494,7 +2494,7 @@ QPDF::damagedPDF( | ||
| 2494 | QPDFExc | 2494 | QPDFExc |
| 2495 | QPDF::damagedPDF(std::string const& object, qpdf_offset_t offset, std::string const& message) | 2495 | QPDF::damagedPDF(std::string const& object, qpdf_offset_t offset, std::string const& message) |
| 2496 | { | 2496 | { |
| 2497 | - return QPDFExc(qpdf_e_damaged_pdf, m->file->getName(), object, offset, message); | 2497 | + return {qpdf_e_damaged_pdf, m->file->getName(), object, offset, message}; |
| 2498 | } | 2498 | } |
| 2499 | 2499 | ||
| 2500 | // Return an exception of type qpdf_e_damaged_pdf. The filename is taken from m->file and the | 2500 | // Return an exception of type qpdf_e_damaged_pdf. The filename is taken from m->file and the |
libqpdf/QPDFAcroFormDocumentHelper.cc
| @@ -70,7 +70,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(std::vector<QPDFObjectHandle> | @@ -70,7 +70,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(std::vector<QPDFObjectHandle> | ||
| 70 | if (seen.add(obj)) { | 70 | if (seen.add(obj)) { |
| 71 | auto kids = obj.getKey("/Kids"); | 71 | auto kids = obj.getKey("/Kids"); |
| 72 | if (kids.isArray()) { | 72 | if (kids.isArray()) { |
| 73 | - for (auto kid: kids.aitems()) { | 73 | + for (auto const& kid: kids.aitems()) { |
| 74 | queue.push_back(kid); | 74 | queue.push_back(kid); |
| 75 | } | 75 | } |
| 76 | } | 76 | } |
| @@ -104,7 +104,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(std::vector<QPDFObjectHandle> | @@ -104,7 +104,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(std::vector<QPDFObjectHandle> | ||
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | - for (auto i: fields) { | 107 | + for (auto const& i: fields) { |
| 108 | addFormField(i); | 108 | addFormField(i); |
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| @@ -165,7 +165,7 @@ QPDFAcroFormDocumentHelper::getFormFields() | @@ -165,7 +165,7 @@ QPDFAcroFormDocumentHelper::getFormFields() | ||
| 165 | analyze(); | 165 | analyze(); |
| 166 | std::vector<QPDFFormFieldObjectHelper> result; | 166 | std::vector<QPDFFormFieldObjectHelper> result; |
| 167 | for (auto const& iter: m->field_to_annotations) { | 167 | for (auto const& iter: m->field_to_annotations) { |
| 168 | - result.push_back(this->qpdf.getObject(iter.first)); | 168 | + result.emplace_back(this->qpdf.getObject(iter.first)); |
| 169 | } | 169 | } |
| 170 | return result; | 170 | return result; |
| 171 | } | 171 | } |
| @@ -279,7 +279,7 @@ QPDFAcroFormDocumentHelper::analyze() | @@ -279,7 +279,7 @@ QPDFAcroFormDocumentHelper::analyze() | ||
| 279 | annot.warnIfPossible("this widget annotation is not" | 279 | annot.warnIfPossible("this widget annotation is not" |
| 280 | " reachable from /AcroForm in the document catalog"); | 280 | " reachable from /AcroForm in the document catalog"); |
| 281 | m->annotation_to_field[og] = QPDFFormFieldObjectHelper(annot); | 281 | m->annotation_to_field[og] = QPDFFormFieldObjectHelper(annot); |
| 282 | - m->field_to_annotations[og].push_back(QPDFAnnotationObjectHelper(annot)); | 282 | + m->field_to_annotations[og].emplace_back(annot); |
| 283 | } | 283 | } |
| 284 | } | 284 | } |
| 285 | } | 285 | } |
| @@ -342,7 +342,7 @@ QPDFAcroFormDocumentHelper::traverseField( | @@ -342,7 +342,7 @@ QPDFAcroFormDocumentHelper::traverseField( | ||
| 342 | 342 | ||
| 343 | if (is_annotation) { | 343 | if (is_annotation) { |
| 344 | QPDFObjectHandle our_field = (is_field ? field : parent); | 344 | QPDFObjectHandle our_field = (is_field ? field : parent); |
| 345 | - m->field_to_annotations[our_field.getObjGen()].push_back(QPDFAnnotationObjectHelper(field)); | 345 | + m->field_to_annotations[our_field.getObjGen()].emplace_back(field); |
| 346 | m->annotation_to_field[og] = QPDFFormFieldObjectHelper(our_field); | 346 | m->annotation_to_field[og] = QPDFFormFieldObjectHelper(our_field); |
| 347 | } | 347 | } |
| 348 | 348 | ||
| @@ -469,19 +469,18 @@ namespace | @@ -469,19 +469,18 @@ namespace | ||
| 469 | ResourceReplacer( | 469 | ResourceReplacer( |
| 470 | std::map<std::string, std::map<std::string, std::string>> const& dr_map, | 470 | std::map<std::string, std::map<std::string, std::string>> const& dr_map, |
| 471 | std::map<std::string, std::map<std::string, std::set<size_t>>> const& rnames); | 471 | std::map<std::string, std::map<std::string, std::set<size_t>>> const& rnames); |
| 472 | - virtual ~ResourceReplacer() = default; | ||
| 473 | - virtual void handleToken(QPDFTokenizer::Token const&) override; | 472 | + ~ResourceReplacer() override = default; |
| 473 | + void handleToken(QPDFTokenizer::Token const&) override; | ||
| 474 | 474 | ||
| 475 | private: | 475 | private: |
| 476 | - size_t offset; | 476 | + size_t offset{0}; |
| 477 | std::map<std::string, std::map<size_t, std::string>> to_replace; | 477 | std::map<std::string, std::map<size_t, std::string>> to_replace; |
| 478 | }; | 478 | }; |
| 479 | } // namespace | 479 | } // namespace |
| 480 | 480 | ||
| 481 | ResourceReplacer::ResourceReplacer( | 481 | ResourceReplacer::ResourceReplacer( |
| 482 | std::map<std::string, std::map<std::string, std::string>> const& dr_map, | 482 | std::map<std::string, std::map<std::string, std::string>> const& dr_map, |
| 483 | - std::map<std::string, std::map<std::string, std::set<size_t>>> const& rnames) : | ||
| 484 | - offset(0) | 483 | + std::map<std::string, std::map<std::string, std::set<size_t>>> const& rnames) |
| 485 | { | 484 | { |
| 486 | // We have: | 485 | // We have: |
| 487 | // * dr_map[resource_type][key] == new_key | 486 | // * dr_map[resource_type][key] == new_key |
| @@ -1019,7 +1018,7 @@ QPDFAcroFormDocumentHelper::fixCopiedAnnotations( | @@ -1019,7 +1018,7 @@ QPDFAcroFormDocumentHelper::fixCopiedAnnotations( | ||
| 1019 | to_page.replaceKey("/Annots", QPDFObjectHandle::newArray(new_annots)); | 1018 | to_page.replaceKey("/Annots", QPDFObjectHandle::newArray(new_annots)); |
| 1020 | addAndRenameFormFields(new_fields); | 1019 | addAndRenameFormFields(new_fields); |
| 1021 | if (added_fields) { | 1020 | if (added_fields) { |
| 1022 | - for (auto f: new_fields) { | 1021 | + for (auto const& f: new_fields) { |
| 1023 | added_fields->insert(f.getObjGen()); | 1022 | added_fields->insert(f.getObjGen()); |
| 1024 | } | 1023 | } |
| 1025 | } | 1024 | } |
libqpdf/QPDFCrypto_openssl.cc
| @@ -194,7 +194,7 @@ QPDFCrypto_openssl::MD5_digest(MD5_Digest d) | @@ -194,7 +194,7 @@ QPDFCrypto_openssl::MD5_digest(MD5_Digest d) | ||
| 194 | std::string | 194 | std::string |
| 195 | QPDFCrypto_openssl::SHA2_digest() | 195 | QPDFCrypto_openssl::SHA2_digest() |
| 196 | { | 196 | { |
| 197 | - return std::string(reinterpret_cast<char*>(md_out), sha2_bits / 8); | 197 | + return {reinterpret_cast<char*>(md_out), sha2_bits / 8}; |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | void | 200 | void |
libqpdf/QPDFDocumentHelper.cc
| 1 | #include <qpdf/QPDFDocumentHelper.hh> | 1 | #include <qpdf/QPDFDocumentHelper.hh> |
| 2 | 2 | ||
| 3 | -QPDFDocumentHelper::~QPDFDocumentHelper() | 3 | +QPDFDocumentHelper::~QPDFDocumentHelper() // NOLINT (modernize-use-equals-default) |
| 4 | { | 4 | { |
| 5 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 5 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 6 | } | 6 | } |
libqpdf/QPDFFormFieldObjectHelper.cc
| @@ -481,8 +481,8 @@ namespace | @@ -481,8 +481,8 @@ namespace | ||
| 481 | std::vector<std::string> opt; | 481 | std::vector<std::string> opt; |
| 482 | double tf; | 482 | double tf; |
| 483 | QPDFObjectHandle::Rectangle bbox; | 483 | QPDFObjectHandle::Rectangle bbox; |
| 484 | - enum { st_top, st_bmc, st_emc, st_end } state; | ||
| 485 | - bool replaced; | 484 | + enum { st_top, st_bmc, st_emc, st_end } state{st_top}; |
| 485 | + bool replaced{false}; | ||
| 486 | }; | 486 | }; |
| 487 | } // namespace | 487 | } // namespace |
| 488 | 488 | ||
| @@ -496,9 +496,7 @@ ValueSetter::ValueSetter( | @@ -496,9 +496,7 @@ ValueSetter::ValueSetter( | ||
| 496 | V(V), | 496 | V(V), |
| 497 | opt(opt), | 497 | opt(opt), |
| 498 | tf(tf), | 498 | tf(tf), |
| 499 | - bbox(bbox), | ||
| 500 | - state(st_top), | ||
| 501 | - replaced(false) | 499 | + bbox(bbox) |
| 502 | { | 500 | { |
| 503 | } | 501 | } |
| 504 | 502 | ||
| @@ -649,34 +647,24 @@ namespace | @@ -649,34 +647,24 @@ namespace | ||
| 649 | class TfFinder: public QPDFObjectHandle::TokenFilter | 647 | class TfFinder: public QPDFObjectHandle::TokenFilter |
| 650 | { | 648 | { |
| 651 | public: | 649 | public: |
| 652 | - TfFinder(); | ||
| 653 | - ~TfFinder() override | ||
| 654 | - { | ||
| 655 | - } | 650 | + TfFinder() = default; |
| 651 | + ~TfFinder() override = default; | ||
| 656 | void handleToken(QPDFTokenizer::Token const&) override; | 652 | void handleToken(QPDFTokenizer::Token const&) override; |
| 657 | double getTf(); | 653 | double getTf(); |
| 658 | std::string getFontName(); | 654 | std::string getFontName(); |
| 659 | std::string getDA(); | 655 | std::string getDA(); |
| 660 | 656 | ||
| 661 | private: | 657 | private: |
| 662 | - double tf; | ||
| 663 | - int tf_idx; | 658 | + double tf{11.0}; |
| 659 | + int tf_idx{-1}; | ||
| 664 | std::string font_name; | 660 | std::string font_name; |
| 665 | - double last_num; | ||
| 666 | - int last_num_idx; | 661 | + double last_num{0.0}; |
| 662 | + int last_num_idx{-1}; | ||
| 667 | std::string last_name; | 663 | std::string last_name; |
| 668 | std::vector<std::string> DA; | 664 | std::vector<std::string> DA; |
| 669 | }; | 665 | }; |
| 670 | } // namespace | 666 | } // namespace |
| 671 | 667 | ||
| 672 | -TfFinder::TfFinder() : | ||
| 673 | - tf(11.0), | ||
| 674 | - tf_idx(-1), | ||
| 675 | - last_num(0.0), | ||
| 676 | - last_num_idx(-1) | ||
| 677 | -{ | ||
| 678 | -} | ||
| 679 | - | ||
| 680 | void | 668 | void |
| 681 | TfFinder::handleToken(QPDFTokenizer::Token const& token) | 669 | TfFinder::handleToken(QPDFTokenizer::Token const& token) |
| 682 | { | 670 | { |
libqpdf/QPDFJob.cc
| @@ -428,7 +428,7 @@ QPDFJob::parseNumrange(char const* range, int max) | @@ -428,7 +428,7 @@ QPDFJob::parseNumrange(char const* range, int max) | ||
| 428 | } catch (std::runtime_error& e) { | 428 | } catch (std::runtime_error& e) { |
| 429 | usage(e.what()); | 429 | usage(e.what()); |
| 430 | } | 430 | } |
| 431 | - return std::vector<int>(); | 431 | + return {}; |
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | std::unique_ptr<QPDF> | 434 | std::unique_ptr<QPDF> |
| @@ -894,7 +894,7 @@ QPDFJob::doListAttachments(QPDF& pdf) | @@ -894,7 +894,7 @@ QPDFJob::doListAttachments(QPDF& pdf) | ||
| 894 | v << " " << i2.first << " -> " << i2.second << "\n"; | 894 | v << " " << i2.first << " -> " << i2.second << "\n"; |
| 895 | } | 895 | } |
| 896 | v << " all data streams:\n"; | 896 | v << " all data streams:\n"; |
| 897 | - for (auto i2: efoh->getEmbeddedFileStreams().ditems()) { | 897 | + for (auto const& i2: efoh->getEmbeddedFileStreams().ditems()) { |
| 898 | auto efs = QPDFEFStreamObjectHelper(i2.second); | 898 | auto efs = QPDFEFStreamObjectHelper(i2.second); |
| 899 | v << " " << i2.first << " -> " | 899 | v << " " << i2.first << " -> " |
| 900 | << efs.getObjectHandle().getObjGen().unparse(',') << "\n"; | 900 | << efs.getObjectHandle().getObjGen().unparse(',') << "\n"; |
| @@ -1329,7 +1329,7 @@ QPDFJob::doJSONAttachments(Pipeline* p, bool& first, QPDF& pdf) | @@ -1329,7 +1329,7 @@ QPDFJob::doJSONAttachments(Pipeline* p, bool& first, QPDF& pdf) | ||
| 1329 | j_names.addDictionaryMember(i2.first, JSON::makeString(i2.second)); | 1329 | j_names.addDictionaryMember(i2.first, JSON::makeString(i2.second)); |
| 1330 | } | 1330 | } |
| 1331 | auto j_streams = j_details.addDictionaryMember("streams", JSON::makeDictionary()); | 1331 | auto j_streams = j_details.addDictionaryMember("streams", JSON::makeDictionary()); |
| 1332 | - for (auto i2: fsoh->getEmbeddedFileStreams().ditems()) { | 1332 | + for (auto const& i2: fsoh->getEmbeddedFileStreams().ditems()) { |
| 1333 | auto efs = QPDFEFStreamObjectHelper(i2.second); | 1333 | auto efs = QPDFEFStreamObjectHelper(i2.second); |
| 1334 | auto j_stream = j_streams.addDictionaryMember(i2.first, JSON::makeDictionary()); | 1334 | auto j_stream = j_streams.addDictionaryMember(i2.first, JSON::makeDictionary()); |
| 1335 | j_stream.addDictionaryMember( | 1335 | j_stream.addDictionaryMember( |
| @@ -2376,9 +2376,8 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector<std::unique_ptr<QPDF>>& page_hea | @@ -2376,9 +2376,8 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector<std::unique_ptr<QPDF>>& page_hea | ||
| 2376 | 2376 | ||
| 2377 | // Read original pages from the PDF, and parse the page range associated with this | 2377 | // Read original pages from the PDF, and parse the page range associated with this |
| 2378 | // occurrence of the file. | 2378 | // occurrence of the file. |
| 2379 | - parsed_specs.push_back( | ||
| 2380 | - // line-break | ||
| 2381 | - QPDFPageData(page_spec.filename, page_spec_qpdfs[page_spec.filename], page_spec.range)); | 2379 | + parsed_specs.emplace_back( |
| 2380 | + page_spec.filename, page_spec_qpdfs[page_spec.filename], page_spec.range); | ||
| 2382 | } | 2381 | } |
| 2383 | 2382 | ||
| 2384 | std::map<unsigned long long, bool> remove_unreferenced; | 2383 | std::map<unsigned long long, bool> remove_unreferenced; |
| @@ -2427,9 +2426,8 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector<std::unique_ptr<QPDF>>& page_hea | @@ -2427,9 +2426,8 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector<std::unique_ptr<QPDF>>& page_hea | ||
| 2427 | for (size_t j = 0; j < m->collate; ++j) { | 2426 | for (size_t j = 0; j < m->collate; ++j) { |
| 2428 | if (cur_page + j < page_data.selected_pages.size()) { | 2427 | if (cur_page + j < page_data.selected_pages.size()) { |
| 2429 | got_pages = true; | 2428 | got_pages = true; |
| 2430 | - new_parsed_specs.push_back( | ||
| 2431 | - // line-break | ||
| 2432 | - QPDFPageData(page_data, page_data.selected_pages.at(cur_page + j))); | 2429 | + new_parsed_specs.emplace_back( |
| 2430 | + page_data, page_data.selected_pages.at(cur_page + j)); | ||
| 2433 | } | 2431 | } |
| 2434 | } | 2432 | } |
| 2435 | } | 2433 | } |
libqpdf/QPDFJob_argv.cc
| @@ -40,18 +40,15 @@ namespace | @@ -40,18 +40,15 @@ namespace | ||
| 40 | std::shared_ptr<QPDFJob::UOConfig> c_uo; | 40 | std::shared_ptr<QPDFJob::UOConfig> c_uo; |
| 41 | std::shared_ptr<QPDFJob::EncConfig> c_enc; | 41 | std::shared_ptr<QPDFJob::EncConfig> c_enc; |
| 42 | std::vector<std::string> accumulated_args; | 42 | std::vector<std::string> accumulated_args; |
| 43 | - std::shared_ptr<char> pages_password; | ||
| 44 | - bool gave_input; | ||
| 45 | - bool gave_output; | 43 | + std::shared_ptr<char> pages_password{nullptr}; |
| 44 | + bool gave_input{false}; | ||
| 45 | + bool gave_output{false}; | ||
| 46 | }; | 46 | }; |
| 47 | } // namespace | 47 | } // namespace |
| 48 | 48 | ||
| 49 | ArgParser::ArgParser(QPDFArgParser& ap, std::shared_ptr<QPDFJob::Config> c_main) : | 49 | ArgParser::ArgParser(QPDFArgParser& ap, std::shared_ptr<QPDFJob::Config> c_main) : |
| 50 | ap(ap), | 50 | ap(ap), |
| 51 | - c_main(c_main), | ||
| 52 | - pages_password(nullptr), | ||
| 53 | - gave_input(false), | ||
| 54 | - gave_output(false) | 51 | + c_main(c_main) |
| 55 | { | 52 | { |
| 56 | initOptionTables(); | 53 | initOptionTables(); |
| 57 | } | 54 | } |
libqpdf/QPDFJob_config.cc
| @@ -942,7 +942,7 @@ QPDFJob::PagesConfig* | @@ -942,7 +942,7 @@ QPDFJob::PagesConfig* | ||
| 942 | QPDFJob::PagesConfig::pageSpec( | 942 | QPDFJob::PagesConfig::pageSpec( |
| 943 | std::string const& filename, std::string const& range, char const* password) | 943 | std::string const& filename, std::string const& range, char const* password) |
| 944 | { | 944 | { |
| 945 | - this->config->o.m->page_specs.push_back(QPDFJob::PageSpec(filename, password, range)); | 945 | + this->config->o.m->page_specs.emplace_back(filename, password, range); |
| 946 | return this; | 946 | return this; |
| 947 | } | 947 | } |
| 948 | 948 |
libqpdf/QPDFJob_json.cc
| @@ -59,7 +59,7 @@ namespace | @@ -59,7 +59,7 @@ namespace | ||
| 59 | 59 | ||
| 60 | std::list<std::shared_ptr<JSONHandler>> json_handlers; | 60 | std::list<std::shared_ptr<JSONHandler>> json_handlers; |
| 61 | bool partial; | 61 | bool partial; |
| 62 | - JSONHandler* jh; // points to last of json_handlers | 62 | + JSONHandler* jh{nullptr}; // points to last of json_handlers |
| 63 | std::shared_ptr<QPDFJob::Config> c_main; | 63 | std::shared_ptr<QPDFJob::Config> c_main; |
| 64 | std::shared_ptr<QPDFJob::CopyAttConfig> c_copy_att; | 64 | std::shared_ptr<QPDFJob::CopyAttConfig> c_copy_att; |
| 65 | std::shared_ptr<QPDFJob::AttConfig> c_att; | 65 | std::shared_ptr<QPDFJob::AttConfig> c_att; |
| @@ -71,7 +71,6 @@ namespace | @@ -71,7 +71,6 @@ namespace | ||
| 71 | 71 | ||
| 72 | Handlers::Handlers(bool partial, std::shared_ptr<QPDFJob::Config> c_main) : | 72 | Handlers::Handlers(bool partial, std::shared_ptr<QPDFJob::Config> c_main) : |
| 73 | partial(partial), | 73 | partial(partial), |
| 74 | - jh(nullptr), | ||
| 75 | c_main(c_main) | 74 | c_main(c_main) |
| 76 | { | 75 | { |
| 77 | initHandlers(); | 76 | initHandlers(); |
libqpdf/QPDFLogger.cc
| @@ -12,8 +12,7 @@ namespace | @@ -12,8 +12,7 @@ namespace | ||
| 12 | { | 12 | { |
| 13 | public: | 13 | public: |
| 14 | Pl_Track(char const* identifier, Pipeline* next) : | 14 | Pl_Track(char const* identifier, Pipeline* next) : |
| 15 | - Pipeline(identifier, next), | ||
| 16 | - used(false) | 15 | + Pipeline(identifier, next) |
| 17 | { | 16 | { |
| 18 | } | 17 | } |
| 19 | 18 | ||
| @@ -37,7 +36,7 @@ namespace | @@ -37,7 +36,7 @@ namespace | ||
| 37 | } | 36 | } |
| 38 | 37 | ||
| 39 | private: | 38 | private: |
| 40 | - bool used; | 39 | + bool used{false}; |
| 41 | }; | 40 | }; |
| 42 | }; // namespace | 41 | }; // namespace |
| 43 | 42 |
libqpdf/QPDFMatrix.cc
| @@ -57,7 +57,7 @@ QPDFMatrix::unparse() const | @@ -57,7 +57,7 @@ QPDFMatrix::unparse() const | ||
| 57 | QPDFObjectHandle::Matrix | 57 | QPDFObjectHandle::Matrix |
| 58 | QPDFMatrix::getAsMatrix() const | 58 | QPDFMatrix::getAsMatrix() const |
| 59 | { | 59 | { |
| 60 | - return QPDFObjectHandle::Matrix(a, b, c, d, e, f); | 60 | + return {a, b, c, d, e, f}; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | void | 63 | void |
| @@ -124,11 +124,11 @@ QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) const | @@ -124,11 +124,11 @@ QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) const | ||
| 124 | transform(r.llx, r.ury, tx.at(1), ty.at(1)); | 124 | transform(r.llx, r.ury, tx.at(1), ty.at(1)); |
| 125 | transform(r.urx, r.lly, tx.at(2), ty.at(2)); | 125 | transform(r.urx, r.lly, tx.at(2), ty.at(2)); |
| 126 | transform(r.urx, r.ury, tx.at(3), ty.at(3)); | 126 | transform(r.urx, r.ury, tx.at(3), ty.at(3)); |
| 127 | - return QPDFObjectHandle::Rectangle( | 127 | + return { |
| 128 | *std::min_element(tx.begin(), tx.end()), | 128 | *std::min_element(tx.begin(), tx.end()), |
| 129 | *std::min_element(ty.begin(), ty.end()), | 129 | *std::min_element(ty.begin(), ty.end()), |
| 130 | *std::max_element(tx.begin(), tx.end()), | 130 | *std::max_element(tx.begin(), tx.end()), |
| 131 | - *std::max_element(ty.begin(), ty.end())); | 131 | + *std::max_element(ty.begin(), ty.end())}; |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | bool | 134 | bool |
libqpdf/QPDFNameTreeObjectHelper.cc
| @@ -34,7 +34,7 @@ namespace | @@ -34,7 +34,7 @@ namespace | ||
| 34 | 34 | ||
| 35 | static NameTreeDetails name_tree_details; | 35 | static NameTreeDetails name_tree_details; |
| 36 | 36 | ||
| 37 | -QPDFNameTreeObjectHelper::~QPDFNameTreeObjectHelper() | 37 | +QPDFNameTreeObjectHelper::~QPDFNameTreeObjectHelper() // NOLINT (modernize-use-equals-default) |
| 38 | { | 38 | { |
| 39 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer. For this specific | 39 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer. For this specific |
| 40 | // class, see github issue #745. | 40 | // class, see github issue #745. |
| @@ -54,8 +54,7 @@ QPDFNameTreeObjectHelper::QPDFNameTreeObjectHelper(QPDFObjectHandle oh, QPDF& q, | @@ -54,8 +54,7 @@ QPDFNameTreeObjectHelper::QPDFNameTreeObjectHelper(QPDFObjectHandle oh, QPDF& q, | ||
| 54 | QPDFNameTreeObjectHelper | 54 | QPDFNameTreeObjectHelper |
| 55 | QPDFNameTreeObjectHelper::newEmpty(QPDF& qpdf, bool auto_repair) | 55 | QPDFNameTreeObjectHelper::newEmpty(QPDF& qpdf, bool auto_repair) |
| 56 | { | 56 | { |
| 57 | - return QPDFNameTreeObjectHelper( | ||
| 58 | - qpdf.makeIndirectObject("<< /Names [] >>"_qpdf), qpdf, auto_repair); | 57 | + return {qpdf.makeIndirectObject("<< /Names [] >>"_qpdf), qpdf, auto_repair}; |
| 59 | } | 58 | } |
| 60 | 59 | ||
| 61 | QPDFNameTreeObjectHelper::iterator::iterator(std::shared_ptr<NNTreeIterator> const& i) : | 60 | QPDFNameTreeObjectHelper::iterator::iterator(std::shared_ptr<NNTreeIterator> const& i) : |
| @@ -135,33 +134,33 @@ QPDFNameTreeObjectHelper::iterator::remove() | @@ -135,33 +134,33 @@ QPDFNameTreeObjectHelper::iterator::remove() | ||
| 135 | QPDFNameTreeObjectHelper::iterator | 134 | QPDFNameTreeObjectHelper::iterator |
| 136 | QPDFNameTreeObjectHelper::begin() const | 135 | QPDFNameTreeObjectHelper::begin() const |
| 137 | { | 136 | { |
| 138 | - return iterator(std::make_shared<NNTreeIterator>(m->impl->begin())); | 137 | + return {std::make_shared<NNTreeIterator>(m->impl->begin())}; |
| 139 | } | 138 | } |
| 140 | 139 | ||
| 141 | QPDFNameTreeObjectHelper::iterator | 140 | QPDFNameTreeObjectHelper::iterator |
| 142 | QPDFNameTreeObjectHelper::end() const | 141 | QPDFNameTreeObjectHelper::end() const |
| 143 | { | 142 | { |
| 144 | - return iterator(std::make_shared<NNTreeIterator>(m->impl->end())); | 143 | + return {std::make_shared<NNTreeIterator>(m->impl->end())}; |
| 145 | } | 144 | } |
| 146 | 145 | ||
| 147 | QPDFNameTreeObjectHelper::iterator | 146 | QPDFNameTreeObjectHelper::iterator |
| 148 | QPDFNameTreeObjectHelper::last() const | 147 | QPDFNameTreeObjectHelper::last() const |
| 149 | { | 148 | { |
| 150 | - return iterator(std::make_shared<NNTreeIterator>(m->impl->last())); | 149 | + return {std::make_shared<NNTreeIterator>(m->impl->last())}; |
| 151 | } | 150 | } |
| 152 | 151 | ||
| 153 | QPDFNameTreeObjectHelper::iterator | 152 | QPDFNameTreeObjectHelper::iterator |
| 154 | QPDFNameTreeObjectHelper::find(std::string const& key, bool return_prev_if_not_found) | 153 | QPDFNameTreeObjectHelper::find(std::string const& key, bool return_prev_if_not_found) |
| 155 | { | 154 | { |
| 156 | auto i = m->impl->find(QPDFObjectHandle::newUnicodeString(key), return_prev_if_not_found); | 155 | auto i = m->impl->find(QPDFObjectHandle::newUnicodeString(key), return_prev_if_not_found); |
| 157 | - return iterator(std::make_shared<NNTreeIterator>(i)); | 156 | + return {std::make_shared<NNTreeIterator>(i)}; |
| 158 | } | 157 | } |
| 159 | 158 | ||
| 160 | QPDFNameTreeObjectHelper::iterator | 159 | QPDFNameTreeObjectHelper::iterator |
| 161 | QPDFNameTreeObjectHelper::insert(std::string const& key, QPDFObjectHandle value) | 160 | QPDFNameTreeObjectHelper::insert(std::string const& key, QPDFObjectHandle value) |
| 162 | { | 161 | { |
| 163 | auto i = m->impl->insert(QPDFObjectHandle::newUnicodeString(key), value); | 162 | auto i = m->impl->insert(QPDFObjectHandle::newUnicodeString(key), value); |
| 164 | - return iterator(std::make_shared<NNTreeIterator>(i)); | 163 | + return {std::make_shared<NNTreeIterator>(i)}; |
| 165 | } | 164 | } |
| 166 | 165 | ||
| 167 | bool | 166 | bool |
libqpdf/QPDFNumberTreeObjectHelper.cc
| @@ -35,7 +35,7 @@ namespace | @@ -35,7 +35,7 @@ namespace | ||
| 35 | 35 | ||
| 36 | static NumberTreeDetails number_tree_details; | 36 | static NumberTreeDetails number_tree_details; |
| 37 | 37 | ||
| 38 | -QPDFNumberTreeObjectHelper::~QPDFNumberTreeObjectHelper() | 38 | +QPDFNumberTreeObjectHelper::~QPDFNumberTreeObjectHelper() // NOLINT (modernize-use-equals-default) |
| 39 | { | 39 | { |
| 40 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer. For this specific | 40 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer. For this specific |
| 41 | // class, see github issue #745. | 41 | // class, see github issue #745. |
| @@ -56,8 +56,7 @@ QPDFNumberTreeObjectHelper::QPDFNumberTreeObjectHelper( | @@ -56,8 +56,7 @@ QPDFNumberTreeObjectHelper::QPDFNumberTreeObjectHelper( | ||
| 56 | QPDFNumberTreeObjectHelper | 56 | QPDFNumberTreeObjectHelper |
| 57 | QPDFNumberTreeObjectHelper::newEmpty(QPDF& qpdf, bool auto_repair) | 57 | QPDFNumberTreeObjectHelper::newEmpty(QPDF& qpdf, bool auto_repair) |
| 58 | { | 58 | { |
| 59 | - return QPDFNumberTreeObjectHelper( | ||
| 60 | - qpdf.makeIndirectObject("<< /Nums [] >>"_qpdf), qpdf, auto_repair); | 59 | + return {qpdf.makeIndirectObject("<< /Nums [] >>"_qpdf), qpdf, auto_repair}; |
| 61 | } | 60 | } |
| 62 | 61 | ||
| 63 | QPDFNumberTreeObjectHelper::iterator::iterator(std::shared_ptr<NNTreeIterator> const& i) : | 62 | QPDFNumberTreeObjectHelper::iterator::iterator(std::shared_ptr<NNTreeIterator> const& i) : |
| @@ -137,33 +136,33 @@ QPDFNumberTreeObjectHelper::iterator::remove() | @@ -137,33 +136,33 @@ QPDFNumberTreeObjectHelper::iterator::remove() | ||
| 137 | QPDFNumberTreeObjectHelper::iterator | 136 | QPDFNumberTreeObjectHelper::iterator |
| 138 | QPDFNumberTreeObjectHelper::begin() const | 137 | QPDFNumberTreeObjectHelper::begin() const |
| 139 | { | 138 | { |
| 140 | - return iterator(std::make_shared<NNTreeIterator>(m->impl->begin())); | 139 | + return {std::make_shared<NNTreeIterator>(m->impl->begin())}; |
| 141 | } | 140 | } |
| 142 | 141 | ||
| 143 | QPDFNumberTreeObjectHelper::iterator | 142 | QPDFNumberTreeObjectHelper::iterator |
| 144 | QPDFNumberTreeObjectHelper::end() const | 143 | QPDFNumberTreeObjectHelper::end() const |
| 145 | { | 144 | { |
| 146 | - return iterator(std::make_shared<NNTreeIterator>(m->impl->end())); | 145 | + return {std::make_shared<NNTreeIterator>(m->impl->end())}; |
| 147 | } | 146 | } |
| 148 | 147 | ||
| 149 | QPDFNumberTreeObjectHelper::iterator | 148 | QPDFNumberTreeObjectHelper::iterator |
| 150 | QPDFNumberTreeObjectHelper::last() const | 149 | QPDFNumberTreeObjectHelper::last() const |
| 151 | { | 150 | { |
| 152 | - return iterator(std::make_shared<NNTreeIterator>(m->impl->last())); | 151 | + return {std::make_shared<NNTreeIterator>(m->impl->last())}; |
| 153 | } | 152 | } |
| 154 | 153 | ||
| 155 | QPDFNumberTreeObjectHelper::iterator | 154 | QPDFNumberTreeObjectHelper::iterator |
| 156 | QPDFNumberTreeObjectHelper::find(numtree_number key, bool return_prev_if_not_found) | 155 | QPDFNumberTreeObjectHelper::find(numtree_number key, bool return_prev_if_not_found) |
| 157 | { | 156 | { |
| 158 | auto i = m->impl->find(QPDFObjectHandle::newInteger(key), return_prev_if_not_found); | 157 | auto i = m->impl->find(QPDFObjectHandle::newInteger(key), return_prev_if_not_found); |
| 159 | - return iterator(std::make_shared<NNTreeIterator>(i)); | 158 | + return {std::make_shared<NNTreeIterator>(i)}; |
| 160 | } | 159 | } |
| 161 | 160 | ||
| 162 | QPDFNumberTreeObjectHelper::iterator | 161 | QPDFNumberTreeObjectHelper::iterator |
| 163 | QPDFNumberTreeObjectHelper::insert(numtree_number key, QPDFObjectHandle value) | 162 | QPDFNumberTreeObjectHelper::insert(numtree_number key, QPDFObjectHandle value) |
| 164 | { | 163 | { |
| 165 | auto i = m->impl->insert(QPDFObjectHandle::newInteger(key), value); | 164 | auto i = m->impl->insert(QPDFObjectHandle::newInteger(key), value); |
| 166 | - return iterator(std::make_shared<NNTreeIterator>(i)); | 165 | + return {std::make_shared<NNTreeIterator>(i)}; |
| 167 | } | 166 | } |
| 168 | 167 | ||
| 169 | bool | 168 | bool |
libqpdf/QPDFObjectHandle.cc
| @@ -49,7 +49,7 @@ QPDFObjectHandle::StreamDataProvider::StreamDataProvider(bool supports_retry) : | @@ -49,7 +49,7 @@ QPDFObjectHandle::StreamDataProvider::StreamDataProvider(bool supports_retry) : | ||
| 49 | { | 49 | { |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | -QPDFObjectHandle::StreamDataProvider::~StreamDataProvider() | 52 | +QPDFObjectHandle::StreamDataProvider::~StreamDataProvider() // NOLINT (modernize-use-equals-default) |
| 53 | { | 53 | { |
| 54 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 54 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 55 | } | 55 | } |
| @@ -189,13 +189,12 @@ namespace | @@ -189,13 +189,12 @@ namespace | ||
| 189 | unsigned char getLastChar(); | 189 | unsigned char getLastChar(); |
| 190 | 190 | ||
| 191 | private: | 191 | private: |
| 192 | - unsigned char last_char; | 192 | + unsigned char last_char{0}; |
| 193 | }; | 193 | }; |
| 194 | } // namespace | 194 | } // namespace |
| 195 | 195 | ||
| 196 | LastChar::LastChar(Pipeline* next) : | 196 | LastChar::LastChar(Pipeline* next) : |
| 197 | - Pipeline("lastchar", next), | ||
| 198 | - last_char(0) | 197 | + Pipeline("lastchar", next) |
| 199 | { | 198 | { |
| 200 | } | 199 | } |
| 201 | 200 | ||
| @@ -752,7 +751,7 @@ QPDFObjectHandle::getValueAsInlineImage(std::string& value) | @@ -752,7 +751,7 @@ QPDFObjectHandle::getValueAsInlineImage(std::string& value) | ||
| 752 | QPDFObjectHandle::QPDFArrayItems | 751 | QPDFObjectHandle::QPDFArrayItems |
| 753 | QPDFObjectHandle::aitems() | 752 | QPDFObjectHandle::aitems() |
| 754 | { | 753 | { |
| 755 | - return QPDFArrayItems(*this); | 754 | + return *this; |
| 756 | } | 755 | } |
| 757 | 756 | ||
| 758 | int | 757 | int |
| @@ -826,11 +825,11 @@ QPDFObjectHandle::getArrayAsRectangle() | @@ -826,11 +825,11 @@ QPDFObjectHandle::getArrayAsRectangle() | ||
| 826 | return {}; | 825 | return {}; |
| 827 | } | 826 | } |
| 828 | } | 827 | } |
| 829 | - return Rectangle( | 828 | + return { |
| 830 | std::min(items[0], items[2]), | 829 | std::min(items[0], items[2]), |
| 831 | std::min(items[1], items[3]), | 830 | std::min(items[1], items[3]), |
| 832 | std::max(items[0], items[2]), | 831 | std::max(items[0], items[2]), |
| 833 | - std::max(items[1], items[3])); | 832 | + std::max(items[1], items[3])}; |
| 834 | } | 833 | } |
| 835 | return {}; | 834 | return {}; |
| 836 | } | 835 | } |
| @@ -848,7 +847,7 @@ QPDFObjectHandle::getArrayAsMatrix() | @@ -848,7 +847,7 @@ QPDFObjectHandle::getArrayAsMatrix() | ||
| 848 | return {}; | 847 | return {}; |
| 849 | } | 848 | } |
| 850 | } | 849 | } |
| 851 | - return Matrix(items[0], items[1], items[2], items[3], items[4], items[5]); | 850 | + return {items[0], items[1], items[2], items[3], items[4], items[5]}; |
| 852 | } | 851 | } |
| 853 | return {}; | 852 | return {}; |
| 854 | } | 853 | } |
| @@ -959,7 +958,7 @@ QPDFObjectHandle::eraseItemAndGetOld(int at) | @@ -959,7 +958,7 @@ QPDFObjectHandle::eraseItemAndGetOld(int at) | ||
| 959 | QPDFObjectHandle::QPDFDictItems | 958 | QPDFObjectHandle::QPDFDictItems |
| 960 | QPDFObjectHandle::ditems() | 959 | QPDFObjectHandle::ditems() |
| 961 | { | 960 | { |
| 962 | - return QPDFDictItems(*this); | 961 | + return {*this}; |
| 963 | } | 962 | } |
| 964 | 963 | ||
| 965 | bool | 964 | bool |
| @@ -1049,7 +1048,7 @@ QPDFObjectHandle::makeResourcesIndirect(QPDF& owning_qpdf) | @@ -1049,7 +1048,7 @@ QPDFObjectHandle::makeResourcesIndirect(QPDF& owning_qpdf) | ||
| 1049 | if (!sub.isDictionary()) { | 1048 | if (!sub.isDictionary()) { |
| 1050 | continue; | 1049 | continue; |
| 1051 | } | 1050 | } |
| 1052 | - for (auto i2: sub.ditems()) { | 1051 | + for (auto const& i2: sub.ditems()) { |
| 1053 | std::string const& key = i2.first; | 1052 | std::string const& key = i2.first; |
| 1054 | QPDFObjectHandle val = i2.second; | 1053 | QPDFObjectHandle val = i2.second; |
| 1055 | if (!val.isIndirect()) { | 1054 | if (!val.isIndirect()) { |
| @@ -1070,7 +1069,7 @@ QPDFObjectHandle::mergeResources( | @@ -1070,7 +1069,7 @@ QPDFObjectHandle::mergeResources( | ||
| 1070 | 1069 | ||
| 1071 | auto make_og_to_name = [](QPDFObjectHandle& dict, | 1070 | auto make_og_to_name = [](QPDFObjectHandle& dict, |
| 1072 | std::map<QPDFObjGen, std::string>& og_to_name) { | 1071 | std::map<QPDFObjGen, std::string>& og_to_name) { |
| 1073 | - for (auto i: dict.ditems()) { | 1072 | + for (auto const& i: dict.ditems()) { |
| 1074 | if (i.second.isIndirect()) { | 1073 | if (i.second.isIndirect()) { |
| 1075 | og_to_name[i.second.getObjGen()] = i.first; | 1074 | og_to_name[i.second.getObjGen()] = i.first; |
| 1076 | } | 1075 | } |
| @@ -1079,7 +1078,7 @@ QPDFObjectHandle::mergeResources( | @@ -1079,7 +1078,7 @@ QPDFObjectHandle::mergeResources( | ||
| 1079 | 1078 | ||
| 1080 | // This algorithm is described in comments in QPDFObjectHandle.hh | 1079 | // This algorithm is described in comments in QPDFObjectHandle.hh |
| 1081 | // above the declaration of mergeResources. | 1080 | // above the declaration of mergeResources. |
| 1082 | - for (auto o_top: other.ditems()) { | 1081 | + for (auto const& o_top: other.ditems()) { |
| 1083 | std::string const& rtype = o_top.first; | 1082 | std::string const& rtype = o_top.first; |
| 1084 | QPDFObjectHandle other_val = o_top.second; | 1083 | QPDFObjectHandle other_val = o_top.second; |
| 1085 | if (hasKey(rtype)) { | 1084 | if (hasKey(rtype)) { |
| @@ -1096,7 +1095,7 @@ QPDFObjectHandle::mergeResources( | @@ -1096,7 +1095,7 @@ QPDFObjectHandle::mergeResources( | ||
| 1096 | std::set<std::string> rnames; | 1095 | std::set<std::string> rnames; |
| 1097 | int min_suffix = 1; | 1096 | int min_suffix = 1; |
| 1098 | bool initialized_maps = false; | 1097 | bool initialized_maps = false; |
| 1099 | - for (auto ov_iter: other_val.ditems()) { | 1098 | + for (auto const& ov_iter: other_val.ditems()) { |
| 1100 | std::string const& key = ov_iter.first; | 1099 | std::string const& key = ov_iter.first; |
| 1101 | QPDFObjectHandle rval = ov_iter.second; | 1100 | QPDFObjectHandle rval = ov_iter.second; |
| 1102 | if (!this_val.hasKey(key)) { | 1101 | if (!this_val.hasKey(key)) { |
| @@ -1862,61 +1861,61 @@ QPDFObjectHandle::getParsedOffset() | @@ -1862,61 +1861,61 @@ QPDFObjectHandle::getParsedOffset() | ||
| 1862 | QPDFObjectHandle | 1861 | QPDFObjectHandle |
| 1863 | QPDFObjectHandle::newBool(bool value) | 1862 | QPDFObjectHandle::newBool(bool value) |
| 1864 | { | 1863 | { |
| 1865 | - return QPDFObjectHandle(QPDF_Bool::create(value)); | 1864 | + return {QPDF_Bool::create(value)}; |
| 1866 | } | 1865 | } |
| 1867 | 1866 | ||
| 1868 | QPDFObjectHandle | 1867 | QPDFObjectHandle |
| 1869 | QPDFObjectHandle::newNull() | 1868 | QPDFObjectHandle::newNull() |
| 1870 | { | 1869 | { |
| 1871 | - return QPDFObjectHandle(QPDF_Null::create()); | 1870 | + return {QPDF_Null::create()}; |
| 1872 | } | 1871 | } |
| 1873 | 1872 | ||
| 1874 | QPDFObjectHandle | 1873 | QPDFObjectHandle |
| 1875 | QPDFObjectHandle::newInteger(long long value) | 1874 | QPDFObjectHandle::newInteger(long long value) |
| 1876 | { | 1875 | { |
| 1877 | - return QPDFObjectHandle(QPDF_Integer::create(value)); | 1876 | + return {QPDF_Integer::create(value)}; |
| 1878 | } | 1877 | } |
| 1879 | 1878 | ||
| 1880 | QPDFObjectHandle | 1879 | QPDFObjectHandle |
| 1881 | QPDFObjectHandle::newReal(std::string const& value) | 1880 | QPDFObjectHandle::newReal(std::string const& value) |
| 1882 | { | 1881 | { |
| 1883 | - return QPDFObjectHandle(QPDF_Real::create(value)); | 1882 | + return {QPDF_Real::create(value)}; |
| 1884 | } | 1883 | } |
| 1885 | 1884 | ||
| 1886 | QPDFObjectHandle | 1885 | QPDFObjectHandle |
| 1887 | QPDFObjectHandle::newReal(double value, int decimal_places, bool trim_trailing_zeroes) | 1886 | QPDFObjectHandle::newReal(double value, int decimal_places, bool trim_trailing_zeroes) |
| 1888 | { | 1887 | { |
| 1889 | - return QPDFObjectHandle(QPDF_Real::create(value, decimal_places, trim_trailing_zeroes)); | 1888 | + return {QPDF_Real::create(value, decimal_places, trim_trailing_zeroes)}; |
| 1890 | } | 1889 | } |
| 1891 | 1890 | ||
| 1892 | QPDFObjectHandle | 1891 | QPDFObjectHandle |
| 1893 | QPDFObjectHandle::newName(std::string const& name) | 1892 | QPDFObjectHandle::newName(std::string const& name) |
| 1894 | { | 1893 | { |
| 1895 | - return QPDFObjectHandle(QPDF_Name::create(name)); | 1894 | + return {QPDF_Name::create(name)}; |
| 1896 | } | 1895 | } |
| 1897 | 1896 | ||
| 1898 | QPDFObjectHandle | 1897 | QPDFObjectHandle |
| 1899 | QPDFObjectHandle::newString(std::string const& str) | 1898 | QPDFObjectHandle::newString(std::string const& str) |
| 1900 | { | 1899 | { |
| 1901 | - return QPDFObjectHandle(QPDF_String::create(str)); | 1900 | + return {QPDF_String::create(str)}; |
| 1902 | } | 1901 | } |
| 1903 | 1902 | ||
| 1904 | QPDFObjectHandle | 1903 | QPDFObjectHandle |
| 1905 | QPDFObjectHandle::newUnicodeString(std::string const& utf8_str) | 1904 | QPDFObjectHandle::newUnicodeString(std::string const& utf8_str) |
| 1906 | { | 1905 | { |
| 1907 | - return QPDFObjectHandle(QPDF_String::create_utf16(utf8_str)); | 1906 | + return {QPDF_String::create_utf16(utf8_str)}; |
| 1908 | } | 1907 | } |
| 1909 | 1908 | ||
| 1910 | QPDFObjectHandle | 1909 | QPDFObjectHandle |
| 1911 | QPDFObjectHandle::newOperator(std::string const& value) | 1910 | QPDFObjectHandle::newOperator(std::string const& value) |
| 1912 | { | 1911 | { |
| 1913 | - return QPDFObjectHandle(QPDF_Operator::create(value)); | 1912 | + return {QPDF_Operator::create(value)}; |
| 1914 | } | 1913 | } |
| 1915 | 1914 | ||
| 1916 | QPDFObjectHandle | 1915 | QPDFObjectHandle |
| 1917 | QPDFObjectHandle::newInlineImage(std::string const& value) | 1916 | QPDFObjectHandle::newInlineImage(std::string const& value) |
| 1918 | { | 1917 | { |
| 1919 | - return QPDFObjectHandle(QPDF_InlineImage::create(value)); | 1918 | + return {QPDF_InlineImage::create(value)}; |
| 1920 | } | 1919 | } |
| 1921 | 1920 | ||
| 1922 | QPDFObjectHandle | 1921 | QPDFObjectHandle |
| @@ -1928,44 +1927,37 @@ QPDFObjectHandle::newArray() | @@ -1928,44 +1927,37 @@ QPDFObjectHandle::newArray() | ||
| 1928 | QPDFObjectHandle | 1927 | QPDFObjectHandle |
| 1929 | QPDFObjectHandle::newArray(std::vector<QPDFObjectHandle> const& items) | 1928 | QPDFObjectHandle::newArray(std::vector<QPDFObjectHandle> const& items) |
| 1930 | { | 1929 | { |
| 1931 | - return QPDFObjectHandle(QPDF_Array::create(items)); | 1930 | + return {QPDF_Array::create(items)}; |
| 1932 | } | 1931 | } |
| 1933 | 1932 | ||
| 1934 | QPDFObjectHandle | 1933 | QPDFObjectHandle |
| 1935 | QPDFObjectHandle::newArray(Rectangle const& rect) | 1934 | QPDFObjectHandle::newArray(Rectangle const& rect) |
| 1936 | { | 1935 | { |
| 1937 | - std::vector<QPDFObjectHandle> items; | ||
| 1938 | - items.push_back(newReal(rect.llx)); | ||
| 1939 | - items.push_back(newReal(rect.lly)); | ||
| 1940 | - items.push_back(newReal(rect.urx)); | ||
| 1941 | - items.push_back(newReal(rect.ury)); | ||
| 1942 | - return newArray(items); | 1936 | + return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)}); |
| 1943 | } | 1937 | } |
| 1944 | 1938 | ||
| 1945 | QPDFObjectHandle | 1939 | QPDFObjectHandle |
| 1946 | QPDFObjectHandle::newArray(Matrix const& matrix) | 1940 | QPDFObjectHandle::newArray(Matrix const& matrix) |
| 1947 | { | 1941 | { |
| 1948 | - std::vector<QPDFObjectHandle> items; | ||
| 1949 | - items.push_back(newReal(matrix.a)); | ||
| 1950 | - items.push_back(newReal(matrix.b)); | ||
| 1951 | - items.push_back(newReal(matrix.c)); | ||
| 1952 | - items.push_back(newReal(matrix.d)); | ||
| 1953 | - items.push_back(newReal(matrix.e)); | ||
| 1954 | - items.push_back(newReal(matrix.f)); | ||
| 1955 | - return newArray(items); | 1942 | + return newArray( |
| 1943 | + {newReal(matrix.a), | ||
| 1944 | + newReal(matrix.b), | ||
| 1945 | + newReal(matrix.c), | ||
| 1946 | + newReal(matrix.d), | ||
| 1947 | + newReal(matrix.e), | ||
| 1948 | + newReal(matrix.f)}); | ||
| 1956 | } | 1949 | } |
| 1957 | 1950 | ||
| 1958 | QPDFObjectHandle | 1951 | QPDFObjectHandle |
| 1959 | QPDFObjectHandle::newArray(QPDFMatrix const& matrix) | 1952 | QPDFObjectHandle::newArray(QPDFMatrix const& matrix) |
| 1960 | { | 1953 | { |
| 1961 | - std::vector<QPDFObjectHandle> items; | ||
| 1962 | - items.push_back(newReal(matrix.a)); | ||
| 1963 | - items.push_back(newReal(matrix.b)); | ||
| 1964 | - items.push_back(newReal(matrix.c)); | ||
| 1965 | - items.push_back(newReal(matrix.d)); | ||
| 1966 | - items.push_back(newReal(matrix.e)); | ||
| 1967 | - items.push_back(newReal(matrix.f)); | ||
| 1968 | - return newArray(items); | 1954 | + return newArray( |
| 1955 | + {newReal(matrix.a), | ||
| 1956 | + newReal(matrix.b), | ||
| 1957 | + newReal(matrix.c), | ||
| 1958 | + newReal(matrix.d), | ||
| 1959 | + newReal(matrix.e), | ||
| 1960 | + newReal(matrix.f)}); | ||
| 1969 | } | 1961 | } |
| 1970 | 1962 | ||
| 1971 | QPDFObjectHandle | 1963 | QPDFObjectHandle |
| @@ -1995,7 +1987,7 @@ QPDFObjectHandle::newDictionary() | @@ -1995,7 +1987,7 @@ QPDFObjectHandle::newDictionary() | ||
| 1995 | QPDFObjectHandle | 1987 | QPDFObjectHandle |
| 1996 | QPDFObjectHandle::newDictionary(std::map<std::string, QPDFObjectHandle> const& items) | 1988 | QPDFObjectHandle::newDictionary(std::map<std::string, QPDFObjectHandle> const& items) |
| 1997 | { | 1989 | { |
| 1998 | - return QPDFObjectHandle(QPDF_Dictionary::create(items)); | 1990 | + return {QPDF_Dictionary::create(items)}; |
| 1999 | } | 1991 | } |
| 2000 | 1992 | ||
| 2001 | QPDFObjectHandle | 1993 | QPDFObjectHandle |
| @@ -2060,7 +2052,7 @@ QPDFObjectHandle::shallowCopy() | @@ -2060,7 +2052,7 @@ QPDFObjectHandle::shallowCopy() | ||
| 2060 | if (!dereference()) { | 2052 | if (!dereference()) { |
| 2061 | throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle"); | 2053 | throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle"); |
| 2062 | } | 2054 | } |
| 2063 | - return QPDFObjectHandle(obj->copy()); | 2055 | + return {obj->copy()}; |
| 2064 | } | 2056 | } |
| 2065 | 2057 | ||
| 2066 | QPDFObjectHandle | 2058 | QPDFObjectHandle |
| @@ -2069,7 +2061,7 @@ QPDFObjectHandle::unsafeShallowCopy() | @@ -2069,7 +2061,7 @@ QPDFObjectHandle::unsafeShallowCopy() | ||
| 2069 | if (!dereference()) { | 2061 | if (!dereference()) { |
| 2070 | throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle"); | 2062 | throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle"); |
| 2071 | } | 2063 | } |
| 2072 | - return QPDFObjectHandle(obj->copy(true)); | 2064 | + return {obj->copy(true)}; |
| 2073 | } | 2065 | } |
| 2074 | 2066 | ||
| 2075 | void | 2067 | void |
| @@ -2471,13 +2463,13 @@ QPDFObjectHandle::QPDFDictItems::iterator::Members::Members(QPDFObjectHandle& oh | @@ -2471,13 +2463,13 @@ QPDFObjectHandle::QPDFDictItems::iterator::Members::Members(QPDFObjectHandle& oh | ||
| 2471 | QPDFObjectHandle::QPDFDictItems::iterator | 2463 | QPDFObjectHandle::QPDFDictItems::iterator |
| 2472 | QPDFObjectHandle::QPDFDictItems::begin() | 2464 | QPDFObjectHandle::QPDFDictItems::begin() |
| 2473 | { | 2465 | { |
| 2474 | - return iterator(oh, true); | 2466 | + return {oh, true}; |
| 2475 | } | 2467 | } |
| 2476 | 2468 | ||
| 2477 | QPDFObjectHandle::QPDFDictItems::iterator | 2469 | QPDFObjectHandle::QPDFDictItems::iterator |
| 2478 | QPDFObjectHandle::QPDFDictItems::end() | 2470 | QPDFObjectHandle::QPDFDictItems::end() |
| 2479 | { | 2471 | { |
| 2480 | - return iterator(oh, false); | 2472 | + return {oh, false}; |
| 2481 | } | 2473 | } |
| 2482 | 2474 | ||
| 2483 | QPDFObjectHandle::QPDFArrayItems::QPDFArrayItems(QPDFObjectHandle const& oh) : | 2475 | QPDFObjectHandle::QPDFArrayItems::QPDFArrayItems(QPDFObjectHandle const& oh) : |
| @@ -2551,13 +2543,13 @@ QPDFObjectHandle::QPDFArrayItems::iterator::Members::Members(QPDFObjectHandle& o | @@ -2551,13 +2543,13 @@ QPDFObjectHandle::QPDFArrayItems::iterator::Members::Members(QPDFObjectHandle& o | ||
| 2551 | QPDFObjectHandle::QPDFArrayItems::iterator | 2543 | QPDFObjectHandle::QPDFArrayItems::iterator |
| 2552 | QPDFObjectHandle::QPDFArrayItems::begin() | 2544 | QPDFObjectHandle::QPDFArrayItems::begin() |
| 2553 | { | 2545 | { |
| 2554 | - return iterator(oh, true); | 2546 | + return {oh, true}; |
| 2555 | } | 2547 | } |
| 2556 | 2548 | ||
| 2557 | QPDFObjectHandle::QPDFArrayItems::iterator | 2549 | QPDFObjectHandle::QPDFArrayItems::iterator |
| 2558 | QPDFObjectHandle::QPDFArrayItems::end() | 2550 | QPDFObjectHandle::QPDFArrayItems::end() |
| 2559 | { | 2551 | { |
| 2560 | - return iterator(oh, false); | 2552 | + return {oh, false}; |
| 2561 | } | 2553 | } |
| 2562 | 2554 | ||
| 2563 | QPDFObjGen | 2555 | QPDFObjGen |
libqpdf/QPDFObjectHelper.cc
| 1 | #include <qpdf/QPDFObjectHelper.hh> | 1 | #include <qpdf/QPDFObjectHelper.hh> |
| 2 | 2 | ||
| 3 | -QPDFObjectHelper::~QPDFObjectHelper() | 3 | +QPDFObjectHelper::~QPDFObjectHelper() // NOLINT (modernize-use-equals-default) |
| 4 | { | 4 | { |
| 5 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 5 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 6 | } | 6 | } |
libqpdf/QPDFPageDocumentHelper.cc
| @@ -14,7 +14,7 @@ QPDFPageDocumentHelper::getAllPages() | @@ -14,7 +14,7 @@ QPDFPageDocumentHelper::getAllPages() | ||
| 14 | { | 14 | { |
| 15 | std::vector<QPDFPageObjectHelper> pages; | 15 | std::vector<QPDFPageObjectHelper> pages; |
| 16 | for (auto const& iter: this->qpdf.getAllPages()) { | 16 | for (auto const& iter: this->qpdf.getAllPages()) { |
| 17 | - pages.push_back(QPDFPageObjectHelper(iter)); | 17 | + pages.emplace_back(iter); |
| 18 | } | 18 | } |
| 19 | return pages; | 19 | return pages; |
| 20 | } | 20 | } |
libqpdf/QPDFPageObjectHelper.cc
| @@ -20,8 +20,8 @@ namespace | @@ -20,8 +20,8 @@ namespace | ||
| 20 | from_page(from_page) | 20 | from_page(from_page) |
| 21 | { | 21 | { |
| 22 | } | 22 | } |
| 23 | - virtual ~ContentProvider() = default; | ||
| 24 | - virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline); | 23 | + ~ContentProvider() override = default; |
| 24 | + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override; | ||
| 25 | 25 | ||
| 26 | private: | 26 | private: |
| 27 | QPDFObjectHandle from_page; | 27 | QPDFObjectHandle from_page; |
| @@ -44,8 +44,8 @@ namespace | @@ -44,8 +44,8 @@ namespace | ||
| 44 | { | 44 | { |
| 45 | public: | 45 | public: |
| 46 | InlineImageTracker(QPDF*, size_t min_size, QPDFObjectHandle resources); | 46 | InlineImageTracker(QPDF*, size_t min_size, QPDFObjectHandle resources); |
| 47 | - virtual ~InlineImageTracker() = default; | ||
| 48 | - virtual void handleToken(QPDFTokenizer::Token const&); | 47 | + ~InlineImageTracker() override = default; |
| 48 | + void handleToken(QPDFTokenizer::Token const&) override; | ||
| 49 | QPDFObjectHandle convertIIDict(QPDFObjectHandle odict); | 49 | QPDFObjectHandle convertIIDict(QPDFObjectHandle odict); |
| 50 | 50 | ||
| 51 | QPDF* qpdf; | 51 | QPDF* qpdf; |
| @@ -53,19 +53,16 @@ namespace | @@ -53,19 +53,16 @@ namespace | ||
| 53 | QPDFObjectHandle resources; | 53 | QPDFObjectHandle resources; |
| 54 | std::string dict_str; | 54 | std::string dict_str; |
| 55 | std::string bi_str; | 55 | std::string bi_str; |
| 56 | - int min_suffix; | ||
| 57 | - bool any_images; | ||
| 58 | - enum { st_top, st_bi } state; | 56 | + int min_suffix{1}; |
| 57 | + bool any_images{false}; | ||
| 58 | + enum { st_top, st_bi } state{st_top}; | ||
| 59 | }; | 59 | }; |
| 60 | } // namespace | 60 | } // namespace |
| 61 | 61 | ||
| 62 | InlineImageTracker::InlineImageTracker(QPDF* qpdf, size_t min_size, QPDFObjectHandle resources) : | 62 | InlineImageTracker::InlineImageTracker(QPDF* qpdf, size_t min_size, QPDFObjectHandle resources) : |
| 63 | qpdf(qpdf), | 63 | qpdf(qpdf), |
| 64 | min_size(min_size), | 64 | min_size(min_size), |
| 65 | - resources(resources), | ||
| 66 | - min_suffix(1), | ||
| 67 | - any_images(false), | ||
| 68 | - state(st_top) | 65 | + resources(resources) |
| 69 | { | 66 | { |
| 70 | } | 67 | } |
| 71 | 68 | ||
| @@ -451,7 +448,7 @@ QPDFPageObjectHelper::getAnnotations(std::string const& only_subtype) | @@ -451,7 +448,7 @@ QPDFPageObjectHelper::getAnnotations(std::string const& only_subtype) | ||
| 451 | for (int i = 0; i < nannots; ++i) { | 448 | for (int i = 0; i < nannots; ++i) { |
| 452 | QPDFObjectHandle annot = annots.getArrayItem(i); | 449 | QPDFObjectHandle annot = annots.getArrayItem(i); |
| 453 | if (annot.isDictionaryOfType("", only_subtype)) { | 450 | if (annot.isDictionaryOfType("", only_subtype)) { |
| 454 | - result.push_back(QPDFAnnotationObjectHelper(annot)); | 451 | + result.emplace_back(annot); |
| 455 | } | 452 | } |
| 456 | } | 453 | } |
| 457 | } | 454 | } |
| @@ -662,7 +659,7 @@ QPDFPageObjectHelper::shallowCopyPage() | @@ -662,7 +659,7 @@ QPDFPageObjectHelper::shallowCopyPage() | ||
| 662 | QPDF& qpdf = | 659 | QPDF& qpdf = |
| 663 | this->oh.getQPDF("QPDFPageObjectHelper::shallowCopyPage called with a direct object"); | 660 | this->oh.getQPDF("QPDFPageObjectHelper::shallowCopyPage called with a direct object"); |
| 664 | QPDFObjectHandle new_page = this->oh.shallowCopy(); | 661 | QPDFObjectHandle new_page = this->oh.shallowCopy(); |
| 665 | - return QPDFPageObjectHelper(qpdf.makeIndirectObject(new_page)); | 662 | + return {qpdf.makeIndirectObject(new_page)}; |
| 666 | } | 663 | } |
| 667 | 664 | ||
| 668 | QPDFObjectHandle::Matrix | 665 | QPDFObjectHandle::Matrix |
| @@ -758,7 +755,7 @@ QPDFPageObjectHelper::getMatrixForFormXObjectPlacement( | @@ -758,7 +755,7 @@ QPDFPageObjectHelper::getMatrixForFormXObjectPlacement( | ||
| 758 | QPDFObjectHandle fdict = fo.getDict(); | 755 | QPDFObjectHandle fdict = fo.getDict(); |
| 759 | QPDFObjectHandle bbox_obj = fdict.getKey("/BBox"); | 756 | QPDFObjectHandle bbox_obj = fdict.getKey("/BBox"); |
| 760 | if (!bbox_obj.isRectangle()) { | 757 | if (!bbox_obj.isRectangle()) { |
| 761 | - return QPDFMatrix(); | 758 | + return {}; |
| 762 | } | 759 | } |
| 763 | 760 | ||
| 764 | QPDFMatrix wmatrix; // work matrix | 761 | QPDFMatrix wmatrix; // work matrix |
| @@ -793,7 +790,7 @@ QPDFPageObjectHelper::getMatrixForFormXObjectPlacement( | @@ -793,7 +790,7 @@ QPDFPageObjectHelper::getMatrixForFormXObjectPlacement( | ||
| 793 | // Calculate a scale factor, if needed. Shrink or expand if needed and allowed. | 790 | // Calculate a scale factor, if needed. Shrink or expand if needed and allowed. |
| 794 | if ((T.urx == T.llx) || (T.ury == T.lly)) { | 791 | if ((T.urx == T.llx) || (T.ury == T.lly)) { |
| 795 | // avoid division by zero | 792 | // avoid division by zero |
| 796 | - return QPDFMatrix(); | 793 | + return {}; |
| 797 | } | 794 | } |
| 798 | double rect_w = rect.urx - rect.llx; | 795 | double rect_w = rect.urx - rect.llx; |
| 799 | double rect_h = rect.ury - rect.lly; | 796 | double rect_h = rect.ury - rect.lly; |
libqpdf/QPDFParser.cc
| @@ -55,7 +55,7 @@ QPDFParser::parse(bool& empty, bool content_stream) | @@ -55,7 +55,7 @@ QPDFParser::parse(bool& empty, bool content_stream) | ||
| 55 | bool set_offset = false; | 55 | bool set_offset = false; |
| 56 | 56 | ||
| 57 | std::vector<StackFrame> stack; | 57 | std::vector<StackFrame> stack; |
| 58 | - stack.push_back(StackFrame(input)); | 58 | + stack.emplace_back(input); |
| 59 | std::vector<parser_state_e> state_stack; | 59 | std::vector<parser_state_e> state_stack; |
| 60 | state_stack.push_back(st_top); | 60 | state_stack.push_back(st_top); |
| 61 | qpdf_offset_t offset; | 61 | qpdf_offset_t offset; |
| @@ -141,7 +141,7 @@ QPDFParser::parse(bool& empty, bool content_stream) | @@ -141,7 +141,7 @@ QPDFParser::parse(bool& empty, bool content_stream) | ||
| 141 | (tokenizer.getType() == QPDFTokenizer::tt_array_open) ? st_array | 141 | (tokenizer.getType() == QPDFTokenizer::tt_array_open) ? st_array |
| 142 | : st_dictionary); | 142 | : st_dictionary); |
| 143 | b_contents = false; | 143 | b_contents = false; |
| 144 | - stack.push_back(StackFrame(input)); | 144 | + stack.emplace_back(input); |
| 145 | } | 145 | } |
| 146 | break; | 146 | break; |
| 147 | 147 |
libqpdf/QPDFWriter.cc
| @@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
| 26 | #include <cstdlib> | 26 | #include <cstdlib> |
| 27 | #include <stdexcept> | 27 | #include <stdexcept> |
| 28 | 28 | ||
| 29 | -QPDFWriter::ProgressReporter::~ProgressReporter() | 29 | +QPDFWriter::ProgressReporter::~ProgressReporter() // NOLINT (modernize-use-equals-default) |
| 30 | { | 30 | { |
| 31 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 31 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 32 | } | 32 | } |
| @@ -36,7 +36,8 @@ QPDFWriter::FunctionProgressReporter::FunctionProgressReporter(std::function<voi | @@ -36,7 +36,8 @@ QPDFWriter::FunctionProgressReporter::FunctionProgressReporter(std::function<voi | ||
| 36 | { | 36 | { |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | -QPDFWriter::FunctionProgressReporter::~FunctionProgressReporter() | 39 | +QPDFWriter::FunctionProgressReporter::~FunctionProgressReporter() // NOLINT |
| 40 | + // (modernize-use-equals-default) | ||
| 40 | { | 41 | { |
| 41 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer | 42 | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
| 42 | } | 43 | } |
libqpdf/QPDFXRefEntry.cc
libqpdf/QPDF_Array.cc
| @@ -201,7 +201,7 @@ QPDF_Array::getAsVector() const | @@ -201,7 +201,7 @@ QPDF_Array::getAsVector() const | ||
| 201 | v.reserve(size_t(size())); | 201 | v.reserve(size_t(size())); |
| 202 | for (auto const& item: sp_elements) { | 202 | for (auto const& item: sp_elements) { |
| 203 | v.resize(size_t(item.first), null_oh); | 203 | v.resize(size_t(item.first), null_oh); |
| 204 | - v.push_back(item.second); | 204 | + v.emplace_back(item.second); |
| 205 | } | 205 | } |
| 206 | v.resize(size_t(size()), null_oh); | 206 | v.resize(size_t(size()), null_oh); |
| 207 | return v; | 207 | return v; |
libqpdf/QPDF_encryption.cc
| @@ -164,7 +164,7 @@ pad_or_truncate_password_V4(std::string const& password) | @@ -164,7 +164,7 @@ pad_or_truncate_password_V4(std::string const& password) | ||
| 164 | { | 164 | { |
| 165 | char k1[key_bytes]; | 165 | char k1[key_bytes]; |
| 166 | pad_or_truncate_password_V4(password, k1); | 166 | pad_or_truncate_password_V4(password, k1); |
| 167 | - return std::string(k1, key_bytes); | 167 | + return {k1, key_bytes}; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | static std::string | 170 | static std::string |
| @@ -235,7 +235,7 @@ process_with_aes( | @@ -235,7 +235,7 @@ process_with_aes( | ||
| 235 | } else { | 235 | } else { |
| 236 | outlength = std::min(outlength, bufp->getSize()); | 236 | outlength = std::min(outlength, bufp->getSize()); |
| 237 | } | 237 | } |
| 238 | - return std::string(reinterpret_cast<char*>(bufp->getBuffer()), outlength); | 238 | + return {reinterpret_cast<char*>(bufp->getBuffer()), outlength}; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | static std::string | 241 | static std::string |
| @@ -355,7 +355,7 @@ QPDF::compute_data_key( | @@ -355,7 +355,7 @@ QPDF::compute_data_key( | ||
| 355 | md5.encodeDataIncrementally(result.c_str(), result.length()); | 355 | md5.encodeDataIncrementally(result.c_str(), result.length()); |
| 356 | MD5::Digest digest; | 356 | MD5::Digest digest; |
| 357 | md5.digest(digest); | 357 | md5.digest(digest); |
| 358 | - return std::string(reinterpret_cast<char*>(digest), std::min(result.length(), toS(16))); | 358 | + return {reinterpret_cast<char*>(digest), std::min(result.length(), toS(16))}; |
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | std::string | 361 | std::string |
| @@ -401,7 +401,7 @@ QPDF::compute_encryption_key_from_password(std::string const& password, Encrypti | @@ -401,7 +401,7 @@ QPDF::compute_encryption_key_from_password(std::string const& password, Encrypti | ||
| 401 | MD5::Digest digest; | 401 | MD5::Digest digest; |
| 402 | int key_len = std::min(toI(sizeof(digest)), data.getLengthBytes()); | 402 | int key_len = std::min(toI(sizeof(digest)), data.getLengthBytes()); |
| 403 | iterate_md5_digest(md5, digest, ((data.getR() >= 3) ? 50 : 0), key_len); | 403 | iterate_md5_digest(md5, digest, ((data.getR() >= 3) ? 50 : 0), key_len); |
| 404 | - return std::string(reinterpret_cast<char*>(digest), toS(key_len)); | 404 | + return {reinterpret_cast<char*>(digest), toS(key_len)}; |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | static void | 407 | static void |
| @@ -448,7 +448,7 @@ compute_O_value( | @@ -448,7 +448,7 @@ compute_O_value( | ||
| 448 | data.getLengthBytes(), | 448 | data.getLengthBytes(), |
| 449 | (data.getR() >= 3) ? 20 : 1, | 449 | (data.getR() >= 3) ? 20 : 1, |
| 450 | false); | 450 | false); |
| 451 | - return std::string(upass, key_bytes); | 451 | + return {upass, key_bytes}; |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | static std::string | 454 | static std::string |
| @@ -467,7 +467,7 @@ compute_U_value_R2(std::string const& user_password, QPDF::EncryptionData const& | @@ -467,7 +467,7 @@ compute_U_value_R2(std::string const& user_password, QPDF::EncryptionData const& | ||
| 467 | data.getLengthBytes(), | 467 | data.getLengthBytes(), |
| 468 | 1, | 468 | 1, |
| 469 | false); | 469 | false); |
| 470 | - return std::string(udata, key_bytes); | 470 | + return {udata, key_bytes}; |
| 471 | } | 471 | } |
| 472 | 472 | ||
| 473 | static std::string | 473 | static std::string |
| @@ -496,7 +496,7 @@ compute_U_value_R3(std::string const& user_password, QPDF::EncryptionData const& | @@ -496,7 +496,7 @@ compute_U_value_R3(std::string const& user_password, QPDF::EncryptionData const& | ||
| 496 | for (unsigned int i = sizeof(MD5::Digest); i < key_bytes; ++i) { | 496 | for (unsigned int i = sizeof(MD5::Digest); i < key_bytes; ++i) { |
| 497 | result[i] = static_cast<char>((i * i) % 0xff); | 497 | result[i] = static_cast<char>((i * i) % 0xff); |
| 498 | } | 498 | } |
| 499 | - return std::string(result, key_bytes); | 499 | + return {result, key_bytes}; |
| 500 | } | 500 | } |
| 501 | 501 | ||
| 502 | static std::string | 502 | static std::string |
libqpdf/QPDF_json.cc
| @@ -238,7 +238,7 @@ class QPDF::JSONReactor: public JSON::Reactor | @@ -238,7 +238,7 @@ class QPDF::JSONReactor: public JSON::Reactor | ||
| 238 | } | 238 | } |
| 239 | } | 239 | } |
| 240 | } | 240 | } |
| 241 | - virtual ~JSONReactor() = default; | 241 | + ~JSONReactor() override = default; |
| 242 | void dictionaryStart() override; | 242 | void dictionaryStart() override; |
| 243 | void arrayStart() override; | 243 | void arrayStart() override; |
| 244 | void containerEnd(JSON const& value) override; | 244 | void containerEnd(JSON const& value) override; |
libqpdf/QPDF_linearization.cc
| @@ -1367,7 +1367,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) | @@ -1367,7 +1367,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) | ||
| 1367 | for (auto& oh: m->part6) { | 1367 | for (auto& oh: m->part6) { |
| 1368 | int obj = oh.getObjectID(); | 1368 | int obj = oh.getObjectID(); |
| 1369 | obj_to_index[obj] = toI(shared.size()); | 1369 | obj_to_index[obj] = toI(shared.size()); |
| 1370 | - shared.push_back(CHSharedObjectEntry(obj)); | 1370 | + shared.emplace_back(obj); |
| 1371 | } | 1371 | } |
| 1372 | QTC::TC("qpdf", "QPDF lin part 8 empty", m->part8.empty() ? 1 : 0); | 1372 | QTC::TC("qpdf", "QPDF lin part 8 empty", m->part8.empty() ? 1 : 0); |
| 1373 | if (!m->part8.empty()) { | 1373 | if (!m->part8.empty()) { |
| @@ -1375,7 +1375,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) | @@ -1375,7 +1375,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) | ||
| 1375 | for (auto& oh: m->part8) { | 1375 | for (auto& oh: m->part8) { |
| 1376 | int obj = oh.getObjectID(); | 1376 | int obj = oh.getObjectID(); |
| 1377 | obj_to_index[obj] = toI(shared.size()); | 1377 | obj_to_index[obj] = toI(shared.size()); |
| 1378 | - shared.push_back(CHSharedObjectEntry(obj)); | 1378 | + shared.emplace_back(obj); |
| 1379 | } | 1379 | } |
| 1380 | } | 1380 | } |
| 1381 | if (static_cast<size_t>(m->c_shared_object_data.nshared_total) != | 1381 | if (static_cast<size_t>(m->c_shared_object_data.nshared_total) != |
| @@ -1585,7 +1585,7 @@ QPDF::calculateHSharedObject( | @@ -1585,7 +1585,7 @@ QPDF::calculateHSharedObject( | ||
| 1585 | int length = outputLengthNextN(csoe.at(i).object, 1, lengths, obj_renumber); | 1585 | int length = outputLengthNextN(csoe.at(i).object, 1, lengths, obj_renumber); |
| 1586 | min_length = std::min(min_length, length); | 1586 | min_length = std::min(min_length, length); |
| 1587 | max_length = std::max(max_length, length); | 1587 | max_length = std::max(max_length, length); |
| 1588 | - soe.push_back(HSharedObjectEntry()); | 1588 | + soe.emplace_back(); |
| 1589 | soe.at(i).delta_group_length = length; | 1589 | soe.at(i).delta_group_length = length; |
| 1590 | } | 1590 | } |
| 1591 | if (soe.size() != toS(cso.nshared_total)) { | 1591 | if (soe.size() != toS(cso.nshared_total)) { |
libqpdf/QUtil.cc
| @@ -903,14 +903,14 @@ QUtil::get_current_qpdf_time() | @@ -903,14 +903,14 @@ QUtil::get_current_qpdf_time() | ||
| 903 | // Don't know how to get timezone on this platform | 903 | // Don't know how to get timezone on this platform |
| 904 | int tzoff = 0; | 904 | int tzoff = 0; |
| 905 | # endif | 905 | # endif |
| 906 | - return QPDFTime( | 906 | + return { |
| 907 | static_cast<int>(ltime.tm_year + 1900), | 907 | static_cast<int>(ltime.tm_year + 1900), |
| 908 | static_cast<int>(ltime.tm_mon + 1), | 908 | static_cast<int>(ltime.tm_mon + 1), |
| 909 | static_cast<int>(ltime.tm_mday), | 909 | static_cast<int>(ltime.tm_mday), |
| 910 | static_cast<int>(ltime.tm_hour), | 910 | static_cast<int>(ltime.tm_hour), |
| 911 | static_cast<int>(ltime.tm_min), | 911 | static_cast<int>(ltime.tm_min), |
| 912 | static_cast<int>(ltime.tm_sec), | 912 | static_cast<int>(ltime.tm_sec), |
| 913 | - tzoff); | 913 | + tzoff}; |
| 914 | #endif | 914 | #endif |
| 915 | } | 915 | } |
| 916 | 916 | ||
| @@ -1082,13 +1082,12 @@ namespace | @@ -1082,13 +1082,12 @@ namespace | ||
| 1082 | 1082 | ||
| 1083 | private: | 1083 | private: |
| 1084 | RandomDataProvider* default_provider; | 1084 | RandomDataProvider* default_provider; |
| 1085 | - RandomDataProvider* current_provider; | 1085 | + RandomDataProvider* current_provider{nullptr}; |
| 1086 | }; | 1086 | }; |
| 1087 | } // namespace | 1087 | } // namespace |
| 1088 | 1088 | ||
| 1089 | RandomDataProviderProvider::RandomDataProviderProvider() : | 1089 | RandomDataProviderProvider::RandomDataProviderProvider() : |
| 1090 | - default_provider(CryptoRandomDataProvider::getInstance()), | ||
| 1091 | - current_provider(nullptr) | 1090 | + default_provider(CryptoRandomDataProvider::getInstance()) |
| 1092 | { | 1091 | { |
| 1093 | this->current_provider = default_provider; | 1092 | this->current_provider = default_provider; |
| 1094 | } | 1093 | } |
| @@ -1246,7 +1245,7 @@ QUtil::read_lines_from_file( | @@ -1246,7 +1245,7 @@ QUtil::read_lines_from_file( | ||
| 1246 | char c; | 1245 | char c; |
| 1247 | while (next_char(c)) { | 1246 | while (next_char(c)) { |
| 1248 | if (buf == nullptr) { | 1247 | if (buf == nullptr) { |
| 1249 | - lines.push_back(""); | 1248 | + lines.emplace_back(""); |
| 1250 | buf = &(lines.back()); | 1249 | buf = &(lines.back()); |
| 1251 | buf->reserve(80); | 1250 | buf->reserve(80); |
| 1252 | } | 1251 | } |
libqpdf/qpdf-c.cc
| @@ -813,13 +813,13 @@ trap_oh_errors(qpdf_data qpdf, std::function<RET()> fallback, std::function<RET( | @@ -813,13 +813,13 @@ trap_oh_errors(qpdf_data qpdf, std::function<RET()> fallback, std::function<RET( | ||
| 813 | if (!qpdf->silence_errors) { | 813 | if (!qpdf->silence_errors) { |
| 814 | QTC::TC("qpdf", "qpdf-c warn about oh error", qpdf->oh_error_occurred ? 0 : 1); | 814 | QTC::TC("qpdf", "qpdf-c warn about oh error", qpdf->oh_error_occurred ? 0 : 1); |
| 815 | if (!qpdf->oh_error_occurred) { | 815 | if (!qpdf->oh_error_occurred) { |
| 816 | - qpdf->warnings.push_back(QPDFExc( | 816 | + qpdf->warnings.emplace_back( |
| 817 | qpdf_e_internal, | 817 | qpdf_e_internal, |
| 818 | qpdf->qpdf->getFilename(), | 818 | qpdf->qpdf->getFilename(), |
| 819 | "", | 819 | "", |
| 820 | 0, | 820 | 0, |
| 821 | "C API function caught an exception that it isn't returning; please point the " | 821 | "C API function caught an exception that it isn't returning; please point the " |
| 822 | - "application developer to ERROR HANDLING in qpdf-c.h")); | 822 | + "application developer to ERROR HANDLING in qpdf-c.h"); |
| 823 | qpdf->oh_error_occurred = true; | 823 | qpdf->oh_error_occurred = true; |
| 824 | } | 824 | } |
| 825 | *QPDFLogger::defaultLogger()->getError() << qpdf->error->what() << "\n"; | 825 | *QPDFLogger::defaultLogger()->getError() << qpdf->error->what() << "\n"; |
libqpdf/qpdf/Pl_LZWDecoder.hh
| @@ -10,9 +10,9 @@ class Pl_LZWDecoder: public Pipeline | @@ -10,9 +10,9 @@ class Pl_LZWDecoder: public Pipeline | ||
| 10 | { | 10 | { |
| 11 | public: | 11 | public: |
| 12 | Pl_LZWDecoder(char const* identifier, Pipeline* next, bool early_code_change); | 12 | Pl_LZWDecoder(char const* identifier, Pipeline* next, bool early_code_change); |
| 13 | - virtual ~Pl_LZWDecoder() = default; | ||
| 14 | - virtual void write(unsigned char const* buf, size_t len); | ||
| 15 | - virtual void finish(); | 13 | + ~Pl_LZWDecoder() override = default; |
| 14 | + void write(unsigned char const* buf, size_t len) override; | ||
| 15 | + void finish() override; | ||
| 16 | 16 | ||
| 17 | private: | 17 | private: |
| 18 | void sendNextCode(); | 18 | void sendNextCode(); |
libqpdf/qpdf/Pl_MD5.hh
| @@ -14,9 +14,9 @@ class Pl_MD5: public Pipeline | @@ -14,9 +14,9 @@ class Pl_MD5: public Pipeline | ||
| 14 | { | 14 | { |
| 15 | public: | 15 | public: |
| 16 | Pl_MD5(char const* identifier, Pipeline* next); | 16 | Pl_MD5(char const* identifier, Pipeline* next); |
| 17 | - virtual ~Pl_MD5() = default; | ||
| 18 | - virtual void write(unsigned char const*, size_t); | ||
| 19 | - virtual void finish(); | 17 | + ~Pl_MD5() override = default; |
| 18 | + void write(unsigned char const*, size_t) override; | ||
| 19 | + void finish() override; | ||
| 20 | std::string getHexDigest(); | 20 | std::string getHexDigest(); |
| 21 | // Enable/disable. Disabling the pipeline causes it to become a pass-through. This makes it | 21 | // Enable/disable. Disabling the pipeline causes it to become a pass-through. This makes it |
| 22 | // possible to stick an MD5 pipeline in a pipeline when it may or may not be required. Disabling | 22 | // possible to stick an MD5 pipeline in a pipeline when it may or may not be required. Disabling |
libqpdf/qpdf/QPDFArgParser.hh
| @@ -145,19 +145,12 @@ class QPDFArgParser | @@ -145,19 +145,12 @@ class QPDFArgParser | ||
| 145 | private: | 145 | private: |
| 146 | struct OptionEntry | 146 | struct OptionEntry |
| 147 | { | 147 | { |
| 148 | - OptionEntry() : | ||
| 149 | - parameter_needed(false), | ||
| 150 | - bare_arg_handler(nullptr), | ||
| 151 | - param_arg_handler(nullptr), | ||
| 152 | - invalid_choice_handler(nullptr) | ||
| 153 | - { | ||
| 154 | - } | ||
| 155 | - bool parameter_needed; | 148 | + bool parameter_needed{false}; |
| 156 | std::string parameter_name; | 149 | std::string parameter_name; |
| 157 | std::set<std::string> choices; | 150 | std::set<std::string> choices; |
| 158 | - bare_arg_handler_t bare_arg_handler; | ||
| 159 | - param_arg_handler_t param_arg_handler; | ||
| 160 | - param_arg_handler_t invalid_choice_handler; | 151 | + bare_arg_handler_t bare_arg_handler{nullptr}; |
| 152 | + param_arg_handler_t param_arg_handler{nullptr}; | ||
| 153 | + param_arg_handler_t invalid_choice_handler{nullptr}; | ||
| 161 | }; | 154 | }; |
| 162 | typedef std::map<std::string, OptionEntry> option_table_t; | 155 | typedef std::map<std::string, OptionEntry> option_table_t; |
| 163 | 156 |
libqpdf/qpdf/QPDF_Array.hh
| @@ -9,14 +9,14 @@ | @@ -9,14 +9,14 @@ | ||
| 9 | class QPDF_Array: public QPDFValue | 9 | class QPDF_Array: public QPDFValue |
| 10 | { | 10 | { |
| 11 | public: | 11 | public: |
| 12 | - virtual ~QPDF_Array() = default; | 12 | + ~QPDF_Array() override = default; |
| 13 | static std::shared_ptr<QPDFObject> create(std::vector<QPDFObjectHandle> const& items); | 13 | static std::shared_ptr<QPDFObject> create(std::vector<QPDFObjectHandle> const& items); |
| 14 | static std::shared_ptr<QPDFObject> | 14 | static std::shared_ptr<QPDFObject> |
| 15 | create(std::vector<std::shared_ptr<QPDFObject>>&& items, bool sparse); | 15 | create(std::vector<std::shared_ptr<QPDFObject>>&& items, bool sparse); |
| 16 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 17 | - virtual std::string unparse(); | ||
| 18 | - virtual JSON getJSON(int json_version); | ||
| 19 | - virtual void disconnect(); | 16 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 17 | + std::string unparse() override; | ||
| 18 | + JSON getJSON(int json_version) override; | ||
| 19 | + void disconnect() override; | ||
| 20 | 20 | ||
| 21 | int | 21 | int |
| 22 | size() const noexcept | 22 | size() const noexcept |
libqpdf/qpdf/QPDF_Bool.hh
| @@ -6,11 +6,11 @@ | @@ -6,11 +6,11 @@ | ||
| 6 | class QPDF_Bool: public QPDFValue | 6 | class QPDF_Bool: public QPDFValue |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | - virtual ~QPDF_Bool() = default; | 9 | + ~QPDF_Bool() override = default; |
| 10 | static std::shared_ptr<QPDFObject> create(bool val); | 10 | static std::shared_ptr<QPDFObject> create(bool val); |
| 11 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 12 | - virtual std::string unparse(); | ||
| 13 | - virtual JSON getJSON(int json_version); | 11 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 12 | + std::string unparse() override; | ||
| 13 | + JSON getJSON(int json_version) override; | ||
| 14 | bool getVal() const; | 14 | bool getVal() const; |
| 15 | 15 | ||
| 16 | private: | 16 | private: |
libqpdf/qpdf/QPDF_Destroyed.hh
| @@ -6,10 +6,10 @@ | @@ -6,10 +6,10 @@ | ||
| 6 | class QPDF_Destroyed: public QPDFValue | 6 | class QPDF_Destroyed: public QPDFValue |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | - virtual ~QPDF_Destroyed() = default; | ||
| 10 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 11 | - virtual std::string unparse(); | ||
| 12 | - virtual JSON getJSON(int json_version); | 9 | + ~QPDF_Destroyed() override = default; |
| 10 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; | ||
| 11 | + std::string unparse() override; | ||
| 12 | + JSON getJSON(int json_version) override; | ||
| 13 | static std::shared_ptr<QPDFValue> getInstance(); | 13 | static std::shared_ptr<QPDFValue> getInstance(); |
| 14 | 14 | ||
| 15 | private: | 15 | private: |
libqpdf/qpdf/QPDF_Dictionary.hh
| @@ -11,13 +11,13 @@ | @@ -11,13 +11,13 @@ | ||
| 11 | class QPDF_Dictionary: public QPDFValue | 11 | class QPDF_Dictionary: public QPDFValue |
| 12 | { | 12 | { |
| 13 | public: | 13 | public: |
| 14 | - virtual ~QPDF_Dictionary() = default; | 14 | + ~QPDF_Dictionary() override = default; |
| 15 | static std::shared_ptr<QPDFObject> create(std::map<std::string, QPDFObjectHandle> const& items); | 15 | static std::shared_ptr<QPDFObject> create(std::map<std::string, QPDFObjectHandle> const& items); |
| 16 | static std::shared_ptr<QPDFObject> create(std::map<std::string, QPDFObjectHandle>&& items); | 16 | static std::shared_ptr<QPDFObject> create(std::map<std::string, QPDFObjectHandle>&& items); |
| 17 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 18 | - virtual std::string unparse(); | ||
| 19 | - virtual JSON getJSON(int json_version); | ||
| 20 | - virtual void disconnect(); | 17 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 18 | + std::string unparse() override; | ||
| 19 | + JSON getJSON(int json_version) override; | ||
| 20 | + void disconnect() override; | ||
| 21 | 21 | ||
| 22 | // hasKey() and getKeys() treat keys with null values as if they aren't there. getKey() returns | 22 | // hasKey() and getKeys() treat keys with null values as if they aren't there. getKey() returns |
| 23 | // null for the value of a non-existent key. This is as per the PDF spec. | 23 | // null for the value of a non-existent key. This is as per the PDF spec. |
libqpdf/qpdf/QPDF_InlineImage.hh
| @@ -6,13 +6,13 @@ | @@ -6,13 +6,13 @@ | ||
| 6 | class QPDF_InlineImage: public QPDFValue | 6 | class QPDF_InlineImage: public QPDFValue |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | - virtual ~QPDF_InlineImage() = default; | 9 | + ~QPDF_InlineImage() override = default; |
| 10 | static std::shared_ptr<QPDFObject> create(std::string const& val); | 10 | static std::shared_ptr<QPDFObject> create(std::string const& val); |
| 11 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 12 | - virtual std::string unparse(); | ||
| 13 | - virtual JSON getJSON(int json_version); | ||
| 14 | - virtual std::string | ||
| 15 | - getStringValue() const | 11 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 12 | + std::string unparse() override; | ||
| 13 | + JSON getJSON(int json_version) override; | ||
| 14 | + std::string | ||
| 15 | + getStringValue() const override | ||
| 16 | { | 16 | { |
| 17 | return val; | 17 | return val; |
| 18 | } | 18 | } |
libqpdf/qpdf/QPDF_Integer.hh
| @@ -6,11 +6,11 @@ | @@ -6,11 +6,11 @@ | ||
| 6 | class QPDF_Integer: public QPDFValue | 6 | class QPDF_Integer: public QPDFValue |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | - virtual ~QPDF_Integer() = default; | 9 | + ~QPDF_Integer() override = default; |
| 10 | static std::shared_ptr<QPDFObject> create(long long value); | 10 | static std::shared_ptr<QPDFObject> create(long long value); |
| 11 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 12 | - virtual std::string unparse(); | ||
| 13 | - virtual JSON getJSON(int json_version); | 11 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 12 | + std::string unparse() override; | ||
| 13 | + JSON getJSON(int json_version) override; | ||
| 14 | long long getVal() const; | 14 | long long getVal() const; |
| 15 | 15 | ||
| 16 | private: | 16 | private: |
libqpdf/qpdf/QPDF_Name.hh
| @@ -6,16 +6,16 @@ | @@ -6,16 +6,16 @@ | ||
| 6 | class QPDF_Name: public QPDFValue | 6 | class QPDF_Name: public QPDFValue |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | - virtual ~QPDF_Name() = default; | 9 | + ~QPDF_Name() override = default; |
| 10 | static std::shared_ptr<QPDFObject> create(std::string const& name); | 10 | static std::shared_ptr<QPDFObject> create(std::string const& name); |
| 11 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 12 | - virtual std::string unparse(); | ||
| 13 | - virtual JSON getJSON(int json_version); | 11 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 12 | + std::string unparse() override; | ||
| 13 | + JSON getJSON(int json_version) override; | ||
| 14 | 14 | ||
| 15 | // Put # into strings with characters unsuitable for name token | 15 | // Put # into strings with characters unsuitable for name token |
| 16 | static std::string normalizeName(std::string const& name); | 16 | static std::string normalizeName(std::string const& name); |
| 17 | - virtual std::string | ||
| 18 | - getStringValue() const | 17 | + std::string |
| 18 | + getStringValue() const override | ||
| 19 | { | 19 | { |
| 20 | return name; | 20 | return name; |
| 21 | } | 21 | } |
libqpdf/qpdf/QPDF_Null.hh
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | class QPDF_Null: public QPDFValue | 6 | class QPDF_Null: public QPDFValue |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | - virtual ~QPDF_Null() = default; | 9 | + ~QPDF_Null() override = default; |
| 10 | static std::shared_ptr<QPDFObject> create(); | 10 | static std::shared_ptr<QPDFObject> create(); |
| 11 | static std::shared_ptr<QPDFObject> create( | 11 | static std::shared_ptr<QPDFObject> create( |
| 12 | std::shared_ptr<QPDFObject> parent, | 12 | std::shared_ptr<QPDFObject> parent, |
| @@ -16,9 +16,9 @@ class QPDF_Null: public QPDFValue | @@ -16,9 +16,9 @@ class QPDF_Null: public QPDFValue | ||
| 16 | std::shared_ptr<QPDFValue> parent, | 16 | std::shared_ptr<QPDFValue> parent, |
| 17 | std::string_view const& static_descr, | 17 | std::string_view const& static_descr, |
| 18 | std::string var_descr); | 18 | std::string var_descr); |
| 19 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 20 | - virtual std::string unparse(); | ||
| 21 | - virtual JSON getJSON(int json_version); | 19 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 20 | + std::string unparse() override; | ||
| 21 | + JSON getJSON(int json_version) override; | ||
| 22 | 22 | ||
| 23 | private: | 23 | private: |
| 24 | QPDF_Null(); | 24 | QPDF_Null(); |
libqpdf/qpdf/QPDF_Operator.hh
| @@ -6,13 +6,13 @@ | @@ -6,13 +6,13 @@ | ||
| 6 | class QPDF_Operator: public QPDFValue | 6 | class QPDF_Operator: public QPDFValue |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | - virtual ~QPDF_Operator() = default; | 9 | + ~QPDF_Operator() override = default; |
| 10 | static std::shared_ptr<QPDFObject> create(std::string const& val); | 10 | static std::shared_ptr<QPDFObject> create(std::string const& val); |
| 11 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 12 | - virtual std::string unparse(); | ||
| 13 | - virtual JSON getJSON(int json_version); | ||
| 14 | - virtual std::string | ||
| 15 | - getStringValue() const | 11 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 12 | + std::string unparse() override; | ||
| 13 | + JSON getJSON(int json_version) override; | ||
| 14 | + std::string | ||
| 15 | + getStringValue() const override | ||
| 16 | { | 16 | { |
| 17 | return val; | 17 | return val; |
| 18 | } | 18 | } |
libqpdf/qpdf/QPDF_Real.hh
| @@ -6,15 +6,15 @@ | @@ -6,15 +6,15 @@ | ||
| 6 | class QPDF_Real: public QPDFValue | 6 | class QPDF_Real: public QPDFValue |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | - virtual ~QPDF_Real() = default; | 9 | + ~QPDF_Real() override = default; |
| 10 | static std::shared_ptr<QPDFObject> create(std::string const& val); | 10 | static std::shared_ptr<QPDFObject> create(std::string const& val); |
| 11 | static std::shared_ptr<QPDFObject> | 11 | static std::shared_ptr<QPDFObject> |
| 12 | create(double value, int decimal_places, bool trim_trailing_zeroes); | 12 | create(double value, int decimal_places, bool trim_trailing_zeroes); |
| 13 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 14 | - virtual std::string unparse(); | ||
| 15 | - virtual JSON getJSON(int json_version); | ||
| 16 | - virtual std::string | ||
| 17 | - getStringValue() const | 13 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 14 | + std::string unparse() override; | ||
| 15 | + JSON getJSON(int json_version) override; | ||
| 16 | + std::string | ||
| 17 | + getStringValue() const override | ||
| 18 | { | 18 | { |
| 19 | return val; | 19 | return val; |
| 20 | } | 20 | } |
libqpdf/qpdf/QPDF_Reserved.hh
| @@ -6,11 +6,11 @@ | @@ -6,11 +6,11 @@ | ||
| 6 | class QPDF_Reserved: public QPDFValue | 6 | class QPDF_Reserved: public QPDFValue |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | - virtual ~QPDF_Reserved() = default; | 9 | + ~QPDF_Reserved() override = default; |
| 10 | static std::shared_ptr<QPDFObject> create(); | 10 | static std::shared_ptr<QPDFObject> create(); |
| 11 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 12 | - virtual std::string unparse(); | ||
| 13 | - virtual JSON getJSON(int json_version); | 11 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 12 | + std::string unparse() override; | ||
| 13 | + JSON getJSON(int json_version) override; | ||
| 14 | 14 | ||
| 15 | private: | 15 | private: |
| 16 | QPDF_Reserved(); | 16 | QPDF_Reserved(); |
libqpdf/qpdf/QPDF_Stream.hh
| @@ -16,19 +16,19 @@ class QPDF; | @@ -16,19 +16,19 @@ class QPDF; | ||
| 16 | class QPDF_Stream: public QPDFValue | 16 | class QPDF_Stream: public QPDFValue |
| 17 | { | 17 | { |
| 18 | public: | 18 | public: |
| 19 | - virtual ~QPDF_Stream() = default; | 19 | + ~QPDF_Stream() override = default; |
| 20 | static std::shared_ptr<QPDFObject> create( | 20 | static std::shared_ptr<QPDFObject> create( |
| 21 | QPDF*, | 21 | QPDF*, |
| 22 | QPDFObjGen const& og, | 22 | QPDFObjGen const& og, |
| 23 | QPDFObjectHandle stream_dict, | 23 | QPDFObjectHandle stream_dict, |
| 24 | qpdf_offset_t offset, | 24 | qpdf_offset_t offset, |
| 25 | size_t length); | 25 | size_t length); |
| 26 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 27 | - virtual std::string unparse(); | ||
| 28 | - virtual JSON getJSON(int json_version); | ||
| 29 | - virtual void setDescription( | ||
| 30 | - QPDF*, std::shared_ptr<QPDFValue::Description>& description, qpdf_offset_t offset); | ||
| 31 | - virtual void disconnect(); | 26 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 27 | + std::string unparse() override; | ||
| 28 | + JSON getJSON(int json_version) override; | ||
| 29 | + void setDescription( | ||
| 30 | + QPDF*, std::shared_ptr<QPDFValue::Description>& description, qpdf_offset_t offset) override; | ||
| 31 | + void disconnect() override; | ||
| 32 | QPDFObjectHandle getDict() const; | 32 | QPDFObjectHandle getDict() const; |
| 33 | bool isDataModified() const; | 33 | bool isDataModified() const; |
| 34 | void setFilterOnWrite(bool); | 34 | void setFilterOnWrite(bool); |
libqpdf/qpdf/QPDF_String.hh
| @@ -10,16 +10,16 @@ class QPDF_String: public QPDFValue | @@ -10,16 +10,16 @@ class QPDF_String: public QPDFValue | ||
| 10 | friend class QPDFWriter; | 10 | friend class QPDFWriter; |
| 11 | 11 | ||
| 12 | public: | 12 | public: |
| 13 | - virtual ~QPDF_String() = default; | 13 | + ~QPDF_String() override = default; |
| 14 | static std::shared_ptr<QPDFObject> create(std::string const& val); | 14 | static std::shared_ptr<QPDFObject> create(std::string const& val); |
| 15 | static std::shared_ptr<QPDFObject> create_utf16(std::string const& utf8_val); | 15 | static std::shared_ptr<QPDFObject> create_utf16(std::string const& utf8_val); |
| 16 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 17 | - virtual std::string unparse(); | 16 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 17 | + std::string unparse() override; | ||
| 18 | std::string unparse(bool force_binary); | 18 | std::string unparse(bool force_binary); |
| 19 | - virtual JSON getJSON(int json_version); | 19 | + JSON getJSON(int json_version) override; |
| 20 | std::string getUTF8Val() const; | 20 | std::string getUTF8Val() const; |
| 21 | - virtual std::string | ||
| 22 | - getStringValue() const | 21 | + std::string |
| 22 | + getStringValue() const override | ||
| 23 | { | 23 | { |
| 24 | return val; | 24 | return val; |
| 25 | } | 25 | } |
libqpdf/qpdf/QPDF_Unresolved.hh
| @@ -6,11 +6,11 @@ | @@ -6,11 +6,11 @@ | ||
| 6 | class QPDF_Unresolved: public QPDFValue | 6 | class QPDF_Unresolved: public QPDFValue |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | - virtual ~QPDF_Unresolved() = default; | 9 | + ~QPDF_Unresolved() override = default; |
| 10 | static std::shared_ptr<QPDFObject> create(QPDF* qpdf, QPDFObjGen const& og); | 10 | static std::shared_ptr<QPDFObject> create(QPDF* qpdf, QPDFObjGen const& og); |
| 11 | - virtual std::shared_ptr<QPDFObject> copy(bool shallow = false); | ||
| 12 | - virtual std::string unparse(); | ||
| 13 | - virtual JSON getJSON(int json_version); | 11 | + std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 12 | + std::string unparse() override; | ||
| 13 | + JSON getJSON(int json_version) override; | ||
| 14 | 14 | ||
| 15 | private: | 15 | private: |
| 16 | QPDF_Unresolved(QPDF* qpdf, QPDFObjGen const& og); | 16 | QPDF_Unresolved(QPDF* qpdf, QPDFObjGen const& og); |
libqpdf/qpdf/ResourceFinder.hh
| @@ -7,7 +7,7 @@ class ResourceFinder: public QPDFObjectHandle::ParserCallbacks | @@ -7,7 +7,7 @@ class ResourceFinder: public QPDFObjectHandle::ParserCallbacks | ||
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | ResourceFinder(); | 9 | ResourceFinder(); |
| 10 | - virtual ~ResourceFinder() = default; | 10 | + ~ResourceFinder() override = default; |
| 11 | void handleObject(QPDFObjectHandle, size_t, size_t) override; | 11 | void handleObject(QPDFObjectHandle, size_t, size_t) override; |
| 12 | void handleEOF() override; | 12 | void handleEOF() override; |
| 13 | std::set<std::string> const& getNames() const; | 13 | std::set<std::string> const& getNames() const; |
libqpdf/qpdf/SF_ASCII85Decode.hh
| @@ -9,7 +9,7 @@ class SF_ASCII85Decode: public QPDFStreamFilter | @@ -9,7 +9,7 @@ class SF_ASCII85Decode: public QPDFStreamFilter | ||
| 9 | { | 9 | { |
| 10 | public: | 10 | public: |
| 11 | SF_ASCII85Decode() = default; | 11 | SF_ASCII85Decode() = default; |
| 12 | - virtual ~SF_ASCII85Decode() = default; | 12 | + ~SF_ASCII85Decode() override = default; |
| 13 | 13 | ||
| 14 | Pipeline* | 14 | Pipeline* |
| 15 | getDecodePipeline(Pipeline* next) override | 15 | getDecodePipeline(Pipeline* next) override |
libqpdf/qpdf/SF_ASCIIHexDecode.hh
| @@ -9,7 +9,7 @@ class SF_ASCIIHexDecode: public QPDFStreamFilter | @@ -9,7 +9,7 @@ class SF_ASCIIHexDecode: public QPDFStreamFilter | ||
| 9 | { | 9 | { |
| 10 | public: | 10 | public: |
| 11 | SF_ASCIIHexDecode() = default; | 11 | SF_ASCIIHexDecode() = default; |
| 12 | - virtual ~SF_ASCIIHexDecode() = default; | 12 | + ~SF_ASCIIHexDecode() override = default; |
| 13 | 13 | ||
| 14 | Pipeline* | 14 | Pipeline* |
| 15 | getDecodePipeline(Pipeline* next) override | 15 | getDecodePipeline(Pipeline* next) override |
libqpdf/qpdf/SF_DCTDecode.hh
| @@ -9,7 +9,7 @@ class SF_DCTDecode: public QPDFStreamFilter | @@ -9,7 +9,7 @@ class SF_DCTDecode: public QPDFStreamFilter | ||
| 9 | { | 9 | { |
| 10 | public: | 10 | public: |
| 11 | SF_DCTDecode() = default; | 11 | SF_DCTDecode() = default; |
| 12 | - virtual ~SF_DCTDecode() = default; | 12 | + ~SF_DCTDecode() override = default; |
| 13 | 13 | ||
| 14 | Pipeline* | 14 | Pipeline* |
| 15 | getDecodePipeline(Pipeline* next) override | 15 | getDecodePipeline(Pipeline* next) override |
libqpdf/qpdf/SF_FlateLzwDecode.hh
| @@ -9,10 +9,10 @@ class SF_FlateLzwDecode: public QPDFStreamFilter | @@ -9,10 +9,10 @@ class SF_FlateLzwDecode: public QPDFStreamFilter | ||
| 9 | { | 9 | { |
| 10 | public: | 10 | public: |
| 11 | SF_FlateLzwDecode(bool lzw); | 11 | SF_FlateLzwDecode(bool lzw); |
| 12 | - virtual ~SF_FlateLzwDecode() = default; | 12 | + ~SF_FlateLzwDecode() override = default; |
| 13 | 13 | ||
| 14 | - virtual bool setDecodeParms(QPDFObjectHandle decode_parms); | ||
| 15 | - virtual Pipeline* getDecodePipeline(Pipeline* next); | 14 | + bool setDecodeParms(QPDFObjectHandle decode_parms) override; |
| 15 | + Pipeline* getDecodePipeline(Pipeline* next) override; | ||
| 16 | 16 | ||
| 17 | static std::shared_ptr<QPDFStreamFilter> flate_factory(); | 17 | static std::shared_ptr<QPDFStreamFilter> flate_factory(); |
| 18 | static std::shared_ptr<QPDFStreamFilter> lzw_factory(); | 18 | static std::shared_ptr<QPDFStreamFilter> lzw_factory(); |
libqpdf/qpdf/SF_RunLengthDecode.hh
| @@ -9,7 +9,7 @@ class SF_RunLengthDecode: public QPDFStreamFilter | @@ -9,7 +9,7 @@ class SF_RunLengthDecode: public QPDFStreamFilter | ||
| 9 | { | 9 | { |
| 10 | public: | 10 | public: |
| 11 | SF_RunLengthDecode() = default; | 11 | SF_RunLengthDecode() = default; |
| 12 | - virtual ~SF_RunLengthDecode() = default; | 12 | + ~SF_RunLengthDecode() override = default; |
| 13 | 13 | ||
| 14 | Pipeline* | 14 | Pipeline* |
| 15 | getDecodePipeline(Pipeline* next) override | 15 | getDecodePipeline(Pipeline* next) override |
libqpdf/qpdf/SecureRandomDataProvider.hh
| @@ -7,8 +7,8 @@ class SecureRandomDataProvider: public RandomDataProvider | @@ -7,8 +7,8 @@ class SecureRandomDataProvider: public RandomDataProvider | ||
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | SecureRandomDataProvider() = default; | 9 | SecureRandomDataProvider() = default; |
| 10 | - virtual ~SecureRandomDataProvider() = default; | ||
| 11 | - virtual void provideRandomData(unsigned char* data, size_t len); | 10 | + ~SecureRandomDataProvider() override = default; |
| 11 | + void provideRandomData(unsigned char* data, size_t len) override; | ||
| 12 | static RandomDataProvider* getInstance(); | 12 | static RandomDataProvider* getInstance(); |
| 13 | }; | 13 | }; |
| 14 | 14 |
libtests/arg_parser.cc
| @@ -28,12 +28,11 @@ class ArgParser | @@ -28,12 +28,11 @@ class ArgParser | ||
| 28 | void output(std::string const&); | 28 | void output(std::string const&); |
| 29 | 29 | ||
| 30 | QPDFArgParser ap; | 30 | QPDFArgParser ap; |
| 31 | - int quacks; | 31 | + int quacks{0}; |
| 32 | }; | 32 | }; |
| 33 | 33 | ||
| 34 | ArgParser::ArgParser(int argc, char* argv[]) : | 34 | ArgParser::ArgParser(int argc, char* argv[]) : |
| 35 | - ap(QPDFArgParser(argc, argv, "TEST_ARG_PARSER")), | ||
| 36 | - quacks(0) | 35 | + ap(QPDFArgParser(argc, argv, "TEST_ARG_PARSER")) |
| 37 | { | 36 | { |
| 38 | initOptions(); | 37 | initOptions(); |
| 39 | } | 38 | } |
libtests/dct_compress.cc
| @@ -10,21 +10,17 @@ | @@ -10,21 +10,17 @@ | ||
| 10 | static void | 10 | static void |
| 11 | usage() | 11 | usage() |
| 12 | { | 12 | { |
| 13 | - std::cerr << "Usage: dct_compress infile outfile width height" | ||
| 14 | - << " {rgb|cmyk|gray}" << std::endl; | 13 | + std::cerr << "Usage: dct_compress infile outfile width height {rgb|cmyk|gray}" << std::endl; |
| 15 | exit(2); | 14 | exit(2); |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 18 | class Callback: public Pl_DCT::CompressConfig | 17 | class Callback: public Pl_DCT::CompressConfig |
| 19 | { | 18 | { |
| 20 | public: | 19 | public: |
| 21 | - Callback() : | ||
| 22 | - called(false) | ||
| 23 | - { | ||
| 24 | - } | 20 | + Callback() = default; |
| 25 | ~Callback() override = default; | 21 | ~Callback() override = default; |
| 26 | void apply(jpeg_compress_struct*) override; | 22 | void apply(jpeg_compress_struct*) override; |
| 27 | - bool called; | 23 | + bool called{false}; |
| 28 | }; | 24 | }; |
| 29 | 25 | ||
| 30 | void | 26 | void |
libtests/json_parse.cc
| @@ -10,7 +10,7 @@ namespace | @@ -10,7 +10,7 @@ namespace | ||
| 10 | class Reactor: public JSON::Reactor | 10 | class Reactor: public JSON::Reactor |
| 11 | { | 11 | { |
| 12 | public: | 12 | public: |
| 13 | - virtual ~Reactor() = default; | 13 | + ~Reactor() override = default; |
| 14 | void dictionaryStart() override; | 14 | void dictionaryStart() override; |
| 15 | void arrayStart() override; | 15 | void arrayStart() override; |
| 16 | void containerEnd(JSON const& value) override; | 16 | void containerEnd(JSON const& value) override; |
libtests/random.cc
| @@ -6,10 +6,10 @@ | @@ -6,10 +6,10 @@ | ||
| 6 | class BogusRandomDataProvider: public RandomDataProvider | 6 | class BogusRandomDataProvider: public RandomDataProvider |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | - virtual ~BogusRandomDataProvider() = default; | 9 | + ~BogusRandomDataProvider() override = default; |
| 10 | BogusRandomDataProvider() = default; | 10 | BogusRandomDataProvider() = default; |
| 11 | - virtual void | ||
| 12 | - provideRandomData(unsigned char* data, size_t len) | 11 | + void |
| 12 | + provideRandomData(unsigned char* data, size_t len) override | ||
| 13 | { | 13 | { |
| 14 | for (size_t i = 0; i < len; ++i) { | 14 | for (size_t i = 0; i < len; ++i) { |
| 15 | data[i] = static_cast<unsigned char>(i & 0xff); | 15 | data[i] = static_cast<unsigned char>(i & 0xff); |
qpdf/fix-qdf.cc
| @@ -46,42 +46,29 @@ class QdfFixer | @@ -46,42 +46,29 @@ class QdfFixer | ||
| 46 | st_before_trailer, | 46 | st_before_trailer, |
| 47 | st_in_trailer, | 47 | st_in_trailer, |
| 48 | st_done, | 48 | st_done, |
| 49 | - } state; | 49 | + } state{st_top}; |
| 50 | 50 | ||
| 51 | - size_t lineno; | ||
| 52 | - qpdf_offset_t offset; | ||
| 53 | - qpdf_offset_t last_offset; | ||
| 54 | - int last_obj; | 51 | + size_t lineno{0}; |
| 52 | + qpdf_offset_t offset{0}; | ||
| 53 | + qpdf_offset_t last_offset{0}; | ||
| 54 | + int last_obj{0}; | ||
| 55 | std::vector<QPDFXRefEntry> xref; | 55 | std::vector<QPDFXRefEntry> xref; |
| 56 | - qpdf_offset_t stream_start; | ||
| 57 | - size_t stream_length; | ||
| 58 | - qpdf_offset_t xref_offset; | ||
| 59 | - size_t xref_f1_nbytes; | ||
| 60 | - size_t xref_f2_nbytes; | ||
| 61 | - size_t xref_size; | 56 | + qpdf_offset_t stream_start{0}; |
| 57 | + size_t stream_length{0}; | ||
| 58 | + qpdf_offset_t xref_offset{0}; | ||
| 59 | + size_t xref_f1_nbytes{0}; | ||
| 60 | + size_t xref_f2_nbytes{0}; | ||
| 61 | + size_t xref_size{0}; | ||
| 62 | std::vector<std::string_view> ostream; | 62 | std::vector<std::string_view> ostream; |
| 63 | std::vector<qpdf_offset_t> ostream_offsets; | 63 | std::vector<qpdf_offset_t> ostream_offsets; |
| 64 | std::vector<std::string_view> ostream_discarded; | 64 | std::vector<std::string_view> ostream_discarded; |
| 65 | - size_t ostream_idx; | ||
| 66 | - int ostream_id; | 65 | + size_t ostream_idx{0}; |
| 66 | + int ostream_id{0}; | ||
| 67 | std::string ostream_extends; | 67 | std::string ostream_extends; |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | QdfFixer::QdfFixer(std::string const& filename) : | 70 | QdfFixer::QdfFixer(std::string const& filename) : |
| 71 | - filename(filename), | ||
| 72 | - state(st_top), | ||
| 73 | - lineno(0), | ||
| 74 | - offset(0), | ||
| 75 | - last_offset(0), | ||
| 76 | - last_obj(0), | ||
| 77 | - stream_start(0), | ||
| 78 | - stream_length(0), | ||
| 79 | - xref_offset(0), | ||
| 80 | - xref_f1_nbytes(0), | ||
| 81 | - xref_f2_nbytes(0), | ||
| 82 | - xref_size(0), | ||
| 83 | - ostream_idx(0), | ||
| 84 | - ostream_id(0) | 71 | + filename(filename) |
| 85 | { | 72 | { |
| 86 | } | 73 | } |
| 87 | 74 |
qpdf/test_driver.cc
| @@ -51,7 +51,7 @@ class ExtendNameTree: public QPDFNameTreeObjectHelper | @@ -51,7 +51,7 @@ class ExtendNameTree: public QPDFNameTreeObjectHelper | ||
| 51 | { | 51 | { |
| 52 | public: | 52 | public: |
| 53 | ExtendNameTree(QPDFObjectHandle o, QPDF& q); | 53 | ExtendNameTree(QPDFObjectHandle o, QPDF& q); |
| 54 | - virtual ~ExtendNameTree(); | 54 | + ~ExtendNameTree() override; |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | ExtendNameTree::ExtendNameTree(QPDFObjectHandle o, QPDF& q) : | 57 | ExtendNameTree::ExtendNameTree(QPDFObjectHandle o, QPDF& q) : |
| @@ -68,16 +68,15 @@ class Provider: public QPDFObjectHandle::StreamDataProvider | @@ -68,16 +68,15 @@ class Provider: public QPDFObjectHandle::StreamDataProvider | ||
| 68 | { | 68 | { |
| 69 | public: | 69 | public: |
| 70 | Provider(std::shared_ptr<Buffer> b) : | 70 | Provider(std::shared_ptr<Buffer> b) : |
| 71 | - b(b), | ||
| 72 | - bad_length(false) | 71 | + b(b) |
| 73 | { | 72 | { |
| 74 | } | 73 | } |
| 75 | - virtual ~Provider() = default; | ||
| 76 | - virtual void | ||
| 77 | - provideStreamData(int objid, int generation, Pipeline* p) | 74 | + ~Provider() override = default; |
| 75 | + void | ||
| 76 | + provideStreamData(int objid, int generation, Pipeline* p) override | ||
| 78 | { | 77 | { |
| 79 | - // Don't change signature to use QPDFObjGen const& to detect | ||
| 80 | - // problems forwarding to legacy implementations. | 78 | + // Don't change signature to use QPDFObjGen const& to detect problems forwarding to legacy |
| 79 | + // implementations. | ||
| 81 | p->write(b->getBuffer(), b->getSize()); | 80 | p->write(b->getBuffer(), b->getSize()); |
| 82 | if (this->bad_length) { | 81 | if (this->bad_length) { |
| 83 | unsigned char ch = ' '; | 82 | unsigned char ch = ' '; |
| @@ -93,16 +92,16 @@ class Provider: public QPDFObjectHandle::StreamDataProvider | @@ -93,16 +92,16 @@ class Provider: public QPDFObjectHandle::StreamDataProvider | ||
| 93 | 92 | ||
| 94 | private: | 93 | private: |
| 95 | std::shared_ptr<Buffer> b; | 94 | std::shared_ptr<Buffer> b; |
| 96 | - bool bad_length; | 95 | + bool bad_length{false}; |
| 97 | }; | 96 | }; |
| 98 | 97 | ||
| 99 | class ParserCallbacks: public QPDFObjectHandle::ParserCallbacks | 98 | class ParserCallbacks: public QPDFObjectHandle::ParserCallbacks |
| 100 | { | 99 | { |
| 101 | public: | 100 | public: |
| 102 | - virtual ~ParserCallbacks() = default; | ||
| 103 | - virtual void contentSize(size_t size); | ||
| 104 | - virtual void handleObject(QPDFObjectHandle, size_t, size_t); | ||
| 105 | - virtual void handleEOF(); | 101 | + ~ParserCallbacks() override = default; |
| 102 | + void contentSize(size_t size) override; | ||
| 103 | + void handleObject(QPDFObjectHandle, size_t, size_t) override; | ||
| 104 | + void handleEOF() override; | ||
| 106 | }; | 105 | }; |
| 107 | 106 | ||
| 108 | void | 107 | void |
| @@ -138,9 +137,9 @@ class TokenFilter: public QPDFObjectHandle::TokenFilter | @@ -138,9 +137,9 @@ class TokenFilter: public QPDFObjectHandle::TokenFilter | ||
| 138 | { | 137 | { |
| 139 | public: | 138 | public: |
| 140 | TokenFilter() = default; | 139 | TokenFilter() = default; |
| 141 | - virtual ~TokenFilter() = default; | ||
| 142 | - virtual void | ||
| 143 | - handleToken(QPDFTokenizer::Token const& t) | 140 | + ~TokenFilter() override = default; |
| 141 | + void | ||
| 142 | + handleToken(QPDFTokenizer::Token const& t) override | ||
| 144 | { | 143 | { |
| 145 | if (t == QPDFTokenizer::Token(QPDFTokenizer::tt_string, "Potato")) { | 144 | if (t == QPDFTokenizer::Token(QPDFTokenizer::tt_string, "Potato")) { |
| 146 | // Exercise unparsing of strings by token constructor | 145 | // Exercise unparsing of strings by token constructor |
| @@ -149,8 +148,8 @@ class TokenFilter: public QPDFObjectHandle::TokenFilter | @@ -149,8 +148,8 @@ class TokenFilter: public QPDFObjectHandle::TokenFilter | ||
| 149 | writeToken(t); | 148 | writeToken(t); |
| 150 | } | 149 | } |
| 151 | } | 150 | } |
| 152 | - virtual void | ||
| 153 | - handleEOF() | 151 | + void |
| 152 | + handleEOF() override | ||
| 154 | { | 153 | { |
| 155 | writeToken(QPDFTokenizer::Token(QPDFTokenizer::tt_name, "/bye")); | 154 | writeToken(QPDFTokenizer::Token(QPDFTokenizer::tt_name, "/bye")); |
| 156 | write("\n"); | 155 | write("\n"); |
| @@ -2577,7 +2576,7 @@ test_76(QPDF& pdf, char const* arg2) | @@ -2577,7 +2576,7 @@ test_76(QPDF& pdf, char const* arg2) | ||
| 2577 | assert(efs2.getSubtype() == "text/plain"); | 2576 | assert(efs2.getSubtype() == "text/plain"); |
| 2578 | assert(QUtil::hex_encode(efs2.getChecksum()) == "2fce9c8228e360ba9b04a1bd1bf63d6b"); | 2577 | assert(QUtil::hex_encode(efs2.getChecksum()) == "2fce9c8228e360ba9b04a1bd1bf63d6b"); |
| 2579 | 2578 | ||
| 2580 | - for (auto iter: efdh.getEmbeddedFiles()) { | 2579 | + for (auto const& iter: efdh.getEmbeddedFiles()) { |
| 2581 | std::cout << iter.first << " -> " << iter.second->getFilename() << std::endl; | 2580 | std::cout << iter.first << " -> " << iter.second->getFilename() << std::endl; |
| 2582 | } | 2581 | } |
| 2583 | assert(efdh.getEmbeddedFile("att1")->getFilename() == "att1.txt"); | 2582 | assert(efdh.getEmbeddedFile("att1")->getFilename() == "att1.txt"); |
qpdf/test_large_file.cc
| @@ -61,21 +61,19 @@ class ImageChecker: public Pipeline | @@ -61,21 +61,19 @@ class ImageChecker: public Pipeline | ||
| 61 | { | 61 | { |
| 62 | public: | 62 | public: |
| 63 | ImageChecker(size_t n); | 63 | ImageChecker(size_t n); |
| 64 | - virtual ~ImageChecker() = default; | ||
| 65 | - virtual void write(unsigned char const* data, size_t len); | ||
| 66 | - virtual void finish(); | 64 | + ~ImageChecker() override = default; |
| 65 | + void write(unsigned char const* data, size_t len) override; | ||
| 66 | + void finish() override; | ||
| 67 | 67 | ||
| 68 | private: | 68 | private: |
| 69 | size_t n; | 69 | size_t n; |
| 70 | - size_t offset; | ||
| 71 | - bool okay; | 70 | + size_t offset{0}; |
| 71 | + bool okay{true}; | ||
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | ImageChecker::ImageChecker(size_t n) : | 74 | ImageChecker::ImageChecker(size_t n) : |
| 75 | Pipeline("image checker", nullptr), | 75 | Pipeline("image checker", nullptr), |
| 76 | - n(n), | ||
| 77 | - offset(0), | ||
| 78 | - okay(true) | 76 | + n(n) |
| 79 | { | 77 | { |
| 80 | } | 78 | } |
| 81 | 79 | ||
| @@ -104,8 +102,8 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider | @@ -104,8 +102,8 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider | ||
| 104 | { | 102 | { |
| 105 | public: | 103 | public: |
| 106 | ImageProvider(size_t n); | 104 | ImageProvider(size_t n); |
| 107 | - virtual ~ImageProvider() = default; | ||
| 108 | - virtual void provideStreamData(int objid, int generation, Pipeline* pipeline); | 105 | + ~ImageProvider() override = default; |
| 106 | + void provideStreamData(int objid, int generation, Pipeline* pipeline) override; | ||
| 109 | 107 | ||
| 110 | private: | 108 | private: |
| 111 | size_t n; | 109 | size_t n; |
qpdf/test_tokenizer.cc
| @@ -28,8 +28,8 @@ class Finder: public InputSource::Finder | @@ -28,8 +28,8 @@ class Finder: public InputSource::Finder | ||
| 28 | str(str) | 28 | str(str) |
| 29 | { | 29 | { |
| 30 | } | 30 | } |
| 31 | - virtual ~Finder() = default; | ||
| 32 | - virtual bool check(); | 31 | + ~Finder() override = default; |
| 32 | + bool check() override; | ||
| 33 | 33 | ||
| 34 | private: | 34 | private: |
| 35 | std::shared_ptr<InputSource> is; | 35 | std::shared_ptr<InputSource> is; |