parse: Fix two compiler warnings
authorBart Van Assche <bart.vanassche@wdc.com>
Mon, 12 Mar 2018 21:24:27 +0000 (14:24 -0700)
committerBart Van Assche <bart.vanassche@wdc.com>
Mon, 12 Mar 2018 21:42:55 +0000 (14:42 -0700)
Avoid that gcc on NetBSD reports the following compiler warnings:

    CC parse.o
parse.c: In function 'get_mult_time':
parse.c:175: warning: array subscript has type 'char'
parse.c: In function '__get_mult_bytes':
parse.c:221: warning: array subscript has type 'char'

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
parse.c

diff --git a/parse.c b/parse.c
index a9ee1cee42aa486deb11b504868f5763a23eecca..fdb66115c310d2f60652e37fcd0d410eeaa23dd5 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -172,7 +172,7 @@ static unsigned long long get_mult_time(const char *str, int len,
 
        c = strdup(p);
        for (i = 0; i < strlen(c); i++)
 
        c = strdup(p);
        for (i = 0; i < strlen(c); i++)
-               c[i] = tolower(c[i]);
+               c[i] = tolower((unsigned char)c[i]);
 
        if (!strncmp("us", c, 2) || !strncmp("usec", c, 4))
                mult = 1;
 
        if (!strncmp("us", c, 2) || !strncmp("usec", c, 4))
                mult = 1;
@@ -218,7 +218,7 @@ static unsigned long long __get_mult_bytes(const char *p, void *data,
        c = strdup(p);
 
        for (i = 0; i < strlen(c); i++) {
        c = strdup(p);
 
        for (i = 0; i < strlen(c); i++) {
-               c[i] = tolower(c[i]);
+               c[i] = tolower((unsigned char)c[i]);
                if (is_separator(c[i])) {
                        c[i] = '\0';
                        break;
                if (is_separator(c[i])) {
                        c[i] = '\0';
                        break;