From 70c29b4e5d240202e680a6293548d6e50f64cba9 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 17 Aug 2024 10:21:50 -0500 Subject: [PATCH] More updates to windows build. --- build_win.bat | 2 ++ src/core/corelib.c | 7 ++++++- src/core/filewatch.c | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build_win.bat b/build_win.bat index 25f8c011..efd33867 100644 --- a/build_win.bat +++ b/build_win.bat @@ -50,6 +50,7 @@ for %%f in (src\boot\*.c) do ( %JANET_LINK% /out:build\janet_boot.exe build\boot\*.obj @if not errorlevel 0 goto :BUILDFAIL build\janet_boot . > build\c\janet.c +@if not errorlevel 0 goto :BUILDFAIL @rem Build the sources %JANET_COMPILE% /Fobuild\janet.obj build\c\janet.c @@ -59,6 +60,7 @@ build\janet_boot . > build\c\janet.c @rem Build the resources rc /nologo /fobuild\janet_win.res janet_win.rc +@if not errorlevel 0 goto :BUILDFAIL @rem Link everything to main client %JANET_LINK% /out:janet.exe build\janet.obj build\shell.obj build\janet_win.res diff --git a/src/core/corelib.c b/src/core/corelib.c index da1dfc5c..7ac7f564 100644 --- a/src/core/corelib.c +++ b/src/core/corelib.c @@ -448,7 +448,12 @@ JANET_CORE_FN(janet_core_range, count = stop; } count = (count > 0) ? count : 0; - int32_t int_count = ceil(count); + int32_t int_count; + if (count > (double) INT32_MAX) { + int_count = INT32_MAX; + } else { + int_count = (int32_t) ceil(count); + } if (step > 0.0) { janet_assert(start + int_count * step >= stop, "bad range code"); } else { diff --git a/src/core/filewatch.c b/src/core/filewatch.c index 39d2e293..bb534961 100644 --- a/src/core/filewatch.c +++ b/src/core/filewatch.c @@ -353,8 +353,8 @@ static void watcher_callback_read(JanetFiber *fiber, JanetAsyncEvent event) { } static void janet_watcher_listen(JanetWatcher *watcher) { - for (int32_t i = 0; i < watcher.watch_descriptors.capacity; i++) { - const JanetKV *kv = watcher.watch_descriptors.items + i; + for (int32_t i = 0; i < watcher->watch_descriptors.capacity; i++) { + const JanetKV *kv = watcher->watch_descriptors.items + i; if (!janet_checktype(kv->key, JANET_POINTER)) continue; OverlappedWatch *ow = janet_unwrap_pointer(kv->key); Janet pathv = kv->value;