summaryrefslogtreecommitdiff
path: root/zen/serialize.h
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-12-16 21:08:02 -0500
committerB. Stack <bgstack15@gmail.com>2022-12-16 21:08:02 -0500
commitd35a4795f16e51f5773d00dce796f6948f82dae2 (patch)
treeb37279f6f8b354407507cc1a0e44691d6c63ffe8 /zen/serialize.h
parentadd upstream 11.28 (diff)
downloadFreeFileSync-d35a4795f16e51f5773d00dce796f6948f82dae2.tar.gz
FreeFileSync-d35a4795f16e51f5773d00dce796f6948f82dae2.tar.bz2
FreeFileSync-d35a4795f16e51f5773d00dce796f6948f82dae2.zip
add upstream 11.2911.29
Diffstat (limited to 'zen/serialize.h')
-rw-r--r--zen/serialize.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/zen/serialize.h b/zen/serialize.h
index dd393422..a996b118 100644
--- a/zen/serialize.h
+++ b/zen/serialize.h
@@ -301,15 +301,16 @@ void unbufferedStreamCopy(Function1 tryRead /*(void* buffer, size_t bytesToRead)
Function2 tryWrite /*(const void* buffer, size_t bytesToWrite) throw X; may return short*/,
size_t blockSizeOut) //throw X
{
- /* caveat: buffer block sizes might not be power of 2:
+ /* caveat: buffer block sizes might not be a power of 2:
- f_iosize for network share on macOS
- libssh2 uses weird packet sizes like MAX_SFTP_OUTGOING_SIZE (30000), and will send incomplete packages if block size is not an exact multiple :(
+ - MTP uses file size as blocksize if under 256 kB (=> can be as small as 1 byte! https://freefilesync.org/forum/viewtopic.php?t=9823)
=> that's a problem because we want input/output sizes to be multiples of each other to help avoid the std::memmove() below */
#if 0
blockSizeIn = std::bit_ceil(blockSizeIn);
blockSizeOut = std::bit_ceil(blockSizeOut);
#endif
- if (blockSizeIn <= 1 || blockSizeOut <= 1)
+ if (blockSizeIn == 0 || blockSizeOut == 0)
throw std::logic_error("Contract violation! " + std::string(__FILE__) + ':' + numberTo<std::string>(__LINE__));
const size_t bufCapacity = blockSizeOut - 1 + blockSizeIn;
bgstack15