Commit d0682f0f609e979ba085d93a1a0d8e0559f739bb
1 parent
e28f4efb
Use nullptr instead of 0 or NULL
Showing
33 changed files
with
72 additions
and
72 deletions
examples/qpdfjob-remove-annotations.cc
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | // The example is a full copy of the qpdf program modified to allways remove all |
| 12 | 12 | // annotations from the final output. |
| 13 | 13 | |
| 14 | -static char const* whoami = 0; | |
| 14 | +static char const* whoami = nullptr; | |
| 15 | 15 | |
| 16 | 16 | static void |
| 17 | 17 | usageExit(std::string const& msg) | ... | ... |
include/qpdf/Pl_Buffer.hh
| ... | ... | @@ -43,7 +43,7 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline |
| 43 | 43 | { |
| 44 | 44 | public: |
| 45 | 45 | QPDF_DLL |
| 46 | - Pl_Buffer(char const* identifier, Pipeline* next = 0); | |
| 46 | + Pl_Buffer(char const* identifier, Pipeline* next = nullptr); | |
| 47 | 47 | QPDF_DLL |
| 48 | 48 | virtual ~Pl_Buffer(); |
| 49 | 49 | QPDF_DLL | ... | ... |
include/qpdf/Pl_DCT.hh
| ... | ... | @@ -57,7 +57,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline |
| 57 | 57 | JDIMENSION image_height, |
| 58 | 58 | int components, |
| 59 | 59 | J_COLOR_SPACE color_space, |
| 60 | - CompressConfig* config_callback = 0); | |
| 60 | + CompressConfig* config_callback = nullptr); | |
| 61 | 61 | |
| 62 | 62 | QPDF_DLL |
| 63 | 63 | virtual ~Pl_DCT(); |
| ... | ... | @@ -91,7 +91,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline |
| 91 | 91 | JDIMENSION image_height = 0, |
| 92 | 92 | int components = 1, |
| 93 | 93 | J_COLOR_SPACE color_space = JCS_GRAYSCALE, |
| 94 | - CompressConfig* config_callback = 0); | |
| 94 | + CompressConfig* config_callback = nullptr); | |
| 95 | 95 | Members(Members const&) = delete; |
| 96 | 96 | |
| 97 | 97 | action_e action; | ... | ... |
include/qpdf/Pl_QPDFTokenizer.hh
| ... | ... | @@ -51,7 +51,7 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline |
| 51 | 51 | Pl_QPDFTokenizer( |
| 52 | 52 | char const* identifier, |
| 53 | 53 | QPDFObjectHandle::TokenFilter* filter, |
| 54 | - Pipeline* next = 0); | |
| 54 | + Pipeline* next = nullptr); | |
| 55 | 55 | QPDF_DLL |
| 56 | 56 | virtual ~Pl_QPDFTokenizer(); |
| 57 | 57 | QPDF_DLL | ... | ... |
include/qpdf/QPDF.hh
| ... | ... | @@ -83,7 +83,7 @@ class QPDF |
| 83 | 83 | // interpreted as a raw encryption key. See comments on |
| 84 | 84 | // setPasswordIsHexKey for more information. |
| 85 | 85 | QPDF_DLL |
| 86 | - void processFile(char const* filename, char const* password = 0); | |
| 86 | + void processFile(char const* filename, char const* password = nullptr); | |
| 87 | 87 | |
| 88 | 88 | // Parse a PDF from a stdio FILE*. The FILE must be open in |
| 89 | 89 | // binary mode and must be seekable. It may be open read only. |
| ... | ... | @@ -96,7 +96,7 @@ class QPDF |
| 96 | 96 | char const* description, |
| 97 | 97 | FILE* file, |
| 98 | 98 | bool close_file, |
| 99 | - char const* password = 0); | |
| 99 | + char const* password = nullptr); | |
| 100 | 100 | |
| 101 | 101 | // Parse a PDF file loaded into a memory buffer. This works |
| 102 | 102 | // exactly like processFile except that the PDF file is in memory |
| ... | ... | @@ -107,14 +107,14 @@ class QPDF |
| 107 | 107 | char const* description, |
| 108 | 108 | char const* buf, |
| 109 | 109 | size_t length, |
| 110 | - char const* password = 0); | |
| 110 | + char const* password = nullptr); | |
| 111 | 111 | |
| 112 | 112 | // Parse a PDF file loaded from a custom InputSource. If you have |
| 113 | 113 | // your own method of retrieving a PDF file, you can subclass |
| 114 | 114 | // InputSource and use this method. |
| 115 | 115 | QPDF_DLL |
| 116 | 116 | void |
| 117 | - processInputSource(std::shared_ptr<InputSource>, char const* password = 0); | |
| 117 | + processInputSource(std::shared_ptr<InputSource>, char const* password = nullptr); | |
| 118 | 118 | |
| 119 | 119 | // Create a PDF from an input source that contains JSON as written |
| 120 | 120 | // by writeJSON (or qpdf --json-output, version 2 or higher). The | ... | ... |
include/qpdf/QPDFCryptoImpl.hh
include/qpdf/QPDFJob.hh
| ... | ... | @@ -497,7 +497,7 @@ class QPDFJob |
| 497 | 497 | |
| 498 | 498 | // Helper functions |
| 499 | 499 | static void usage(std::string const& msg); |
| 500 | - static JSON json_schema(int json_version, std::set<std::string>* keys = 0); | |
| 500 | + static JSON json_schema(int json_version, std::set<std::string>* keys = nullptr); | |
| 501 | 501 | static void parse_object_id( |
| 502 | 502 | std::string const& objspec, bool& trailer, int& obj, int& gen); |
| 503 | 503 | void parseRotationParameter(std::string const&); | ... | ... |
include/qpdf/QPDFObjectHandle.hh
| ... | ... | @@ -526,7 +526,7 @@ class QPDFObjectHandle |
| 526 | 526 | QPDF_DLL |
| 527 | 527 | void parsePageContents(ParserCallbacks* callbacks); |
| 528 | 528 | QPDF_DLL |
| 529 | - void filterPageContents(TokenFilter* filter, Pipeline* next = 0); | |
| 529 | + void filterPageContents(TokenFilter* filter, Pipeline* next = nullptr); | |
| 530 | 530 | // See comments for QPDFPageObjectHelper::pipeContents. |
| 531 | 531 | QPDF_DLL |
| 532 | 532 | void pipePageContents(Pipeline* p); |
| ... | ... | @@ -538,7 +538,7 @@ class QPDFObjectHandle |
| 538 | 538 | // contents. This can be used to apply a TokenFilter to a form |
| 539 | 539 | // XObject, whose data is in the same format as a content stream. |
| 540 | 540 | QPDF_DLL |
| 541 | - void filterAsContents(TokenFilter* filter, Pipeline* next = 0); | |
| 541 | + void filterAsContents(TokenFilter* filter, Pipeline* next = nullptr); | |
| 542 | 542 | // Called on a stream to parse the stream as page contents. This |
| 543 | 543 | // can be used to parse a form XObject. |
| 544 | 544 | QPDF_DLL | ... | ... |
include/qpdf/QPDFOutlineObjectHelper.hh
| ... | ... | @@ -42,7 +42,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper |
| 42 | 42 | { |
| 43 | 43 | // This must be cleared explicitly to avoid circular references |
| 44 | 44 | // that prevent cleanup of pointer holders. |
| 45 | - this->m->parent = 0; | |
| 45 | + this->m->parent = nullptr; | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // All constructors are private. You can only create one of these | ... | ... |
include/qpdf/QPDFPageObjectHelper.hh
| ... | ... | @@ -320,12 +320,12 @@ class QPDFPageObjectHelper: public QPDFObjectHelper |
| 320 | 320 | // examples/pdf-count-strings.cc for an example. |
| 321 | 321 | QPDF_DLL |
| 322 | 322 | void |
| 323 | - filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0); | |
| 323 | + filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); | |
| 324 | 324 | |
| 325 | 325 | // Old name -- calls filterContents() |
| 326 | 326 | QPDF_DLL |
| 327 | 327 | void filterPageContents( |
| 328 | - QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0); | |
| 328 | + QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); | |
| 329 | 329 | |
| 330 | 330 | // Pipe a page's contents through the given pipeline. This method |
| 331 | 331 | // works whether the contents are a single stream or an array of | ... | ... |
include/qpdf/QPDFWriter.hh
| ... | ... | @@ -539,7 +539,7 @@ class QPDFWriter |
| 539 | 539 | friend class QPDFWriter; |
| 540 | 540 | |
| 541 | 541 | public: |
| 542 | - PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = 0) : | |
| 542 | + PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = nullptr) : | |
| 543 | 543 | qw(qw), |
| 544 | 544 | bp(bp) |
| 545 | 545 | { | ... | ... |
include/qpdf/QUtil.hh
| ... | ... | @@ -245,7 +245,7 @@ namespace QUtil |
| 245 | 245 | // Returns true iff the variable is defined. If `value' is |
| 246 | 246 | // non-null, initializes it with the value of the variable. |
| 247 | 247 | QPDF_DLL |
| 248 | - bool get_env(std::string const& var, std::string* value = 0); | |
| 248 | + bool get_env(std::string const& var, std::string* value = nullptr); | |
| 249 | 249 | |
| 250 | 250 | QPDF_DLL |
| 251 | 251 | time_t get_current_time(); | ... | ... |
libqpdf/QUtil.cc
| ... | ... | @@ -836,8 +836,8 @@ char* |
| 836 | 836 | QUtil::getWhoami(char* argv0) |
| 837 | 837 | { |
| 838 | 838 | char* whoami = nullptr; |
| 839 | - if (((whoami = strrchr(argv0, '/')) == NULL) && | |
| 840 | - ((whoami = strrchr(argv0, '\\')) == NULL)) { | |
| 839 | + if (((whoami = strrchr(argv0, '/')) == nullptr) && | |
| 840 | + ((whoami = strrchr(argv0, '\\')) == nullptr)) { | |
| 841 | 841 | whoami = argv0; |
| 842 | 842 | } else { |
| 843 | 843 | ++whoami; | ... | ... |
libqpdf/qpdf/Pl_SHA2.hh
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | class Pl_SHA2: public Pipeline |
| 21 | 21 | { |
| 22 | 22 | public: |
| 23 | - Pl_SHA2(int bits = 0, Pipeline* next = 0); | |
| 23 | + Pl_SHA2(int bits = 0, Pipeline* next = nullptr); | |
| 24 | 24 | virtual ~Pl_SHA2() = default; |
| 25 | 25 | virtual void write(unsigned char const*, size_t); |
| 26 | 26 | virtual void finish(); | ... | ... |
libqpdf/qpdf/QPDFArgParser.hh
| ... | ... | @@ -177,9 +177,9 @@ class QPDFArgParser |
| 177 | 177 | { |
| 178 | 178 | OptionEntry() : |
| 179 | 179 | parameter_needed(false), |
| 180 | - bare_arg_handler(0), | |
| 181 | - param_arg_handler(0), | |
| 182 | - invalid_choice_handler(0) | |
| 180 | + bare_arg_handler(nullptr), | |
| 181 | + param_arg_handler(nullptr), | |
| 182 | + invalid_choice_handler(nullptr) | |
| 183 | 183 | { |
| 184 | 184 | } |
| 185 | 185 | bool parameter_needed; | ... | ... |
libqpdf/qpdf/QPDFCrypto_openssl.hh
| ... | ... | @@ -39,7 +39,7 @@ class QPDFCrypto_openssl: public QPDFCryptoImpl |
| 39 | 39 | void RC4_process( |
| 40 | 40 | unsigned char const* in_data, |
| 41 | 41 | size_t len, |
| 42 | - unsigned char* out_data = 0) override; | |
| 42 | + unsigned char* out_data = nullptr) override; | |
| 43 | 43 | void RC4_finalize() override; |
| 44 | 44 | |
| 45 | 45 | void SHA2_init(int bits) override; | ... | ... |
libtests/aes.cc
| ... | ... | @@ -29,9 +29,9 @@ main(int argc, char* argv[]) |
| 29 | 29 | { |
| 30 | 30 | bool encrypt = true; |
| 31 | 31 | bool cbc_mode = true; |
| 32 | - char* hexkey = 0; | |
| 33 | - char* infilename = 0; | |
| 34 | - char* outfilename = 0; | |
| 32 | + char* hexkey = nullptr; | |
| 33 | + char* infilename = nullptr; | |
| 34 | + char* outfilename = nullptr; | |
| 35 | 35 | bool zero_iv = false; |
| 36 | 36 | bool static_iv = false; |
| 37 | 37 | bool disable_padding = false; |
| ... | ... | @@ -65,7 +65,7 @@ main(int argc, char* argv[]) |
| 65 | 65 | usage(); |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | - if (outfilename == 0) { | |
| 68 | + if (outfilename == nullptr) { | |
| 69 | 69 | usage(); |
| 70 | 70 | } |
| 71 | 71 | |
| ... | ... | @@ -81,14 +81,14 @@ main(int argc, char* argv[]) |
| 81 | 81 | t[1] = hexkey[i + 1]; |
| 82 | 82 | t[2] = '\0'; |
| 83 | 83 | |
| 84 | - long val = strtol(t, 0, 16); | |
| 84 | + long val = strtol(t, nullptr, 16); | |
| 85 | 85 | key[i / 2] = static_cast<unsigned char>(val); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile); |
| 89 | 89 | Pl_AES_PDF* aes = new Pl_AES_PDF("aes_128_cbc", out, encrypt, key, keylen); |
| 90 | 90 | delete[] key; |
| 91 | - key = 0; | |
| 91 | + key = nullptr; | |
| 92 | 92 | if (!cbc_mode) { |
| 93 | 93 | aes->disableCBC(); |
| 94 | 94 | } | ... | ... |
libtests/arg_parser.cc
| ... | ... | @@ -51,7 +51,7 @@ ArgParser::initOptions() |
| 51 | 51 | ap.addBare("potato", b(&ArgParser::handlePotato)); |
| 52 | 52 | ap.addRequiredParameter("salad", p(&ArgParser::handleSalad), "tossed"); |
| 53 | 53 | ap.addOptionalParameter("moo", p(&ArgParser::handleMoo)); |
| 54 | - char const* choices[] = {"pig", "boar", "sow", 0}; | |
| 54 | + char const* choices[] = {"pig", "boar", "sow", nullptr}; | |
| 55 | 55 | ap.addChoices("oink", p(&ArgParser::handleOink), true, choices); |
| 56 | 56 | ap.selectHelpOptionTable(); |
| 57 | 57 | ap.addBare("version", [this]() { output("3.14159"); }); | ... | ... |
libtests/numrange.cc
libtests/predictors.cc
| ... | ... | @@ -21,7 +21,7 @@ run(char const* filename, |
| 21 | 21 | FILE* in = QUtil::safe_fopen(filename, "rb"); |
| 22 | 22 | FILE* o1 = QUtil::safe_fopen("out", "wb"); |
| 23 | 23 | Pipeline* out = new Pl_StdioFile("out", o1); |
| 24 | - Pipeline* pl = 0; | |
| 24 | + Pipeline* pl = nullptr; | |
| 25 | 25 | if (strcmp(filter, "png") == 0) { |
| 26 | 26 | pl = new Pl_PNGFilter( |
| 27 | 27 | "png", | ... | ... |
libtests/qutil.cc
| ... | ... | @@ -489,7 +489,7 @@ same_file_test() |
| 489 | 489 | assert_same_file("qutil.out", "qutil.out", true); |
| 490 | 490 | assert_same_file("qutil.out", "other-file", false); |
| 491 | 491 | assert_same_file("qutil.out", "", false); |
| 492 | - assert_same_file("qutil.out", 0, false); | |
| 492 | + assert_same_file("qutil.out", nullptr, false); | |
| 493 | 493 | assert_same_file("", "qutil.out", false); |
| 494 | 494 | } |
| 495 | 495 | ... | ... |
libtests/random.cc
| ... | ... | @@ -56,7 +56,7 @@ main() |
| 56 | 56 | if (!((buf[0] == 0) && (buf[1] == 1) && (buf[2] == 2) && (buf[3] == 3))) { |
| 57 | 57 | std::cout << "fail: bogus random didn't provide correct bytes\n"; |
| 58 | 58 | } |
| 59 | - QUtil::setRandomDataProvider(0); | |
| 59 | + QUtil::setRandomDataProvider(nullptr); | |
| 60 | 60 | if (QUtil::getRandomDataProvider() != orig_rdp) { |
| 61 | 61 | std::cout << "fail: passing null to setRandomDataProvider " |
| 62 | 62 | "didn't reset the random data provider\n"; | ... | ... |
libtests/rc4.cc
qpdf/fix-qdf.cc
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | #include <regex> |
| 9 | 9 | #include <string_view> |
| 10 | 10 | |
| 11 | -static char const* whoami = 0; | |
| 11 | +static char const* whoami = nullptr; | |
| 12 | 12 | |
| 13 | 13 | static void |
| 14 | 14 | usage() |
| ... | ... | @@ -392,7 +392,7 @@ realmain(int argc, char* argv[]) |
| 392 | 392 | { |
| 393 | 393 | whoami = QUtil::getWhoami(argv[0]); |
| 394 | 394 | QUtil::setLineBuf(stdout); |
| 395 | - char const* filename = 0; | |
| 395 | + char const* filename = nullptr; | |
| 396 | 396 | if (argc > 2) { |
| 397 | 397 | usage(); |
| 398 | 398 | } else if ((argc > 1) && (strcmp(argv[1], "--version") == 0)) { |
| ... | ... | @@ -405,7 +405,7 @@ realmain(int argc, char* argv[]) |
| 405 | 405 | filename = argv[1]; |
| 406 | 406 | } |
| 407 | 407 | std::string input; |
| 408 | - if (filename == 0) { | |
| 408 | + if (filename == nullptr) { | |
| 409 | 409 | filename = "standard input"; |
| 410 | 410 | QUtil::binary_stdin(); |
| 411 | 411 | input = QUtil::read_file_into_string(stdin); | ... | ... |
qpdf/pdf_from_scratch.cc
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | #include <cstdlib> |
| 10 | 10 | #include <cstring> |
| 11 | 11 | |
| 12 | -static char const* whoami = 0; | |
| 12 | +static char const* whoami = nullptr; | |
| 13 | 13 | |
| 14 | 14 | void |
| 15 | 15 | usage() |
| ... | ... | @@ -86,7 +86,7 @@ int |
| 86 | 86 | main(int argc, char* argv[]) |
| 87 | 87 | { |
| 88 | 88 | QUtil::setLineBuf(stdout); |
| 89 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 89 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 90 | 90 | whoami = argv[0]; |
| 91 | 91 | } else { |
| 92 | 92 | ++whoami; | ... | ... |
qpdf/qpdf.cc
qpdf/test_driver.cc
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | #define QPDF_OBJECT_NOWARN |
| 38 | 38 | #include <qpdf/QPDFObject.hh> |
| 39 | 39 | |
| 40 | -static char const* whoami = 0; | |
| 40 | +static char const* whoami = nullptr; | |
| 41 | 41 | |
| 42 | 42 | void |
| 43 | 43 | usage() |
| ... | ... | @@ -286,7 +286,7 @@ test_0_1(QPDF& pdf, char const* arg2) |
| 286 | 286 | qtest.pipeStreamData(out.get(), 0, qpdf_dl_none); |
| 287 | 287 | |
| 288 | 288 | std::cout << std::endl << "Uncompressed stream data:" << std::endl; |
| 289 | - if (qtest.pipeStreamData(0, 0, qpdf_dl_all)) { | |
| 289 | + if (qtest.pipeStreamData(nullptr, 0, qpdf_dl_all)) { | |
| 290 | 290 | std::cout.flush(); |
| 291 | 291 | QUtil::binary_stdout(); |
| 292 | 292 | out = std::make_shared<Pl_StdioFile>("filtered", stdout); |
| ... | ... | @@ -387,7 +387,7 @@ test_4(QPDF& pdf, char const* arg2) |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | trailer.replaceKey("/Info", pdf.makeIndirectObject(qtest)); |
| 390 | - QPDFWriter w(pdf, 0); | |
| 390 | + QPDFWriter w(pdf, nullptr); | |
| 391 | 391 | w.setQDFMode(true); |
| 392 | 392 | w.setStaticID(true); |
| 393 | 393 | w.write(); |
| ... | ... | @@ -599,7 +599,7 @@ test_12(QPDF& pdf, char const* arg2) |
| 599 | 599 | # pragma GCC diagnostic push |
| 600 | 600 | # pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 601 | 601 | #endif |
| 602 | - pdf.setOutputStreams(0, 0); | |
| 602 | + pdf.setOutputStreams(nullptr, nullptr); | |
| 603 | 603 | #if (defined(__GNUC__) || defined(__clang__)) |
| 604 | 604 | # pragma GCC diagnostic pop |
| 605 | 605 | #endif |
| ... | ... | @@ -1009,7 +1009,7 @@ test_25(QPDF& pdf, char const* arg2) |
| 1009 | 1009 | // Copy qtest without crossing page boundaries. Should get O1 |
| 1010 | 1010 | // and O2 and their streams but not O3 or any other pages. |
| 1011 | 1011 | |
| 1012 | - assert(arg2 != 0); | |
| 1012 | + assert(arg2 != nullptr); | |
| 1013 | 1013 | { |
| 1014 | 1014 | // Make sure original PDF is out of scope when we write. |
| 1015 | 1015 | QPDF oldpdf; |
| ... | ... | @@ -1035,7 +1035,7 @@ test_26(QPDF& pdf, char const* arg2) |
| 1035 | 1035 | |
| 1036 | 1036 | { |
| 1037 | 1037 | // Make sure original PDF is out of scope when we write. |
| 1038 | - assert(arg2 != 0); | |
| 1038 | + assert(arg2 != nullptr); | |
| 1039 | 1039 | QPDF oldpdf; |
| 1040 | 1040 | oldpdf.processFile(arg2); |
| 1041 | 1041 | QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest"); |
| ... | ... | @@ -1104,7 +1104,7 @@ test_27(QPDF& pdf, char const* arg2) |
| 1104 | 1104 | QPDFObjectHandle s3 = QPDFObjectHandle::newStream(&empty3); |
| 1105 | 1105 | s3.replaceStreamData( |
| 1106 | 1106 | p2, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull()); |
| 1107 | - assert(arg2 != 0); | |
| 1107 | + assert(arg2 != nullptr); | |
| 1108 | 1108 | QPDF oldpdf; |
| 1109 | 1109 | oldpdf.processFile(arg2); |
| 1110 | 1110 | QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest"); |
| ... | ... | @@ -1151,7 +1151,7 @@ static void |
| 1151 | 1151 | test_29(QPDF& pdf, char const* arg2) |
| 1152 | 1152 | { |
| 1153 | 1153 | // Detect mixed objects in QPDFWriter |
| 1154 | - assert(arg2 != 0); | |
| 1154 | + assert(arg2 != nullptr); | |
| 1155 | 1155 | auto other = QPDF::create(); |
| 1156 | 1156 | other->processFile(arg2); |
| 1157 | 1157 | // We need to create a QPDF with mixed ownership to exercise |
| ... | ... | @@ -1201,7 +1201,7 @@ test_29(QPDF& pdf, char const* arg2) |
| 1201 | 1201 | static void |
| 1202 | 1202 | test_30(QPDF& pdf, char const* arg2) |
| 1203 | 1203 | { |
| 1204 | - assert(arg2 != 0); | |
| 1204 | + assert(arg2 != nullptr); | |
| 1205 | 1205 | QPDF encrypted; |
| 1206 | 1206 | encrypted.processFile(arg2, "user"); |
| 1207 | 1207 | QPDFWriter w(pdf, "b.pdf"); |
| ... | ... | @@ -1433,7 +1433,7 @@ test_40(QPDF& pdf, char const* arg2) |
| 1433 | 1433 | // feature was implemented by Sahil Arora |
| 1434 | 1434 | // <sahilarora.535@gmail.com> as part of a Google Summer of |
| 1435 | 1435 | // Code project in 2017. |
| 1436 | - assert(arg2 != 0); | |
| 1436 | + assert(arg2 != nullptr); | |
| 1437 | 1437 | QPDFWriter w(pdf, arg2); |
| 1438 | 1438 | w.setPCLm(true); |
| 1439 | 1439 | w.setStaticID(true); |
| ... | ... | @@ -3558,11 +3558,11 @@ runtest(int n, char const* filename1, char const* arg2) |
| 3558 | 3558 | |
| 3559 | 3559 | QPDF pdf; |
| 3560 | 3560 | std::shared_ptr<char> file_buf; |
| 3561 | - FILE* filep = 0; | |
| 3561 | + FILE* filep = nullptr; | |
| 3562 | 3562 | if (n == 0) { |
| 3563 | 3563 | pdf.setAttemptRecovery(false); |
| 3564 | 3564 | } |
| 3565 | - if (((n == 35) || (n == 36)) && (arg2 != 0)) { | |
| 3565 | + if (((n == 35) || (n == 36)) && (arg2 != nullptr)) { | |
| 3566 | 3566 | // arg2 is password |
| 3567 | 3567 | pdf.processFile(filename1, arg2); |
| 3568 | 3568 | } else if (n == 45) { |
| ... | ... | @@ -3652,7 +3652,7 @@ int |
| 3652 | 3652 | main(int argc, char* argv[]) |
| 3653 | 3653 | { |
| 3654 | 3654 | QUtil::setLineBuf(stdout); |
| 3655 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 3655 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 3656 | 3656 | whoami = argv[0]; |
| 3657 | 3657 | } else { |
| 3658 | 3658 | ++whoami; | ... | ... |
qpdf/test_large_file.cc
| ... | ... | @@ -35,7 +35,7 @@ |
| 35 | 35 | // reading the large file then allows us to verify large file support |
| 36 | 36 | // with confidence. |
| 37 | 37 | |
| 38 | -static char const* whoami = 0; | |
| 38 | +static char const* whoami = nullptr; | |
| 39 | 39 | |
| 40 | 40 | // Height should be a multiple of 10 |
| 41 | 41 | static size_t const nstripes = 10; |
| ... | ... | @@ -47,7 +47,7 @@ static size_t const npages = 200; |
| 47 | 47 | size_t stripesize = 0; |
| 48 | 48 | size_t width = 0; |
| 49 | 49 | size_t height = 0; |
| 50 | -static unsigned char* buf = 0; | |
| 50 | +static unsigned char* buf = nullptr; | |
| 51 | 51 | |
| 52 | 52 | static inline unsigned char |
| 53 | 53 | get_pixel_color(size_t n, size_t row) |
| ... | ... | @@ -73,7 +73,7 @@ class ImageChecker: public Pipeline |
| 73 | 73 | }; |
| 74 | 74 | |
| 75 | 75 | ImageChecker::ImageChecker(size_t n) : |
| 76 | - Pipeline("image checker", 0), | |
| 76 | + Pipeline("image checker", nullptr), | |
| 77 | 77 | n(n), |
| 78 | 78 | offset(0), |
| 79 | 79 | okay(true) |
| ... | ... | @@ -122,7 +122,7 @@ ImageProvider::ImageProvider(size_t n) : |
| 122 | 122 | void |
| 123 | 123 | ImageProvider::provideStreamData(int objid, int generation, Pipeline* pipeline) |
| 124 | 124 | { |
| 125 | - if (buf == 0) { | |
| 125 | + if (buf == nullptr) { | |
| 126 | 126 | buf = new unsigned char[width * stripesize]; |
| 127 | 127 | } |
| 128 | 128 | std::cout << "page " << n << " of " << npages << std::endl; | ... | ... |
qpdf/test_pdf_doc_encoding.cc
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | #include <cstdlib> |
| 5 | 5 | #include <cstring> |
| 6 | 6 | |
| 7 | -static char const* whoami = 0; | |
| 7 | +static char const* whoami = nullptr; | |
| 8 | 8 | |
| 9 | 9 | void |
| 10 | 10 | usage() |
| ... | ... | @@ -16,7 +16,7 @@ usage() |
| 16 | 16 | int |
| 17 | 17 | main(int argc, char* argv[]) |
| 18 | 18 | { |
| 19 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 19 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 20 | 20 | whoami = argv[0]; |
| 21 | 21 | } else { |
| 22 | 22 | ++whoami; | ... | ... |
qpdf/test_pdf_unicode.cc
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | #include <cstdlib> |
| 5 | 5 | #include <cstring> |
| 6 | 6 | |
| 7 | -static char const* whoami = 0; | |
| 7 | +static char const* whoami = nullptr; | |
| 8 | 8 | |
| 9 | 9 | void |
| 10 | 10 | usage() |
| ... | ... | @@ -16,7 +16,7 @@ usage() |
| 16 | 16 | int |
| 17 | 17 | main(int argc, char* argv[]) |
| 18 | 18 | { |
| 19 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 19 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 20 | 20 | whoami = argv[0]; |
| 21 | 21 | } else { |
| 22 | 22 | ++whoami; | ... | ... |
qpdf/test_tokenizer.cc
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | #include <cstdlib> |
| 12 | 12 | #include <cstring> |
| 13 | 13 | |
| 14 | -static char const* whoami = 0; | |
| 14 | +static char const* whoami = nullptr; | |
| 15 | 15 | |
| 16 | 16 | void |
| 17 | 17 | usage() |
| ... | ... | @@ -91,7 +91,7 @@ tokenTypeName(QPDFTokenizer::token_type_e ttype) |
| 91 | 91 | case QPDFTokenizer::tt_inline_image: |
| 92 | 92 | return "inline-image"; |
| 93 | 93 | } |
| 94 | - return 0; | |
| 94 | + return nullptr; | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | static std::string |
| ... | ... | @@ -238,13 +238,13 @@ int |
| 238 | 238 | main(int argc, char* argv[]) |
| 239 | 239 | { |
| 240 | 240 | QUtil::setLineBuf(stdout); |
| 241 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 241 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 242 | 242 | whoami = argv[0]; |
| 243 | 243 | } else { |
| 244 | 244 | ++whoami; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - char const* filename = 0; | |
| 247 | + char const* filename = nullptr; | |
| 248 | 248 | size_t max_len = 0; |
| 249 | 249 | bool include_ignorable = true; |
| 250 | 250 | for (int i = 1; i < argc; ++i) { |
| ... | ... | @@ -265,7 +265,7 @@ main(int argc, char* argv[]) |
| 265 | 265 | filename = argv[i]; |
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | - if (filename == 0) { | |
| 268 | + if (filename == nullptr) { | |
| 269 | 269 | usage(); |
| 270 | 270 | } |
| 271 | 271 | ... | ... |
qpdf/test_unicode_filenames.cc
zlib-flate/zlib-flate.cc
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | #include <cstdlib> |
| 10 | 10 | #include <cstring> |
| 11 | 11 | |
| 12 | -static char const* whoami = 0; | |
| 12 | +static char const* whoami = nullptr; | |
| 13 | 13 | |
| 14 | 14 | void |
| 15 | 15 | usage() |
| ... | ... | @@ -27,7 +27,7 @@ usage() |
| 27 | 27 | int |
| 28 | 28 | main(int argc, char* argv[]) |
| 29 | 29 | { |
| 30 | - if ((whoami = strrchr(argv[0], '/')) == NULL) { | |
| 30 | + if ((whoami = strrchr(argv[0], '/')) == nullptr) { | |
| 31 | 31 | whoami = argv[0]; |
| 32 | 32 | } else { |
| 33 | 33 | ++whoami; | ... | ... |