Use nullptr instead of 0 or NULL

This commit is contained in:
m-holger 2023-05-20 12:46:50 +01:00
parent e28f4efb00
commit d0682f0f60
33 changed files with 72 additions and 72 deletions

View File

@ -11,7 +11,7 @@
// The example is a full copy of the qpdf program modified to allways remove all // The example is a full copy of the qpdf program modified to allways remove all
// annotations from the final output. // annotations from the final output.
static char const* whoami = 0; static char const* whoami = nullptr;
static void static void
usageExit(std::string const& msg) usageExit(std::string const& msg)

View File

@ -43,7 +43,7 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
{ {
public: public:
QPDF_DLL QPDF_DLL
Pl_Buffer(char const* identifier, Pipeline* next = 0); Pl_Buffer(char const* identifier, Pipeline* next = nullptr);
QPDF_DLL QPDF_DLL
virtual ~Pl_Buffer(); virtual ~Pl_Buffer();
QPDF_DLL QPDF_DLL

View File

@ -57,7 +57,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
JDIMENSION image_height, JDIMENSION image_height,
int components, int components,
J_COLOR_SPACE color_space, J_COLOR_SPACE color_space,
CompressConfig* config_callback = 0); CompressConfig* config_callback = nullptr);
QPDF_DLL QPDF_DLL
virtual ~Pl_DCT(); virtual ~Pl_DCT();
@ -91,7 +91,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
JDIMENSION image_height = 0, JDIMENSION image_height = 0,
int components = 1, int components = 1,
J_COLOR_SPACE color_space = JCS_GRAYSCALE, J_COLOR_SPACE color_space = JCS_GRAYSCALE,
CompressConfig* config_callback = 0); CompressConfig* config_callback = nullptr);
Members(Members const&) = delete; Members(Members const&) = delete;
action_e action; action_e action;

View File

@ -51,7 +51,7 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline
Pl_QPDFTokenizer( Pl_QPDFTokenizer(
char const* identifier, char const* identifier,
QPDFObjectHandle::TokenFilter* filter, QPDFObjectHandle::TokenFilter* filter,
Pipeline* next = 0); Pipeline* next = nullptr);
QPDF_DLL QPDF_DLL
virtual ~Pl_QPDFTokenizer(); virtual ~Pl_QPDFTokenizer();
QPDF_DLL QPDF_DLL

View File

@ -83,7 +83,7 @@ class QPDF
// interpreted as a raw encryption key. See comments on // interpreted as a raw encryption key. See comments on
// setPasswordIsHexKey for more information. // setPasswordIsHexKey for more information.
QPDF_DLL 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 // 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. // binary mode and must be seekable. It may be open read only.
@ -96,7 +96,7 @@ class QPDF
char const* description, char const* description,
FILE* file, FILE* file,
bool close_file, bool close_file,
char const* password = 0); char const* password = nullptr);
// Parse a PDF file loaded into a memory buffer. This works // Parse a PDF file loaded into a memory buffer. This works
// exactly like processFile except that the PDF file is in memory // exactly like processFile except that the PDF file is in memory
@ -107,14 +107,14 @@ class QPDF
char const* description, char const* description,
char const* buf, char const* buf,
size_t length, size_t length,
char const* password = 0); char const* password = nullptr);
// Parse a PDF file loaded from a custom InputSource. If you have // Parse a PDF file loaded from a custom InputSource. If you have
// your own method of retrieving a PDF file, you can subclass // your own method of retrieving a PDF file, you can subclass
// InputSource and use this method. // InputSource and use this method.
QPDF_DLL QPDF_DLL
void void
processInputSource(std::shared_ptr<InputSource>, char const* password = 0); processInputSource(std::shared_ptr<InputSource>, char const* password = nullptr);
// Create a PDF from an input source that contains JSON as written // Create a PDF from an input source that contains JSON as written
// by writeJSON (or qpdf --json-output, version 2 or higher). The // by writeJSON (or qpdf --json-output, version 2 or higher). The

View File

@ -80,7 +80,7 @@ class QPDF_DLL_CLASS QPDFCryptoImpl
virtual void RC4_process( virtual void RC4_process(
unsigned char const* in_data, unsigned char const* in_data,
size_t len, size_t len,
unsigned char* out_data = 0) = 0; unsigned char* out_data = nullptr) = 0;
QPDF_DLL QPDF_DLL
virtual void RC4_finalize() = 0; virtual void RC4_finalize() = 0;

View File

