summaryrefslogtreecommitdiff
path: root/zen/zlib_wrap.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2020-03-20 22:34:51 +0000
committerDaniel Wilhelm <shieldwed@outlook.com>2020-03-20 22:34:51 +0000
commit543ddcd795ba2fa44676b59135a745f51f28a8da (patch)
tree5c378aa54f4bb65c081cf9a92530d8af1f1f53dd /zen/zlib_wrap.h
parentMerge branch '10.20' into 'master' (diff)
parentadd upstream 10.21 (diff)
downloadFreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.tar.gz
FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.tar.bz2
FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.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.h')
-rw-r--r--zen/zlib_wrap.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/zen/zlib_wrap.h b/zen/zlib_wrap.h
index b820a4f8..3db609da 100644
--- a/zen/zlib_wrap.h
+++ b/zen/zlib_wrap.h
@@ -63,7 +63,7 @@ BinContainer compress(const BinContainer& stream, int level) //throw SysError
//save uncompressed stream size for decompression
const uint64_t uncompressedSize = stream.size(); //use portable number type!
contOut.resize(sizeof(uncompressedSize));
- std::memcpy(&*contOut.begin(), &uncompressedSize, sizeof(uncompressedSize));
+ std::memcpy(&contOut[0], &uncompressedSize, sizeof(uncompressedSize));
const size_t bufferEstimate = impl::zlib_compressBound(stream.size()); //upper limit for buffer size, larger than input size!!!
@@ -105,8 +105,8 @@ BinContainer decompress(const BinContainer& stream) //throw SysError
contOut.resize(static_cast<size_t>(uncompressedSize)); //throw std::bad_alloc
}
//most likely this is due to data corruption:
- catch (const std::length_error& e) { throw SysError(L"zlib error: " + _("Out of memory.") + L" " + utfTo<std::wstring>(e.what())); }
- catch (const std::bad_alloc& e) { throw SysError(L"zlib error: " + _("Out of memory.") + L" " + utfTo<std::wstring>(e.what())); }
+ catch (const std::length_error& e) { throw SysError(L"zlib error: " + _("Out of memory.") + L' ' + utfTo<std::wstring>(e.what())); }
+ catch (const std::bad_alloc& e) { throw SysError(L"zlib error: " + _("Out of memory.") + L' ' + utfTo<std::wstring>(e.what())); }
const size_t bytesWritten = impl::zlib_decompress(&*stream.begin() + sizeof(uncompressedSize),
stream.size() - sizeof(uncompressedSize),
bgstack15