From: Marcel Raad Date: Tue, 18 Aug 2015 07:39:38 +0000 (+0200) Subject: inet_pton.c: Fix MSVC run-time check failure X-Git-Tag: curl-7_45_0~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=618dfd65e4915fbd71247a960ef15e6c281d4fec;p=thirdparty%2Fcurl.git inet_pton.c: Fix MSVC run-time check failure Visual Studio complains with a message box: "Run-Time Check Failure #1 - A cast to a smaller data type has caused a loss of data. If this was intentional, you should mask the source of the cast with the appropriate bitmask. For example: char c = (i & 0xFF); Changing the code in this way will not affect the quality of the resulting optimized code." This is because only 'val' is cast to unsigned char, so the "& 0xff" has no effect. Closes #387 --- diff --git a/lib/inet_pton.c b/lib/inet_pton.c index f50b365da6..34dfc31e7e 100644 --- a/lib/inet_pton.c +++ b/lib/inet_pton.c @@ -189,7 +189,7 @@ inet_pton6(const char *src, unsigned char *dst) if(tp + INT16SZ > endp) return (0); *tp++ = (unsigned char) (val >> 8) & 0xff; - *tp++ = (unsigned char) val & 0xff; + *tp++ = (unsigned char) (val & 0xff); saw_xdigit = 0; val = 0; continue;