[hackers] [sbase] Fix warning 'array subscript of type char' || sin

From: <git_AT_suckless.org>
Date: Tue, 02 Sep 2014 14:32:50 +0200

commit b712ef44ad49c5eed7fb89e1ab4b85a114ab4c6d
Author: sin <sin_AT_2f30.org>
Date: Tue Sep 2 12:45:39 2014 +0100

    Fix warning 'array subscript of type char'

diff --git a/fold.c b/fold.c
index c307bb9..9f6d66a 100644
--- a/fold.c
+++ b/fold.c
_AT_@ -75,21 +75,23 @@ foldline(const char *str, long width)
         bool space;
         long col, j;
         size_t i = 0, n = 0;
+ int c;
 
         do {
                 space = false;
                 for(j = i, col = 0; str[j] && col <= width; j++) {
- if(!UTF8_POINT(str[j]) && !bflag)
+ c = str[j];
+ if(!UTF8_POINT(c) && !bflag)
                                 continue;
- if(sflag && isspace(str[j])) {
+ if(sflag && isspace(c)) {
                                 space = true;
                                 n = j+1;
                         }
                         else if(!space)
                                 n = j;
 
- if(!bflag && iscntrl(str[j]))
- switch(str[j]) {
+ if(!bflag && iscntrl(c))
+ switch(c) {
                                 case '':
                                         col--;
                                         break;
diff --git a/sort.c b/sort.c
index b0b9131..e97673b 100644
--- a/sort.c
+++ b/sort.c
_AT_@ -172,7 +172,7 @@ linecmp(const char **a, const char **b)
 static int
 parse_flags(char **s, int *flags, int bflag)
 {
- while(isalpha(**s))
+ while(isalpha((int)**s))
                 switch(*((*s)++)) {
                 case 'b':
                         *flags |= bflag;
diff --git a/split.c b/split.c
index 638af54..4b2c2d8 100644
--- a/split.c
+++ b/split.c
_AT_@ -41,7 +41,7 @@ main(int argc, char *argv[])
                 size = strtoull(tmp, &end, 10);
                 if(*end == '
Received on Tue Sep 02 2014 - 14:32:50 CEST

This archive was generated by hypermail 2.3.0 : Tue Sep 02 2014 - 14:36:09 CEST