cygwin 1.7 build fixes

It's less accepting of signed char ... insisting that e.g. tolower()
not receive one as a parameter.

It's probably good to phase out such usage, given the number of bugs
that lurk in the vicinity (assumptions that char is unsigned), so fix
these even though such usage is actually legal.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
This commit is contained in:
David Brownell 2009-12-26 10:19:19 -08:00
parent f9d203d1e6
commit 08a890e4aa
6 changed files with 16 additions and 14 deletions

View File

@ -1345,7 +1345,8 @@ COMMAND_HANDLER(mg_bank_cmd)
char *str;
mflash_bank->rst_pin.num = strtoul(CMD_ARGV[2], &str, 0);
if (*str)
mflash_bank->rst_pin.port[0] = (uint16_t)tolower(str[0]);
mflash_bank->rst_pin.port[0] = (uint16_t)
tolower((unsigned)str[0]);
mflash_bank->target = target;

View File

@ -2217,7 +2217,7 @@ static Jim_Obj *JimStringToLower(Jim_Interp *interp, Jim_Obj *strObjPtr)
memcpy(buf, strObjPtr->bytes, strObjPtr->length + 1);
for (i = 0; i < strObjPtr->length; i++)
buf[i] = tolower(buf[i]);
buf[i] = tolower((unsigned)buf[i]);
return Jim_NewStringObjNoAlloc(interp, buf, strObjPtr->length);
}
@ -2233,7 +2233,7 @@ static Jim_Obj *JimStringToUpper(Jim_Interp *interp, Jim_Obj *strObjPtr)
memcpy(buf, strObjPtr->bytes, strObjPtr->length + 1);
for (i = 0; i < strObjPtr->length; i++)
buf[i] = toupper(buf[i]);
buf[i] = toupper((unsigned)buf[i]);
return Jim_NewStringObjNoAlloc(interp, buf, strObjPtr->length);
}
@ -2347,7 +2347,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
case '8':
case '9':
accum = 0;
while (isdigit(*fmt) && (fmtLen > 0)) {
while (isdigit((unsigned)*fmt) && (fmtLen > 0)) {
accum = (accum * 10) + (*fmt - '0');
fmt++; fmtLen--;
}

View File

@ -943,7 +943,7 @@ void gdb_str_to_target(struct target *target, char *tstr, struct reg *reg)
}
}
static int hextoint(char c)
static int hextoint(int c)
{
if (c>='0'&&c<='9')
{

View File

@ -88,7 +88,7 @@ static int tcl_input(struct connection *connection)
const char *result;
int reslen;
struct tcl_connection *tclc;
char in[256];
unsigned char in[256];
rlen = read_socket(connection->fd, &in, sizeof(in));
if (rlen <= 0) {

View File

@ -195,8 +195,8 @@ void telnet_clear_line(struct connection *connection, struct telnet_connection *
int telnet_input(struct connection *connection)
{
int bytes_read;
char buffer[TELNET_BUFFER_SIZE];
char *buf_p;
unsigned char buffer[TELNET_BUFFER_SIZE];
unsigned char *buf_p;
struct telnet_connection *t_con = connection->priv;
struct command_context *command_context = connection->cmd_ctx;
@ -216,7 +216,7 @@ int telnet_input(struct connection *connection)
switch (t_con->state)
{
case TELNET_STATE_DATA:
if (*buf_p == '\xff')
if (*buf_p == 0xff)
{
t_con->state = TELNET_STATE_IAC;
}
@ -395,16 +395,16 @@ int telnet_input(struct connection *connection)
case TELNET_STATE_IAC:
switch (*buf_p)
{
case '\xfe':
case 0xfe:
t_con->state = TELNET_STATE_DONT;
break;
case '\xfd':
case 0xfd:
t_con->state = TELNET_STATE_DO;
break;
case '\xfc':
case 0xfc:
t_con->state = TELNET_STATE_WONT;
break;
case '\xfb':
case 0xfb:
t_con->state = TELNET_STATE_WILL;
break;
}

View File

@ -470,7 +470,8 @@ free_all:
#define SVFP_CMD_INC_CNT 1024
static int svf_read_command_from_file(int fd)
{
char ch, *tmp_buffer = NULL;
unsigned char ch;
char *tmp_buffer = NULL;
int cmd_pos = 0, cmd_ok = 0, slash = 0, comment = 0;
while (!cmd_ok && (read(fd, &ch, 1) > 0))