From 8ec1732af08424163ac78e11ca8aa4a03328db54 Mon Sep 17 00:00:00 2001 From: UMU Date: Sun, 13 Feb 2022 13:57:43 +0800 Subject: [PATCH] build: fix error C4146 on MSVC (#3271) > error C4146: unary minus operator applied to unsigned type, result still unsigned --- src/idna.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/idna.c b/src/idna.c index b44cb16a..93d982ca 100644 --- a/src/idna.c +++ b/src/idna.c @@ -21,6 +21,7 @@ #include "idna.h" #include #include +#include /* UINT_MAX */ static unsigned uv__utf8_decode1_slow(const char** p, const char* pe, @@ -129,7 +130,7 @@ static int uv__idna_toascii_label(const char* s, const char* se, while (s < se) { c = uv__utf8_decode1(&s, se); - if (c == -1u) + if (c == UINT_MAX) return UV_EINVAL; if (c < 128) @@ -151,7 +152,7 @@ static int uv__idna_toascii_label(const char* s, const char* se, s = ss; while (s < se) { c = uv__utf8_decode1(&s, se); - assert(c != -1u); + assert(c != UINT_MAX); if (c > 127) continue; @@ -182,7 +183,7 @@ static int uv__idna_toascii_label(const char* s, const char* se, while (s < se) { c = uv__utf8_decode1(&s, se); - assert(c != -1u); + assert(c != UINT_MAX); if (c >= n) if (c < m) @@ -201,7 +202,7 @@ static int uv__idna_toascii_label(const char* s, const char* se, s = ss; while (s < se) { c = uv__utf8_decode1(&s, se); - assert(c != -1u); + assert(c != UINT_MAX); if (c < n) if (++delta == 0) @@ -280,7 +281,7 @@ long uv__idna_toascii(const char* s, const char* se, char* d, char* de) { st = si; c = uv__utf8_decode1(&si, se); - if (c == -1u) + if (c == UINT_MAX) return UV_EINVAL; if (c != '.')