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;
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;

2
sort.c
View File

@ -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;

View File

@ -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;