mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-31 10:58:25 +00:00
PointerHolder: deprecate getPointer() and getRefcount()
Use get() and use_count() instead. Add #define NO_POINTERHOLDER_DEPRECATION to remove deprecation markers for these only. This commit also removes all deprecated PointerHolder API calls from qpdf's code except in PointerHolder's test suite, which must continue to test the deprecated APIs.
This commit is contained in:
parent
f727bc9443
commit
9044a24097
@ -1,5 +1,10 @@
|
||||
2022-02-04 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* PointerHolder: deprecate getPointer() and getRefcount(). If you
|
||||
don't want to disable deprecation warnings in general but are not
|
||||
ready to tackle this change yet, you can define
|
||||
NO_POINTERHOLDER_DEPRECATION to suppress those.
|
||||
|
||||
* PointerHolder: add a get() method and a use_count() method for
|
||||
compatibility with std::shared_ptr. In qpdf 11, qpdf's APIs will
|
||||
switch to using std::shared_ptr instead of PointerHolder, though
|
||||
|
@ -12,7 +12,7 @@ int main(int argc, char **argv)
|
||||
size_t size = 0;
|
||||
QUtil::read_file_into_memory(argv[i], file_buf, size);
|
||||
LLVMFuzzerTestOneInput(
|
||||
reinterpret_cast<unsigned char*>(file_buf.getPointer()), size);
|
||||
reinterpret_cast<unsigned char*>(file_buf.get()), size);
|
||||
std::cout << argv[i] << " successful" << std::endl;
|
||||
}
|
||||
return 0;
|
||||
|
@ -135,14 +135,23 @@ class PointerHolder
|
||||
|
||||
// NOTE: The pointer returned by getPointer turns into a pumpkin
|
||||
// when the last PointerHolder that contains it disappears.
|
||||
#ifndef NO_POINTERHOLDER_DEPRECATION
|
||||
[[deprecated("use PointerHolder<T>::get() instead of getPointer()")]]
|
||||
#endif
|
||||
T* getPointer()
|
||||
{
|
||||
return this->data->pointer;
|
||||
}
|
||||
#ifndef NO_POINTERHOLDER_DEPRECATION
|
||||
[[deprecated("use PointerHolder<T>::get() instead of getPointer()")]]
|
||||
#endif
|
||||
T const* getPointer() const
|
||||
{
|
||||
return this->data->pointer;
|
||||
}
|
||||
#ifndef NO_POINTERHOLDER_DEPRECATION
|
||||
[[deprecated("use use_count() instead of getRefcount()")]]
|
||||
#endif
|
||||
int getRefcount() const
|
||||
{
|
||||
return this->data->refcount;
|
||||
|
@ -24,7 +24,7 @@ ClosedFileInputSource::~ClosedFileInputSource()
|
||||
void
|
||||
ClosedFileInputSource::before()
|
||||
{
|
||||
if (0 == this->m->fis.getPointer())
|
||||
if (0 == this->m->fis.get())
|
||||
{
|
||||
this->m->fis = new FileInputSource();
|
||||
this->m->fis->setFilename(this->m->filename.c_str());
|
||||
@ -81,7 +81,7 @@ void
|
||||
ClosedFileInputSource::rewind()
|
||||
{
|
||||
this->m->offset = 0;
|
||||
if (this->m->fis.getPointer())
|
||||
if (this->m->fis.get())
|
||||
{
|
||||
this->m->fis->rewind();
|
||||
}
|
||||
@ -109,7 +109,7 @@ void
|
||||
ClosedFileInputSource::stayOpen(bool val)
|
||||
{
|
||||
this->m->stay_open = val;
|
||||
if ((! val) && this->m->fis.getPointer())
|
||||
if ((! val) && this->m->fis.get())
|
||||
{
|
||||
after();
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ std::string JSON::JSON_null::unparse(size_t) const
|
||||
std::string
|
||||
JSON::unparse() const
|
||||
{
|
||||
if (0 == this->m->value.getPointer())
|
||||
if (0 == this->m->value.get())
|
||||
{
|
||||
return "null";
|
||||
}
|
||||
@ -219,13 +219,13 @@ JSON
|
||||
JSON::addDictionaryMember(std::string const& key, JSON const& val)
|
||||
{
|
||||
JSON_dictionary* obj = dynamic_cast<JSON_dictionary*>(
|
||||
this->m->value.getPointer());
|
||||
this->m->value.get());
|
||||
if (0 == obj)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"JSON::addDictionaryMember called on non-dictionary");
|
||||
}
|
||||
if (val.m->value.getPointer())
|
||||
if (val.m->value.get())
|
||||
{
|
||||
obj->members[encode_string(key)] = val.m->value;
|
||||
}
|
||||
@ -246,12 +246,12 @@ JSON
|
||||
JSON::addArrayElement(JSON const& val)
|
||||
{
|
||||
JSON_array* arr = dynamic_cast<JSON_array*>(
|
||||
this->m->value.getPointer());
|
||||
this->m->value.get());
|
||||
if (0 == arr)
|
||||
{
|
||||
throw std::runtime_error("JSON::addArrayElement called on non-array");
|
||||
}
|
||||
if (val.m->value.getPointer())
|
||||
if (val.m->value.get())
|
||||
{
|
||||
arr->elements.push_back(val.m->value);
|
||||
}
|
||||
@ -302,20 +302,20 @@ bool
|
||||
JSON::isArray() const
|
||||
{
|
||||
return nullptr != dynamic_cast<JSON_array const*>(
|
||||
this->m->value.getPointer());
|
||||
this->m->value.get());
|
||||
}
|
||||
|
||||
bool
|
||||
JSON::isDictionary() const
|
||||
{
|
||||
return nullptr != dynamic_cast<JSON_dictionary const*>(
|
||||
this->m->value.getPointer());
|
||||
this->m->value.get());
|
||||
}
|
||||
|
||||
bool
|
||||
JSON::getString(std::string& utf8) const
|
||||
{
|
||||
auto v = dynamic_cast<JSON_string const*>(this->m->value.getPointer());
|
||||
auto v = dynamic_cast<JSON_string const*>(this->m->value.get());
|
||||
if (v == nullptr)
|
||||
{
|
||||
return false;
|
||||
@ -327,7 +327,7 @@ JSON::getString(std::string& utf8) const
|
||||
bool
|
||||
JSON::getNumber(std::string& value) const
|
||||
{
|
||||
auto v = dynamic_cast<JSON_number const*>(this->m->value.getPointer());
|
||||
auto v = dynamic_cast<JSON_number const*>(this->m->value.get());
|
||||
if (v == nullptr)
|
||||
{
|
||||
return false;
|
||||
@ -339,7 +339,7 @@ JSON::getNumber(std::string& value) const
|
||||
bool
|
||||
JSON::getBool(bool& value) const
|
||||
{
|
||||
auto v = dynamic_cast<JSON_bool const*>(this->m->value.getPointer());
|
||||
auto v = dynamic_cast<JSON_bool const*>(this->m->value.get());
|
||||
if (v == nullptr)
|
||||
{
|
||||
return false;
|
||||
@ -351,7 +351,7 @@ JSON::getBool(bool& value) const
|
||||
bool
|
||||
JSON::isNull() const
|
||||
{
|
||||
if (dynamic_cast<JSON_null const*>(this->m->value.getPointer()))
|
||||
if (dynamic_cast<JSON_null const*>(this->m->value.get()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -362,7 +362,7 @@ bool
|
||||
JSON::forEachDictItem(
|
||||
std::function<void(std::string const& key, JSON value)> fn) const
|
||||
{
|
||||
auto v = dynamic_cast<JSON_dictionary const*>(this->m->value.getPointer());
|
||||
auto v = dynamic_cast<JSON_dictionary const*>(this->m->value.get());
|
||||
if (v == nullptr)
|
||||
{
|
||||
return false;
|
||||
@ -377,7 +377,7 @@ JSON::forEachDictItem(
|
||||
bool
|
||||
JSON::forEachArrayItem(std::function<void(JSON value)> fn) const
|
||||
{
|
||||
auto v = dynamic_cast<JSON_array const*>(this->m->value.getPointer());
|
||||
auto v = dynamic_cast<JSON_array const*>(this->m->value.get());
|
||||
if (v == nullptr)
|
||||
{
|
||||
return false;
|
||||
@ -392,8 +392,8 @@ JSON::forEachArrayItem(std::function<void(JSON value)> fn) const
|
||||
bool
|
||||
JSON::checkSchema(JSON schema, std::list<std::string>& errors)
|
||||
{
|
||||
return checkSchemaInternal(this->m->value.getPointer(),
|
||||
schema.m->value.getPointer(),
|
||||
return checkSchemaInternal(this->m->value.get(),
|
||||
schema.m->value.get(),
|
||||
0, errors, "");
|
||||
}
|
||||
|
||||
@ -401,8 +401,8 @@ bool
|
||||
JSON::checkSchema(JSON schema, unsigned long flags,
|
||||
std::list<std::string>& errors)
|
||||
{
|
||||
return checkSchemaInternal(this->m->value.getPointer(),
|
||||
schema.m->value.getPointer(),
|
||||
return checkSchemaInternal(this->m->value.get(),
|
||||
schema.m->value.get(),
|
||||
flags, errors, "");
|
||||
}
|
||||
|
||||
@ -452,12 +452,12 @@ JSON::checkSchemaInternal(JSON_value* this_v, JSON_value* sch_v,
|
||||
|
||||
if (sch_dict && (! pattern_key.empty()))
|
||||
{
|
||||
auto pattern_schema = sch_dict->members[pattern_key].getPointer();
|
||||
auto pattern_schema = sch_dict->members[pattern_key].get();
|
||||
for (auto const& iter: this_dict->members)
|
||||
{
|
||||
std::string const& key = iter.first;
|
||||
checkSchemaInternal(
|
||||
this_dict->members[key].getPointer(), pattern_schema,
|
||||
this_dict->members[key].get(), pattern_schema,
|
||||
flags, errors, prefix + "." + key);
|
||||
}
|
||||
}
|
||||
@ -469,8 +469,8 @@ JSON::checkSchemaInternal(JSON_value* this_v, JSON_value* sch_v,
|
||||
if (this_dict->members.count(key))
|
||||
{
|
||||
checkSchemaInternal(
|
||||
this_dict->members[key].getPointer(),
|
||||
iter.second.getPointer(),
|
||||
this_dict->members[key].get(),
|
||||
iter.second.get(),
|
||||
flags, errors, prefix + "." + key);
|
||||
}
|
||||
else
|
||||
@ -523,8 +523,8 @@ JSON::checkSchemaInternal(JSON_value* this_v, JSON_value* sch_v,
|
||||
iter != this_arr->elements.end(); ++iter, ++i)
|
||||
{
|
||||
checkSchemaInternal(
|
||||
(*iter).getPointer(),
|
||||
sch_arr->elements.at(0).getPointer(),
|
||||
(*iter).get(),
|
||||
sch_arr->elements.at(0).get(),
|
||||
flags, errors, prefix + "." + QUtil::int_to_string(i));
|
||||
}
|
||||
}
|
||||
@ -1067,7 +1067,7 @@ JSONParser::handleToken()
|
||||
break;
|
||||
}
|
||||
|
||||
if ((item.getPointer() == nullptr) == (delimiter == '\0'))
|
||||
if ((item.get() == nullptr) == (delimiter == '\0'))
|
||||
{
|
||||
throw std::logic_error(
|
||||
"JSONParser::handleToken: logic error: exactly one of item"
|
||||
@ -1076,7 +1076,7 @@ JSONParser::handleToken()
|
||||
|
||||
// See whether what we have is allowed at this point.
|
||||
|
||||
if (item.getPointer())
|
||||
if (item.get())
|
||||
{
|
||||
switch (parser_state)
|
||||
{
|
||||
@ -1213,7 +1213,7 @@ JSONParser::handleToken()
|
||||
throw std::logic_error(
|
||||
"JSONParser::handleToken: unexpected delimiter in transition");
|
||||
}
|
||||
else if (item.getPointer())
|
||||
else if (item.get())
|
||||
{
|
||||
PointerHolder<JSON> tos;
|
||||
if (! stack.empty())
|
||||
@ -1259,7 +1259,7 @@ JSONParser::handleToken()
|
||||
}
|
||||
|
||||
// Prepare for next token
|
||||
if (item.getPointer())
|
||||
if (item.get())
|
||||
{
|
||||
if (item->isDictionary())
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ Pl_Buffer::~Pl_Buffer()
|
||||
void
|
||||
Pl_Buffer::write(unsigned char* buf, size_t len)
|
||||
{
|
||||
if (this->m->data.getPointer() == 0)
|
||||
if (this->m->data.get() == 0)
|
||||
{
|
||||
this->m->data = new Buffer(len);
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b)
|
||||
static int const BUF_SIZE = 65536;
|
||||
PointerHolder<unsigned char> outbuffer_ph(
|
||||
true, new unsigned char[BUF_SIZE]);
|
||||
unsigned char* outbuffer = outbuffer_ph.getPointer();
|
||||
unsigned char* outbuffer = outbuffer_ph.get();
|
||||
jpeg_pipeline_dest(cinfo, outbuffer, BUF_SIZE, this->getNext());
|
||||
|
||||
cinfo->image_width = this->m->image_width;
|
||||
|
@ -37,7 +37,7 @@ Pl_Flate::Members::Members(size_t out_bufsize,
|
||||
zstream.opaque = 0;
|
||||
zstream.next_in = 0;
|
||||
zstream.avail_in = 0;
|
||||
zstream.next_out = this->outbuf.getPointer();
|
||||
zstream.next_out = this->outbuf.get();
|
||||
zstream.avail_out = QIntC::to_uint(out_bufsize);
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ Pl_Flate::warn(char const* msg, int code)
|
||||
void
|
||||
Pl_Flate::write(unsigned char* data, size_t len)
|
||||
{
|
||||
if (this->m->outbuf.getPointer() == 0)
|
||||
if (this->m->outbuf.get() == 0)
|
||||
{
|
||||
throw std::logic_error(
|
||||
this->identifier +
|
||||
@ -208,8 +208,8 @@ Pl_Flate::handleData(unsigned char* data, size_t len, int flush)
|
||||
QIntC::to_ulong(this->m->out_bufsize - zstream.avail_out);
|
||||
if (ready > 0)
|
||||
{
|
||||
this->getNext()->write(this->m->outbuf.getPointer(), ready);
|
||||
zstream.next_out = this->m->outbuf.getPointer();
|
||||
this->getNext()->write(this->m->outbuf.get(), ready);
|
||||
zstream.next_out = this->m->outbuf.get();
|
||||
zstream.avail_out = QIntC::to_uint(this->m->out_bufsize);
|
||||
}
|
||||
}
|
||||
@ -227,7 +227,7 @@ Pl_Flate::finish()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this->m->outbuf.getPointer())
|
||||
if (this->m->outbuf.get())
|
||||
{
|
||||
if (this->m->initialized)
|
||||
{
|
||||
|
@ -49,10 +49,10 @@ Pl_PNGFilter::Pl_PNGFilter(char const* identifier, Pipeline* next,
|
||||
true, new unsigned char[this->bytes_per_row + 1]);
|
||||
this->buf2 = PointerHolder<unsigned char>(
|
||||
true, new unsigned char[this->bytes_per_row + 1]);
|
||||
memset(this->buf1.getPointer(), 0, this->bytes_per_row + 1);
|
||||
memset(this->buf2.getPointer(), 0, this->bytes_per_row + 1);
|
||||
this->cur_row = this->buf1.getPointer();
|
||||
this->prev_row = this->buf2.getPointer();
|
||||
memset(this->buf1.get(), 0, this->bytes_per_row + 1);
|
||||
memset(this->buf2.get(), 0, this->bytes_per_row + 1);
|
||||
this->cur_row = this->buf1.get();
|
||||
this->prev_row = this->buf2.get();
|
||||
|
||||
// number of bytes per incoming row
|
||||
this->incoming = (action == a_encode ?
|
||||
@ -81,7 +81,7 @@ Pl_PNGFilter::write(unsigned char* data, size_t len)
|
||||
// Swap rows
|
||||
unsigned char* t = this->prev_row;
|
||||
this->prev_row = this->cur_row;
|
||||
this->cur_row = t ? t : this->buf2.getPointer();
|
||||
this->cur_row = t ? t : this->buf2.get();
|
||||
memset(this->cur_row, 0, this->bytes_per_row + 1);
|
||||
left = this->incoming;
|
||||
this->pos = 0;
|
||||
@ -269,7 +269,7 @@ Pl_PNGFilter::finish()
|
||||
processRow();
|
||||
}
|
||||
this->prev_row = 0;
|
||||
this->cur_row = buf1.getPointer();
|
||||
this->cur_row = buf1.get();
|
||||
this->pos = 0;
|
||||
memset(this->cur_row, 0, this->bytes_per_row + 1);
|
||||
|
||||
|
@ -19,7 +19,7 @@ Pl_RC4::~Pl_RC4()
|
||||
void
|
||||
Pl_RC4::write(unsigned char* data, size_t len)
|
||||
{
|
||||
if (this->outbuf.getPointer() == 0)
|
||||
if (this->outbuf.get() == 0)
|
||||
{
|
||||
throw std::logic_error(
|
||||
this->identifier +
|
||||
@ -35,9 +35,9 @@ Pl_RC4::write(unsigned char* data, size_t len)
|
||||
(bytes_left < this->out_bufsize ? bytes_left : out_bufsize);
|
||||
bytes_left -= bytes;
|
||||
// lgtm[cpp/weak-cryptographic-algorithm]
|
||||
rc4.process(p, bytes, outbuf.getPointer());
|
||||
rc4.process(p, bytes, outbuf.get());
|
||||
p += bytes;
|
||||
getNext()->write(outbuf.getPointer(), bytes);
|
||||
getNext()->write(outbuf.get(), bytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ Pl_TIFFPredictor::Pl_TIFFPredictor(char const* identifier, Pipeline* next,
|
||||
this->bytes_per_row = bpr & UINT_MAX;
|
||||
this->cur_row = PointerHolder<unsigned char>(
|
||||
true, new unsigned char[this->bytes_per_row]);
|
||||
memset(this->cur_row.getPointer(), 0, this->bytes_per_row);
|
||||
memset(this->cur_row.get(), 0, this->bytes_per_row);
|
||||
}
|
||||
|
||||
Pl_TIFFPredictor::~Pl_TIFFPredictor()
|
||||
@ -54,20 +54,20 @@ Pl_TIFFPredictor::write(unsigned char* data, size_t len)
|
||||
while (len >= left)
|
||||
{
|
||||
// finish off current row
|
||||
memcpy(this->cur_row.getPointer() + this->pos, data + offset, left);
|
||||
memcpy(this->cur_row.get() + this->pos, data + offset, left);
|
||||
offset += left;
|
||||
len -= left;
|
||||
|
||||
processRow();
|
||||
|
||||
// Prepare for next row
|
||||
memset(this->cur_row.getPointer(), 0, this->bytes_per_row);
|
||||
memset(this->cur_row.get(), 0, this->bytes_per_row);
|
||||
left = this->bytes_per_row;
|
||||
this->pos = 0;
|
||||
}
|
||||
if (len)
|
||||
{
|
||||
memcpy(this->cur_row.getPointer() + this->pos, data + offset, len);
|
||||
memcpy(this->cur_row.get() + this->pos, data + offset, len);
|
||||
}
|
||||
this->pos += len;
|
||||
}
|
||||
@ -78,7 +78,7 @@ Pl_TIFFPredictor::processRow()
|
||||
QTC::TC("libtests", "Pl_TIFFPredictor processRow",
|
||||
(action == a_decode ? 0 : 1));
|
||||
BitWriter bw(this->getNext());
|
||||
BitStream in(this->cur_row.getPointer(), this->bytes_per_row);
|
||||
BitStream in(this->cur_row.get(), this->bytes_per_row);
|
||||
std::vector<long long> prev;
|
||||
for (unsigned int i = 0; i < this->samples_per_pixel; ++i)
|
||||
{
|
||||
@ -117,6 +117,6 @@ Pl_TIFFPredictor::finish()
|
||||
processRow();
|
||||
}
|
||||
this->pos = 0;
|
||||
memset(this->cur_row.getPointer(), 0, this->bytes_per_row);
|
||||
memset(this->cur_row.get(), 0, this->bytes_per_row);
|
||||
getNext()->finish();
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ QPDF::CopiedStreamDataProvider::provideStreamData(
|
||||
PointerHolder<ForeignStreamData> foreign_data =
|
||||
this->foreign_stream_data[QPDFObjGen(objid, generation)];
|
||||
bool result = false;
|
||||
if (foreign_data.getPointer())
|
||||
if (foreign_data.get())
|
||||
{
|
||||
result = destination_qpdf.pipeForeignStreamData(
|
||||
foreign_data, pipeline, suppress_warnings, will_retry);
|
||||
@ -256,7 +256,7 @@ QPDF::~QPDF()
|
||||
iter != this->m->obj_cache.end(); ++iter)
|
||||
{
|
||||
QPDFObject::ObjAccessor::releaseResolved(
|
||||
(*iter).second.object.getPointer());
|
||||
(*iter).second.object.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1507,7 +1507,7 @@ QPDF::fixDanglingReferences(bool force)
|
||||
{
|
||||
QPDF_Array* arr =
|
||||
dynamic_cast<QPDF_Array*>(
|
||||
QPDFObjectHandle::ObjAccessor::getObject(obj).getPointer());
|
||||
QPDFObjectHandle::ObjAccessor::getObject(obj).get());
|
||||
arr->addExplicitElementsToList(to_check);
|
||||
}
|
||||
for (std::list<QPDFObjectHandle>::iterator iter = to_check.begin();
|
||||
@ -1604,7 +1604,7 @@ QPDF::readObject(PointerHolder<InputSource> input,
|
||||
if (this->m->encp->encrypted && (! in_object_stream))
|
||||
{
|
||||
decrypter_ph = new StringDecrypter(this, objid, generation);
|
||||
decrypter = decrypter_ph.getPointer();
|
||||
decrypter = decrypter_ph.get();
|
||||
}
|
||||
QPDFObjectHandle object = QPDFObjectHandle::parse(
|
||||
input, this->m->last_object_description,
|
||||
@ -2080,7 +2080,7 @@ QPDF::objectChanged(QPDFObjGen const& og, PointerHolder<QPDFObject>& oph)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return (c->second.object.getPointer() != oph.getPointer());
|
||||
return (c->second.object.get() != oph.get());
|
||||
}
|
||||
|
||||
PointerHolder<QPDFObject>
|
||||
@ -2230,7 +2230,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
|
||||
PointerHolder<InputSource> input = new BufferInputSource(
|
||||
this->m->file->getName() +
|
||||
" object stream " + QUtil::int_to_string(obj_stream_number),
|
||||
bp.getPointer());
|
||||
bp.get());
|
||||
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
@ -2640,7 +2640,7 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign)
|
||||
QPDF_Stream* stream =
|
||||
dynamic_cast<QPDF_Stream*>(
|
||||
QPDFObjectHandle::ObjAccessor::getObject(
|
||||
foreign).getPointer());
|
||||
foreign).get());
|
||||
if (! stream)
|
||||
{
|
||||
throw std::logic_error("unable to retrieve underlying"
|
||||
@ -2649,7 +2649,7 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign)
|
||||
PointerHolder<Buffer> stream_buffer =
|
||||
stream->getStreamDataBuffer();
|
||||
if ((foreign_stream_qpdf->m->immediate_copy_from) &&
|
||||
(stream_buffer.getPointer() == 0))
|
||||
(stream_buffer.get() == 0))
|
||||
{
|
||||
// Pull the stream data into a buffer before attempting
|
||||
// the copy operation. Do it on the source stream so that
|
||||
@ -2663,14 +2663,14 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign)
|
||||
}
|
||||
PointerHolder<QPDFObjectHandle::StreamDataProvider> stream_provider =
|
||||
stream->getStreamDataProvider();
|
||||
if (stream_buffer.getPointer())
|
||||
if (stream_buffer.get())
|
||||
{
|
||||
QTC::TC("qpdf", "QPDF copy foreign stream with buffer");
|
||||
result.replaceStreamData(stream_buffer,
|
||||
dict.getKey("/Filter"),
|
||||
dict.getKey("/DecodeParms"));
|
||||
}
|
||||
else if (stream_provider.getPointer())
|
||||
else if (stream_provider.get())
|
||||
{
|
||||
// In this case, the remote stream's QPDF must stay in scope.
|
||||
QTC::TC("qpdf", "QPDF copy foreign stream with provider");
|
||||
|
@ -903,7 +903,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
|
||||
else if ((from_qpdf != &this->qpdf) && (! from_afdh))
|
||||
{
|
||||
afdhph = new QPDFAcroFormDocumentHelper(*from_qpdf);
|
||||
from_afdh = afdhph.getPointer();
|
||||
from_afdh = afdhph.get();
|
||||
}
|
||||
bool foreign = (from_qpdf != &this->qpdf);
|
||||
|
||||
|
@ -756,7 +756,7 @@ QPDFJob::Config::jobJsonFile(std::string const& parameter)
|
||||
QUtil::read_file_into_memory(parameter.c_str(), file_buf, size);
|
||||
try
|
||||
{
|
||||
o.initializeFromJson(std::string(file_buf.getPointer(), size), true);
|
||||
o.initializeFromJson(std::string(file_buf.get(), size), true);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
@ -241,14 +241,14 @@ QPDFObjectHandle::releaseResolved()
|
||||
// destruction. See comments in QPDF::~QPDF().
|
||||
if (isIndirect())
|
||||
{
|
||||
if (this->obj.getPointer())
|
||||
if (this->obj.get())
|
||||
{
|
||||
this->obj = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QPDFObject::ObjAccessor::releaseResolved(this->obj.getPointer());
|
||||
QPDFObject::ObjAccessor::releaseResolved(this->obj.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ QPDFObjectHandle::isBool()
|
||||
return false;
|
||||
}
|
||||
dereference();
|
||||
return QPDFObjectTypeAccessor<QPDF_Bool>::check(obj.getPointer());
|
||||
return QPDFObjectTypeAccessor<QPDF_Bool>::check(obj.get());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -329,7 +329,7 @@ QPDFObjectHandle::isDirectNull() const
|
||||
// Don't call dereference() -- this is a const method, and we know
|
||||
// objid == 0, so there's nothing to resolve.
|
||||
return (this->initialized && (this->objid == 0) &&
|
||||
QPDFObjectTypeAccessor<QPDF_Null>::check(obj.getPointer()));
|
||||
QPDFObjectTypeAccessor<QPDF_Null>::check(obj.get()));
|
||||
}
|
||||
|
||||
bool
|
||||
@ -340,7 +340,7 @@ QPDFObjectHandle::isNull()
|
||||
return false;
|
||||
}
|
||||
dereference();
|
||||
return QPDFObjectTypeAccessor<QPDF_Null>::check(obj.getPointer());
|
||||
return QPDFObjectTypeAccessor<QPDF_Null>::check(obj.get());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -351,7 +351,7 @@ QPDFObjectHandle::isInteger()
|
||||
return false;
|
||||
}
|
||||
dereference();
|
||||
return QPDFObjectTypeAccessor<QPDF_Integer>::check(obj.getPointer());
|
||||
return QPDFObjectTypeAccessor<QPDF_Integer>::check(obj.get());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -362,7 +362,7 @@ QPDFObjectHandle::isReal()
|
||||
return false;
|
||||
}
|
||||
dereference();
|
||||
return QPDFObjectTypeAccessor<QPDF_Real>::check(obj.getPointer());
|
||||
return QPDFObjectTypeAccessor<QPDF_Real>::check(obj.get());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -399,7 +399,7 @@ QPDFObjectHandle::isName()
|
||||
return false;
|
||||
}
|
||||
dereference();
|
||||
return QPDFObjectTypeAccessor<QPDF_Name>::check(obj.getPointer());
|
||||
return QPDFObjectTypeAccessor<QPDF_Name>::check(obj.get());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -410,7 +410,7 @@ QPDFObjectHandle::isString()
|
||||
return false;
|
||||
}
|
||||
dereference();
|
||||
return QPDFObjectTypeAccessor<QPDF_String>::check(obj.getPointer());
|
||||
return QPDFObjectTypeAccessor<QPDF_String>::check(obj.get());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -421,7 +421,7 @@ QPDFObjectHandle::isOperator()
|
||||
return false;
|
||||
}
|
||||
dereference();
|
||||
return QPDFObjectTypeAccessor<QPDF_Operator>::check(obj.getPointer());
|
||||
return QPDFObjectTypeAccessor<QPDF_Operator>::check(obj.get());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -432,7 +432,7 @@ QPDFObjectHandle::isInlineImage()
|
||||
return false;
|
||||
}
|
||||
dereference();
|
||||
return QPDFObjectTypeAccessor<QPDF_InlineImage>::check(obj.getPointer());
|
||||
return QPDFObjectTypeAccessor<QPDF_InlineImage>::check(obj.get());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -443,7 +443,7 @@ QPDFObjectHandle::isArray()
|
||||
return false;
|
||||
}
|
||||
dereference();
|
||||
return QPDFObjectTypeAccessor<QPDF_Array>::check(obj.getPointer());
|
||||
return QPDFObjectTypeAccessor<QPDF_Array>::check(obj.get());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -454,7 +454,7 @@ QPDFObjectHandle::isDictionary()
|
||||
return false;
|
||||
}
|
||||
dereference();
|
||||
return QPDFObjectTypeAccessor<QPDF_Dictionary>::check(obj.getPointer());
|
||||
return QPDFObjectTypeAccessor<QPDF_Dictionary>::check(obj.get());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -465,7 +465,7 @@ QPDFObjectHandle::isStream()
|
||||
return false;
|
||||
}
|
||||
dereference();
|
||||
return QPDFObjectTypeAccessor<QPDF_Stream>::check(obj.getPointer());
|
||||
return QPDFObjectTypeAccessor<QPDF_Stream>::check(obj.get());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -526,7 +526,7 @@ QPDFObjectHandle::getBoolValue()
|
||||
{
|
||||
if (isBool())
|
||||
{
|
||||
return dynamic_cast<QPDF_Bool*>(obj.getPointer())->getVal();
|
||||
return dynamic_cast<QPDF_Bool*>(obj.get())->getVal();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -543,7 +543,7 @@ QPDFObjectHandle::getIntValue()
|
||||
{
|
||||
if (isInteger())
|
||||
{
|
||||
return dynamic_cast<QPDF_Integer*>(obj.getPointer())->getVal();
|
||||
return dynamic_cast<QPDF_Integer*>(obj.get())->getVal();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -636,7 +636,7 @@ QPDFObjectHandle::getRealValue()
|
||||
{
|
||||
if (isReal())
|
||||
{
|
||||
return dynamic_cast<QPDF_Real*>(obj.getPointer())->getVal();
|
||||
return dynamic_cast<QPDF_Real*>(obj.get())->getVal();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -653,7 +653,7 @@ QPDFObjectHandle::getName()
|
||||
{
|
||||
if (isName())
|
||||
{
|
||||
return dynamic_cast<QPDF_Name*>(obj.getPointer())->getName();
|
||||
return dynamic_cast<QPDF_Name*>(obj.get())->getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -670,7 +670,7 @@ QPDFObjectHandle::getStringValue()
|
||||
{
|
||||
if (isString())
|
||||
{
|
||||
return dynamic_cast<QPDF_String*>(obj.getPointer())->getVal();
|
||||
return dynamic_cast<QPDF_String*>(obj.get())->getVal();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -685,7 +685,7 @@ QPDFObjectHandle::getUTF8Value()
|
||||
{
|
||||
if (isString())
|
||||
{
|
||||
return dynamic_cast<QPDF_String*>(obj.getPointer())->getUTF8Val();
|
||||
return dynamic_cast<QPDF_String*>(obj.get())->getUTF8Val();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -702,7 +702,7 @@ QPDFObjectHandle::getOperatorValue()
|
||||
{
|
||||
if (isOperator())
|
||||
{
|
||||
return dynamic_cast<QPDF_Operator*>(obj.getPointer())->getVal();
|
||||
return dynamic_cast<QPDF_Operator*>(obj.get())->getVal();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -717,7 +717,7 @@ QPDFObjectHandle::getInlineImageValue()
|
||||
{
|
||||
if (isInlineImage())
|
||||
{
|
||||
return dynamic_cast<QPDF_InlineImage*>(obj.getPointer())->getVal();
|
||||
return dynamic_cast<QPDF_InlineImage*>(obj.get())->getVal();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -740,7 +740,7 @@ QPDFObjectHandle::getArrayNItems()
|
||||
{
|
||||
if (isArray())
|
||||
{
|
||||
return dynamic_cast<QPDF_Array*>(obj.getPointer())->getNItems();
|
||||
return dynamic_cast<QPDF_Array*>(obj.get())->getNItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -756,7 +756,7 @@ QPDFObjectHandle::getArrayItem(int n)
|
||||
QPDFObjectHandle result;
|
||||
if (isArray() && (n < getArrayNItems()) && (n >= 0))
|
||||
{
|
||||
result = dynamic_cast<QPDF_Array*>(obj.getPointer())->getItem(n);
|
||||
result = dynamic_cast<QPDF_Array*>(obj.get())->getItem(n);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -869,7 +869,7 @@ QPDFObjectHandle::getArrayAsVector()
|
||||
std::vector<QPDFObjectHandle> result;
|
||||
if (isArray())
|
||||
{
|
||||
dynamic_cast<QPDF_Array*>(obj.getPointer())->getAsVector(result);
|
||||
dynamic_cast<QPDF_Array*>(obj.get())->getAsVector(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -887,7 +887,7 @@ QPDFObjectHandle::setArrayItem(int n, QPDFObjectHandle const& item)
|
||||
if (isArray())
|
||||
{
|
||||
checkOwnership(item);
|
||||
dynamic_cast<QPDF_Array*>(obj.getPointer())->setItem(n, item);
|
||||
dynamic_cast<QPDF_Array*>(obj.get())->setItem(n, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -905,7 +905,7 @@ QPDFObjectHandle::setArrayFromVector(std::vector<QPDFObjectHandle> const& items)
|
||||
{
|
||||
checkOwnership(item);
|
||||
}
|
||||
dynamic_cast<QPDF_Array*>(obj.getPointer())->setFromVector(items);
|
||||
dynamic_cast<QPDF_Array*>(obj.get())->setFromVector(items);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -919,7 +919,7 @@ QPDFObjectHandle::insertItem(int at, QPDFObjectHandle const& item)
|
||||
{
|
||||
if (isArray())
|
||||
{
|
||||
dynamic_cast<QPDF_Array*>(obj.getPointer())->insertItem(at, item);
|
||||
dynamic_cast<QPDF_Array*>(obj.get())->insertItem(at, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -934,7 +934,7 @@ QPDFObjectHandle::appendItem(QPDFObjectHandle const& item)
|
||||
if (isArray())
|
||||
{
|
||||
checkOwnership(item);
|
||||
dynamic_cast<QPDF_Array*>(obj.getPointer())->appendItem(item);
|
||||
dynamic_cast<QPDF_Array*>(obj.get())->appendItem(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -948,7 +948,7 @@ QPDFObjectHandle::eraseItem(int at)
|
||||
{
|
||||
if (isArray() && (at < getArrayNItems()) && (at >= 0))
|
||||
{
|
||||
dynamic_cast<QPDF_Array*>(obj.getPointer())->eraseItem(at);
|
||||
dynamic_cast<QPDF_Array*>(obj.get())->eraseItem(at);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -978,7 +978,7 @@ QPDFObjectHandle::hasKey(std::string const& key)
|
||||
{
|
||||
if (isDictionary())
|
||||
{
|
||||
return dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->hasKey(key);
|
||||
return dynamic_cast<QPDF_Dictionary*>(obj.get())->hasKey(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -996,7 +996,7 @@ QPDFObjectHandle::getKey(std::string const& key)
|
||||
if (isDictionary())
|
||||
{
|
||||
result = dynamic_cast<QPDF_Dictionary*>(
|
||||
obj.getPointer())->getKey(key);
|
||||
obj.get())->getKey(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1024,7 +1024,7 @@ QPDFObjectHandle::getKeys()
|
||||
std::set<std::string> result;
|
||||
if (isDictionary())
|
||||
{
|
||||
result = dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->getKeys();
|
||||
result = dynamic_cast<QPDF_Dictionary*>(obj.get())->getKeys();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1041,7 +1041,7 @@ QPDFObjectHandle::getDictAsMap()
|
||||
if (isDictionary())
|
||||
{
|
||||
result = dynamic_cast<QPDF_Dictionary*>(
|
||||
obj.getPointer())->getAsMap();
|
||||
obj.get())->getAsMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1311,7 +1311,7 @@ QPDFObjectHandle::replaceKey(std::string const& key,
|
||||
{
|
||||
checkOwnership(value);
|
||||
dynamic_cast<QPDF_Dictionary*>(
|
||||
obj.getPointer())->replaceKey(key, value);
|
||||
obj.get())->replaceKey(key, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1325,7 +1325,7 @@ QPDFObjectHandle::removeKey(std::string const& key)
|
||||
{
|
||||
if (isDictionary())
|
||||
{
|
||||
dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->removeKey(key);
|
||||
dynamic_cast<QPDF_Dictionary*>(obj.get())->removeKey(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1342,7 +1342,7 @@ QPDFObjectHandle::replaceOrRemoveKey(std::string const& key,
|
||||
{
|
||||
checkOwnership(value);
|
||||
dynamic_cast<QPDF_Dictionary*>(
|
||||
obj.getPointer())->replaceOrRemoveKey(key, value);
|
||||
obj.get())->replaceOrRemoveKey(key, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1356,35 +1356,35 @@ QPDFObjectHandle
|
||||
QPDFObjectHandle::getDict()
|
||||
{
|
||||
assertStream();
|
||||
return dynamic_cast<QPDF_Stream*>(obj.getPointer())->getDict();
|
||||
return dynamic_cast<QPDF_Stream*>(obj.get())->getDict();
|
||||
}
|
||||
|
||||
void
|
||||
QPDFObjectHandle::setFilterOnWrite(bool val)
|
||||
{
|
||||
assertStream();
|
||||
dynamic_cast<QPDF_Stream*>(obj.getPointer())->setFilterOnWrite(val);
|
||||
dynamic_cast<QPDF_Stream*>(obj.get())->setFilterOnWrite(val);
|
||||
}
|
||||
|
||||
bool
|
||||
QPDFObjectHandle::getFilterOnWrite()
|
||||
{
|
||||
assertStream();
|
||||
return dynamic_cast<QPDF_Stream*>(obj.getPointer())->getFilterOnWrite();
|
||||
return dynamic_cast<QPDF_Stream*>(obj.get())->getFilterOnWrite();
|
||||
}
|
||||
|
||||
bool
|
||||
QPDFObjectHandle::isDataModified()
|
||||
{
|
||||
assertStream();
|
||||
return dynamic_cast<QPDF_Stream*>(obj.getPointer())->isDataModified();
|
||||
return dynamic_cast<QPDF_Stream*>(obj.get())->isDataModified();
|
||||
}
|
||||
|
||||
void
|
||||
QPDFObjectHandle::replaceDict(QPDFObjectHandle new_dict)
|
||||
{
|
||||
assertStream();
|
||||
dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceDict(new_dict);
|
||||
dynamic_cast<QPDF_Stream*>(obj.get())->replaceDict(new_dict);
|
||||
}
|
||||
|
||||
PointerHolder<Buffer>
|
||||
@ -1392,14 +1392,14 @@ QPDFObjectHandle::getStreamData(qpdf_stream_decode_level_e level)
|
||||
{
|
||||
assertStream();
|
||||
return dynamic_cast<QPDF_Stream*>(
|
||||
obj.getPointer())->getStreamData(level);
|
||||
obj.get())->getStreamData(level);
|
||||
}
|
||||
|
||||
PointerHolder<Buffer>
|
||||
QPDFObjectHandle::getRawStreamData()
|
||||
{
|
||||
assertStream();
|
||||
return dynamic_cast<QPDF_Stream*>(obj.getPointer())->getRawStreamData();
|
||||
return dynamic_cast<QPDF_Stream*>(obj.get())->getRawStreamData();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1409,7 +1409,7 @@ QPDFObjectHandle::pipeStreamData(Pipeline* p, bool* filtering_attempted,
|
||||
bool suppress_warnings, bool will_retry)
|
||||
{
|
||||
assertStream();
|
||||
return dynamic_cast<QPDF_Stream*>(obj.getPointer())->pipeStreamData(
|
||||
return dynamic_cast<QPDF_Stream*>(obj.get())->pipeStreamData(
|
||||
p, filtering_attempted, encode_flags, decode_level,
|
||||
suppress_warnings, will_retry);
|
||||
}
|
||||
@ -1422,7 +1422,7 @@ QPDFObjectHandle::pipeStreamData(Pipeline* p,
|
||||
{
|
||||
assertStream();
|
||||
bool filtering_attempted;
|
||||
dynamic_cast<QPDF_Stream*>(obj.getPointer())->pipeStreamData(
|
||||
dynamic_cast<QPDF_Stream*>(obj.get())->pipeStreamData(
|
||||
p, &filtering_attempted, encode_flags, decode_level,
|
||||
suppress_warnings, will_retry);
|
||||
return filtering_attempted;
|
||||
@ -1455,7 +1455,7 @@ QPDFObjectHandle::replaceStreamData(PointerHolder<Buffer> data,
|
||||
QPDFObjectHandle const& decode_parms)
|
||||
{
|
||||
assertStream();
|
||||
dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData(
|
||||
dynamic_cast<QPDF_Stream*>(obj.get())->replaceStreamData(
|
||||
data, filter, decode_parms);
|
||||
}
|
||||
|
||||
@ -1468,7 +1468,7 @@ QPDFObjectHandle::replaceStreamData(std::string const& data,
|
||||
PointerHolder<Buffer> b = new Buffer(data.length());
|
||||
unsigned char* bp = b->getBuffer();
|
||||
memcpy(bp, data.c_str(), data.length());
|
||||
dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData(
|
||||
dynamic_cast<QPDF_Stream*>(obj.get())->replaceStreamData(
|
||||
b, filter, decode_parms);
|
||||
}
|
||||
|
||||
@ -1478,7 +1478,7 @@ QPDFObjectHandle::replaceStreamData(PointerHolder<StreamDataProvider> provider,
|
||||
QPDFObjectHandle const& decode_parms)
|
||||
{
|
||||
assertStream();
|
||||
dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData(
|
||||
dynamic_cast<QPDF_Stream*>(obj.get())->replaceStreamData(
|
||||
provider, filter, decode_parms);
|
||||
}
|
||||
|
||||
@ -1522,7 +1522,7 @@ QPDFObjectHandle::replaceStreamData(std::function<void(Pipeline*)> provider,
|
||||
{
|
||||
assertStream();
|
||||
PointerHolder<StreamDataProvider> sdp = new FunctionProvider(provider);
|
||||
dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData(
|
||||
dynamic_cast<QPDF_Stream*>(obj.get())->replaceStreamData(
|
||||
sdp, filter, decode_parms);
|
||||
}
|
||||
|
||||
@ -1534,7 +1534,7 @@ QPDFObjectHandle::replaceStreamData(
|
||||
{
|
||||
assertStream();
|
||||
PointerHolder<StreamDataProvider> sdp = new FunctionProvider(provider);
|
||||
dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData(
|
||||
dynamic_cast<QPDF_Stream*>(obj.get())->replaceStreamData(
|
||||
sdp, filter, decode_parms);
|
||||
}
|
||||
|
||||
@ -1787,7 +1787,7 @@ QPDFObjectHandle::unparseBinary()
|
||||
if (this->isString())
|
||||
{
|
||||
return dynamic_cast<QPDF_String*>(
|
||||
this->obj.getPointer())->unparse(true);
|
||||
this->obj.get())->unparse(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1988,7 +1988,7 @@ QPDFObjectHandle::parseContentStream_data(
|
||||
{
|
||||
size_t stream_length = stream_data->getSize();
|
||||
PointerHolder<InputSource> input =
|
||||
new BufferInputSource(description, stream_data.getPointer());
|
||||
new BufferInputSource(description, stream_data.get());
|
||||
QPDFTokenizer tokenizer;
|
||||
tokenizer.allowEOF();
|
||||
bool empty = false;
|
||||
@ -2055,7 +2055,7 @@ QPDFObjectHandle::addTokenFilter(PointerHolder<TokenFilter> filter)
|
||||
{
|
||||
assertStream();
|
||||
return dynamic_cast<QPDF_Stream*>(
|
||||
obj.getPointer())->addTokenFilter(filter);
|
||||
obj.get())->addTokenFilter(filter);
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
@ -2575,7 +2575,7 @@ QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset)
|
||||
{
|
||||
// This is called during parsing on newly created direct objects,
|
||||
// so we can't call dereference() here.
|
||||
if (this->obj.getPointer())
|
||||
if (this->obj.get())
|
||||
{
|
||||
this->obj->setParsedOffset(offset);
|
||||
}
|
||||
@ -2777,7 +2777,7 @@ QPDFObjectHandle::newStream(QPDF* qpdf)
|
||||
new QPDF_Stream(qpdf, 0, 0, stream_dict, 0, 0)));
|
||||
result.dereference();
|
||||
QPDF_Stream* stream =
|
||||
dynamic_cast<QPDF_Stream*>(result.obj.getPointer());
|
||||
dynamic_cast<QPDF_Stream*>(result.obj.get());
|
||||
stream->setObjGen(result.getObjectID(), result.getGeneration());
|
||||
return result;
|
||||
}
|
||||
@ -2819,7 +2819,7 @@ QPDFObjectHandle::setObjectDescription(QPDF* owning_qpdf,
|
||||
{
|
||||
// This is called during parsing on newly created direct objects,
|
||||
// so we can't call dereference() here.
|
||||
if (isInitialized() && this->obj.getPointer())
|
||||
if (isInitialized() && this->obj.get())
|
||||
{
|
||||
this->obj->setDescription(owning_qpdf, object_description);
|
||||
}
|
||||
@ -2831,7 +2831,7 @@ QPDFObjectHandle::hasObjectDescription()
|
||||
if (isInitialized())
|
||||
{
|
||||
dereference();
|
||||
if (this->obj.getPointer())
|
||||
if (this->obj.get())
|
||||
{
|
||||
return this->obj->hasDescription();
|
||||
}
|
||||
@ -2872,7 +2872,7 @@ QPDFObjectHandle::shallowCopyInternal(QPDFObjectHandle& new_obj,
|
||||
{
|
||||
QTC::TC("qpdf", "QPDFObjectHandle shallow copy array");
|
||||
// No newArray for shallow copying the sparse array
|
||||
QPDF_Array* arr = dynamic_cast<QPDF_Array*>(obj.getPointer());
|
||||
QPDF_Array* arr = dynamic_cast<QPDF_Array*>(obj.get());
|
||||
new_obj = QPDFObjectHandle(
|
||||
new QPDF_Array(arr->getElementsForShallowCopy()));
|
||||
}
|
||||
@ -3309,23 +3309,23 @@ QPDFObjectHandle::dereference()
|
||||
throw std::logic_error(
|
||||
"attempted to dereference an uninitialized QPDFObjectHandle");
|
||||
}
|
||||
if (this->obj.getPointer() && this->objid &&
|
||||
if (this->obj.get() && this->objid &&
|
||||
QPDF::Resolver::objectChanged(
|
||||
this->qpdf, QPDFObjGen(this->objid, this->generation), this->obj))
|
||||
{
|
||||
this->obj = nullptr;
|
||||
}
|
||||
if (this->obj.getPointer() == 0)
|
||||
if (this->obj.get() == 0)
|
||||
{
|
||||
PointerHolder<QPDFObject> obj = QPDF::Resolver::resolve(
|
||||
this->qpdf, this->objid, this->generation);
|
||||
if (obj.getPointer() == 0)
|
||||
if (obj.get() == 0)
|
||||
{
|
||||
// QPDF::resolve never returns an uninitialized object, but
|
||||
// check just in case.
|
||||
this->obj = new QPDF_Null();
|
||||
}
|
||||
else if (dynamic_cast<QPDF_Reserved*>(obj.getPointer()))
|
||||
else if (dynamic_cast<QPDF_Reserved*>(obj.get()))
|
||||
{
|
||||
// Do not resolve
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name)
|
||||
}
|
||||
else if (name.isString())
|
||||
{
|
||||
if (0 == this->m->names_dest.getPointer())
|
||||
if (0 == this->m->names_dest.get())
|
||||
{
|
||||
QPDFObjectHandle names = this->qpdf.getRoot().getKey("/Names");
|
||||
if (names.isDictionary())
|
||||
@ -117,7 +117,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->m->names_dest.getPointer())
|
||||
if (this->m->names_dest.get())
|
||||
{
|
||||
if (this->m->names_dest->findObject(name.getUTF8Value(), result))
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ QPDFPageLabelDocumentHelper::QPDFPageLabelDocumentHelper(QPDF& qpdf) :
|
||||
bool
|
||||
QPDFPageLabelDocumentHelper::hasPageLabels()
|
||||
{
|
||||
return 0 != this->m->labels.getPointer();
|
||||
return 0 != this->m->labels.get();
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
|
@ -1222,7 +1222,7 @@ QPDFPageObjectHelper::flattenRotation(QPDFAcroFormDocumentHelper* afdh)
|
||||
if (! afdh)
|
||||
{
|
||||
afdhph = new QPDFAcroFormDocumentHelper(*qpdf);
|
||||
afdh = afdhph.getPointer();
|
||||
afdh = afdhph.get();
|
||||
}
|
||||
afdh->transformAnnotations(
|
||||
annots, new_annots, new_fields, old_fields, cm);
|
||||
@ -1270,7 +1270,7 @@ QPDFPageObjectHelper::copyAnnotations(
|
||||
if (! afdh)
|
||||
{
|
||||
afdhph = new QPDFAcroFormDocumentHelper(*this_qpdf);
|
||||
afdh = afdhph.getPointer();
|
||||
afdh = afdhph.get();
|
||||
}
|
||||
if (this_qpdf == from_qpdf)
|
||||
{
|
||||
@ -1288,7 +1288,7 @@ QPDFPageObjectHelper::copyAnnotations(
|
||||
else
|
||||
{
|
||||
from_afdhph = new QPDFAcroFormDocumentHelper(*from_qpdf);
|
||||
from_afdh = from_afdhph.getPointer();
|
||||
from_afdh = from_afdhph.get();
|
||||
}
|
||||
|
||||
afdh->transformAnnotations(
|
||||
|
@ -652,7 +652,7 @@ QPDFTokenizer::expectInlineImage(PointerHolder<InputSource> input)
|
||||
void
|
||||
QPDFTokenizer::findEI(PointerHolder<InputSource> input)
|
||||
{
|
||||
if (! input.getPointer())
|
||||
if (! input.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -3581,7 +3581,7 @@ QPDFWriter::indicateProgress(bool decrement, bool finished)
|
||||
|
||||
++this->m->events_seen;
|
||||
|
||||
if (! this->m->progress_reporter.getPointer())
|
||||
if (! this->m->progress_reporter.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp,
|
||||
{
|
||||
normalizer = new ContentNormalizer();
|
||||
pipeline = new Pl_QPDFTokenizer(
|
||||
"normalizer", normalizer.getPointer(), pipeline);
|
||||
"normalizer", normalizer.get(), pipeline);
|
||||
to_delete.push_back(pipeline);
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp,
|
||||
iter != this->token_filters.rend(); ++iter)
|
||||
{
|
||||
pipeline = new Pl_QPDFTokenizer(
|
||||
"token filter", (*iter).getPointer(), pipeline);
|
||||
"token filter", (*iter).get(), pipeline);
|
||||
to_delete.push_back(pipeline);
|
||||
}
|
||||
|
||||
@ -512,14 +512,14 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp,
|
||||
}
|
||||
}
|
||||
|
||||
if (this->stream_data.getPointer())
|
||||
if (this->stream_data.get())
|
||||
{
|
||||
QTC::TC("qpdf", "QPDF_Stream pipe replaced stream data");
|
||||
pipeline->write(this->stream_data->getBuffer(),
|
||||
this->stream_data->getSize());
|
||||
pipeline->finish();
|
||||
}
|
||||
else if (this->stream_provider.getPointer())
|
||||
else if (this->stream_provider.get())
|
||||
{
|
||||
Pl_Count count("stream provider count", pipeline);
|
||||
if (this->stream_provider->supportsRetry())
|
||||
@ -590,7 +590,7 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp,
|
||||
|
||||
if (filter &&
|
||||
(! suppress_warnings) &&
|
||||
normalizer.getPointer() &&
|
||||
normalizer.get() &&
|
||||
normalizer->anyBadTokens())
|
||||
{
|
||||
warn(QPDFExc(qpdf_e_damaged_pdf, qpdf->getFilename(),
|
||||
|
@ -206,7 +206,7 @@ iterate_rc4(unsigned char* data, size_t data_len,
|
||||
{
|
||||
PointerHolder<unsigned char> key_ph = PointerHolder<unsigned char>(
|
||||
true, new unsigned char[QIntC::to_size(key_len)]);
|
||||
unsigned char* key = key_ph.getPointer();
|
||||
unsigned char* key = key_ph.get();
|
||||
for (int i = 0; i < iterations; ++i)
|
||||
{
|
||||
int const xor_value = (reverse ? iterations - 1 - i : i);
|
||||
|
@ -314,7 +314,7 @@ QPDF::readLinearizationData()
|
||||
QPDFObjectHandle HO = H0.getKey("/O"); // outline
|
||||
|
||||
PointerHolder<Buffer> hbp = pb.getBuffer();
|
||||
Buffer* hb = hbp.getPointer();
|
||||
Buffer* hb = hbp.get();
|
||||
unsigned char const* h_buf = hb->getBuffer();
|
||||
size_t h_size = hb->getSize();
|
||||
|
||||
|
@ -470,7 +470,7 @@ win_convert_filename(char const* filename)
|
||||
size_t len = u16.length();
|
||||
size_t wlen = (len / 2) - 1;
|
||||
PointerHolder<wchar_t> wfilenamep(true, new wchar_t[wlen + 1]);
|
||||
wchar_t* wfilename = wfilenamep.getPointer();
|
||||
wchar_t* wfilename = wfilenamep.get();
|
||||
wfilename[wlen] = 0;
|
||||
for (unsigned int i = 2; i < len; i += 2)
|
||||
{
|
||||
@ -489,9 +489,9 @@ QUtil::safe_fopen(char const* filename, char const* mode)
|
||||
FILE* f = 0;
|
||||
#ifdef _WIN32
|
||||
PointerHolder<wchar_t> wfilenamep = win_convert_filename(filename);
|
||||
wchar_t* wfilename = wfilenamep.getPointer();
|
||||
wchar_t* wfilename = wfilenamep.get();
|
||||
PointerHolder<wchar_t> wmodep(true, new wchar_t[strlen(mode) + 1]);
|
||||
wchar_t* wmode = wmodep.getPointer();
|
||||
wchar_t* wmode = wmodep.get();
|
||||
wmode[strlen(mode)] = 0;
|
||||
for (size_t i = 0; i < strlen(mode); ++i)
|
||||
{
|
||||
@ -633,7 +633,7 @@ QUtil::remove_file(char const* path)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
PointerHolder<wchar_t> wpath = win_convert_filename(path);
|
||||
os_wrapper(std::string("remove ") + path, _wunlink(wpath.getPointer()));
|
||||
os_wrapper(std::string("remove ") + path, _wunlink(wpath.get()));
|
||||
#else
|
||||
os_wrapper(std::string("remove ") + path, unlink(path));
|
||||
#endif
|
||||
@ -654,7 +654,7 @@ QUtil::rename_file(char const* oldname, char const* newname)
|
||||
PointerHolder<wchar_t> wold = win_convert_filename(oldname);
|
||||
PointerHolder<wchar_t> wnew = win_convert_filename(newname);
|
||||
os_wrapper(std::string("rename ") + oldname + " " + newname,
|
||||
_wrename(wold.getPointer(), wnew.getPointer()));
|
||||
_wrename(wold.get(), wnew.get()));
|
||||
#else
|
||||
os_wrapper(std::string("rename ") + oldname + " " + newname,
|
||||
rename(oldname, newname));
|
||||
@ -867,8 +867,8 @@ QUtil::get_env(std::string const& var, std::string* value)
|
||||
if (value)
|
||||
{
|
||||
PointerHolder<char> t = PointerHolder<char>(true, new char[len + 1]);
|
||||
::GetEnvironmentVariable(var.c_str(), t.getPointer(), len);
|
||||
*value = t.getPointer();
|
||||
::GetEnvironmentVariable(var.c_str(), t.get(), len);
|
||||
*value = t.get();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1261,7 +1261,7 @@ QUtil::read_file_into_memory(
|
||||
size = QIntC::to_size(QUtil::tell(f));
|
||||
fseek(f, 0, SEEK_SET);
|
||||
file_buf = PointerHolder<char>(true, new char[size]);
|
||||
char* buf_p = file_buf.getPointer();
|
||||
char* buf_p = file_buf.get();
|
||||
size_t bytes_read = 0;
|
||||
size_t len = 0;
|
||||
while ((len = fread(buf_p + bytes_read, 1, size - bytes_read, f)) > 0)
|
||||
|
@ -175,7 +175,7 @@ void qpdf_cleanup(qpdf_data* qpdf)
|
||||
{
|
||||
QTC::TC("qpdf", "qpdf-c called qpdf_cleanup");
|
||||
qpdf_oh_release_all(*qpdf);
|
||||
if ((*qpdf)->error.getPointer())
|
||||
if ((*qpdf)->error.get())
|
||||
{
|
||||
QTC::TC("qpdf", "qpdf-c cleanup warned about unhandled error");
|
||||
std::cerr << "WARNING: application did not handle error: "
|
||||
@ -216,12 +216,12 @@ QPDF_BOOL qpdf_more_warnings(qpdf_data qpdf)
|
||||
QPDF_BOOL qpdf_has_error(qpdf_data qpdf)
|
||||
{
|
||||
QTC::TC("qpdf", "qpdf-c called qpdf_has_error");
|
||||
return (qpdf->error.getPointer() ? QPDF_TRUE : QPDF_FALSE);
|
||||
return (qpdf->error.get() ? QPDF_TRUE : QPDF_FALSE);
|
||||
}
|
||||
|
||||
qpdf_error qpdf_get_error(qpdf_data qpdf)
|
||||
{
|
||||
if (qpdf->error.getPointer())
|
||||
if (qpdf->error.get())
|
||||
{
|
||||
qpdf->tmp_error.exc = qpdf->error;
|
||||
qpdf->error = 0;
|
||||
@ -498,11 +498,11 @@ QPDF_BOOL qpdf_allow_modify_all(qpdf_data qpdf)
|
||||
|
||||
static void qpdf_init_write_internal(qpdf_data qpdf)
|
||||
{
|
||||
if (qpdf->qpdf_writer.getPointer())
|
||||
if (qpdf->qpdf_writer.get())
|
||||
{
|
||||
QTC::TC("qpdf", "qpdf-c called qpdf_init_write multiple times");
|
||||
qpdf->qpdf_writer = 0;
|
||||
if (qpdf->output_buffer.getPointer())
|
||||
if (qpdf->output_buffer.get())
|
||||
{
|
||||
qpdf->output_buffer = 0;
|
||||
qpdf->write_memory = false;
|
||||
@ -541,7 +541,7 @@ size_t qpdf_get_buffer_length(qpdf_data qpdf)
|
||||
{
|
||||
qpdf_get_buffer_internal(qpdf);
|
||||
size_t result = 0;
|
||||
if (qpdf->output_buffer.getPointer())
|
||||
if (qpdf->output_buffer.get())
|
||||
{
|
||||
result = qpdf->output_buffer->getSize();
|
||||
}
|
||||
@ -552,7 +552,7 @@ unsigned char const* qpdf_get_buffer(qpdf_data qpdf)
|
||||
{
|
||||
unsigned char const* result = 0;
|
||||
qpdf_get_buffer_internal(qpdf);
|
||||
if (qpdf->output_buffer.getPointer())
|
||||
if (qpdf->output_buffer.get())
|
||||
{
|
||||
result = qpdf->output_buffer->getBuffer();
|
||||
}
|
||||
@ -978,7 +978,7 @@ static RET do_with_oh(
|
||||
qpdf, fallback, [fn, oh](qpdf_data q) {
|
||||
auto i = q->oh_cache.find(oh);
|
||||
bool result = ((i != q->oh_cache.end()) &&
|
||||
(i->second).getPointer());
|
||||
(i->second).get());
|
||||
if (! result)
|
||||
{
|
||||
QTC::TC("qpdf", "qpdf-c invalid object handle");
|
||||
@ -1506,7 +1506,7 @@ qpdf_oh qpdf_oh_new_stream(qpdf_data qpdf)
|
||||
{
|
||||
QTC::TC("qpdf", "qpdf-c called qpdf_oh_new_stream");
|
||||
return new_object(
|
||||
qpdf, QPDFObjectHandle::newStream(qpdf->qpdf.getPointer()));
|
||||
qpdf, QPDFObjectHandle::newStream(qpdf->qpdf.get()));
|
||||
}
|
||||
|
||||
void qpdf_oh_make_direct(qpdf_data qpdf, qpdf_oh oh)
|
||||
|
@ -66,7 +66,7 @@ int main()
|
||||
// of the next match
|
||||
memcpy(b + 2037, "potato potato salad ", 20);
|
||||
PointerHolder<InputSource> is =
|
||||
new BufferInputSource("test buffer input source", b1.getPointer());
|
||||
new BufferInputSource("test buffer input source", b1.get());
|
||||
Finder f1(is, "salad");
|
||||
check("find potato salad", true,
|
||||
is->findFirst("potato", 0, 0, f1));
|
||||
|
@ -15,7 +15,7 @@ int main(int argc, char* argv[])
|
||||
PointerHolder<char> buf;
|
||||
size_t size;
|
||||
QUtil::read_file_into_memory(filename, buf, size);
|
||||
std::string s(buf.getPointer(), size);
|
||||
std::string s(buf.get(), size);
|
||||
std::cout << JSON::parse(s).unparse() << std::endl;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
|
@ -1,3 +1,4 @@
|
||||
#define NO_POINTERHOLDER_DEPRECATION // we need to test the deprecated API
|
||||
#include <qpdf/PointerHolder.hh>
|
||||
|
||||
#include <iostream>
|
||||
|
@ -528,7 +528,7 @@ void read_from_file_test()
|
||||
size_t size = 0;
|
||||
QUtil::read_file_into_memory("other-file", buf, size);
|
||||
std::cout << "read " << size << " bytes" << std::endl;
|
||||
char const* p = buf.getPointer();
|
||||
char const* p = buf.get();
|
||||
assert(size == 24652);
|
||||
assert(memcmp(p, "This file is used for qutil testing.", 36) == 0);
|
||||
assert(p[59] == static_cast<char>(13));
|
||||
@ -609,11 +609,11 @@ void rename_delete_test()
|
||||
fprintf(f1, "one");
|
||||
fclose(f1);
|
||||
QUtil::read_file_into_memory("old\xcf\x80", buf, size);
|
||||
assert(memcmp(buf.getPointer(), "one", 3) == 0);
|
||||
assert(memcmp(buf.get(), "one", 3) == 0);
|
||||
std::cout << "rename file" << std::endl;;
|
||||
QUtil::rename_file("old\xcf\x80", "old\xcf\x80.~tmp");
|
||||
QUtil::read_file_into_memory("old\xcf\x80.~tmp", buf, size);
|
||||
assert(memcmp(buf.getPointer(), "one", 3) == 0);
|
||||
assert(memcmp(buf.get(), "one", 3) == 0);
|
||||
assert_no_file("old\xcf\x80");
|
||||
std::cout << "create file" << std::endl;;
|
||||
f1 = QUtil::safe_fopen("old\xcf\x80", "w");
|
||||
@ -622,7 +622,7 @@ void rename_delete_test()
|
||||
std::cout << "rename over existing" << std::endl;;
|
||||
QUtil::rename_file("old\xcf\x80", "old\xcf\x80.~tmp");
|
||||
QUtil::read_file_into_memory("old\xcf\x80.~tmp", buf, size);
|
||||
assert(memcmp(buf.getPointer(), "two", 3) == 0);
|
||||
assert(memcmp(buf.get(), "two", 3) == 0);
|
||||
assert_no_file("old\xcf\x80");
|
||||
std::cout << "delete file" << std::endl;;
|
||||
QUtil::remove_file("old\xcf\x80.~tmp");
|
||||
|
@ -295,7 +295,7 @@ static void test_0_1(QPDF& pdf, char const* arg2)
|
||||
std::cout.flush();
|
||||
QUtil::binary_stdout();
|
||||
PointerHolder<Pl_StdioFile> out = new Pl_StdioFile("raw", stdout);
|
||||
qtest.pipeStreamData(out.getPointer(), 0, qpdf_dl_none);
|
||||
qtest.pipeStreamData(out.get(), 0, qpdf_dl_none);
|
||||
|
||||
std::cout << std::endl << "Uncompressed stream data:" << std::endl;
|
||||
if (qtest.pipeStreamData(0, 0, qpdf_dl_all))
|
||||
@ -303,7 +303,7 @@ static void test_0_1(QPDF& pdf, char const* arg2)
|
||||
std::cout.flush();
|
||||
QUtil::binary_stdout();
|
||||
out = new Pl_StdioFile("filtered", stdout);
|
||||
qtest.pipeStreamData(out.getPointer(), 0, qpdf_dl_all);
|
||||
qtest.pipeStreamData(out.get(), 0, qpdf_dl_all);
|
||||
std::cout << std::endl << "End of stream data" << std::endl;
|
||||
}
|
||||
else
|
||||
@ -344,7 +344,7 @@ static void test_2(QPDF& pdf, char const* arg2)
|
||||
QPDFObjectHandle contents = page.getKey("/Contents");
|
||||
QUtil::binary_stdout();
|
||||
PointerHolder<Pl_StdioFile> out = new Pl_StdioFile("filtered", stdout);
|
||||
contents.pipeStreamData(out.getPointer(), 0, qpdf_dl_generalized);
|
||||
contents.pipeStreamData(out.get(), 0, qpdf_dl_generalized);
|
||||
}
|
||||
|
||||
static void test_3(QPDF& pdf, char const* arg2)
|
||||
@ -358,7 +358,7 @@ static void test_3(QPDF& pdf, char const* arg2)
|
||||
QUtil::binary_stdout();
|
||||
PointerHolder<Pl_StdioFile> out =
|
||||
new Pl_StdioFile("tokenized stream", stdout);
|
||||
stream.pipeStreamData(out.getPointer(),
|
||||
stream.pipeStreamData(out.get(),
|
||||
qpdf_ef_normalize, qpdf_dl_generalized);
|
||||
}
|
||||
}
|
||||
@ -3154,7 +3154,7 @@ static void test_83(QPDF& pdf, char const* arg2)
|
||||
try
|
||||
{
|
||||
std::cout << "calling initializeFromJson" << std::endl;
|
||||
j.initializeFromJson(std::string(file_buf.getPointer(), size));
|
||||
j.initializeFromJson(std::string(file_buf.get(), size));
|
||||
std::cout << "called initializeFromJson" << std::endl;
|
||||
}
|
||||
catch (QPDFUsage& e)
|
||||
@ -3278,7 +3278,7 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
std::string filename(std::string(filename1) + ".obfuscated");
|
||||
size_t size = 0;
|
||||
QUtil::read_file_into_memory(filename.c_str(), file_buf, size);
|
||||
char* p = file_buf.getPointer();
|
||||
char* p = file_buf.get();
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
p[i] = static_cast<char>(p[i] ^ 0xcc);
|
||||
@ -3309,7 +3309,7 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
QTC::TC("qpdf", "exercise processMemoryFile");
|
||||
size_t size = 0;
|
||||
QUtil::read_file_into_memory(filename1, file_buf, size);
|
||||
pdf.processMemoryFile(filename1, file_buf.getPointer(), size);
|
||||
pdf.processMemoryFile(filename1, file_buf.get(), size);
|
||||
}
|
||||
|
||||
std::map<int, void (*)(QPDF&, char const*)> test_functions = {
|
||||
|
@ -222,7 +222,7 @@ static void process(char const* filename, bool include_ignorable,
|
||||
(*iter).pipeContents(&plb);
|
||||
PointerHolder<Buffer> content_data = plb.getBuffer();
|
||||
BufferInputSource* bis = new BufferInputSource(
|
||||
"content data", content_data.getPointer());
|
||||
"content data", content_data.get());
|
||||
is = bis;
|
||||
dump_tokens(is, "PAGE " + QUtil::int_to_string(pageno),
|
||||
max_len, include_ignorable, false, true);
|
||||
@ -240,7 +240,7 @@ static void process(char const* filename, bool include_ignorable,
|
||||
PointerHolder<Buffer> b =
|
||||
(*iter).getStreamData(qpdf_dl_specialized);
|
||||
BufferInputSource* bis = new BufferInputSource(
|
||||
"object stream data", b.getPointer());
|
||||
"object stream data", b.get());
|
||||
is = bis;
|
||||
dump_tokens(is, "OBJECT STREAM " +
|
||||
QUtil::int_to_string((*iter).getObjectID()),
|
||||
|
@ -77,7 +77,7 @@ int main(int argc, char* argv[])
|
||||
QUtil::binary_stdin();
|
||||
PointerHolder<Pl_StdioFile> out = new Pl_StdioFile("stdout", stdout);
|
||||
PointerHolder<Pl_Flate> flate =
|
||||
new Pl_Flate("flate", out.getPointer(), action);
|
||||
new Pl_Flate("flate", out.get(), action);
|
||||
bool warn = false;
|
||||
flate->setWarnCallback([&warn](char const* msg, int code) {
|
||||
warn = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user