From c62e8e2b285b9b401d6add5a7a0da98c7ea86373 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sun, 6 Feb 2022 11:40:24 -0500 Subject: Update for clean compile with POINTERHOLDER_TRANSITION=2 --- libqpdf/QPDF.cc | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'libqpdf/QPDF.cc') diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index 565c73f6..64d98233 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -269,7 +269,7 @@ QPDF::processFile(char const* filename, char const* password) { FileInputSource* fi = new FileInputSource(); fi->setFilename(filename); - processInputSource(fi, password); + processInputSource(PointerHolder(fi), password); } void @@ -278,7 +278,7 @@ QPDF::processFile(char const* description, FILE* filep, { FileInputSource* fi = new FileInputSource(); fi->setFile(description, filep, close_file); - processInputSource(fi, password); + processInputSource(PointerHolder(fi), password); } void @@ -287,10 +287,11 @@ QPDF::processMemoryFile(char const* description, char const* password) { processInputSource( - new BufferInputSource( - description, - new Buffer(QUtil::unsigned_char_pointer(buf), length), - true), + PointerHolder( + new BufferInputSource( + description, + new Buffer(QUtil::unsigned_char_pointer(buf), length), + true)), password); } @@ -305,7 +306,7 @@ QPDF::processInputSource(PointerHolder source, void QPDF::closeInputSource() { - this->m->file = new InvalidInputSource(); + this->m->file = PointerHolder(new InvalidInputSource()); } void @@ -425,7 +426,8 @@ QPDF::findHeader() // offsets in the file are such that 0 points to the // beginning of the header. QTC::TC("qpdf", "QPDF global offset"); - this->m->file = new OffsetInputSource(this->m->file, global_offset); + this->m->file = PointerHolder( + new OffsetInputSource(this->m->file, global_offset)); } } return valid; @@ -1607,7 +1609,8 @@ QPDF::readObject(PointerHolder input, StringDecrypter* decrypter = 0; if (this->m->encp->encrypted && (! in_object_stream)) { - decrypter_ph = new StringDecrypter(this, objid, generation); + decrypter_ph = make_pointer_holder( + this, objid, generation); decrypter = decrypter_ph.get(); } QPDFObjectHandle object = QPDFObjectHandle::parse( @@ -2105,7 +2108,7 @@ QPDF::resolve(int objid, int generation) "loop detected resolving object " + QUtil::int_to_string(objid) + " " + QUtil::int_to_string(generation))); - return new QPDF_Null; + return PointerHolder(new QPDF_Null); } ResolveRecorder rr(this, og); @@ -2231,10 +2234,11 @@ QPDF::resolveObjectsInStream(int obj_stream_number) std::map offsets; PointerHolder bp = obj_stream.getStreamData(qpdf_dl_specialized); - PointerHolder input = new BufferInputSource( - this->m->file->getName() + - " object stream " + QUtil::int_to_string(obj_stream_number), - bp.get()); + auto input = PointerHolder( + new BufferInputSource( + this->m->file->getName() + + " object stream " + QUtil::int_to_string(obj_stream_number), + bp.get())); for (int i = 0; i < n; ++i) { @@ -2630,7 +2634,9 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign) { this->m->copied_stream_data_provider = new CopiedStreamDataProvider(*this); - this->m->copied_streams = this->m->copied_stream_data_provider; + this->m->copied_streams = + PointerHolder( + this->m->copied_stream_data_provider); } QPDFObjGen local_og(result.getObjGen()); // Copy information from the foreign stream so we can pipe its @@ -2686,8 +2692,8 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign) } else { - PointerHolder foreign_stream_data = - new ForeignStreamData( + auto foreign_stream_data = + make_pointer_holder( foreign_stream_qpdf->m->encp, foreign_stream_qpdf->m->file, foreign.getObjectID(), -- cgit v1.2.3-54-g00ecf