aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_encryption.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 /libqpdf/QPDF_encryption.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 'libqpdf/QPDF_encryption.cc')
-rw-r--r--libqpdf/QPDF_encryption.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc
index fff35c67..54c2dadc 100644
--- a/libqpdf/QPDF_encryption.cc
+++ b/libqpdf/QPDF_encryption.cc
@@ -1238,7 +1238,7 @@ QPDF::decryptStream(PointerHolder<EncryptionParameters> encp,
QPDF& qpdf_for_warning, Pipeline*& pipeline,
int objid, int generation,
QPDFObjectHandle& stream_dict,
- std::vector<PointerHolder<Pipeline> >& heap)
+ std::vector<std::shared_ptr<Pipeline>>& heap)
{
std::string type;
if (stream_dict.getKey("/Type").isName())
@@ -1343,21 +1343,25 @@ QPDF::decryptStream(PointerHolder<EncryptionParameters> encp,
}
}
std::string key = getKeyForObject(encp, objid, generation, use_aes);
+ std::shared_ptr<Pipeline> new_pipeline;
if (use_aes)
{
QTC::TC("qpdf", "QPDF_encryption aes decode stream");
- pipeline = new Pl_AES_PDF("AES stream decryption", pipeline,
- false, QUtil::unsigned_char_pointer(key),
- key.length());
+ new_pipeline = std::make_shared<Pl_AES_PDF>(
+ "AES stream decryption", pipeline,
+ false, QUtil::unsigned_char_pointer(key),
+ key.length());
}
else
{
QTC::TC("qpdf", "QPDF_encryption rc4 decode stream");
- pipeline = new Pl_RC4("RC4 stream decryption", pipeline,
- QUtil::unsigned_char_pointer(key),
- toI(key.length()));
+ new_pipeline = std::make_shared<Pl_RC4>(
+ "RC4 stream decryption", pipeline,
+ QUtil::unsigned_char_pointer(key),
+ toI(key.length()));
}
- heap.push_back(pipeline);
+ pipeline = new_pipeline.get();
+ heap.push_back(new_pipeline);
}
void