From: Jelte Jansen Date: Wed, 2 Feb 2005 10:08:02 +0000 (+0000) Subject: removed unused debug prints X-Git-Tag: release-0.50~470 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b2fc2c4656f10ed0c3b1ceec518bfa1137fa2f76;p=thirdparty%2Fldns.git removed unused debug prints expanded make test target to include test4 and 5 fixed all current (... :p) lint warnings --- diff --git a/Makefile.in b/Makefile.in index d44dfcc4..c0c9a209 100644 --- a/Makefile.in +++ b/Makefile.in @@ -105,8 +105,12 @@ test2: run-test2 ./run-test2 test3: run-test3 ./run-test3 +test4: run-test4 + ./run-test4 +test5: run-test5 + ./run-test5 -test: test0 test1 test2 test3 +test: test0 test1 test2 test3 test4 test5 lint: for i in $(ALL_SOURCES); do \ diff --git a/host2str.c b/host2str.c index 920d3ece..b70fbec1 100644 --- a/host2str.c +++ b/host2str.c @@ -89,16 +89,15 @@ ldns_rdf2buffer_str_dname(ldns_buffer *output, ldns_rdf *dname) /* single root label */ if (1 == ldns_rdf_size(dname)) { - ldns_buffer_printf(output, ".\0", 2); - ldns_buffer_status(output); - } - - while ((len > 0) && src_pos < ldns_rdf_size(dname)) { - src_pos++; - ldns_buffer_write(output, &data[src_pos], len); - src_pos += len; - len = data[src_pos]; - ldns_buffer_printf(output, "."); + ldns_buffer_printf(output, ".", 2); + } else { + while ((len > 0) && src_pos < ldns_rdf_size(dname)) { + src_pos++; + ldns_buffer_write(output, &data[src_pos], len); + src_pos += len; + len = data[src_pos]; + ldns_buffer_printf(output, "."); + } } return ldns_buffer_status(output); } @@ -157,7 +156,7 @@ ldns_rdf2buffer_str_aaaa(ldns_buffer *output, ldns_rdf *rdf) { char str[INET6_ADDRSTRLEN]; - if (inet_ntop(AF_INET6, ldns_rdf_data(rdf), str, sizeof(str))) { + if (inet_ntop(AF_INET6, ldns_rdf_data(rdf), str, (socklen_t) sizeof(str))) { ldns_buffer_printf(output, "%s", str); } @@ -425,7 +424,7 @@ ldns_rdf2buffer_str_wks(ldns_buffer *output, ldns_rdf *rdf) current_service < ldns_rdf_size(rdf) * 8; current_service++) { if (get_bit(&(ldns_rdf_data(rdf)[1]), current_service)) { - service = getservbyport(ntohs(current_service), + service = getservbyport((int) ntohs(current_service), proto_name); if (service && service->s_name) { ldns_buffer_printf(output, "%s ", diff --git a/net.c b/net.c index 45d9eeaf..bcb6e236 100644 --- a/net.c +++ b/net.c @@ -56,7 +56,7 @@ ldns_send(ldns_resolver *r, ldns_pkt *query_pkt) struct sockaddr_storage *ns; struct sockaddr_in *ns4; struct sockaddr_in6 *ns6; - socklen_t ns_len; + size_t ns_len; ldns_rdf **ns_array; ldns_pkt *reply; @@ -86,18 +86,14 @@ ldns_send(ldns_resolver *r, ldns_pkt *query_pkt) ns4 = (struct sockaddr_in*) ns; ns4->sin_port = htons(ldns_resolver_port(r)); ns_len = (socklen_t)sizeof(struct sockaddr_in); - printf("port %d\n", ntohs(ns4->sin_port)); break; case AF_INET6: ns6 = (struct sockaddr_in6*) ns; ns6->sin6_port = htons(ldns_resolver_port(r)); ns_len = (socklen_t)sizeof(struct sockaddr_in6); - printf("port %d\n", ntohs(ns6->sin6_port)); break; } - printf("ip address len %d\n", ns_len); - /* query */ if (1 == ldns_resolver_usevc(r)) { reply = ldns_send_tcp(qb, ns, ns_len); @@ -147,7 +143,7 @@ ldns_send_udp(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t to gettimeofday(&tv_e, NULL); if (bytes == -1) { - printf("error with sending: %s\n"); + printf("error with sending\n"); close(sockfd); return NULL; } diff --git a/rdata.c b/rdata.c index 98d006de..4e50a6ae 100644 --- a/rdata.c +++ b/rdata.c @@ -152,11 +152,6 @@ ldns_rdf2native_sockaddr_storage(ldns_rdf *rd) data->ss_family = AF_INET; data_in = (struct sockaddr_in*) data; data_in->sin_port = htons(LDNS_PORT); - - printf("address native: %s\n", inet_ntoa(*b)); - printf("address hex: %x\n", &data_in->sin_addr); - printf("address hex: %x\n", &data_in->sin_port); - memcpy(&(data_in->sin_addr), ldns_rdf_data(rd), ldns_rdf_size(rd)); return data; case LDNS_RDF_TYPE_AAAA: diff --git a/str2host.c b/str2host.c index c95618c1..eca1dbfe 100644 --- a/str2host.c +++ b/str2host.c @@ -40,7 +40,7 @@ ldns_str2rdf_int16(ldns_rdf **rd, const uint8_t *shortstr) uint16_t *r; r = MALLOC(uint16_t); - *r = htons((uint16_t)strtol(shortstr, &end, 0)); + *r = htons((uint16_t)strtol((char *)shortstr, &end, 0)); if(*end != 0) { FREE(r); @@ -175,7 +175,7 @@ ldns_str2rdf_dname(ldns_rdf **d, const uint8_t* str) q = buf; for (s = p = buf_str; *s; s++) { if (*s == '.') { - label_chars = s - p; + label_chars = (unsigned int) (s - p); label_chars2 = label_chars + 39; /* somehting printable */ /* put this number in the right spot in buf and * copy those chars over*/ @@ -185,13 +185,13 @@ ldns_str2rdf_dname(ldns_rdf **d, const uint8_t* str) p = s + 1; /* move the new position after the dot */ } } - label_chars = s - p; + label_chars = (unsigned int) (s - p); label_chars2 = label_chars + 39; /* somehting printable */ memcpy(q, &label_chars, 1); memcpy(q + 1, p, label_chars); q += (label_chars + 1); - *q = (uint8_t*)'\00'; /* end the string */ + q = (uint8_t*)'\00'; /* end the string */ /* s - buf_str works because no magic is done * in the above for-loop */ *d = ldns_rdf_new_frm_data((s - buf_str + 2) , LDNS_RDF_TYPE_DNAME , buf); @@ -245,7 +245,7 @@ ldns_str2rdf_aaaa(ldns_rdf **rd, const uint8_t* str) ldns_status ldns_str2rdf_str(ldns_rdf **rd, const uint8_t* str) { - if (strlen(str) > 255) { + if (strlen((char *) str) > 255) { return LDNS_STATUS_INVALID_STR; } *rd = ldns_rdf_new_frm_data(strlen((char*)str), LDNS_RDF_TYPE_STR, (void*)str); @@ -276,7 +276,7 @@ ldns_str2rdf_b64(ldns_rdf **rd, const uint8_t* str) uint8_t buffer[B64BUFSIZE]; int16_t i; - i = b64_pton((const char*)str, buffer, B64BUFSIZE); + i = (uint16_t) b64_pton((const char*)str, buffer, B64BUFSIZE); if (-1 == i) { return LDNS_STATUS_INVALID_B64; } else {