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));
ldns_buffer_clear(buf);
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);
rk->rk.dname_len = ldns_buffer_limit(buf);
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;
log_assert(cfg->remote_control_enable && cfg->control_port);
if(cfg->control_ifs) {
struct config_strlist* p = cfg->control_ifs;
struct config_strlist* p;
for(p = cfg->control_ifs; p; p = p->next) {
if(!add_open(p->str, cfg->control_port, &l, 1)) {
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 s;
int i;
log_assert(daemon->num > 0);
/* gather all thread statistics in one place */
for(i=0; i<daemon->num; i++) {
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;
int cmdline_verbose = 0;
int debug_mode = 0;
#ifdef UB_ON_WINDOWS
int cmdline_cfg = 0;
#endif
#ifdef HAVE_SBRK
/* take debug snapshot of heap */
@ -623,7 +625,9 @@ main(int argc, char* argv[])
switch(c) {
case 'c':
cfgfile = optarg;
#ifdef UB_ON_WINDOWS
cmdline_cfg = 1;
#endif
break;
case 'v':
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
- 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 */
struct ub_packed_rrset_key* s;
size_t origzonelen = 1;
size_t i;
if(!msg || !request)
@ -130,7 +129,6 @@ response_type_from_server(int rdset,
if(dp) {
origzone = dp->name;
origzonelen = dp->namelen;
}
/* 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) {
rhs = rr->ttl_data+4+2;
len = ldns_read_uint16(rr->ttl_data+4);
if(!(len=dname_valid(rhs, len))) {
if(!dname_valid(rhs, len)) {
/* malformed domain name in rdata */
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)
{
int query_count = 0;
struct delegpt_ns* ns = iq->dp->nslist;
struct delegpt_ns* ns;
int missing;
int toget = 0;

View file

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

View file

@ -110,7 +110,6 @@ write_q(int fd, int udp, ldns_buffer* buf, int id,
{
struct query_info qinfo;
ldns_rdf* rdf;
int labs;
uint16_t len;
/* qname */
rdf = ldns_dname_new_frm_str(strname);
@ -119,7 +118,7 @@ write_q(int fd, int udp, ldns_buffer* buf, int id,
exit(1);
}
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);
if(!qinfo.qname) fatal_exit("out of memory");

View file

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

View file

@ -63,7 +63,7 @@ ub_thread_blocksigs()
fatal_exit("thr_sigsetmask: %s", strerror(err));
# else
/* 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));
# endif /* HAVE_SOLARIS_THREADS */
#endif /* HAVE_PTHREAD */
@ -87,7 +87,7 @@ void ub_thread_sig_unblock(int sig)
fatal_exit("thr_sigsetmask: %s", strerror(err));
# else
/* 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));
# endif /* HAVE_SOLARIS_THREADS */
#endif /* HAVE_PTHREAD */

View file

@ -600,8 +600,7 @@ static struct trust_anchor*
parse_id(struct val_anchors* anchors, char* line)
{
struct trust_anchor *tp;
size_t len;
int labs, r;
int r;
ldns_rdf* rdf;
uint16_t dclass;
/* read the owner name */
@ -612,8 +611,6 @@ parse_id(struct val_anchors* anchors, char* line)
rdf = ldns_dname_new_frm_str(line);
if(!rdf)
return NULL;
labs = dname_count_size_labels(ldns_rdf_data(rdf), &len);
log_assert(len == ldns_rdf_size(rdf));
/* read the class */
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 int origlen = *len;
int newlen;
uint8_t t;
BIGNUM *R, *S;
DSA_SIG *dsasig;
/* extract the R and S field from the sig buffer */
if(origlen < 1 + 2*SHA_DIGEST_LENGTH)
return 0;
t = orig[0];
R = BN_new();
if(!R) return 0;
(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)
{
uint8_t* target_key_name, *current_key_name;
size_t target_key_len, current_key_len;
size_t target_key_len;
int strip_lab;
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_len = vq->key_entry->namelen;
/* If our current key entry matches our target, then we are done. */
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;
}
current_key_name = vq->empty_DS_name;
current_key_len = vq->empty_DS_len;
}
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,
vq->qchase.qclass);
log_assert(nm && nm_len)
log_assert(nm && nm_len);
/* sanity check: no DLV lookups below the DLV anchor itself.
* Like, an securely insecure delegation there makes no sense. */
if(dname_subdomain_c(nm, qstate->env->anchors->dlv_anchor->name)) {