@ -497,7 +497,7 @@ class QPDFJob
// Helper functions // Helper functions
static void usage(std::string const& msg); static void usage(std::string const& msg);
static JSON json_schema(int json_version, std::set<std::string>* keys = 0); static JSON json_schema(int json_version, std::set<std::string>* keys = nullptr);
static void parse_object_id( static void parse_object_id(
std::string const& objspec, bool& trailer, int& obj, int& gen); std::string const& objspec, bool& trailer, int& obj, int& gen);
void parseRotationParameter(std::string const&); void parseRotationParameter(std::string const&);

View File

@ -526,7 +526,7 @@ class QPDFObjectHandle
QPDF_DLL QPDF_DLL
void parsePageContents(ParserCallbacks* callbacks); void parsePageContents(ParserCallbacks* callbacks);
QPDF_DLL QPDF_DLL
void filterPageContents(TokenFilter* filter, Pipeline* next = 0); void filterPageContents(TokenFilter* filter, Pipeline* next = nullptr);
// See comments for QPDFPageObjectHelper::pipeContents. // See comments for QPDFPageObjectHelper::pipeContents.
QPDF_DLL QPDF_DLL
void pipePageContents(Pipeline* p); void pipePageContents(Pipeline* p);
@ -538,7 +538,7 @@ class QPDFObjectHandle
// contents. This can be used to apply a TokenFilter to a form // contents. This can be used to apply a TokenFilter to a form
// XObject, whose data is in the same format as a content stream. // XObject, whose data is in the same format as a content stream.
QPDF_DLL 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 // Called on a stream to parse the stream as page contents. This
// can be used to parse a form XObject. // can be used to parse a form XObject.
QPDF_DLL QPDF_DLL

View File

