From 791b90b9898cc41869538f1dfc303588436682b7 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sat, 15 Feb 2020 11:50:31 -0500 Subject: add upstream 10.20 It is worth noting that the send email feature is not present in the GPL release. --- zen/zlib_wrap.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'zen/zlib_wrap.h') diff --git a/zen/zlib_wrap.h b/zen/zlib_wrap.h index 9d9229ac..b820a4f8 100644 --- a/zen/zlib_wrap.h +++ b/zen/zlib_wrap.h @@ -27,8 +27,8 @@ BinContainer decompress(const BinContainer& stream); //throw SysError class InputStreamAsGzip //convert input stream into gzip on the fly { public: - InputStreamAsGzip( //throw SysError - const std::function& readBlock /*throw X*/); //returning 0 signals EOF: Posix read() semantics + explicit InputStreamAsGzip( //throw SysError + const std::function& readBlock /*throw X; returning 0 signals EOF: Posix read() semantics*/); ~InputStreamAsGzip(); size_t read(void* buffer, size_t bytesToRead); //throw SysError, X; return "bytesToRead" bytes unless end of stream! @@ -38,6 +38,7 @@ private: const std::unique_ptr pimpl_; }; +std::string compressAsGzip(const void* buffer, size_t bufSize); //throw SysError @@ -103,10 +104,9 @@ BinContainer decompress(const BinContainer& stream) //throw SysError { contOut.resize(static_cast(uncompressedSize)); //throw std::bad_alloc } - catch (const std::bad_alloc& e) //most likely due to data corruption! - { - throw SysError(L"zlib error: " + _("Out of memory.") + L" " + utfTo(e.what())); - } + //most likely this is due to data corruption: + catch (const std::length_error& e) { throw SysError(L"zlib error: " + _("Out of memory.") + L" " + utfTo(e.what())); } + catch (const std::bad_alloc& e) { throw SysError(L"zlib error: " + _("Out of memory.") + L" " + utfTo(e.what())); } const size_t bytesWritten = impl::zlib_decompress(&*stream.begin() + sizeof(uncompressedSize), stream.size() - sizeof(uncompressedSize), -- cgit