Fix various compiler warnings from the clang llvm compiler.

git-svn-id: file:///svn/unbound/trunk@2111 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2010-05-18 12:37:04 +00:00
parent 271445fa4d
commit b4b641807b
14 changed files with 25 additions and 22 deletions

View file

@ -444,6 +444,12 @@ load_rr(SSL* ssl, ldns_buffer* buf, struct regional* region,
rk->rk.rrset_class = htons(ldns_rr_get_class(rr)); rk->rk.rrset_class = htons(ldns_rr_get_class(rr));
ldns_buffer_clear(buf); ldns_buffer_clear(buf);
status = ldns_dname2buffer_wire(buf, ldns_rr_owner(rr)); status = ldns_dname2buffer_wire(buf, ldns_rr_owner(rr));
if(status != LDNS_STATUS_OK) {
log_warn("error cannot dname2buffer :%s",
ldns_get_errorstr_by_id(status));
ldns_rr_free(rr);
return 0;
}
ldns_buffer_flip(buf); ldns_buffer_flip(buf);
rk->rk.dname_len = ldns_buffer_limit(buf); rk->rk.dname_len = ldns_buffer_limit(buf);
rk->rk.dname = regional_alloc_init(region, rk->rk.dname = regional_alloc_init(region,

View file

@ -317,7 +317,7 @@ struct listen_port* daemon_remote_open_ports(struct config_file* cfg)
struct listen_port* l = NULL; struct listen_port* l = NULL;
log_assert(cfg->remote_control_enable && cfg->control_port); log_assert(cfg->remote_control_enable && cfg->control_port);
if(cfg->control_ifs) { if(cfg->control_ifs) {
struct config_strlist* p = cfg->control_ifs; struct config_strlist* p;
for(p = cfg->control_ifs; p; p = p->next) { for(p = cfg->control_ifs; p; p = p->next) {
if(!add_open(p->str, cfg->control_port, &l, 1)) { if(!add_open(p->str, cfg->control_port, &l, 1)) {
listening_ports_free(l); listening_ports_free(l);
@ -877,6 +877,7 @@ do_stats(SSL* ssl, struct daemon_remote* rc, int reset)
struct stats_info total; struct stats_info total;
struct stats_info s; struct stats_info s;
int i; int i;
log_assert(daemon->num > 0);
/* gather all thread statistics in one place */ /* gather all thread statistics in one place */
for(i=0; i<daemon->num; i++) { for(i=0; i<daemon->num; i++) {
server_stats_obtain(rc->worker, daemon->workers[i], &s, reset); server_stats_obtain(rc->worker, daemon->workers[i], &s, reset);

View file

@ -610,7 +610,9 @@ main(int argc, char* argv[])
const char* winopt = NULL; const char* winopt = NULL;
int cmdline_verbose = 0; int cmdline_verbose = 0;
int debug_mode = 0; int debug_mode = 0;
#ifdef UB_ON_WINDOWS
int cmdline_cfg = 0; int cmdline_cfg = 0;
#endif
#ifdef HAVE_SBRK #ifdef HAVE_SBRK
/* take debug snapshot of heap */ /* take debug snapshot of heap */
@ -623,7 +625,9 @@ main(int argc, char* argv[])
switch(c) { switch(c) {
case 'c': case 'c':
cfgfile = optarg; cfgfile = optarg;
#ifdef UB_ON_WINDOWS
cmdline_cfg = 1; cmdline_cfg = 1;
#endif
break; break;
case 'v': case 'v':
cmdline_verbose ++; cmdline_verbose ++;

View file

@ -1,3 +1,6 @@
18 May 2010: Wouter
- Fix various compiler warnings from the clang llvm compiler.
6 May 2010: Wouter 6 May 2010: Wouter
- Fix bug#308: spelling error in variable name in parser and lexer. - Fix bug#308: spelling error in variable name in parser and lexer.

View file

@ -106,7 +106,6 @@ response_type_from_server(int rdset,
{ {
uint8_t* origzone = (uint8_t*)"\000"; /* the default */ uint8_t* origzone = (uint8_t*)"\000"; /* the default */
struct ub_packed_rrset_key* s; struct ub_packed_rrset_key* s;
size_t origzonelen = 1;
size_t i; size_t i;
if(!msg || !request) if(!msg || !request)
@ -130,7 +129,6 @@ response_type_from_server(int rdset,
if(dp) { if(dp) {
origzone = dp->name; origzone = dp->name;
origzonelen = dp->namelen;
} }
/* First we look at the answer section. This can tell us if this is a /* First we look at the answer section. This can tell us if this is a

View file

@ -561,7 +561,7 @@ static int sanitize_nsec_is_overreach(struct rrset_parse* rrset,
for(rr = rrset->rr_first; rr; rr = rr->next) { for(rr = rrset->rr_first; rr; rr = rr->next) {
rhs = rr->ttl_data+4+2; rhs = rr->ttl_data+4+2;
len = ldns_read_uint16(rr->ttl_data+4); len = ldns_read_uint16(rr->ttl_data+4);
if(!(len=dname_valid(rhs, len))) { if(!dname_valid(rhs, len)) {
/* malformed domain name in rdata */ /* malformed domain name in rdata */
return 1; return 1;
} }

View file

@ -1266,7 +1266,7 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq,
struct iter_env* ie, int id, int maxtargets, int* num) struct iter_env* ie, int id, int maxtargets, int* num)
{ {
int query_count = 0; int query_count = 0;
struct delegpt_ns* ns = iq->dp->nslist; struct delegpt_ns* ns;
int missing; int missing;
int toget = 0; int toget = 0;

View file

@ -347,7 +347,6 @@ answer_check_it(struct replay_runtime* runtime)
&runtime->now->addr, runtime->now->addrlen, &runtime->now->addr, runtime->now->addrlen,
&ans->repinfo.addr, ans->repinfo.addrlen) == 0) && &ans->repinfo.addr, ans->repinfo.addrlen) == 0) &&
find_match(runtime->now->match, ans->pkt, tr)) { find_match(runtime->now->match, ans->pkt, tr)) {
struct replay_answer *n = ans->next;
log_info("testbound matched event entry from line %d", log_info("testbound matched event entry from line %d",
runtime->now->match->lineno); runtime->now->match->lineno);
log_info("testbound: do STEP %d %s", log_info("testbound: do STEP %d %s",
@ -359,7 +358,6 @@ answer_check_it(struct replay_runtime* runtime)
if(!ans->next) if(!ans->next)
runtime->answer_last = prev; runtime->answer_last = prev;
delete_replay_answer(ans); delete_replay_answer(ans);
ans = n;
return; return;
} else { } else {
prev = ans; prev = ans;

View file

@ -110,7 +110,6 @@ write_q(int fd, int udp, ldns_buffer* buf, int id,
{ {
struct query_info qinfo; struct query_info qinfo;
ldns_rdf* rdf; ldns_rdf* rdf;
int labs;
uint16_t len; uint16_t len;
/* qname */ /* qname */
rdf = ldns_dname_new_frm_str(strname); rdf = ldns_dname_new_frm_str(strname);
@ -119,7 +118,7 @@ write_q(int fd, int udp, ldns_buffer* buf, int id,
exit(1); exit(1);
} }
qinfo.qname = memdup(ldns_rdf_data(rdf), ldns_rdf_size(rdf)); qinfo.qname = memdup(ldns_rdf_data(rdf), ldns_rdf_size(rdf));
labs = dname_count_size_labels(qinfo.qname, &qinfo.qname_len); (void)dname_count_size_labels(qinfo.qname, &qinfo.qname_len);
ldns_rdf_deep_free(rdf); ldns_rdf_deep_free(rdf);
if(!qinfo.qname) fatal_exit("out of memory"); if(!qinfo.qname) fatal_exit("out of memory");

View file

@ -4936,6 +4936,8 @@
10116, 10116,
10128, 10128,
10160, 10160,
10161,
10162,
10200, 10200,
10201, 10201,
10252, 10252,

View file

@ -63,7 +63,7 @@ ub_thread_blocksigs()
fatal_exit("thr_sigsetmask: %s", strerror(err)); fatal_exit("thr_sigsetmask: %s", strerror(err));
# else # else
/* have nothing, do single process signal mask */ /* have nothing, do single process signal mask */
if((err=sigprocmask(SIG_SETMASK, &sigset, NULL))) if(sigprocmask(SIG_SETMASK, &sigset, NULL))
fatal_exit("sigprocmask: %s", strerror(errno)); fatal_exit("sigprocmask: %s", strerror(errno));
# endif /* HAVE_SOLARIS_THREADS */ # endif /* HAVE_SOLARIS_THREADS */
#endif /* HAVE_PTHREAD */ #endif /* HAVE_PTHREAD */
@ -87,7 +87,7 @@ void ub_thread_sig_unblock(int sig)
fatal_exit("thr_sigsetmask: %s", strerror(err)); fatal_exit("thr_sigsetmask: %s", strerror(err));
# else # else
/* have nothing, do single thread case */ /* have nothing, do single thread case */
if((err=sigprocmask(SIG_UNBLOCK, &sigset, NULL))) if(sigprocmask(SIG_UNBLOCK, &sigset, NULL))
fatal_exit("sigprocmask: %s", strerror(errno)); fatal_exit("sigprocmask: %s", strerror(errno));
# endif /* HAVE_SOLARIS_THREADS */ # endif /* HAVE_SOLARIS_THREADS */
#endif /* HAVE_PTHREAD */ #endif /* HAVE_PTHREAD */

View file

@ -600,8 +600,7 @@ static struct trust_anchor*
parse_id(struct val_anchors* anchors, char* line) parse_id(struct val_anchors* anchors, char* line)
{ {
struct trust_anchor *tp; struct trust_anchor *tp;
size_t len; int r;
int labs, r;
ldns_rdf* rdf; ldns_rdf* rdf;
uint16_t dclass; uint16_t dclass;
/* read the owner name */ /* read the owner name */
@ -612,8 +611,6 @@ parse_id(struct val_anchors* anchors, char* line)
rdf = ldns_dname_new_frm_str(line); rdf = ldns_dname_new_frm_str(line);
if(!rdf) if(!rdf)
return NULL; return NULL;
labs = dname_count_size_labels(ldns_rdf_data(rdf), &len);
log_assert(len == ldns_rdf_size(rdf));
/* read the class */ /* read the class */
dclass = parse_int(next+1, &r); dclass = parse_int(next+1, &r);

View file

@ -1253,15 +1253,12 @@ setup_dsa_sig(unsigned char** sig, unsigned int* len)
unsigned char* orig = *sig; unsigned char* orig = *sig;
unsigned int origlen = *len; unsigned int origlen = *len;
int newlen; int newlen;
uint8_t t;
BIGNUM *R, *S; BIGNUM *R, *S;
DSA_SIG *dsasig; DSA_SIG *dsasig;
/* extract the R and S field from the sig buffer */ /* extract the R and S field from the sig buffer */
if(origlen < 1 + 2*SHA_DIGEST_LENGTH) if(origlen < 1 + 2*SHA_DIGEST_LENGTH)
return 0; return 0;
t = orig[0];
R = BN_new(); R = BN_new();
if(!R) return 0; if(!R) return 0;
(void) BN_bin2bn(orig + 1, SHA_DIGEST_LENGTH, R); (void) BN_bin2bn(orig + 1, SHA_DIGEST_LENGTH, R);

View file

@ -1376,7 +1376,7 @@ static int
processFindKey(struct module_qstate* qstate, struct val_qstate* vq, int id) processFindKey(struct module_qstate* qstate, struct val_qstate* vq, int id)
{ {
uint8_t* target_key_name, *current_key_name; uint8_t* target_key_name, *current_key_name;
size_t target_key_len, current_key_len; size_t target_key_len;
int strip_lab; int strip_lab;
log_query_info(VERB_ALGO, "validator: FindKey", &vq->qchase); log_query_info(VERB_ALGO, "validator: FindKey", &vq->qchase);
@ -1405,7 +1405,6 @@ processFindKey(struct module_qstate* qstate, struct val_qstate* vq, int id)
} }
current_key_name = vq->key_entry->name; current_key_name = vq->key_entry->name;
current_key_len = vq->key_entry->namelen;
/* If our current key entry matches our target, then we are done. */ /* If our current key entry matches our target, then we are done. */
if(query_dname_compare(target_key_name, current_key_name) == 0) { if(query_dname_compare(target_key_name, current_key_name) == 0) {
@ -1428,7 +1427,6 @@ processFindKey(struct module_qstate* qstate, struct val_qstate* vq, int id)
return 1; return 1;
} }
current_key_name = vq->empty_DS_name; current_key_name = vq->empty_DS_name;
current_key_len = vq->empty_DS_len;
} }
log_nametypeclass(VERB_ALGO, "current keyname", current_key_name, log_nametypeclass(VERB_ALGO, "current keyname", current_key_name,
@ -1735,7 +1733,7 @@ val_dlv_init(struct module_qstate* qstate, struct val_qstate* vq,
} }
log_nametypeclass(VERB_ALGO, "DLV init look", nm, LDNS_RR_TYPE_DS, log_nametypeclass(VERB_ALGO, "DLV init look", nm, LDNS_RR_TYPE_DS,
vq->qchase.qclass); vq->qchase.qclass);
log_assert(nm && nm_len) log_assert(nm && nm_len);
/* sanity check: no DLV lookups below the DLV anchor itself. /* sanity check: no DLV lookups below the DLV anchor itself.
* Like, an securely insecure delegation there makes no sense. */ * Like, an securely insecure delegation there makes no sense. */
if(dname_subdomain_c(nm, qstate->env->anchors->dlv_anchor->name)) { if(dname_subdomain_c(nm, qstate->env->anchors->dlv_anchor->name)) {