aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/lzw.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 /libtests/lzw.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 'libtests/lzw.cc')
-rw-r--r--libtests/lzw.cc26
1 files changed, 9 insertions, 17 deletions
diff --git a/libtests/lzw.cc b/libtests/lzw.cc
index 1c87045b..788d3dfc 100644
--- a/libtests/lzw.cc
+++ b/libtests/lzw.cc
@@ -6,23 +6,21 @@
#include <stdlib.h>
#include <string.h>
-int main(int argc, char* argv[])
+int
+main(int argc, char* argv[])
{
bool early_code_change = true;
- if ((argc == 4) && (strcmp(argv[3], "--no-early-code-change") == 0))
- {
+ if ((argc == 4) && (strcmp(argv[3], "--no-early-code-change") == 0)) {
early_code_change = false;
}
- if (argc < 3)
- {
+ if (argc < 3) {
std::cerr << "Usage: lzw infile outfile [ --no-early-code-change ]"
<< std::endl;
exit(2);
}
- try
- {
+ try {
char* infilename = argv[1];
char* outfilename = argv[2];
@@ -34,22 +32,16 @@ int main(int argc, char* argv[])
unsigned char buf[10000];
bool done = false;
- while (! done)
- {
+ while (!done) {
size_t len = fread(buf, 1, sizeof(buf), infile);
- if (len <= 0)
- {
+ if (len <= 0) {
done = true;
- }
- else
- {
+ } else {
decode.write(buf, len);
}
}
decode.finish();
- }
- catch (std::exception& e)
- {
+ } catch (std::exception& e) {
std::cerr << e.what() << std::endl;
exit(2);
}