From 63c2ea5566cc7a0983cc748a3d4855d24beeebda Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Mon, 18 Sep 2023 16:00:46 +0800 Subject: [PATCH] fixes incorrect cint overflow in system (#22718) fixes #22700 --- lib/std/syncio.nim | 2 +- lib/system.nim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/syncio.nim b/lib/std/syncio.nim index 879301f8af..498b2b5a44 100644 --- a/lib/std/syncio.nim +++ b/lib/std/syncio.nim @@ -246,7 +246,7 @@ when defined(windows): # machine. We also enable `setConsoleOutputCP(65001)` now by default. # But we cannot call printf directly as the string might contain \0. # So we have to loop over all the sections separated by potential \0s. - var i = c_fprintf(f, "%s", s) + var i = int c_fprintf(f, "%s", s) while i < s.len: if s[i] == '\0': let w = c_fputc('\0', f) diff --git a/lib/system.nim b/lib/system.nim index 4949430a34..633f637ca0 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2788,7 +2788,7 @@ when notJSnotNims: # machine. We also enable `setConsoleOutputCP(65001)` now by default. # But we cannot call printf directly as the string might contain \0. # So we have to loop over all the sections separated by potential \0s. - var i = c_fprintf(f, "%s", s) + var i = int c_fprintf(f, "%s", s) while i < s.len: if s[i] == '\0': let w = c_fputc('\0', f)