diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2020-03-20 22:34:51 +0000 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2020-03-20 22:34:51 +0000 |
commit | 543ddcd795ba2fa44676b59135a745f51f28a8da (patch) | |
tree | 5c378aa54f4bb65c081cf9a92530d8af1f1f53dd /zen/zlib_wrap.cpp | |
parent | Merge branch '10.20' into 'master' (diff) | |
parent | add upstream 10.21 (diff) | |
download | FreeFileSync-10.21.tar.gz FreeFileSync-10.21.tar.bz2 FreeFileSync-10.21.zip |
Merge branch '10.21' into 'master'10.21
add upstream 10.21
See merge request opensource-tracking/FreeFileSync!18
Diffstat (limited to 'zen/zlib_wrap.cpp')
-rw-r--r-- | zen/zlib_wrap.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/zen/zlib_wrap.cpp b/zen/zlib_wrap.cpp index 57a0f33c..685843c3 100644 --- a/zen/zlib_wrap.cpp +++ b/zen/zlib_wrap.cpp @@ -29,8 +29,10 @@ std::wstring formatZlibStatusCode(int sc) ZEN_CHECK_CASE_FOR_CONSTANT(Z_MEM_ERROR); ZEN_CHECK_CASE_FOR_CONSTANT(Z_BUF_ERROR); ZEN_CHECK_CASE_FOR_CONSTANT(Z_VERSION_ERROR); + + default: + return replaceCpy<std::wstring>(L"zlib status %x", L"%x", numberTo<std::wstring>(sc)); } - return replaceCpy<std::wstring>(L"zlib status %x.", L"%x", numberTo<std::wstring>(sc)); } } @@ -53,7 +55,7 @@ size_t zen::impl::zlib_compress(const void* src, size_t srcLen, void* trg, size_ // Z_MEM_ERROR: not enough memory // Z_BUF_ERROR: not enough room in the output buffer if (rv != Z_OK || bufferSize > trgLen) - throw SysError(formatSystemError(L"compress2", formatZlibStatusCode(rv), L"zlib error")); + throw SysError(formatSystemError(L"zlib compress2", formatZlibStatusCode(rv), L"")); return bufferSize; } @@ -71,7 +73,7 @@ size_t zen::impl::zlib_decompress(const void* src, size_t srcLen, void* trg, siz // Z_BUF_ERROR: not enough room in the output buffer // Z_DATA_ERROR: input data was corrupted or incomplete if (rv != Z_OK || bufferSize > trgLen) - throw SysError(formatSystemError(L"uncompress", formatZlibStatusCode(rv), L"zlib error")); + throw SysError(formatSystemError(L"zlib uncompress", formatZlibStatusCode(rv), L"")); return bufferSize; } @@ -96,7 +98,7 @@ public: memLevel, //int memLevel Z_DEFAULT_STRATEGY); //int strategy if (rv != Z_OK) - throw SysError(formatSystemError(L"deflateInit2", formatZlibStatusCode(rv), L"zlib error")); + throw SysError(formatSystemError(L"zlib deflateInit2", formatZlibStatusCode(rv), L"")); } ~Impl() @@ -108,7 +110,7 @@ public: size_t read(void* buffer, size_t bytesToRead) //throw SysError, X; return "bytesToRead" bytes unless end of stream! { if (bytesToRead == 0) //"read() with a count of 0 returns zero" => indistinguishable from end of file! => check! - throw std::logic_error("Contract violation! " + std::string(__FILE__) + ":" + numberTo<std::string>(__LINE__)); + throw std::logic_error("Contract violation! " + std::string(__FILE__) + ':' + numberTo<std::string>(__LINE__)); gzipStream_.next_out = static_cast<Bytef*>(buffer); gzipStream_.avail_out = static_cast<uInt>(bytesToRead); @@ -131,7 +133,7 @@ public: if (rv == Z_STREAM_END) return bytesToRead - gzipStream_.avail_out; if (rv != Z_OK) - throw SysError(formatSystemError(L"deflate", formatZlibStatusCode(rv), L"zlib error")); + throw SysError(formatSystemError(L"zlib deflate", formatZlibStatusCode(rv), L"")); if (gzipStream_.avail_out == 0) return bytesToRead; |