stream: weasel around false-positive GCC warning
As _countof is manually implemented on non-Windows platforms, GCC knows it returns size_t, but fails to realize it will never be more than 0x400 in our case making truncation harmless. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
4fa30d5630
commit
9fb899849d
@ -479,8 +479,9 @@ namespace stdex
|
||||
return *this;
|
||||
data.reserve(num_chars);
|
||||
for (;;) {
|
||||
T buf[0x400];
|
||||
uint32_t num_read = static_cast<uint32_t>(read_array(buf, sizeof(T), std::min<uint32_t>(num_chars, _countof(buf))));
|
||||
constexpr uint32_t buf_chars = 0x400;
|
||||
T buf[buf_chars];
|
||||
uint32_t num_read = static_cast<uint32_t>(read_array(buf, sizeof(T), std::min<uint32_t>(num_chars, buf_chars)));
|
||||
data.append(buf, num_read);
|
||||
num_chars -= num_read;
|
||||
if (!num_chars || !ok())
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
SPDX-License-Identifier: MIT
|
||||
Copyright © 2016-2024 Amebis
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user