aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pdf-create.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-04 17:03:52 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-04 19:12:37 +0100
commitabc300f05c00de72081203d89d9065b25f1ccb3c (patch)
tree3a679f3f3feb43a5ca3af536fb89832b0dd6e7b7 /examples/pdf-create.cc
parentf0c2e0ef1e2b10b19fea60d5e6580910a92092e1 (diff)
downloadqpdf-abc300f05c00de72081203d89d9065b25f1ccb3c.tar.zst
Replace containers of PointerHolder with containers of std::shared_ptr
None of these are in the public API.
Diffstat (limited to 'examples/pdf-create.cc')
-rw-r--r--examples/pdf-create.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc
index 199584fe..52f02a0d 100644
--- a/examples/pdf-create.cc
+++ b/examples/pdf-create.cc
@@ -16,6 +16,7 @@
#include <qpdf/Pl_DCT.hh>
#include <qpdf/QIntC.hh>
#include <iostream>
+#include <memory>
#include <string.h>
#include <stdlib.h>
@@ -105,22 +106,25 @@ void
ImageProvider::provideStreamData(int objid, int generation,
Pipeline* pipeline)
{
- std::vector<PointerHolder<Pipeline> > to_delete;
+ std::vector<std::shared_ptr<Pipeline>> to_delete;
Pipeline* p = pipeline;
+ std::shared_ptr<Pipeline> p_new;
if (filter == "/DCTDecode")
{
- p = new Pl_DCT(
+ p_new = std::make_shared<Pl_DCT>(
"image encoder", pipeline,
QIntC::to_uint(width), QIntC::to_uint(getHeight()),
QIntC::to_int(stripes[0].length()), j_color_space);
- to_delete.push_back(p);
+ to_delete.push_back(p_new);
+ p = p_new.get();
}
else if (filter == "/RunLengthDecode")
{
- p = new Pl_RunLength(
+ p_new = std::make_shared<Pl_RunLength>(
"image encoder", pipeline, Pl_RunLength::a_encode);
- to_delete.push_back(p);
+ to_delete.push_back(p_new);
+ p = p_new.get();
}
for (size_t i = 0; i < n_stripes; ++i)