From: Miek Gieben Date: Tue, 27 Sep 2005 13:07:30 +0000 (+0000) Subject: move the rdata's size from uint16_t -> size_t X-Git-Tag: release-1.0.0~103 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22feb23f452d07d39bce16031b08a4b6375bb59f;p=thirdparty%2Fldns.git move the rdata's size from uint16_t -> size_t --- diff --git a/TODO b/TODO index 704ff4da..10d4cc68 100644 --- a/TODO +++ b/TODO @@ -32,7 +32,5 @@ o check all conversion routines on missing types - str2host - host2str o use size_t where needed - searchlist in resolver - nameserver in resolver *everywhere we count and use uint16_t* diff --git a/ldns/rdata.h b/ldns/rdata.h index bbb977ae..ec89c272 100644 --- a/ldns/rdata.h +++ b/ldns/rdata.h @@ -112,7 +112,7 @@ typedef enum ldns_enum_cert_algorithm ldns_cert_algorithm; struct ldns_struct_rdf { /** The size of the data (in bytes) */ - uint16_t _size; + size_t _size; /** The type of the data */ ldns_rdf_type _type; /** Pointer to the data (byte buffer) */ @@ -129,7 +129,7 @@ typedef struct ldns_struct_rdf ldns_rdf; * \param[in] size the new size * \return void */ -void ldns_rdf_set_size(ldns_rdf *rd, uint16_t size); +void ldns_rdf_set_size(ldns_rdf *rd, size_t size); /** * sets the size of the rdf. * \param[in] *rd the rdf to operate on @@ -151,7 +151,7 @@ void ldns_rdf_set_data(ldns_rdf *rd, void *data); * \param[in] *rd the rdf to read from * \return uint16_t with the size */ -uint16_t ldns_rdf_size(const ldns_rdf *rd); +size_t ldns_rdf_size(const ldns_rdf *rd); /** * returns the type of the rdf. We need to insert _get_ * here to prevent conflict the the rdf_type TYPE. @@ -177,7 +177,7 @@ uint8_t *ldns_rdf_data(const ldns_rdf *rd); * \param[in] data pointer to the buffer to be copied * \return the new rdf structure or NULL on failure */ -ldns_rdf *ldns_rdf_new(ldns_rdf_type type, uint16_t size, void *data); +ldns_rdf *ldns_rdf_new(ldns_rdf_type type, size_t size, void *data); /** * allocates a new rdf structure and fills it. @@ -188,7 +188,7 @@ ldns_rdf *ldns_rdf_new(ldns_rdf_type type, uint16_t size, void *data); * \param[in] data pointer to the buffer to be copied * \return the new rdf structure or NULL on failure */ -ldns_rdf *ldns_rdf_new_frm_data(ldns_rdf_type type, uint16_t size, const void *data); +ldns_rdf *ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data); /** * creates a new rdf from a string. @@ -271,7 +271,7 @@ ldns_rdf *ldns_native2rdf_int32(ldns_rdf_type type, uint32_t value); * \param[in] *data pointer to the actual data * \return ldns_rd* the rdf with the data */ -ldns_rdf *ldns_native2rdf_int16_data(uint16_t size, uint8_t *data); +ldns_rdf *ldns_native2rdf_int16_data(size_t size, uint8_t *data); /** * reverses an rdf, only actually useful for AAAA and A records. diff --git a/rdata.c b/rdata.c index 0c9892e4..0647c57a 100644 --- a/rdata.c +++ b/rdata.c @@ -30,7 +30,7 @@ */ /* read */ -uint16_t +size_t ldns_rdf_size(const ldns_rdf *rd) { return rd->_size; @@ -50,7 +50,7 @@ ldns_rdf_data(const ldns_rdf *rd) /* write */ void -ldns_rdf_set_size(ldns_rdf *rd, uint16_t s) +ldns_rdf_set_size(ldns_rdf *rd, size_t s) { rd->_size = s; } @@ -223,16 +223,16 @@ ldns_native2rdf_int32(ldns_rdf_type type, uint32_t value) } ldns_rdf * -ldns_native2rdf_int16_data(uint16_t size, uint8_t *data) +ldns_native2rdf_int16_data(size_t size, uint8_t *data) { - uint8_t *rdf_data = LDNS_XMALLOC(uint8_t, (size_t) size + 2); + uint8_t *rdf_data = LDNS_XMALLOC(uint8_t, size + 2); ldns_write_uint16(rdf_data, size); memcpy(rdf_data + 2, data, size); return ldns_rdf_new(LDNS_RDF_TYPE_INT16_DATA, size + 2, rdf_data); } ldns_rdf * -ldns_rdf_new(ldns_rdf_type t, uint16_t s, void *d) +ldns_rdf_new(ldns_rdf_type t, size_t s, void *d) { ldns_rdf *rd; rd = LDNS_MALLOC(ldns_rdf); @@ -246,7 +246,7 @@ ldns_rdf_new(ldns_rdf_type t, uint16_t s, void *d) } ldns_rdf * -ldns_rdf_new_frm_data(ldns_rdf_type type, uint16_t size, const void *data) +ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data) { ldns_rdf *rdf; rdf = LDNS_MALLOC(ldns_rdf);