2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

Replace PointerHolder with std::shared_ptr in the rest of the code

Increase to POINTERHOLDER_TRANSITION=3

patrepl s/PointerHolder/std::shared_ptr/g **/*.cc **/*.hh
patrepl s/make_pointer_holder/std::make_shared/g **/*.cc
patrepl s/make_array_pointer_holder/QUtil::make_shared_array/g **/*.cc
patrepl s,qpdf/std::shared_ptr,qpdf/PointerHolder, **/*.cc **/*.hh
git restore include/qpdf/PointerHolder.hh
git restore libtests/pointer_holder.cc
cleanpatch
./format-code
This commit is contained in:
Jay Berkenbilt 2022-04-09 14:49:10 -04:00
parent a68703b07e
commit ba0ef7a124
14 changed files with 79 additions and 79 deletions

View File

@ -108,7 +108,7 @@ if(NOT (BUILD_STATIC_LIBS OR BUILD_SHARED_LIBS))
FATAL_ERROR "At least one of static or shared libraries must be built")
endif()
add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:POINTERHOLDER_TRANSITION=2>)
add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:POINTERHOLDER_TRANSITION=3>)
enable_testing()
set(RUN_QTEST perl ${qpdf_SOURCE_DIR}/run-qtest)

View File

@ -176,7 +176,7 @@ add_page(
// with /FlateDecode if we don't provide any other form of
// compression.
ImageProvider* p = new ImageProvider(color_space, filter);
PointerHolder<QPDFObjectHandle::StreamDataProvider> provider(p);
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
size_t width = p->getWidth();
size_t height = p->getHeight();
QPDFObjectHandle image = QPDFObjectHandle::newStream(&pdf);
@ -296,10 +296,10 @@ check(
// Check image data
auto actual_data = image.getStreamData(qpdf_dl_all);
ImageProvider* p = new ImageProvider(desired_color_space, "null");
PointerHolder<QPDFObjectHandle::StreamDataProvider> provider(p);
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
Pl_Buffer b_p("get image data");
provider->provideStreamData(0, 0, &b_p);
PointerHolder<Buffer> desired_data(b_p.getBuffer());
std::shared_ptr<Buffer> desired_data(b_p.getBuffer());
if (desired_data->getSize() != actual_data->getSize()) {
std::cout << "page " << pageno << ": image data length mismatch"

View File

@ -205,7 +205,7 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider
void registerStream(
QPDFObjectHandle stream,
PointerHolder<QPDFObjectHandle::StreamDataProvider> self);
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> self);
private:
bool maybeReplace(
@ -283,7 +283,7 @@ StreamReplacer::maybeReplace(
// make all its decisions from the stream dictionary. However,
// it's a good idea to make sure we can retrieve the filtered data
// if we are going to need it later.
PointerHolder<Buffer> out;
std::shared_ptr<Buffer> out;
try {
out = stream.getStreamData();
} catch (...) {
@ -321,7 +321,7 @@ StreamReplacer::maybeReplace(
void
StreamReplacer::registerStream(
QPDFObjectHandle stream,
PointerHolder<QPDFObjectHandle::StreamDataProvider> self)
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> self)
{
QPDFObjGen og(stream.getObjGen());
@ -409,10 +409,10 @@ process(
qpdf.processFile(infilename);
// Create a single StreamReplacer instance. The interface requires
// a PointerHolder in various places, so allocate a StreamReplacer
// and stash it in a PointerHolder.
// a std::shared_ptr in various places, so allocate a StreamReplacer
// and stash it in a std::shared_ptr.
StreamReplacer* replacer = new StreamReplacer(&qpdf);
PointerHolder<QPDFObjectHandle::StreamDataProvider> p(replacer);
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> p(replacer);
for (auto& o : qpdf.getAllObjects()) {
if (o.isStream()) {

View File

@ -207,10 +207,11 @@ main(int argc, char* argv[])
// details.
QPDFPageObjectHelper& page(*iter);
page.addContentTokenFilter(
PointerHolder<QPDFObjectHandle::TokenFilter>(
std::shared_ptr<QPDFObjectHandle::TokenFilter>(
new StringReverser));
page.addContentTokenFilter(
PointerHolder<QPDFObjectHandle::TokenFilter>(new ColorToGray));
std::shared_ptr<QPDFObjectHandle::TokenFilter>(
new ColorToGray));
}
QPDFWriter w(pdf, outfilename);

View File

@ -41,7 +41,7 @@ class ImageInverter: public QPDFObjectHandle::StreamDataProvider
void registerImage(
QPDFObjectHandle image,
PointerHolder<QPDFObjectHandle::StreamDataProvider> self);
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> self);
private:
std::map<QPDFObjGen, QPDFObjectHandle> copied_images;
@ -50,14 +50,14 @@ class ImageInverter: public QPDFObjectHandle::StreamDataProvider
void
ImageInverter::registerImage(
QPDFObjectHandle image,
PointerHolder<QPDFObjectHandle::StreamDataProvider> self)
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> self)
{
// replaceStreamData requires a pointer holder to the stream data
// provider, but there's no way for us to generate one ourselves,
// so we have to have it handed to us. Don't be tempted to have
// the class contain a PointerHolder to itself as a member. Doing
// the class contain a std::shared_ptr to itself as a member. Doing
// this will prevent the class from ever being deleted since the
// reference count will never drop to zero (and PointerHolder
// reference count will never drop to zero (and std::shared_ptr
// doesn't have weak references).
QPDFObjGen og(image.getObjGen());
@ -90,7 +90,7 @@ ImageInverter::provideStreamData(int objid, int generation, Pipeline* pipeline)
// image data. Then invert the image data and write the inverted
// data to the pipeline.
QPDFObjGen og(objid, generation);
PointerHolder<Buffer> data =
std::shared_ptr<Buffer> data =
this->copied_images[og].getStreamData(qpdf_dl_all);
size_t size = data->getSize();
unsigned char* buf = data->getBuffer();
@ -128,7 +128,7 @@ main(int argc, char* argv[])
qpdf.processFile(infilename, password);
ImageInverter* inv = new ImageInverter;
auto p = PointerHolder<QPDFObjectHandle::StreamDataProvider>(inv);
auto p = std::shared_ptr<QPDFObjectHandle::StreamDataProvider>(inv);
// For each page...
std::vector<QPDFPageObjectHelper> pages =

View File

@ -34,9 +34,9 @@ class FuzzHelper
void run();
private:
PointerHolder<QPDF> getQpdf();
PointerHolder<QPDFWriter> getWriter(PointerHolder<QPDF>);
void doWrite(PointerHolder<QPDFWriter> w);
std::shared_ptr<QPDF> getQpdf();
std::shared_ptr<QPDFWriter> getWriter(std::shared_ptr<QPDF>);
void doWrite(std::shared_ptr<QPDFWriter> w);
void testWrite();
void testPages();
void testOutlines();
@ -52,27 +52,27 @@ FuzzHelper::FuzzHelper(unsigned char const* data, size_t size) :
{
}
PointerHolder<QPDF>
std::shared_ptr<QPDF>
FuzzHelper::getQpdf()
{
auto is = PointerHolder<InputSource>(
auto is = std::shared_ptr<InputSource>(
new BufferInputSource("fuzz input", &this->input_buffer));
auto qpdf = make_pointer_holder<QPDF>();
auto qpdf = std::make_shared<QPDF>();
qpdf->processInputSource(is);
return qpdf;
}
PointerHolder<QPDFWriter>
FuzzHelper::getWriter(PointerHolder<QPDF> qpdf)
std::shared_ptr<QPDFWriter>
FuzzHelper::getWriter(std::shared_ptr<QPDF> qpdf)
{
auto w = make_pointer_holder<QPDFWriter>(*qpdf);
auto w = std::make_shared<QPDFWriter>(*qpdf);
w->setOutputPipeline(&this->discard);
w->setDecodeLevel(qpdf_dl_all);
return w;
}
void
FuzzHelper::doWrite(PointerHolder<QPDFWriter> w)
FuzzHelper::doWrite(std::shared_ptr<QPDFWriter> w)
{
try {
w->write();
@ -88,8 +88,8 @@ FuzzHelper::testWrite()
{
// Write in various ways to exercise QPDFWriter
PointerHolder<QPDF> q;
PointerHolder<QPDFWriter> w;
std::shared_ptr<QPDF> q;
std::shared_ptr<QPDFWriter> w;
q = getQpdf();
w = getWriter(q);
@ -126,7 +126,7 @@ FuzzHelper::testPages()
{
// Parse all content streams, and exercise some helpers that
// operate on pages.
PointerHolder<QPDF> q = getQpdf();
std::shared_ptr<QPDF> q = getQpdf();
QPDFPageDocumentHelper pdh(*q);
QPDFPageLabelDocumentHelper pldh(*q);
QPDFOutlineDocumentHelper odh(*q);
@ -168,7 +168,7 @@ FuzzHelper::testPages()
void
FuzzHelper::testOutlines()
{
PointerHolder<QPDF> q = getQpdf();
std::shared_ptr<QPDF> q = getQpdf();
std::list<std::vector<QPDFOutlineObjectHelper>> queue;
QPDFOutlineDocumentHelper odh(*q);
queue.push_back(odh.getTopLevelOutlines());

View File

@ -8,7 +8,7 @@ int
main(int argc, char** argv)
{
for (int i = 1; i < argc; i++) {
PointerHolder<char> file_buf;
std::shared_ptr<char> file_buf;
size_t size = 0;
QUtil::read_file_into_memory(argv[i], file_buf, size);
LLVMFuzzerTestOneInput(

View File

@ -5,11 +5,11 @@
#include <cstring>
#include <iostream>
static PointerHolder<Buffer>
static std::shared_ptr<Buffer>
get_buffer()
{
size_t size = 3172;
PointerHolder<Buffer> b(new Buffer(size));
std::shared_ptr<Buffer> b(new Buffer(size));
unsigned char* p = b->getBuffer();
for (size_t i = 0; i < size; ++i) {
p[i] = static_cast<unsigned char>(i & 0xff);
@ -20,7 +20,7 @@ get_buffer()
class Finder: public InputSource::Finder
{
public:
Finder(PointerHolder<InputSource> is, std::string const& after) :
Finder(std::shared_ptr<InputSource> is, std::string const& after) :
is(is),
after(after)
{
@ -31,7 +31,7 @@ class Finder: public InputSource::Finder
virtual bool check();
private:
PointerHolder<InputSource> is;
std::shared_ptr<InputSource> is;
std::string after;
};
@ -57,14 +57,14 @@ check(char const* description, bool expected, bool actual)
int
main()
{
PointerHolder<Buffer> b1 = get_buffer();
std::shared_ptr<Buffer> b1 = get_buffer();
unsigned char* b = b1->getBuffer();
// Straddle block boundaries
memcpy(b + 1022, "potato", 6);
// Overlap so that the first check() would advance past the start
// of the next match
memcpy(b + 2037, "potato potato salad ", 20);
auto is = PointerHolder<InputSource>(
auto is = std::shared_ptr<InputSource>(
new BufferInputSource("test buffer input source", b1.get()));
Finder f1(is, "salad");
check("find potato salad", true, is->findFirst("potato", 0, 0, f1));

View File

@ -11,7 +11,7 @@ main(int argc, char* argv[])
}
char const* filename = argv[1];
try {
PointerHolder<char> buf;
std::shared_ptr<char> buf;
size_t size;
QUtil::read_file_into_memory(filename, buf, size);
std::string s(buf.get(), size);

View File

@ -529,7 +529,7 @@ read_from_file_test()
fclose(fp);
}
PointerHolder<char> buf;
std::shared_ptr<char> buf;
size_t size = 0;
QUtil::read_file_into_memory("other-file", buf, size);
std::cout << "read " << size << " bytes" << std::endl;
@ -595,7 +595,7 @@ assert_no_file(char const* filename)
void
rename_delete_test()
{
PointerHolder<char> buf;
std::shared_ptr<char> buf;
size_t size = 0;
try {

View File

@ -49,7 +49,7 @@ usage()
class Provider: public QPDFObjectHandle::StreamDataProvider
{
public:
Provider(PointerHolder<Buffer> b) :
Provider(std::shared_ptr<Buffer> b) :
b(b),
bad_length(false)
{
@ -74,7 +74,7 @@ class Provider: public QPDFObjectHandle::StreamDataProvider
}
private:
PointerHolder<Buffer> b;
std::shared_ptr<Buffer> b;
bool bad_length;
};
@ -151,7 +151,7 @@ class TokenFilter: public QPDFObjectHandle::TokenFilter
static std::string
getPageContents(QPDFObjectHandle page)
{
PointerHolder<Buffer> b1 = page.getKey("/Contents").getStreamData();
std::shared_ptr<Buffer> b1 = page.getKey("/Contents").getStreamData();
return std::string(
reinterpret_cast<char*>(b1->getBuffer()), b1->getSize()) +
"\0";
@ -271,14 +271,14 @@ test_0_1(QPDF& pdf, char const* arg2)
std::cout << "Raw stream data:" << std::endl;
std::cout.flush();
QUtil::binary_stdout();
auto out = make_pointer_holder<Pl_StdioFile>("raw", stdout);
auto out = std::make_shared<Pl_StdioFile>("raw", stdout);
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)) {
std::cout.flush();
QUtil::binary_stdout();
out = make_pointer_holder<Pl_StdioFile>("filtered", stdout);
out = std::make_shared<Pl_StdioFile>("filtered", stdout);
qtest.pipeStreamData(out.get(), 0, qpdf_dl_all);
std::cout << std::endl << "End of stream data" << std::endl;
} else {
@ -316,7 +316,7 @@ test_2(QPDF& pdf, char const* arg2)
QPDFObjectHandle page = kids.getArrayItem(1); // second page
QPDFObjectHandle contents = page.getKey("/Contents");
QUtil::binary_stdout();
auto out = make_pointer_holder<Pl_StdioFile>("filtered", stdout);
auto out = std::make_shared<Pl_StdioFile>("filtered", stdout);
contents.pipeStreamData(out.get(), 0, qpdf_dl_generalized);
}
@ -329,8 +329,7 @@ test_3(QPDF& pdf, char const* arg2)
std::cout << "-- stream " << i << " --" << std::endl;
std::cout.flush();
QUtil::binary_stdout();
auto out =
make_pointer_holder<Pl_StdioFile>("tokenized stream", stdout);
auto out = std::make_shared<Pl_StdioFile>("tokenized stream", stdout);
stream.pipeStreamData(
out.get(), qpdf_ef_normalize, qpdf_dl_generalized);
}
@ -503,7 +502,7 @@ test_8(QPDF& pdf, char const* arg2)
// This is a bogus way to use StreamDataProvider, but it does
// adequately test its functionality.
Provider* provider = new Provider(b);
auto p = PointerHolder<QPDFObjectHandle::StreamDataProvider>(provider);
auto p = std::shared_ptr<QPDFObjectHandle::StreamDataProvider>(provider);
qstream.replaceStreamData(
p,
QPDFObjectHandle::newName("/FlateDecode"),
@ -532,7 +531,7 @@ test_9(QPDF& pdf, char const* arg2)
{
QPDFObjectHandle root = pdf.getRoot();
// Explicitly exercise the Buffer version of newStream
auto buf = make_pointer_holder<Buffer>(20U);
auto buf = std::make_shared<Buffer>(20U);
unsigned char* bp = buf->getBuffer();
memcpy(bp, "data for new stream\n", 20); // no null!
QPDFObjectHandle qstream = QPDFObjectHandle::newStream(&pdf, buf);
@ -581,8 +580,8 @@ test_11(QPDF& pdf, char const* arg2)
{
QPDFObjectHandle root = pdf.getRoot();
QPDFObjectHandle qstream = root.getKey("/QStream");
PointerHolder<Buffer> b1 = qstream.getStreamData();
PointerHolder<Buffer> b2 = qstream.getRawStreamData();
std::shared_ptr<Buffer> b1 = qstream.getStreamData();
std::shared_ptr<Buffer> b2 = qstream.getRawStreamData();
if ((b1->getSize() == 7) && (memcmp(b1->getBuffer(), "potato\n", 7) == 0)) {
std::cout << "filtered stream data okay" << std::endl;
}
@ -815,7 +814,7 @@ test_17(QPDF& pdf, char const* arg2)
QPDFObjectHandle(pages.at(1)).getKey("/Contents").getObjGen());
pdf.removePage(pages.at(0));
assert(pages.size() == 2);
PointerHolder<Buffer> b =
std::shared_ptr<Buffer> b =
QPDFObjectHandle(pages.at(0)).getKey("/Contents").getStreamData();
std::string contents = std::string(
reinterpret_cast<char const*>(b->getBuffer()), b->getSize());
@ -1039,7 +1038,7 @@ test_27(QPDF& pdf, char const* arg2)
// also exercise setImmediateCopyFrom.
// Create a provider. The provider stays in scope.
PointerHolder<QPDFObjectHandle::StreamDataProvider> p1;
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> p1;
{
// Local scope
Pl_Buffer pl("buffer");
@ -1065,7 +1064,7 @@ test_27(QPDF& pdf, char const* arg2)
// Make sure some source PDFs are out of scope when we
// write.
PointerHolder<QPDFObjectHandle::StreamDataProvider> p2;
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> p2;
// Create another provider. This one will go out of scope
// along with its containing qpdf, which has
// setImmediateCopyFrom(true).
@ -1266,7 +1265,7 @@ test_35(QPDF& pdf, char const* arg2)
{
// Extract attachments
std::map<std::string, PointerHolder<Buffer>> attachments;
std::map<std::string, std::shared_ptr<Buffer>> attachments;
QPDFObjectHandle root = pdf.getRoot();
QPDFObjectHandle names = root.getKey("/Names");
QPDFObjectHandle embeddedFiles = names.getKey("/EmbeddedFiles");
@ -1282,7 +1281,7 @@ test_35(QPDF& pdf, char const* arg2)
attachments[filename] = stream.getStreamData();
}
}
for (std::map<std::string, PointerHolder<Buffer>>::iterator iter =
for (std::map<std::string, std::shared_ptr<Buffer>>::iterator iter =
attachments.begin();
iter != attachments.end();
++iter) {
@ -1421,7 +1420,7 @@ test_41(QPDF& pdf, char const* arg2)
iter != pages.end();
++iter) {
(*iter).addContentTokenFilter(
PointerHolder<QPDFObjectHandle::TokenFilter>(new TokenFilter()));
std::shared_ptr<QPDFObjectHandle::TokenFilter>(new TokenFilter()));
}
QPDFWriter w(pdf, "a.pdf");
w.setQDFMode(true);
@ -2468,12 +2467,12 @@ test_68(QPDF& pdf, char const* arg2)
} catch (std::exception& e) {
std::cout << "get unfilterable stream: " << e.what() << std::endl;
}
PointerHolder<Buffer> b1 = qstream.getStreamData(qpdf_dl_all);
std::shared_ptr<Buffer> b1 = qstream.getStreamData(qpdf_dl_all);
if ((b1->getSize() > 10) &&
(memcmp(b1->getBuffer(), "wwwwwwwww", 9) == 0)) {
std::cout << "filtered stream data okay" << std::endl;
}
PointerHolder<Buffer> b2 = qstream.getRawStreamData();
std::shared_ptr<Buffer> b2 = qstream.getRawStreamData();
if ((b2->getSize() > 10) &&
(memcmp(
b2->getBuffer(), "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46", 10) ==
@ -2578,11 +2577,11 @@ test_72(QPDF& pdf, char const* arg2)
Pl_Buffer b("buffer");
if (i == 0) {
fx1.addContentTokenFilter(
PointerHolder<QPDFObjectHandle::TokenFilter>(
std::shared_ptr<QPDFObjectHandle::TokenFilter>(
new TokenFilter()));
} else {
fx1.getObjectHandle().addTokenFilter(
PointerHolder<QPDFObjectHandle::TokenFilter>(
std::shared_ptr<QPDFObjectHandle::TokenFilter>(
new TokenFilter()));
}
fx1.pipeContents(&b);
@ -2999,7 +2998,7 @@ test_83(QPDF& pdf, char const* arg2)
// partial = true, we just use qpdf --job-json-file.
QPDFJob j;
PointerHolder<char> file_buf;
std::shared_ptr<char> file_buf;
size_t size;
QUtil::read_file_into_memory(arg2, file_buf, size);
try {
@ -3201,7 +3200,7 @@ runtest(int n, char const* filename1, char const* arg2)
}
QPDF pdf;
PointerHolder<char> file_buf;
std::shared_ptr<char> file_buf;
FILE* filep = 0;
if (n == 0) {
pdf.setAttemptRecovery(false);

View File

@ -231,7 +231,7 @@ create_pdf(char const* filename)
image_dict.replaceKey("/Width", newInteger(width));
image_dict.replaceKey("/Height", newInteger(height));
ImageProvider* p = new ImageProvider(pageno);
PointerHolder<QPDFObjectHandle::StreamDataProvider> provider(p);
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
image.replaceStreamData(
provider, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull());
@ -265,7 +265,7 @@ create_pdf(char const* filename)
static void
check_page_contents(size_t pageno, QPDFObjectHandle page)
{
PointerHolder<Buffer> buf = page.getKey("/Contents").getStreamData();
std::shared_ptr<Buffer> buf = page.getKey("/Contents").getStreamData();
std::string actual_contents =
std::string(reinterpret_cast<char*>(buf->getBuffer()), buf->getSize());
std::string expected_contents = generate_page_contents(pageno);

View File

@ -25,7 +25,7 @@ usage()
class Finder: public InputSource::Finder
{
public:
Finder(PointerHolder<InputSource> is, std::string const& str) :
Finder(std::shared_ptr<InputSource> is, std::string const& str) :
is(is),
str(str)
{
@ -36,7 +36,7 @@ class Finder: public InputSource::Finder
virtual bool check();
private:
PointerHolder<InputSource> is;
std::shared_ptr<InputSource> is;
std::string str;
};
@ -117,7 +117,7 @@ sanitize(std::string const& value)
static void
try_skipping(
QPDFTokenizer& tokenizer,
PointerHolder<InputSource> is,
std::shared_ptr<InputSource> is,
size_t max_len,
char const* what,
Finder& f)
@ -132,7 +132,7 @@ try_skipping(
static void
dump_tokens(
PointerHolder<InputSource> is,
std::shared_ptr<InputSource> is,
std::string const& label,
size_t max_len,
bool include_ignorable,
@ -191,12 +191,12 @@ dump_tokens(
static void
process(char const* filename, bool include_ignorable, size_t max_len)
{
PointerHolder<InputSource> is;
std::shared_ptr<InputSource> is;
// Tokenize file, skipping streams
FileInputSource* fis = new FileInputSource();
fis->setFilename(filename);
is = PointerHolder<InputSource>(fis);
is = std::shared_ptr<InputSource>(fis);
dump_tokens(is, "FILE", max_len, include_ignorable, true, false);
// Tokenize content streams, skipping inline images
@ -214,7 +214,7 @@ process(char const* filename, bool include_ignorable, size_t max_len)
auto content_data = plb.getBufferSharedPointer();
BufferInputSource* bis =
new BufferInputSource("content data", content_data.get());
is = PointerHolder<InputSource>(bis);
is = std::shared_ptr<InputSource>(bis);
dump_tokens(
is,
"PAGE " + QUtil::int_to_string(pageno),
@ -231,11 +231,11 @@ process(char const* filename, bool include_ignorable, size_t max_len)
++iter) {
if ((*iter).isStream() && (*iter).getDict().getKey("/Type").isName() &&
(*iter).getDict().getKey("/Type").getName() == "/ObjStm") {
PointerHolder<Buffer> b =
std::shared_ptr<Buffer> b =
(*iter).getStreamData(qpdf_dl_specialized);
BufferInputSource* bis =
new BufferInputSource("object stream data", b.get());
is = PointerHolder<InputSource>(bis);
is = std::shared_ptr<InputSource>(bis);
dump_tokens(
is,
"OBJECT STREAM " + QUtil::int_to_string((*iter).getObjectID()),

View File

@ -59,8 +59,8 @@ main(int argc, char* argv[])
QUtil::binary_stdout();
QUtil::binary_stdin();
auto out = make_pointer_holder<Pl_StdioFile>("stdout", stdout);
auto flate = make_pointer_holder<Pl_Flate>("flate", out.get(), action);
auto out = std::make_shared<Pl_StdioFile>("stdout", stdout);
auto flate = std::make_shared<Pl_Flate>("flate", out.get(), action);
bool warn = false;
flate->setWarnCallback([&warn](char const* msg, int code) {
warn = true;