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 | 23 | void |
| 24 | 24 | ClosedFileInputSource::before() |
| 25 | 25 | { |
| 26 | - if (nullptr == this->m->fis.get()) { | |
| 26 | + if (nullptr == this->m->fis) { | |
| 27 | 27 | this->m->fis = |
| 28 | 28 | std::make_shared<FileInputSource>(this->m->filename.c_str()); |
| 29 | 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 | 204 | void |
| 205 | 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 | 208 | *p << "null"; |
| 209 | 209 | } else { |
| 210 | 210 | this->m->value->write(p, depth); |
| ... | ... | @@ -1122,7 +1122,7 @@ JSONParser::handleToken() |
| 1122 | 1122 | break; |
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | - if ((item.get() == nullptr) == (delimiter == ' == nullptr) == (delimiter == '\0')) {')) { | |
| 1125 | + if ((item == nullptr) == (delimiter == ' == nullptr) == (delimiter == '\0')) {')) { | |
| 1126 | 1126 | throw std::logic_error( |
| 1127 | 1127 | "JSONParser::handleToken: logic error: exactly one of item" |
| 1128 | 1128 | " or delimiter must be set"); | ... | ... |
libqpdf/Pl_Buffer.cc
| ... | ... | @@ -26,7 +26,7 @@ Pl_Buffer::~Pl_Buffer() |
| 26 | 26 | void |
| 27 | 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 | 30 | this->m->data = std::make_shared<Buffer>(len); |
| 31 | 31 | } |
| 32 | 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 | 86 | void |
| 87 | 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 | 90 | throw std::logic_error( |
| 91 | 91 | this->identifier + |
| 92 | 92 | ": Pl_Flate: write() called after finish() called"); | ... | ... |
libqpdf/Pl_RC4.cc
| ... | ... | @@ -18,7 +18,7 @@ Pl_RC4::Pl_RC4( |
| 18 | 18 | void |
| 19 | 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 | 22 | throw std::logic_error( |
| 23 | 23 | this->identifier + |
| 24 | 24 | ": Pl_RC4: write() called after finish() called"); | ... | ... |
libqpdf/QPDF.cc
| ... | ... | @@ -2457,7 +2457,7 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign) |
| 2457 | 2457 | } |
| 2458 | 2458 | std::shared_ptr<Buffer> stream_buffer = stream->getStreamDataBuffer(); |
| 2459 | 2459 | if ((foreign_stream_qpdf->m->immediate_copy_from) && |
| 2460 | - (stream_buffer.get() == nullptr)) { | |
| 2460 | + (stream_buffer == nullptr)) { | |
| 2461 | 2461 | // Pull the stream data into a buffer before attempting |
| 2462 | 2462 | // the copy operation. Do it on the source stream so that |
| 2463 | 2463 | // if the source stream is copied multiple times, we don't | ... | ... |
libqpdf/QPDFEmbeddedFileDocumentHelper.cc
| ... | ... | @@ -50,7 +50,7 @@ QPDFEmbeddedFileDocumentHelper::QPDFEmbeddedFileDocumentHelper(QPDF& qpdf) : |
| 50 | 50 | bool |
| 51 | 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 | 56 | void | ... | ... |
libqpdf/QPDFJob.cc
| ... | ... | @@ -223,7 +223,7 @@ ImageOptimizer::evaluate(std::string const& description) |
| 223 | 223 | Pl_Discard d; |
| 224 | 224 | Pl_Count c("count", &d); |
| 225 | 225 | std::shared_ptr<Pipeline> p = makePipeline(description, &c); |
| 226 | - if (p.get() == nullptr) { | |
| 226 | + if (p == nullptr) { | |
| 227 | 227 | // message issued by makePipeline |
| 228 | 228 | return false; |
| 229 | 229 | } |
| ... | ... | @@ -252,7 +252,7 @@ void |
| 252 | 252 | ImageOptimizer::provideStreamData(QPDFObjGen const&, Pipeline* pipeline) |
| 253 | 253 | { |
| 254 | 254 | std::shared_ptr<Pipeline> p = makePipeline("", pipeline); |
| 255 | - if (p.get() == nullptr) { | |
| 255 | + if (p == nullptr) { | |
| 256 | 256 | // Should not be possible |
| 257 | 257 | image.warnIfPossible("unable to create pipeline after previous" |
| 258 | 258 | " success; image data will be lost"); |
| ... | ... | @@ -2243,8 +2243,7 @@ QPDFJob::handleUnderOverlay(QPDF& pdf) |
| 2243 | 2243 | { |
| 2244 | 2244 | validateUnderOverlay(pdf, &m->underlay); |
| 2245 | 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 | 2247 | return; |
| 2249 | 2248 | } |
| 2250 | 2249 | std::map<int, std::vector<int>> underlay_pagenos; | ... | ... |
libqpdf/QPDFObjectHandle.cc
| ... | ... | @@ -3122,10 +3122,10 @@ QPDFObjectHandle::dereference() |
| 3122 | 3122 | QPDF::Resolver::objectChanged(this->qpdf, getObjGen(), this->obj)) { |
| 3123 | 3123 | this->obj = nullptr; |
| 3124 | 3124 | } |
| 3125 | - if (this->obj.get() == nullptr) { | |
| 3125 | + if (this->obj == nullptr) { | |
| 3126 | 3126 | std::shared_ptr<QPDFObject> obj = |
| 3127 | 3127 | QPDF::Resolver::resolve(this->qpdf, getObjGen()); |
| 3128 | - if (obj.get() == nullptr) { | |
| 3128 | + if (obj == nullptr) { | |
| 3129 | 3129 | // QPDF::resolve never returns an uninitialized object, but |
| 3130 | 3130 | // check just in case. |
| 3131 | 3131 | this->obj = QPDF_Null::create(); | ... | ... |
libqpdf/QPDFOutlineDocumentHelper.cc
| ... | ... | @@ -82,7 +82,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name) |
| 82 | 82 | result = this->m->dest_dict.getKey(name.getName()); |
| 83 | 83 | } |
| 84 | 84 | } else if (name.isString()) { |
| 85 | - if (nullptr == this->m->names_dest.get()) { | |
| 85 | + if (nullptr == this->m->names_dest) { | |
| 86 | 86 | QPDFObjectHandle names = this->qpdf.getRoot().getKey("/Names"); |
| 87 | 87 | if (names.isDictionary()) { |
| 88 | 88 | QPDFObjectHandle dests = names.getKey("/Dests"); | ... | ... |
libqpdf/QPDFPageLabelDocumentHelper.cc
| ... | ... | @@ -16,7 +16,7 @@ QPDFPageLabelDocumentHelper::QPDFPageLabelDocumentHelper(QPDF& qpdf) : |
| 16 | 16 | bool |
| 17 | 17 | QPDFPageLabelDocumentHelper::hasPageLabels() |
| 18 | 18 | { |
| 19 | - return nullptr != this->m->labels.get(); | |
| 19 | + return nullptr != this->m->labels; | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | QPDFObjectHandle | ... | ... |