Commit fd17c8e3fe38a56abf50ce0edec1cde48d4f74cb

Authored by Jay Berkenbilt
Committed by GitHub
2 parents a6d7b79e e6577a13

Merge pull request #963 from m-holger/tidy

Code tidy
Showing 148 changed files with 400 additions and 483 deletions

Too many changes.

To preserve performance only 100 of 148 files are displayed.

examples/pdf-bookmarks.cc
@@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
5 #include <qpdf/QTC.hh> 5 #include <qpdf/QTC.hh>
6 #include <qpdf/QUtil.hh> 6 #include <qpdf/QUtil.hh>
7 #include <iostream> 7 #include <iostream>
8 -#include <stdlib.h>  
9 -#include <string.h> 8 +#include <cstdlib>
  9 +#include <cstring>
10 10
11 // This program demonstrates extraction of bookmarks using the qpdf 11 // This program demonstrates extraction of bookmarks using the qpdf
12 // outlines API. Note that all the information shown by this program 12 // outlines API. Note that all the information shown by this program
examples/pdf-count-strings.cc
@@ -5,14 +5,12 @@ @@ -5,14 +5,12 @@
5 // 5 //
6 6
7 #include <iostream> 7 #include <iostream>
8 -#include <stdlib.h>  
9 -#include <string.h> 8 +#include <cstdlib>
10 9
11 #include <qpdf/Pl_StdioFile.hh> 10 #include <qpdf/Pl_StdioFile.hh>
12 #include <qpdf/QPDF.hh> 11 #include <qpdf/QPDF.hh>
13 #include <qpdf/QPDFObjectHandle.hh> 12 #include <qpdf/QPDFObjectHandle.hh>
14 #include <qpdf/QPDFPageDocumentHelper.hh> 13 #include <qpdf/QPDFPageDocumentHelper.hh>
15 -#include <qpdf/QPDFPageObjectHelper.hh>  
16 #include <qpdf/QUtil.hh> 14 #include <qpdf/QUtil.hh>
17 15
18 static char const* whoami = nullptr; 16 static char const* whoami = nullptr;
@@ -32,9 +30,9 @@ class StringCounter: public QPDFObjectHandle::TokenFilter @@ -32,9 +30,9 @@ class StringCounter: public QPDFObjectHandle::TokenFilter
32 count(0) 30 count(0)
33 { 31 {
34 } 32 }
35 - virtual ~StringCounter() = default;  
36 - virtual void handleToken(QPDFTokenizer::Token const&);  
37 - virtual void handleEOF(); 33 + ~StringCounter() override = default;
  34 + void handleToken(QPDFTokenizer::Token const&) override;
  35 + void handleEOF() override;
