summaryrefslogtreecommitdiff
path: root/zen/serialize.h
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2023-10-28 08:29:29 -0400
committerB. Stack <bgstack15@gmail.com>2023-10-28 08:29:29 -0400
commitd30e0825ff61e9d8bae68cdfd2798da0badcf255 (patch)
treea55034c5f47324d2220e40639c6c632a895c5648 /zen/serialize.h
parentadd upstream 13.0 (diff)
downloadFreeFileSync-d30e0825ff61e9d8bae68cdfd2798da0badcf255.tar.gz
FreeFileSync-d30e0825ff61e9d8bae68cdfd2798da0badcf255.tar.bz2
FreeFileSync-d30e0825ff61e9d8bae68cdfd2798da0badcf255.zip
add upstream 13.113.1
Diffstat (limited to 'zen/serialize.h')
-rw-r--r--zen/serialize.h11
1 files changed, 1 insertions, 10 deletions
diff --git a/zen/serialize.h b/zen/serialize.h
index 02dcd2b2..f3e4f7ff 100644
--- a/zen/serialize.h
+++ b/zen/serialize.h
@@ -7,7 +7,6 @@
#ifndef SERIALIZE_H_839405783574356
#define SERIALIZE_H_839405783574356
-//#include <bit>
#include <functional>
#include "sys_error.h"
//keep header clean from specific stream implementations! (e.g.file_io.h)! used by abstract.h!
@@ -261,21 +260,13 @@ BinContainer unbufferedLoad(Function tryRead /*(void* buffer, size_t bytesToRead
BinContainer buf;
for (;;)
{
-#ifndef ZEN_HAVE_RESIZE_AND_OVERWRITE
-#error include legacy_compiler.h!
-#endif
-#if ZEN_HAVE_RESIZE_AND_OVERWRITE //permature(?) perf optimization; avoid needless zero-initialization:
size_t bytesRead = 0;
buf.resize_and_overwrite(buf.size() + blockSize, [&, bufSizeOld = buf.size()](char* rawBuf, size_t /*rawBufSize: caveat: may be larger than what's requested*/)
+ //permature(?) perf optimization; avoid needless zero-initialization:
{
bytesRead = tryRead(rawBuf + bufSizeOld, blockSize); //throw X; may return short; only 0 means EOF
return bufSizeOld + bytesRead;
});
-#else
- buf.resize(buf.size() + blockSize); //needless zero-initialization!
- const size_t bytesRead = tryRead(buf.data() + buf.size() - blockSize, blockSize); //throw X; may return short; only 0 means EOF
- buf.resize(buf.size() - blockSize + bytesRead); //caveat: unsigned arithmetics
-#endif
if (bytesRead == 0) //end of file
{
//caveat: memory consumption of returned string!
bgstack15