@ -42,7 +42,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
{ {
// This must be cleared explicitly to avoid circular references // This must be cleared explicitly to avoid circular references
// that prevent cleanup of pointer holders. // 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 // All constructors are private. You can only create one of these

View File

@ -320,12 +320,12 @@ class QPDFPageObjectHelper: public QPDFObjectHelper
// examples/pdf-count-strings.cc for an example. // examples/pdf-count-strings.cc for an example.
QPDF_DLL QPDF_DLL
void void
filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0); filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr);
// Old name -- calls filterContents() // Old name -- calls filterContents()
QPDF_DLL QPDF_DLL
void filterPageContents( 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 // Pipe a page's contents through the given pipeline. This method
// works whether the contents are a single stream or an array of // works whether the contents are a single stream or an array of

View File

@ -539,7 +539,7 @@ class QPDFWriter
friend class QPDFWriter; friend class QPDFWriter;
public: public:
PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = 0) : PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = nullptr) :
qw(qw), qw(qw),
bp(bp) bp(bp)
{ {

View File

@ -245,7 +245,7 @@ namespace QUtil
// Returns true iff the variable is defined. If `value' is // Returns true iff the variable is defined. If `value' is
// non-null, initializes it with the value of the variable. // non-null, initializes it with the value of the variable.
QPDF_DLL 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 QPDF_DLL
time_t get_current_time(); time_t get_current_time();

View File

@ -836,8 +836,8 @@ char*
QUtil::getWhoami(char* argv0) QUtil::getWhoami(char* argv0)
{ {
char* whoami = nullptr; char* whoami = nullptr;
if (((whoami = strrchr(argv0, '/')) == NULL) && if (((whoami = strrchr(argv0, '/')) == nullptr) &&
((whoami = strrchr(argv0, '\\')) == NULL)) { ((whoami = strrchr(argv0, '\\')) == nullptr)) {
whoami = argv0; whoami = argv0;
} else { } else {
++whoami; ++whoami;

View File

@ -20,7 +20,7 @@
class Pl_SHA2: public Pipeline class Pl_SHA2: public Pipeline
{ {
public: public:
Pl_SHA2(int bits = 0, Pipeline* next = 0); Pl_SHA2(int bits = 0, Pipeline* next = nullptr);
virtual ~Pl_SHA2() = default; virtual ~Pl_SHA2() = default;
virtual void write(unsigned char const*, size_t); virtual void write(unsigned char const*, size_t);
virtual void finish(); virtual void finish();

View File

@ -177,9 +177,9 @@ class QPDFArgParser
{ {
OptionEntry() : OptionEntry() :
parameter_needed(false), parameter_needed(false),
bare_arg_handler(0), bare_arg_handler(nullptr),
param_arg_handler(0), param_arg_handler(nullptr),
invalid_choice_handler(0) invalid_choice_handler(nullptr)
{ {
} }
bool parameter_needed; bool parameter_needed;

View File

@ -39,7 +39,7 @@ class QPDFCrypto_openssl: public QPDFCryptoImpl
void RC4_process( void RC4_process(
unsigned char const* in_data, unsigned char const* in_data,
size_t len, size_t len,
unsigned char* out_data = 0) override; unsigned char* out_data = nullptr) override;
void RC4_finalize() override; void RC4_finalize() override;
void SHA2_init(int bits) override; void SHA2_init(int bits) override;

View File

@ -29,9 +29,9 @@ main(int argc, char* argv[])
{ {
bool encrypt = true; bool encrypt = true;
bool cbc_mode = true; bool cbc_mode = true;
char* hexkey = 0; char* hexkey = nullptr;
char* infilename = 0; char* infilename = nullptr;
char* outfilename = 0; char* outfilename = nullptr;
bool zero_iv = false; bool zero_iv = false;
bool static_iv = false; bool static_iv = false;
bool disable_padding = false; bool disable_padding = false;
@ -65,7 +65,7 @@ main(int argc, char* argv[])
usage(); usage();
} }
} }
if (outfilename == 0) { if (outfilename == nullptr) {
usage(); usage();
} }
@ -81,14 +81,14 @@ main(int argc, char* argv[])
t[1] = hexkey[i + 1]; t[1] = hexkey[i + 1];
t[2] = '\0'; t[2] = '\0';
long val = strtol(t, 0, 16); long val = strtol(t, nullptr, 16);
key[i / 2] = static_cast<unsigned char>(val); key[i / 2] = static_cast<unsigned char>(val);
} }
Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile); Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile);
Pl_AES_PDF* aes = new Pl_AES_PDF("aes_128_cbc", out, encrypt, key, keylen); Pl_AES_PDF* aes = new Pl_AES_PDF("aes_128_cbc", out, encrypt, key, keylen);
delete[] key; delete[] key;
key = 0; key = nullptr;
if (!cbc_mode) { if (!cbc_mode) {
aes->disableCBC(); aes->disableCBC();
} }

View File

@ -51,7 +51,7 @@ ArgParser::initOptions()
ap.addBare("potato", b(&ArgParser::handlePotato)); ap.addBare("potato", b(&ArgParser::handlePotato));
ap.addRequiredParameter("salad", p(&ArgParser::handleSalad), "tossed"); ap.addRequiredParameter("salad", p(&ArgParser::handleSalad), "tossed");
ap.addOptionalParameter("moo", p(&ArgParser::handleMoo)); 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.addChoices("oink", p(&ArgParser::handleOink), true, choices);
ap.selectHelpOptionTable(); ap.selectHelpOptionTable();
ap.addBare("version", [this]() { output("3.14159"); }); ap.addBare("version", [this]() { output("3.14159"); });

View File

@ -4,7 +4,7 @@
static void static void
test_numrange(char const* range) test_numrange(char const* range)
{ {
if (range == 0) { if (range == nullptr) {
std::cout << "null" << std::endl; std::cout << "null" << std::endl;
} else { } else {
std::vector<int> result = QUtil::parse_numrange(range, 15); std::vector<int> result = QUtil::parse_numrange(range, 15);

View File

@ -21,7 +21,7 @@ run(char const* filename,
FILE* in = QUtil::safe_fopen(filename, "rb"); FILE* in = QUtil::safe_fopen(filename, "rb");
FILE* o1 = QUtil::safe_fopen("out", "wb"); FILE* o1 = QUtil::safe_fopen("out", "wb");
Pipeline* out = new Pl_StdioFile("out", o1); Pipeline* out = new Pl_StdioFile("out", o1);
Pipeline* pl = 0; Pipeline* pl = nullptr;
if (strcmp(filter, "png") == 0) { if (strcmp(filter, "png") == 0) {
pl = new Pl_PNGFilter( pl = new Pl_PNGFilter(
"png", "png",

View File

@ -489,7 +489,7 @@ same_file_test()
assert_same_file("qutil.out", "qutil.out", true); assert_same_file("qutil.out", "qutil.out", true);
assert_same_file("qutil.out", "other-file", false); assert_same_file("qutil.out", "other-file", false);
assert_same_file("qutil.out", "", 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); assert_same_file("", "qutil.out", false);
} }

View File

@ -56,7 +56,7 @@ main()
if (!((buf[0] == 0) && (buf[1] == 1) && (buf[2] == 2) && (buf[3] == 3))) { if (!((buf[0] == 0) && (buf[1] == 1) && (buf[2] == 2) && (buf[3] == 3))) {
std::cout << "fail: bogus random didn't provide correct bytes\n"; std::cout << "fail: bogus random didn't provide correct bytes\n";
} }
QUtil::setRandomDataProvider(0); QUtil::setRandomDataProvider(nullptr);
if (QUtil::getRandomDataProvider() != orig_rdp) { if (QUtil::getRandomDataProvider() != orig_rdp) {
std::cout << "fail: passing null to setRandomDataProvider " std::cout << "fail: passing null to setRandomDataProvider "
"didn't reset the random data provider\n"; "didn't reset the random data provider\n";

View File

@ -51,7 +51,7 @@ main(int argc, char* argv[])
t[1] = hexkey[i + 1]; t[1] = hexkey[i + 1];
t[2] = '\0'; t[2] = '\0';
long val = strtol(t, 0, 16); long val = strtol(t, nullptr, 16);
key[i / 2] = static_cast<unsigned char>(val); key[i / 2] = static_cast<unsigned char>(val);
} }

View File

@ -8,7 +8,7 @@
#include <regex> #include <regex>
#include <string_view> #include <string_view>
static char const* whoami = 0; static char const* whoami = nullptr;
static void static void
usage() usage()
@ -392,7 +392,7 @@ realmain(int argc, char* argv[])
{ {
whoami = QUtil::getWhoami(argv[0]); whoami = QUtil::getWhoami(argv[0]);
QUtil::setLineBuf(stdout); QUtil::setLineBuf(stdout);
char const* filename = 0; char const* filename = nullptr;
if (argc > 2) { if (argc > 2) {
usage(); usage();
} else if ((argc > 1) && (strcmp(argv[1], "--version") == 0)) { } else if ((argc > 1) && (strcmp(argv[1], "--version") == 0)) {
@ -405,7 +405,7 @@ realmain(int argc, char* argv[])
filename = argv[1]; filename = argv[1];
} }
std::string input; std::string input;
if (filename == 0) { if (filename == nullptr) {
filename = "standard input"; filename = "standard input";
QUtil::binary_stdin(); QUtil::binary_stdin();
input = QUtil::read_file_into_string(stdin); input = QUtil::read_file_into_string(stdin);

View File

@ -9,7 +9,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
static char const* whoami = 0; static char const* whoami = nullptr;
void void
usage() usage()
@ -86,7 +86,7 @@ int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
QUtil::setLineBuf(stdout); QUtil::setLineBuf(stdout);
if ((whoami = strrchr(argv[0], '/')) == NULL) { if ((whoami = strrchr(argv[0], '/')) == nullptr) {
whoami = argv[0]; whoami = argv[0];
} else { } else {
++whoami; ++whoami;

View File

@ -6,7 +6,7 @@
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
static char const* whoami = 0; static char const* whoami = nullptr;
static void static void
usageExit(std::string const& msg) usageExit(std::string const& msg)

View File

@ -37,7 +37,7 @@
#define QPDF_OBJECT_NOWARN #define QPDF_OBJECT_NOWARN
#include <qpdf/QPDFObject.hh> #include <qpdf/QPDFObject.hh>
static char const* whoami = 0; static char const* whoami = nullptr;
void void
usage() usage()
@ -286,7 +286,7 @@ test_0_1(QPDF& pdf, char const* arg2)
qtest.pipeStreamData(out.get(), 0, qpdf_dl_none); qtest.pipeStreamData(out.get(), 0, qpdf_dl_none);
std::cout << std::endl << "Uncompressed stream data:" << std::endl; 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(); std::cout.flush();
QUtil::binary_stdout(); QUtil::binary_stdout();
out = std::make_shared<Pl_StdioFile>("filtered", stdout); out = std::make_shared<Pl_StdioFile>("filtered", stdout);
@ -387,7 +387,7 @@ test_4(QPDF& pdf, char const* arg2)
} }
trailer.replaceKey("/Info", pdf.makeIndirectObject(qtest)); trailer.replaceKey("/Info", pdf.makeIndirectObject(qtest));
QPDFWriter w(pdf, 0); QPDFWriter w(pdf, nullptr);
w.setQDFMode(true); w.setQDFMode(true);
w.setStaticID(true); w.setStaticID(true);
w.write(); w.write();
@ -599,7 +599,7 @@ test_12(QPDF& pdf, char const* arg2)
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations" # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
pdf.setOutputStreams(0, 0); pdf.setOutputStreams(nullptr, nullptr);
#if (defined(__GNUC__) || defined(__clang__)) #if (defined(__GNUC__) || defined(__clang__))
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif #endif
@ -1009,7 +1009,7 @@ test_25(QPDF& pdf, char const* arg2)
// Copy qtest without crossing page boundaries. Should get O1 // Copy qtest without crossing page boundaries. Should get O1
// and O2 and their streams but not O3 or any other pages. // 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. // Make sure original PDF is out of scope when we write.
QPDF oldpdf; QPDF oldpdf;
@ -1035,7 +1035,7 @@ test_26(QPDF& pdf, char const* arg2)
{ {
// Make sure original PDF is out of scope when we write. // Make sure original PDF is out of scope when we write.
assert(arg2 != 0); assert(arg2 != nullptr);
QPDF oldpdf; QPDF oldpdf;
oldpdf.processFile(arg2); oldpdf.processFile(arg2);
QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest"); QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest");
@ -1104,7 +1104,7 @@ test_27(QPDF& pdf, char const* arg2)
QPDFObjectHandle s3 = QPDFObjectHandle::newStream(&empty3); QPDFObjectHandle s3 = QPDFObjectHandle::newStream(&empty3);
s3.replaceStreamData( s3.replaceStreamData(
p2, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull()); p2, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull());
assert(arg2 != 0); assert(arg2 != nullptr);
QPDF oldpdf; QPDF oldpdf;
oldpdf.processFile(arg2); oldpdf.processFile(arg2);
QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest"); QPDFObjectHandle qtest = oldpdf.getTrailer().getKey("/QTest");
@ -1151,7 +1151,7 @@ static void
test_29(QPDF& pdf, char const* arg2) test_29(QPDF& pdf, char const* arg2)
{ {
// Detect mixed objects in QPDFWriter // Detect mixed objects in QPDFWriter
assert(arg2 != 0); assert(arg2 != nullptr);
auto other = QPDF::create(); auto other = QPDF::create();
other->processFile(arg2); other->processFile(arg2);
// We need to create a QPDF with mixed ownership to exercise // We need to create a QPDF with mixed ownership to exercise
@ -1201,7 +1201,7 @@ test_29(QPDF& pdf, char const* arg2)
static void static void
test_30(QPDF& pdf, char const* arg2) test_30(QPDF& pdf, char const* arg2)
{ {
assert(arg2 != 0); assert(arg2 != nullptr);
QPDF encrypted; QPDF encrypted;
encrypted.processFile(arg2, "user"); encrypted.processFile(arg2, "user");
QPDFWriter w(pdf, "b.pdf"); QPDFWriter w(pdf, "b.pdf");
@ -1433,7 +1433,7 @@ test_40(QPDF& pdf, char const* arg2)
// feature was implemented by Sahil Arora // feature was implemented by Sahil Arora
// <sahilarora.535@gmail.com> as part of a Google Summer of // <sahilarora.535@gmail.com> as part of a Google Summer of
// Code project in 2017. // Code project in 2017.
assert(arg2 != 0); assert(arg2 != nullptr);
QPDFWriter w(pdf, arg2); QPDFWriter w(pdf, arg2);
w.setPCLm(true); w.setPCLm(true);
w.setStaticID(true); w.setStaticID(true);
@ -3558,11 +3558,11 @@ runtest(int n, char const* filename1, char const* arg2)
QPDF pdf; QPDF pdf;
std::shared_ptr<char> file_buf; std::shared_ptr<char> file_buf;
FILE* filep = 0; FILE* filep = nullptr;
if (n == 0) { if (n == 0) {
pdf.setAttemptRecovery(false); pdf.setAttemptRecovery(false);
} }
if (((n == 35) || (n == 36)) && (arg2 != 0)) { if (((n == 35) || (n == 36)) && (arg2 != nullptr)) {
// arg2 is password // arg2 is password
pdf.processFile(filename1, arg2); pdf.processFile(filename1, arg2);
} else if (n == 45) { } else if (n == 45) {
@ -3652,7 +3652,7 @@ int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
QUtil::setLineBuf(stdout); QUtil::setLineBuf(stdout);
if ((whoami = strrchr(argv[0], '/')) == NULL) { if ((whoami = strrchr(argv[0], '/')) == nullptr) {
whoami = argv[0]; whoami = argv[0];
} else { } else {
++whoami; ++whoami;

View File

@ -35,7 +35,7 @@
// reading the large file then allows us to verify large file support // reading the large file then allows us to verify large file support
// with confidence. // with confidence.
static char const* whoami = 0; static char const* whoami = nullptr;
// Height should be a multiple of 10 // Height should be a multiple of 10
static size_t const nstripes = 10; static size_t const nstripes = 10;
@ -47,7 +47,7 @@ static size_t const npages = 200;
size_t stripesize = 0; size_t stripesize = 0;
size_t width = 0; size_t width = 0;
size_t height = 0; size_t height = 0;
static unsigned char* buf = 0; static unsigned char* buf = nullptr;
static inline unsigned char static inline unsigned char
get_pixel_color(size_t n, size_t row) get_pixel_color(size_t n, size_t row)
@ -73,7 +73,7 @@ class ImageChecker: public Pipeline
}; };
ImageChecker::ImageChecker(size_t n) : ImageChecker::ImageChecker(size_t n) :
Pipeline("image checker", 0), Pipeline("image checker", nullptr),
n(n), n(n),
offset(0), offset(0),
okay(true) okay(true)
@ -122,7 +122,7 @@ ImageProvider::ImageProvider(size_t n) :
void void
ImageProvider::provideStreamData(int objid, int generation, Pipeline* pipeline) ImageProvider::provideStreamData(int objid, int generation, Pipeline* pipeline)
{ {
if (buf == 0) { if (buf == nullptr) {
buf = new unsigned char[width * stripesize]; buf = new unsigned char[width * stripesize];
} }
std::cout << "page " << n << " of " << npages << std::endl; std::cout << "page " << n << " of " << npages << std::endl;

View File

@ -4,7 +4,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
static char const* whoami = 0; static char const* whoami = nullptr;
void void
usage() usage()
@ -16,7 +16,7 @@ usage()
int int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
if ((whoami = strrchr(argv[0], '/')) == NULL) { if ((whoami = strrchr(argv[0], '/')) == nullptr) {
whoami = argv[0]; whoami = argv[0];
} else { } else {
++whoami; ++whoami;

View File

@ -4,7 +4,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
static char const* whoami = 0; static char const* whoami = nullptr;
void void
usage() usage()
@ -16,7 +16,7 @@ usage()
int int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
if ((whoami = strrchr(argv[0], '/')) == NULL) { if ((whoami = strrchr(argv[0], '/')) == nullptr) {
whoami = argv[0]; whoami = argv[0];
} else { } else {
++whoami; ++whoami;

View File

@ -11,7 +11,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
static char const* whoami = 0; static char const* whoami = nullptr;
void void
usage() usage()
@ -91,7 +91,7 @@ tokenTypeName(QPDFTokenizer::token_type_e ttype)
case QPDFTokenizer::tt_inline_image: case QPDFTokenizer::tt_inline_image:
return "inline-image"; return "inline-image";
} }
return 0; return nullptr;
} }
static std::string static std::string
@ -238,13 +238,13 @@ int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
QUtil::setLineBuf(stdout); QUtil::setLineBuf(stdout);
if ((whoami = strrchr(argv[0], '/')) == NULL) { if ((whoami = strrchr(argv[0], '/')) == nullptr) {
whoami = argv[0]; whoami = argv[0];
} else { } else {
++whoami; ++whoami;
} }
char const* filename = 0; char const* filename = nullptr;
size_t max_len = 0; size_t max_len = 0;
bool include_ignorable = true; bool include_ignorable = true;
for (int i = 1; i < argc; ++i) { for (int i = 1; i < argc; ++i) {
@ -265,7 +265,7 @@ main(int argc, char* argv[])
filename = argv[i]; filename = argv[i];
} }
} }
if (filename == 0) { if (filename == nullptr) {
usage(); usage();
} }

View File

@ -12,7 +12,7 @@
static void static void
do_copy(FILE* in, FILE* out) do_copy(FILE* in, FILE* out)
{ {
if ((in == 0) || (out == 0)) { if ((in == nullptr) || (out == nullptr)) {
std::cerr << "errors opening files" << std::endl; std::cerr << "errors opening files" << std::endl;
exit(2); exit(2);
} }

View File

@ -9,7 +9,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
static char const* whoami = 0; static char const* whoami = nullptr;
void void
usage() usage()
@ -27,7 +27,7 @@ usage()
int int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
if ((whoami = strrchr(argv[0], '/')) == NULL) { if ((whoami = strrchr(argv[0], '/')) == nullptr) {
whoami = argv[0]; whoami = argv[0];
} else { } else {
++whoami; ++whoami;