diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-04-02 23:14:10 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-04-04 14:10:40 +0200 |
commit | 12f1eb15ca3fed6310402847559a7c99d3c77847 (patch) | |
tree | 8935675b623c6f3b4914b8b44f7fa5f2816a9241 /libtests/flate.cc | |
parent | f20fa61eb4c323eb1642c69c236b3d9a1f8b2cdb (diff) | |
download | qpdf-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 'libtests/flate.cc')
-rw-r--r-- | libtests/flate.cc | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/libtests/flate.cc b/libtests/flate.cc index 058b956e..77fb440e 100644 --- a/libtests/flate.cc +++ b/libtests/flate.cc @@ -1,15 +1,16 @@ +#include <qpdf/Pl_Count.hh> #include <qpdf/Pl_Flate.hh> #include <qpdf/Pl_StdioFile.hh> -#include <qpdf/Pl_Count.hh> #include <qpdf/QUtil.hh> -#include <iostream> #include <errno.h> -#include <string.h> +#include <iostream> #include <stdlib.h> +#include <string.h> -void run(char const* filename) +void +run(char const* filename) { std::string n1 = std::string(filename) + ".1"; std::string n2 = std::string(filename) + ".2"; @@ -38,8 +39,7 @@ void run(char const* filename) FILE* in1 = QUtil::safe_fopen(filename, "rb"); unsigned char buf[1024]; size_t len; - while ((len = fread(buf, 1, sizeof(buf), in1)) > 0) - { + while ((len = fread(buf, 1, sizeof(buf), in1)) > 0) { // Write to the compression pipeline def1->write(buf, len); @@ -57,7 +57,6 @@ void run(char const* filename) std::cout << "bytes written to o3: " << count3->getCount() << std::endl; - delete def3; delete inf3; delete count3; @@ -66,8 +65,7 @@ void run(char const* filename) // Now read the compressed data and write to the output uncompress pipeline FILE* in2 = QUtil::safe_fopen(n1.c_str(), "rb"); - while ((len = fread(buf, 1, sizeof(buf), in2)) > 0) - { + while ((len = fread(buf, 1, sizeof(buf), in2)) > 0) { inf2->write(buf, len); } fclose(in2); @@ -83,21 +81,18 @@ void run(char const* filename) std::cout << "done" << std::endl; } -int main(int argc, char* argv[]) +int +main(int argc, char* argv[]) { - if (argc != 2) - { + if (argc != 2) { std::cerr << "Usage: pipeline filename" << std::endl; exit(2); } char* filename = argv[1]; - try - { + try { run(filename); - } - catch (std::exception& e) - { + } catch (std::exception& e) { std::cout << e.what() << std::endl; } return 0; |