aboutsummaryrefslogtreecommitdiffstats
path: root/zlib-flate
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-08 15:18:08 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-08 17:51:15 +0100
commitcb769c62e55599e9f980001830bc61d9fcaa64a9 (patch)
tree0bf980c385a61cbc8720cf990762ffc1200f9d6a /zlib-flate
parent716381f65a2b2dc72f8da2426ba71aeab02c507f (diff)
downloadqpdf-cb769c62e55599e9f980001830bc61d9fcaa64a9.tar.zst
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.
Diffstat (limited to 'zlib-flate')
-rw-r--r--zlib-flate/qtest/zf.test14
-rw-r--r--zlib-flate/zlib-flate.cc54
2 files changed, 34 insertions, 34 deletions
diff --git a/zlib-flate/qtest/zf.test b/zlib-flate/qtest/zf.test
index 2f89ff54..d864a130 100644
--- a/zlib-flate/qtest/zf.test
+++ b/zlib-flate/qtest/zf.test
@@ -24,16 +24,16 @@ foreach my $level ('', '=1', '=9')
}
$td->runtest("error",
- {$td->COMMAND => "zlib-flate -uncompress < 1.uncompressed"},
- {$td->REGEXP => "flate: inflate: data: .*\n",
- $td->EXIT_STATUS => 2},
- $td->NORMALIZE_NEWLINES);
+ {$td->COMMAND => "zlib-flate -uncompress < 1.uncompressed"},
+ {$td->REGEXP => "flate: inflate: data: .*\n",
+ $td->EXIT_STATUS => 2},
+ $td->NORMALIZE_NEWLINES);
$td->runtest("corrupted input",
- {$td->COMMAND => "zlib-flate -uncompress < missing-z-finish.in"},
- {$td->REGEXP =>
+ {$td->COMMAND => "zlib-flate -uncompress < missing-z-finish.in"},
+ {$td->REGEXP =>
"input stream is complete but output may still be valid",
$td->EXIT_STATUS => 3},
- $td->NORMALIZE_NEWLINES);
+ $td->NORMALIZE_NEWLINES);
$td->report(8);
diff --git a/zlib-flate/zlib-flate.cc b/zlib-flate/zlib-flate.cc
index 61938dd2..d4809dc5 100644
--- a/zlib-flate/zlib-flate.cc
+++ b/zlib-flate/zlib-flate.cc
@@ -14,7 +14,7 @@ static char const* whoami = 0;
void usage()
{
std::cerr << "Usage: " << whoami << " { -uncompress | -compress[=n] }"
- << std::endl
+ << std::endl
<< "If n is specified with -compress, it is a"
<< " zlib compression level from" << std::endl
<< "1 to 9 where lower numbers are faster and"
@@ -28,49 +28,49 @@ int main(int argc, char* argv[])
{
if ((whoami = strrchr(argv[0], '/')) == NULL)
{
- whoami = argv[0];
+ whoami = argv[0];
}
else
{
- ++whoami;
+ ++whoami;
}
// For libtool's sake....
if (strncmp(whoami, "lt-", 3) == 0)
{
- whoami += 3;
+ whoami += 3;
}
if ((argc == 2) && (strcmp(argv[1], "--version") == 0))
{
std::cout << whoami << " from qpdf version "
<< QPDF::QPDFVersion() << std::endl;
- exit(0);
+ exit(0);
}
if (argc != 2)
{
- usage();
+ usage();
}
Pl_Flate::action_e action = Pl_Flate::a_inflate;
if ((strcmp(argv[1], "-uncompress") == 0))
{
- // okay
+ // okay
}
else if ((strcmp(argv[1], "-compress") == 0))
{
- action = Pl_Flate::a_deflate;
+ action = Pl_Flate::a_deflate;
}
else if ((strncmp(argv[1], "-compress=", 10) == 0))
{
- action = Pl_Flate::a_deflate;
+ action = Pl_Flate::a_deflate;
int level = QUtil::string_to_int(argv[1] + 10);
Pl_Flate::setCompressionLevel(level);
}
else
{
- usage();
+ usage();
}
QUtil::binary_stdout();
@@ -86,26 +86,26 @@ int main(int argc, char* argv[])
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
- {
- flate->write(buf, len);
- }
- }
- flate->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
+ {
+ flate->write(buf, len);
+ }
+ }
+ flate->finish();
}
catch (std::exception& e)
{
- std::cerr << whoami << ": " << e.what() << std::endl;
- exit(2);
+ std::cerr << whoami << ": " << e.what() << std::endl;
+ exit(2);
}
if (warn)