From: Wouter Wijngaards Date: Fri, 7 Dec 2007 14:07:38 +0000 (+0000) Subject: portability of header file. X-Git-Tag: release-0.9~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61b42edaef71916167c663ec592ee9ad36b2f990;p=thirdparty%2Funbound.git portability of header file. git-svn-id: file:///svn/unbound/trunk@818 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index 44549db6f..aef52675a 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -5,6 +5,7 @@ - dot removed from CNAME display. - respect -v for NXDOMAINs. - updated ldns-src.tar.gz with ldns-trunk today (1.2.2 fixes). + - size_t to int for portability of the header file. 6 December 2007: Wouter - library resolution works in foreground mode, unbound-host app diff --git a/libunbound/unbound.h b/libunbound/unbound.h index 8a2a87811..7d60cd474 100644 --- a/libunbound/unbound.h +++ b/libunbound/unbound.h @@ -91,7 +91,6 @@ */ #ifndef _UB_UNBOUND_H #define _UB_UNBOUND_H -#include /** * The validation context is created to hold the resolver status, @@ -124,7 +123,7 @@ struct ub_val_result { char** data; /** the length in bytes of the data items, len[i] for data[i] */ - size_t* len; + int* len; /** * canonical name for the result (the final cname). diff --git a/libunbound/worker.c b/libunbound/worker.c index 7be64dd6a..df884fc23 100644 --- a/libunbound/worker.c +++ b/libunbound/worker.c @@ -229,8 +229,8 @@ fill_res(struct ub_val_result* res, struct ub_packed_rrset_key* answer, if(!fill_canon(res, finalcname)) return 0; /* out of memory */ } - res->data = calloc(1, sizeof(char*)); - res->len = calloc(1, sizeof(size_t)); + res->data = (char**)calloc(1, sizeof(char*)); + res->len = (int*)calloc(1, sizeof(int)); return (res->data && res->len); } data = (struct packed_rrset_data*)answer->entry.data; @@ -239,13 +239,13 @@ fill_res(struct ub_val_result* res, struct ub_packed_rrset_key* answer, return 0; /* out of memory */ } else res->canonname = res->qname; - res->data = calloc(data->count+1, sizeof(char*)); - res->len = calloc(data->count+1, sizeof(size_t)); + res->data = (char**)calloc(data->count+1, sizeof(char*)); + res->len = (int*)calloc(data->count+1, sizeof(int)); if(!res->data || !res->len) return 0; /* out of memory */ for(i=0; icount; i++) { /* remove rdlength from rdata */ - res->len[i] = data->rr_len[i] - 2; + res->len[i] = (int)(data->rr_len[i] - 2); res->data[i] = memdup(data->rr_data[i]+2, res->len[i]); if(!res->data[i]) return 0; /* out of memory */ diff --git a/smallapp/unbound-host.c b/smallapp/unbound-host.c index abd8a0f12..54d2ec39f 100644 --- a/smallapp/unbound-host.c +++ b/smallapp/unbound-host.c @@ -220,7 +220,7 @@ static void print_rd(int t, char* data, size_t len) { size_t i, pos = 0; - uint8_t* rd = malloc(len+2); + uint8_t* rd = (uint8_t*)malloc(len+2); ldns_rr* rr = ldns_rr_new(); ldns_status status; if(!rd || !rr) { @@ -326,7 +326,7 @@ pretty_output(char* q, int t, int c, int sec, int haved, pretty_rdata( result->canonname?result->canonname:q, cstr, tstr, t, secstatus, result->data[i], - result->len[i]); + (size_t)result->len[i]); i++; } }