From fb416edfbdae410d993e0504f2e9f7deb6367a20 Mon Sep 17 00:00:00 2001 From: kkard2 Date: Sun, 7 Sep 2025 11:16:17 +0200 Subject: fix cl.exe warnings --- examples/texture.c | 2 +- platform_win32.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/texture.c b/examples/texture.c index 1a4382a..d6bee54 100644 --- a/examples/texture.c +++ b/examples/texture.c @@ -21,7 +21,7 @@ void init() { } texture.stride = texture.width; - texture.pixels = data; // NOTE(kard): be careful if changing following loop + texture.pixels = (uint32_t *)data; // NOTE(kard): be careful if changing following loop // converting from stbi's RGBA to ARGB for (size_t i = 0; i < texture.width * texture.height; i++) { diff --git a/platform_win32.c b/platform_win32.c index 226dbd7..2df92b6 100644 --- a/platform_win32.c +++ b/platform_win32.c @@ -52,13 +52,13 @@ void redirect_io_to_console() { AllocConsole(); FILE *fp; - fp = freopen("CONOUT$", "w", stdout); + assert(!freopen_s(&fp, "CONOUT$", "w", stdout)); setvbuf(stdout, NULL, _IONBF, 0); - fp = freopen("CONOUT$", "w", stderr); + assert(!freopen_s(&fp, "CONOUT$", "w", stderr)); setvbuf(stderr, NULL, _IONBF, 0); - fp = freopen("CONIN$", "r", stdin); + assert(!freopen_s(&fp, "CONIN$", "r", stdin)); setvbuf(stdin, NULL, _IONBF, 0); } @@ -183,7 +183,7 @@ int WinMain( actual_end.QuadPart = qpc_start.QuadPart + (TARGET_FRAME_TIME_US * qpc_freq.QuadPart / 1000000); remaining.QuadPart = (actual_end.QuadPart - qpc_end.QuadPart) * 1000000 / qpc_freq.QuadPart; if (remaining.QuadPart > 2000) { - Sleep((remaining.QuadPart - 1000) / 1000); + Sleep((DWORD)((remaining.QuadPart - 1000) / 1000)); } while (qpc_end.QuadPart < actual_end.QuadPart) { -- cgit v1.3.1