cygwin fix : use unsigned char for ctype function

See http://www.nabble.com/-PATCH-RFA--Distinguish-between-EOF-and-character-with-value-0xff-td23161772.html#a23188494

cygwin 1.7 actually displays a warning when using signed char with the ctype
function, so that compilation fails when using -Wall -Werror.

So we just cast all arguments to unsigned char.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Xavier Chantry 2009-09-26 00:58:42 +02:00 committed by Dan McGee
parent 35bbc96b99
commit caea098c21
4 changed files with 8 additions and 8 deletions

View File

@ -495,7 +495,7 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
}
_alpm_strtrim(line);
char first = tolower(line[0]);
char first = tolower((unsigned char)line[0]);
if(first > 'a' && first < 'z') {
struct tm tmp_tm = {0}; /* initialize to null in case of failure */
setlocale(LC_TIME, "C");
@ -511,7 +511,7 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
}
_alpm_strtrim(line);
char first = tolower(line[0]);
char first = tolower((unsigned char)line[0]);
if(first > 'a' && first < 'z') {
struct tm tmp_tm = {0}; /* initialize to null in case of failure */
setlocale(LC_TIME, "C");

View File

@ -82,7 +82,7 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
} else if(!strcmp(key, "license")) {
newpkg->licenses = alpm_list_add(newpkg->licenses, strdup(ptr));
} else if(!strcmp(key, "builddate")) {
char first = tolower(ptr[0]);
char first = tolower((unsigned char)ptr[0]);
if(first > 'a' && first < 'z') {
struct tm tmp_tm = {0}; /* initialize to null in case of failure */
setlocale(LC_TIME, "C");

View File

@ -175,7 +175,7 @@ char *_alpm_strtrim(char *str)
return(str);
}
while(isspace((int)*pch)) {
while(isspace((unsigned char)*pch)) {
pch++;
}
if(pch != str) {
@ -188,7 +188,7 @@ char *_alpm_strtrim(char *str)
}
pch = (str + (strlen(str) - 1));
while(isspace((int)*pch)) {
while(isspace((unsigned char)*pch)) {
pch--;
}
*++pch = '\0';

View File

@ -297,7 +297,7 @@ char *strtoupper(char *str)
char *ptr = str;
while(*ptr) {
(*ptr) = toupper(*ptr);
(*ptr) = toupper((unsigned char)*ptr);
ptr++;
}
return str;
@ -314,7 +314,7 @@ char *strtrim(char *str)
return(str);
}
while(isspace(*pch)) {
while(isspace((unsigned char)*pch)) {
pch++;
}
if(pch != str) {
@ -327,7 +327,7 @@ char *strtrim(char *str)
}
pch = (str + (strlen(str) - 1));
while(isspace(*pch)) {
while(isspace((unsigned char)*pch)) {
pch--;
}
*++pch = '\0';