# HG changeset patch # User Bruno Haible # Date 1538342205 -7200 # Node ID 6b0218435966305924271c644ab34b17eb645838 # Parent 7e5e23ac78b6407cdb67e1729576d649d4240263 vasnprintf: Avoid warnings from GCC's -Wsign-compare. Reported by Bjarni Ingi Gislason in . * lib/vasnprintf.c (VASNPRINTF): Cast 'count' from 'int' to 'unsigned int' before comparison with an unsigned value. diff -r 7e5e23ac78b6 -r 6b0218435966 ChangeLog --- a/ChangeLog Sun Sep 30 19:50:34 2018 +0200 +++ b/ChangeLog Sun Sep 30 23:16:45 2018 +0200 @@ -1,3 +1,11 @@ +2018-09-30 Bruno Haible + + vasnprintf: Avoid warnings from GCC's -Wsign-compare. + Reported by Bjarni Ingi Gislason in + . + * lib/vasnprintf.c (VASNPRINTF): Cast 'count' from 'int' to + 'unsigned int' before comparison with an unsigned value. + 2018-09-30 Bruno Haible grantpt: Remove unnecessary dependency. diff -r 7e5e23ac78b6 -r 6b0218435966 lib/vasnprintf.c --- a/lib/vasnprintf.c Sun Sep 30 19:50:34 2018 +0200 +++ b/lib/vasnprintf.c Sun Sep 30 23:16:45 2018 +0200 @@ -2696,7 +2696,7 @@ errno = EILSEQ; return NULL; } - if (precision < count) + if (precision < (unsigned int) count) break; arg_end++; characters += count; @@ -5127,7 +5127,7 @@ { /* Verify that snprintf() has NUL-terminated its result. */ - if (count < maxlen + if ((unsigned int) count < maxlen && ((TCHAR_T *) (result + length)) [count] != '\0') abort (); /* Portability hack. */