@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2023 Jonathan Schleifer + * Copyright (c) 2008-2024 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -325,10 +325,13 @@ tmp = (length < (size_t)CTX.length - CTX.position ? (uint16_t)length : CTX.length - CTX.position); tmp = (uint16_t)[_stream readIntoBuffer: buffer + bytesWritten length: tmp]; + + if OF_UNLIKELY (tmp == 0) + return bytesWritten; slidingWindow = _slidingWindow; slidingWindowIndex = _slidingWindowIndex; for (uint_fast16_t i = 0; i < tmp; i++) { slidingWindow[slidingWindowIndex] =