Fix warning 'array subscript of type char'

This commit is contained in:
sin 2014-09-02 12:45:39 +01:00
parent 0cbafaecb6
commit b712ef44ad
3 changed files with 8 additions and 6 deletions

10
fold.c
View File

@ -75,21 +75,23 @@ foldline(const char *str, long width)
bool space; bool space;
long col, j; long col, j;
size_t i = 0, n = 0; size_t i = 0, n = 0;
int c;
do { do {
space = false; space = false;
for(j = i, col = 0; str[j] && col <= width; j++) { 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; continue;
if(sflag && isspace(str[j])) { if(sflag && isspace(c)) {
space = true; space = true;
n = j+1; n = j+1;
} }
else if(!space) else if(!space)
n = j; n = j;
if(!bflag && iscntrl(str[j])) if(!bflag && iscntrl(c))
switch(str[j]) { switch(c) {
case '\b': case '\b':
col--; col--;
break; break;

2
sort.c
View File

@ -172,7 +172,7 @@ linecmp(const char **a, const char **b)
static int static int
parse_flags(char **s, int *flags, int bflag) parse_flags(char **s, int *flags, int bflag)
{ {
while(isalpha(**s)) while(isalpha((int)**s))
switch(*((*s)++)) { switch(*((*s)++)) {
case 'b': case 'b':
*flags |= bflag; *flags |= bflag;

View File

@ -41,7 +41,7 @@ main(int argc, char *argv[])
size = strtoull(tmp, &end, 10); size = strtoull(tmp, &end, 10);
if(*end == '\0') if(*end == '\0')
break; break;
switch(toupper(*end)) { switch(toupper((int)*end)) {
case 'K': case 'K':
scale = 1024; scale = 1024;
break; break;