]> git.sur5r.net Git - openocd/commitdiff
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 123d61ce82e1afd5d69f5186a593f8dd7085e7ff..5c8ca8c16b46cc6912301c814cc3faa38a2e8999 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 c04acf09f870273e0392d9ae2c174615a2996b56..53d1a75eb34e241c012c91fe09f2ea868b728e09 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 8798ae03c92110529db51775eff82ad594e01632..cf62864188feffda109dc007d92ed083479a7cbf 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 082476861b5e3999f3216570fa9dfc1a942f3075..a772c0aca6d32ae0266d3a3717df9aceb6f92eaa 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 929c1c16efd8fe333ee2627c5547a802e1a10b25..92e7480b93e3a40b865324c64af0e6cab565b126 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 1c746f382c724042b9a1448d3223b94ef1cee67e..dfdecbcd83c6c082c563d74f9853db66944deeaa 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))