From a50f2001192cda570410e4c34e08a5c0ee4edd53 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Thu, 31 Oct 2013 15:28:13 +0000 Subject: [PATCH] Fix portability of UINT_MAX and incomplete type of enum in header file. git-svn-id: file:///svn/unbound/trunk@3000 be551aaa-1e26-0410-a405-d3ace91eadb9 --- ldns/rrdef.c | 3 +-- ldns/wire2str.c | 2 +- ldns/wire2str.h | 6 ++---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ldns/rrdef.c b/ldns/rrdef.c index 0d4d14038..4043dd2fd 100644 --- a/ldns/rrdef.c +++ b/ldns/rrdef.c @@ -694,8 +694,7 @@ ldns_rr_descriptor_maximum(const ldns_rr_descriptor *descriptor) { if (descriptor) { if (descriptor->_variable != LDNS_RDF_TYPE_NONE) { - /* Should really be SIZE_MAX... bad FreeBSD. */ - return UINT_MAX; + return 65535; /* cannot be more than 64k */ } else { return descriptor->_maximum; } diff --git a/ldns/wire2str.c b/ldns/wire2str.c index 8bd74f110..d68335247 100644 --- a/ldns/wire2str.c +++ b/ldns/wire2str.c @@ -883,7 +883,7 @@ int ldns_wire2str_ttl_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen) } int ldns_wire2str_rdf_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen, - ldns_rdf_type rdftype, uint8_t* pkt, size_t pktlen) + int rdftype, uint8_t* pkt, size_t pktlen) { if(*dlen == 0) return 0; switch(rdftype) { diff --git a/ldns/wire2str.h b/ldns/wire2str.h index a29ace7a3..339a30c3f 100644 --- a/ldns/wire2str.h +++ b/ldns/wire2str.h @@ -20,7 +20,6 @@ extern "C" { #endif struct ldns_struct_lookup_table; -enum ldns_enum_rdf_type; /* lookup tables for standard DNS stuff */ /** Taken from RFC 2535, section 7. */ @@ -461,15 +460,14 @@ int ldns_wire2str_dname_buf(uint8_t* dname, size_t dname_len, char* str, * @param data_len: length of data buffer. * @param str: string buffer. * @param str_len: length of string buffer. - * @param rdftype: the type of the rdata field. + * @param rdftype: the type of the rdata field, enum ldns_rdf_type. * @param pkt: packet for decompression, if NULL no decompression. * @param pktlen: length of packet buffer. * @return number of characters (except null) needed to print. * Can return -1 on failure. */ int ldns_wire2str_rdf_scan(uint8_t** data, size_t* data_len, char** str, - size_t* str_len, enum ldns_enum_rdf_type rdftype, uint8_t* pkt, - size_t pktlen); + size_t* str_len, int rdftype, uint8_t* pkt, size_t pktlen); /** * Scan wireformat int8 field to string, with user buffers. -- 2.47.2