From e31298bdc3beb1cddedff1210f3e7d2bd34d2e1f Mon Sep 17 00:00:00 2001 From: daan Date: Mon, 20 Apr 2020 18:04:09 -0700 Subject: [PATCH] fix compiler warning in secure mode --- src/alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/alloc.c b/src/alloc.c index 90a1f461..607d15b6 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -650,7 +650,7 @@ mi_decl_restrict char* mi_strdup(const char* s) mi_attr_noexcept { mi_decl_restrict char* mi_heap_strndup(mi_heap_t* heap, const char* s, size_t n) mi_attr_noexcept { if (s == NULL) return NULL; const char* end = (const char*)memchr(s, 0, n); // find end of string in the first `n` characters (returns NULL if not found) - const size_t m = (end != NULL ? (end - s) : n); // `m` is the minimum of `n` or the end-of-string + const size_t m = (end != NULL ? (size_t)(end - s) : n); // `m` is the minimum of `n` or the end-of-string mi_assert_internal(m <= n); char* t = (char*)mi_heap_malloc(heap, m+1); if (t == NULL) return NULL;