diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-02-08 15:18:08 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-02-08 17:51:15 +0100 |
commit | cb769c62e55599e9f980001830bc61d9fcaa64a9 (patch) | |
tree | 0bf980c385a61cbc8720cf990762ffc1200f9d6a /libqpdf/MD5.cc | |
parent | 716381f65a2b2dc72f8da2426ba71aeab02c507f (diff) | |
download | qpdf-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 'libqpdf/MD5.cc')
-rw-r--r-- | libqpdf/MD5.cc | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/libqpdf/MD5.cc b/libqpdf/MD5.cc index 0b85de0e..dc4460a0 100644 --- a/libqpdf/MD5.cc +++ b/libqpdf/MD5.cc @@ -66,28 +66,28 @@ void MD5::encodeFile(char const *filename, qpdf_offset_t up_to_offset) } do { - if ((up_to_offset >= 0) && ((so_far + to_try) > up_to_size)) - { - to_try = up_to_size - so_far; - } - len = fread(buffer, 1, to_try, file); - if (len > 0) - { - encodeDataIncrementally(buffer, len); - so_far += len; - if ((up_to_offset >= 0) && (so_far >= up_to_size)) - { - break; - } - } + if ((up_to_offset >= 0) && ((so_far + to_try) > up_to_size)) + { + to_try = up_to_size - so_far; + } + len = fread(buffer, 1, to_try, file); + if (len > 0) + { + encodeDataIncrementally(buffer, len); + so_far += len; + if ((up_to_offset >= 0) && (so_far >= up_to_size)) + { + break; + } + } } while (len > 0); if (ferror(file)) { - // Assume, perhaps incorrectly, that errno was set by the - // underlying call to read.... - (void) fclose(file); - QUtil::throw_system_error( - std::string("MD5: read error on ") + filename); + // Assume, perhaps incorrectly, that errno was set by the + // underlying call to read.... + (void) fclose(file); + QUtil::throw_system_error( + std::string("MD5: read error on ") + filename); } (void) fclose(file); @@ -108,7 +108,7 @@ void MD5::print() unsigned int i; for (i = 0; i < 16; ++i) { - printf("%02x", digest_val[i]); + printf("%02x", digest_val[i]); } printf("\n"); } @@ -140,7 +140,7 @@ MD5::getFileChecksum(char const* filename, qpdf_offset_t up_to_offset) bool MD5::checkDataChecksum(char const* const checksum, - char const* buf, size_t len) + char const* buf, size_t len) { std::string actual_checksum = getDataChecksum(buf, len); return (checksum == actual_checksum); @@ -148,17 +148,17 @@ MD5::checkDataChecksum(char const* const checksum, bool MD5::checkFileChecksum(char const* const checksum, - char const* filename, qpdf_offset_t up_to_offset) + char const* filename, qpdf_offset_t up_to_offset) { bool result = false; try { - std::string actual_checksum = getFileChecksum(filename, up_to_offset); - result = (checksum == actual_checksum); + std::string actual_checksum = getFileChecksum(filename, up_to_offset); + result = (checksum == actual_checksum); } catch (std::runtime_error const&) { - // Ignore -- return false + // Ignore -- return false } return result; } |