sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit b712ef44ad49c5eed7fb89e1ab4b85a114ab4c6d
parent 0cbafaecb68a5977f99e00f4a084686193e1d5e1
Author: sin <sin@2f30.org>
Date:   Tue,  2 Sep 2014 12:45:39 +0100

Fix warning 'array subscript of type char'

Diffstat:
Mfold.c | 10++++++----
Msort.c | 2+-
Msplit.c | 2+-
3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/fold.c b/fold.c @@ -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 '\b': col--; break; diff --git a/sort.c b/sort.c @@ -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 @@ -41,7 +41,7 @@ main(int argc, char *argv[]) size = strtoull(tmp, &end, 10); if(*end == '\0') break; - switch(toupper(*end)) { + switch(toupper((int)*end)) { case 'K': scale = 1024; break;