#985163 match.c: cast a character to an int for comparison with the function "tolower"

Package:
src:nn
Source:
nn
Submitter:
Bjarni Ingi Gislason
Date:
2021-03-13 21:15:06 UTC
Severity:
normal
Tags:
#985163#5
Date:
2021-03-13 21:13:18 UTC
From:
To:
Dear Maintainer,

match.c:61:48: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
   61 |  if (!isascii(c) || !isupper(c) || _tolower(c) != (unsigned) d)
      |                                                ^~

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 match.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/match.c b/match.c
index 8eadbeb..6f1969b 100644
--- a/match.c
+++ b/match.c
@@ -65,10 +65,10 @@ streq_fold(register char *mask, register char *str)
 	    continue;

 #ifdef _tolower
-	if (!isascii(c) || !isupper(c) || _tolower(c) != (unsigned) d)
+	if (!isascii(c) || !isupper(c) || _tolower(c) != (int) d)
 	    return 0;
 #else
-	if (tolower(c) != d)
+	if (tolower(c) != (int) d)
 	    return 0;
 #endif
     }
@@ -88,10 +88,10 @@ strmatch_fold(char *mask, register char *str)
 #ifdef _tolower
 	    if (!isascii(c) || !isupper(c))
 		continue;
-	    if (_tolower(c) == (unsigned) m1)
+	    if (_tolower(c) == (int) m1)
 		break;
 #else
-	    if (tolower(c) == m1)
+	    if (tolower(c) == (int) m1)
 		break;
 #endif
 	}