Commit 7c6901bce574fa35a610de1bec90512c6e84d05d
1 parent
a9c0b026
Code tidy: remove redundant calls to smart_ptrs get() method
Showing
11 changed files
with
15 additions
and
16 deletions
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 (nullptr == this->m->fis.get()) { | 26 | + if (nullptr == this->m->fis) { |
| 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); |
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 (nullptr == this->m->value.get()) { | 207 | + if (nullptr == this->m->value) { |
| 208 | *p << "null"; | 208 | *p << "null"; |
| 209 | } else { | 209 | } else { |
| 210 | this->m->value->write(p, depth); | 210 | this->m->value->write(p, depth); |
| @@ -1122,7 +1122,7 @@ JSONParser::handleToken() | @@ -1122,7 +1122,7 @@ JSONParser::handleToken() | ||
| 1122 | break; | 1122 | break; |
| 1123 | } | 1123 | } |
| 1124 | 1124 | ||
| 1125 | - if ((item.get() == nullptr) == (delimiter == ' == nullptr) == (delimiter == '\0')) {')) { | 1125 | + if ((item == nullptr) == (delimiter == ' == nullptr) == (delimiter == '\0')) {')) { |
| 1126 | throw std::logic_error( | 1126 | throw std::logic_error( |
| 1127 | "JSONParser::handleToken: logic error: exactly one of item" | 1127 | "JSONParser::handleToken: logic error: exactly one of item" |
| 1128 | " or delimiter must be set"); | 1128 | " or delimiter must be set"); |
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() == nullptr) { | 29 | + if (this->m->data == 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_Flate.cc
| @@ -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() == nullptr) { | 89 | + if (this->m->outbuf == 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"); |
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() == nullptr) { | 21 | + if (this->outbuf == 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"); |
libqpdf/QPDF.cc
| @@ -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() == nullptr)) { | 2460 | + (stream_buffer == 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/QPDFEmbeddedFileDocumentHelper.cc
| @@ -50,7 +50,7 @@ QPDFEmbeddedFileDocumentHelper::QPDFEmbeddedFileDocumentHelper(QPDF& qpdf) : | @@ -50,7 +50,7 @@ QPDFEmbeddedFileDocumentHelper::QPDFEmbeddedFileDocumentHelper(QPDF& qpdf) : | ||
| 50 | bool | 50 | bool |
| 51 | QPDFEmbeddedFileDocumentHelper::hasEmbeddedFiles() const | 51 | QPDFEmbeddedFileDocumentHelper::hasEmbeddedFiles() const |
| 52 | { | 52 | { |
| 53 | - return (this->m->embedded_files.get() != nullptr); | 53 | + return (this->m->embedded_files != nullptr); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | void | 56 | void |
libqpdf/QPDFJob.cc
| @@ -223,7 +223,7 @@ ImageOptimizer::evaluate(std::string const& description) | @@ -223,7 +223,7 @@ ImageOptimizer::evaluate(std::string const& description) | ||
| 223 | Pl_Discard d; | 223 | Pl_Discard d; |
| 224 | Pl_Count c("count", &d); | 224 | Pl_Count c("count", &d); |
| 225 | std::shared_ptr<Pipeline> p = makePipeline(description, &c); | 225 | std::shared_ptr<Pipeline> p = makePipeline(description, &c); |
| 226 | - if (p.get() == nullptr) { | 226 | + if (p == nullptr) { |
| 227 | // message issued by makePipeline | 227 | // message issued by makePipeline |
| 228 | return false; | 228 | return false; |
| 229 | } | 229 | } |
| @@ -252,7 +252,7 @@ void | @@ -252,7 +252,7 @@ void | ||
| 252 | ImageOptimizer::provideStreamData(QPDFObjGen const&, Pipeline* pipeline) | 252 | ImageOptimizer::provideStreamData(QPDFObjGen const&, Pipeline* pipeline) |
| 253 | { | 253 | { |
| 254 | std::shared_ptr<Pipeline> p = makePipeline("", pipeline); | 254 | std::shared_ptr<Pipeline> p = makePipeline("", pipeline); |
| 255 | - if (p.get() == nullptr) { | 255 | + if (p == nullptr) { |
| 256 | // Should not be possible | 256 | // Should not be possible |
| 257 | image.warnIfPossible("unable to create pipeline after previous" | 257 | image.warnIfPossible("unable to create pipeline after previous" |
| 258 | " success; image data will be lost"); | 258 | " success; image data will be lost"); |
| @@ -2243,8 +2243,7 @@ QPDFJob::handleUnderOverlay(QPDF& pdf) | @@ -2243,8 +2243,7 @@ QPDFJob::handleUnderOverlay(QPDF& pdf) | ||
| 2243 | { | 2243 | { |
| 2244 | validateUnderOverlay(pdf, &m->underlay); | 2244 | validateUnderOverlay(pdf, &m->underlay); |
| 2245 | validateUnderOverlay(pdf, &m->overlay); | 2245 | validateUnderOverlay(pdf, &m->overlay); |
| 2246 | - if ((nullptr == m->underlay.pdf.get()) && | ||
| 2247 | - (nullptr == m->overlay.pdf.get())) { | 2246 | + if ((nullptr == m->underlay.pdf) && (nullptr == m->overlay.pdf)) { |
| 2248 | return; | 2247 | return; |
| 2249 | } | 2248 | } |
| 2250 | std::map<int, std::vector<int>> underlay_pagenos; | 2249 | std::map<int, std::vector<int>> underlay_pagenos; |
libqpdf/QPDFObjectHandle.cc
| @@ -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() == nullptr) { | 3125 | + if (this->obj == 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() == nullptr) { | 3128 | + if (obj == 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 (nullptr == this->m->names_dest.get()) { | 85 | + if (nullptr == this->m->names_dest) { |
| 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 nullptr != this->m->labels.get(); | 19 | + return nullptr != this->m->labels; |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | QPDFObjectHandle | 22 | QPDFObjectHandle |