From cb769c62e55599e9f980001830bc61d9fcaa64a9 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 8 Feb 2022 09:18:08 -0500 Subject: WHITESPACE ONLY -- expand tabs in source code This comment expands all tabs using an 8-character tab-width. You should ignore this commit when using git blame or use git blame -w. In the early days, I used to use tabs where possible for indentation, since emacs did this automatically. In recent years, I have switched to only using spaces, which means qpdf source code has been a mixture of spaces and tabs. I have avoided cleaning this up because of not wanting gratuitous whitespaces change to cloud the output of git blame, but I changed my mind after discussing with users who view qpdf source code in editors/IDEs that have other tab widths by default and in light of the fact that I am planning to start applying automatic code formatting soon. --- libtests/aes.cc | 32 +++++----- libtests/ascii85.cc | 34 +++++----- libtests/bits.cc | 30 ++++----- libtests/buffer.cc | 96 ++++++++++++++-------------- libtests/cxx11.cc | 2 +- libtests/dct_compress.cc | 18 +++--- libtests/dct_uncompress.cc | 22 +++---- libtests/flate.cc | 18 +++--- libtests/hex.cc | 34 +++++----- libtests/lzw.cc | 60 +++++++++--------- libtests/main_from_wmain.cc | 6 +- libtests/md5.cc | 26 ++++---- libtests/numrange.cc | 2 +- libtests/pointer_holder.cc | 50 +++++++-------- libtests/predictors.cc | 44 ++++++------- libtests/qtest/ascii85.test | 14 ++--- libtests/qtest/bits.test | 8 +-- libtests/qtest/buffer.test | 8 +-- libtests/qtest/cxx11.test | 8 +-- libtests/qtest/flate.test | 24 +++---- libtests/qtest/hex.test | 12 ++-- libtests/qtest/input_source.test | 6 +- libtests/qtest/json.test | 4 +- libtests/qtest/lzw.test | 20 +++--- libtests/qtest/matrix.test | 4 +- libtests/qtest/nntree.test | 6 +- libtests/qtest/ph.test | 8 +-- libtests/qtest/predictors.test | 48 +++++++------- libtests/qtest/qintc.test | 8 +-- libtests/qtest/qutil.test | 8 +-- libtests/qtest/sparse_array.test | 4 +- libtests/qutil.cc | 132 +++++++++++++++++++-------------------- libtests/rc4.cc | 34 +++++----- libtests/runlength.cc | 22 +++---- 34 files changed, 426 insertions(+), 426 deletions(-) (limited to 'libtests') diff --git a/libtests/aes.cc b/libtests/aes.cc index 26906d46..71348744 100644 --- a/libtests/aes.cc +++ b/libtests/aes.cc @@ -96,13 +96,13 @@ int main(int argc, char* argv[]) unsigned char* key = new unsigned char[keylen]; for (unsigned int i = 0; i < strlen(hexkey); i += 2) { - char t[3]; - t[0] = hexkey[i]; - t[1] = hexkey[i + 1]; - t[2] = '\0'; + char t[3]; + t[0] = hexkey[i]; + t[1] = hexkey[i + 1]; + t[2] = '\0'; - long val = strtol(t, 0, 16); - key[i/2] = static_cast(val); + long val = strtol(t, 0, 16); + key[i/2] = static_cast(val); } Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile); @@ -111,7 +111,7 @@ int main(int argc, char* argv[]) key = 0; if (! cbc_mode) { - aes->disableCBC(); + aes->disableCBC(); } if (zero_iv) { @@ -131,15 +131,15 @@ int main(int argc, char* argv[]) bool done = false; while (! done) { - size_t len = fread(buf, 1, sizeof(buf), infile); - if (len <= 0) - { - done = true; - } - else - { - aes->write(buf, len); - } + size_t len = fread(buf, 1, sizeof(buf), infile); + if (len <= 0) + { + done = true; + } + else + { + aes->write(buf, len); + } } aes->finish(); delete aes; diff --git a/libtests/ascii85.cc b/libtests/ascii85.cc index 7fd7f69b..91f3b7f5 100644 --- a/libtests/ascii85.cc +++ b/libtests/ascii85.cc @@ -11,26 +11,26 @@ int main() try { - unsigned char buf[10000]; - bool done = false; - while (! done) - { - size_t len = fread(buf, 1, sizeof(buf), stdin); - if (len <= 0) - { - done = true; - } - else - { - decode.write(buf, len); - } - } - decode.finish(); + unsigned char buf[10000]; + bool done = false; + while (! done) + { + size_t len = fread(buf, 1, sizeof(buf), stdin); + if (len <= 0) + { + done = true; + } + else + { + decode.write(buf, len); + } + } + decode.finish(); } catch (std::exception& e) { - std::cerr << e.what() << std::endl; - exit(2); + std::cerr << e.what() << std::endl; + exit(2); } return 0; diff --git a/libtests/bits.cc b/libtests/bits.cc index 1dfd42ed..55075f85 100644 --- a/libtests/bits.cc +++ b/libtests/bits.cc @@ -15,29 +15,29 @@ static void print_values(long long byte_offset, size_t bit_offset, - size_t bits_available) + size_t bits_available) { std::cout << "byte offset = " << byte_offset << ", " - << "bit offset = " << bit_offset << ", " - << "bits available = " << bits_available << std::endl; + << "bit offset = " << bit_offset << ", " + << "bits available = " << bits_available << std::endl; } static void test_read_bits(unsigned char const* buf, - unsigned char const*& p, size_t& bit_offset, - size_t& bits_available, size_t bits_wanted) + unsigned char const*& p, size_t& bit_offset, + size_t& bits_available, size_t bits_wanted) { unsigned long result = - QIntC::to_ulong(read_bits(p, bit_offset, bits_available, bits_wanted)); + QIntC::to_ulong(read_bits(p, bit_offset, bits_available, bits_wanted)); std::cout << "bits read: " << bits_wanted << ", result = " << result - << std::endl; + << std::endl; print_values(p - buf, bit_offset, bits_available); } static void test_write_bits(unsigned char& ch, size_t& bit_offset, unsigned long val, - size_t bits, Pl_Buffer* bp) + size_t bits, Pl_Buffer* bp) { write_bits(ch, bit_offset, val, bits, bp); std::cout << "ch = " << QUtil::uint_to_string_base(ch, 16, 2) @@ -69,7 +69,7 @@ test() // Read tests static unsigned char const buf[] = { - 0xF5, 0x15, 0x65, 0x79, 0x12, 0x89, 0x75, 0x4B + 0xF5, 0x15, 0x65, 0x79, 0x12, 0x89, 0x75, 0x4B }; unsigned char const* p = buf; @@ -91,12 +91,12 @@ test() try { - test_read_bits(buf, p, bit_offset, bits_available, 4); + test_read_bits(buf, p, bit_offset, bits_available, 4); } catch (std::exception& e) { - std::cout << "exception: " << e.what() << std::endl; - print_values(p - buf, bit_offset, bits_available); + std::cout << "exception: " << e.what() << std::endl; + print_values(p - buf, bit_offset, bits_available); } test_read_bits(buf, p, bit_offset, bits_available, 3); @@ -183,12 +183,12 @@ int main() { try { - test(); + test(); } catch (std::exception& e) { - std::cout << "unexpected exception: " << e.what() << std::endl; - exit(2); + std::cout << "unexpected exception: " << e.what() << std::endl; + exit(2); } std::cout << "done" << std::endl; return 0; diff --git a/libtests/buffer.cc b/libtests/buffer.cc index 23d82e7b..ea36a807 100644 --- a/libtests/buffer.cc +++ b/libtests/buffer.cc @@ -36,54 +36,54 @@ int main() try { - Pl_Discard discard; - Pl_Count count("count", &discard); - Pl_Buffer bp1("bp1", &count); - bp1.write(uc("12345"), 5); - bp1.write(uc("67890"), 5); - bp1.finish(); - std::cout << "count: " << count.getCount() << std::endl; - bp1.write(uc("abcde"), 5); - bp1.write(uc("fghij"), 6); - bp1.finish(); - std::cout << "count: " << count.getCount() << std::endl; - Buffer* b = bp1.getBuffer(); - std::cout << "size: " << b->getSize() << std::endl; - std::cout << "data: " << b->getBuffer() << std::endl; - delete b; - bp1.write(uc("qwert"), 5); - bp1.write(uc("yuiop"), 6); - bp1.finish(); - std::cout << "count: " << count.getCount() << std::endl; - b = bp1.getBuffer(); - std::cout << "size: " << b->getSize() << std::endl; - std::cout << "data: " << b->getBuffer() << std::endl; - delete b; + Pl_Discard discard; + Pl_Count count("count", &discard); + Pl_Buffer bp1("bp1", &count); + bp1.write(uc("12345"), 5); + bp1.write(uc("67890"), 5); + bp1.finish(); + std::cout << "count: " << count.getCount() << std::endl; + bp1.write(uc("abcde"), 5); + bp1.write(uc("fghij"), 6); + bp1.finish(); + std::cout << "count: " << count.getCount() << std::endl; + Buffer* b = bp1.getBuffer(); + std::cout << "size: " << b->getSize() << std::endl; + std::cout << "data: " << b->getBuffer() << std::endl; + delete b; + bp1.write(uc("qwert"), 5); + bp1.write(uc("yuiop"), 6); + bp1.finish(); + std::cout << "count: " << count.getCount() << std::endl; + b = bp1.getBuffer(); + std::cout << "size: " << b->getSize() << std::endl; + std::cout << "data: " << b->getBuffer() << std::endl; + delete b; - Pl_Buffer bp2("bp2"); - bp2.write(uc("moo"), 3); - bp2.write(uc("quack"), 6); - try - { - delete bp2.getBuffer(); - } - catch (std::exception& e) - { - std::cout << e.what() << std::endl; - } - bp2.finish(); - b = bp2.getBuffer(); - std::cout << "size: " << b->getSize() << std::endl; - std::cout << "data: " << b->getBuffer() << std::endl; - delete b; + Pl_Buffer bp2("bp2"); + bp2.write(uc("moo"), 3); + bp2.write(uc("quack"), 6); + try + { + delete bp2.getBuffer(); + } + catch (std::exception& e) + { + std::cout << e.what() << std::endl; + } + bp2.finish(); + b = bp2.getBuffer(); + std::cout << "size: " << b->getSize() << std::endl; + std::cout << "data: " << b->getBuffer() << std::endl; + delete b; - unsigned char lbuf[10]; - Buffer b1(lbuf, 10); - if (! ((b1.getBuffer() == lbuf) && - (b1.getSize() == 10))) - { - throw std::logic_error("hand-created buffer is not as expected"); - } + unsigned char lbuf[10]; + Buffer b1(lbuf, 10); + if (! ((b1.getBuffer() == lbuf) && + (b1.getSize() == 10))) + { + throw std::logic_error("hand-created buffer is not as expected"); + } Pl_Buffer bp3("bp3"); b = bp3.getBuffer(); @@ -127,8 +127,8 @@ int main() } catch (std::exception& e) { - std::cout << "unexpected exception: " << e.what() << std::endl; - exit(2); + std::cout << "unexpected exception: " << e.what() << std::endl; + exit(2); } std::cout << "done" << std::endl; diff --git a/libtests/cxx11.cc b/libtests/cxx11.cc index 20a5134f..bc14b5c0 100644 --- a/libtests/cxx11.cc +++ b/libtests/cxx11.cc @@ -344,7 +344,7 @@ void do_regex() s.clear(); for (std::sregex_iterator iter = m1; iter != m2; ++iter) { - std::smatch const& match2 = *iter; + std::smatch const& match2 = *iter; s += match2[0].str() + "|"; } assert("234|9453|423|" == s); diff --git a/libtests/dct_compress.cc b/libtests/dct_compress.cc index 590af57f..2a583ffd 100644 --- a/libtests/dct_compress.cc +++ b/libtests/dct_compress.cc @@ -76,15 +76,15 @@ int main(int argc, char* argv[]) Pl_DCT dct("dct", &out, width, height, components, cs, &callback); while (! done) { - size_t len = fread(buf, 1, sizeof(buf), infile); - if (len <= 0) - { - done = true; - } - else - { - dct.write(buf, len); - } + size_t len = fread(buf, 1, sizeof(buf), infile); + if (len <= 0) + { + done = true; + } + else + { + dct.write(buf, len); + } } dct.finish(); if (! callback.called) diff --git a/libtests/dct_uncompress.cc b/libtests/dct_uncompress.cc index 1ab1ae21..dd366852 100644 --- a/libtests/dct_uncompress.cc +++ b/libtests/dct_uncompress.cc @@ -11,9 +11,9 @@ int main(int argc, char* argv[]) { if (argc != 3) { - std::cerr << "Usage: dct_uncompress infile outfile" + std::cerr << "Usage: dct_uncompress infile outfile" << std::endl; - exit(2); + exit(2); } char* infilename = argv[1]; @@ -27,15 +27,15 @@ int main(int argc, char* argv[]) Pl_DCT dct("dct", &out); while (! done) { - size_t len = fread(buf, 1, sizeof(buf), infile); - if (len <= 0) - { - done = true; - } - else - { - dct.write(buf, len); - } + size_t len = fread(buf, 1, sizeof(buf), infile); + if (len <= 0) + { + done = true; + } + else + { + dct.write(buf, len); + } } dct.finish(); fclose(infile); diff --git a/libtests/flate.cc b/libtests/flate.cc index 3da056ed..058b956e 100644 --- a/libtests/flate.cc +++ b/libtests/flate.cc @@ -40,11 +40,11 @@ void run(char const* filename) size_t len; while ((len = fread(buf, 1, sizeof(buf), in1)) > 0) { - // Write to the compression pipeline - def1->write(buf, len); + // Write to the compression pipeline + def1->write(buf, len); - // Write to the both pipeline - def3->write(buf, len); + // Write to the both pipeline + def3->write(buf, len); } fclose(in1); @@ -68,7 +68,7 @@ void run(char const* filename) FILE* in2 = QUtil::safe_fopen(n1.c_str(), "rb"); while ((len = fread(buf, 1, sizeof(buf), in2)) > 0) { - inf2->write(buf, len); + inf2->write(buf, len); } fclose(in2); @@ -87,18 +87,18 @@ int main(int argc, char* argv[]) { if (argc != 2) { - std::cerr << "Usage: pipeline filename" << std::endl; - exit(2); + std::cerr << "Usage: pipeline filename" << std::endl; + exit(2); } char* filename = argv[1]; try { - run(filename); + run(filename); } catch (std::exception& e) { - std::cout << e.what() << std::endl; + std::cout << e.what() << std::endl; } return 0; } diff --git a/libtests/hex.cc b/libtests/hex.cc index 4e3eefde..0480c7ea 100644 --- a/libtests/hex.cc +++ b/libtests/hex.cc @@ -11,26 +11,26 @@ int main() try { - unsigned char buf[10000]; - bool done = false; - while (! done) - { - size_t len = fread(buf, 1, sizeof(buf), stdin); - if (len <= 0) - { - done = true; - } - else - { - decode.write(buf, len); - } - } - decode.finish(); + unsigned char buf[10000]; + bool done = false; + while (! done) + { + size_t len = fread(buf, 1, sizeof(buf), stdin); + if (len <= 0) + { + done = true; + } + else + { + decode.write(buf, len); + } + } + decode.finish(); } catch (std::exception& e) { - std::cerr << e.what() << std::endl; - exit(2); + std::cerr << e.what() << std::endl; + exit(2); } return 0; diff --git a/libtests/lzw.cc b/libtests/lzw.cc index 003c9217..1c87045b 100644 --- a/libtests/lzw.cc +++ b/libtests/lzw.cc @@ -11,47 +11,47 @@ int main(int argc, char* argv[]) bool early_code_change = true; if ((argc == 4) && (strcmp(argv[3], "--no-early-code-change") == 0)) { - early_code_change = false; + early_code_change = false; } if (argc < 3) { - std::cerr << "Usage: lzw infile outfile [ --no-early-code-change ]" - << std::endl; - exit(2); + std::cerr << "Usage: lzw infile outfile [ --no-early-code-change ]" + << std::endl; + exit(2); } try { - char* infilename = argv[1]; - char* outfilename = argv[2]; - - FILE* infile = QUtil::safe_fopen(infilename, "rb"); - FILE* outfile = QUtil::safe_fopen(outfilename, "wb"); - - Pl_StdioFile out("output", outfile); - Pl_LZWDecoder decode("decode", &out, early_code_change); - - unsigned char buf[10000]; - bool done = false; - while (! done) - { - size_t len = fread(buf, 1, sizeof(buf), infile); - if (len <= 0) - { - done = true; - } - else - { - decode.write(buf, len); - } - } - decode.finish(); + char* infilename = argv[1]; + char* outfilename = argv[2]; + + FILE* infile = QUtil::safe_fopen(infilename, "rb"); + FILE* outfile = QUtil::safe_fopen(outfilename, "wb"); + + Pl_StdioFile out("output", outfile); + Pl_LZWDecoder decode("decode", &out, early_code_change); + + unsigned char buf[10000]; + bool done = false; + while (! done) + { + size_t len = fread(buf, 1, sizeof(buf), infile); + if (len <= 0) + { + done = true; + } + else + { + decode.write(buf, len); + } + } + decode.finish(); } catch (std::exception& e) { - std::cerr << e.what() << std::endl; - exit(2); + std::cerr << e.what() << std::endl; + exit(2); } return 0; diff --git a/libtests/main_from_wmain.cc b/libtests/main_from_wmain.cc index 6b8a9c05..842db52e 100644 --- a/libtests/main_from_wmain.cc +++ b/libtests/main_from_wmain.cc @@ -42,12 +42,12 @@ int main(int argc, char* argv[]) #ifndef QPDF_NO_WCHAR_T try { - wmain_test(); - cwmain_test(); + wmain_test(); + cwmain_test(); } catch (std::exception& e) { - std::cout << "unexpected exception: " << e.what() << std::endl; + std::cout << "unexpected exception: " << e.what() << std::endl; } #endif // QPDF_NO_WCHAR_T diff --git a/libtests/md5.cc b/libtests/md5.cc index e88c1d66..04935804 100644 --- a/libtests/md5.cc +++ b/libtests/md5.cc @@ -20,9 +20,9 @@ int main(int, char*[]) test_string("message digest"); test_string("abcdefghijklmnopqrstuvwxyz"); test_string("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi" - "jklmnopqrstuvwxyz0123456789"); + "jklmnopqrstuvwxyz0123456789"); test_string("1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890"); + "1234567890123456789012345678901234567890"); MD5 a; a.encodeFile("md5.in"); std::cout << a.unparse() << std::endl; @@ -31,16 +31,16 @@ int main(int, char*[]) std::cout << b.unparse() << std::endl; std::cout - << MD5::checkDataChecksum("900150983cd24fb0d6963f7d28e17f72", "abc", 3) - << std::endl - << MD5::checkFileChecksum("5f4b4321873433daae578f85c72f9e74", "md5.in") - << std::endl - << MD5::checkFileChecksum("6f4b4321873433daae578f85c72f9e74", "md5.in") - << std::endl - << MD5::checkDataChecksum("000150983cd24fb0d6963f7d28e17f72", "abc", 3) - << std::endl - << MD5::checkFileChecksum("6f4b4321873433daae578f85c72f9e74", "glerbl") - << std::endl; + << MD5::checkDataChecksum("900150983cd24fb0d6963f7d28e17f72", "abc", 3) + << std::endl + << MD5::checkFileChecksum("5f4b4321873433daae578f85c72f9e74", "md5.in") + << std::endl + << MD5::checkFileChecksum("6f4b4321873433daae578f85c72f9e74", "md5.in") + << std::endl + << MD5::checkDataChecksum("000150983cd24fb0d6963f7d28e17f72", "abc", 3) + << std::endl + << MD5::checkFileChecksum("6f4b4321873433daae578f85c72f9e74", "glerbl") + << std::endl; Pl_Discard d; @@ -54,7 +54,7 @@ int main(int, char*[]) p2.persistAcrossFinish(true); for (int i = 0; i < 2; ++i) { - FILE* f = QUtil::safe_fopen("md5.in", "rb"); + FILE* f = QUtil::safe_fopen("md5.in", "rb"); // buffer size < size of md5.in unsigned char buf[50]; bool done = false; diff --git a/libtests/numrange.cc b/libtests/numrange.cc index 6cbb90ac..bc3a4036 100644 --- a/libtests/numrange.cc +++ b/libtests/numrange.cc @@ -28,7 +28,7 @@ int main(int argc, char* argv[]) } catch (std::exception& e) { - std::cout << e.what() << std::endl; + std::cout << e.what() << std::endl; return 2; } diff --git a/libtests/pointer_holder.cc b/libtests/pointer_holder.cc index 3db2241a..67c13d5a 100644 --- a/libtests/pointer_holder.cc +++ b/libtests/pointer_holder.cc @@ -70,35 +70,35 @@ int main(int argc, char* argv[]) ObjectHolder oh0; { - std::cout << "hello" << std::endl; - Object* o1 = new Object; - ObjectHolder oh1(o1); + std::cout << "hello" << std::endl; + Object* o1 = new Object; + ObjectHolder oh1(o1); std::cout << "oh1 refcount = " << oh1.getRefcount() << std::endl; - ObjectHolder oh2(oh1); + ObjectHolder oh2(oh1); std::cout << "oh1 refcount = " << oh1.getRefcount() << std::endl; std::cout << "oh2 refcount = " << oh2.use_count() << std::endl; - ObjectHolder oh3(new Object); - ObjectHolder oh4; - ObjectHolder oh5; + ObjectHolder oh3(new Object); + ObjectHolder oh4; + ObjectHolder oh5; std::cout << "oh5 refcount = " << oh5.getRefcount() << std::endl; - if (oh4 == oh5) - { - std::cout << "nulls equal" << std::endl; - } - oh3 = oh1; - oh4 = oh2; - if (oh3 == oh4) - { - std::cout << "equal okay" << std::endl; - } - if ((! (oh3 < oh4)) && (! (oh4 < oh3))) - { - std::cout << "less than okay" << std::endl; - } - ol1.push_back(oh3); - ol1.push_back(oh3); - Object* o3 = new Object; - oh0 = o3; + if (oh4 == oh5) + { + std::cout << "nulls equal" << std::endl; + } + oh3 = oh1; + oh4 = oh2; + if (oh3 == oh4) + { + std::cout << "equal okay" << std::endl; + } + if ((! (oh3 < oh4)) && (! (oh4 < oh3))) + { + std::cout << "less than okay" << std::endl; + } + ol1.push_back(oh3); + ol1.push_back(oh3); + Object* o3 = new Object; + oh0 = o3; PointerHolder oh6(new Object()); oh6->hello(); } diff --git a/libtests/predictors.cc b/libtests/predictors.cc index 9342e22c..d2c4863e 100644 --- a/libtests/predictors.cc +++ b/libtests/predictors.cc @@ -42,24 +42,24 @@ void run(char const* filename, char const* filter, size_t len; while (true) { - len = fread(buf, 1, (2 * columns) + 1, in); - if (len == 0) - { - break; - } - pl->write(buf, len); - len = fread(buf, 1, 1, in); - if (len == 0) - { - break; - } - pl->write(buf, len); - len = fread(buf, 1, 1, in); - if (len == 0) - { - break; - } - pl->write(buf, len); + len = fread(buf, 1, (2 * columns) + 1, in); + if (len == 0) + { + break; + } + pl->write(buf, len); + len = fread(buf, 1, 1, in); + if (len == 0) + { + break; + } + pl->write(buf, len); + len = fread(buf, 1, 1, in); + if (len == 0) + { + break; + } + pl->write(buf, len); } pl->finish(); @@ -75,10 +75,10 @@ int main(int argc, char* argv[]) { if (argc != 7) { - std::cerr << "Usage: predictor {png|tiff} {en,de}code filename" + std::cerr << "Usage: predictor {png|tiff} {en,de}code filename" << " columns samples-per-pixel bits-per-sample" << std::endl; - exit(2); + exit(2); } char* filter = argv[1]; bool encode = (strcmp(argv[2], "encode") == 0); @@ -89,14 +89,14 @@ int main(int argc, char* argv[]) try { - run(filename, filter, encode, + run(filename, filter, encode, QIntC::to_uint(columns), QIntC::to_uint(bits_per_sample), QIntC::to_uint(samples_per_pixel)); } catch (std::exception& e) { - std::cout << e.what() << std::endl; + std::cout << e.what() << std::endl; } return 0; } diff --git a/libtests/qtest/ascii85.test b/libtests/qtest/ascii85.test index 7ea3ee42..53977619 100644 --- a/libtests/qtest/ascii85.test +++ b/libtests/qtest/ascii85.test @@ -10,14 +10,14 @@ require TestDriver; my $td = new TestDriver('ascii85'); $td->runtest("decode", - {$td->COMMAND => "ascii85 < base85.in"}, - {$td->FILE => "binary.out", - $td->EXIT_STATUS => 0}); + {$td->COMMAND => "ascii85 < base85.in"}, + {$td->FILE => "binary.out", + $td->EXIT_STATUS => 0}); $td->runtest("partial decode", - {$td->COMMAND => "echo '\@<5skEHbu7\$3~>' | ascii85"}, - {$td->STRING => "asdfqwer\n", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "echo '\@<5skEHbu7\$3~>' | ascii85"}, + {$td->STRING => "asdfqwer\n", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); $td->report(2); diff --git a/libtests/qtest/bits.test b/libtests/qtest/bits.test index 08bee707..0fa3df6d 100644 --- a/libtests/qtest/bits.test +++ b/libtests/qtest/bits.test @@ -10,9 +10,9 @@ require TestDriver; my $td = new TestDriver('bits'); $td->runtest("bits", - {$td->COMMAND => "bits"}, - {$td->FILE => "bits.out", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "bits"}, + {$td->FILE => "bits.out", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); $td->report(1); diff --git a/libtests/qtest/buffer.test b/libtests/qtest/buffer.test index 38da9fc3..f19461e1 100644 --- a/libtests/qtest/buffer.test +++ b/libtests/qtest/buffer.test @@ -10,9 +10,9 @@ require TestDriver; my $td = new TestDriver('buffer'); $td->runtest("buffer", - {$td->COMMAND => "buffer"}, - {$td->FILE => "buffer.out", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "buffer"}, + {$td->FILE => "buffer.out", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); $td->report(1); diff --git a/libtests/qtest/cxx11.test b/libtests/qtest/cxx11.test index 5efbd87f..2ed9059d 100644 --- a/libtests/qtest/cxx11.test +++ b/libtests/qtest/cxx11.test @@ -8,9 +8,9 @@ require TestDriver; my $td = new TestDriver('c++-11'); $td->runtest("C++-11", - {$td->COMMAND => "cxx11"}, - {$td->STRING => "assertions passed\n", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "cxx11"}, + {$td->STRING => "assertions passed\n", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); $td->report(1); diff --git a/libtests/qtest/flate.test b/libtests/qtest/flate.test index b7acae60..3d99bc3a 100644 --- a/libtests/qtest/flate.test +++ b/libtests/qtest/flate.test @@ -32,24 +32,24 @@ close(F); check_file("farbage", "a6449c61db5b0645c0693b7560b77a60"); $td->runtest("run driver", - {$td->COMMAND => "flate farbage"},, - {$td->STRING => "bytes written to o3: 100010\ndone\n", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "flate farbage"},, + {$td->STRING => "bytes written to o3: 100010\ndone\n", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); check_file("farbage", "a6449c61db5b0645c0693b7560b77a60"); $td->runtest("compressed file correct", - {$td->FILE => "farbage.1"}, - {$td->FILE => "compressed"}); + {$td->FILE => "farbage.1"}, + {$td->FILE => "compressed"}); $td->runtest("uncompress filter works", - {$td->FILE => "farbage"}, - {$td->FILE => "farbage.2"}); + {$td->FILE => "farbage"}, + {$td->FILE => "farbage.2"}); $td->runtest("double filter works", - {$td->FILE => "farbage"}, - {$td->FILE => "farbage.3"}); + {$td->FILE => "farbage"}, + {$td->FILE => "farbage.3"}); cleanup(); @@ -69,6 +69,6 @@ sub check_file close(F); my $result = $md5->hexdigest; $td->runtest("check $file", - {$td->STRING => "$result\n"}, - {$td->STRING => "$sum\n"}); + {$td->STRING => "$result\n"}, + {$td->STRING => "$sum\n"}); } diff --git a/libtests/qtest/hex.test b/libtests/qtest/hex.test index 32ec84b5..9dba0ef6 100644 --- a/libtests/qtest/hex.test +++ b/libtests/qtest/hex.test @@ -10,13 +10,13 @@ require TestDriver; my $td = new TestDriver('hex'); $td->runtest("decode", - {$td->COMMAND => "hex < hex.in"}, - {$td->FILE => "binary.out", - $td->EXIT_STATUS => 0}); + {$td->COMMAND => "hex < hex.in"}, + {$td->FILE => "binary.out", + $td->EXIT_STATUS => 0}); $td->runtest("partial decode", - {$td->COMMAND => "echo '7a65726F203D203>' | hex"}, - {$td->STRING => "zero = 0", - $td->EXIT_STATUS => 0}); + {$td->COMMAND => "echo '7a65726F203D203>' | hex"}, + {$td->STRING => "zero = 0", + $td->EXIT_STATUS => 0}); $td->report(2); diff --git a/libtests/qtest/input_source.test b/libtests/qtest/input_source.test index 89a1c21a..54a7b0f9 100644 --- a/libtests/qtest/input_source.test +++ b/libtests/qtest/input_source.test @@ -12,9 +12,9 @@ my $td = new TestDriver('InputSource'); cleanup(); $td->runtest("input source tests", - {$td->COMMAND => "input_source"}, - {$td->FILE => "input_source.out", - $td->EXIT_STATUS => 0}, + {$td->COMMAND => "input_source"}, + {$td->FILE => "input_source.out", + $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); cleanup(); diff --git a/libtests/qtest/json.test b/libtests/qtest/json.test index b62994d3..d9a72234 100644 --- a/libtests/qtest/json.test +++ b/libtests/qtest/json.test @@ -10,8 +10,8 @@ require TestDriver; my $td = new TestDriver('json'); $td->runtest("json", - {$td->COMMAND => "json"}, - {$td->FILE => "json.out", $td->EXIT_STATUS => 0}, + {$td->COMMAND => "json"}, + {$td->FILE => "json.out", $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); $td->report(1); diff --git a/libtests/qtest/lzw.test b/libtests/qtest/lzw.test index e6142115..1e6c1d3d 100644 --- a/libtests/qtest/lzw.test +++ b/libtests/qtest/lzw.test @@ -12,22 +12,22 @@ my $td = new TestDriver('lzw'); cleanup(); $td->runtest("decode: early code change", - {$td->COMMAND => "lzw lzw1.in tmp"}, - {$td->STRING => "", - $td->EXIT_STATUS => 0}); + {$td->COMMAND => "lzw lzw1.in tmp"}, + {$td->STRING => "", + $td->EXIT_STATUS => 0}); $td->runtest("check output", - {$td->FILE => "tmp"}, - {$td->FILE => "lzw1.out"}); + {$td->FILE => "tmp"}, + {$td->FILE => "lzw1.out"}); $td->runtest("decode: no early code change", - {$td->COMMAND => "lzw lzw2.in tmp --no-early-code-change"}, - {$td->STRING => "", - $td->EXIT_STATUS => 0}); + {$td->COMMAND => "lzw lzw2.in tmp --no-early-code-change"}, + {$td->STRING => "", + $td->EXIT_STATUS => 0}); $td->runtest("check output", - {$td->FILE => "tmp"}, - {$td->FILE => "lzw2.out"}); + {$td->FILE => "tmp"}, + {$td->FILE => "lzw2.out"}); cleanup(); diff --git a/libtests/qtest/matrix.test b/libtests/qtest/matrix.test index 90522f9c..b0d4da8c 100644 --- a/libtests/qtest/matrix.test +++ b/libtests/qtest/matrix.test @@ -8,8 +8,8 @@ require TestDriver; my $td = new TestDriver('matrix'); $td->runtest("matrix", - {$td->COMMAND => "matrix"}, - {$td->STRING => "matrix tests done\n", $td->EXIT_STATUS => 0}, + {$td->COMMAND => "matrix"}, + {$td->STRING => "matrix tests done\n", $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); $td->report(1); diff --git a/libtests/qtest/nntree.test b/libtests/qtest/nntree.test index a1dcb957..69f96868 100644 --- a/libtests/qtest/nntree.test +++ b/libtests/qtest/nntree.test @@ -10,8 +10,8 @@ require TestDriver; my $td = new TestDriver('nntree'); $td->runtest("nntree", - {$td->COMMAND => "nntree"}, - {$td->FILE => "nntree.out", $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "nntree"}, + {$td->FILE => "nntree.out", $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); $td->report(1); diff --git a/libtests/qtest/ph.test b/libtests/qtest/ph.test index 9c0ffb8e..565b29a6 100644 --- a/libtests/qtest/ph.test +++ b/libtests/qtest/ph.test @@ -10,9 +10,9 @@ require TestDriver; my $td = new TestDriver('ph'); $td->runtest("PointerHolder", - {$td->COMMAND => "pointer_holder"}, - {$td->FILE => "ph.out", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "pointer_holder"}, + {$td->FILE => "ph.out", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); $td->report(1); diff --git a/libtests/qtest/predictors.test b/libtests/qtest/predictors.test index 98961d1a..45b995e9 100644 --- a/libtests/qtest/predictors.test +++ b/libtests/qtest/predictors.test @@ -14,44 +14,44 @@ my $td = new TestDriver('predictors'); cleanup(); $td->runtest("decode columns = 4", - {$td->COMMAND => "predictors png decode in1 4 1 8"}, - {$td->STRING => "done\n", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "predictors png decode in1 4 1 8"}, + {$td->STRING => "done\n", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); $td->runtest("check output", - {$td->FILE => "out"}, - {$td->FILE => "out1"}); + {$td->FILE => "out"}, + {$td->FILE => "out1"}); $td->runtest("decode columns = 5", - {$td->COMMAND => "predictors png decode in2 5 1 8"}, - {$td->STRING => "done\n", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "predictors png decode in2 5 1 8"}, + {$td->STRING => "done\n", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); $td->runtest("check output", - {$td->FILE => "out"}, - {$td->FILE => "out2"}); + {$td->FILE => "out"}, + {$td->FILE => "out2"}); $td->runtest("encode columns = 4", - {$td->COMMAND => "predictors png encode out1 4 1 8"}, - {$td->STRING => "done\n", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "predictors png encode out1 4 1 8"}, + {$td->STRING => "done\n", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); $td->runtest("check output", - {$td->FILE => "out"}, - {$td->FILE => "in1"}); + {$td->FILE => "out"}, + {$td->FILE => "in1"}); $td->runtest("encode columns = 5", - {$td->COMMAND => "predictors png encode out2 5 1 8"}, - {$td->STRING => "done\n", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "predictors png encode out2 5 1 8"}, + {$td->STRING => "done\n", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); $td->runtest("check output", - {$td->FILE => "out"}, - {$td->FILE => "in2"}); + {$td->FILE => "out"}, + {$td->FILE => "in2"}); my @other_png = ( '01--32-3-16', diff --git a/libtests/qtest/qintc.test b/libtests/qtest/qintc.test index 4b2dc3a5..423d6ffd 100644 --- a/libtests/qtest/qintc.test +++ b/libtests/qtest/qintc.test @@ -10,9 +10,9 @@ require TestDriver; my $td = new TestDriver('qintc'); $td->runtest("QINTC", - {$td->COMMAND => "qintc"}, - {$td->FILE => "qintc.out", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES | $td->RM_WS_ONLY_LINES); + {$td->COMMAND => "qintc"}, + {$td->FILE => "qintc.out", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES | $td->RM_WS_ONLY_LINES); $td->report(1); diff --git a/libtests/qtest/qutil.test b/libtests/qtest/qutil.test index 3487236c..9e93bbf9 100644 --- a/libtests/qtest/qutil.test +++ b/libtests/qtest/qutil.test @@ -10,10 +10,10 @@ require TestDriver; my $td = new TestDriver('qutil'); $td->runtest("QUtil", - {$td->COMMAND => "qutil"}, - {$td->FILE => "qutil.out", - $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES | $td->RM_WS_ONLY_LINES); + {$td->COMMAND => "qutil"}, + {$td->FILE => "qutil.out", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES | $td->RM_WS_ONLY_LINES); my $mfw = `main_from_wmain`; if ($mfw eq '') diff --git a/libtests/qtest/sparse_array.test b/libtests/qtest/sparse_array.test index c3535d85..a6448c3f 100644 --- a/libtests/qtest/sparse_array.test +++ b/libtests/qtest/sparse_array.test @@ -8,8 +8,8 @@ require TestDriver; my $td = new TestDriver('sparse array'); $td->runtest("sparse_array", - {$td->COMMAND => "sparse_array"}, - {$td->STRING => "sparse array tests done\n", + {$td->COMMAND => "sparse_array"}, + {$td->STRING => "sparse array tests done\n", $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); diff --git a/libtests/qutil.cc b/libtests/qutil.cc index 75cd47b3..e6fc4661 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -115,11 +115,11 @@ void string_conversion_test() // a non-C locale. set_locale(); std::cout << QUtil::int_to_string(16059) << std::endl - << QUtil::int_to_string(16059, 7) << std::endl - << QUtil::int_to_string(16059, -7) << std::endl - << QUtil::double_to_string(3.14159, 0, false) << std::endl - << QUtil::double_to_string(3.14159, 3) << std::endl - << QUtil::double_to_string(1000.123, -1024, false) << std::endl + << QUtil::int_to_string(16059, 7) << std::endl + << QUtil::int_to_string(16059, -7) << std::endl + << QUtil::double_to_string(3.14159, 0, false) << std::endl + << QUtil::double_to_string(3.14159, 3) << std::endl + << QUtil::double_to_string(1000.123, -1024, false) << std::endl << QUtil::double_to_string(.1234, 5, false) << std::endl << QUtil::double_to_string(.0001234, 5) << std::endl << QUtil::double_to_string(.123456, 5) << std::endl @@ -143,31 +143,31 @@ void string_conversion_test() char* tmp = QUtil::copy_string(embedded_null); if (memcmp(tmp, embedded_null.c_str(), 7) == 0) { - std::cout << "compare okay" << std::endl; + std::cout << "compare okay" << std::endl; } else { - std::cout << "compare failed" << std::endl; + std::cout << "compare failed" << std::endl; } delete [] tmp; // Also test with make_shared_cstr and make_unique_cstr auto tmp2 = QUtil::make_shared_cstr(embedded_null); if (memcmp(tmp2.get(), embedded_null.c_str(), 7) == 0) { - std::cout << "compare okay" << std::endl; + std::cout << "compare okay" << std::endl; } else { - std::cout << "compare failed" << std::endl; + std::cout << "compare failed" << std::endl; } auto tmp3 = QUtil::make_unique_cstr(embedded_null); if (memcmp(tmp3.get(), embedded_null.c_str(), 7) == 0) { - std::cout << "compare okay" << std::endl; + std::cout << "compare okay" << std::endl; } else { - std::cout << "compare failed" << std::endl; + std::cout << "compare failed" << std::endl; } std::string int_max_str = QUtil::int_to_string(INT_MAX); @@ -197,14 +197,14 @@ void os_wrapper_test() { try { - std::cout << "before remove" << std::endl; - QUtil::os_wrapper("remove file", + std::cout << "before remove" << std::endl; + QUtil::os_wrapper("remove file", remove("/this/file/does/not/exist")); - std::cout << "after remove" << std::endl; + std::cout << "after remove" << std::endl; } catch (std::runtime_error& s) { - std::cout << "exception: " << s.what() << std::endl; + std::cout << "exception: " << s.what() << std::endl; } } @@ -212,14 +212,14 @@ void fopen_wrapper_test() { try { - std::cout << "before fopen" << std::endl; - FILE* f = QUtil::safe_fopen("/this/file/does/not/exist", "r"); - std::cout << "after fopen" << std::endl; - (void) fclose(f); + std::cout << "before fopen" << std::endl; + FILE* f = QUtil::safe_fopen("/this/file/does/not/exist", "r"); + std::cout << "after fopen" << std::endl; + (void) fclose(f); } catch (QPDFSystemError& s) { - std::cout << "exception: " << s.what() << std::endl; + std::cout << "exception: " << s.what() << std::endl; assert(s.getErrno() != 0); } @@ -231,10 +231,10 @@ void getenv_test() { std::string val; std::cout << "IN_TESTSUITE: " << QUtil::get_env("IN_TESTSUITE", &val) - << ": " << val << std::endl; + << ": " << val << std::endl; // Hopefully this environment variable is not defined. std::cout << "HAGOOGAMAGOOGLE: " << QUtil::get_env("HAGOOGAMAGOOGLE") - << std::endl; + << std::endl; } static void print_utf8(unsigned long val) @@ -243,19 +243,19 @@ static void print_utf8(unsigned long val) std::cout << "0x" << QUtil::uint_to_string_base(val, 16) << " ->"; if (val < 0xfffe) { - std::cout << " " << result; + std::cout << " " << result; } else { - // Emacs has trouble with utf-8 encoding files with characters - // outside the 16-bit portion, so just show the character - // values. - for (std::string::iterator iter = result.begin(); - iter != result.end(); ++iter) - { - std::cout << " " << QUtil::int_to_string_base( + // Emacs has trouble with utf-8 encoding files with characters + // outside the 16-bit portion, so just show the character + // values. + for (std::string::iterator iter = result.begin(); + iter != result.end(); ++iter) + { + std::cout << " " << QUtil::int_to_string_base( static_cast(static_cast(*iter)), 16, 2); - } + } } std::cout << std::endl; } @@ -269,11 +269,11 @@ void to_utf8_test() print_utf8(0x7fffffffUL); try { - print_utf8(0x80000000UL); + print_utf8(0x80000000UL); } catch (std::runtime_error& e) { - std::cout << "0x80000000: " << e.what() << std::endl; + std::cout << "0x80000000: " << e.what() << std::endl; } } @@ -407,11 +407,11 @@ void transcoding_test() assert(! QUtil::utf8_to_pdf_doc(input2, output)); assert(QUtil::utf8_to_pdf_doc(input3, output)); std::cout << "alternatives" << std::endl; - // char name mac win pdf-doc - // U+0192 florin 304 203 206 - // U+00A9 copyright 251 251 251 - // U+00E9 eacute 216 351 351 - // U+017E zcaron - 236 236 + // char name mac win pdf-doc + // U+0192 florin 304 203 206 + // U+00A9 copyright 251 251 251 + // U+00E9 eacute 216 351 351 + // U+017E zcaron - 236 236 std::string pdfdoc = "\206\251\351\236"; std::string utf8 = QUtil::pdf_doc_to_utf8(pdfdoc); print_alternatives(pdfdoc); @@ -669,39 +669,39 @@ int main(int argc, char* argv[]) try { std::cout << "---- string conversion" << std::endl; - string_conversion_test(); - std::cout << "---- os wrapper" << std::endl; - os_wrapper_test(); - std::cout << "---- fopen" << std::endl; - fopen_wrapper_test(); - std::cout << "---- getenv" << std::endl; - getenv_test(); - std::cout << "---- utf8" << std::endl; - to_utf8_test(); - std::cout << "---- utf16" << std::endl; - to_utf16_test(); - std::cout << "---- utf8_to_ascii" << std::endl; + string_conversion_test(); + std::cout << "---- os wrapper" << std::endl; + os_wrapper_test(); + std::cout << "---- fopen" << std::endl; + fopen_wrapper_test(); + std::cout << "---- getenv" << std::endl; + getenv_test(); + std::cout << "---- utf8" << std::endl; + to_utf8_test(); + std::cout << "---- utf16" << std::endl; + to_utf16_test(); + std::cout << "---- utf8_to_ascii" << std::endl; utf8_to_ascii_test(); - std::cout << "---- transcoding" << std::endl; + std::cout << "---- transcoding" << std::endl; transcoding_test(); - std::cout << "---- whoami" << std::endl; - get_whoami_test(); - std::cout << "---- file" << std::endl; - same_file_test(); - std::cout << "---- path" << std::endl; - path_test(); - std::cout << "---- read from file" << std::endl; - read_from_file_test(); - std::cout << "---- hex encode/decode" << std::endl; - hex_encode_decode_test(); - std::cout << "---- rename/delete" << std::endl; - rename_delete_test(); - std::cout << "---- timestamp" << std::endl; - timestamp_test(); + std::cout << "---- whoami" << std::endl; + get_whoami_test(); + std::cout << "---- file" << std::endl; + same_file_test(); + std::cout << "---- path" << std::endl; + path_test(); + std::cout << "---- read from file" << std::endl; + read_from_file_test(); + std::cout << "---- hex encode/decode" << std::endl; + hex_encode_decode_test(); + std::cout << "---- rename/delete" << std::endl; + rename_delete_test(); + std::cout << "---- timestamp" << std::endl; + timestamp_test(); } catch (std::exception& e) { - std::cout << "unexpected exception: " << e.what() << std::endl; + std::cout << "unexpected exception: " << e.what() << std::endl; } return 0; diff --git a/libtests/rc4.cc b/libtests/rc4.cc index b8abce88..eab3a759 100644 --- a/libtests/rc4.cc +++ b/libtests/rc4.cc @@ -31,8 +31,8 @@ int main(int argc, char* argv[]) if (argc != 4) { - std::cerr << "Usage: rc4 hex-key infile outfile" << std::endl; - exit(2); + std::cerr << "Usage: rc4 hex-key infile outfile" << std::endl; + exit(2); } char* hexkey = argv[1]; @@ -46,13 +46,13 @@ int main(int argc, char* argv[]) FILE* infile = QUtil::safe_fopen(infilename, "rb"); for (unsigned int i = 0; i < strlen(hexkey); i += 2) { - char t[3]; - t[0] = hexkey[i]; - t[1] = hexkey[i + 1]; - t[2] = '\0'; + char t[3]; + t[0] = hexkey[i]; + t[1] = hexkey[i + 1]; + t[2] = '\0'; - long val = strtol(t, 0, 16); - key[i/2] = static_cast(val); + long val = strtol(t, 0, 16); + key[i/2] = static_cast(val); } FILE* outfile = QUtil::safe_fopen(outfilename, "wb"); @@ -66,15 +66,15 @@ int main(int argc, char* argv[]) bool done = false; while (! done) { - size_t len = fread(buf, 1, sizeof(buf), infile); - if (len <= 0) - { - done = true; - } - else - { - rc4->write(buf, len); - } + size_t len = fread(buf, 1, sizeof(buf), infile); + if (len <= 0) + { + done = true; + } + else + { + rc4->write(buf, len); + } } rc4->finish(); delete rc4; diff --git a/libtests/runlength.cc b/libtests/runlength.cc index 3dfe0563..f54e7300 100644 --- a/libtests/runlength.cc +++ b/libtests/runlength.cc @@ -11,9 +11,9 @@ int main(int argc, char* argv[]) { if (argc != 4) { - std::cerr << "Usage: runlength {-encode|-decode} infile outfile" + std::cerr << "Usage: runlength {-encode|-decode} infile outfile" << std::endl; - exit(2); + exit(2); } bool encode = (strcmp("-encode", argv[1]) == 0); @@ -30,15 +30,15 @@ int main(int argc, char* argv[]) (encode ? Pl_RunLength::a_encode : Pl_RunLength::a_decode)); while (! done) { - size_t len = fread(buf, 1, sizeof(buf), infile); - if (len <= 0) - { - done = true; - } - else - { - rl.write(buf, len); - } + size_t len = fread(buf, 1, sizeof(buf), infile); + if (len <= 0) + { + done = true; + } + else + { + rl.write(buf, len); + } } rl.finish(); fclose(infile); -- cgit v1.2.3-70-g09d2