cygwin 1.7 build fixes
authorDavid Brownell <dbrownell@users.sourceforge.net>
Sat, 26 Dec 2009 18:19:19 +0000 (10:19 -0800)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Sat, 26 Dec 2009 18:19:19 +0000 (10:19 -0800)
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>
src/flash/mflash.c
src/helper/jim.c
src/server/gdb_server.c
src/server/tcl_server.c
src/server/telnet_server.c
src/svf/svf.c

index 123d61c..5c8ca8c 100644 (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;
 
index c04acf0..53d1a75 100644 (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--;
                        }
index 8798ae0..cf62864 100644 (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')
        {
index 0824768..a772c0a 100644 (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) {
index 929c1c1..92e7480 100644 (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;
                                }
index 1c746f3..dfdecbc 100644 (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))