Commit: 8e1243fc6309f0793b5c8d814ba79f6dffda8386
Parent: 1d73c58835a0f89911168abce6ecab8a896bd36e
Author: Randy Palamar
Date: Tue, 10 Jun 2025 07:58:22 -0600
os: w32: fix chunk size in write new file
it was reported that some compilers insist on making this an s32
which is then equivalent to S32_MIN making the test invalid (we
use signed lengths everywhere).
Diffstat:
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/os_win32.c b/os_win32.c
@@ -246,14 +246,12 @@ function OS_READ_FILE_FN(os_read_file)
function OS_WRITE_NEW_FILE_FN(os_write_new_file)
{
- enum { CHUNK_SIZE = GB(2) };
-
b32 result = 0;
iptr h = CreateFileA(fname, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
if (h >= 0) {
while (raw.len > 0) {
s8 chunk = raw;
- chunk.len = MIN(chunk.len, CHUNK_SIZE);
+ chunk.len = MIN(chunk.len, (iz)GB(2));
result = os_write_file(h, chunk);
if (!result) break;
raw = s8_cut_head(raw, chunk.len);