]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix ctype invocation casts.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 13 Oct 2014 08:22:34 +0000 (08:22 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 13 Oct 2014 08:22:34 +0000 (08:22 +0000)
git-svn-id: file:///svn/unbound/trunk@3241 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
ldns/str2wire.c
ldns/wire2str.c

index 73b99194c1441a3dccda26794a16dcf04abb0c11..4e89f933ee4245f96d0fba436091e6139b3cc28f 100644 (file)
@@ -1,5 +1,6 @@
 13 October 2014: Wouter
        - Fix #617: in ldns in unbound, lowercase WKS services.
+       - Fix ctype invocation casts.
 
 10 October 2014: Wouter
        - Fix unbound-checkconf check for module config with dns64 module.
index 01b1a2589a460f7baaeb250809c175f3dd3961fb..ff5060702a8a46149df55337bbe3ada44b141a73 100644 (file)
@@ -245,7 +245,7 @@ rrinternal_get_ttl(sldns_buffer* strbuf, char* token, size_t token_len,
        }
        *ttl = (uint32_t) sldns_str2period(token, &endptr);
 
-       if (strlen(token) > 0 && !isdigit((int)token[0])) {
+       if (strlen(token) > 0 && !isdigit((unsigned char)token[0])) {
                *not_there = 1;
                /* ah, it's not there or something */
                if (default_ttl == 0) {
@@ -388,7 +388,7 @@ rrinternal_spool_hex(char* token, uint8_t* rr, size_t rr_len,
                        p++;
                        continue;
                }
-               if(!isxdigit(*p))
+               if(!isxdigit((unsigned char)*p))
                        return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_RDATA,
                                p-token);
                if(*cur_hex_data_size >= hex_data_size)
@@ -1201,7 +1201,7 @@ int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len)
                        s++;
                        continue;
                }
-               if(!isxdigit(*s))
+               if(!isxdigit((unsigned char)*s))
                        return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
                if(*len < dlen/2 + 1)
                        return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
@@ -1401,7 +1401,7 @@ static int
 loc_parse_cm(char* my_str, char** endstr, uint8_t* m, uint8_t* e)
 {
        uint32_t meters = 0, cm = 0, val;
-       while (isblank(*my_str)) {
+       while (isblank((unsigned char)*my_str)) {
                my_str++;
        }
        meters = (uint32_t)strtol(my_str, &my_str, 10);
@@ -1452,17 +1452,17 @@ int sldns_str2wire_loc_buf(const char* str, uint8_t* rd, size_t* len)
 
        char *my_str = (char *) str;
 
-       if (isdigit((int) *my_str)) {
+       if (isdigit((unsigned char) *my_str)) {
                h = (uint32_t) strtol(my_str, &my_str, 10);
        } else {
                return LDNS_WIREPARSE_ERR_INVALID_STR;
        }
 
-       while (isblank((int) *my_str)) {
+       while (isblank((unsigned char) *my_str)) {
                my_str++;
        }
 
-       if (isdigit((int) *my_str)) {
+       if (isdigit((unsigned char) *my_str)) {
                m = (uint32_t) strtol(my_str, &my_str, 10);
        } else if (*my_str == 'N' || *my_str == 'S') {
                goto north;
@@ -1470,16 +1470,16 @@ int sldns_str2wire_loc_buf(const char* str, uint8_t* rd, size_t* len)
                return LDNS_WIREPARSE_ERR_INVALID_STR;
        }
 
-       while (isblank((int) *my_str)) {
+       while (isblank((unsigned char) *my_str)) {
                my_str++;
        }
 
-       if (isdigit((int) *my_str)) {
+       if (isdigit((unsigned char) *my_str)) {
                s = strtod(my_str, &my_str);
        }
 
        /* skip blanks before norterness */
-       while (isblank((int) *my_str)) {
+       while (isblank((unsigned char) *my_str)) {
                my_str++;
        }
 
@@ -1506,21 +1506,21 @@ north:
        } else {
                latitude = equator - latitude;
        }
-       while (isblank(*my_str)) {
+       while (isblank((unsigned char)*my_str)) {
                my_str++;
        }
 
-       if (isdigit((int) *my_str)) {
+       if (isdigit((unsigned char) *my_str)) {
                h = (uint32_t) strtol(my_str, &my_str, 10);
        } else {
                return LDNS_WIREPARSE_ERR_INVALID_STR;
        }
 
-       while (isblank((int) *my_str)) {
+       while (isblank((unsigned char) *my_str)) {
                my_str++;
        }
 
-       if (isdigit((int) *my_str)) {
+       if (isdigit((unsigned char) *my_str)) {
                m = (uint32_t) strtol(my_str, &my_str, 10);
        } else if (*my_str == 'E' || *my_str == 'W') {
                goto east;
@@ -1528,16 +1528,16 @@ north:
                return LDNS_WIREPARSE_ERR_INVALID_STR;
        }
 
-       while (isblank(*my_str)) {
+       while (isblank((unsigned char)*my_str)) {
                my_str++;
        }
 
-       if (isdigit((int) *my_str)) {
+       if (isdigit((unsigned char) *my_str)) {
                s = strtod(my_str, &my_str);
        }
 
        /* skip blanks before easterness */
-       while (isblank(*my_str)) {
+       while (isblank((unsigned char)*my_str)) {
                my_str++;
        }
 
@@ -1707,7 +1707,7 @@ int sldns_str2wire_nsap_buf(const char* str, uint8_t* rd, size_t* len)
                        s++;
                        continue;
                }
-               if(!isxdigit(*s))
+               if(!isxdigit((unsigned char)*s))
                        return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
                if(*len < dlen/2 + 1)
                        return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
@@ -1738,7 +1738,7 @@ int sldns_str2wire_atma_buf(const char* str, uint8_t* rd, size_t* len)
                        s++;
                        continue;
                }
-               if(!isxdigit(*s))
+               if(!isxdigit((unsigned char)*s))
                        return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
                if(*len < dlen/2 + 1)
                        return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
@@ -1841,7 +1841,8 @@ int sldns_str2wire_nsec3_salt_buf(const char* str, uint8_t* rd, size_t* len)
                return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
        rd[0] = (uint8_t) (salt_length_str / 2);
        for (i = 0; i < salt_length_str; i += 2) {
-               if (isxdigit((int)str[i]) && isxdigit((int)str[i+1])) {
+               if (isxdigit((unsigned char)str[i]) &&
+                       isxdigit((unsigned char)str[i+1])) {
                        rd[1+i/2] = (uint8_t)(sldns_hexdigit_to_int(str[i])*16
                                + sldns_hexdigit_to_int(str[i+1]));
                } else {
index c2a1850ef9b6f8e5015894fbcb2dcc40106208fb..81e173c78d5895e3eaa116c5aa8ea559a448bc95 100644 (file)
@@ -722,7 +722,7 @@ static int dname_char_print(char** s, size_t* slen, uint8_t c)
 {
        if(c == '.' || c == ';' || c == '(' || c == ')' || c == '\\')
                return sldns_str_print(s, slen, "\\%c", c);
-       else if(!(isascii((int)c) && isgraph((int)c)))
+       else if(!(isascii((unsigned char)c) && isgraph((unsigned char)c)))
                return sldns_str_print(s, slen, "\\%03u", (unsigned)c);
        /* plain printout */
        if(*slen) {
@@ -1064,7 +1064,7 @@ int sldns_wire2str_aaaa_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
 /** printout escaped TYPE_STR character */
 static int str_char_print(char** s, size_t* sl, uint8_t c)
 {
-       if(isprint((int)c) || c == '\t') {
+       if(isprint((unsigned char)c) || c == '\t') {
                if(c == '\"' || c == '\\')
                        return sldns_str_print(s, sl, "\\%c", c);
                if(*sl) {
@@ -1625,7 +1625,7 @@ int sldns_wire2str_tag_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
        if(*dl < 1+n)
                return -1;
        for(i=0; i<n; i++)
-               if(!isalnum((int)(*d)[i]))
+               if(!isalnum((unsigned char)(*d)[i]))
                        return -1;
        for(i=0; i<n; i++)
                w += sldns_str_print(s, sl, "%c", (char)(*d)[i]);
@@ -1713,7 +1713,7 @@ int sldns_wire2str_edns_nsid_print(char** s, size_t* sl, uint8_t* data,
        size_t i, printed=0;
        w += print_hex_buf(s, sl, data, len);
        for(i=0; i<len; i++) {
-               if(isprint((int)data[i]) || data[i] == '\t') {
+               if(isprint((unsigned char)data[i]) || data[i] == '\t') {
                        if(!printed) {
                                w += sldns_str_print(s, sl, " (");
                                printed = 1;