diff --git a/examples/qpdfjob-remove-annotations.cc b/examples/qpdfjob-remove-annotations.cc index fd8754d5..5334e7dc 100644 --- a/examples/qpdfjob-remove-annotations.cc +++ b/examples/qpdfjob-remove-annotations.cc @@ -11,7 +11,7 @@ // The example is a full copy of the qpdf program modified to allways remove all // annotations from the final output. -static char const* whoami = 0; +static char const* whoami = nullptr; static void usageExit(std::string const& msg) diff --git a/include/qpdf/Pl_Buffer.hh b/include/qpdf/Pl_Buffer.hh index e2f71094..fcef0c56 100644 --- a/include/qpdf/Pl_Buffer.hh +++ b/include/qpdf/Pl_Buffer.hh @@ -43,7 +43,7 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline { public: QPDF_DLL - Pl_Buffer(char const* identifier, Pipeline* next = 0); + Pl_Buffer(char const* identifier, Pipeline* next = nullptr); QPDF_DLL virtual ~Pl_Buffer(); QPDF_DLL diff --git a/include/qpdf/Pl_DCT.hh b/include/qpdf/Pl_DCT.hh index 543967ec..9352091f 100644 --- a/include/qpdf/Pl_DCT.hh +++ b/include/qpdf/Pl_DCT.hh @@ -57,7 +57,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline JDIMENSION image_height, int components, J_COLOR_SPACE color_space, - CompressConfig* config_callback = 0); + CompressConfig* config_callback = nullptr); QPDF_DLL virtual ~Pl_DCT(); @@ -91,7 +91,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline JDIMENSION image_height = 0, int components = 1, J_COLOR_SPACE color_space = JCS_GRAYSCALE, - CompressConfig* config_callback = 0); + CompressConfig* config_callback = nullptr); Members(Members const&) = delete; action_e action; diff --git a/include/qpdf/Pl_QPDFTokenizer.hh b/include/qpdf/Pl_QPDFTokenizer.hh index ce3615ec..0b8cafc2 100644 --- a/include/qpdf/Pl_QPDFTokenizer.hh +++ b/include/qpdf/Pl_QPDFTokenizer.hh @@ -51,7 +51,7 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline Pl_QPDFTokenizer( char const* identifier, QPDFObjectHandle::TokenFilter* filter, - Pipeline* next = 0); + Pipeline* next = nullptr); QPDF_DLL virtual ~Pl_QPDFTokenizer(); QPDF_DLL diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 5567a686..03490af7 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -83,7 +83,7 @@ class QPDF // interpreted as a raw encryption key. See comments on // setPasswordIsHexKey for more information. QPDF_DLL - void processFile(char const* filename, char const* password = 0); + void processFile(char const* filename, char const* password = nullptr); // Parse a PDF from a stdio FILE*. The FILE must be open in // binary mode and must be seekable. It may be open read only. @@ -96,7 +96,7 @@ class QPDF char const* description, FILE* file, bool close_file, - char const* password = 0); + char const* password = nullptr); // Parse a PDF file loaded into a memory buffer. This works // exactly like processFile except that the PDF file is in memory @@ -107,14 +107,14 @@ class QPDF char const* description, char const* buf, size_t length, - char const* password = 0); + char const* password = nullptr); // Parse a PDF file loaded from a custom InputSource. If you have // your own method of retrieving a PDF file, you can subclass // InputSource and use this method. QPDF_DLL void - processInputSource(std::shared_ptr, char const* password = 0); + processInputSource(std::shared_ptr, char const* password = nullptr); // Create a PDF from an input source that contains JSON as written // by writeJSON (or qpdf --json-output, version 2 or higher). The diff --git a/include/qpdf/QPDFCryptoImpl.hh b/include/qpdf/QPDFCryptoImpl.hh index 5345b45b..3fd64d3a 100644 --- a/include/qpdf/QPDFCryptoImpl.hh +++ b/include/qpdf/QPDFCryptoImpl.hh @@ -80,7 +80,7 @@ class QPDF_DLL_CLASS QPDFCryptoImpl virtual void RC4_process( unsigned char const* in_data, size_t len, - unsigned char* out_data = 0) = 0; + unsigned char* out_data = nullptr) = 0; QPDF_DLL virtual void RC4_finalize() = 0; diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh index 2a82d61c..7396cd6a 100644 --- a/include/qpdf/QPDFJob.hh +++ b/include/qpdf/QPDFJob.hh @@ -497,7 +497,7 @@ class QPDFJob // Helper functions static void usage(std::string const& msg); - static JSON json_schema(int json_version, std::set* keys = 0); + static JSON json_schema(int json_version, std::set* keys = nullptr); static void parse_object_id( std::string const& objspec, bool& trailer, int& obj, int& gen); void parseRotationParameter(std::string const&); diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index ee424e39..198ca42e 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -526,7 +526,7 @@ class QPDFObjectHandle QPDF_DLL void parsePageContents(ParserCallbacks* callbacks); QPDF_DLL - void filterPageContents(TokenFilter* filter, Pipeline* next = 0); + void filterPageContents(TokenFilter* filter, Pipeline* next = nullptr); // See comments for QPDFPageObjectHelper::pipeContents. QPDF_DLL void pipePageContents(Pipeline* p); @@ -538,7 +538,7 @@ class QPDFObjectHandle // contents. This can be used to apply a TokenFilter to a form // XObject, whose data is in the same format as a content stream. QPDF_DLL - void filterAsContents(TokenFilter* filter, Pipeline* next = 0); + void filterAsContents(TokenFilter* filter, Pipeline* next = nullptr); // Called on a stream to parse the stream as page contents. This // can be used to parse a form XObject. QPDF_DLL diff --git a/include/qpdf/QPDFOutlineObjectHelper.hh b/include/qpdf/QPDFOutlineObjectHelper.hh index c8b82a80..507a4a51 100644 --- a/include/qpdf/QPDFOutlineObjectHelper.hh +++ b/include/qpdf/QPDFOutlineObjectHelper.hh @@ -42,7 +42,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper { // This must be cleared explicitly to avoid circular references // that prevent cleanup of pointer holders. - this->m->parent = 0; + this->m->parent = nullptr; } // All constructors are private. You can only create one of these diff --git a/include/qpdf/QPDFPageObjectHelper.hh b/include/qpdf/QPDFPageObjectHelper.hh index ebb9e87e..9f647c70 100644 --- a/include/qpdf/QPDFPageObjectHelper.hh +++ b/include/qpdf/QPDFPageObjectHelper.hh @@ -320,12 +320,12 @@ class QPDFPageObjectHelper: public QPDFObjectHelper // examples/pdf-count-strings.cc for an example. QPDF_DLL void - filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0); + filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); // Old name -- calls filterContents() QPDF_DLL void filterPageContents( - QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0); + QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); // Pipe a page's contents through the given pipeline. This method // works whether the contents are a single stream or an array of diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh index 15b5579f..8305974c 100644 --- a/include/qpdf/QPDFWriter.hh +++ b/include/qpdf/QPDFWriter.hh @@ -539,7 +539,7 @@ class QPDFWriter friend class QPDFWriter; public: - PipelinePopper(QPDFWriter* qw, std::shared_ptr* bp = 0) : + PipelinePopper(QPDFWriter* qw, std::shared_ptr* bp = nullptr) : qw(qw), bp(bp) { diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index 5291fe09..2f7f15b2 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -245,7 +245,7 @@ namespace QUtil // Returns true iff the variable is defined. If `value' is // non-null, initializes it with the value of the variable. QPDF_DLL - bool get_env(std::string const& var, std::string* value = 0); + bool get_env(std::string const& var, std::string* value = nullptr); QPDF_DLL time_t get_current_time(); diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index 4f9c1021..a542736d 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -836,8 +836,8 @@ char* QUtil::getWhoami(char* argv0) { char* whoami = nullptr; - if (((whoami = strrchr(argv0, '/')) == NULL) && - ((whoami = strrchr(argv0, '\\')) == NULL)) { + if (((whoami = strrchr(argv0, '/')) == nullptr) && + ((whoami = strrchr(argv0, '\\')) == nullptr)) { whoami = argv0; } else { ++whoami; diff --git a/libqpdf/qpdf/Pl_SHA2.hh b/libqpdf/qpdf/Pl_SHA2.hh index d5b2e547..99a19a37 100644 --- a/libqpdf/qpdf/Pl_SHA2.hh +++ b/libqpdf/qpdf/Pl_SHA2.hh @@ -20,7 +20,7 @@ class Pl_SHA2: public Pipeline { public: - Pl_SHA2(int bits = 0, Pipeline* next = 0); + Pl_SHA2(int bits = 0, Pipeline* next = nullptr); virtual ~Pl_SHA2() = default; virtual void write(unsigned char const*, size_t); virtual void finish(); diff --git a/libqpdf/qpdf/QPDFArgParser.hh b/libqpdf/qpdf/QPDFArgParser.hh index 89c7acc0..759ad148 100644 --- a/libqpdf/qpdf/QPDFArgParser.hh +++ b/libqpdf/qpdf/QPDFArgParser.hh @@ -177,9 +177,9 @@ class QPDFArgParser { OptionEntry() : parameter_needed(false), - bare_arg_handler(0), - param_arg_handler(0), - invalid_choice_handler(0) + bare_arg_handler(nullptr), + param_arg_handler(nullptr), + invalid_choice_handler(nullptr) { } bool parameter_needed; diff --git a/libqpdf/qpdf/QPDFCrypto_openssl.hh b/libqpdf/qpdf/QPDFCrypto_openssl.hh index eae69ab1..0d07b99b 100644 --- a/libqpdf/qpdf/QPDFCrypto_openssl.hh +++ b/libqpdf/qpdf/QPDFCrypto_openssl.hh @@ -39,7 +39,7 @@ class QPDFCrypto_openssl: public QPDFCryptoImpl void RC4_process( unsigned char const* in_data, size_t len, - unsigned char* out_data = 0) override; + unsigned char* out_data = nullptr) override; void RC4_finalize() override; void SHA2_init(int bits) override; diff --git a/libtests/aes.cc b/libtests/aes.cc index 4541fffe..5ae8152a 100644 --- a/libtests/aes.cc +++ b/libtests/aes.cc @@ -29,9 +29,9 @@ main(int argc, char* argv[]) { bool encrypt = true; bool cbc_mode = true; - char* hexkey = 0; - char* infilename = 0; - char* outfilename = 0; + char* hexkey = nullptr; + char* infilename = nullptr; + char* outfilename = nullptr; bool zero_iv = false; bool static_iv = false; bool disable_padding = false; @@ -65,7 +65,7 @@ main(int argc, char* argv[]) usage(); } } - if (outfilename == 0) { + if (outfilename == nullptr) { usage(); } @@ -81,14 +81,14 @@ main(int argc, char* argv[]) t[1] = hexkey[i + 1]; t[2] = '\0'; - long val = strtol(t, 0, 16); + long val = strtol(t, nullptr, 16); key[i / 2] = static_cast(val); } Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile); Pl_AES_PDF* aes = new Pl_AES_PDF("aes_128_cbc", out, encrypt, key, keylen); delete[] key; - key = 0; + key = nullptr; if (!cbc_mode) { aes->disableCBC(); } diff --git a/libtests/arg_parser.cc b/libtests/arg_parser.cc index 6b4c829f..c9474d55 100644 --- a/libtests/arg_parser.cc +++ b/libtests/arg_parser.cc @@ -51,7 +51,7 @@ ArgParser::initOptions() ap.addBare("potato", b(&ArgParser::handlePotato)); ap.addRequiredParameter("salad", p(&ArgParser::handleSalad), "tossed"); ap.addOptionalParameter("moo", p(&ArgParser::handleMoo)); - char const* choices[] = {"pig", "boar", "sow", 0}; + char const* choices[] = {"pig", "boar", "sow", nullptr}; ap.addChoices("oink", p(&ArgParser::handleOink), true, choices); ap.selectHelpOptionTable(); ap.addBare("version", [this]() { output("3.14159"); }); diff --git a/libtests/numrange.cc b/libtests/numrange.cc index c0bf5bd7..ded03324 100644 --- a/libtests/numrange.cc +++ b/libtests/numrange.cc @@ -4,7 +4,7 @@ static void test_numrange(char const* range) { - if (range == 0) { + if (range == nullptr) { std::cout << "null" << std::endl; } else { std::vector result = QUtil::parse_numrange(range, 15); diff --git a/libtests/predictors.cc b/libtests/predictors.cc index fd1cc2ad..d7825bc6 100644 --- a/libtests/predictors.cc +++ b/libtests/predictors.cc @@ -21,7 +21,7 @@ run(char const* filename, FILE* in = QUtil::safe_fopen(filename, "rb"); FILE* o1 = QUtil::safe_fopen("out", "wb"); Pipeline* out = new Pl_StdioFile("out", o1); - Pipeline* pl = 0; + Pipeline* pl = nullptr; if (strcmp(filter, "png") == 0) { pl = new Pl_PNGFilter( "png", diff --git a/libtests/qutil.cc b/libtests/qutil.cc index a6f1282a..be5b6b1b 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -489,7 +489,7 @@ same_file_test() assert_same_file("qutil.out", "qutil.out", true); assert_same_file("qutil.out", "other-file", false); assert_same_file("qutil.out", "", false); - assert_same_file("qutil.out", 0, false); + assert_same_file("qutil.out", nullptr, false); assert_same_file("", "qutil.out", false); } diff --git a/libtests/random.cc b/libtests/random.cc index 40ef7d47..899c264c 100644 --- a/libtests/random.cc +++ b/libtests/random.cc @@ -56,7 +56,7 @@ main() if (!((buf[0] == 0) && (buf[1] == 1) && (buf[2] == 2) && (buf[3] == 3))) { std::cout << "fail: bogus random didn't provide correct bytes\n"; } - QUtil::setRandomDataProvider(0); + QUtil::setRandomDataProvider(nullptr); if (QUtil::getRandomDataProvider() != orig_rdp) { std::cout << "fail: passing null to setRandomDataProvider " "didn't reset the random data provider\n"; diff --git a/libtests/rc4.cc b/libtests/rc4.cc index 874c11ff..ca4af91d 100644 --- a/libtests/rc4.cc +++ b/libtests/rc4.cc @@ -51,7 +51,7 @@ main(int argc, char* argv[]) t[1] = hexkey[i + 1]; t[2] = '\0'; - long val = strtol(t, 0, 16); + long val = strtol(t, nullptr, 16); key[i / 2] = static_cast(val); } diff --git a/qpdf/fix-qdf.cc b/qpdf/fix-qdf.cc index 34b3d3dc..1d46971c 100644 --- a/qpdf/fix-qdf.cc +++ b/qpdf/fix-qdf.cc @@ -8,7 +8,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; static void usage() @@ -392,7 +392,7 @@ realmain(int argc, char* argv[]) { whoami = QUtil::getWhoami(argv[0]); QUtil::setLineBuf(stdout); - char const* filename = 0; + char const* filename = nullptr; if (argc > 2) { usage(); } else if ((argc > 1) && (strcmp(argv[1], "--version") == 0)) { @@ -405,7 +405,7 @@ realmain(int argc, char* argv[]) filename = argv[1]; } std::string input; - if (filename == 0) { + if (filename == nullptr) { filename = "standard input"; QUtil::binary_stdin(); input = QUtil::read_file_into_string(stdin); diff --git a/qpdf/pdf_from_scratch.cc b/qpdf/pdf_from_scratch.cc index 1b172964..41e52f9c 100644 --- a/qpdf/pdf_from_scratch.cc +++ b/qpdf/pdf_from_scratch.cc @@ -9,7 +9,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -86,7 +86,7 @@ int main(int argc, char* argv[]) { QUtil::setLineBuf(stdout); - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami; diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc index 815a86b4..08e94d38 100644 --- a/qpdf/qpdf.cc +++ b/qpdf/qpdf.cc @@ -6,7 +6,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; static void usageExit(std::string const& msg) diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index 673c6b58..e9e7754c 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -37,7 +37,7 @@ #define QPDF_OBJECT_NOWARN #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -286,7 +286,7 @@ test_0_1(QPDF& pdf, char const* arg2) qtest.pipeStreamData(out.get(), 0, qpdf_dl_none); std::cout << std::endl << "Uncompressed stream data:" << std::endl; - if (qtest.pipeStreamData(0, 0, qpdf_dl_all)) { + if (qtest.pipeStreamData(nullptr, 0, qpdf_dl_all)) { std::cout.flush(); QUtil::binary_stdout(); out = std::make_shared("filtered", stdout); @@ -387,7 +387,7 @@ test_4(QPDF& pdf, char const* arg2) } trailer.replaceKey("/Info", pdf.makeIndirectObject(qtest)); - QPDFWriter w(pdf, 0); + QPDFWriter w(pdf, nullptr); w.setQDFMode(true); w.setStaticID(true); w.write(); @@ -599,7 +599,7 @@ test_12(QPDF& pdf, char const* arg2) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif - pdf.setOutputStreams(0, 0); + pdf.setOutputStreams(nullptr, nullptr); #if (defined(__GNUC__) || defined(__clang__)) # pragma GCC diagnostic pop #endif @@ -1009,7 +1009,7 @@ test_25(QPDF& pdf, char const* arg2) // Copy qtest without crossing page boundaries. Should get O1 // and O2 and their streams but not O3 or any other pages. - assert(arg2 != 0); + assert(arg2 != nullptr); { // Make sure original PDF is out of scope when we write. QPDF oldpdf; @@ -1035,7 +1035,7 @@ test_26(QPDF& pdf, char const* arg2) { // Make sure original PDF is out of scope when we write. - assert(arg2 != 0); + assert(arg2 != nullptr); QPDF oldpdf; oldpdf.processFile(arg2); QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest"); @@ -1104,7 +1104,7 @@ test_27(QPDF& pdf, char const* arg2) QPDFObjectHandle s3 = QPDFObjectHandle::newStream(&empty3); s3.replaceStreamData( p2, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull()); - assert(arg2 != 0); + assert(arg2 != nullptr); QPDF oldpdf; oldpdf.processFile(arg2); QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest"); @@ -1151,7 +1151,7 @@ static void test_29(QPDF& pdf, char const* arg2) { // Detect mixed objects in QPDFWriter - assert(arg2 != 0); + assert(arg2 != nullptr); auto other = QPDF::create(); other->processFile(arg2); // We need to create a QPDF with mixed ownership to exercise @@ -1201,7 +1201,7 @@ test_29(QPDF& pdf, char const* arg2) static void test_30(QPDF& pdf, char const* arg2) { - assert(arg2 != 0); + assert(arg2 != nullptr); QPDF encrypted; encrypted.processFile(arg2, "user"); QPDFWriter w(pdf, "b.pdf"); @@ -1433,7 +1433,7 @@ test_40(QPDF& pdf, char const* arg2) // feature was implemented by Sahil Arora // as part of a Google Summer of // Code project in 2017. - assert(arg2 != 0); + assert(arg2 != nullptr); QPDFWriter w(pdf, arg2); w.setPCLm(true); w.setStaticID(true); @@ -3558,11 +3558,11 @@ runtest(int n, char const* filename1, char const* arg2) QPDF pdf; std::shared_ptr file_buf; - FILE* filep = 0; + FILE* filep = nullptr; if (n == 0) { pdf.setAttemptRecovery(false); } - if (((n == 35) || (n == 36)) && (arg2 != 0)) { + if (((n == 35) || (n == 36)) && (arg2 != nullptr)) { // arg2 is password pdf.processFile(filename1, arg2); } else if (n == 45) { @@ -3652,7 +3652,7 @@ int main(int argc, char* argv[]) { QUtil::setLineBuf(stdout); - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami; diff --git a/qpdf/test_large_file.cc b/qpdf/test_large_file.cc index b30967c7..aea7c0c5 100644 --- a/qpdf/test_large_file.cc +++ b/qpdf/test_large_file.cc @@ -35,7 +35,7 @@ // reading the large file then allows us to verify large file support // with confidence. -static char const* whoami = 0; +static char const* whoami = nullptr; // Height should be a multiple of 10 static size_t const nstripes = 10; @@ -47,7 +47,7 @@ static size_t const npages = 200; size_t stripesize = 0; size_t width = 0; size_t height = 0; -static unsigned char* buf = 0; +static unsigned char* buf = nullptr; static inline unsigned char get_pixel_color(size_t n, size_t row) @@ -73,7 +73,7 @@ class ImageChecker: public Pipeline }; ImageChecker::ImageChecker(size_t n) : - Pipeline("image checker", 0), + Pipeline("image checker", nullptr), n(n), offset(0), okay(true) @@ -122,7 +122,7 @@ ImageProvider::ImageProvider(size_t n) : void ImageProvider::provideStreamData(int objid, int generation, Pipeline* pipeline) { - if (buf == 0) { + if (buf == nullptr) { buf = new unsigned char[width * stripesize]; } std::cout << "page " << n << " of " << npages << std::endl; diff --git a/qpdf/test_pdf_doc_encoding.cc b/qpdf/test_pdf_doc_encoding.cc index cd2e9b42..e7aba030 100644 --- a/qpdf/test_pdf_doc_encoding.cc +++ b/qpdf/test_pdf_doc_encoding.cc @@ -4,7 +4,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -16,7 +16,7 @@ usage() int main(int argc, char* argv[]) { - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami; diff --git a/qpdf/test_pdf_unicode.cc b/qpdf/test_pdf_unicode.cc index b28edeaf..325fcad8 100644 --- a/qpdf/test_pdf_unicode.cc +++ b/qpdf/test_pdf_unicode.cc @@ -4,7 +4,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -16,7 +16,7 @@ usage() int main(int argc, char* argv[]) { - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami; diff --git a/qpdf/test_tokenizer.cc b/qpdf/test_tokenizer.cc index 8a58fc8e..d9c09c0b 100644 --- a/qpdf/test_tokenizer.cc +++ b/qpdf/test_tokenizer.cc @@ -11,7 +11,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -91,7 +91,7 @@ tokenTypeName(QPDFTokenizer::token_type_e ttype) case QPDFTokenizer::tt_inline_image: return "inline-image"; } - return 0; + return nullptr; } static std::string @@ -238,13 +238,13 @@ int main(int argc, char* argv[]) { QUtil::setLineBuf(stdout); - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami; } - char const* filename = 0; + char const* filename = nullptr; size_t max_len = 0; bool include_ignorable = true; for (int i = 1; i < argc; ++i) { @@ -265,7 +265,7 @@ main(int argc, char* argv[]) filename = argv[i]; } } - if (filename == 0) { + if (filename == nullptr) { usage(); } diff --git a/qpdf/test_unicode_filenames.cc b/qpdf/test_unicode_filenames.cc index b2fd50f3..16478161 100644 --- a/qpdf/test_unicode_filenames.cc +++ b/qpdf/test_unicode_filenames.cc @@ -12,7 +12,7 @@ static void do_copy(FILE* in, FILE* out) { - if ((in == 0) || (out == 0)) { + if ((in == nullptr) || (out == nullptr)) { std::cerr << "errors opening files" << std::endl; exit(2); } diff --git a/zlib-flate/zlib-flate.cc b/zlib-flate/zlib-flate.cc index 8f0f087a..d1311c84 100644 --- a/zlib-flate/zlib-flate.cc +++ b/zlib-flate/zlib-flate.cc @@ -9,7 +9,7 @@ #include #include -static char const* whoami = 0; +static char const* whoami = nullptr; void usage() @@ -27,7 +27,7 @@ usage() int main(int argc, char* argv[]) { - if ((whoami = strrchr(argv[0], '/')) == NULL) { + if ((whoami = strrchr(argv[0], '/')) == nullptr) { whoami = argv[0]; } else { ++whoami;