38 int getCount() const; 36 int getCount() const;
39 37
40 private: 38 private:
examples/pdf-create.cc
@@ -12,13 +12,11 @@ @@ -12,13 +12,11 @@
12 #include <qpdf/QPDF.hh> 12 #include <qpdf/QPDF.hh>
13 #include <qpdf/QPDFObjectHandle.hh> 13 #include <qpdf/QPDFObjectHandle.hh>
14 #include <qpdf/QPDFPageDocumentHelper.hh> 14 #include <qpdf/QPDFPageDocumentHelper.hh>
15 -#include <qpdf/QPDFPageObjectHelper.hh>  
16 #include <qpdf/QPDFWriter.hh> 15 #include <qpdf/QPDFWriter.hh>
17 #include <qpdf/QUtil.hh> 16 #include <qpdf/QUtil.hh>
18 #include <iostream> 17 #include <iostream>
19 #include <memory> 18 #include <memory>
20 -#include <stdlib.h>  
21 -#include <string.h> 19 +#include <cstdlib>
22 20
23 static char const* whoami = nullptr; 21 static char const* whoami = nullptr;
24 22
@@ -28,8 +26,8 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider @@ -28,8 +26,8 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider
28 { 26 {
29 public: 27 public:
30 ImageProvider(std::string const& color_space, std::string const& filter); 28 ImageProvider(std::string const& color_space, std::string const& filter);
31 - virtual ~ImageProvider() = default;  
32 - virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline); 29 + ~ImageProvider() override = default;
  30 + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override;
33 size_t getWidth() const; 31 size_t getWidth() const;
34 size_t getHeight() const; 32 size_t getHeight() const;
35 33
@@ -168,7 +166,7 @@ add_page( @@ -168,7 +166,7 @@ add_page(
168 // mode. Since we are not specifying, QPDFWriter will compress 166 // mode. Since we are not specifying, QPDFWriter will compress
169 // with /FlateDecode if we don't provide any other form of 167 // with /FlateDecode if we don't provide any other form of
170 // compression. 168 // compression.
171 - ImageProvider* p = new ImageProvider(color_space, filter); 169 + auto* p = new ImageProvider(color_space, filter);
172 std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p); 170 std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
173 size_t width = p->getWidth(); 171 size_t width = p->getWidth();
174 size_t height = p->getHeight(); 172 size_t height = p->getHeight();
@@ -288,7 +286,7 @@ check( @@ -288,7 +286,7 @@ check(
288 if (!this_errors) { 286 if (!this_errors) {
289 // Check image data 287 // Check image data
290 auto actual_data = image.getStreamData(qpdf_dl_all); 288 auto actual_data = image.getStreamData(qpdf_dl_all);
291 - ImageProvider* p = new ImageProvider(desired_color_space, "null"); 289 + auto* p = new ImageProvider(desired_color_space, "null");
292 std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p); 290 std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
293 Pl_Buffer b_p("get image data"); 291 Pl_Buffer b_p("get image data");
294 provider->provideStreamData(QPDFObjGen(), &b_p); 292 provider->provideStreamData(QPDFObjGen(), &b_p);
examples/pdf-custom-filter.cc
@@ -48,9 +48,9 @@ class Pl_XOR: public Pipeline @@ -48,9 +48,9 @@ class Pl_XOR: public Pipeline
48 48
49 public: 49 public:
50 Pl_XOR(char const* identifier, Pipeline* next, unsigned char key); 50 Pl_XOR(char const* identifier, Pipeline* next, unsigned char key);
51 - virtual ~Pl_XOR() = default;  
52 - virtual void write(unsigned char const* data, size_t len) override;  
53 - virtual void finish() override; 51 + ~Pl_XOR() override = default;
  52 + void write(unsigned char const* data, size_t len) override;
  53 + void finish() override;
54 54
55 private: 55 private:
56 unsigned char key; 56 unsigned char key;
@@ -91,10 +91,10 @@ class SF_XORDecode: public QPDFStreamFilter @@ -91,10 +91,10 @@ class SF_XORDecode: public QPDFStreamFilter
91 // filter, which just means QPDF assumes that it should not 91 // filter, which just means QPDF assumes that it should not
92 // "uncompress" the stream by default. 92 // "uncompress" the stream by default.
93 public: 93 public:
94 - virtual ~SF_XORDecode() = default;  
95 - virtual bool setDecodeParms(QPDFObjectHandle decode_parms) override;  
96 - virtual Pipeline* getDecodePipeline(Pipeline* next) override;  
97 - virtual bool isSpecializedCompression() override; 94 + ~SF_XORDecode() override = default;
  95 + bool setDecodeParms(QPDFObjectHandle decode_parms) override;
  96 + Pipeline* getDecodePipeline(Pipeline* next) override;
  97 + bool isSpecializedCompression() override;
98 98
99 private: 99 private:
100 unsigned char key; 100 unsigned char key;
@@ -199,8 +199,8 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider @@ -199,8 +199,8 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider
199 199
200 public: 200 public:
201 StreamReplacer(QPDF* pdf); 201 StreamReplacer(QPDF* pdf);
202 - virtual ~StreamReplacer() = default;  
203 - virtual void 202 + ~StreamReplacer() override = default;
  203 + void
204 provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override; 204 provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
205 205
206 void registerStream( 206 void registerStream(
@@ -409,7 +409,7 @@ process( @@ -409,7 +409,7 @@ process(
409 // Create a single StreamReplacer instance. The interface requires 409 // Create a single StreamReplacer instance. The interface requires
410 // a std::shared_ptr in various places, so allocate a StreamReplacer 410 // a std::shared_ptr in various places, so allocate a StreamReplacer
411 // and stash it in a std::shared_ptr. 411 // and stash it in a std::shared_ptr.
412 - StreamReplacer* replacer = new StreamReplacer(&qpdf); 412 + auto* replacer = new StreamReplacer(&qpdf);
413 std::shared_ptr<QPDFObjectHandle::StreamDataProvider> p(replacer); 413 std::shared_ptr<QPDFObjectHandle::StreamDataProvider> p(replacer);
414 414
415 for (auto& o: qpdf.getAllObjects()) { 415 for (auto& o: qpdf.getAllObjects()) {
examples/pdf-double-page-size.cc
@@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
5 #include <qpdf/QPDFWriter.hh> 5 #include <qpdf/QPDFWriter.hh>
6 #include <qpdf/QUtil.hh> 6 #include <qpdf/QUtil.hh>
7 #include <iostream> 7 #include <iostream>
8 -#include <stdlib.h>  
9 -#include <string.h> 8 +#include <cstdlib>
  9 +#include <cstring>
10 10
11 static char const* whoami = nullptr; 11 static char const* whoami = nullptr;
12 12
examples/pdf-filter-tokens.cc
@@ -8,13 +8,11 @@ @@ -8,13 +8,11 @@
8 #include <algorithm> 8 #include <algorithm>
9 #include <deque> 9 #include <deque>
10 #include <iostream> 10 #include <iostream>
11 -#include <stdlib.h>  
12 -#include <string.h> 11 +#include <cstdlib>
13 12
14 #include <qpdf/QPDF.hh> 13 #include <qpdf/QPDF.hh>
15 #include <qpdf/QPDFObjectHandle.hh> 14 #include <qpdf/QPDFObjectHandle.hh>
16 #include <qpdf/QPDFPageDocumentHelper.hh> 15 #include <qpdf/QPDFPageDocumentHelper.hh>
17 -#include <qpdf/QPDFPageObjectHelper.hh>  
18 #include <qpdf/QPDFWriter.hh> 16 #include <qpdf/QPDFWriter.hh>
19 #include <qpdf/QUtil.hh> 17 #include <qpdf/QUtil.hh>
20 18
@@ -35,8 +33,8 @@ usage() @@ -35,8 +33,8 @@ usage()
35 class StringReverser: public QPDFObjectHandle::TokenFilter 33 class StringReverser: public QPDFObjectHandle::TokenFilter
36 { 34 {
37 public: 35 public:
38 - virtual ~StringReverser() = default;  
39 - virtual void handleToken(QPDFTokenizer::Token const&); 36 + ~StringReverser() override = default;
  37 + void handleToken(QPDFTokenizer::Token const&) override;
40 }; 38 };
41 39
42 void 40 void
@@ -68,9 +66,9 @@ StringReverser::handleToken(QPDFTokenizer::Token const&amp; token) @@ -68,9 +66,9 @@ StringReverser::handleToken(QPDFTokenizer::Token const&amp; token)
68 class ColorToGray: public QPDFObjectHandle::TokenFilter 66 class ColorToGray: public QPDFObjectHandle::TokenFilter
69 { 67 {
70 public: 68 public:
71 - virtual ~ColorToGray() = default;  
72 - virtual void handleToken(QPDFTokenizer::Token const&);  
73 - virtual void handleEOF(); 69 + ~ColorToGray() override = default;
  70 + void handleToken(QPDFTokenizer::Token const&) override;
  71 + void handleEOF() override;
74 72
75 private: 73 private:
76 bool isNumeric(QPDFTokenizer::token_type_e); 74 bool isNumeric(QPDFTokenizer::token_type_e);
examples/pdf-invert-images.cc
@@ -6,8 +6,8 @@ @@ -6,8 +6,8 @@
6 #include <qpdf/QPDFWriter.hh> 6 #include <qpdf/QPDFWriter.hh>
7 #include <qpdf/QUtil.hh> 7 #include <qpdf/QUtil.hh>
8 #include <iostream> 8 #include <iostream>
9 -#include <stdlib.h>  
10 -#include <string.h> 9 +#include <cstdlib>
  10 +#include <cstring>
11 11
12 static char const* whoami = nullptr; 12 static char const* whoami = nullptr;
13 13
@@ -33,8 +33,8 @@ usage() @@ -33,8 +33,8 @@ usage()
33 class ImageInverter: public QPDFObjectHandle::StreamDataProvider 33 class ImageInverter: public QPDFObjectHandle::StreamDataProvider
34 { 34 {
35 public: 35 public:
36 - virtual ~ImageInverter() = default;  
37 - virtual void 36 + ~ImageInverter() override = default;
  37 + void
38 provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override; 38 provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
39 39
40 void registerImage( 40 void registerImage(
@@ -124,7 +124,7 @@ main(int argc, char* argv[]) @@ -124,7 +124,7 @@ main(int argc, char* argv[])
124 QPDF qpdf; 124 QPDF qpdf;
125 qpdf.processFile(infilename, password); 125 qpdf.processFile(infilename, password);
126 126
127 - ImageInverter* inv = new ImageInverter; 127 + auto* inv = new ImageInverter;
128 auto p = std::shared_ptr<QPDFObjectHandle::StreamDataProvider>(inv); 128 auto p = std::shared_ptr<QPDFObjectHandle::StreamDataProvider>(inv);
129 129
130 // For each page... 130 // For each page...
examples/pdf-mod-info.cc
@@ -6,9 +6,9 @@ @@ -6,9 +6,9 @@
6 #include <qpdf/QTC.hh> 6 #include <qpdf/QTC.hh>
7 #include <qpdf/QUtil.hh> 7 #include <qpdf/QUtil.hh>
8 #include <iostream> 8 #include <iostream>
9 -#include <stdio.h>  
10 -#include <stdlib.h>  
11 -#include <string.h> 9 +#include <cstdio>
  10 +#include <cstdlib>
  11 +#include <cstring>
12 12
13 static char const* version = "1.1"; 13 static char const* version = "1.1";
14 static char const* whoami = nullptr; 14 static char const* whoami = nullptr;
examples/pdf-name-number-tree.cc
@@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
3 #include <qpdf/QPDFNumberTreeObjectHelper.hh> 3 #include <qpdf/QPDFNumberTreeObjectHelper.hh>
4 #include <qpdf/QPDFWriter.hh> 4 #include <qpdf/QPDFWriter.hh>
5 #include <qpdf/QUtil.hh> 5 #include <qpdf/QUtil.hh>
6 -#include <cstring>  
7 #include <iostream> 6 #include <iostream>
8 7
9 static char const* whoami = nullptr; 8 static char const* whoami = nullptr;
examples/pdf-npages.cc
1 #include <iostream> 1 #include <iostream>
2 -#include <stdlib.h>  
3 -#include <string.h> 2 +#include <cstdlib>
  3 +#include <cstring>
4 4
5 #include <qpdf/QPDF.hh> 5 #include <qpdf/QPDF.hh>
6 #include <qpdf/QUtil.hh> 6 #include <qpdf/QUtil.hh>
examples/pdf-overlay-page.cc
@@ -4,8 +4,7 @@ @@ -4,8 +4,7 @@
4 #include <qpdf/QPDFWriter.hh> 4 #include <qpdf/QPDFWriter.hh>
5 #include <qpdf/QUtil.hh> 5 #include <qpdf/QUtil.hh>
6 #include <iostream> 6 #include <iostream>
7 -#include <stdlib.h>  
8 -#include <string.h> 7 +#include <cstdlib>
9 8
10 // This program demonstrates use of form XObjects to overlay a page 9 // This program demonstrates use of form XObjects to overlay a page
11 // from one file onto all pages of another file. The qpdf program's 10 // from one file onto all pages of another file. The qpdf program's
examples/pdf-parse-content.cc
1 #include <iostream> 1 #include <iostream>
2 -#include <stdlib.h>  
3 -#include <string.h> 2 +#include <cstdlib>
4 3
5 #include <qpdf/QIntC.hh> 4 #include <qpdf/QIntC.hh>
6 #include <qpdf/QPDF.hh> 5 #include <qpdf/QPDF.hh>
@@ -23,10 +22,10 @@ usage() @@ -23,10 +22,10 @@ usage()
23 class ParserCallbacks: public QPDFObjectHandle::ParserCallbacks 22 class ParserCallbacks: public QPDFObjectHandle::ParserCallbacks
24 { 23 {
25 public: 24 public:
26 - virtual ~ParserCallbacks() = default;  
27 - virtual void contentSize(size_t);  
28 - virtual void handleObject(QPDFObjectHandle, size_t offset, size_t length);  
29 - virtual void handleEOF(); 25 + ~ParserCallbacks() override = default;
  26 + void contentSize(size_t) override;
  27 + void handleObject(QPDFObjectHandle, size_t offset, size_t length) override;
  28 + void handleEOF() override;
30 }; 29 };
31 30
32 void 31 void
examples/pdf-set-form-values.cc
@@ -4,9 +4,7 @@ @@ -4,9 +4,7 @@
4 #include <qpdf/QPDFWriter.hh> 4 #include <qpdf/QPDFWriter.hh>
5 #include <qpdf/QUtil.hh> 5 #include <qpdf/QUtil.hh>
6 #include <iostream> 6 #include <iostream>
7 -#include <stdio.h>  
8 -#include <stdlib.h>  
9 -#include <string.h> 7 +#include <cstdlib>
10 8
11 static char const* whoami = nullptr; 9 static char const* whoami = nullptr;
12 10
examples/pdf-split-pages.cc
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 12
13 #include <cstring> 13 #include <cstring>
14 #include <iostream> 14 #include <iostream>
15 -#include <stdlib.h> 15 +#include <cstdlib>
16 #include <string> 16 #include <string>
17 17
18 static bool static_id = false; 18 static bool static_id = false;
examples/qpdf-job.cc
1 -#include <qpdf/QIntC.hh>  
2 #include <qpdf/QPDFJob.hh> 1 #include <qpdf/QPDFJob.hh>
3 #include <qpdf/QUtil.hh> 2 #include <qpdf/QUtil.hh>
4 3
5 -#include <cstring>  
6 #include <iostream> 4 #include <iostream>
7 5
8 // This program is a simple demonstration of different ways to use the 6 // This program is a simple demonstration of different ways to use the
examples/qpdfjob-c-save-attachment.c
1 -#include <qpdf/Constants.h>  
2 #include <qpdf/qpdfjob-c.h> 1 #include <qpdf/qpdfjob-c.h>
3 #include <qpdf/qpdflogger-c.h> 2 #include <qpdf/qpdflogger-c.h>
4 3
examples/qpdfjob-remove-annotations.cc
@@ -4,7 +4,6 @@ @@ -4,7 +4,6 @@
4 4
5 #include <cstdio> 5 #include <cstdio>
6 #include <cstdlib> 6 #include <cstdlib>
7 -#include <cstring>  
8 #include <iostream> 7 #include <iostream>
9 8
10 // This example demonstrates how we can use the QPDFJob createQPDF and writeQPDF 9 // This example demonstrates how we can use the QPDFJob createQPDF and writeQPDF
@@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@
12 // The example is a full copy of the qpdf program modified to allways remove all 11 // The example is a full copy of the qpdf program modified to allways remove all
13 // annotations from the final output. 12 // annotations from the final output.
14 13
15 -static char const* whoami = 0; 14 +static char const* whoami = nullptr;
16 15
17 static void 16 static void
18 usageExit(std::string const& msg) 17 usageExit(std::string const& msg)
fuzz/qpdf_fuzzer.cc
@@ -14,13 +14,13 @@ @@ -14,13 +14,13 @@
14 class DiscardContents: public QPDFObjectHandle::ParserCallbacks 14 class DiscardContents: public QPDFObjectHandle::ParserCallbacks
15 { 15 {
16 public: 16 public:
17 - virtual ~DiscardContents() = default;  
18 - virtual void  
19 - handleObject(QPDFObjectHandle) 17 + ~DiscardContents() override = default;
  18 + void
  19 + handleObject(QPDFObjectHandle) override
20 { 20 {
21 } 21 }
22 - virtual void  
23 - handleEOF() 22 + void
  23 + handleEOF() override
24 { 24 {
25 } 25 }
26 }; 26 };
include/qpdf/Buffer.hh
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 #include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785) 26 #include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
27 27
28 #include <memory> 28 #include <memory>
29 -#include <stddef.h> 29 +#include <cstddef>
30 30
31 class Buffer 31 class Buffer
32 { 32 {
include/qpdf/InputSource.hh
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 #include <qpdf/Types.h> 27 #include <qpdf/Types.h>
28 28
29 #include <memory> 29 #include <memory>
30 -#include <stdio.h> 30 +#include <cstdio>
31 #include <string> 31 #include <string>
32 32
33 // Remember to use QPDF_DLL_CLASS on anything derived from InputSource 33 // Remember to use QPDF_DLL_CLASS on anything derived from InputSource
include/qpdf/JSON.hh
@@ -369,8 +369,8 @@ class JSON @@ -369,8 +369,8 @@ class JSON
369 JSON_value(vt_dictionary) 369 JSON_value(vt_dictionary)
370 { 370 {
371 } 371 }
372 - virtual ~JSON_dictionary() = default;  
373 - virtual void write(Pipeline*, size_t depth) const; 372 + ~JSON_dictionary() override = default;
  373 + void write(Pipeline*, size_t depth) const override;
374 std::map<std::string, JSON> members; 374 std::map<std::string, JSON> members;
375 std::set<std::string> parsed_keys; 375 std::set<std::string> parsed_keys;
376 }; 376 };
@@ -380,15 +380,15 @@ class JSON @@ -380,15 +380,15 @@ class JSON
380 JSON_value(vt_array) 380 JSON_value(vt_array)
381 { 381 {
382 } 382 }
383 - virtual ~JSON_array() = default;  
384 - virtual void write(Pipeline*, size_t depth) const; 383 + ~JSON_array() override = default;
  384 + void write(Pipeline*, size_t depth) const override;
385 std::vector<JSON> elements; 385 std::vector<JSON> elements;
386 }; 386 };
387 struct JSON_string: public JSON_value 387 struct JSON_string: public JSON_value
388 { 388 {
389 JSON_string(std::string const& utf8); 389 JSON_string(std::string const& utf8);
390 - virtual ~JSON_string() = default;  
391 - virtual void write(Pipeline*, size_t depth) const; 390 + ~JSON_string() override = default;
  391 + void write(Pipeline*, size_t depth) const override;
392 std::string utf8; 392 std::string utf8;
393 std::string encoded; 393 std::string encoded;
394 }; 394 };
@@ -397,15 +397,15 @@ class JSON @@ -397,15 +397,15 @@ class JSON
397 JSON_number(long long val); 397 JSON_number(long long val);
398 JSON_number(double val); 398 JSON_number(double val);
399 JSON_number(std::string const& val); 399 JSON_number(std::string const& val);
400 - virtual ~JSON_number() = default;  
401 - virtual void write(Pipeline*, size_t depth) const; 400 + ~JSON_number() override = default;
  401 + void write(Pipeline*, size_t depth) const override;
402 std::string encoded; 402 std::string encoded;
403 }; 403 };
404 struct JSON_bool: public JSON_value 404 struct JSON_bool: public JSON_value
405 { 405 {
406 JSON_bool(bool val); 406 JSON_bool(bool val);
407 - virtual ~JSON_bool() = default;  
408 - virtual void write(Pipeline*, size_t depth) const; 407 + ~JSON_bool() override = default;
  408 + void write(Pipeline*, size_t depth) const override;
409 bool value; 409 bool value;
410 }; 410 };
411 struct JSON_null: public JSON_value 411 struct JSON_null: public JSON_value
@@ -414,14 +414,14 @@ class JSON @@ -414,14 +414,14 @@ class JSON
414 JSON_value(vt_null) 414 JSON_value(vt_null)
415 { 415 {
416 } 416 }
417 - virtual ~JSON_null() = default;  
418 - virtual void write(Pipeline*, size_t depth) const; 417 + ~JSON_null() override = default;
  418 + void write(Pipeline*, size_t depth) const override;
419 }; 419 };
420 struct JSON_blob: public JSON_value 420 struct JSON_blob: public JSON_value
421 { 421 {
422 JSON_blob(std::function<void(Pipeline*)> fn); 422 JSON_blob(std::function<void(Pipeline*)> fn);
423 - virtual ~JSON_blob() = default;  
424 - virtual void write(Pipeline*, size_t depth) const; 423 + ~JSON_blob() override = default;
  424 + void write(Pipeline*, size_t depth) const override;
425 std::function<void(Pipeline*)> fn; 425 std::function<void(Pipeline*)> fn;
426 }; 426 };
427 427
include/qpdf/Pl_Buffer.hh
@@ -43,13 +43,13 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline @@ -43,13 +43,13 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
43 { 43 {
44 public: 44 public:
45 QPDF_DLL 45 QPDF_DLL
46 - Pl_Buffer(char const* identifier, Pipeline* next = 0); 46 + Pl_Buffer(char const* identifier, Pipeline* next = nullptr);
47 QPDF_DLL 47 QPDF_DLL
48 - virtual ~Pl_Buffer(); 48 + ~Pl_Buffer() override;
49 QPDF_DLL 49 QPDF_DLL
50 - virtual void write(unsigned char const*, size_t); 50 + void write(unsigned char const*, size_t) override;
51 QPDF_DLL 51 QPDF_DLL
52 - virtual void finish(); 52 + void finish() override;
53 53
54 // Each call to getBuffer() resets this object -- see notes above. 54 // Each call to getBuffer() resets this object -- see notes above.
55 // The caller is responsible for deleting the returned Buffer 55 // The caller is responsible for deleting the returned Buffer
include/qpdf/Pl_DCT.hh
@@ -57,7 +57,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline @@ -57,7 +57,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
57 JDIMENSION image_height, 57 JDIMENSION image_height,
58 int components, 58 int components,
59 J_COLOR_SPACE color_space, 59 J_COLOR_SPACE color_space,
60 - CompressConfig* config_callback = 0); 60 + CompressConfig* config_callback = nullptr);
61 61
62 QPDF_DLL 62 QPDF_DLL
63 virtual ~Pl_DCT(); 63 virtual ~Pl_DCT();
@@ -91,7 +91,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline @@ -91,7 +91,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
91 JDIMENSION image_height = 0, 91 JDIMENSION image_height = 0,
92 int components = 1, 92 int components = 1,
93 J_COLOR_SPACE color_space = JCS_GRAYSCALE, 93 J_COLOR_SPACE color_space = JCS_GRAYSCALE,
94 - CompressConfig* config_callback = 0); 94 + CompressConfig* config_callback = nullptr);
95 Members(Members const&) = delete; 95 Members(Members const&) = delete;
96 96
97 action_e action; 97 action_e action;
include/qpdf/Pl_QPDFTokenizer.hh
@@ -51,7 +51,7 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline @@ -51,7 +51,7 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline
51 Pl_QPDFTokenizer( 51 Pl_QPDFTokenizer(
52 char const* identifier, 52 char const* identifier,
53 QPDFObjectHandle::TokenFilter* filter, 53 QPDFObjectHandle::TokenFilter* filter,
54 - Pipeline* next = 0); 54 + Pipeline* next = nullptr);
55 QPDF_DLL 55 QPDF_DLL
56 virtual ~Pl_QPDFTokenizer(); 56 virtual ~Pl_QPDFTokenizer();
57 QPDF_DLL 57 QPDF_DLL
include/qpdf/Pl_StdioFile.hh
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 26
27 #include <qpdf/Pipeline.hh> 27 #include <qpdf/Pipeline.hh>
28 28
29 -#include <stdio.h> 29 +#include <cstdio>
30 30
31 // 31 //
32 // This pipeline is reusable. 32 // This pipeline is reusable.
include/qpdf/QPDF.hh
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 #include <list> 30 #include <list>
31 #include <map> 31 #include <map>
32 #include <memory> 32 #include <memory>
33 -#include <stdio.h> 33 +#include <cstdio>
34 #include <string> 34 #include <string>
35 #include <string_view> 35 #include <string_view>
36 #include <vector> 36 #include <vector>
@@ -83,7 +83,7 @@ class QPDF @@ -83,7 +83,7 @@ class QPDF
83 // interpreted as a raw encryption key. See comments on 83 // interpreted as a raw encryption key. See comments on
84 // setPasswordIsHexKey for more information. 84 // setPasswordIsHexKey for more information.
85 QPDF_DLL 85 QPDF_DLL
86 - void processFile(char const* filename, char const* password = 0); 86 + void processFile(char const* filename, char const* password = nullptr);
87 87
88 // Parse a PDF from a stdio FILE*. The FILE must be open in 88 // Parse a PDF from a stdio FILE*. The FILE must be open in
89 // binary mode and must be seekable. It may be open read only. 89 // binary mode and must be seekable. It may be open read only.
@@ -96,7 +96,7 @@ class QPDF @@ -96,7 +96,7 @@ class QPDF
96 char const* description, 96 char const* description,
97 FILE* file, 97 FILE* file,
98 bool close_file, 98 bool close_file,
99 - char const* password = 0); 99 + char const* password = nullptr);
100 100
101 // Parse a PDF file loaded into a memory buffer. This works 101 // Parse a PDF file loaded into a memory buffer. This works
102 // exactly like processFile except that the PDF file is in memory 102 // exactly like processFile except that the PDF file is in memory
@@ -107,14 +107,14 @@ class QPDF @@ -107,14 +107,14 @@ class QPDF
107 char const* description, 107 char const* description,
108 char const* buf, 108 char const* buf,
109 size_t length, 109 size_t length,
110 - char const* password = 0); 110 + char const* password = nullptr);
111 111
112 // Parse a PDF file loaded from a custom InputSource. If you have 112 // Parse a PDF file loaded from a custom InputSource. If you have
113 // your own method of retrieving a PDF file, you can subclass 113 // your own method of retrieving a PDF file, you can subclass
114 // InputSource and use this method. 114 // InputSource and use this method.
115 QPDF_DLL 115 QPDF_DLL
116 void 116 void
117 - processInputSource(std::shared_ptr<InputSource>, char const* password = 0); 117 + processInputSource(std::shared_ptr<InputSource>, char const* password = nullptr);
118 118
119 // Create a PDF from an input source that contains JSON as written 119 // Create a PDF from an input source that contains JSON as written
120 // by writeJSON (or qpdf --json-output, version 2 or higher). The 120 // by writeJSON (or qpdf --json-output, version 2 or higher). The
include/qpdf/QPDFCryptoImpl.hh
@@ -80,7 +80,7 @@ class QPDF_DLL_CLASS QPDFCryptoImpl @@ -80,7 +80,7 @@ class QPDF_DLL_CLASS QPDFCryptoImpl
80 virtual void RC4_process( 80 virtual void RC4_process(
81 unsigned char const* in_data, 81 unsigned char const* in_data,
82 size_t len, 82 size_t len,
83 - unsigned char* out_data = 0) = 0; 83 + unsigned char* out_data = nullptr) = 0;
84 QPDF_DLL 84 QPDF_DLL
85 virtual void RC4_finalize() = 0; 85 virtual void RC4_finalize() = 0;
86 86
include/qpdf/QPDFJob.hh
@@ -497,7 +497,7 @@ class QPDFJob @@ -497,7 +497,7 @@ class QPDFJob
497 497
498 // Helper functions 498 // Helper functions
499 static void usage(std::string const& msg); 499 static void usage(std::string const& msg);
500 - static JSON json_schema(int json_version, std::set<std::string>* keys = 0); 500 + static JSON json_schema(int json_version, std::set<std::string>* keys = nullptr);
501 static void parse_object_id( 501 static void parse_object_id(
502 std::string const& objspec, bool& trailer, int& obj, int& gen); 502 std::string const& objspec, bool& trailer, int& obj, int& gen);
503 void parseRotationParameter(std::string const&); 503 void parseRotationParameter(std::string const&);
include/qpdf/QPDFObjectHandle.hh
@@ -526,7 +526,7 @@ class QPDFObjectHandle @@ -526,7 +526,7 @@ class QPDFObjectHandle
526 QPDF_DLL 526 QPDF_DLL
527 void parsePageContents(ParserCallbacks* callbacks); 527 void parsePageContents(ParserCallbacks* callbacks);
528 QPDF_DLL 528 QPDF_DLL
529 - void filterPageContents(TokenFilter* filter, Pipeline* next = 0); 529 + void filterPageContents(TokenFilter* filter, Pipeline* next = nullptr);
530 // See comments for QPDFPageObjectHelper::pipeContents. 530 // See comments for QPDFPageObjectHelper::pipeContents.
531 QPDF_DLL 531 QPDF_DLL
532 void pipePageContents(Pipeline* p); 532 void pipePageContents(Pipeline* p);
@@ -538,7 +538,7 @@ class QPDFObjectHandle @@ -538,7 +538,7 @@ class QPDFObjectHandle
538 // contents. This can be used to apply a TokenFilter to a form 538 // contents. This can be used to apply a TokenFilter to a form
539 // XObject, whose data is in the same format as a content stream. 539 // XObject, whose data is in the same format as a content stream.
540 QPDF_DLL 540 QPDF_DLL
541 - void filterAsContents(TokenFilter* filter, Pipeline* next = 0); 541 + void filterAsContents(TokenFilter* filter, Pipeline* next = nullptr);
542 // Called on a stream to parse the stream as page contents. This 542 // Called on a stream to parse the stream as page contents. This
543 // can be used to parse a form XObject. 543 // can be used to parse a form XObject.
544 QPDF_DLL 544 QPDF_DLL
include/qpdf/QPDFOutlineObjectHelper.hh
@@ -42,7 +42,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper @@ -42,7 +42,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
42 { 42 {
43 // This must be cleared explicitly to avoid circular references 43 // This must be cleared explicitly to avoid circular references
44 // that prevent cleanup of pointer holders. 44 // that prevent cleanup of pointer holders.
45 - this->m->parent = 0; 45 + this->m->parent = nullptr;
46 } 46 }
47 47
48 // All constructors are private. You can only create one of these 48 // All constructors are private. You can only create one of these
include/qpdf/QPDFPageObjectHelper.hh
@@ -320,12 +320,12 @@ class QPDFPageObjectHelper: public QPDFObjectHelper @@ -320,12 +320,12 @@ class QPDFPageObjectHelper: public QPDFObjectHelper
320 // examples/pdf-count-strings.cc for an example. 320 // examples/pdf-count-strings.cc for an example.
321 QPDF_DLL 321 QPDF_DLL
322 void 322 void
323 - filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0); 323 + filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr);
324 324
325 // Old name -- calls filterContents() 325 // Old name -- calls filterContents()
326 QPDF_DLL 326 QPDF_DLL
327 void filterPageContents( 327 void filterPageContents(
328 - QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0); 328 + QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr);
329 329
330 // Pipe a page's contents through the given pipeline. This method 330 // Pipe a page's contents through the given pipeline. This method
331 // works whether the contents are a single stream or an array of 331 // works whether the contents are a single stream or an array of
include/qpdf/QPDFTokenizer.hh
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785) 28 #include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
29 29
30 #include <memory> 30 #include <memory>
31 -#include <stdio.h> 31 +#include <cstdio>
32 #include <string> 32 #include <string>
33 33
34 class QPDFTokenizer 34 class QPDFTokenizer
include/qpdf/QPDFWriter.hh
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 #include <map> 34 #include <map>
35 #include <memory> 35 #include <memory>
36 #include <set> 36 #include <set>
37 -#include <stdio.h> 37 +#include <cstdio>
38 #include <string> 38 #include <string>
39 #include <string_view> 39 #include <string_view>
40 #include <vector> 40 #include <vector>
@@ -102,7 +102,7 @@ class QPDFWriter @@ -102,7 +102,7 @@ class QPDFWriter
102 QPDF_DLL 102 QPDF_DLL
103 virtual ~FunctionProgressReporter(); 103 virtual ~FunctionProgressReporter();
104 QPDF_DLL 104 QPDF_DLL
105 - virtual void reportProgress(int) override; 105 + void reportProgress(int) override;
106 106
107 private: 107 private:
108 std::function<void(int)> handler; 108 std::function<void(int)> handler;
@@ -539,7 +539,7 @@ class QPDFWriter @@ -539,7 +539,7 @@ class QPDFWriter
539 friend class QPDFWriter; 539 friend class QPDFWriter;
540 540
541 public: 541 public:
542 - PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = 0) : 542 + PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = nullptr) :
543 qw(qw), 543 qw(qw),
544 bp(bp) 544 bp(bp)
545 { 545 {
include/qpdf/QUtil.hh
@@ -30,9 +30,9 @@ @@ -30,9 +30,9 @@
30 #include <list> 30 #include <list>
31 #include <memory> 31 #include <memory>
32 #include <stdexcept> 32 #include <stdexcept>
33 -#include <stdio.h> 33 +#include <cstdio>
34 #include <string> 34 #include <string>
35 -#include <time.h> 35 +#include <ctime>
36 #include <vector> 36 #include <vector>
37 37
38 class RandomDataProvider; 38 class RandomDataProvider;
@@ -245,7 +245,7 @@ namespace QUtil @@ -245,7 +245,7 @@ namespace QUtil
245 // Returns true iff the variable is defined. If `value' is 245 // Returns true iff the variable is defined. If `value' is
246 // non-null, initializes it with the value of the variable. 246 // non-null, initializes it with the value of the variable.
247 QPDF_DLL 247 QPDF_DLL
248 - bool get_env(std::string const& var, std::string* value = 0); 248 + bool get_env(std::string const& var, std::string* value = nullptr);
249 249
250 QPDF_DLL 250 QPDF_DLL
251 time_t get_current_time(); 251 time_t get_current_time();
include/qpdf/RandomDataProvider.hh
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 #define RANDOMDATAPROVIDER_HH 23 #define RANDOMDATAPROVIDER_HH
24 24
25 #include <qpdf/DLL.h> 25 #include <qpdf/DLL.h>
26 -#include <string.h> // for size_t 26 +#include <cstring> // for size_t
27 27
28 class QPDF_DLL_CLASS RandomDataProvider 28 class QPDF_DLL_CLASS RandomDataProvider
29 { 29 {
libqpdf/BufferInputSource.cc
@@ -2,10 +2,8 @@ @@ -2,10 +2,8 @@
2 2
3 #include <qpdf/QIntC.hh> 3 #include <qpdf/QIntC.hh>
4 #include <algorithm> 4 #include <algorithm>
5 -#include <limits>  
6 #include <sstream> 5 #include <sstream>
7 -#include <stdexcept>  
8 -#include <string.h> 6 +#include <cstring>
9 7
10 BufferInputSource::BufferInputSource( 8 BufferInputSource::BufferInputSource(
11 std::string const& description, Buffer* buf, bool own_memory) : 9 std::string const& description, Buffer* buf, bool own_memory) :
libqpdf/FileInputSource.cc
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 #include <qpdf/QPDFExc.hh> 3 #include <qpdf/QPDFExc.hh>
4 #include <qpdf/QUtil.hh> 4 #include <qpdf/QUtil.hh>
5 #include <algorithm> 5 #include <algorithm>
6 -#include <string.h> 6 +#include <cstring>
7 7
8 FileInputSource::FileInputSource() : 8 FileInputSource::FileInputSource() :
9 close_file(false), 9 close_file(false),
libqpdf/InputSource.cc
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 #include <qpdf/QIntC.hh> 3 #include <qpdf/QIntC.hh>
4 #include <qpdf/QTC.hh> 4 #include <qpdf/QTC.hh>
5 #include <stdexcept> 5 #include <stdexcept>
6 -#include <string.h> 6 +#include <cstring>
7 7
8 void 8 void
9 InputSource::setLastOffset(qpdf_offset_t offset) 9 InputSource::setLastOffset(qpdf_offset_t offset)
libqpdf/InsecureRandomDataProvider.cc
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 #include <qpdf/QUtil.hh> 3 #include <qpdf/QUtil.hh>
4 #include <qpdf/qpdf-config.h> 4 #include <qpdf/qpdf-config.h>
5 -#include <stdlib.h> 5 +#include <cstdlib>
6 6
7 InsecureRandomDataProvider::InsecureRandomDataProvider() : 7 InsecureRandomDataProvider::InsecureRandomDataProvider() :
8 seeded_random(false) 8 seeded_random(false)
@@ -24,7 +24,7 @@ InsecureRandomDataProvider::random() @@ -24,7 +24,7 @@ InsecureRandomDataProvider::random()
24 // Seed the random number generator with something simple, but 24 // Seed the random number generator with something simple, but
25 // just to be interesting, don't use the unmodified current 25 // just to be interesting, don't use the unmodified current
26 // time. It would be better if this were a more secure seed. 26 // time. It would be better if this were a more secure seed.
27 - unsigned int seed = 27 + auto seed =
28 static_cast<unsigned int>(QUtil::get_current_time() ^ 0xcccc); 28 static_cast<unsigned int>(QUtil::get_current_time() ^ 0xcccc);
29 #ifdef HAVE_RANDOM 29 #ifdef HAVE_RANDOM
30 ::srandom(seed); 30 ::srandom(seed);
libqpdf/JSON.cc
@@ -294,7 +294,7 @@ JSON::addDictionaryMember(std::string const&amp; key, JSON const&amp; val) @@ -294,7 +294,7 @@ JSON::addDictionaryMember(std::string const&amp; key, JSON const&amp; val)
294 bool 294 bool
295 JSON::checkDictionaryKeySeen(std::string const& key) 295 JSON::checkDictionaryKeySeen(std::string const& key)
296 { 296 {
297 - JSON_dictionary* obj = dynamic_cast<JSON_dictionary*>(this->m->value.get()); 297 + auto* obj = dynamic_cast<JSON_dictionary*>(this->m->value.get());
298 if (nullptr == obj) { 298 if (nullptr == obj) {
299 throw std::logic_error( 299 throw std::logic_error(
300 "JSON::checkDictionaryKey called on non-dictionary"); 300 "JSON::checkDictionaryKey called on non-dictionary");
@@ -315,7 +315,7 @@ JSON::makeArray() @@ -315,7 +315,7 @@ JSON::makeArray()
315 JSON 315 JSON
316 JSON::addArrayElement(JSON const& val) 316 JSON::addArrayElement(JSON const& val)
317 { 317 {
318 - JSON_array* arr = dynamic_cast<JSON_array*>(this->m->value.get()); 318 + auto* arr = dynamic_cast<JSON_array*>(this->m->value.get());
319 if (nullptr == arr) { 319 if (nullptr == arr) {
320 throw std::runtime_error("JSON::addArrayElement called on non-array"); 320 throw std::runtime_error("JSON::addArrayElement called on non-array");
321 } 321 }
@@ -470,13 +470,13 @@ JSON::checkSchemaInternal( @@ -470,13 +470,13 @@ JSON::checkSchemaInternal(
470 std::list<std::string>& errors, 470 std::list<std::string>& errors,
471 std::string prefix) 471 std::string prefix)
472 { 472 {
473 - JSON_array* this_arr = dynamic_cast<JSON_array*>(this_v);  
474 - JSON_dictionary* this_dict = dynamic_cast<JSON_dictionary*>(this_v); 473 + auto* this_arr = dynamic_cast<JSON_array*>(this_v);
  474 + auto* this_dict = dynamic_cast<JSON_dictionary*>(this_v);
475 475
476 - JSON_array* sch_arr = dynamic_cast<JSON_array*>(sch_v);  
477 - JSON_dictionary* sch_dict = dynamic_cast<JSON_dictionary*>(sch_v); 476 + auto* sch_arr = dynamic_cast<JSON_array*>(sch_v);
  477 + auto* sch_dict = dynamic_cast<JSON_dictionary*>(sch_v);
478 478
479 - JSON_string* sch_str = dynamic_cast<JSON_string*>(sch_v); 479 + auto* sch_str = dynamic_cast<JSON_string*>(sch_v);
480 480
481 std::string err_prefix; 481 std::string err_prefix;
482 if (prefix.empty()) { 482 if (prefix.empty()) {
libqpdf/MD5.cc
@@ -4,11 +4,7 @@ @@ -4,11 +4,7 @@
4 #include <qpdf/QPDFCryptoProvider.hh> 4 #include <qpdf/QPDFCryptoProvider.hh>
5 #include <qpdf/QUtil.hh> 5 #include <qpdf/QUtil.hh>
6 6
7 -#include <errno.h>  
8 -#include <memory.h>  
9 -#include <stdio.h>  
10 -#include <stdlib.h>  
11 -#include <string.h> 7 +#include <cstring>
12 8
13 MD5::MD5() 9 MD5::MD5()
14 { 10 {
libqpdf/Pipeline.cc
1 #include <qpdf/Pipeline.hh> 1 #include <qpdf/Pipeline.hh>
2 2
3 -#include <qpdf/QUtil.hh>  
4 -  
5 #include <cstring> 3 #include <cstring>
6 #include <stdexcept> 4 #include <stdexcept>
7 5
libqpdf/Pl_AES_PDF.cc
@@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
5 #include <qpdf/QUtil.hh> 5 #include <qpdf/QUtil.hh>
6 #include <cstring> 6 #include <cstring>
7 #include <stdexcept> 7 #include <stdexcept>
8 -#include <stdlib.h>  
9 #include <string> 8 #include <string>
10 9
11 bool Pl_AES_PDF::use_static_iv = false; 10 bool Pl_AES_PDF::use_static_iv = false;
libqpdf/Pl_ASCII85Decoder.cc
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 #include <qpdf/QTC.hh> 3 #include <qpdf/QTC.hh>
4 #include <stdexcept> 4 #include <stdexcept>
5 -#include <string.h> 5 +#include <cstring>
6 6
7 Pl_ASCII85Decoder::Pl_ASCII85Decoder(char const* identifier, Pipeline* next) : 7 Pl_ASCII85Decoder::Pl_ASCII85Decoder(char const* identifier, Pipeline* next) :
8 Pipeline(identifier, next), 8 Pipeline(identifier, next),
libqpdf/Pl_ASCIIHexDecoder.cc
1 #include <qpdf/Pl_ASCIIHexDecoder.hh> 1 #include <qpdf/Pl_ASCIIHexDecoder.hh>
2 2
3 #include <qpdf/QTC.hh> 3 #include <qpdf/QTC.hh>
4 -#include <ctype.h> 4 +#include <cctype>
5 #include <stdexcept> 5 #include <stdexcept>
6 -#include <string.h>  
7 6
8 Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) : 7 Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) :
9 Pipeline(identifier, next), 8 Pipeline(identifier, next),
@@ -77,7 +76,7 @@ Pl_ASCIIHexDecoder::flush() @@ -77,7 +76,7 @@ Pl_ASCIIHexDecoder::flush()
77 b[i] = this->inbuf[i] - '0'; 76 b[i] = this->inbuf[i] - '0';
78 } 77 }
79 } 78 }
80 - unsigned char ch = static_cast<unsigned char>((b[0] << 4) + b[1]); 79 + auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
81 80
82 QTC::TC( 81 QTC::TC(
83 "libtests", 82 "libtests",
libqpdf/Pl_Base64.cc
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 2
3 #include <qpdf/QIntC.hh> 3 #include <qpdf/QIntC.hh>
4 #include <qpdf/QUtil.hh> 4 #include <qpdf/QUtil.hh>
5 -#include <algorithm>  
6 #include <cstring> 5 #include <cstring>
7 #include <stdexcept> 6 #include <stdexcept>
8 7
libqpdf/Pl_Buffer.cc
@@ -2,8 +2,8 @@ @@ -2,8 +2,8 @@
2 2
3 #include <algorithm> 3 #include <algorithm>
4 #include <stdexcept> 4 #include <stdexcept>
5 -#include <stdlib.h>  
6 -#include <string.h> 5 +#include <cstdlib>
  6 +#include <cstring>
7 7
8 Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) : 8 Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) :
9 Pipeline(identifier, next), 9 Pipeline(identifier, next),
@@ -45,7 +45,7 @@ Pl_Buffer::getBuffer() @@ -45,7 +45,7 @@ Pl_Buffer::getBuffer()
45 } 45 }
46 46
47 auto size = this->m->data.length(); 47 auto size = this->m->data.length();
48 - Buffer* b = new Buffer(size); 48 + auto* b = new Buffer(size);
49 if (size > 0) { 49 if (size > 0) {
50 unsigned char* p = b->getBuffer(); 50 unsigned char* p = b->getBuffer();
51 memcpy(p, this->m->data.data(), size); 51 memcpy(p, this->m->data.data(), size);
libqpdf/Pl_DCT.cc
@@ -2,12 +2,9 @@ @@ -2,12 +2,9 @@
2 2
3 #include <qpdf/QIntC.hh> 3 #include <qpdf/QIntC.hh>
4 #include <qpdf/QTC.hh> 4 #include <qpdf/QTC.hh>
5 -#include <qpdf/QUtil.hh>  
6 5
7 -#include <cstring>  
8 -#include <setjmp.h> 6 +#include <csetjmp>
9 #include <stdexcept> 7 #include <stdexcept>
10 -#include <stdlib.h>  
11 #include <string> 8 #include <string>
12 9
13 #if BITS_IN_JSAMPLE != 8 10 #if BITS_IN_JSAMPLE != 8
@@ -27,7 +24,7 @@ namespace @@ -27,7 +24,7 @@ namespace
27 static void 24 static void
28 error_handler(j_common_ptr cinfo) 25 error_handler(j_common_ptr cinfo)
29 { 26 {
30 - qpdf_jpeg_error_mgr* jerr = 27 + auto* jerr =
31 reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err); 28 reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
32 char buf[JMSG_LENGTH_MAX]; 29 char buf[JMSG_LENGTH_MAX];
33 (*cinfo->err->format_message)(cinfo, buf); 30 (*cinfo->err->format_message)(cinfo, buf);
@@ -170,7 +167,7 @@ static boolean @@ -170,7 +167,7 @@ static boolean
170 empty_pipeline_output_buffer(j_compress_ptr cinfo) 167 empty_pipeline_output_buffer(j_compress_ptr cinfo)
171 { 168 {
172 QTC::TC("libtests", "Pl_DCT empty_pipeline_output_buffer"); 169 QTC::TC("libtests", "Pl_DCT empty_pipeline_output_buffer");
173 - dct_pipeline_dest* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest); 170 + auto* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest);
174 dest->next->write(dest->buffer, dest->size); 171 dest->next->write(dest->buffer, dest->size);
175 dest->pub.next_output_byte = dest->buffer; 172 dest->pub.next_output_byte = dest->buffer;
176 dest->pub.free_in_buffer = dest->size; 173 dest->pub.free_in_buffer = dest->size;
@@ -181,7 +178,7 @@ static void @@ -181,7 +178,7 @@ static void
181 term_pipeline_destination(j_compress_ptr cinfo) 178 term_pipeline_destination(j_compress_ptr cinfo)
182 { 179 {
183 QTC::TC("libtests", "Pl_DCT term_pipeline_destination"); 180 QTC::TC("libtests", "Pl_DCT term_pipeline_destination");
184 - dct_pipeline_dest* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest); 181 + auto* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest);
185 dest->next->write(dest->buffer, dest->size - dest->pub.free_in_buffer); 182 dest->next->write(dest->buffer, dest->size - dest->pub.free_in_buffer);
186 } 183 }
187 184
@@ -195,7 +192,7 @@ jpeg_pipeline_dest( @@ -195,7 +192,7 @@ jpeg_pipeline_dest(
195 reinterpret_cast<j_common_ptr>(cinfo), 192 reinterpret_cast<j_common_ptr>(cinfo),
196 JPOOL_PERMANENT, 193 JPOOL_PERMANENT,
197 sizeof(dct_pipeline_dest))); 194 sizeof(dct_pipeline_dest)));
198 - dct_pipeline_dest* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest); 195 + auto* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest);
199 dest->pub.init_destination = init_pipeline_destination; 196 dest->pub.init_destination = init_pipeline_destination;
200 dest->pub.empty_output_buffer = empty_pipeline_output_buffer; 197 dest->pub.empty_output_buffer = empty_pipeline_output_buffer;
201 dest->pub.term_destination = term_pipeline_destination; 198 dest->pub.term_destination = term_pipeline_destination;
@@ -264,7 +261,7 @@ jpeg_buffer_src(j_decompress_ptr cinfo, Buffer* buffer) @@ -264,7 +261,7 @@ jpeg_buffer_src(j_decompress_ptr cinfo, Buffer* buffer)
264 void 261 void
265 Pl_DCT::compress(void* cinfo_p, Buffer* b) 262 Pl_DCT::compress(void* cinfo_p, Buffer* b)
266 { 263 {
267 - struct jpeg_compress_struct* cinfo = 264 + auto* cinfo =
268 reinterpret_cast<jpeg_compress_struct*>(cinfo_p); 265 reinterpret_cast<jpeg_compress_struct*>(cinfo_p);
269 266
270 #if ( \ 267 #if ( \
@@ -319,7 +316,7 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b) @@ -319,7 +316,7 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b)
319 void 316 void
320 Pl_DCT::decompress(void* cinfo_p, Buffer* b) 317 Pl_DCT::decompress(void* cinfo_p, Buffer* b)
321 { 318 {
322 - struct jpeg_decompress_struct* cinfo = 319 + auto* cinfo =
323 reinterpret_cast<jpeg_decompress_struct*>(cinfo_p); 320 reinterpret_cast<jpeg_decompress_struct*>(cinfo_p);
324 321
325 #if ( \ 322 #if ( \
libqpdf/Pl_Flate.cc
1 #include <qpdf/Pl_Flate.hh> 1 #include <qpdf/Pl_Flate.hh>
2 2
3 -#include <limits.h>  
4 -#include <string.h> 3 +#include <climits>
  4 +#include <cstring>
5 #include <zlib.h> 5 #include <zlib.h>
6 6
7 #include <qpdf/QIntC.hh> 7 #include <qpdf/QIntC.hh>
libqpdf/Pl_Function.cc
1 #include <qpdf/Pl_Function.hh> 1 #include <qpdf/Pl_Function.hh>
2 2
3 -#include <qpdf/QUtil.hh>  
4 -#include <errno.h>  
5 #include <stdexcept> 3 #include <stdexcept>
6 4
7 Pl_Function::Members::Members(writer_t fn) : 5 Pl_Function::Members::Members(writer_t fn) :
libqpdf/Pl_LZWDecoder.cc
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 #include <qpdf/QTC.hh> 4 #include <qpdf/QTC.hh>
5 #include <qpdf/QUtil.hh> 5 #include <qpdf/QUtil.hh>
6 #include <stdexcept> 6 #include <stdexcept>
7 -#include <string.h> 7 +#include <cstring>
8 8
9 Pl_LZWDecoder::Pl_LZWDecoder( 9 Pl_LZWDecoder::Pl_LZWDecoder(
10 char const* identifier, Pipeline* next, bool early_code_change) : 10 char const* identifier, Pipeline* next, bool early_code_change) :
@@ -189,7 +189,7 @@ Pl_LZWDecoder::handleCode(unsigned int code) @@ -189,7 +189,7 @@ Pl_LZWDecoder::handleCode(unsigned int code)
189 } 189 }
190 190
191 if (code < 256) { 191 if (code < 256) {
192 - unsigned char ch = static_cast<unsigned char>(code); 192 + auto ch = static_cast<unsigned char>(code);
193 getNext()->write(&ch, 1); 193 getNext()->write(&ch, 1);
194 } else { 194 } else {
195 unsigned int idx = code - 258; 195 unsigned int idx = code - 258;
libqpdf/Pl_OStream.cc
1 #include <qpdf/Pl_OStream.hh> 1 #include <qpdf/Pl_OStream.hh>
2 2
3 -#include <qpdf/QUtil.hh>  
4 -#include <errno.h>  
5 #include <stdexcept> 3 #include <stdexcept>
6 4
7 Pl_OStream::Members::Members(std::ostream& os) : 5 Pl_OStream::Members::Members(std::ostream& os) :
libqpdf/Pl_PNGFilter.cc
@@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
3 #include <qpdf/QTC.hh> 3 #include <qpdf/QTC.hh>
4 #include <qpdf/QUtil.hh> 4 #include <qpdf/QUtil.hh>
5 5
6 -#include <limits.h> 6 +#include <climits>
7 #include <stdexcept> 7 #include <stdexcept>
8 -#include <string.h> 8 +#include <cstring>
9 9
10 static int 10 static int
11 abs_diff(int a, int b) 11 abs_diff(int a, int b)
libqpdf/Pl_QPDFTokenizer.cc
@@ -2,9 +2,7 @@ @@ -2,9 +2,7 @@
2 2
3 #include <qpdf/BufferInputSource.hh> 3 #include <qpdf/BufferInputSource.hh>
4 #include <qpdf/QTC.hh> 4 #include <qpdf/QTC.hh>
5 -#include <qpdf/QUtil.hh>  
6 #include <stdexcept> 5 #include <stdexcept>
7 -#include <string.h>  
8 6
9 Pl_QPDFTokenizer::Members::Members() : 7 Pl_QPDFTokenizer::Members::Members() :
10 filter(nullptr), 8 filter(nullptr),
libqpdf/Pl_RunLength.cc
@@ -127,11 +127,11 @@ Pl_RunLength::flush_encode() @@ -127,11 +127,11 @@ Pl_RunLength::flush_encode()
127 throw std::logic_error( 127 throw std::logic_error(
128 "Pl_RunLength: invalid length in flush_encode for run"); 128 "Pl_RunLength: invalid length in flush_encode for run");
129 } 129 }
130 - unsigned char ch = static_cast<unsigned char>(257 - this->m->length); 130 + auto ch = static_cast<unsigned char>(257 - this->m->length);
131 this->getNext()->write(&ch, 1); 131 this->getNext()->write(&ch, 1);
132 this->getNext()->write(&this->m->buf[0], 1); 132 this->getNext()->write(&this->m->buf[0], 1);
133 } else if (this->m->length > 0) { 133 } else if (this->m->length > 0) {
134 - unsigned char ch = static_cast<unsigned char>(this->m->length - 1); 134 + auto ch = static_cast<unsigned char>(this->m->length - 1);
135 this->getNext()->write(&ch, 1); 135 this->getNext()->write(&ch, 1);
136 this->getNext()->write(this->m->buf, this->m->length); 136 this->getNext()->write(this->m->buf, this->m->length);
137 } 137 }
libqpdf/Pl_SHA2.cc
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 2
3 #include <qpdf/QPDFCryptoProvider.hh> 3 #include <qpdf/QPDFCryptoProvider.hh>
4 #include <qpdf/QUtil.hh> 4 #include <qpdf/QUtil.hh>
5 -#include <cstdio>  
6 #include <stdexcept> 5 #include <stdexcept>
7 6
8 Pl_SHA2::Pl_SHA2(int bits, Pipeline* next) : 7 Pl_SHA2::Pl_SHA2(int bits, Pipeline* next) :
libqpdf/Pl_StdioFile.cc
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 #include <qpdf/Pl_StdioFile.hh> 3 #include <qpdf/Pl_StdioFile.hh>
4 4
5 #include <qpdf/QUtil.hh> 5 #include <qpdf/QUtil.hh>
6 -#include <errno.h> 6 +#include <cerrno>
7 #include <stdexcept> 7 #include <stdexcept>
8 8
9 Pl_StdioFile::Members::Members(FILE* f) : 9 Pl_StdioFile::Members::Members(FILE* f) :
libqpdf/Pl_String.cc
1 #include <qpdf/Pl_String.hh> 1 #include <qpdf/Pl_String.hh>
2 2
3 -#include <qpdf/QUtil.hh>  
4 -#include <errno.h>  
5 #include <stdexcept> 3 #include <stdexcept>
6 4
7 Pl_String::Members::Members(std::string& s) : 5 Pl_String::Members::Members(std::string& s) :
libqpdf/Pl_TIFFPredictor.cc
@@ -5,9 +5,9 @@ @@ -5,9 +5,9 @@
5 #include <qpdf/QTC.hh> 5 #include <qpdf/QTC.hh>
6 #include <qpdf/QUtil.hh> 6 #include <qpdf/QUtil.hh>
7 7
8 -#include <limits.h> 8 +#include <climits>
9 #include <stdexcept> 9 #include <stdexcept>
10 -#include <string.h> 10 +#include <cstring>
11 #include <vector> 11 #include <vector>
12 12
13 Pl_TIFFPredictor::Pl_TIFFPredictor( 13 Pl_TIFFPredictor::Pl_TIFFPredictor(
libqpdf/QPDF.cc
@@ -9,8 +9,8 @@ @@ -9,8 +9,8 @@
9 #include <memory.h> 9 #include <memory.h>
10 #include <regex> 10 #include <regex>
11 #include <sstream> 11 #include <sstream>
12 -#include <stdlib.h>  
13 -#include <string.h> 12 +#include <cstdlib>
  13 +#include <cstring>
14 #include <vector> 14 #include <vector>
15 15
16 #include <qpdf/BufferInputSource.hh> 16 #include <qpdf/BufferInputSource.hh>
@@ -60,42 +60,42 @@ namespace @@ -60,42 +60,42 @@ namespace
60 class InvalidInputSource: public InputSource 60 class InvalidInputSource: public InputSource
61 { 61 {
62 public: 62 public:
63 - virtual ~InvalidInputSource() = default;  
64 - virtual qpdf_offset_t 63 + ~InvalidInputSource() override = default;
  64 + qpdf_offset_t
65 findAndSkipNextEOL() override 65 findAndSkipNextEOL() override
66 { 66 {
67 throwException(); 67 throwException();
68 return 0; 68 return 0;
69 } 69 }
70 - virtual std::string const& 70 + std::string const&
71 getName() const override 71 getName() const override
72 { 72 {
73 static std::string name("closed input source"); 73 static std::string name("closed input source");
74 return name; 74 return name;
75 } 75 }
76 - virtual qpdf_offset_t 76 + qpdf_offset_t
77 tell() override 77 tell() override
78 { 78 {
79 throwException(); 79 throwException();
80 return 0; 80 return 0;
81 } 81 }
82 - virtual void 82 + void
83 seek(qpdf_offset_t offset, int whence) override 83 seek(qpdf_offset_t offset, int whence) override
84 { 84 {
85 throwException(); 85 throwException();
86 } 86 }
87 - virtual void 87 + void
88 rewind() override 88 rewind() override
89 { 89 {
90 throwException(); 90 throwException();
91 } 91 }
92 - virtual size_t 92 + size_t
93 read(char* buffer, size_t length) override 93 read(char* buffer, size_t length) override
94 { 94 {
95 throwException(); 95 throwException();
96 return 0; 96 return 0;
97 } 97 }
98 - virtual void 98 + void
99 unreadCh(char ch) override 99 unreadCh(char ch) override
100 { 100 {
101 throwException(); 101 throwException();
@@ -264,7 +264,7 @@ QPDF::create() @@ -264,7 +264,7 @@ QPDF::create()
264 void 264 void
265 QPDF::processFile(char const* filename, char const* password) 265 QPDF::processFile(char const* filename, char const* password)
266 { 266 {
267 - FileInputSource* fi = new FileInputSource(filename); 267 + auto* fi = new FileInputSource(filename);
268 processInputSource(std::shared_ptr<InputSource>(fi), password); 268 processInputSource(std::shared_ptr<InputSource>(fi), password);
269 } 269 }
270 270
@@ -272,7 +272,7 @@ void @@ -272,7 +272,7 @@ void
272 QPDF::processFile( 272 QPDF::processFile(
273 char const* description, FILE* filep, bool close_file, char const* password) 273 char const* description, FILE* filep, bool close_file, char const* password)
274 { 274 {
275 - FileInputSource* fi = new FileInputSource(description, filep, close_file); 275 + auto* fi = new FileInputSource(description, filep, close_file);
276 processInputSource(std::shared_ptr<InputSource>(fi), password); 276 processInputSource(std::shared_ptr<InputSource>(fi), password);
277 } 277 }
278 278
@@ -2537,7 +2537,7 @@ QPDF::getCompressibleObjGens() @@ -2537,7 +2537,7 @@ QPDF::getCompressibleObjGens()
2537 if (obj.isStream()) { 2537 if (obj.isStream()) {
2538 QPDFObjectHandle dict = obj.getDict(); 2538 QPDFObjectHandle dict = obj.getDict();
2539 std::set<std::string> keys = dict.getKeys(); 2539 std::set<std::string> keys = dict.getKeys();
2540 - for (std::set<std::string>::reverse_iterator iter = keys.rbegin(); 2540 + for (auto iter = keys.rbegin();
2541 iter != keys.rend(); 2541 iter != keys.rend();
2542 ++iter) { 2542 ++iter) {
2543 std::string const& key = *iter; 2543 std::string const& key = *iter;
@@ -2553,7 +2553,7 @@ QPDF::getCompressibleObjGens() @@ -2553,7 +2553,7 @@ QPDF::getCompressibleObjGens()
2553 } 2553 }
2554 } else if (obj.isDictionary()) { 2554 } else if (obj.isDictionary()) {
2555 std::set<std::string> keys = obj.getKeys(); 2555 std::set<std::string> keys = obj.getKeys();
2556 - for (std::set<std::string>::reverse_iterator iter = keys.rbegin(); 2556 + for (auto iter = keys.rbegin();
2557 iter != keys.rend(); 2557 iter != keys.rend();
2558 ++iter) { 2558 ++iter) {
2559 queue.push_front(obj.getKey(*iter)); 2559 queue.push_front(obj.getKey(*iter));
libqpdf/QPDFAnnotationObjectHelper.cc
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 2
3 #include <qpdf/QPDF.hh> 3 #include <qpdf/QPDF.hh>
4 #include <qpdf/QPDFMatrix.hh> 4 #include <qpdf/QPDFMatrix.hh>
5 -#include <qpdf/QPDFNameTreeObjectHelper.hh>  
6 #include <qpdf/QTC.hh> 5 #include <qpdf/QTC.hh>
7 #include <qpdf/QUtil.hh> 6 #include <qpdf/QUtil.hh>
8 7
libqpdf/QPDFExc.cc
1 #include <qpdf/QPDFExc.hh> 1 #include <qpdf/QPDFExc.hh>
2 2
3 -#include <qpdf/QUtil.hh>  
4 -  
5 QPDFExc::QPDFExc( 3 QPDFExc::QPDFExc(
6 qpdf_error_code_e error_code, 4 qpdf_error_code_e error_code,
7 std::string const& filename, 5 std::string const& filename,
libqpdf/QPDFFormFieldObjectHelper.cc
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 #include <qpdf/QPDFAnnotationObjectHelper.hh> 6 #include <qpdf/QPDFAnnotationObjectHelper.hh>
7 #include <qpdf/QTC.hh> 7 #include <qpdf/QTC.hh>
8 #include <qpdf/QUtil.hh> 8 #include <qpdf/QUtil.hh>
9 -#include <stdlib.h> 9 +#include <cstdlib>
10 10
11 QPDFFormFieldObjectHelper::QPDFFormFieldObjectHelper(QPDFObjectHandle oh) : 11 QPDFFormFieldObjectHelper::QPDFFormFieldObjectHelper(QPDFObjectHandle oh) :
12 QPDFObjectHelper(oh), 12 QPDFObjectHelper(oh),
@@ -515,9 +515,9 @@ namespace @@ -515,9 +515,9 @@ namespace
515 std::vector<std::string> const& opt, 515 std::vector<std::string> const& opt,
516 double tf, 516 double tf,
517 QPDFObjectHandle::Rectangle const& bbox); 517 QPDFObjectHandle::Rectangle const& bbox);
518 - virtual ~ValueSetter() = default;  
519 - virtual void handleToken(QPDFTokenizer::Token const&);  
520 - virtual void handleEOF(); 518 + ~ValueSetter() override = default;
  519 + void handleToken(QPDFTokenizer::Token const&) override;
  520 + void handleEOF() override;
521 void writeAppearance(); 521 void writeAppearance();
522 522
523 private: 523 private:
@@ -611,7 +611,7 @@ ValueSetter::writeAppearance() @@ -611,7 +611,7 @@ ValueSetter::writeAppearance()
611 // Write one or more lines, centered vertically, possibly with 611 // Write one or more lines, centered vertically, possibly with
612 // one row highlighted. 612 // one row highlighted.
613 613
614 - size_t max_rows = static_cast<size_t>((bbox.ury - bbox.lly) / tfh); 614 + auto max_rows = static_cast<size_t>((bbox.ury - bbox.lly) / tfh);
615 bool highlight = false; 615 bool highlight = false;
616 size_t highlight_idx = 0; 616 size_t highlight_idx = 0;
617 617
@@ -706,10 +706,10 @@ namespace @@ -706,10 +706,10 @@ namespace
706 { 706 {
707 public: 707 public:
708 TfFinder(); 708 TfFinder();
709 - virtual ~TfFinder() 709 + ~TfFinder() override
710 { 710 {
711 } 711 }
712 - virtual void handleToken(QPDFTokenizer::Token const&); 712 + void handleToken(QPDFTokenizer::Token const&) override;
713 double getTf(); 713 double getTf();
714 std::string getFontName(); 714 std::string getFontName();
715 std::string getDA(); 715 std::string getDA();
libqpdf/QPDFJob.cc
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 #include <cstdio> 3 #include <cstdio>
4 #include <cstdlib> 4 #include <cstdlib>
5 #include <cstring> 5 #include <cstring>
6 -#include <ctype.h> 6 +#include <cctype>
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <iostream> 8 #include <iostream>
9 #include <memory> 9 #include <memory>
@@ -48,8 +48,8 @@ namespace @@ -48,8 +48,8 @@ namespace
48 size_t oi_min_height, 48 size_t oi_min_height,
49 size_t oi_min_area, 49 size_t oi_min_area,
50 QPDFObjectHandle& image); 50 QPDFObjectHandle& image);
51 - virtual ~ImageOptimizer() = default;  
52 - virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline); 51 + ~ImageOptimizer() override = default;
  52 + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override;
53 std::shared_ptr<Pipeline> 53 std::shared_ptr<Pipeline>
54 makePipeline(std::string const& description, Pipeline* next); 54 makePipeline(std::string const& description, Pipeline* next);
55 bool evaluate(std::string const& description); 55 bool evaluate(std::string const& description);
@@ -65,13 +65,13 @@ namespace @@ -65,13 +65,13 @@ namespace
65 class DiscardContents: public QPDFObjectHandle::ParserCallbacks 65 class DiscardContents: public QPDFObjectHandle::ParserCallbacks
66 { 66 {
67 public: 67 public:
68 - virtual ~DiscardContents() = default;  
69 - virtual void  
70 - handleObject(QPDFObjectHandle) 68 + ~DiscardContents() override = default;
  69 + void
  70 + handleObject(QPDFObjectHandle) override
71 { 71 {
72 } 72 }
73 - virtual void  
74 - handleEOF() 73 + void
  74 + handleEOF() override
75 { 75 {
76 } 76 }
77 }; 77 };
@@ -98,8 +98,8 @@ namespace @@ -98,8 +98,8 @@ namespace
98 filename(filename) 98 filename(filename)
99 { 99 {
100 } 100 }
101 - virtual ~ProgressReporter() = default;  
102 - virtual void reportProgress(int); 101 + ~ProgressReporter() override = default;
  102 + void reportProgress(int) override;
103 103
104 private: 104 private:
105 Pipeline& p; 105 Pipeline& p;
libqpdf/QPDFJob_argv.cc
@@ -3,12 +3,12 @@ @@ -3,12 +3,12 @@
3 // See "HOW TO ADD A COMMAND-LINE ARGUMENT" in README-maintainer. 3 // See "HOW TO ADD A COMMAND-LINE ARGUMENT" in README-maintainer.
4 4
5 #include <cstdio> 5 #include <cstdio>
6 -#include <ctype.h> 6 +#include <cctype>
7 #include <iostream> 7 #include <iostream>
8 #include <memory> 8 #include <memory>
9 #include <sstream> 9 #include <sstream>
10 -#include <stdlib.h>  
11 -#include <string.h> 10 +#include <cstdlib>
  11 +#include <cstring>
12 12
13 #include <qpdf/QIntC.hh> 13 #include <qpdf/QIntC.hh>
14 #include <qpdf/QPDFArgParser.hh> 14 #include <qpdf/QPDFArgParser.hh>
libqpdf/QPDFLogger.cc
@@ -17,14 +17,14 @@ namespace @@ -17,14 +17,14 @@ namespace
17 { 17 {
18 } 18 }
19 19
20 - virtual void 20 + void
21 write(unsigned char const* data, size_t len) override 21 write(unsigned char const* data, size_t len) override
22 { 22 {
23 this->used = true; 23 this->used = true;
24 getNext()->write(data, len); 24 getNext()->write(data, len);
25 } 25 }
26 26
27 - virtual void 27 + void
28 finish() override 28 finish() override
29 { 29 {
30 getNext()->finish(); 30 getNext()->finish();
libqpdf/QPDFNameTreeObjectHelper.cc
@@ -7,18 +7,18 @@ namespace @@ -7,18 +7,18 @@ namespace
7 class NameTreeDetails: public NNTreeDetails 7 class NameTreeDetails: public NNTreeDetails
8 { 8 {
9 public: 9 public:
10 - virtual std::string const& 10 + std::string const&
11 itemsKey() const override 11 itemsKey() const override
12 { 12 {
13 static std::string k("/Names"); 13 static std::string k("/Names");
14 return k; 14 return k;
15 } 15 }
16 - virtual bool 16 + bool
17 keyValid(QPDFObjectHandle oh) const override 17 keyValid(QPDFObjectHandle oh) const override
18 { 18 {
19 return oh.isString(); 19 return oh.isString();
20 } 20 }
21 - virtual int 21 + int
22 compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override 22 compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override
23 { 23 {
24 if (!(keyValid(a) && keyValid(b))) { 24 if (!(keyValid(a) && keyValid(b))) {
libqpdf/QPDFNumberTreeObjectHelper.cc
@@ -8,18 +8,18 @@ namespace @@ -8,18 +8,18 @@ namespace
8 class NumberTreeDetails: public NNTreeDetails 8 class NumberTreeDetails: public NNTreeDetails
9 { 9 {
10 public: 10 public:
11 - virtual std::string const& 11 + std::string const&
12 itemsKey() const override 12 itemsKey() const override
13 { 13 {
14 static std::string k("/Nums"); 14 static std::string k("/Nums");
15 return k; 15 return k;
16 } 16 }
17 - virtual bool 17 + bool
18 keyValid(QPDFObjectHandle oh) const override 18 keyValid(QPDFObjectHandle oh) const override
19 { 19 {
20 return oh.isInteger(); 20 return oh.isInteger();
21 } 21 }
22 - virtual int 22 + int
23 compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override 23 compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override
24 { 24 {
25 if (!(keyValid(a) && keyValid(b))) { 25 if (!(keyValid(a) && keyValid(b))) {
libqpdf/QPDFObjectHandle.cc
@@ -30,10 +30,10 @@ @@ -30,10 +30,10 @@
30 30
31 #include <algorithm> 31 #include <algorithm>
32 #include <cstring> 32 #include <cstring>
33 -#include <ctype.h>  
34 -#include <limits.h> 33 +#include <cctype>
  34 +#include <climits>
35 #include <stdexcept> 35 #include <stdexcept>
36 -#include <stdlib.h> 36 +#include <cstdlib>
37 37
38 using namespace std::literals; 38 using namespace std::literals;
39 39
@@ -111,8 +111,8 @@ namespace @@ -111,8 +111,8 @@ namespace
111 old_contents(old_contents) 111 old_contents(old_contents)
112 { 112 {
113 } 113 }
114 - virtual ~CoalesceProvider() = default;  
115 - virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline); 114 + ~CoalesceProvider() override = default;
  115 + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override;
116 116
117 private: 117 private:
118 QPDFObjectHandle containing_page; 118 QPDFObjectHandle containing_page;
@@ -200,9 +200,9 @@ namespace @@ -200,9 +200,9 @@ namespace
200 { 200 {
201 public: 201 public:
202 LastChar(Pipeline* next); 202 LastChar(Pipeline* next);
203 - virtual ~LastChar() = default;  
204 - virtual void write(unsigned char const* data, size_t len);  
205 - virtual void finish(); 203 + ~LastChar() override = default;
  204 + void write(unsigned char const* data, size_t len) override;
  205 + void finish() override;
206 unsigned char getLastChar(); 206 unsigned char getLastChar();
207 207
208 private: 208 private:
@@ -1446,13 +1446,13 @@ namespace @@ -1446,13 +1446,13 @@ namespace
1446 { 1446 {
1447 } 1447 }
1448 1448
1449 - virtual void 1449 + void
1450 provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override 1450 provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override
1451 { 1451 {
1452 p1(pipeline); 1452 p1(pipeline);
1453 } 1453 }
1454 1454
1455 - virtual bool 1455 + bool
1456 provideStreamData( 1456 provideStreamData(
1457 QPDFObjGen const&, 1457 QPDFObjGen const&,
1458 Pipeline* pipeline, 1458 Pipeline* pipeline,
libqpdf/QPDFParser.cc
@@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
16 #include <qpdf/QPDF_Reserved.hh> 16 #include <qpdf/QPDF_Reserved.hh>
17 #include <qpdf/QPDF_Stream.hh> 17 #include <qpdf/QPDF_Stream.hh>
18 #include <qpdf/QPDF_String.hh> 18 #include <qpdf/QPDF_String.hh>
19 -#include <qpdf/QPDF_Unresolved.hh>  
20 #include <qpdf/QTC.hh> 19 #include <qpdf/QTC.hh>
21 #include <qpdf/QUtil.hh> 20 #include <qpdf/QUtil.hh>
22 21
libqpdf/QPDFSystemError.cc
1 #include <qpdf/QPDFSystemError.hh> 1 #include <qpdf/QPDFSystemError.hh>
2 2
3 -#include <qpdf/QUtil.hh>  
4 -#include <string.h> 3 +#include <cstring>
5 4
6 QPDFSystemError::QPDFSystemError( 5 QPDFSystemError::QPDFSystemError(
7 std::string const& description, int system_errno) : 6 std::string const& description, int system_errno) :
libqpdf/QPDFTokenizer.cc
@@ -11,8 +11,8 @@ @@ -11,8 +11,8 @@
11 #include <qpdf/QUtil.hh> 11 #include <qpdf/QUtil.hh>
12 12
13 #include <stdexcept> 13 #include <stdexcept>
14 -#include <stdlib.h>  
15 -#include <string.h> 14 +#include <cstdlib>
  15 +#include <cstring>
16 16
17 static inline bool 17 static inline bool
18 is_delimiter(char ch) 18 is_delimiter(char ch)
@@ -35,8 +35,8 @@ namespace @@ -35,8 +35,8 @@ namespace
35 str(str) 35 str(str)
36 { 36 {
37 } 37 }
38 - virtual ~QPDFWordTokenFinder() = default;  
39 - virtual bool check(); 38 + ~QPDFWordTokenFinder() override = default;
  39 + bool check() override;
40 40
41 private: 41 private:
42 std::shared_ptr<InputSource> is; 42 std::shared_ptr<InputSource> is;
libqpdf/QPDFWriter.cc
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 24
25 #include <algorithm> 25 #include <algorithm>
26 #include <stdexcept> 26 #include <stdexcept>
27 -#include <stdlib.h> 27 +#include <cstdlib>
28 28
29 QPDFWriter::ProgressReporter::~ProgressReporter() 29 QPDFWriter::ProgressReporter::~ProgressReporter()
30 { 30 {
@@ -997,7 +997,7 @@ void @@ -997,7 +997,7 @@ void
997 QPDFWriter::activatePipelineStack(PipelinePopper& pp) 997 QPDFWriter::activatePipelineStack(PipelinePopper& pp)
998 { 998 {
999 std::string stack_id("stack " + std::to_string(this->m->next_stack_id)); 999 std::string stack_id("stack " + std::to_string(this->m->next_stack_id));
1000 - Pl_Count* c = 1000 + auto* c =
1001 new Pl_Count(stack_id.c_str(), this->m->pipeline_stack.back()); 1001 new Pl_Count(stack_id.c_str(), this->m->pipeline_stack.back());
1002 ++this->m->next_stack_id; 1002 ++this->m->next_stack_id;
1003 this->m->pipeline_stack.push_back(c); 1003 this->m->pipeline_stack.push_back(c);
@@ -1030,7 +1030,7 @@ QPDFWriter::PipelinePopper::~PipelinePopper() @@ -1030,7 +1030,7 @@ QPDFWriter::PipelinePopper::~PipelinePopper()
1030 qw->m->md5_pipeline = nullptr; 1030 qw->m->md5_pipeline = nullptr;
1031 } 1031 }
1032 qw->m->pipeline_stack.pop_back(); 1032 qw->m->pipeline_stack.pop_back();
1033 - Pl_Buffer* buf = dynamic_cast<Pl_Buffer*>(p); 1033 + auto* buf = dynamic_cast<Pl_Buffer*>(p);
1034 if (bp && buf) { 1034 if (bp && buf) {
1035 *bp = buf->getBufferSharedPointer(); 1035 *bp = buf->getBufferSharedPointer();
1036 } 1036 }
libqpdf/QPDFXRefEntry.cc
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 2
3 #include <qpdf/QIntC.hh> 3 #include <qpdf/QIntC.hh>
4 #include <qpdf/QPDFExc.hh> 4 #include <qpdf/QPDFExc.hh>
5 -#include <qpdf/QUtil.hh>  
6 5
7 QPDFXRefEntry::QPDFXRefEntry() 6 QPDFXRefEntry::QPDFXRefEntry()
8 { 7 {
libqpdf/QPDF_Array.cc
@@ -83,7 +83,7 @@ QPDF_Array::copy(bool shallow) @@ -83,7 +83,7 @@ QPDF_Array::copy(bool shallow)
83 return do_create(new QPDF_Array(*this)); 83 return do_create(new QPDF_Array(*this));
84 } else { 84 } else {
85 if (sparse) { 85 if (sparse) {
86 - QPDF_Array* result = new QPDF_Array(); 86 + auto* result = new QPDF_Array();
87 result->sp_size = sp_size; 87 result->sp_size = sp_size;
88 for (auto const& element: sp_elements) { 88 for (auto const& element: sp_elements) {
89 auto const& obj = element.second; 89 auto const& obj = element.second;
libqpdf/QPDF_Name.cc
1 #include <qpdf/QPDF_Name.hh> 1 #include <qpdf/QPDF_Name.hh>
2 2
3 #include <qpdf/QUtil.hh> 3 #include <qpdf/QUtil.hh>
4 -#include <stdio.h>  
5 -#include <string.h>  
6 4
7 QPDF_Name::QPDF_Name(std::string const& name) : 5 QPDF_Name::QPDF_Name(std::string const& name) :
8 QPDFValue(::ot_name, "name"), 6 QPDFValue(::ot_name, "name"),
libqpdf/QPDF_Stream.cc
@@ -27,10 +27,10 @@ namespace @@ -27,10 +27,10 @@ namespace
27 { 27 {
28 public: 28 public:
29 SF_Crypt() = default; 29 SF_Crypt() = default;
30 - virtual ~SF_Crypt() = default; 30 + ~SF_Crypt() override = default;
31 31
32 - virtual bool  
33 - setDecodeParms(QPDFObjectHandle decode_parms) 32 + bool
  33 + setDecodeParms(QPDFObjectHandle decode_parms) override
34 { 34 {
35 if (decode_parms.isNull()) { 35 if (decode_parms.isNull()) {
36 return true; 36 return true;
@@ -49,8 +49,8 @@ namespace @@ -49,8 +49,8 @@ namespace
49 return filterable; 49 return filterable;
50 } 50 }
51 51
52 - virtual Pipeline*  
53 - getDecodePipeline(Pipeline*) 52 + Pipeline*
  53 + getDecodePipeline(Pipeline*) override
54 { 54 {
55 // Not used -- handled by pipeStreamData 55 // Not used -- handled by pipeStreamData
56 return nullptr; 56 return nullptr;
@@ -557,7 +557,7 @@ QPDF_Stream::pipeStreamData( @@ -557,7 +557,7 @@ QPDF_Stream::pipeStreamData(
557 if (decode_pipeline) { 557 if (decode_pipeline) {
558 pipeline = decode_pipeline; 558 pipeline = decode_pipeline;
559 } 559 }
560 - Pl_Flate* flate = dynamic_cast<Pl_Flate*>(pipeline); 560 + auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
561 if (flate != nullptr) { 561 if (flate != nullptr) {
562 flate->setWarnCallback( 562 flate->setWarnCallback(
563 [this](char const* msg, int code) { warn(msg); }); 563 [this](char const* msg, int code) { warn(msg); });
libqpdf/QPDF_String.cc
@@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
5 // DO NOT USE ctype -- it is locale dependent for some things, and 5 // DO NOT USE ctype -- it is locale dependent for some things, and
6 // it's not worth the risk of including it in case it may accidentally 6 // it's not worth the risk of including it in case it may accidentally
7 // be used. 7 // be used.
8 -#include <string.h>  
9 8
10 static bool 9 static bool
11 is_iso_latin1_printable(char ch) 10 is_iso_latin1_printable(char ch)
libqpdf/QPDF_encryption.cc
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 #include <qpdf/RC4.hh> 17 #include <qpdf/RC4.hh>
18 18
19 #include <algorithm> 19 #include <algorithm>
20 -#include <string.h> 20 +#include <cstring>
21 21
22 static unsigned char const padding_string[] = { 22 static unsigned char const padding_string[] = {
23 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 23 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e,
libqpdf/QPDF_json.cc
@@ -242,13 +242,13 @@ class QPDF::JSONReactor: public JSON::Reactor @@ -242,13 +242,13 @@ class QPDF::JSONReactor: public JSON::Reactor
242 } 242 }
243 } 243 }
244 virtual ~JSONReactor() = default; 244 virtual ~JSONReactor() = default;
245 - virtual void dictionaryStart() override;  
246 - virtual void arrayStart() override;  
247 - virtual void containerEnd(JSON const& value) override;  
248 - virtual void topLevelScalar() override;  
249 - virtual bool 245 + void dictionaryStart() override;
  246 + void arrayStart() override;
  247 + void containerEnd(JSON const& value) override;
  248 + void topLevelScalar() override;
  249 + bool
250 dictionaryItem(std::string const& key, JSON const& value) override; 250 dictionaryItem(std::string const& key, JSON const& value) override;
251 - virtual bool arrayItem(JSON const& value) override; 251 + bool arrayItem(JSON const& value) override;
252 252
253 bool anyErrors() const; 253 bool anyErrors() const;
254 254
libqpdf/QPDF_linearization.cc
@@ -13,9 +13,8 @@ @@ -13,9 +13,8 @@
13 #include <qpdf/QUtil.hh> 13 #include <qpdf/QUtil.hh>
14 14
15 #include <algorithm> 15 #include <algorithm>
16 -#include <iostream>  
17 -#include <math.h>  
18 -#include <string.h> 16 +#include <cmath>
  17 +#include <cstring>
19 18
20 template <class T, class int_type> 19 template <class T, class int_type>
21 static void 20 static void
libqpdf/QPDF_optimization.cc
@@ -115,7 +115,7 @@ QPDF::optimize( @@ -115,7 +115,7 @@ QPDF::optimize(
115 } 115 }
116 116
117 ObjUser root_ou = ObjUser(ObjUser::ou_root); 117 ObjUser root_ou = ObjUser(ObjUser::ou_root);
118 - QPDFObjGen root_og = QPDFObjGen(root.getObjGen()); 118 + auto root_og = QPDFObjGen(root.getObjGen());
119 this->m->obj_user_to_objects[root_ou].insert(root_og); 119 this->m->obj_user_to_objects[root_ou].insert(root_og);
120 this->m->object_to_obj_users[root_og].insert(root_ou); 120 this->m->object_to_obj_users[root_og].insert(root_ou);
121 121
libqpdf/QTC.cc
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 #include <qpdf/QUtil.hh> 3 #include <qpdf/QUtil.hh>
4 #include <map> 4 #include <map>
5 #include <set> 5 #include <set>
6 -#include <stdio.h> 6 +#include <cstdio>
7 7
8 static bool 8 static bool
9 tc_active(char const* const scope) 9 tc_active(char const* const scope)
libqpdf/QUtil.cc
@@ -9,9 +9,8 @@ @@ -9,9 +9,8 @@
9 #include <qpdf/QPDFSystemError.hh> 9 #include <qpdf/QPDFSystemError.hh>
10 #include <qpdf/QTC.hh> 10 #include <qpdf/QTC.hh>
11 11
12 -#include <cmath>  
13 -#include <ctype.h>  
14 -#include <errno.h> 12 +#include <cctype>
  13 +#include <cerrno>
15 #include <fcntl.h> 14 #include <fcntl.h>
16 #include <fstream> 15 #include <fstream>
17 #include <iomanip> 16 #include <iomanip>
@@ -22,9 +21,9 @@ @@ -22,9 +21,9 @@
22 #include <set> 21 #include <set>
23 #include <sstream> 22 #include <sstream>
24 #include <stdexcept> 23 #include <stdexcept>
25 -#include <stdio.h>  
26 -#include <stdlib.h>  
27 -#include <string.h> 24 +#include <cstdio>
  25 +#include <cstdlib>
  26 +#include <cstring>
28 #ifndef QPDF_NO_WCHAR_T 27 #ifndef QPDF_NO_WCHAR_T
29 # include <cwchar> 28 # include <cwchar>
30 #endif 29 #endif
@@ -837,8 +836,8 @@ char* @@ -837,8 +836,8 @@ char*
837 QUtil::getWhoami(char* argv0) 836 QUtil::getWhoami(char* argv0)
838 { 837 {
839 char* whoami = nullptr; 838 char* whoami = nullptr;
840 - if (((whoami = strrchr(argv0, '/')) == NULL) &&  
841 - ((whoami = strrchr(argv0, '\\')) == NULL)) { 839 + if (((whoami = strrchr(argv0, '/')) == nullptr) &&
  840 + ((whoami = strrchr(argv0, '\\')) == nullptr)) {
842 whoami = argv0; 841 whoami = argv0;
843 } else { 842 } else {
844 ++whoami; 843 ++whoami;
libqpdf/RC4.cc
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 2
3 #include <qpdf/QPDFCryptoProvider.hh> 3 #include <qpdf/QPDFCryptoProvider.hh>
4 4
5 -#include <string.h>  
6 5
7 RC4::RC4(unsigned char const* key_data, int key_len) : 6 RC4::RC4(unsigned char const* key_data, int key_len) :
8 crypto(QPDFCryptoProvider::getImpl()) 7 crypto(QPDFCryptoProvider::getImpl())
libqpdf/qpdf-c.cc
@@ -15,7 +15,6 @@ @@ -15,7 +15,6 @@
15 #include <qpdf/qpdf-c_impl.hh> 15 #include <qpdf/qpdf-c_impl.hh>
16 #include <qpdf/qpdflogger-c_impl.hh> 16 #include <qpdf/qpdflogger-c_impl.hh>
17 17
18 -#include <cstring>  
19 #include <functional> 18 #include <functional>
20 #include <list> 19 #include <list>
21 #include <stdexcept> 20 #include <stdexcept>
@@ -107,7 +106,7 @@ qpdf_data @@ -107,7 +106,7 @@ qpdf_data
107 qpdf_init() 106 qpdf_init()
108 { 107 {
109 QTC::TC("qpdf", "qpdf-c called qpdf_init"); 108 QTC::TC("qpdf", "qpdf-c called qpdf_init");
110 - qpdf_data qpdf = new _qpdf_data(); 109 + auto qpdf = new _qpdf_data();
111 qpdf->qpdf = QPDF::create(); 110 qpdf->qpdf = QPDF::create();
112 return qpdf; 111 return qpdf;
113 } 112 }
libqpdf/qpdf/BitStream.hh
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 #ifndef BITSTREAM_HH 3 #ifndef BITSTREAM_HH
4 #define BITSTREAM_HH 4 #define BITSTREAM_HH
5 5
6 -#include <stddef.h> 6 +#include <cstddef>
7 7
8 class BitStream 8 class BitStream
9 { 9 {
libqpdf/qpdf/BitWriter.hh
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 #ifndef BITWRITER_HH 3 #ifndef BITWRITER_HH
4 #define BITWRITER_HH 4 #define BITWRITER_HH
5 5
6 -#include <stddef.h> 6 +#include <cstddef>
7 7
8 class Pipeline; 8 class Pipeline;
9 9
libqpdf/qpdf/ContentNormalizer.hh
@@ -7,8 +7,8 @@ class ContentNormalizer: public QPDFObjectHandle::TokenFilter @@ -7,8 +7,8 @@ class ContentNormalizer: public QPDFObjectHandle::TokenFilter
7 { 7 {
8 public: 8 public:
9 ContentNormalizer(); 9 ContentNormalizer();
10 - virtual ~ContentNormalizer() = default;  
11 - virtual void handleToken(QPDFTokenizer::Token const&); 10 + ~ContentNormalizer() override = default;
  11 + void handleToken(QPDFTokenizer::Token const&) override;
12 12
13 bool anyBadTokens() const; 13 bool anyBadTokens() const;
14 bool lastTokenWasBad() const; 14 bool lastTokenWasBad() const;
libqpdf/qpdf/CryptoRandomDataProvider.hh
@@ -7,8 +7,8 @@ class CryptoRandomDataProvider: public RandomDataProvider @@ -7,8 +7,8 @@ class CryptoRandomDataProvider: public RandomDataProvider
7 { 7 {
8 public: 8 public:
9 CryptoRandomDataProvider() = default; 9 CryptoRandomDataProvider() = default;
10 - virtual ~CryptoRandomDataProvider() = default;  
11 - virtual void provideRandomData(unsigned char* data, size_t len); 10 + ~CryptoRandomDataProvider() override = default;
  11 + void provideRandomData(unsigned char* data, size_t len) override;
12 static RandomDataProvider* getInstance(); 12 static RandomDataProvider* getInstance();
13 }; 13 };
14 14
libqpdf/qpdf/InsecureRandomDataProvider.hh
@@ -7,8 +7,8 @@ class InsecureRandomDataProvider: public RandomDataProvider @@ -7,8 +7,8 @@ class InsecureRandomDataProvider: public RandomDataProvider
7 { 7 {
8 public: 8 public:
9 InsecureRandomDataProvider(); 9 InsecureRandomDataProvider();
10 - virtual ~InsecureRandomDataProvider() = default;  
11 - virtual void provideRandomData(unsigned char* data, size_t len); 10 + ~InsecureRandomDataProvider() override = default;
  11 + void provideRandomData(unsigned char* data, size_t len) override;
12 static RandomDataProvider* getInstance(); 12 static RandomDataProvider* getInstance();
13 13
14 private: 14 private:
libqpdf/qpdf/OffsetInputSource.hh
@@ -11,15 +11,15 @@ class OffsetInputSource: public InputSource @@ -11,15 +11,15 @@ class OffsetInputSource: public InputSource
11 public: 11 public:
12 OffsetInputSource( 12 OffsetInputSource(
13 std::shared_ptr<InputSource>, qpdf_offset_t global_offset); 13 std::shared_ptr<InputSource>, qpdf_offset_t global_offset);
14 - virtual ~OffsetInputSource() = default; 14 + ~OffsetInputSource() override = default;
15 15
16 - virtual qpdf_offset_t findAndSkipNextEOL();  
17 - virtual std::string const& getName() const;  
18 - virtual qpdf_offset_t tell();  
19 - virtual void seek(qpdf_offset_t offset, int whence);  
20 - virtual void rewind();  
21 - virtual size_t read(char* buffer, size_t length);  
22 - virtual void unreadCh(char ch); 16 + qpdf_offset_t findAndSkipNextEOL() override;
  17 + std::string const& getName() const override;
  18 + qpdf_offset_t tell() override;
  19 + void seek(qpdf_offset_t offset, int whence) override;
  20 + void rewind() override;
  21 + size_t read(char* buffer, size_t length) override;
  22 + void unreadCh(char ch) override;
23 23
24 private: 24 private:
25 std::shared_ptr<InputSource> proxied; 25 std::shared_ptr<InputSource> proxied;
libqpdf/qpdf/Pl_AES_PDF.hh
@@ -18,10 +18,10 @@ class Pl_AES_PDF: public Pipeline @@ -18,10 +18,10 @@ class Pl_AES_PDF: public Pipeline
18 bool encrypt, 18 bool encrypt,
19 unsigned char const* key, 19 unsigned char const* key,
20 size_t key_bytes); 20 size_t key_bytes);
21 - virtual ~Pl_AES_PDF() = default; 21 + ~Pl_AES_PDF() override = default;
22 22
23 - virtual void write(unsigned char const* data, size_t len);  
24 - virtual void finish(); 23 + void write(unsigned char const* data, size_t len) override;
  24 + void finish() override;
25 25
26 // Use zero initialization vector; needed for AESV3 26 // Use zero initialization vector; needed for AESV3
27 void useZeroIV(); 27 void useZeroIV();
libqpdf/qpdf/Pl_ASCII85Decoder.hh
@@ -7,9 +7,9 @@ class Pl_ASCII85Decoder: public Pipeline @@ -7,9 +7,9 @@ class Pl_ASCII85Decoder: public Pipeline
7 { 7 {
8 public: 8 public:
9 Pl_ASCII85Decoder(char const* identifier, Pipeline* next); 9 Pl_ASCII85Decoder(char const* identifier, Pipeline* next);
10 - virtual ~Pl_ASCII85Decoder() = default;  
11 - virtual void write(unsigned char const* buf, size_t len);  
12 - virtual void finish(); 10 + ~Pl_ASCII85Decoder() override = default;
  11 + void write(unsigned char const* buf, size_t len) override;
  12 + void finish() override;
13 13
14 private: 14 private:
15 void flush(); 15 void flush();
libqpdf/qpdf/Pl_ASCIIHexDecoder.hh
@@ -7,9 +7,9 @@ class Pl_ASCIIHexDecoder: public Pipeline @@ -7,9 +7,9 @@ class Pl_ASCIIHexDecoder: public Pipeline
7 { 7 {
8 public: 8 public:
9 Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next); 9 Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next);
10 - virtual ~Pl_ASCIIHexDecoder() = default;  
11 - virtual void write(unsigned char const* buf, size_t len);  
12 - virtual void finish(); 10 + ~Pl_ASCIIHexDecoder() override = default;
  11 + void write(unsigned char const* buf, size_t len) override;
  12 + void finish() override;
13 13
14 private: 14 private:
15 void flush(); 15 void flush();
libqpdf/qpdf/Pl_Base64.hh
@@ -8,9 +8,9 @@ class Pl_Base64: public Pipeline @@ -8,9 +8,9 @@ class Pl_Base64: public Pipeline
8 public: 8 public:
9 enum action_e { a_encode, a_decode }; 9 enum action_e { a_encode, a_decode };
10 Pl_Base64(char const* identifier, Pipeline* next, action_e); 10 Pl_Base64(char const* identifier, Pipeline* next, action_e);
11 - virtual ~Pl_Base64() = default;  
12 - virtual void write(unsigned char const* buf, size_t len) override;  
13 - virtual void finish() override; 11 + ~Pl_Base64() override = default;
  12 + void write(unsigned char const* buf, size_t len) override;
  13 + void finish() override;
14 14
15 private: 15 private:
16 void decode(unsigned char const* buf, size_t len); 16 void decode(unsigned char const* buf, size_t len);
libqpdf/qpdf/Pl_PNGFilter.hh
@@ -22,10 +22,10 @@ class Pl_PNGFilter: public Pipeline @@ -22,10 +22,10 @@ class Pl_PNGFilter: public Pipeline
22 unsigned int columns, 22 unsigned int columns,
23 unsigned int samples_per_pixel = 1, 23 unsigned int samples_per_pixel = 1,
24 unsigned int bits_per_sample = 8); 24 unsigned int bits_per_sample = 8);
25 - virtual ~Pl_PNGFilter() = default; 25 + ~Pl_PNGFilter() override = default;
26 26
27 - virtual void write(unsigned char const* data, size_t len);  
28 - virtual void finish(); 27 + void write(unsigned char const* data, size_t len) override;
  28 + void finish() override;
29 29
30 private: 30 private:
31 void decodeSub(); 31 void decodeSub();
libqpdf/qpdf/Pl_RC4.hh
@@ -17,10 +17,10 @@ class Pl_RC4: public Pipeline @@ -17,10 +17,10 @@ class Pl_RC4: public Pipeline
17 unsigned char const* key_data, 17 unsigned char const* key_data,
18 int key_len = -1, 18 int key_len = -1,
19 size_t out_bufsize = def_bufsize); 19 size_t out_bufsize = def_bufsize);
20 - virtual ~Pl_RC4() = default; 20 + ~Pl_RC4() override = default;
21 21
22 - virtual void write(unsigned char const* data, size_t len);  
23 - virtual void finish(); 22 + void write(unsigned char const* data, size_t len) override;
  23 + void finish() override;
24 24
25 private: 25 private:
26 std::shared_ptr<unsigned char> outbuf; 26 std::shared_ptr<unsigned char> outbuf;
libqpdf/qpdf/Pl_SHA2.hh
@@ -20,10 +20,10 @@ @@ -20,10 +20,10 @@
20 class Pl_SHA2: public Pipeline 20 class Pl_SHA2: public Pipeline
21 { 21 {
22 public: 22 public:
23 - Pl_SHA2(int bits = 0, Pipeline* next = 0);  
24 - virtual ~Pl_SHA2() = default;  
25 - virtual void write(unsigned char const*, size_t);  
26 - virtual void finish(); 23 + Pl_SHA2(int bits = 0, Pipeline* next = nullptr);
  24 + ~Pl_SHA2() override = default;
  25 + void write(unsigned char const*, size_t) override;
  26 + void finish() override;
27 void resetBits(int bits); 27 void resetBits(int bits);
28 std::string getHexDigest(); 28 std::string getHexDigest();
29 std::string getRawDigest(); 29 std::string getRawDigest();
libqpdf/qpdf/Pl_TIFFPredictor.hh
@@ -18,10 +18,10 @@ class Pl_TIFFPredictor: public Pipeline @@ -18,10 +18,10 @@ class Pl_TIFFPredictor: public Pipeline
18 unsigned int columns, 18 unsigned int columns,
19 unsigned int samples_per_pixel = 1, 19 unsigned int samples_per_pixel = 1,
20 unsigned int bits_per_sample = 8); 20 unsigned int bits_per_sample = 8);
21 - virtual ~Pl_TIFFPredictor() = default; 21 + ~Pl_TIFFPredictor() override = default;
22 22
23 - virtual void write(unsigned char const* data, size_t len);  
24 - virtual void finish(); 23 + void write(unsigned char const* data, size_t len) override;
  24 + void finish() override;
25 25
26 private: 26 private:
27 void processRow(); 27 void processRow();