aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFEFStreamObjectHelper.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-02 23:14:10 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-04 14:10:40 +0200
commit12f1eb15ca3fed6310402847559a7c99d3c77847 (patch)
tree8935675b623c6f3b4914b8b44f7fa5f2816a9241 /libqpdf/QPDFEFStreamObjectHelper.cc
parentf20fa61eb4c323eb1642c69c236b3d9a1f8b2cdb (diff)
downloadqpdf-12f1eb15ca3fed6310402847559a7c99d3c77847.tar.zst
Programmatically apply new formatting to code
Run this: for i in **/*.cc **/*.c **/*.h **/*.hh; do clang-format < $i >| $i.new && mv $i.new $i done
Diffstat (limited to 'libqpdf/QPDFEFStreamObjectHelper.cc')
-rw-r--r--libqpdf/QPDFEFStreamObjectHelper.cc55
1 files changed, 20 insertions, 35 deletions
diff --git a/libqpdf/QPDFEFStreamObjectHelper.cc b/libqpdf/QPDFEFStreamObjectHelper.cc
index ef44c1c1..de11e30f 100644
--- a/libqpdf/QPDFEFStreamObjectHelper.cc
+++ b/libqpdf/QPDFEFStreamObjectHelper.cc
@@ -1,13 +1,12 @@
#include <qpdf/QPDFEFStreamObjectHelper.hh>
-#include <qpdf/QIntC.hh>
-#include <qpdf/QUtil.hh>
#include <qpdf/Pl_Count.hh>
-#include <qpdf/Pl_MD5.hh>
#include <qpdf/Pl_Discard.hh>
+#include <qpdf/Pl_MD5.hh>
+#include <qpdf/QIntC.hh>
+#include <qpdf/QUtil.hh>
-QPDFEFStreamObjectHelper::QPDFEFStreamObjectHelper(
- QPDFObjectHandle oh) :
+QPDFEFStreamObjectHelper::QPDFEFStreamObjectHelper(QPDFObjectHandle oh) :
QPDFObjectHelper(oh),
m(new Members())
{
@@ -21,8 +20,7 @@ QPDFObjectHandle
QPDFEFStreamObjectHelper::getParam(std::string const& pkey)
{
auto params = this->oh.getDict().getKey("/Params");
- if (params.isDictionary())
- {
+ if (params.isDictionary()) {
return params.getKey(pkey);
}
return QPDFObjectHandle::newNull();
@@ -33,8 +31,7 @@ QPDFEFStreamObjectHelper::setParam(
std::string const& pkey, QPDFObjectHandle const& pval)
{
auto params = this->oh.getDict().getKey("/Params");
- if (! params.isDictionary())
- {
+ if (!params.isDictionary()) {
params = QPDFObjectHandle::newDictionary();
this->oh.getDict().replaceKey("/Params", params);
}
@@ -45,8 +42,7 @@ std::string
QPDFEFStreamObjectHelper::getCreationDate()
{
auto val = getParam("/CreationDate");
- if (val.isString())
- {
+ if (val.isString()) {
return val.getUTF8Value();
}
return "";
@@ -56,8 +52,7 @@ std::string
QPDFEFStreamObjectHelper::getModDate()
{
auto val = getParam("/ModDate");
- if (val.isString())
- {
+ if (val.isString()) {
return val.getUTF8Value();
}
return "";
@@ -67,8 +62,7 @@ size_t
QPDFEFStreamObjectHelper::getSize()
{
auto val = getParam("/Size");
- if (val.isInteger())
- {
+ if (val.isInteger()) {
return QIntC::to_size(val.getUIntValueAsUInt());
}
return 0;
@@ -78,11 +72,9 @@ std::string
QPDFEFStreamObjectHelper::getSubtype()
{
auto val = this->oh.getDict().getKey("/Subtype");
- if (val.isName())
- {
+ if (val.isName()) {
auto n = val.getName();
- if (n.length() > 1)
- {
+ if (n.length() > 1) {
return n.substr(1);
}
}
@@ -93,23 +85,20 @@ std::string
QPDFEFStreamObjectHelper::getChecksum()
{
auto val = getParam("/CheckSum");
- if (val.isString())
- {
+ if (val.isString()) {
return val.getStringValue();
}
return "";
}
QPDFEFStreamObjectHelper
-QPDFEFStreamObjectHelper::createEFStream(
- QPDF& qpdf, PointerHolder<Buffer> data)
+QPDFEFStreamObjectHelper::createEFStream(QPDF& qpdf, PointerHolder<Buffer> data)
{
return newFromStream(QPDFObjectHandle::newStream(&qpdf, data));
}
QPDFEFStreamObjectHelper
-QPDFEFStreamObjectHelper::createEFStream(
- QPDF& qpdf, std::string const& data)
+QPDFEFStreamObjectHelper::createEFStream(QPDF& qpdf, std::string const& data)
{
return newFromStream(QPDFObjectHandle::newStream(&qpdf, data));
}
@@ -119,9 +108,8 @@ QPDFEFStreamObjectHelper::createEFStream(
QPDF& qpdf, std::function<void(Pipeline*)> provider)
{
auto stream = QPDFObjectHandle::newStream(&qpdf);
- stream.replaceStreamData(provider,
- QPDFObjectHandle::newNull(),
- QPDFObjectHandle::newNull());
+ stream.replaceStreamData(
+ provider, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull());
return newFromStream(stream);
}
@@ -156,18 +144,15 @@ QPDFEFStreamObjectHelper::newFromStream(QPDFObjectHandle stream)
Pl_Discard discard;
Pl_MD5 md5("EF md5", &discard);
Pl_Count count("EF size", &md5);
- if (! stream.pipeStreamData(&count, nullptr, 0, qpdf_dl_all))
- {
+ if (!stream.pipeStreamData(&count, nullptr, 0, qpdf_dl_all)) {
stream.warnIfPossible(
"unable to get stream data for new embedded file stream");
- }
- else
- {
+ } else {
result.setParam(
"/Size", QPDFObjectHandle::newInteger(count.getCount()));
result.setParam(
- "/CheckSum", QPDFObjectHandle::newString(
- QUtil::hex_decode(md5.getHexDigest())));
+ "/CheckSum",
+ QPDFObjectHandle::newString(QUtil::hex_decode(md5.getHexDigest())));
}
return result;
}