From 3b659f53201b13a124c18fe7e6c82ad27806adc8 Mon Sep 17 00:00:00 2001 From: dearblue Date: Thu, 2 Jan 2025 15:34:36 +0900 Subject: [PATCH] Properly cast the return value of `memchr()` --- mrbgems/mruby-io/src/file.c | 2 +- mrbgems/mruby-io/test/mruby_io_test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mrbgems/mruby-io/src/file.c b/mrbgems/mruby-io/src/file.c index 589f1be14..8f195aa70 100644 --- a/mrbgems/mruby-io/src/file.c +++ b/mrbgems/mruby-io/src/file.c @@ -381,7 +381,7 @@ mrb_file__gethome(mrb_state *mrb, mrb_value klass) char *pathp = RSTRING_PTR(path); const char *const pathend = pathp + RSTRING_LEN(path); for (;;) { - pathp = memchr((void*)pathp, '\\', (size_t)(pathend - pathp)); + pathp = (char*)memchr((void*)pathp, '\\', (size_t)(pathend - pathp)); if (!pathp) break; *pathp++ = '/'; } diff --git a/mrbgems/mruby-io/test/mruby_io_test.c b/mrbgems/mruby-io/test/mruby_io_test.c index d47e20cad..f11c960c2 100644 --- a/mrbgems/mruby-io/test/mruby_io_test.c +++ b/mrbgems/mruby-io/test/mruby_io_test.c @@ -257,7 +257,7 @@ mrb_mruby_io_gem_test(mrb_state* mrb) char *pathp = RSTRING_PTR(path); const char *const pathend = pathp + RSTRING_LEN(path); for (;;) { - pathp = memchr(pathp, '\\', pathend - pathp); + pathp = (char*)memchr(pathp, '\\', pathend - pathp); if (!pathp) break; *pathp++ = '/'; }