Commit 4feb10fdaf51bf3f88b853cdb32a1e9b1692ba52
Committed by
GitHub
Merge pull request #734 from m-holger/nullptr
Code tidy : replace 0 with nullptr or true
Showing
49 changed files
with
193 additions
and
187 deletions
examples/pdf-attach-file.cc
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | // the use of the qpdf literal syntax introduced in qpdf 10.6. | 15 | // the use of the qpdf literal syntax introduced in qpdf 10.6. |
| 16 | // | 16 | // |
| 17 | 17 | ||
| 18 | -static char const* whoami = 0; | 18 | +static char const* whoami = nullptr; |
| 19 | 19 | ||
| 20 | static void | 20 | static void |
| 21 | usage(std::string const& msg) | 21 | usage(std::string const& msg) |
| @@ -167,11 +167,11 @@ main(int argc, char* argv[]) | @@ -167,11 +167,11 @@ main(int argc, char* argv[]) | ||
| 167 | { | 167 | { |
| 168 | whoami = QUtil::getWhoami(argv[0]); | 168 | whoami = QUtil::getWhoami(argv[0]); |
| 169 | 169 | ||
| 170 | - char const* infilename = 0; | ||
| 171 | - char const* password = 0; | ||
| 172 | - char const* attachment = 0; | ||
| 173 | - char const* outfilename = 0; | ||
| 174 | - char const* mimetype = 0; | 170 | + char const* infilename = nullptr; |
| 171 | + char const* password = nullptr; | ||
| 172 | + char const* attachment = nullptr; | ||
| 173 | + char const* outfilename = nullptr; | ||
| 174 | + char const* mimetype = nullptr; | ||
| 175 | 175 | ||
| 176 | auto check_arg = [](char const* arg, std::string const& msg) { | 176 | auto check_arg = [](char const* arg, std::string const& msg) { |
| 177 | if (arg == nullptr) { | 177 | if (arg == nullptr) { |
examples/pdf-bookmarks.cc
| @@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
| 14 | // | 14 | // |
| 15 | // Ignore calls to QTC::TC - they are for qpdf CI testing only. | 15 | // Ignore calls to QTC::TC - they are for qpdf CI testing only. |
| 16 | 16 | ||
| 17 | -static char const* whoami = 0; | 17 | +static char const* whoami = nullptr; |
| 18 | static enum { st_none, st_numbers, st_lines } style = st_none; | 18 | static enum { st_none, st_numbers, st_lines } style = st_none; |
| 19 | static bool show_open = false; | 19 | static bool show_open = false; |
| 20 | static bool show_targets = false; | 20 | static bool show_targets = false; |
examples/pdf-count-strings.cc
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | #include <qpdf/QPDFPageObjectHelper.hh> | 15 | #include <qpdf/QPDFPageObjectHelper.hh> |
| 16 | #include <qpdf/QUtil.hh> | 16 | #include <qpdf/QUtil.hh> |
| 17 | 17 | ||
| 18 | -static char const* whoami = 0; | 18 | +static char const* whoami = nullptr; |
| 19 | 19 | ||
| 20 | void | 20 | void |
| 21 | usage() | 21 | usage() |
examples/pdf-create.cc
| @@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
| 20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
| 21 | #include <string.h> | 21 | #include <string.h> |
| 22 | 22 | ||
| 23 | -static char const* whoami = 0; | 23 | +static char const* whoami = nullptr; |
| 24 | 24 | ||
| 25 | // This is a simple StreamDataProvider that writes image data for an | 25 | // This is a simple StreamDataProvider that writes image data for an |
| 26 | // orange square of the given width and height. | 26 | // orange square of the given width and height. |
examples/pdf-custom-filter.cc
| @@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
| 37 | // of running this example on test files that are specifically crafted | 37 | // of running this example on test files that are specifically crafted |
| 38 | // for it. | 38 | // for it. |
| 39 | 39 | ||
| 40 | -static char const* whoami = 0; | 40 | +static char const* whoami = nullptr; |
| 41 | 41 | ||
| 42 | class Pl_XOR: public Pipeline | 42 | class Pl_XOR: public Pipeline |
| 43 | { | 43 | { |
| @@ -447,8 +447,8 @@ main(int argc, char* argv[]) | @@ -447,8 +447,8 @@ main(int argc, char* argv[]) | ||
| 447 | { | 447 | { |
| 448 | whoami = QUtil::getWhoami(argv[0]); | 448 | whoami = QUtil::getWhoami(argv[0]); |
| 449 | 449 | ||
| 450 | - char const* infilename = 0; | ||
| 451 | - char const* outfilename = 0; | 450 | + char const* infilename = nullptr; |
| 451 | + char const* outfilename = nullptr; | ||
| 452 | bool decode_specialized = false; | 452 | bool decode_specialized = false; |
| 453 | for (int i = 1; i < argc; ++i) { | 453 | for (int i = 1; i < argc; ++i) { |
| 454 | if (strcmp(argv[i], "--decode-specialized") == 0) { | 454 | if (strcmp(argv[i], "--decode-specialized") == 0) { |
examples/pdf-double-page-size.cc
examples/pdf-filter-tokens.cc
examples/pdf-invert-images.cc
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
| 10 | #include <string.h> | 10 | #include <string.h> |
| 11 | 11 | ||
| 12 | -static char const* whoami = 0; | 12 | +static char const* whoami = nullptr; |
| 13 | 13 | ||
| 14 | void | 14 | void |
| 15 | usage() | 15 | usage() |
| @@ -142,7 +142,8 @@ main(int argc, char* argv[]) | @@ -142,7 +142,8 @@ main(int argc, char* argv[]) | ||
| 142 | // pipeStreamData with a null pipeline to determine | 142 | // pipeStreamData with a null pipeline to determine |
| 143 | // whether the image is filterable. Directly inspect | 143 | // whether the image is filterable. Directly inspect |
| 144 | // keys to determine the image type. | 144 | // keys to determine the image type. |
| 145 | - if (image.pipeStreamData(0, qpdf_ef_compress, qpdf_dl_all) && | 145 | + if (image.pipeStreamData( |
| 146 | + nullptr, qpdf_ef_compress, qpdf_dl_all) && | ||
| 146 | color_space.isNameAndEquals("/DeviceGray") && | 147 | color_space.isNameAndEquals("/DeviceGray") && |
| 147 | bits_per_component.isInteger() && | 148 | bits_per_component.isInteger() && |
| 148 | (bits_per_component.getIntValue() == 8)) { | 149 | (bits_per_component.getIntValue() == 8)) { |
examples/pdf-mod-info.cc
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | #include <string.h> | 11 | #include <string.h> |
| 12 | 12 | ||
| 13 | static char const* version = "1.1"; | 13 | static char const* version = "1.1"; |
| 14 | -static char const* whoami = 0; | 14 | +static char const* whoami = nullptr; |
| 15 | 15 | ||
| 16 | void | 16 | void |
| 17 | usage() | 17 | usage() |
| @@ -77,8 +77,8 @@ main(int argc, char* argv[]) | @@ -77,8 +77,8 @@ main(int argc, char* argv[]) | ||
| 77 | exit(0); | 77 | exit(0); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | - char* fl_in = 0; | ||
| 81 | - char* fl_out = 0; | 80 | + char* fl_in = nullptr; |
| 81 | + char* fl_out = nullptr; | ||
| 82 | std::string cur_key; | 82 | std::string cur_key; |
| 83 | 83 | ||
| 84 | for (int i = 1; i < argc; ++i) { | 84 | for (int i = 1; i < argc; ++i) { |
examples/pdf-name-number-tree.cc
examples/pdf-npages.cc
examples/pdf-overlay-page.cc
| @@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
| 12 | // --overlay and --underlay options provide a more general version of | 12 | // --overlay and --underlay options provide a more general version of |
| 13 | // this capability. | 13 | // this capability. |
| 14 | 14 | ||
| 15 | -static char const* whoami = 0; | 15 | +static char const* whoami = nullptr; |
| 16 | 16 | ||
| 17 | void | 17 | void |
| 18 | usage() | 18 | usage() |
examples/pdf-parse-content.cc
examples/pdf-set-form-values.cc
examples/qpdf-job.cc
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | // This program is a simple demonstration of different ways to use the | 8 | // This program is a simple demonstration of different ways to use the |
| 9 | // QPDFJob API. | 9 | // QPDFJob API. |
| 10 | 10 | ||
| 11 | -static char const* whoami = 0; | 11 | +static char const* whoami = nullptr; |
| 12 | 12 | ||
| 13 | static void | 13 | static void |
| 14 | usage() | 14 | usage() |
libqpdf/Buffer.cc
| @@ -5,10 +5,10 @@ | @@ -5,10 +5,10 @@ | ||
| 5 | Buffer::Members::Members(size_t size, unsigned char* buf, bool own_memory) : | 5 | Buffer::Members::Members(size_t size, unsigned char* buf, bool own_memory) : |
| 6 | own_memory(own_memory), | 6 | own_memory(own_memory), |
| 7 | size(size), | 7 | size(size), |
| 8 | - buf(0) | 8 | + buf(nullptr) |
| 9 | { | 9 | { |
| 10 | if (own_memory) { | 10 | if (own_memory) { |
| 11 | - this->buf = (size ? new unsigned char[size] : 0); | 11 | + this->buf = (size ? new unsigned char[size] : nullptr); |
| 12 | } else { | 12 | } else { |
| 13 | this->buf = buf; | 13 | this->buf = buf; |
| 14 | } | 14 | } |
| @@ -22,12 +22,12 @@ Buffer::Members::~Members() | @@ -22,12 +22,12 @@ Buffer::Members::~Members() | ||
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | Buffer::Buffer() : | 24 | Buffer::Buffer() : |
| 25 | - m(new Members(0, 0, true)) | 25 | + m(new Members(0, nullptr, true)) |
| 26 | { | 26 | { |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | Buffer::Buffer(size_t size) : | 29 | Buffer::Buffer(size_t size) : |
| 30 | - m(new Members(size, 0, true)) | 30 | + m(new Members(size, nullptr, true)) |
| 31 | { | 31 | { |
| 32 | } | 32 | } |
| 33 | 33 | ||
| @@ -52,7 +52,8 @@ void | @@ -52,7 +52,8 @@ void | ||
| 52 | Buffer::copy(Buffer const& rhs) | 52 | Buffer::copy(Buffer const& rhs) |
| 53 | { | 53 | { |
| 54 | if (this != &rhs) { | 54 | if (this != &rhs) { |
| 55 | - this->m = std::shared_ptr<Members>(new Members(rhs.m->size, 0, true)); | 55 | + this->m = |
| 56 | + std::shared_ptr<Members>(new Members(rhs.m->size, nullptr, true)); | ||
| 56 | if (this->m->size) { | 57 | if (this->m->size) { |
| 57 | memcpy(this->m->buf, rhs.m->buf, this->m->size); | 58 | memcpy(this->m->buf, rhs.m->buf, this->m->size); |
| 58 | } | 59 | } |
libqpdf/BufferInputSource.cc
| @@ -25,7 +25,7 @@ BufferInputSource::BufferInputSource( | @@ -25,7 +25,7 @@ BufferInputSource::BufferInputSource( | ||
| 25 | 25 | ||
| 26 | BufferInputSource::BufferInputSource( | 26 | BufferInputSource::BufferInputSource( |
| 27 | std::string const& description, std::string const& contents) : | 27 | std::string const& description, std::string const& contents) : |
| 28 | - m(new Members(true, description, 0)) | 28 | + m(new Members(true, description, nullptr)) |
| 29 | { | 29 | { |
| 30 | this->m->buf = new Buffer(contents.length()); | 30 | this->m->buf = new Buffer(contents.length()); |
| 31 | this->m->max_offset = QIntC::to_offset(this->m->buf->getSize()); | 31 | this->m->max_offset = QIntC::to_offset(this->m->buf->getSize()); |
libqpdf/ClosedFileInputSource.cc
| @@ -23,7 +23,7 @@ ClosedFileInputSource::~ClosedFileInputSource() | @@ -23,7 +23,7 @@ ClosedFileInputSource::~ClosedFileInputSource() | ||
| 23 | void | 23 | void |
| 24 | ClosedFileInputSource::before() | 24 | ClosedFileInputSource::before() |
| 25 | { | 25 | { |
| 26 | - if (0 == this->m->fis.get()) { | 26 | + if (nullptr == this->m->fis.get()) { |
| 27 | this->m->fis = | 27 | this->m->fis = |
| 28 | std::make_shared<FileInputSource>(this->m->filename.c_str()); | 28 | std::make_shared<FileInputSource>(this->m->filename.c_str()); |
| 29 | this->m->fis->seek(this->m->offset, SEEK_SET); | 29 | this->m->fis->seek(this->m->offset, SEEK_SET); |
| @@ -39,7 +39,7 @@ ClosedFileInputSource::after() | @@ -39,7 +39,7 @@ ClosedFileInputSource::after() | ||
| 39 | if (this->m->stay_open) { | 39 | if (this->m->stay_open) { |
| 40 | return; | 40 | return; |
| 41 | } | 41 | } |
| 42 | - this->m->fis = 0; | 42 | + this->m->fis = nullptr; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | qpdf_offset_t | 45 | qpdf_offset_t |
libqpdf/FileInputSource.cc
libqpdf/InputSource.cc
| @@ -69,7 +69,7 @@ InputSource::findFirst( | @@ -69,7 +69,7 @@ InputSource::findFirst( | ||
| 69 | " too small or too large of a character sequence"); | 69 | " too small or too large of a character sequence"); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | - char* p = 0; | 72 | + char* p = nullptr; |
| 73 | qpdf_offset_t buf_offset = offset; | 73 | qpdf_offset_t buf_offset = offset; |
| 74 | size_t bytes_read = 0; | 74 | size_t bytes_read = 0; |
| 75 | 75 | ||
| @@ -86,7 +86,8 @@ InputSource::findFirst( | @@ -86,7 +86,8 @@ InputSource::findFirst( | ||
| 86 | // If p points to buf[size], since strlen(start_chars) is | 86 | // If p points to buf[size], since strlen(start_chars) is |
| 87 | // always >= 1, this overflow test will be correct for that | 87 | // always >= 1, this overflow test will be correct for that |
| 88 | // case regardless of start_chars. | 88 | // case regardless of start_chars. |
| 89 | - if ((p == 0) || ((p + strlen(start_chars)) > (buf + bytes_read))) { | 89 | + if ((p == nullptr) || |
| 90 | + ((p + strlen(start_chars)) > (buf + bytes_read))) { | ||
| 90 | if (p) { | 91 | if (p) { |
| 91 | QTC::TC( | 92 | QTC::TC( |
| 92 | "libtests", | 93 | "libtests", |
| @@ -117,7 +118,7 @@ InputSource::findFirst( | @@ -117,7 +118,7 @@ InputSource::findFirst( | ||
| 117 | memchr( | 118 | memchr( |
| 118 | p, | 119 | p, |
| 119 | start_chars[0], | 120 | start_chars[0], |
| 120 | - bytes_read - QIntC::to_size(p - buf)))) != 0) { | 121 | + bytes_read - QIntC::to_size(p - buf)))) != nullptr) { |
| 121 | if (p == buf) { | 122 | if (p == buf) { |
| 122 | QTC::TC("libtests", "InputSource found match at buf[0]"); | 123 | QTC::TC("libtests", "InputSource found match at buf[0]"); |
| 123 | } | 124 | } |
libqpdf/JSON.cc
| @@ -204,7 +204,7 @@ JSON::JSON_blob::write(Pipeline* p, size_t) const | @@ -204,7 +204,7 @@ JSON::JSON_blob::write(Pipeline* p, size_t) const | ||
| 204 | void | 204 | void |
| 205 | JSON::write(Pipeline* p, size_t depth) const | 205 | JSON::write(Pipeline* p, size_t depth) const |
| 206 | { | 206 | { |
| 207 | - if (0 == this->m->value.get()) { | 207 | + if (nullptr == this->m->value.get()) { |
| 208 | *p << "null"; | 208 | *p << "null"; |
| 209 | } else { | 209 | } else { |
| 210 | this->m->value->write(p, depth); | 210 | this->m->value->write(p, depth); |
| @@ -270,7 +270,7 @@ JSON | @@ -270,7 +270,7 @@ JSON | ||
| 270 | JSON::addDictionaryMember(std::string const& key, JSON const& val) | 270 | JSON::addDictionaryMember(std::string const& key, JSON const& val) |
| 271 | { | 271 | { |
| 272 | JSON_dictionary* obj = dynamic_cast<JSON_dictionary*>(this->m->value.get()); | 272 | JSON_dictionary* obj = dynamic_cast<JSON_dictionary*>(this->m->value.get()); |
| 273 | - if (0 == obj) { | 273 | + if (nullptr == obj) { |
| 274 | throw std::runtime_error( | 274 | throw std::runtime_error( |
| 275 | "JSON::addDictionaryMember called on non-dictionary"); | 275 | "JSON::addDictionaryMember called on non-dictionary"); |
| 276 | } | 276 | } |
| @@ -286,7 +286,7 @@ bool | @@ -286,7 +286,7 @@ bool | ||
| 286 | JSON::checkDictionaryKeySeen(std::string const& key) | 286 | JSON::checkDictionaryKeySeen(std::string const& key) |
| 287 | { | 287 | { |
| 288 | JSON_dictionary* obj = dynamic_cast<JSON_dictionary*>(this->m->value.get()); | 288 | JSON_dictionary* obj = dynamic_cast<JSON_dictionary*>(this->m->value.get()); |
| 289 | - if (0 == obj) { | 289 | + if (nullptr == obj) { |
| 290 | throw std::logic_error( | 290 | throw std::logic_error( |
| 291 | "JSON::checkDictionaryKey called on non-dictionary"); | 291 | "JSON::checkDictionaryKey called on non-dictionary"); |
| 292 | } | 292 | } |
| @@ -307,7 +307,7 @@ JSON | @@ -307,7 +307,7 @@ JSON | ||
| 307 | JSON::addArrayElement(JSON const& val) | 307 | JSON::addArrayElement(JSON const& val) |
| 308 | { | 308 | { |
| 309 | JSON_array* arr = dynamic_cast<JSON_array*>(this->m->value.get()); | 309 | JSON_array* arr = dynamic_cast<JSON_array*>(this->m->value.get()); |
| 310 | - if (0 == arr) { | 310 | + if (nullptr == arr) { |
| 311 | throw std::runtime_error("JSON::addArrayElement called on non-array"); | 311 | throw std::runtime_error("JSON::addArrayElement called on non-array"); |
| 312 | } | 312 | } |
| 313 | if (val.m->value.get()) { | 313 | if (val.m->value.get()) { |
libqpdf/Pipeline.cc
| @@ -14,7 +14,7 @@ Pipeline::Pipeline(char const* identifier, Pipeline* next) : | @@ -14,7 +14,7 @@ Pipeline::Pipeline(char const* identifier, Pipeline* next) : | ||
| 14 | Pipeline* | 14 | Pipeline* |
| 15 | Pipeline::getNext(bool allow_null) | 15 | Pipeline::getNext(bool allow_null) |
| 16 | { | 16 | { |
| 17 | - if ((this->next == 0) && (!allow_null)) { | 17 | + if ((this->next == nullptr) && (!allow_null)) { |
| 18 | throw std::logic_error( | 18 | throw std::logic_error( |
| 19 | this->identifier + | 19 | this->identifier + |
| 20 | ": Pipeline::getNext() called on pipeline with no next"); | 20 | ": Pipeline::getNext() called on pipeline with no next"); |
libqpdf/Pl_Buffer.cc
| @@ -26,7 +26,7 @@ Pl_Buffer::~Pl_Buffer() | @@ -26,7 +26,7 @@ Pl_Buffer::~Pl_Buffer() | ||
| 26 | void | 26 | void |
| 27 | Pl_Buffer::write(unsigned char const* buf, size_t len) | 27 | Pl_Buffer::write(unsigned char const* buf, size_t len) |
| 28 | { | 28 | { |
| 29 | - if (this->m->data.get() == 0) { | 29 | + if (this->m->data.get() == nullptr) { |
| 30 | this->m->data = std::make_shared<Buffer>(len); | 30 | this->m->data = std::make_shared<Buffer>(len); |
| 31 | } | 31 | } |
| 32 | size_t cur_size = this->m->data->getSize(); | 32 | size_t cur_size = this->m->data->getSize(); |
libqpdf/Pl_Discard.cc
libqpdf/Pl_Flate.cc
| @@ -13,7 +13,7 @@ Pl_Flate::Members::Members(size_t out_bufsize, action_e action) : | @@ -13,7 +13,7 @@ Pl_Flate::Members::Members(size_t out_bufsize, action_e action) : | ||
| 13 | out_bufsize(out_bufsize), | 13 | out_bufsize(out_bufsize), |
| 14 | action(action), | 14 | action(action), |
| 15 | initialized(false), | 15 | initialized(false), |
| 16 | - zdata(0) | 16 | + zdata(nullptr) |
| 17 | { | 17 | { |
| 18 | this->outbuf = QUtil::make_shared_array<unsigned char>(out_bufsize); | 18 | this->outbuf = QUtil::make_shared_array<unsigned char>(out_bufsize); |
| 19 | // Indirect through zdata to reach the z_stream so we don't have | 19 | // Indirect through zdata to reach the z_stream so we don't have |
| @@ -29,10 +29,10 @@ Pl_Flate::Members::Members(size_t out_bufsize, action_e action) : | @@ -29,10 +29,10 @@ Pl_Flate::Members::Members(size_t out_bufsize, action_e action) : | ||
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | z_stream& zstream = *(static_cast<z_stream*>(this->zdata)); | 31 | z_stream& zstream = *(static_cast<z_stream*>(this->zdata)); |
| 32 | - zstream.zalloc = 0; | ||
| 33 | - zstream.zfree = 0; | ||
| 34 | - zstream.opaque = 0; | ||
| 35 | - zstream.next_in = 0; | 32 | + zstream.zalloc = nullptr; |
| 33 | + zstream.zfree = nullptr; | ||
| 34 | + zstream.opaque = nullptr; | ||
| 35 | + zstream.next_in = nullptr; | ||
| 36 | zstream.avail_in = 0; | 36 | zstream.avail_in = 0; |
| 37 | zstream.next_out = this->outbuf.get(); | 37 | zstream.next_out = this->outbuf.get(); |
| 38 | zstream.avail_out = QIntC::to_uint(out_bufsize); | 38 | zstream.avail_out = QIntC::to_uint(out_bufsize); |
| @@ -50,7 +50,7 @@ Pl_Flate::Members::~Members() | @@ -50,7 +50,7 @@ Pl_Flate::Members::~Members() | ||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | delete static_cast<z_stream*>(this->zdata); | 52 | delete static_cast<z_stream*>(this->zdata); |
| 53 | - this->zdata = 0; | 53 | + this->zdata = nullptr; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | Pl_Flate::Pl_Flate( | 56 | Pl_Flate::Pl_Flate( |
| @@ -86,7 +86,7 @@ Pl_Flate::warn(char const* msg, int code) | @@ -86,7 +86,7 @@ Pl_Flate::warn(char const* msg, int code) | ||
| 86 | void | 86 | void |
| 87 | Pl_Flate::write(unsigned char const* data, size_t len) | 87 | Pl_Flate::write(unsigned char const* data, size_t len) |
| 88 | { | 88 | { |
| 89 | - if (this->m->outbuf.get() == 0) { | 89 | + if (this->m->outbuf.get() == nullptr) { |
| 90 | throw std::logic_error( | 90 | throw std::logic_error( |
| 91 | this->identifier + | 91 | this->identifier + |
| 92 | ": Pl_Flate: write() called after finish() called"); | 92 | ": Pl_Flate: write() called after finish() called"); |
| @@ -227,7 +227,7 @@ Pl_Flate::finish() | @@ -227,7 +227,7 @@ Pl_Flate::finish() | ||
| 227 | checkError("End", err); | 227 | checkError("End", err); |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | - this->m->outbuf = 0; | 230 | + this->m->outbuf = nullptr; |
| 231 | } | 231 | } |
| 232 | } catch (std::exception& e) { | 232 | } catch (std::exception& e) { |
| 233 | try { | 233 | try { |
libqpdf/Pl_LZWDecoder.cc
| @@ -14,7 +14,7 @@ Pl_LZWDecoder::Pl_LZWDecoder( | @@ -14,7 +14,7 @@ Pl_LZWDecoder::Pl_LZWDecoder( | ||
| 14 | byte_pos(0), | 14 | byte_pos(0), |
| 15 | bit_pos(0), | 15 | bit_pos(0), |
| 16 | bits_available(0), | 16 | bits_available(0), |
| 17 | - code_change_delta(early_code_change ? 1 : 0), | 17 | + code_change_delta(early_code_change), |
| 18 | eod(false), | 18 | eod(false), |
| 19 | last_code(256) | 19 | last_code(256) |
| 20 | { | 20 | { |
| @@ -107,7 +107,7 @@ void | @@ -107,7 +107,7 @@ void | ||
| 107 | Pl_LZWDecoder::addToTable(unsigned char next) | 107 | Pl_LZWDecoder::addToTable(unsigned char next) |
| 108 | { | 108 | { |
| 109 | unsigned int last_size = 0; | 109 | unsigned int last_size = 0; |
| 110 | - unsigned char const* last_data = 0; | 110 | + unsigned char const* last_data = nullptr; |
| 111 | unsigned char tmp[1]; | 111 | unsigned char tmp[1]; |
| 112 | 112 | ||
| 113 | if (this->last_code < 256) { | 113 | if (this->last_code < 256) { |
libqpdf/Pl_OStream.cc
| @@ -10,7 +10,7 @@ Pl_OStream::Members::Members(std::ostream& os) : | @@ -10,7 +10,7 @@ Pl_OStream::Members::Members(std::ostream& os) : | ||
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | Pl_OStream::Pl_OStream(char const* identifier, std::ostream& os) : | 12 | Pl_OStream::Pl_OStream(char const* identifier, std::ostream& os) : |
| 13 | - Pipeline(identifier, 0), | 13 | + Pipeline(identifier, nullptr), |
| 14 | m(new Members(os)) | 14 | m(new Members(os)) |
| 15 | { | 15 | { |
| 16 | } | 16 | } |
libqpdf/Pl_PNGFilter.cc
| @@ -22,10 +22,10 @@ Pl_PNGFilter::Pl_PNGFilter( | @@ -22,10 +22,10 @@ Pl_PNGFilter::Pl_PNGFilter( | ||
| 22 | unsigned int bits_per_sample) : | 22 | unsigned int bits_per_sample) : |
| 23 | Pipeline(identifier, next), | 23 | Pipeline(identifier, next), |
| 24 | action(action), | 24 | action(action), |
| 25 | - cur_row(0), | ||
| 26 | - prev_row(0), | ||
| 27 | - buf1(0), | ||
| 28 | - buf2(0), | 25 | + cur_row(nullptr), |
| 26 | + prev_row(nullptr), | ||
| 27 | + buf1(nullptr), | ||
| 28 | + buf2(nullptr), | ||
| 29 | pos(0) | 29 | pos(0) |
| 30 | { | 30 | { |
| 31 | if (samples_per_pixel < 1) { | 31 | if (samples_per_pixel < 1) { |
| @@ -243,7 +243,7 @@ Pl_PNGFilter::finish() | @@ -243,7 +243,7 @@ Pl_PNGFilter::finish() | ||
| 243 | // write partial row | 243 | // write partial row |
| 244 | processRow(); | 244 | processRow(); |
| 245 | } | 245 | } |
| 246 | - this->prev_row = 0; | 246 | + this->prev_row = nullptr; |
| 247 | this->cur_row = buf1.get(); | 247 | this->cur_row = buf1.get(); |
| 248 | this->pos = 0; | 248 | this->pos = 0; |
| 249 | memset(this->cur_row, 0, this->bytes_per_row + 1); | 249 | memset(this->cur_row, 0, this->bytes_per_row + 1); |
libqpdf/Pl_QPDFTokenizer.cc
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | #include <string.h> | 7 | #include <string.h> |
| 8 | 8 | ||
| 9 | Pl_QPDFTokenizer::Members::Members() : | 9 | Pl_QPDFTokenizer::Members::Members() : |
| 10 | - filter(0), | 10 | + filter(nullptr), |
| 11 | buf("tokenizer buffer") | 11 | buf("tokenizer buffer") |
| 12 | { | 12 | { |
| 13 | } | 13 | } |
| @@ -68,7 +68,8 @@ Pl_QPDFTokenizer::finish() | @@ -68,7 +68,8 @@ Pl_QPDFTokenizer::finish() | ||
| 68 | } | 68 | } |
| 69 | } | 69 | } |
| 70 | this->m->filter->handleEOF(); | 70 | this->m->filter->handleEOF(); |
| 71 | - QPDFObjectHandle::TokenFilter::PipelineAccessor::setPipeline(m->filter, 0); | 71 | + QPDFObjectHandle::TokenFilter::PipelineAccessor::setPipeline( |
| 72 | + m->filter, nullptr); | ||
| 72 | Pipeline* next = this->getNext(true); | 73 | Pipeline* next = this->getNext(true); |
| 73 | if (next) { | 74 | if (next) { |
| 74 | next->finish(); | 75 | next->finish(); |
libqpdf/Pl_RC4.cc
| @@ -18,7 +18,7 @@ Pl_RC4::Pl_RC4( | @@ -18,7 +18,7 @@ Pl_RC4::Pl_RC4( | ||
| 18 | void | 18 | void |
| 19 | Pl_RC4::write(unsigned char const* data, size_t len) | 19 | Pl_RC4::write(unsigned char const* data, size_t len) |
| 20 | { | 20 | { |
| 21 | - if (this->outbuf.get() == 0) { | 21 | + if (this->outbuf.get() == nullptr) { |
| 22 | throw std::logic_error( | 22 | throw std::logic_error( |
| 23 | this->identifier + | 23 | this->identifier + |
| 24 | ": Pl_RC4: write() called after finish() called"); | 24 | ": Pl_RC4: write() called after finish() called"); |
| @@ -41,6 +41,6 @@ Pl_RC4::write(unsigned char const* data, size_t len) | @@ -41,6 +41,6 @@ Pl_RC4::write(unsigned char const* data, size_t len) | ||
| 41 | void | 41 | void |
| 42 | Pl_RC4::finish() | 42 | Pl_RC4::finish() |
| 43 | { | 43 | { |
| 44 | - this->outbuf = 0; | 44 | + this->outbuf = nullptr; |
| 45 | this->getNext()->finish(); | 45 | this->getNext()->finish(); |
| 46 | } | 46 | } |
libqpdf/Pl_StdioFile.cc
| @@ -12,7 +12,7 @@ Pl_StdioFile::Members::Members(FILE* f) : | @@ -12,7 +12,7 @@ Pl_StdioFile::Members::Members(FILE* f) : | ||
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | Pl_StdioFile::Pl_StdioFile(char const* identifier, FILE* f) : | 14 | Pl_StdioFile::Pl_StdioFile(char const* identifier, FILE* f) : |
| 15 | - Pipeline(identifier, 0), | 15 | + Pipeline(identifier, nullptr), |
| 16 | m(new Members(f)) | 16 | m(new Members(f)) |
| 17 | { | 17 | { |
| 18 | } | 18 | } |
libqpdf/QPDF.cc
| @@ -216,7 +216,7 @@ QPDF::Members::Members() : | @@ -216,7 +216,7 @@ QPDF::Members::Members() : | ||
| 216 | pushed_inherited_attributes_to_pages(false), | 216 | pushed_inherited_attributes_to_pages(false), |
| 217 | ever_pushed_inherited_attributes_to_pages(false), | 217 | ever_pushed_inherited_attributes_to_pages(false), |
| 218 | ever_called_get_all_pages(false), | 218 | ever_called_get_all_pages(false), |
| 219 | - copied_stream_data_provider(0), | 219 | + copied_stream_data_provider(nullptr), |
| 220 | reconstructed_xref(false), | 220 | reconstructed_xref(false), |
| 221 | fixed_dangling_refs(false), | 221 | fixed_dangling_refs(false), |
| 222 | immediate_copy_from(false), | 222 | immediate_copy_from(false), |
| @@ -1496,7 +1496,7 @@ QPDF::readObject( | @@ -1496,7 +1496,7 @@ QPDF::readObject( | ||
| 1496 | 1496 | ||
| 1497 | bool empty = false; | 1497 | bool empty = false; |
| 1498 | std::shared_ptr<StringDecrypter> decrypter_ph; | 1498 | std::shared_ptr<StringDecrypter> decrypter_ph; |
| 1499 | - StringDecrypter* decrypter = 0; | 1499 | + StringDecrypter* decrypter = nullptr; |
| 1500 | if (this->m->encp->encrypted && (!in_object_stream)) { | 1500 | if (this->m->encp->encrypted && (!in_object_stream)) { |
| 1501 | decrypter_ph = std::make_shared<StringDecrypter>(this, og); | 1501 | decrypter_ph = std::make_shared<StringDecrypter>(this, og); |
| 1502 | decrypter = decrypter_ph.get(); | 1502 | decrypter = decrypter_ph.get(); |
| @@ -2434,7 +2434,7 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign) | @@ -2434,7 +2434,7 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign) | ||
| 2434 | 2434 | ||
| 2435 | QPDFObjectHandle dict = result.getDict(); | 2435 | QPDFObjectHandle dict = result.getDict(); |
| 2436 | QPDFObjectHandle old_dict = foreign.getDict(); | 2436 | QPDFObjectHandle old_dict = foreign.getDict(); |
| 2437 | - if (this->m->copied_stream_data_provider == 0) { | 2437 | + if (this->m->copied_stream_data_provider == nullptr) { |
| 2438 | this->m->copied_stream_data_provider = | 2438 | this->m->copied_stream_data_provider = |
| 2439 | new CopiedStreamDataProvider(*this); | 2439 | new CopiedStreamDataProvider(*this); |
| 2440 | this->m->copied_streams = | 2440 | this->m->copied_streams = |
| @@ -2457,7 +2457,7 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign) | @@ -2457,7 +2457,7 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign) | ||
| 2457 | } | 2457 | } |
| 2458 | std::shared_ptr<Buffer> stream_buffer = stream->getStreamDataBuffer(); | 2458 | std::shared_ptr<Buffer> stream_buffer = stream->getStreamDataBuffer(); |
| 2459 | if ((foreign_stream_qpdf->m->immediate_copy_from) && | 2459 | if ((foreign_stream_qpdf->m->immediate_copy_from) && |
| 2460 | - (stream_buffer.get() == 0)) { | 2460 | + (stream_buffer.get() == nullptr)) { |
| 2461 | // Pull the stream data into a buffer before attempting | 2461 | // Pull the stream data into a buffer before attempting |
| 2462 | // the copy operation. Do it on the source stream so that | 2462 | // the copy operation. Do it on the source stream so that |
| 2463 | // if the source stream is copied multiple times, we don't | 2463 | // if the source stream is copied multiple times, we don't |
libqpdf/QPDFArgParser.cc
| @@ -30,7 +30,7 @@ QPDFArgParser::QPDFArgParser( | @@ -30,7 +30,7 @@ QPDFArgParser::QPDFArgParser( | ||
| 30 | m(new Members(argc, argv, progname_env)) | 30 | m(new Members(argc, argv, progname_env)) |
| 31 | { | 31 | { |
| 32 | selectHelpOptionTable(); | 32 | selectHelpOptionTable(); |
| 33 | - char const* help_choices[] = {"all", 0}; | 33 | + char const* help_choices[] = {"all", nullptr}; |
| 34 | // More help choices are added dynamically. | 34 | // More help choices are added dynamically. |
| 35 | addChoices( | 35 | addChoices( |
| 36 | "help", bindParam(&QPDFArgParser::argHelp, this), false, help_choices); | 36 | "help", bindParam(&QPDFArgParser::argHelp, this), false, help_choices); |
| @@ -254,7 +254,7 @@ QPDFArgParser::handleArgFileArguments() | @@ -254,7 +254,7 @@ QPDFArgParser::handleArgFileArguments() | ||
| 254 | // deleted by using shared pointers to back the pointers in argv. | 254 | // deleted by using shared pointers to back the pointers in argv. |
| 255 | this->m->new_argv.push_back(QUtil::make_shared_cstr(this->m->argv[0])); | 255 | this->m->new_argv.push_back(QUtil::make_shared_cstr(this->m->argv[0])); |
| 256 | for (int i = 1; i < this->m->argc; ++i) { | 256 | for (int i = 1; i < this->m->argc; ++i) { |
| 257 | - char const* argfile = 0; | 257 | + char const* argfile = nullptr; |
| 258 | if ((strlen(this->m->argv[i]) > 1) && (this->m->argv[i][0] == '@')) { | 258 | if ((strlen(this->m->argv[i]) > 1) && (this->m->argv[i][0] == '@')) { |
| 259 | argfile = 1 + this->m->argv[i]; | 259 | argfile = 1 + this->m->argv[i]; |
| 260 | if (strcmp(argfile, "-") != 0) { | 260 | if (strcmp(argfile, "-") != 0) { |
libqpdf/QPDFCrypto_native.cc
| @@ -14,7 +14,7 @@ getRandomProvider() | @@ -14,7 +14,7 @@ getRandomProvider() | ||
| 14 | static RandomDataProvider* insecure_random_data_provider = | 14 | static RandomDataProvider* insecure_random_data_provider = |
| 15 | InsecureRandomDataProvider::getInstance(); | 15 | InsecureRandomDataProvider::getInstance(); |
| 16 | #else | 16 | #else |
| 17 | - static RandomDataProvider* insecure_random_data_provider = 0; | 17 | + static RandomDataProvider* insecure_random_data_provider = nullptr; |
| 18 | #endif | 18 | #endif |
| 19 | static RandomDataProvider* secure_random_data_provider = | 19 | static RandomDataProvider* secure_random_data_provider = |
| 20 | SecureRandomDataProvider::getInstance(); | 20 | SecureRandomDataProvider::getInstance(); |
| @@ -22,9 +22,9 @@ getRandomProvider() | @@ -22,9 +22,9 @@ getRandomProvider() | ||
| 22 | static RandomDataProvider* provider = | 22 | static RandomDataProvider* provider = |
| 23 | (secure_random_data_provider ? secure_random_data_provider | 23 | (secure_random_data_provider ? secure_random_data_provider |
| 24 | : insecure_random_data_provider ? insecure_random_data_provider | 24 | : insecure_random_data_provider ? insecure_random_data_provider |
| 25 | - : 0); | 25 | + : nullptr); |
| 26 | 26 | ||
| 27 | - if (provider == 0) { | 27 | + if (provider == nullptr) { |
| 28 | throw std::logic_error("QPDFCrypto_native has no random data provider"); | 28 | throw std::logic_error("QPDFCrypto_native has no random data provider"); |
| 29 | } | 29 | } |
| 30 | 30 |
libqpdf/QPDFFormFieldObjectHelper.cc
| @@ -746,7 +746,7 @@ TfFinder::handleToken(QPDFTokenizer::Token const& token) | @@ -746,7 +746,7 @@ TfFinder::handleToken(QPDFTokenizer::Token const& token) | ||
| 746 | switch (ttype) { | 746 | switch (ttype) { |
| 747 | case QPDFTokenizer::tt_integer: | 747 | case QPDFTokenizer::tt_integer: |
| 748 | case QPDFTokenizer::tt_real: | 748 | case QPDFTokenizer::tt_real: |
| 749 | - last_num = strtod(value.c_str(), 0); | 749 | + last_num = strtod(value.c_str(), nullptr); |
| 750 | last_num_idx = QIntC::to_int(DA.size() - 1); | 750 | last_num_idx = QIntC::to_int(DA.size() - 1); |
| 751 | break; | 751 | break; |
| 752 | 752 | ||
| @@ -785,7 +785,7 @@ TfFinder::getDA() | @@ -785,7 +785,7 @@ TfFinder::getDA() | ||
| 785 | for (size_t i = 0; i < n; ++i) { | 785 | for (size_t i = 0; i < n; ++i) { |
| 786 | std::string cur = this->DA.at(i); | 786 | std::string cur = this->DA.at(i); |
| 787 | if (QIntC::to_int(i) == tf_idx) { | 787 | if (QIntC::to_int(i) == tf_idx) { |
| 788 | - double delta = strtod(cur.c_str(), 0) - this->tf; | 788 | + double delta = strtod(cur.c_str(), nullptr) - this->tf; |
| 789 | if ((delta > 0.001) || (delta < -0.001)) { | 789 | if ((delta > 0.001) || (delta < -0.001)) { |
| 790 | // tf doesn't match the font size passed to Tf, so | 790 | // tf doesn't match the font size passed to Tf, so |
| 791 | // substitute. | 791 | // substitute. |
libqpdf/QPDFJob.cc
| @@ -211,7 +211,7 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next) | @@ -211,7 +211,7 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next) | ||
| 211 | bool | 211 | bool |
| 212 | ImageOptimizer::evaluate(std::string const& description) | 212 | ImageOptimizer::evaluate(std::string const& description) |
| 213 | { | 213 | { |
| 214 | - if (!image.pipeStreamData(0, 0, qpdf_dl_specialized, true)) { | 214 | + if (!image.pipeStreamData(nullptr, 0, qpdf_dl_specialized, true)) { |
| 215 | QTC::TC("qpdf", "QPDFJob image optimize no pipeline"); | 215 | QTC::TC("qpdf", "QPDFJob image optimize no pipeline"); |
| 216 | o.doIfVerbose([&](Pipeline& v, std::string const& prefix) { | 216 | o.doIfVerbose([&](Pipeline& v, std::string const& prefix) { |
| 217 | v << prefix << ": " << description | 217 | v << prefix << ": " << description |
| @@ -317,7 +317,7 @@ QPDFJob::Members::Members() : | @@ -317,7 +317,7 @@ QPDFJob::Members::Members() : | ||
| 317 | warnings(false), | 317 | warnings(false), |
| 318 | encryption_status(0), | 318 | encryption_status(0), |
| 319 | verbose(false), | 319 | verbose(false), |
| 320 | - password(0), | 320 | + password(nullptr), |
| 321 | linearize(false), | 321 | linearize(false), |
| 322 | decrypt(false), | 322 | decrypt(false), |
| 323 | split_pages(0), | 323 | split_pages(0), |
| @@ -326,7 +326,7 @@ QPDFJob::Members::Members() : | @@ -326,7 +326,7 @@ QPDFJob::Members::Members() : | ||
| 326 | suppress_warnings(false), | 326 | suppress_warnings(false), |
| 327 | warnings_exit_zero(false), | 327 | warnings_exit_zero(false), |
| 328 | copy_encryption(false), | 328 | copy_encryption(false), |
| 329 | - encryption_file_password(0), | 329 | + encryption_file_password(nullptr), |
| 330 | encrypt(false), | 330 | encrypt(false), |
| 331 | password_is_hex_key(false), | 331 | password_is_hex_key(false), |
| 332 | suppress_password_recovery(false), | 332 | suppress_password_recovery(false), |
| @@ -411,7 +411,7 @@ QPDFJob::Members::Members() : | @@ -411,7 +411,7 @@ QPDFJob::Members::Members() : | ||
| 411 | ii_min_bytes(DEFAULT_II_MIN_BYTES), | 411 | ii_min_bytes(DEFAULT_II_MIN_BYTES), |
| 412 | underlay("underlay"), | 412 | underlay("underlay"), |
| 413 | overlay("overlay"), | 413 | overlay("overlay"), |
| 414 | - under_overlay(0), | 414 | + under_overlay(nullptr), |
| 415 | require_outfile(true), | 415 | require_outfile(true), |
| 416 | replace_input(false), | 416 | replace_input(false), |
| 417 | check_is_encrypted(false), | 417 | check_is_encrypted(false), |
| @@ -673,13 +673,15 @@ QPDFJob::checkConfiguration() | @@ -673,13 +673,15 @@ QPDFJob::checkConfiguration() | ||
| 673 | usage("--split-pages may not be used with --replace-input"); | 673 | usage("--split-pages may not be used with --replace-input"); |
| 674 | } | 674 | } |
| 675 | } | 675 | } |
| 676 | - if (m->infilename == 0) { | 676 | + if (m->infilename == nullptr) { |
| 677 | usage("an input file name is required"); | 677 | usage("an input file name is required"); |
| 678 | } else if ( | 678 | } else if ( |
| 679 | - m->require_outfile && (m->outfilename == 0) && (!m->replace_input)) { | 679 | + m->require_outfile && (m->outfilename == nullptr) && |
| 680 | + (!m->replace_input)) { | ||
| 680 | usage("an output file name is required; use - for standard output"); | 681 | usage("an output file name is required; use - for standard output"); |
| 681 | } else if ( | 682 | } else if ( |
| 682 | - (!m->require_outfile) && ((m->outfilename != 0) || m->replace_input)) { | 683 | + (!m->require_outfile) && |
| 684 | + ((m->outfilename != nullptr) || m->replace_input)) { | ||
| 683 | usage("no output file may be given for this option"); | 685 | usage("no output file may be given for this option"); |
| 684 | } | 686 | } |
| 685 | if (m->check_requires_password && m->check_is_encrypted) { | 687 | if (m->check_requires_password && m->check_is_encrypted) { |
| @@ -924,7 +926,7 @@ QPDFJob::doShowObj(QPDF& pdf) | @@ -924,7 +926,7 @@ QPDFJob::doShowObj(QPDF& pdf) | ||
| 924 | if (obj.isStream()) { | 926 | if (obj.isStream()) { |
| 925 | if (m->show_raw_stream_data || m->show_filtered_stream_data) { | 927 | if (m->show_raw_stream_data || m->show_filtered_stream_data) { |
| 926 | bool filter = m->show_filtered_stream_data; | 928 | bool filter = m->show_filtered_stream_data; |
| 927 | - if (filter && (!obj.pipeStreamData(0, 0, qpdf_dl_all))) { | 929 | + if (filter && (!obj.pipeStreamData(nullptr, 0, qpdf_dl_all))) { |
| 928 | QTC::TC("qpdf", "QPDFJob unable to filter"); | 930 | QTC::TC("qpdf", "QPDFJob unable to filter"); |
| 929 | obj.warnIfPossible("unable to filter stream data"); | 931 | obj.warnIfPossible("unable to filter stream data"); |
| 930 | error = true; | 932 | error = true; |
| @@ -1204,7 +1206,7 @@ QPDFJob::doJSONPages(Pipeline* p, bool& first, QPDF& pdf) | @@ -1204,7 +1206,7 @@ QPDFJob::doJSONPages(Pipeline* p, bool& first, QPDF& pdf) | ||
| 1204 | j_image.addDictionaryMember( | 1206 | j_image.addDictionaryMember( |
| 1205 | "filterable", | 1207 | "filterable", |
| 1206 | JSON::makeBool( | 1208 | JSON::makeBool( |
| 1207 | - image.pipeStreamData(0, 0, m->decode_level, true))); | 1209 | + image.pipeStreamData(nullptr, 0, m->decode_level, true))); |
| 1208 | } | 1210 | } |
| 1209 | j_page.addDictionaryMember("images", j_images); | 1211 | j_page.addDictionaryMember("images", j_images); |
| 1210 | JSON j_contents = | 1212 | JSON j_contents = |
| @@ -1561,7 +1563,7 @@ QPDFJob::json_schema(int json_version, std::set<std::string>* keys) | @@ -1561,7 +1563,7 @@ QPDFJob::json_schema(int json_version, std::set<std::string>* keys) | ||
| 1561 | "decodelevel": "decode level used to determine stream filterability" | 1563 | "decodelevel": "decode level used to determine stream filterability" |
| 1562 | })")); | 1564 | })")); |
| 1563 | 1565 | ||
| 1564 | - bool all_keys = ((keys == 0) || keys->empty()); | 1566 | + bool all_keys = ((keys == nullptr) || keys->empty()); |
| 1565 | 1567 | ||
| 1566 | // The list of selectable top-level keys id duplicated in the | 1568 | // The list of selectable top-level keys id duplicated in the |
| 1567 | // following places: job.yml, QPDFJob::json_schema, and | 1569 | // following places: job.yml, QPDFJob::json_schema, and |
| @@ -1943,7 +1945,7 @@ QPDFJob::doProcess( | @@ -1943,7 +1945,7 @@ QPDFJob::doProcess( | ||
| 1943 | password = ptemp.c_str(); | 1945 | password = ptemp.c_str(); |
| 1944 | } | 1946 | } |
| 1945 | } | 1947 | } |
| 1946 | - if ((password == 0) || empty || m->password_is_hex_key || | 1948 | + if ((password == nullptr) || empty || m->password_is_hex_key || |
| 1947 | m->suppress_password_recovery) { | 1949 | m->suppress_password_recovery) { |
| 1948 | // There is no password, or we're not doing recovery, so just | 1950 | // There is no password, or we're not doing recovery, so just |
| 1949 | // do the normal processing with the supplied password. | 1951 | // do the normal processing with the supplied password. |
| @@ -2591,7 +2593,7 @@ QPDFJob::handlePageSpecs( | @@ -2591,7 +2593,7 @@ QPDFJob::handlePageSpecs( | ||
| 2591 | // to the same underlying file with the same path to | 2593 | // to the same underlying file with the same path to |
| 2592 | // achieve the same affect. | 2594 | // achieve the same affect. |
| 2593 | char const* password = page_spec.password.get(); | 2595 | char const* password = page_spec.password.get(); |
| 2594 | - if ((!m->encryption_file.empty()) && (password == 0) && | 2596 | + if ((!m->encryption_file.empty()) && (password == nullptr) && |
| 2595 | (page_spec.filename == m->encryption_file)) { | 2597 | (page_spec.filename == m->encryption_file)) { |
| 2596 | QTC::TC("qpdf", "QPDFJob pages encryption password"); | 2598 | QTC::TC("qpdf", "QPDFJob pages encryption password"); |
| 2597 | password = m->encryption_file_password.get(); | 2599 | password = m->encryption_file_password.get(); |
| @@ -2600,7 +2602,7 @@ QPDFJob::handlePageSpecs( | @@ -2600,7 +2602,7 @@ QPDFJob::handlePageSpecs( | ||
| 2600 | v << prefix << ": processing " << page_spec.filename << "\n"; | 2602 | v << prefix << ": processing " << page_spec.filename << "\n"; |
| 2601 | }); | 2603 | }); |
| 2602 | std::shared_ptr<InputSource> is; | 2604 | std::shared_ptr<InputSource> is; |
| 2603 | - ClosedFileInputSource* cis = 0; | 2605 | + ClosedFileInputSource* cis = nullptr; |
| 2604 | if (!m->keep_files_open) { | 2606 | if (!m->keep_files_open) { |
| 2605 | QTC::TC("qpdf", "QPDFJob keep files open n"); | 2607 | QTC::TC("qpdf", "QPDFJob keep files open n"); |
| 2606 | cis = new ClosedFileInputSource(page_spec.filename.c_str()); | 2608 | cis = new ClosedFileInputSource(page_spec.filename.c_str()); |
| @@ -2636,7 +2638,7 @@ QPDFJob::handlePageSpecs( | @@ -2636,7 +2638,7 @@ QPDFJob::handlePageSpecs( | ||
| 2636 | if (m->remove_unreferenced_page_resources != QPDFJob::re_no) { | 2638 | if (m->remove_unreferenced_page_resources != QPDFJob::re_no) { |
| 2637 | for (auto const& iter: page_spec_qpdfs) { | 2639 | for (auto const& iter: page_spec_qpdfs) { |
| 2638 | std::string const& filename = iter.first; | 2640 | std::string const& filename = iter.first; |
| 2639 | - ClosedFileInputSource* cis = 0; | 2641 | + ClosedFileInputSource* cis = nullptr; |
| 2640 | if (page_spec_cfis.count(filename)) { | 2642 | if (page_spec_cfis.count(filename)) { |
| 2641 | cis = page_spec_cfis[filename]; | 2643 | cis = page_spec_cfis[filename]; |
| 2642 | cis->stayOpen(true); | 2644 | cis->stayOpen(true); |
| @@ -2707,7 +2709,7 @@ QPDFJob::handlePageSpecs( | @@ -2707,7 +2709,7 @@ QPDFJob::handlePageSpecs( | ||
| 2707 | auto this_afdh = get_afdh_for_qpdf(afdh_map, &pdf); | 2709 | auto this_afdh = get_afdh_for_qpdf(afdh_map, &pdf); |
| 2708 | std::set<QPDFObjGen> referenced_fields; | 2710 | std::set<QPDFObjGen> referenced_fields; |
| 2709 | for (auto& page_data: parsed_specs) { | 2711 | for (auto& page_data: parsed_specs) { |
| 2710 | - ClosedFileInputSource* cis = 0; | 2712 | + ClosedFileInputSource* cis = nullptr; |
| 2711 | if (page_spec_cfis.count(page_data.filename)) { | 2713 | if (page_spec_cfis.count(page_data.filename)) { |
| 2712 | cis = page_spec_cfis[page_data.filename]; | 2714 | cis = page_spec_cfis[page_data.filename]; |
| 2713 | cis->stayOpen(true); | 2715 | cis->stayOpen(true); |
| @@ -3061,7 +3063,7 @@ parse_version( | @@ -3061,7 +3063,7 @@ parse_version( | ||
| 3061 | auto vp = QUtil::make_unique_cstr(full_version_string); | 3063 | auto vp = QUtil::make_unique_cstr(full_version_string); |
| 3062 | char* v = vp.get(); | 3064 | char* v = vp.get(); |
| 3063 | char* p1 = strchr(v, '.'); | 3065 | char* p1 = strchr(v, '.'); |
| 3064 | - char* p2 = (p1 ? strchr(1 + p1, '.') : 0); | 3066 | + char* p2 = (p1 ? strchr(1 + p1, '.') : nullptr); |
| 3065 | if (p2 && *(p2 + 1)) { | 3067 | if (p2 && *(p2 + 1)) { |
| 3066 | *p2++ = '\0'; | 3068 | *p2++ = '\0'; |
| 3067 | extension_level = QUtil::string_to_int(p2); | 3069 | extension_level = QUtil::string_to_int(p2); |
| @@ -3176,7 +3178,7 @@ QPDFJob::doSplitPages(QPDF& pdf, bool& warnings) | @@ -3176,7 +3178,7 @@ QPDFJob::doSplitPages(QPDF& pdf, bool& warnings) | ||
| 3176 | std::string after; | 3178 | std::string after; |
| 3177 | size_t len = strlen(m->outfilename.get()); | 3179 | size_t len = strlen(m->outfilename.get()); |
| 3178 | char* num_spot = strstr(const_cast<char*>(m->outfilename.get()), "%d"); | 3180 | char* num_spot = strstr(const_cast<char*>(m->outfilename.get()), "%d"); |
| 3179 | - if (num_spot != 0) { | 3181 | + if (num_spot != nullptr) { |
| 3180 | QTC::TC("qpdf", "QPDFJob split-pages %d"); | 3182 | QTC::TC("qpdf", "QPDFJob split-pages %d"); |
| 3181 | before = std::string( | 3183 | before = std::string( |
| 3182 | m->outfilename.get(), | 3184 | m->outfilename.get(), |
| @@ -3310,7 +3312,7 @@ QPDFJob::writeOutfile(QPDF& pdf) | @@ -3310,7 +3312,7 @@ QPDFJob::writeOutfile(QPDF& pdf) | ||
| 3310 | }); | 3312 | }); |
| 3311 | } | 3313 | } |
| 3312 | if (m->replace_input) { | 3314 | if (m->replace_input) { |
| 3313 | - m->outfilename = 0; | 3315 | + m->outfilename = nullptr; |
| 3314 | } | 3316 | } |
| 3315 | if (m->replace_input) { | 3317 | if (m->replace_input) { |
| 3316 | // We must close the input before we can rename files | 3318 | // We must close the input before we can rename files |
libqpdf/QPDFJob_config.cc
| @@ -13,7 +13,7 @@ QPDFJob::Config::checkConfiguration() | @@ -13,7 +13,7 @@ QPDFJob::Config::checkConfiguration() | ||
| 13 | QPDFJob::Config* | 13 | QPDFJob::Config* |
| 14 | QPDFJob::Config::inputFile(std::string const& filename) | 14 | QPDFJob::Config::inputFile(std::string const& filename) |
| 15 | { | 15 | { |
| 16 | - if (o.m->infilename == 0) { | 16 | + if (o.m->infilename == nullptr) { |
| 17 | o.m->infilename = QUtil::make_shared_cstr(filename); | 17 | o.m->infilename = QUtil::make_shared_cstr(filename); |
| 18 | } else { | 18 | } else { |
| 19 | usage("input file has already been given"); | 19 | usage("input file has already been given"); |
| @@ -24,7 +24,7 @@ QPDFJob::Config::inputFile(std::string const& filename) | @@ -24,7 +24,7 @@ QPDFJob::Config::inputFile(std::string const& filename) | ||
| 24 | QPDFJob::Config* | 24 | QPDFJob::Config* |
| 25 | QPDFJob::Config::emptyInput() | 25 | QPDFJob::Config::emptyInput() |
| 26 | { | 26 | { |
| 27 | - if (o.m->infilename == 0) { | 27 | + if (o.m->infilename == nullptr) { |
| 28 | // Various places in QPDFJob.cc know that the empty string for | 28 | // Various places in QPDFJob.cc know that the empty string for |
| 29 | // infile means empty. We set it to something other than a | 29 | // infile means empty. We set it to something other than a |
| 30 | // null pointer as an indication that some input source has | 30 | // null pointer as an indication that some input source has |
| @@ -44,7 +44,7 @@ QPDFJob::Config::emptyInput() | @@ -44,7 +44,7 @@ QPDFJob::Config::emptyInput() | ||
| 44 | QPDFJob::Config* | 44 | QPDFJob::Config* |
| 45 | QPDFJob::Config::outputFile(std::string const& filename) | 45 | QPDFJob::Config::outputFile(std::string const& filename) |
| 46 | { | 46 | { |
| 47 | - if ((o.m->outfilename == 0) && (!o.m->replace_input)) { | 47 | + if ((o.m->outfilename == nullptr) && (!o.m->replace_input)) { |
| 48 | o.m->outfilename = QUtil::make_shared_cstr(filename); | 48 | o.m->outfilename = QUtil::make_shared_cstr(filename); |
| 49 | } else { | 49 | } else { |
| 50 | usage("output file has already been given"); | 50 | usage("output file has already been given"); |
| @@ -55,7 +55,7 @@ QPDFJob::Config::outputFile(std::string const& filename) | @@ -55,7 +55,7 @@ QPDFJob::Config::outputFile(std::string const& filename) | ||
| 55 | QPDFJob::Config* | 55 | QPDFJob::Config* |
| 56 | QPDFJob::Config::replaceInput() | 56 | QPDFJob::Config::replaceInput() |
| 57 | { | 57 | { |
| 58 | - if ((o.m->outfilename == 0) && (!o.m->replace_input)) { | 58 | + if ((o.m->outfilename == nullptr) && (!o.m->replace_input)) { |
| 59 | o.m->replace_input = true; | 59 | o.m->replace_input = true; |
| 60 | } else { | 60 | } else { |
| 61 | usage("replace-input can't be used" | 61 | usage("replace-input can't be used" |
| @@ -977,7 +977,7 @@ QPDFJob::UOConfig::endUnderlayOverlay() | @@ -977,7 +977,7 @@ QPDFJob::UOConfig::endUnderlayOverlay() | ||
| 977 | if (config->o.m->under_overlay->filename.empty()) { | 977 | if (config->o.m->under_overlay->filename.empty()) { |
| 978 | usage(config->o.m->under_overlay->which + " file not specified"); | 978 | usage(config->o.m->under_overlay->which + " file not specified"); |
| 979 | } | 979 | } |
| 980 | - config->o.m->under_overlay = 0; | 980 | + config->o.m->under_overlay = nullptr; |
| 981 | return this->config; | 981 | return this->config; |
| 982 | } | 982 | } |
| 983 | 983 |
libqpdf/QPDFObject.cc
| 1 | #include <qpdf/QPDFObject.hh> | 1 | #include <qpdf/QPDFObject.hh> |
| 2 | 2 | ||
| 3 | QPDFObject::QPDFObject() : | 3 | QPDFObject::QPDFObject() : |
| 4 | - owning_qpdf(0), | 4 | + owning_qpdf(nullptr), |
| 5 | parsed_offset(-1) | 5 | parsed_offset(-1) |
| 6 | { | 6 | { |
| 7 | } | 7 | } |
| @@ -25,13 +25,13 @@ QPDFObject::getDescription(QPDF*& qpdf, std::string& description) | @@ -25,13 +25,13 @@ QPDFObject::getDescription(QPDF*& qpdf, std::string& description) | ||
| 25 | { | 25 | { |
| 26 | qpdf = this->owning_qpdf; | 26 | qpdf = this->owning_qpdf; |
| 27 | description = this->object_description; | 27 | description = this->object_description; |
| 28 | - return this->owning_qpdf != 0; | 28 | + return this->owning_qpdf != nullptr; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | bool | 31 | bool |
| 32 | QPDFObject::hasDescription() | 32 | QPDFObject::hasDescription() |
| 33 | { | 33 | { |
| 34 | - return this->owning_qpdf != 0; | 34 | + return this->owning_qpdf != nullptr; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | void | 37 | void |
libqpdf/QPDFObjectHandle.cc
| @@ -265,7 +265,7 @@ QPDFObjectHandle::releaseResolved() | @@ -265,7 +265,7 @@ QPDFObjectHandle::releaseResolved() | ||
| 265 | // destruction. See comments in QPDF::~QPDF(). | 265 | // destruction. See comments in QPDF::~QPDF(). |
| 266 | if (isIndirect()) { | 266 | if (isIndirect()) { |
| 267 | if (this->obj.get()) { | 267 | if (this->obj.get()) { |
| 268 | - this->obj = 0; | 268 | + this->obj = nullptr; |
| 269 | } | 269 | } |
| 270 | } else { | 270 | } else { |
| 271 | QPDFObject::ObjAccessor::releaseResolved(this->obj.get()); | 271 | QPDFObject::ObjAccessor::releaseResolved(this->obj.get()); |
| @@ -780,7 +780,7 @@ QPDFObjectHandle::getArrayItem(int n) | @@ -780,7 +780,7 @@ QPDFObjectHandle::getArrayItem(int n) | ||
| 780 | typeWarning("array", "returning null"); | 780 | typeWarning("array", "returning null"); |
| 781 | QTC::TC("qpdf", "QPDFObjectHandle array null for non-array"); | 781 | QTC::TC("qpdf", "QPDFObjectHandle array null for non-array"); |
| 782 | } | 782 | } |
| 783 | - QPDF* context = 0; | 783 | + QPDF* context = nullptr; |
| 784 | std::string description; | 784 | std::string description; |
| 785 | if (this->obj->getDescription(context, description)) { | 785 | if (this->obj->getDescription(context, description)) { |
| 786 | result.setObjectDescription( | 786 | result.setObjectDescription( |
| @@ -998,7 +998,7 @@ QPDFObjectHandle::getKey(std::string const& key) | @@ -998,7 +998,7 @@ QPDFObjectHandle::getKey(std::string const& key) | ||
| 998 | typeWarning("dictionary", "returning null for attempted key retrieval"); | 998 | typeWarning("dictionary", "returning null for attempted key retrieval"); |
| 999 | QTC::TC("qpdf", "QPDFObjectHandle dictionary null for getKey"); | 999 | QTC::TC("qpdf", "QPDFObjectHandle dictionary null for getKey"); |
| 1000 | result = newNull(); | 1000 | result = newNull(); |
| 1001 | - QPDF* qpdf = 0; | 1001 | + QPDF* qpdf = nullptr; |
| 1002 | std::string description; | 1002 | std::string description; |
| 1003 | if (this->obj->getDescription(qpdf, description)) { | 1003 | if (this->obj->getDescription(qpdf, description)) { |
| 1004 | result.setObjectDescription( | 1004 | result.setObjectDescription( |
| @@ -1665,7 +1665,7 @@ QPDFObjectHandle::coalesceContentStreams() | @@ -1665,7 +1665,7 @@ QPDFObjectHandle::coalesceContentStreams() | ||
| 1665 | return; | 1665 | return; |
| 1666 | } | 1666 | } |
| 1667 | QPDF* qpdf = getOwningQPDF(); | 1667 | QPDF* qpdf = getOwningQPDF(); |
| 1668 | - if (qpdf == 0) { | 1668 | + if (qpdf == nullptr) { |
| 1669 | // Should not be possible for a page object to not have an | 1669 | // Should not be possible for a page object to not have an |
| 1670 | // owning PDF unless it was manually constructed in some | 1670 | // owning PDF unless it was manually constructed in some |
| 1671 | // incorrect way. However, it can happen in a PDF file whose | 1671 | // incorrect way. However, it can happen in a PDF file whose |
| @@ -1782,7 +1782,7 @@ QPDFObjectHandle::parse( | @@ -1782,7 +1782,7 @@ QPDFObjectHandle::parse( | ||
| 1782 | QPDFTokenizer tokenizer; | 1782 | QPDFTokenizer tokenizer; |
| 1783 | bool empty = false; | 1783 | bool empty = false; |
| 1784 | QPDFObjectHandle result = | 1784 | QPDFObjectHandle result = |
| 1785 | - parse(input, object_description, tokenizer, empty, 0, context); | 1785 | + parse(input, object_description, tokenizer, empty, nullptr, context); |
| 1786 | size_t offset = QIntC::to_size(input->tell()); | 1786 | size_t offset = QIntC::to_size(input->tell()); |
| 1787 | while (offset < object_str.length()) { | 1787 | while (offset < object_str.length()) { |
| 1788 | if (!isspace(object_str.at(offset))) { | 1788 | if (!isspace(object_str.at(offset))) { |
| @@ -1918,8 +1918,8 @@ QPDFObjectHandle::parseContentStream_data( | @@ -1918,8 +1918,8 @@ QPDFObjectHandle::parseContentStream_data( | ||
| 1918 | tokenizer.readToken(input, "content", true); | 1918 | tokenizer.readToken(input, "content", true); |
| 1919 | qpdf_offset_t offset = input->getLastOffset(); | 1919 | qpdf_offset_t offset = input->getLastOffset(); |
| 1920 | input->seek(offset, SEEK_SET); | 1920 | input->seek(offset, SEEK_SET); |
| 1921 | - QPDFObjectHandle obj = | ||
| 1922 | - parseInternal(input, "content", tokenizer, empty, 0, context, true); | 1921 | + QPDFObjectHandle obj = parseInternal( |
| 1922 | + input, "content", tokenizer, empty, nullptr, context, true); | ||
| 1923 | if (!obj.isInitialized()) { | 1923 | if (!obj.isInitialized()) { |
| 1924 | // EOF | 1924 | // EOF |
| 1925 | break; | 1925 | break; |
| @@ -2195,7 +2195,7 @@ QPDFObjectHandle::parseInternal( | @@ -2195,7 +2195,7 @@ QPDFObjectHandle::parseInternal( | ||
| 2195 | (olist.at(olist.size() - 1).isInteger()) && | 2195 | (olist.at(olist.size() - 1).isInteger()) && |
| 2196 | (!olist.at(olist.size() - 2).isIndirect()) && | 2196 | (!olist.at(olist.size() - 2).isIndirect()) && |
| 2197 | (olist.at(olist.size() - 2).isInteger())) { | 2197 | (olist.at(olist.size() - 2).isInteger())) { |
| 2198 | - if (context == 0) { | 2198 | + if (context == nullptr) { |
| 2199 | QTC::TC( | 2199 | QTC::TC( |
| 2200 | "qpdf", | 2200 | "qpdf", |
| 2201 | "QPDFObjectHandle indirect without context"); | 2201 | "QPDFObjectHandle indirect without context"); |
| @@ -2671,7 +2671,7 @@ QPDFObjectHandle::newStream( | @@ -2671,7 +2671,7 @@ QPDFObjectHandle::newStream( | ||
| 2671 | QPDFObjectHandle | 2671 | QPDFObjectHandle |
| 2672 | QPDFObjectHandle::newStream(QPDF* qpdf) | 2672 | QPDFObjectHandle::newStream(QPDF* qpdf) |
| 2673 | { | 2673 | { |
| 2674 | - if (qpdf == 0) { | 2674 | + if (qpdf == nullptr) { |
| 2675 | throw std::runtime_error( | 2675 | throw std::runtime_error( |
| 2676 | "attempt to create stream in null qpdf object"); | 2676 | "attempt to create stream in null qpdf object"); |
| 2677 | } | 2677 | } |
| @@ -2915,7 +2915,7 @@ QPDFObjectHandle::typeWarning( | @@ -2915,7 +2915,7 @@ QPDFObjectHandle::typeWarning( | ||
| 2915 | void | 2915 | void |
| 2916 | QPDFObjectHandle::warnIfPossible(std::string const& warning) | 2916 | QPDFObjectHandle::warnIfPossible(std::string const& warning) |
| 2917 | { | 2917 | { |
| 2918 | - QPDF* context = 0; | 2918 | + QPDF* context = nullptr; |
| 2919 | std::string description; | 2919 | std::string description; |
| 2920 | if (dereference() && obj->getDescription(context, description)) { | 2920 | if (dereference() && obj->getDescription(context, description)) { |
| 2921 | warn(context, QPDFExc(qpdf_e_damaged_pdf, "", description, 0, warning)); | 2921 | warn(context, QPDFExc(qpdf_e_damaged_pdf, "", description, 0, warning)); |
| @@ -3122,10 +3122,10 @@ QPDFObjectHandle::dereference() | @@ -3122,10 +3122,10 @@ QPDFObjectHandle::dereference() | ||
| 3122 | QPDF::Resolver::objectChanged(this->qpdf, getObjGen(), this->obj)) { | 3122 | QPDF::Resolver::objectChanged(this->qpdf, getObjGen(), this->obj)) { |
| 3123 | this->obj = nullptr; | 3123 | this->obj = nullptr; |
| 3124 | } | 3124 | } |
| 3125 | - if (this->obj.get() == 0) { | 3125 | + if (this->obj.get() == nullptr) { |
| 3126 | std::shared_ptr<QPDFObject> obj = | 3126 | std::shared_ptr<QPDFObject> obj = |
| 3127 | QPDF::Resolver::resolve(this->qpdf, getObjGen()); | 3127 | QPDF::Resolver::resolve(this->qpdf, getObjGen()); |
| 3128 | - if (obj.get() == 0) { | 3128 | + if (obj.get() == nullptr) { |
| 3129 | // QPDF::resolve never returns an uninitialized object, but | 3129 | // QPDF::resolve never returns an uninitialized object, but |
| 3130 | // check just in case. | 3130 | // check just in case. |
| 3131 | this->obj = QPDF_Null::create(); | 3131 | this->obj = QPDF_Null::create(); |
libqpdf/QPDFOutlineDocumentHelper.cc
| @@ -82,7 +82,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name) | @@ -82,7 +82,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name) | ||
| 82 | result = this->m->dest_dict.getKey(name.getName()); | 82 | result = this->m->dest_dict.getKey(name.getName()); |
| 83 | } | 83 | } |
| 84 | } else if (name.isString()) { | 84 | } else if (name.isString()) { |
| 85 | - if (0 == this->m->names_dest.get()) { | 85 | + if (nullptr == this->m->names_dest.get()) { |
| 86 | QPDFObjectHandle names = this->qpdf.getRoot().getKey("/Names"); | 86 | QPDFObjectHandle names = this->qpdf.getRoot().getKey("/Names"); |
| 87 | if (names.isDictionary()) { | 87 | if (names.isDictionary()) { |
| 88 | QPDFObjectHandle dests = names.getKey("/Dests"); | 88 | QPDFObjectHandle dests = names.getKey("/Dests"); |
libqpdf/QPDFPageLabelDocumentHelper.cc
| @@ -16,7 +16,7 @@ QPDFPageLabelDocumentHelper::QPDFPageLabelDocumentHelper(QPDF& qpdf) : | @@ -16,7 +16,7 @@ QPDFPageLabelDocumentHelper::QPDFPageLabelDocumentHelper(QPDF& qpdf) : | ||
| 16 | bool | 16 | bool |
| 17 | QPDFPageLabelDocumentHelper::hasPageLabels() | 17 | QPDFPageLabelDocumentHelper::hasPageLabels() |
| 18 | { | 18 | { |
| 19 | - return 0 != this->m->labels.get(); | 19 | + return nullptr != this->m->labels.get(); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | QPDFObjectHandle | 22 | QPDFObjectHandle |
libqpdf/QPDFTokenizer.cc
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | static bool | 17 | static bool |
| 18 | is_delimiter(char ch) | 18 | is_delimiter(char ch) |
| 19 | { | 19 | { |
| 20 | - return (strchr(" \t\n\v\f\r()<>[]{}/%", ch) != 0); | 20 | + return (strchr(" \t\n\v\f\r()<>[]{}/%", ch) != nullptr); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | namespace | 23 | namespace |
| @@ -158,7 +158,7 @@ QPDFTokenizer::resolveLiteral() | @@ -158,7 +158,7 @@ QPDFTokenizer::resolveLiteral() | ||
| 158 | num[0] = this->m->val.at(i + 1); | 158 | num[0] = this->m->val.at(i + 1); |
| 159 | num[1] = this->m->val.at(i + 2); | 159 | num[1] = this->m->val.at(i + 2); |
| 160 | num[2] = '\0'; | 160 | num[2] = '\0'; |
| 161 | - char ch2 = static_cast<char>(strtol(num, 0, 16)); | 161 | + char ch2 = static_cast<char>(strtol(num, nullptr, 16)); |
| 162 | if (ch2 == '\0') { | 162 | if (ch2 == '\0') { |
| 163 | this->m->type = tt_bad; | 163 | this->m->type = tt_bad; |
| 164 | QTC::TC("qpdf", "QPDFTokenizer null in name"); | 164 | QTC::TC("qpdf", "QPDFTokenizer null in name"); |
| @@ -323,7 +323,7 @@ QPDFTokenizer::presentCharacter(char ch) | @@ -323,7 +323,7 @@ QPDFTokenizer::presentCharacter(char ch) | ||
| 323 | // We've accumulated \ddd. PDF Spec says to ignore | 323 | // We've accumulated \ddd. PDF Spec says to ignore |
| 324 | // high-order overflow. | 324 | // high-order overflow. |
| 325 | this->m->val += | 325 | this->m->val += |
| 326 | - static_cast<char>(strtol(this->m->bs_num_register, 0, 8)); | 326 | + static_cast<char>(strtol(this->m->bs_num_register, nullptr, 8)); |
| 327 | memset( | 327 | memset( |
| 328 | this->m->bs_num_register, | 328 | this->m->bs_num_register, |
| 329 | '\0', | 329 | '\0', |
| @@ -447,7 +447,7 @@ QPDFTokenizer::presentCharacter(char ch) | @@ -447,7 +447,7 @@ QPDFTokenizer::presentCharacter(char ch) | ||
| 447 | for (unsigned int i = 0; i < this->m->val.length(); i += 2) { | 447 | for (unsigned int i = 0; i < this->m->val.length(); i += 2) { |
| 448 | num[0] = this->m->val.at(i); | 448 | num[0] = this->m->val.at(i); |
| 449 | num[1] = this->m->val.at(i + 1); | 449 | num[1] = this->m->val.at(i + 1); |
| 450 | - char nch = static_cast<char>(strtol(num, 0, 16)); | 450 | + char nch = static_cast<char>(strtol(num, nullptr, 16)); |
| 451 | nval += nch; | 451 | nval += nch; |
| 452 | } | 452 | } |
| 453 | this->m->val = nval; | 453 | this->m->val = nval; |
libqpdf/QPDFWriter.cc
| @@ -52,10 +52,10 @@ QPDFWriter::FunctionProgressReporter::reportProgress(int progress) | @@ -52,10 +52,10 @@ QPDFWriter::FunctionProgressReporter::reportProgress(int progress) | ||
| 52 | QPDFWriter::Members::Members(QPDF& pdf) : | 52 | QPDFWriter::Members::Members(QPDF& pdf) : |
| 53 | pdf(pdf), | 53 | pdf(pdf), |
| 54 | filename("unspecified"), | 54 | filename("unspecified"), |
| 55 | - file(0), | 55 | + file(nullptr), |
| 56 | close_file(false), | 56 | close_file(false), |
| 57 | - buffer_pipeline(0), | ||
| 58 | - output_buffer(0), | 57 | + buffer_pipeline(nullptr), |
| 58 | + output_buffer(nullptr), | ||
| 59 | normalize_content_set(false), | 59 | normalize_content_set(false), |
| 60 | normalize_content(false), | 60 | normalize_content(false), |
| 61 | compress_streams(true), | 61 | compress_streams(true), |
| @@ -82,7 +82,7 @@ QPDFWriter::Members::Members(QPDF& pdf) : | @@ -82,7 +82,7 @@ QPDFWriter::Members::Members(QPDF& pdf) : | ||
| 82 | min_extension_level(0), | 82 | min_extension_level(0), |
| 83 | forced_extension_level(0), | 83 | forced_extension_level(0), |
| 84 | encryption_dict_objid(0), | 84 | encryption_dict_objid(0), |
| 85 | - pipeline(0), | 85 | + pipeline(nullptr), |
| 86 | next_objid(1), | 86 | next_objid(1), |
| 87 | cur_stream_length_id(0), | 87 | cur_stream_length_id(0), |
| 88 | cur_stream_length(0), | 88 | cur_stream_length(0), |
| @@ -90,7 +90,7 @@ QPDFWriter::Members::Members(QPDF& pdf) : | @@ -90,7 +90,7 @@ QPDFWriter::Members::Members(QPDF& pdf) : | ||
| 90 | max_ostream_index(0), | 90 | max_ostream_index(0), |
| 91 | next_stack_id(0), | 91 | next_stack_id(0), |
| 92 | deterministic_id(false), | 92 | deterministic_id(false), |
| 93 | - md5_pipeline(0), | 93 | + md5_pipeline(nullptr), |
| 94 | did_write_setup(false), | 94 | did_write_setup(false), |
| 95 | events_expected(0), | 95 | events_expected(0), |
| 96 | events_seen(0), | 96 | events_seen(0), |
| @@ -128,9 +128,9 @@ void | @@ -128,9 +128,9 @@ void | ||
| 128 | QPDFWriter::setOutputFilename(char const* filename) | 128 | QPDFWriter::setOutputFilename(char const* filename) |
| 129 | { | 129 | { |
| 130 | char const* description = filename; | 130 | char const* description = filename; |
| 131 | - FILE* f = 0; | 131 | + FILE* f = nullptr; |
| 132 | bool close_file = false; | 132 | bool close_file = false; |
| 133 | - if (filename == 0) { | 133 | + if (filename == nullptr) { |
| 134 | description = "standard output"; | 134 | description = "standard output"; |
| 135 | QTC::TC("qpdf", "QPDFWriter write to stdout"); | 135 | QTC::TC("qpdf", "QPDFWriter write to stdout"); |
| 136 | f = stdout; | 136 | f = stdout; |
| @@ -169,7 +169,7 @@ Buffer* | @@ -169,7 +169,7 @@ Buffer* | ||
| 169 | QPDFWriter::getBuffer() | 169 | QPDFWriter::getBuffer() |
| 170 | { | 170 | { |
| 171 | Buffer* result = this->m->output_buffer; | 171 | Buffer* result = this->m->output_buffer; |
| 172 | - this->m->output_buffer = 0; | 172 | + this->m->output_buffer = nullptr; |
| 173 | return result; | 173 | return result; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| @@ -1021,7 +1021,7 @@ QPDFWriter::writePad(int nspaces) | @@ -1021,7 +1021,7 @@ QPDFWriter::writePad(int nspaces) | ||
| 1021 | Pipeline* | 1021 | Pipeline* |
| 1022 | QPDFWriter::pushPipeline(Pipeline* p) | 1022 | QPDFWriter::pushPipeline(Pipeline* p) |
| 1023 | { | 1023 | { |
| 1024 | - qpdf_assert_debug(dynamic_cast<Pl_Count*>(p) == 0); | 1024 | + qpdf_assert_debug(dynamic_cast<Pl_Count*>(p) == nullptr); |
| 1025 | this->m->pipeline_stack.push_back(p); | 1025 | this->m->pipeline_stack.push_back(p); |
| 1026 | return p; | 1026 | return p; |
| 1027 | } | 1027 | } |
| @@ -1066,10 +1066,10 @@ QPDFWriter::PipelinePopper::~PipelinePopper() | @@ -1066,10 +1066,10 @@ QPDFWriter::PipelinePopper::~PipelinePopper() | ||
| 1066 | qpdf_assert_debug(qw->m->pipeline->getIdentifier() == stack_id); | 1066 | qpdf_assert_debug(qw->m->pipeline->getIdentifier() == stack_id); |
| 1067 | delete qw->m->pipeline_stack.back(); | 1067 | delete qw->m->pipeline_stack.back(); |
| 1068 | qw->m->pipeline_stack.pop_back(); | 1068 | qw->m->pipeline_stack.pop_back(); |
| 1069 | - while (dynamic_cast<Pl_Count*>(qw->m->pipeline_stack.back()) == 0) { | 1069 | + while (dynamic_cast<Pl_Count*>(qw->m->pipeline_stack.back()) == nullptr) { |
| 1070 | Pipeline* p = qw->m->pipeline_stack.back(); | 1070 | Pipeline* p = qw->m->pipeline_stack.back(); |
| 1071 | if (dynamic_cast<Pl_MD5*>(p) == qw->m->md5_pipeline) { | 1071 | if (dynamic_cast<Pl_MD5*>(p) == qw->m->md5_pipeline) { |
| 1072 | - qw->m->md5_pipeline = 0; | 1072 | + qw->m->md5_pipeline = nullptr; |
| 1073 | } | 1073 | } |
| 1074 | qw->m->pipeline_stack.pop_back(); | 1074 | qw->m->pipeline_stack.pop_back(); |
| 1075 | Pl_Buffer* buf = dynamic_cast<Pl_Buffer*>(p); | 1075 | Pl_Buffer* buf = dynamic_cast<Pl_Buffer*>(p); |
| @@ -1097,7 +1097,7 @@ void | @@ -1097,7 +1097,7 @@ void | ||
| 1097 | QPDFWriter::pushEncryptionFilter(PipelinePopper& pp) | 1097 | QPDFWriter::pushEncryptionFilter(PipelinePopper& pp) |
| 1098 | { | 1098 | { |
| 1099 | if (this->m->encrypted && (!this->m->cur_data_key.empty())) { | 1099 | if (this->m->encrypted && (!this->m->cur_data_key.empty())) { |
| 1100 | - Pipeline* p = 0; | 1100 | + Pipeline* p = nullptr; |
| 1101 | if (this->m->encrypt_use_aes) { | 1101 | if (this->m->encrypt_use_aes) { |
| 1102 | p = new Pl_AES_PDF( | 1102 | p = new Pl_AES_PDF( |
| 1103 | "aes stream encryption", | 1103 | "aes stream encryption", |
| @@ -1135,7 +1135,7 @@ QPDFWriter::pushMD5Pipeline(PipelinePopper& pp) | @@ -1135,7 +1135,7 @@ QPDFWriter::pushMD5Pipeline(PipelinePopper& pp) | ||
| 1135 | " generation has already occurred."); | 1135 | " generation has already occurred."); |
| 1136 | } | 1136 | } |
| 1137 | qpdf_assert_debug(this->m->deterministic_id); | 1137 | qpdf_assert_debug(this->m->deterministic_id); |
| 1138 | - qpdf_assert_debug(this->m->md5_pipeline == 0); | 1138 | + qpdf_assert_debug(this->m->md5_pipeline == nullptr); |
| 1139 | qpdf_assert_debug(this->m->pipeline->getCount() == 0); | 1139 | qpdf_assert_debug(this->m->pipeline->getCount() == 0); |
| 1140 | this->m->md5_pipeline = new Pl_MD5("qpdf md5", this->m->pipeline); | 1140 | this->m->md5_pipeline = new Pl_MD5("qpdf md5", this->m->pipeline); |
| 1141 | this->m->md5_pipeline->persistAcrossFinish(true); | 1141 | this->m->md5_pipeline->persistAcrossFinish(true); |
| @@ -1148,7 +1148,7 @@ QPDFWriter::pushMD5Pipeline(PipelinePopper& pp) | @@ -1148,7 +1148,7 @@ QPDFWriter::pushMD5Pipeline(PipelinePopper& pp) | ||
| 1148 | void | 1148 | void |
| 1149 | QPDFWriter::computeDeterministicIDData() | 1149 | QPDFWriter::computeDeterministicIDData() |
| 1150 | { | 1150 | { |
| 1151 | - qpdf_assert_debug(this->m->md5_pipeline != 0); | 1151 | + qpdf_assert_debug(this->m->md5_pipeline != nullptr); |
| 1152 | qpdf_assert_debug(this->m->deterministic_id_data.empty()); | 1152 | qpdf_assert_debug(this->m->deterministic_id_data.empty()); |
| 1153 | this->m->deterministic_id_data = this->m->md5_pipeline->getHexDigest(); | 1153 | this->m->deterministic_id_data = this->m->md5_pipeline->getHexDigest(); |
| 1154 | this->m->md5_pipeline->enable(false); | 1154 | this->m->md5_pipeline->enable(false); |
| @@ -2455,10 +2455,10 @@ QPDFWriter::write() | @@ -2455,10 +2455,10 @@ QPDFWriter::write() | ||
| 2455 | if (this->m->close_file) { | 2455 | if (this->m->close_file) { |
| 2456 | fclose(this->m->file); | 2456 | fclose(this->m->file); |
| 2457 | } | 2457 | } |
| 2458 | - this->m->file = 0; | 2458 | + this->m->file = nullptr; |
| 2459 | if (this->m->buffer_pipeline) { | 2459 | if (this->m->buffer_pipeline) { |
| 2460 | this->m->output_buffer = this->m->buffer_pipeline->getBuffer(); | 2460 | this->m->output_buffer = this->m->buffer_pipeline->getBuffer(); |
| 2461 | - this->m->buffer_pipeline = 0; | 2461 | + this->m->buffer_pipeline = nullptr; |
| 2462 | } | 2462 | } |
| 2463 | indicateProgress(false, true); | 2463 | indicateProgress(false, true); |
| 2464 | } | 2464 | } |
| @@ -2967,7 +2967,7 @@ QPDFWriter::writeLinearized() | @@ -2967,7 +2967,7 @@ QPDFWriter::writeLinearized() | ||
| 2967 | 2967 | ||
| 2968 | // Write file in two passes. Part numbers refer to PDF spec 1.4. | 2968 | // Write file in two passes. Part numbers refer to PDF spec 1.4. |
| 2969 | 2969 | ||
| 2970 | - FILE* lin_pass1_file = 0; | 2970 | + FILE* lin_pass1_file = nullptr; |
| 2971 | auto pp_pass1 = std::make_shared<PipelinePopper>(this); | 2971 | auto pp_pass1 = std::make_shared<PipelinePopper>(this); |
| 2972 | auto pp_md5 = std::make_shared<PipelinePopper>(this); | 2972 | auto pp_md5 = std::make_shared<PipelinePopper>(this); |
| 2973 | for (int pass = 1; pass <= 2; ++pass) { | 2973 | for (int pass = 1; pass <= 2; ++pass) { |
| @@ -3203,13 +3203,13 @@ QPDFWriter::writeLinearized() | @@ -3203,13 +3203,13 @@ QPDFWriter::writeLinearized() | ||
| 3203 | "QPDFWriter linearized deterministic ID", | 3203 | "QPDFWriter linearized deterministic ID", |
| 3204 | need_xref_stream ? 0 : 1); | 3204 | need_xref_stream ? 0 : 1); |
| 3205 | computeDeterministicIDData(); | 3205 | computeDeterministicIDData(); |
| 3206 | - pp_md5 = 0; | ||
| 3207 | - qpdf_assert_debug(this->m->md5_pipeline == 0); | 3206 | + pp_md5 = nullptr; |
| 3207 | + qpdf_assert_debug(this->m->md5_pipeline == nullptr); | ||
| 3208 | } | 3208 | } |
| 3209 | 3209 | ||
| 3210 | // Close first pass pipeline | 3210 | // Close first pass pipeline |
| 3211 | file_size = this->m->pipeline->getCount(); | 3211 | file_size = this->m->pipeline->getCount(); |
| 3212 | - pp_pass1 = 0; | 3212 | + pp_pass1 = nullptr; |
| 3213 | 3213 | ||
| 3214 | // Save hint offset since it will be set to zero by | 3214 | // Save hint offset since it will be set to zero by |
| 3215 | // calling openObject. | 3215 | // calling openObject. |
| @@ -3245,7 +3245,7 @@ QPDFWriter::writeLinearized() | @@ -3245,7 +3245,7 @@ QPDFWriter::writeLinearized() | ||
| 3245 | "%% second_xref_end=%s\n", | 3245 | "%% second_xref_end=%s\n", |
| 3246 | QUtil::int_to_string(second_xref_end).c_str()); | 3246 | QUtil::int_to_string(second_xref_end).c_str()); |
| 3247 | fclose(lin_pass1_file); | 3247 | fclose(lin_pass1_file); |
| 3248 | - lin_pass1_file = 0; | 3248 | + lin_pass1_file = nullptr; |
| 3249 | } | 3249 | } |
| 3250 | } | 3250 | } |
| 3251 | } | 3251 | } |
| @@ -3401,7 +3401,7 @@ QPDFWriter::writeStandard() | @@ -3401,7 +3401,7 @@ QPDFWriter::writeStandard() | ||
| 3401 | "qpdf", | 3401 | "qpdf", |
| 3402 | "QPDFWriter standard deterministic ID", | 3402 | "QPDFWriter standard deterministic ID", |
| 3403 | this->m->object_stream_to_objects.empty() ? 0 : 1); | 3403 | this->m->object_stream_to_objects.empty() ? 0 : 1); |
| 3404 | - pp_md5 = 0; | ||
| 3405 | - qpdf_assert_debug(this->m->md5_pipeline == 0); | 3404 | + pp_md5 = nullptr; |
| 3405 | + qpdf_assert_debug(this->m->md5_pipeline == nullptr); | ||
| 3406 | } | 3406 | } |
| 3407 | } | 3407 | } |
libqpdf/QPDF_Dictionary.cc
| @@ -87,7 +87,7 @@ QPDF_Dictionary::getKey(std::string const& key) | @@ -87,7 +87,7 @@ QPDF_Dictionary::getKey(std::string const& key) | ||
| 87 | return item->second; | 87 | return item->second; |
| 88 | } else { | 88 | } else { |
| 89 | QPDFObjectHandle null = QPDFObjectHandle::newNull(); | 89 | QPDFObjectHandle null = QPDFObjectHandle::newNull(); |
| 90 | - QPDF* qpdf = 0; | 90 | + QPDF* qpdf = nullptr; |
| 91 | std::string description; | 91 | std::string description; |
| 92 | if (getDescription(qpdf, description)) { | 92 | if (getDescription(qpdf, description)) { |
| 93 | null.setObjectDescription( | 93 | null.setObjectDescription( |
libqpdf/QPDF_Stream.cc
| @@ -169,7 +169,7 @@ QPDF_Stream::getFilterOnWrite() const | @@ -169,7 +169,7 @@ QPDF_Stream::getFilterOnWrite() const | ||
| 169 | void | 169 | void |
| 170 | QPDF_Stream::releaseResolved() | 170 | QPDF_Stream::releaseResolved() |
| 171 | { | 171 | { |
| 172 | - this->stream_provider = 0; | 172 | + this->stream_provider = nullptr; |
| 173 | QPDFObjectHandle::ReleaseResolver::releaseResolved(this->stream_dict); | 173 | QPDFObjectHandle::ReleaseResolver::releaseResolved(this->stream_dict); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| @@ -313,7 +313,7 @@ QPDF_Stream::setDescription(QPDF* qpdf, std::string const& description) | @@ -313,7 +313,7 @@ QPDF_Stream::setDescription(QPDF* qpdf, std::string const& description) | ||
| 313 | void | 313 | void |
| 314 | QPDF_Stream::setDictDescription() | 314 | QPDF_Stream::setDictDescription() |
| 315 | { | 315 | { |
| 316 | - QPDF* qpdf = 0; | 316 | + QPDF* qpdf = nullptr; |
| 317 | std::string description; | 317 | std::string description; |
| 318 | if ((!this->stream_dict.hasObjectDescription()) && | 318 | if ((!this->stream_dict.hasObjectDescription()) && |
| 319 | getDescription(qpdf, description)) { | 319 | getDescription(qpdf, description)) { |
| @@ -547,7 +547,7 @@ QPDF_Stream::pipeStreamData( | @@ -547,7 +547,7 @@ QPDF_Stream::pipeStreamData( | ||
| 547 | : 3); | 547 | : 3); |
| 548 | } | 548 | } |
| 549 | 549 | ||
| 550 | - if (pipeline == 0) { | 550 | + if (pipeline == nullptr) { |
| 551 | QTC::TC("qpdf", "QPDF_Stream pipeStreamData with null pipeline"); | 551 | QTC::TC("qpdf", "QPDF_Stream pipeStreamData with null pipeline"); |
| 552 | // Return value is whether we can filter in this case. | 552 | // Return value is whether we can filter in this case. |
| 553 | return filter; | 553 | return filter; |
| @@ -693,7 +693,7 @@ QPDF_Stream::replaceStreamData( | @@ -693,7 +693,7 @@ QPDF_Stream::replaceStreamData( | ||
| 693 | QPDFObjectHandle const& decode_parms) | 693 | QPDFObjectHandle const& decode_parms) |
| 694 | { | 694 | { |
| 695 | this->stream_data = data; | 695 | this->stream_data = data; |
| 696 | - this->stream_provider = 0; | 696 | + this->stream_provider = nullptr; |
| 697 | replaceFilterData(filter, decode_parms, data->getSize()); | 697 | replaceFilterData(filter, decode_parms, data->getSize()); |
| 698 | } | 698 | } |
| 699 | 699 | ||
| @@ -704,7 +704,7 @@ QPDF_Stream::replaceStreamData( | @@ -704,7 +704,7 @@ QPDF_Stream::replaceStreamData( | ||
| 704 | QPDFObjectHandle const& decode_parms) | 704 | QPDFObjectHandle const& decode_parms) |
| 705 | { | 705 | { |
| 706 | this->stream_provider = provider; | 706 | this->stream_provider = provider; |
| 707 | - this->stream_data = 0; | 707 | + this->stream_data = nullptr; |
| 708 | replaceFilterData(filter, decode_parms, 0); | 708 | replaceFilterData(filter, decode_parms, 0); |
| 709 | } | 709 | } |
| 710 | 710 |
libqpdf/QPDF_encryption.cc
| @@ -149,8 +149,8 @@ QPDF::trim_user_password(std::string& user_password) | @@ -149,8 +149,8 @@ QPDF::trim_user_password(std::string& user_password) | ||
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | char const* p1 = cstr; | 151 | char const* p1 = cstr; |
| 152 | - char const* p2 = 0; | ||
| 153 | - while ((p2 = strchr(p1, '\x28')) != 0) { | 152 | + char const* p2 = nullptr; |
| 153 | + while ((p2 = strchr(p1, '\x28')) != nullptr) { | ||
| 154 | size_t idx = toS(p2 - cstr); | 154 | size_t idx = toS(p2 - cstr); |
| 155 | if (memcmp(p2, padding_string, len - idx) == 0) { | 155 | if (memcmp(p2, padding_string, len - idx) == 0) { |
| 156 | user_password = user_password.substr(0, idx); | 156 | user_password = user_password.substr(0, idx); |
| @@ -218,7 +218,7 @@ process_with_aes( | @@ -218,7 +218,7 @@ process_with_aes( | ||
| 218 | std::string const& data, | 218 | std::string const& data, |
| 219 | size_t outlength = 0, | 219 | size_t outlength = 0, |
| 220 | unsigned int repetitions = 1, | 220 | unsigned int repetitions = 1, |
| 221 | - unsigned char const* iv = 0, | 221 | + unsigned char const* iv = nullptr, |
| 222 | size_t iv_length = 0) | 222 | size_t iv_length = 0) |
| 223 | { | 223 | { |
| 224 | Pl_Buffer buffer("buffer"); | 224 | Pl_Buffer buffer("buffer"); |
libqpdf/QPDF_linearization.cc
| @@ -542,7 +542,7 @@ QPDF::checkLinearizationInternal() | @@ -542,7 +542,7 @@ QPDF::checkLinearizationInternal() | ||
| 542 | 542 | ||
| 543 | // T: offset of whitespace character preceding xref entry for object 0 | 543 | // T: offset of whitespace character preceding xref entry for object 0 |
| 544 | this->m->file->seek(p.xref_zero_offset, SEEK_SET); | 544 | this->m->file->seek(p.xref_zero_offset, SEEK_SET); |
| 545 | - while (1) { | 545 | + while (true) { |
| 546 | char ch; | 546 | char ch; |
| 547 | this->m->file->read(&ch, 1); | 547 | this->m->file->read(&ch, 1); |
| 548 | if (!((ch == ' ') || (ch == '\r') || (ch == '\n'))) { | 548 | if (!((ch == ' ') || (ch == '\r') || (ch == '\n'))) { |
libqpdf/QUtil.cc
| @@ -396,7 +396,7 @@ QUtil::string_to_ll(char const* str) | @@ -396,7 +396,7 @@ QUtil::string_to_ll(char const* str) | ||
| 396 | #ifdef _MSC_VER | 396 | #ifdef _MSC_VER |
| 397 | long long result = _strtoi64(str, 0, 10); | 397 | long long result = _strtoi64(str, 0, 10); |
| 398 | #else | 398 | #else |
| 399 | - long long result = strtoll(str, 0, 10); | 399 | + long long result = strtoll(str, nullptr, 10); |
| 400 | #endif | 400 | #endif |
| 401 | if (errno == ERANGE) { | 401 | if (errno == ERANGE) { |
| 402 | throw std::range_error( | 402 | throw std::range_error( |
| @@ -430,7 +430,7 @@ QUtil::string_to_ull(char const* str) | @@ -430,7 +430,7 @@ QUtil::string_to_ull(char const* str) | ||
| 430 | #ifdef _MSC_VER | 430 | #ifdef _MSC_VER |
| 431 | unsigned long long result = _strtoui64(str, 0, 10); | 431 | unsigned long long result = _strtoui64(str, 0, 10); |
| 432 | #else | 432 | #else |
| 433 | - unsigned long long result = strtoull(str, 0, 10); | 433 | + unsigned long long result = strtoull(str, nullptr, 10); |
| 434 | #endif | 434 | #endif |
| 435 | if (errno == ERANGE) { | 435 | if (errno == ERANGE) { |
| 436 | throw std::runtime_error( | 436 | throw std::runtime_error( |
| @@ -512,7 +512,7 @@ win_convert_filename(char const* filename) | @@ -512,7 +512,7 @@ win_convert_filename(char const* filename) | ||
| 512 | FILE* | 512 | FILE* |
| 513 | QUtil::safe_fopen(char const* filename, char const* mode) | 513 | QUtil::safe_fopen(char const* filename, char const* mode) |
| 514 | { | 514 | { |
| 515 | - FILE* f = 0; | 515 | + FILE* f = nullptr; |
| 516 | #ifdef _WIN32 | 516 | #ifdef _WIN32 |
| 517 | std::shared_ptr<wchar_t> wfilenamep = win_convert_filename(filename); | 517 | std::shared_ptr<wchar_t> wfilenamep = win_convert_filename(filename); |
| 518 | wchar_t* wfilename = wfilenamep.get(); | 518 | wchar_t* wfilename = wfilenamep.get(); |
| @@ -543,7 +543,7 @@ QUtil::safe_fopen(char const* filename, char const* mode) | @@ -543,7 +543,7 @@ QUtil::safe_fopen(char const* filename, char const* mode) | ||
| 543 | FILE* | 543 | FILE* |
| 544 | QUtil::fopen_wrapper(std::string const& description, FILE* f) | 544 | QUtil::fopen_wrapper(std::string const& description, FILE* f) |
| 545 | { | 545 | { |
| 546 | - if (f == 0) { | 546 | + if (f == nullptr) { |
| 547 | throw_system_error(description); | 547 | throw_system_error(description); |
| 548 | } | 548 | } |
| 549 | return f; | 549 | return f; |
| @@ -599,7 +599,7 @@ QUtil::tell(FILE* stream) | @@ -599,7 +599,7 @@ QUtil::tell(FILE* stream) | ||
| 599 | bool | 599 | bool |
| 600 | QUtil::same_file(char const* name1, char const* name2) | 600 | QUtil::same_file(char const* name1, char const* name2) |
| 601 | { | 601 | { |
| 602 | - if ((name1 == 0) || (strlen(name1) == 0) || (name2 == 0) || | 602 | + if ((name1 == nullptr) || (strlen(name1) == 0) || (name2 == nullptr) || |
| 603 | (strlen(name2) == 0)) { | 603 | (strlen(name2) == 0)) { |
| 604 | return false; | 604 | return false; |
| 605 | } | 605 | } |
| @@ -834,7 +834,7 @@ QUtil::setLineBuf(FILE* f) | @@ -834,7 +834,7 @@ QUtil::setLineBuf(FILE* f) | ||
| 834 | char* | 834 | char* |
| 835 | QUtil::getWhoami(char* argv0) | 835 | QUtil::getWhoami(char* argv0) |
| 836 | { | 836 | { |
| 837 | - char* whoami = 0; | 837 | + char* whoami = nullptr; |
| 838 | if (((whoami = strrchr(argv0, '/')) == NULL) && | 838 | if (((whoami = strrchr(argv0, '/')) == NULL) && |
| 839 | ((whoami = strrchr(argv0, '\\')) == NULL)) { | 839 | ((whoami = strrchr(argv0, '\\')) == NULL)) { |
| 840 | whoami = argv0; | 840 | whoami = argv0; |
| @@ -875,7 +875,7 @@ QUtil::get_env(std::string const& var, std::string* value) | @@ -875,7 +875,7 @@ QUtil::get_env(std::string const& var, std::string* value) | ||
| 875 | # endif | 875 | # endif |
| 876 | #else | 876 | #else |
| 877 | char* p = getenv(var.c_str()); | 877 | char* p = getenv(var.c_str()); |
| 878 | - if (p == 0) { | 878 | + if (p == nullptr) { |
| 879 | return false; | 879 | return false; |
| 880 | } | 880 | } |
| 881 | if (value) { | 881 | if (value) { |
| @@ -908,7 +908,7 @@ QUtil::get_current_time() | @@ -908,7 +908,7 @@ QUtil::get_current_time() | ||
| 908 | ULONGLONG now = uinow.QuadPart; | 908 | ULONGLONG now = uinow.QuadPart; |
| 909 | return static_cast<time_t>((now / 10000000ULL) - 11644473600ULL); | 909 | return static_cast<time_t>((now / 10000000ULL) - 11644473600ULL); |
| 910 | #else | 910 | #else |
| 911 | - return time(0); | 911 | + return time(nullptr); |
| 912 | #endif | 912 | #endif |
| 913 | } | 913 | } |
| 914 | 914 | ||
| @@ -931,7 +931,7 @@ QUtil::get_current_qpdf_time() | @@ -931,7 +931,7 @@ QUtil::get_current_qpdf_time() | ||
| 931 | static_cast<int>(tzinfo.Bias)); | 931 | static_cast<int>(tzinfo.Bias)); |
| 932 | #else | 932 | #else |
| 933 | struct tm ltime; | 933 | struct tm ltime; |
| 934 | - time_t now = time(0); | 934 | + time_t now = time(nullptr); |
| 935 | tzset(); | 935 | tzset(); |
| 936 | # ifdef HAVE_LOCALTIME_R | 936 | # ifdef HAVE_LOCALTIME_R |
| 937 | localtime_r(&now, <ime); | 937 | localtime_r(&now, <ime); |
| @@ -1155,7 +1155,7 @@ namespace | @@ -1155,7 +1155,7 @@ namespace | ||
| 1155 | 1155 | ||
| 1156 | RandomDataProviderProvider::RandomDataProviderProvider() : | 1156 | RandomDataProviderProvider::RandomDataProviderProvider() : |
| 1157 | default_provider(CryptoRandomDataProvider::getInstance()), | 1157 | default_provider(CryptoRandomDataProvider::getInstance()), |
| 1158 | - current_provider(0) | 1158 | + current_provider(nullptr) |
| 1159 | { | 1159 | { |
| 1160 | this->current_provider = default_provider; | 1160 | this->current_provider = default_provider; |
| 1161 | } | 1161 | } |
| @@ -1210,13 +1210,13 @@ QUtil::random() | @@ -1210,13 +1210,13 @@ QUtil::random() | ||
| 1210 | bool | 1210 | bool |
| 1211 | QUtil::is_hex_digit(char ch) | 1211 | QUtil::is_hex_digit(char ch) |
| 1212 | { | 1212 | { |
| 1213 | - return (ch && (strchr("0123456789abcdefABCDEF", ch) != 0)); | 1213 | + return (ch && (strchr("0123456789abcdefABCDEF", ch) != nullptr)); |
| 1214 | } | 1214 | } |
| 1215 | 1215 | ||
| 1216 | bool | 1216 | bool |
| 1217 | QUtil::is_space(char ch) | 1217 | QUtil::is_space(char ch) |
| 1218 | { | 1218 | { |
| 1219 | - return (ch && (strchr(" \f\n\r\t\v", ch) != 0)); | 1219 | + return (ch && (strchr(" \f\n\r\t\v", ch) != nullptr)); |
| 1220 | } | 1220 | } |
| 1221 | 1221 | ||
| 1222 | bool | 1222 | bool |
| @@ -1332,10 +1332,10 @@ QUtil::read_lines_from_file( | @@ -1332,10 +1332,10 @@ QUtil::read_lines_from_file( | ||
| 1332 | std::list<std::string>& lines, | 1332 | std::list<std::string>& lines, |
| 1333 | bool preserve_eol) | 1333 | bool preserve_eol) |
| 1334 | { | 1334 | { |
| 1335 | - std::string* buf = 0; | 1335 | + std::string* buf = nullptr; |
| 1336 | char c; | 1336 | char c; |
| 1337 | while (next_char(c)) { | 1337 | while (next_char(c)) { |
| 1338 | - if (buf == 0) { | 1338 | + if (buf == nullptr) { |
| 1339 | lines.push_back(""); | 1339 | lines.push_back(""); |
| 1340 | buf = &(lines.back()); | 1340 | buf = &(lines.back()); |
| 1341 | buf->reserve(80); | 1341 | buf->reserve(80); |
| @@ -1354,7 +1354,7 @@ QUtil::read_lines_from_file( | @@ -1354,7 +1354,7 @@ QUtil::read_lines_from_file( | ||
| 1354 | buf->erase(buf->length() - 1); | 1354 | buf->erase(buf->length() - 1); |
| 1355 | } | 1355 | } |
| 1356 | } | 1356 | } |
| 1357 | - buf = 0; | 1357 | + buf = nullptr; |
| 1358 | } else { | 1358 | } else { |
| 1359 | buf->append(1, c); | 1359 | buf->append(1, c); |
| 1360 | } | 1360 | } |
| @@ -1471,7 +1471,7 @@ QUtil::parse_numrange(char const* range, int max) | @@ -1471,7 +1471,7 @@ QUtil::parse_numrange(char const* range, int max) | ||
| 1471 | } | 1471 | } |
| 1472 | } | 1472 | } |
| 1473 | 1473 | ||
| 1474 | - p = 0; | 1474 | + p = nullptr; |
| 1475 | for (size_t i = 0; i < work.size(); i += 2) { | 1475 | for (size_t i = 0; i < work.size(); i += 2) { |
| 1476 | int num = work.at(i); | 1476 | int num = work.at(i); |
| 1477 | // max == 0 means we don't know the max and are just | 1477 | // max == 0 means we don't know the max and are just |
| @@ -1990,7 +1990,7 @@ call_main_from_wmain( | @@ -1990,7 +1990,7 @@ call_main_from_wmain( | ||
| 1990 | new_argv[i] = utf8_argv.at(i).get(); | 1990 | new_argv[i] = utf8_argv.at(i).get(); |
| 1991 | } | 1991 | } |
| 1992 | argc = QIntC::to_int(utf8_argv.size()); | 1992 | argc = QIntC::to_int(utf8_argv.size()); |
| 1993 | - new_argv[argc] = 0; | 1993 | + new_argv[argc] = nullptr; |
| 1994 | return realmain(argc, new_argv); | 1994 | return realmain(argc, new_argv); |
| 1995 | } | 1995 | } |
| 1996 | 1996 |
libqpdf/qpdf-c.cc
| @@ -164,7 +164,7 @@ qpdf_cleanup(qpdf_data* qpdf) | @@ -164,7 +164,7 @@ qpdf_cleanup(qpdf_data* qpdf) | ||
| 164 | << (*qpdf)->error->what() << "\n"; | 164 | << (*qpdf)->error->what() << "\n"; |
| 165 | } | 165 | } |
| 166 | delete *qpdf; | 166 | delete *qpdf; |
| 167 | - *qpdf = 0; | 167 | + *qpdf = nullptr; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | size_t | 170 | size_t |
| @@ -203,11 +203,11 @@ qpdf_get_error(qpdf_data qpdf) | @@ -203,11 +203,11 @@ qpdf_get_error(qpdf_data qpdf) | ||
| 203 | { | 203 | { |
| 204 | if (qpdf->error.get()) { | 204 | if (qpdf->error.get()) { |
| 205 | qpdf->tmp_error.exc = qpdf->error; | 205 | qpdf->tmp_error.exc = qpdf->error; |
| 206 | - qpdf->error = 0; | 206 | + qpdf->error = nullptr; |
| 207 | QTC::TC("qpdf", "qpdf-c qpdf_get_error returned error"); | 207 | QTC::TC("qpdf", "qpdf-c qpdf_get_error returned error"); |
| 208 | return &qpdf->tmp_error; | 208 | return &qpdf->tmp_error; |
| 209 | } else { | 209 | } else { |
| 210 | - return 0; | 210 | + return nullptr; |
| 211 | } | 211 | } |
| 212 | } | 212 | } |
| 213 | 213 | ||
| @@ -220,14 +220,14 @@ qpdf_next_warning(qpdf_data qpdf) | @@ -220,14 +220,14 @@ qpdf_next_warning(qpdf_data qpdf) | ||
| 220 | QTC::TC("qpdf", "qpdf-c qpdf_next_warning returned warning"); | 220 | QTC::TC("qpdf", "qpdf-c qpdf_next_warning returned warning"); |
| 221 | return &qpdf->tmp_error; | 221 | return &qpdf->tmp_error; |
| 222 | } else { | 222 | } else { |
| 223 | - return 0; | 223 | + return nullptr; |
| 224 | } | 224 | } |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | char const* | 227 | char const* |
| 228 | qpdf_get_error_full_text(qpdf_data qpdf, qpdf_error e) | 228 | qpdf_get_error_full_text(qpdf_data qpdf, qpdf_error e) |
| 229 | { | 229 | { |
| 230 | - if (e == 0) { | 230 | + if (e == nullptr) { |
| 231 | return ""; | 231 | return ""; |
| 232 | } | 232 | } |
| 233 | return e->exc->what(); | 233 | return e->exc->what(); |
| @@ -236,7 +236,7 @@ qpdf_get_error_full_text(qpdf_data qpdf, qpdf_error e) | @@ -236,7 +236,7 @@ qpdf_get_error_full_text(qpdf_data qpdf, qpdf_error e) | ||
| 236 | enum qpdf_error_code_e | 236 | enum qpdf_error_code_e |
| 237 | qpdf_get_error_code(qpdf_data qpdf, qpdf_error e) | 237 | qpdf_get_error_code(qpdf_data qpdf, qpdf_error e) |
| 238 | { | 238 | { |
| 239 | - if (e == 0) { | 239 | + if (e == nullptr) { |
| 240 | return qpdf_e_success; | 240 | return qpdf_e_success; |
| 241 | } | 241 | } |
| 242 | return e->exc->getErrorCode(); | 242 | return e->exc->getErrorCode(); |
| @@ -245,7 +245,7 @@ qpdf_get_error_code(qpdf_data qpdf, qpdf_error e) | @@ -245,7 +245,7 @@ qpdf_get_error_code(qpdf_data qpdf, qpdf_error e) | ||
| 245 | char const* | 245 | char const* |
| 246 | qpdf_get_error_filename(qpdf_data qpdf, qpdf_error e) | 246 | qpdf_get_error_filename(qpdf_data qpdf, qpdf_error e) |
| 247 | { | 247 | { |
| 248 | - if (e == 0) { | 248 | + if (e == nullptr) { |
| 249 | return ""; | 249 | return ""; |
| 250 | } | 250 | } |
| 251 | return e->exc->getFilename().c_str(); | 251 | return e->exc->getFilename().c_str(); |
| @@ -254,7 +254,7 @@ qpdf_get_error_filename(qpdf_data qpdf, qpdf_error e) | @@ -254,7 +254,7 @@ qpdf_get_error_filename(qpdf_data qpdf, qpdf_error e) | ||
| 254 | unsigned long long | 254 | unsigned long long |
| 255 | qpdf_get_error_file_position(qpdf_data qpdf, qpdf_error e) | 255 | qpdf_get_error_file_position(qpdf_data qpdf, qpdf_error e) |
| 256 | { | 256 | { |
| 257 | - if (e == 0) { | 257 | + if (e == nullptr) { |
| 258 | return 0; | 258 | return 0; |
| 259 | } | 259 | } |
| 260 | return QIntC::to_ulonglong(e->exc->getFilePosition()); | 260 | return QIntC::to_ulonglong(e->exc->getFilePosition()); |
| @@ -263,7 +263,7 @@ qpdf_get_error_file_position(qpdf_data qpdf, qpdf_error e) | @@ -263,7 +263,7 @@ qpdf_get_error_file_position(qpdf_data qpdf, qpdf_error e) | ||
| 263 | char const* | 263 | char const* |
| 264 | qpdf_get_error_message_detail(qpdf_data qpdf, qpdf_error e) | 264 | qpdf_get_error_message_detail(qpdf_data qpdf, qpdf_error e) |
| 265 | { | 265 | { |
| 266 | - if (e == 0) { | 266 | + if (e == nullptr) { |
| 267 | return ""; | 267 | return ""; |
| 268 | } | 268 | } |
| 269 | return e->exc->getMessageDetail().c_str(); | 269 | return e->exc->getMessageDetail().c_str(); |
| @@ -371,7 +371,7 @@ qpdf_get_user_password(qpdf_data qpdf) | @@ -371,7 +371,7 @@ qpdf_get_user_password(qpdf_data qpdf) | ||
| 371 | char const* | 371 | char const* |
| 372 | qpdf_get_info_key(qpdf_data qpdf, char const* key) | 372 | qpdf_get_info_key(qpdf_data qpdf, char const* key) |
| 373 | { | 373 | { |
| 374 | - char const* result = 0; | 374 | + char const* result = nullptr; |
| 375 | QPDFObjectHandle trailer = qpdf->qpdf->getTrailer(); | 375 | QPDFObjectHandle trailer = qpdf->qpdf->getTrailer(); |
| 376 | if (trailer.hasKey("/Info")) { | 376 | if (trailer.hasKey("/Info")) { |
| 377 | QPDFObjectHandle info = trailer.getKey("/Info"); | 377 | QPDFObjectHandle info = trailer.getKey("/Info"); |
| @@ -383,14 +383,14 @@ qpdf_get_info_key(qpdf_data qpdf, char const* key) | @@ -383,14 +383,14 @@ qpdf_get_info_key(qpdf_data qpdf, char const* key) | ||
| 383 | } | 383 | } |
| 384 | } | 384 | } |
| 385 | } | 385 | } |
| 386 | - QTC::TC("qpdf", "qpdf-c get_info_key", (result == 0 ? 0 : 1)); | 386 | + QTC::TC("qpdf", "qpdf-c get_info_key", (result == nullptr ? 0 : 1)); |
| 387 | return result; | 387 | return result; |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | void | 390 | void |
| 391 | qpdf_set_info_key(qpdf_data qpdf, char const* key, char const* value) | 391 | qpdf_set_info_key(qpdf_data qpdf, char const* key, char const* value) |
| 392 | { | 392 | { |
| 393 | - if ((key == 0) || (std::strlen(key) == 0) || (key[0] != '/')) { | 393 | + if ((key == nullptr) || (std::strlen(key) == 0) || (key[0] != '/')) { |
| 394 | return; | 394 | return; |
| 395 | } | 395 | } |
| 396 | QPDFObjectHandle value_object; | 396 | QPDFObjectHandle value_object; |
| @@ -498,11 +498,11 @@ qpdf_init_write_internal(qpdf_data qpdf) | @@ -498,11 +498,11 @@ qpdf_init_write_internal(qpdf_data qpdf) | ||
| 498 | { | 498 | { |
| 499 | if (qpdf->qpdf_writer.get()) { | 499 | if (qpdf->qpdf_writer.get()) { |
| 500 | QTC::TC("qpdf", "qpdf-c called qpdf_init_write multiple times"); | 500 | QTC::TC("qpdf", "qpdf-c called qpdf_init_write multiple times"); |
| 501 | - qpdf->qpdf_writer = 0; | 501 | + qpdf->qpdf_writer = nullptr; |
| 502 | if (qpdf->output_buffer.get()) { | 502 | if (qpdf->output_buffer.get()) { |
| 503 | - qpdf->output_buffer = 0; | 503 | + qpdf->output_buffer = nullptr; |
| 504 | qpdf->write_memory = false; | 504 | qpdf->write_memory = false; |
| 505 | - qpdf->filename = 0; | 505 | + qpdf->filename = nullptr; |
| 506 | } | 506 | } |
| 507 | } | 507 | } |
| 508 | } | 508 | } |
| @@ -530,7 +530,7 @@ qpdf_init_write_memory(qpdf_data qpdf) | @@ -530,7 +530,7 @@ qpdf_init_write_memory(qpdf_data qpdf) | ||
| 530 | static void | 530 | static void |
| 531 | qpdf_get_buffer_internal(qpdf_data qpdf) | 531 | qpdf_get_buffer_internal(qpdf_data qpdf) |
| 532 | { | 532 | { |
| 533 | - if (qpdf->write_memory && (qpdf->output_buffer == 0)) { | 533 | + if (qpdf->write_memory && (qpdf->output_buffer == nullptr)) { |
| 534 | qpdf->output_buffer = qpdf->qpdf_writer->getBufferSharedPointer(); | 534 | qpdf->output_buffer = qpdf->qpdf_writer->getBufferSharedPointer(); |
| 535 | } | 535 | } |
| 536 | } | 536 | } |
| @@ -549,7 +549,7 @@ qpdf_get_buffer_length(qpdf_data qpdf) | @@ -549,7 +549,7 @@ qpdf_get_buffer_length(qpdf_data qpdf) | ||
| 549 | unsigned char const* | 549 | unsigned char const* |
| 550 | qpdf_get_buffer(qpdf_data qpdf) | 550 | qpdf_get_buffer(qpdf_data qpdf) |
| 551 | { | 551 | { |
| 552 | - unsigned char const* result = 0; | 552 | + unsigned char const* result = nullptr; |
| 553 | qpdf_get_buffer_internal(qpdf); | 553 | qpdf_get_buffer_internal(qpdf); |
| 554 | if (qpdf->output_buffer.get()) { | 554 | if (qpdf->output_buffer.get()) { |
| 555 | result = qpdf->output_buffer->getBuffer(); | 555 | result = qpdf->output_buffer->getBuffer(); |