Fix warning 'array subscript of type char'
This commit is contained in:
		
							
								
								
									
										10
									
								
								fold.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								fold.c
									
									
									
									
									
								
							@@ -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
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								sort.c
									
									
									
									
									
								
							@@ -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;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user