]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
More casts.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 13 Oct 2014 09:23:12 +0000 (09:23 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 13 Oct 2014 09:23:12 +0000 (09:23 +0000)
git-svn-id: file:///svn/unbound/trunk@3244 be551aaa-1e26-0410-a405-d3ace91eadb9

compat/strptime.c
daemon/remote.c
ldns/parseutil.c
ldns/str2wire.c
services/modstack.c
testcode/replay.c
testcode/testbound.c
testcode/testpkts.c
util/config_file.c
validator/autotrust.c
validator/val_anchor.c

index 3dd8a7b4885a30e9bb212ffb27c7a869517faf34..10ec315748b25fe13db6859d7d828a30e5a9fa16 100644 (file)
@@ -111,11 +111,11 @@ unbound_strptime(const char *s, const char *format, struct tm *tm)
 
        while ((c = *format) != '\0') {
                /* whitespace, literal or format */
-               if (isspace(c)) { /* whitespace */
+               if (isspace((unsigned char)c)) { /* whitespace */
                        /** whitespace matches zero or more whitespace characters in the
                          * input string.
                         **/
-                       while (isspace(*s))
+                       while (isspace((unsigned char)*s))
                                s++;
                }
                else if (c == '%') { /* format */
@@ -221,7 +221,7 @@ unbound_strptime(const char *s, const char *format, struct tm *tm)
                                        break;
                                case 'n': /* arbitrary whitespace */
                                case 't':
-                                       while (isspace(*s))
+                                       while (isspace((unsigned char)*s))
                                                s++;
                                        break;
                                case 'p': /* am pm */
index 100aa8be1c7355664965486fbf1ff36609294d93..e56572048d4f6246026e3c242558491b1e27f082 100644 (file)
@@ -558,7 +558,7 @@ static char*
 skipwhite(char* str)
 {
        /* EOS \0 is not a space */
-       while( isspace(*str) ) 
+       while( isspace((unsigned char)*str) ) 
                str++;
        return str;
 }
index 7d3841619a28cf37e7b9855a43835007c1cc7aae..5c070aae0399efa46831bc35a6c84481ea28394d 100644 (file)
@@ -467,7 +467,7 @@ sldns_b32_pton_base(const char* src, size_t src_sz, uint8_t* dst, size_t dst_sz,
                                ch = *src++;
                                --src_sz;
 
-                       } while (isspace(ch) && src_sz > 0);
+                       } while (isspace((unsigned char)ch) && src_sz > 0);
 
                        if (ch == '=' || ch == '\0')
                                break;
@@ -572,7 +572,7 @@ sldns_b32_pton_base(const char* src, size_t src_sz, uint8_t* dst, size_t dst_sz,
                                        ch = *src++;
                                        src_sz--;
 
-                               } while (isspace(ch));
+                               } while (isspace((unsigned char)ch));
 
                                if (ch != '=')
                                        return -1;
index 31ef6e10a72cfd1dcbeb551f3cf658843ace9d1f..931e28f84e3e55ff27828deb5570bfbb08208945 100644 (file)
@@ -384,7 +384,7 @@ rrinternal_spool_hex(char* token, uint8_t* rr, size_t rr_len,
 {
        char* p = token;
        while(*p) {
-               if(isspace(*p)) {
+               if(isspace((unsigned char)*p)) {
                        p++;
                        continue;
                }
@@ -833,9 +833,9 @@ sldns_strip_ws(char *line)
 {
         char *s = line, *e;
 
-        for (s = line; *s && isspace(*s); s++)
+        for (s = line; *s && isspace((unsigned char)*s); s++)
                 ;
-        for (e = strchr(s, 0); e > s+2 && isspace(e[-1]) && e[-2] != '\\'; e--)
+        for (e = strchr(s, 0); e > s+2 && isspace((unsigned char)e[-1]) && e[-2] != '\\'; e--)
                 ;
         *e = 0;
         return s;
@@ -866,7 +866,7 @@ int sldns_fp2wire_rr_buf(FILE* in, uint8_t* rr, size_t* len, size_t* dname_len,
                return LDNS_WIREPARSE_ERR_OK;
        }
 
-       if(strncmp(line, "$ORIGIN", 7) == 0 && isspace(line[7])) {
+       if(strncmp(line, "$ORIGIN", 7) == 0 && isspace((unsigned char)line[7])) {
                int s;
                *len = 0;
                *dname_len = 0;
@@ -876,7 +876,7 @@ int sldns_fp2wire_rr_buf(FILE* in, uint8_t* rr, size_t* len, size_t* dname_len,
                        parse_state->origin, &parse_state->origin_len);
                if(s) parse_state->origin_len = 0;
                return s;
-       } else if(strncmp(line, "$TTL", 4) == 0 && isspace(line[4])) {
+       } else if(strncmp(line, "$TTL", 4) == 0 && isspace((unsigned char)line[4])) {
                const char* end = NULL;
                *len = 0;
                *dname_len = 0;
@@ -1197,7 +1197,7 @@ int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len)
        const char* s = str;
        size_t dlen = 0; /* number of hexdigits parsed */
        while(*s) {
-               if(isspace(*s)) {
+               if(isspace((unsigned char)*s)) {
                        s++;
                        continue;
                }
@@ -1703,7 +1703,7 @@ int sldns_str2wire_nsap_buf(const char* str, uint8_t* rd, size_t* len)
        if(slen > LDNS_MAX_RDFLEN*2)
                return LDNS_WIREPARSE_ERR_LABEL_OVERFLOW;
        while(*s) {
-               if(isspace(*s) || *s == '.') {
+               if(isspace((unsigned char)*s) || *s == '.') {
                        s++;
                        continue;
                }
@@ -1734,7 +1734,7 @@ int sldns_str2wire_atma_buf(const char* str, uint8_t* rd, size_t* len)
        if(slen > LDNS_MAX_RDFLEN*2)
                return LDNS_WIREPARSE_ERR_LABEL_OVERFLOW;
        while(*s) {
-               if(isspace(*s) || *s == '.') {
+               if(isspace((unsigned char)*s) || *s == '.') {
                        s++;
                        continue;
                }
index a99030bc3defdb1194bb41c10a1f04b76529e850..49bb2fd15adf455988b18640f7df4c007e786a4a 100644 (file)
@@ -60,12 +60,12 @@ count_modules(const char* s)
                 return 0;
         while(*s) {
                 /* skip whitespace */
-                while(*s && isspace((int)*s))
+                while(*s && isspace((unsigned char)*s))
                         s++;
-                if(*s && !isspace((int)*s)) {
+                if(*s && !isspace((unsigned char)*s)) {
                         /* skip identifier */
                         num++;
-                        while(*s && !isspace((int)*s))
+                        while(*s && !isspace((unsigned char)*s))
                                 s++;
                 }
         }
@@ -152,7 +152,7 @@ module_func_block* module_factory(const char** str)
         const char* s = *str;
        const char** names = module_list_avail();
        fbgetfunctype* fb = module_funcs_avail();
-        while(*s && isspace((int)*s))
+        while(*s && isspace((unsigned char)*s))
                 s++;
        while(names[i]) {
                 if(strncmp(names[i], s, strlen(names[i])) == 0) {
index eb2a7a6507d90a31a6eed56ccd0b084e1cc49197..5c1197146396aa4c628e5de6afc9b4daa038b6e9 100644 (file)
@@ -130,7 +130,7 @@ strip_end_white(char* p)
 {
        size_t i;
        for(i = strlen(p); i > 0; i--) {
-               if(isspace((int)p[i-1]))
+               if(isspace((unsigned char)p[i-1]))
                        p[i-1] = 0;
                else return;
        }
@@ -170,14 +170,14 @@ replay_range_read(char* remain, FILE* in, const char* name,
        while(fgets(line, MAX_LINE_LEN-1, in)) {
                pstate->lineno++;
                parse = line;
-               while(isspace((int)*parse))
+               while(isspace((unsigned char)*parse))
                        parse++;
                if(!*parse || *parse == ';') {
                        pos = ftello(in);
                        continue;
                }
                if(parse_keyword(&parse, "ADDRESS")) {
-                       while(isspace((int)*parse))
+                       while(isspace((unsigned char)*parse))
                                parse++;
                        strip_end_white(parse);
                        if(!extstrtoaddr(parse, &rng->addr, &rng->addrlen)) {
@@ -281,7 +281,7 @@ replay_moment_read(char* remain, FILE* in, const char* name,
                return NULL;
        }
        remain += skip;
-       while(isspace((int)*remain))
+       while(isspace((unsigned char)*remain))
                remain++;
        if(parse_keyword(&remain, "NOTHING")) {
                mom->evt_type = repevt_nothing;
@@ -303,10 +303,10 @@ replay_moment_read(char* remain, FILE* in, const char* name,
                mom->evt_type = repevt_timeout;
        } else if(parse_keyword(&remain, "TIME_PASSES")) {
                mom->evt_type = repevt_time_passes;
-               while(isspace((int)*remain))
+               while(isspace((unsigned char)*remain))
                        remain++;
                if(parse_keyword(&remain, "EVAL")) {
-                       while(isspace((int)*remain))
+                       while(isspace((unsigned char)*remain))
                                remain++;
                        mom->string = strdup(remain);
                        if(!mom->string) fatal_exit("out of memory");
@@ -316,7 +316,7 @@ replay_moment_read(char* remain, FILE* in, const char* name,
                }
        } else if(parse_keyword(&remain, "CHECK_AUTOTRUST")) {
                mom->evt_type = repevt_autotrust_check;
-               while(isspace((int)*remain))
+               while(isspace((unsigned char)*remain))
                        remain++;
                if(strlen(remain)>0 && remain[strlen(remain)-1]=='\n')
                        remain[strlen(remain)-1] = 0;
@@ -333,20 +333,20 @@ replay_moment_read(char* remain, FILE* in, const char* name,
        } else if(parse_keyword(&remain, "INFRA_RTT")) {
                char *s, *m;
                mom->evt_type = repevt_infra_rtt;
-               while(isspace((int)*remain))
+               while(isspace((unsigned char)*remain))
                        remain++;
                s = remain;
                remain = strchr(s, ' ');
                if(!remain) fatal_exit("expected three args for INFRA_RTT");
                remain[0] = 0;
                remain++;
-               while(isspace((int)*remain))
+               while(isspace((unsigned char)*remain))
                        remain++;
                m = strchr(remain, ' ');
                if(!m) fatal_exit("expected three args for INFRA_RTT");
                m[0] = 0;
                m++;
-               while(isspace((int)*m))
+               while(isspace((unsigned char)*m))
                        m++;
                if(!extstrtoaddr(s, &mom->addr, &mom->addrlen))
                        fatal_exit("bad infra_rtt address %s", s);
@@ -361,10 +361,10 @@ replay_moment_read(char* remain, FILE* in, const char* name,
                free(mom);
                return NULL;
        }
-       while(isspace((int)*remain))
+       while(isspace((unsigned char)*remain))
                remain++;
        if(parse_keyword(&remain, "ADDRESS")) {
-               while(isspace((int)*remain))
+               while(isspace((unsigned char)*remain))
                        remain++;
                if(strlen(remain) > 0) /* remove \n */
                        remain[strlen(remain)-1] = 0;
@@ -408,7 +408,7 @@ static struct replay_scenario*
 make_scenario(char* line)
 {
        struct replay_scenario* scen;
-       while(isspace((int)*line))
+       while(isspace((unsigned char)*line))
                line++;
        if(!*line) {
                log_err("scenario: no title given");
@@ -442,7 +442,7 @@ replay_scenario_read(FILE* in, const char* name, int* lineno)
                parse=line;
                pstate.lineno++;
                (*lineno)++;
-               while(isspace((int)*parse))
+               while(isspace((unsigned char)*parse))
                        parse++;
                if(!*parse) 
                        continue; /* empty line */
index b994b8f7eefd2a94f5fef9b7cc53c76fc162bd44..daf8ddd41547dd6c57acf5d35cde586503cb1856 100644 (file)
@@ -97,7 +97,7 @@ add_opts(const char* args, int* pass_argc, char* pass_argv[])
 {
        const char *p = args, *np;
        size_t len;
-       while(p && isspace((int)*p)) 
+       while(p && isspace((unsigned char)*p)) 
                p++;
        while(p && *p) {
                /* find location of next string and length of this one */
@@ -115,7 +115,7 @@ add_opts(const char* args, int* pass_argc, char* pass_argv[])
                (*pass_argc)++;
                /* go to next option */
                p = np;
-               while(p && isspace((int)*p)) 
+               while(p && isspace((unsigned char)*p)) 
                        p++;
        }
 }
@@ -140,7 +140,7 @@ spool_auto_file(FILE* in, int* lineno, FILE* cfg, char* id)
        char* parse;
        FILE* spool;
        /* find filename for new file */
-       while(isspace((int)*id))
+       while(isspace((unsigned char)*id))
                id++;
        if(strlen(id)==0) 
                fatal_exit("AUTROTRUST_FILE must have id, line %d", *lineno);
@@ -158,7 +158,7 @@ spool_auto_file(FILE* in, int* lineno, FILE* cfg, char* id)
        while(fgets(line, MAX_LINE_LEN-1, in)) {
                parse = line;
                (*lineno)++;
-               while(isspace((int)*parse))
+               while(isspace((unsigned char)*parse))
                        parse++;
                if(strncmp(parse, "AUTOTRUST_END", 13) == 0) {
                        fclose(spool);
@@ -197,7 +197,7 @@ setup_config(FILE* in, int* lineno, int* pass_argc, char* pass_argv[])
        while(fgets(line, MAX_LINE_LEN-1, in)) {
                parse = line;
                (*lineno)++;
-               while(isspace((int)*parse))
+               while(isspace((unsigned char)*parse))
                        parse++;
                if(!*parse || parse[0] == ';')
                        continue;
index 725e3a4bad000640a72bc0efd442529d3e693d09..a494d9f01d7b9fd7062c42c18e2370ddaf139894 100644 (file)
@@ -81,7 +81,7 @@ static int str_keyword(char** str, const char* keyword)
        if(strncmp(*str, keyword, len) != 0)
                return 0;
        *str += len;
-       while(isspace((int)**str))
+       while(isspace((unsigned char)**str))
                (*str)++;
        return 1;
 }
@@ -138,7 +138,7 @@ static void matchline(char* line, struct entry* e)
                                error("expected = or : in MATCH: %s", line);
                        parse++;
                        e->ixfr_soa_serial = (uint32_t)strtol(parse, (char**)&parse, 10);
-                       while(isspace((int)*parse)) 
+                       while(isspace((unsigned char)*parse)) 
                                parse++;
                } else {
                        error("could not parse MATCH: '%s'", parse);
@@ -226,11 +226,11 @@ static void adjustline(char* line, struct entry* e,
                        e->copy_query = 1;
                } else if(str_keyword(&parse, "sleep=")) {
                        e->sleeptime = (unsigned int) strtol(parse, (char**)&parse, 10);
-                       while(isspace((int)*parse)) 
+                       while(isspace((unsigned char)*parse)) 
                                parse++;
                } else if(str_keyword(&parse, "packet_sleep=")) {
                        pkt->packet_sleep = (unsigned int) strtol(parse, (char**)&parse, 10);
-                       while(isspace((int)*parse)) 
+                       while(isspace((unsigned char)*parse)) 
                                parse++;
                } else {
                        error("could not parse ADJUST: '%s'", parse);
@@ -422,7 +422,7 @@ get_origin(const char* name, struct sldns_file_parse_state* pstate, char* parse)
        int status;
 
        end=parse;
-       while(!isspace((int)*end) && !isendline(*end))
+       while(!isspace((unsigned char)*end) && !isendline(*end))
                end++;
        store = *end;
        *end = 0;
@@ -518,7 +518,7 @@ read_entry(FILE* in, const char* name, struct sldns_file_parse_state* pstate,
                parse = line;
                pstate->lineno++;
 
-               while(isspace((int)*parse))
+               while(isspace((unsigned char)*parse))
                        parse++;
                /* test for keywords */
                if(isendline(*parse))
index 1fb534625de2f967d477263e4895775b05a12fc9..35bc6452a0ce3b5fc73173b53b5b7cbd232cc9c7 100644 (file)
@@ -1105,7 +1105,7 @@ cfg_count_numbers(const char* s)
        /* sp ::= (space|tab)*      */
        int num = 0;
        while(*s) {
-               while(*s && isspace((int)*s))
+               while(*s && isspace((unsigned char)*s))
                        s++;
                if(!*s) /* end of string */
                        break;
index a597633828f542e6a6539e9a097fb4ebd4c3a486..5e1dc4ef3cdbbed8c44209f74d67ec559f6364bf 100644 (file)
@@ -902,13 +902,13 @@ static int
 handle_origin(char* line, uint8_t** origin, size_t* origin_len)
 {
        size_t len = 0;
-       while(isspace((int)*line))
+       while(isspace((unsigned char)*line))
                line++;
        if(strncmp(line, "$ORIGIN", 7) != 0)
                return 0;
        free(*origin);
        line += 7;
-       while(isspace((int)*line))
+       while(isspace((unsigned char)*line))
                line++;
        *origin = sldns_str2wire_dname(line, &len);
        *origin_len = len;
index a4adfe2d9ddeea0cca4f3a06935b570b1804edbd..3a67fff454ab21f99b51f2c1cbd9ea048be99aca 100644 (file)
@@ -563,7 +563,7 @@ readkeyword_bindfile(FILE* in, sldns_buffer* buf, int* line, int comments)
                /* not a comment, complete the keyword */
                if(numdone > 0) {
                        /* check same type */
-                       if(isspace(c)) {
+                       if(isspace((unsigned char)c)) {
                                ungetc(c, in);
                                return numdone;
                        }
@@ -582,12 +582,12 @@ readkeyword_bindfile(FILE* in, sldns_buffer* buf, int* line, int comments)
                }
                sldns_buffer_write_u8(buf, (uint8_t)c);
                numdone++;
-               if(isspace(c)) {
+               if(isspace((unsigned char)c)) {
                        /* collate whitespace into ' ' */
                        while((c = getc(in)) != EOF ) {
                                if(c == '\n')
                                        (*line)++;
-                               if(!isspace(c)) {
+                               if(!isspace((unsigned char)c)) {
                                        ungetc(c, in);
                                        break;
                                }
@@ -607,7 +607,7 @@ skip_to_special(FILE* in, sldns_buffer* buf, int* line, int spec)
        int rdlen;
        sldns_buffer_clear(buf);
        while((rdlen=readkeyword_bindfile(in, buf, line, 1))) {
-               if(rdlen == 1 && isspace((int)*sldns_buffer_begin(buf))) {
+               if(rdlen == 1 && isspace((unsigned char)*sldns_buffer_begin(buf))) {
                        sldns_buffer_clear(buf);
                        continue;
                }
@@ -648,7 +648,7 @@ process_bind_contents(struct val_anchors* anchors, sldns_buffer* buf,
        sldns_buffer_clear(buf);
        while((rdlen=readkeyword_bindfile(in, buf, line, comments))) {
                if(rdlen == 1 && sldns_buffer_position(buf) == 1
-                       && isspace((int)*sldns_buffer_begin(buf))) {
+                       && isspace((unsigned char)*sldns_buffer_begin(buf))) {
                        /* starting whitespace is removed */
                        sldns_buffer_clear(buf);
                        continue;
@@ -703,7 +703,7 @@ process_bind_contents(struct val_anchors* anchors, sldns_buffer* buf,
                        }
                        return 1;
                } else if(rdlen == 1 && 
-                       isspace((int)sldns_buffer_current(buf)[-1])) {
+                       isspace((unsigned char)sldns_buffer_current(buf)[-1])) {
                        /* leave whitespace here */
                } else {
                        /* not space or whatnot, so actual content */