aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/Pl_MD5.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/Pl_MD5.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/Pl_MD5.cc')
-rw-r--r--libqpdf/Pl_MD5.cc18
1 files changed, 6 insertions, 12 deletions
diff --git a/libqpdf/Pl_MD5.cc b/libqpdf/Pl_MD5.cc
index 9bffa2a6..95e0a8d6 100644
--- a/libqpdf/Pl_MD5.cc
+++ b/libqpdf/Pl_MD5.cc
@@ -17,10 +17,8 @@ Pl_MD5::~Pl_MD5()
void
Pl_MD5::write(unsigned char* buf, size_t len)
{
- if (this->enabled)
- {
- if (! this->in_progress)
- {
+ if (this->enabled) {
+ if (!this->in_progress) {
this->md5.reset();
this->in_progress = true;
}
@@ -30,8 +28,7 @@ Pl_MD5::write(unsigned char* buf, size_t len)
static size_t const max_bytes = 1 << 30;
size_t bytes_left = len;
unsigned char* data = buf;
- while (bytes_left > 0)
- {
+ while (bytes_left > 0) {
size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
this->md5.encodeDataIncrementally(
reinterpret_cast<char*>(data), bytes);
@@ -47,8 +44,7 @@ void
Pl_MD5::finish()
{
this->getNext()->finish();
- if (! this->persist_across_finish)
- {
+ if (!this->persist_across_finish) {
this->in_progress = false;
}
}
@@ -68,10 +64,8 @@ Pl_MD5::persistAcrossFinish(bool persist)
std::string
Pl_MD5::getHexDigest()
{
- if (! this->enabled)
- {
- throw std::logic_error(
- "digest requested for a disabled MD5 Pipeline");
+ if (!this->enabled) {
+ throw std::logic_error("digest requested for a disabled MD5 Pipeline");
}
this->in_progress = false;
return this->md5.unparse();