summaryrefslogtreecommitdiffstats
path: root/qpdf
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2023-05-20 13:46:50 +0200
committerm-holger <m-holger@kubitscheck.org>2023-05-20 16:41:36 +0200
commitd0682f0f609e979ba085d93a1a0d8e0559f739bb (patch)
tree53d0ef2d0be8ee1167c8a59f86bda1b3cdba7f53 /qpdf
parente28f4efb00d5040fa71532d76e63aa7ade105c99 (diff)
downloadqpdf-d0682f0f609e979ba085d93a1a0d8e0559f739bb.tar.zst
Use nullptr instead of 0 or NULL
Diffstat (limited to 'qpdf')
-rw-r--r--qpdf/fix-qdf.cc6
-rw-r--r--qpdf/pdf_from_scratch.cc4
-rw-r--r--qpdf/qpdf.cc2
-rw-r--r--qpdf/test_driver.cc26
-rw-r--r--qpdf/test_large_file.cc8
-rw-r--r--qpdf/test_pdf_doc_encoding.cc4
-rw-r--r--qpdf/test_pdf_unicode.cc4
-rw-r--r--qpdf/test_tokenizer.cc10
-rw-r--r--qpdf/test_unicode_filenames.cc2
9 files changed, 33 insertions, 33 deletions
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 <regex>
#include <string_view>
-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 <cstdlib>
#include <cstring>
-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 <cstdlib>
#include <iostream>
-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 <qpdf/QPDFObject.hh>
-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<Pl_StdioFile>("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
// <sahilarora.535@gmail.com> 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<char> 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 <cstdlib>
#include <cstring>
-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 <cstdlib>
#include <cstring>
-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 <cstdlib>
#include <cstring>
-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);
}