From: Miek Gieben Date: Wed, 22 Dec 2004 12:44:12 +0000 (+0000) Subject: splint X-Git-Tag: release-0.50~603 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d15caec588288aab5fb38e925f4666a0f4664018;p=thirdparty%2Fldns.git splint --- diff --git a/run-test1.c b/run-test1.c index 9bda66bc..9852d15c 100644 --- a/run-test1.c +++ b/run-test1.c @@ -9,6 +9,7 @@ #include "util.h" +#if 0 static const uint8_t wire[] = { 0xd0, 0x0e, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x03, 0x77, 0x77, 0x77, 0x0b, 0x6b, 0x61, 0x6e, 0x61, 0x72, @@ -23,6 +24,7 @@ static const uint8_t wire[] = { 0x00, 0x04, 0xd5, 0x85, 0x27, 0xcb, 0xc0, 0x41, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0xfb, 0x2c, 0x00, 0x04, 0xd4, 0xcc, 0xdb, 0x5b }; +#endif int main(void) diff --git a/str2host.c b/str2host.c index deb83429..e57d6447 100644 --- a/str2host.c +++ b/str2host.c @@ -70,6 +70,48 @@ zparser_conv_time(ldns_rdf *rd, const char *time) return LDNS_STATUS_OK; } +#if 0 +ldns_status +zparser_conv_long(ldns_rdf *rd, const char *longstr) +{ + char *end; /* Used to parse longs, ttls, etc. */ + uint16_t *r = NULL; + uint32_t l; + + r = (uint16_t *) region_alloc(region, + sizeof(uint16_t) + sizeof(uint32_t)); + l = htonl((uint32_t)strtol(longstr, &end, 0)); + + if(*end != 0) { + error_prev_line("Long decimal value is expected"); + } else { + memcpy(r + 1, &l, sizeof(uint32_t)); + *r = sizeof(uint32_t); + } + return r; +} + +ldns_status +zparser_conv_byte(ldns_rdf *rd, const char *bytestr) +{ + + /* convert a byte value to wireformat */ + char *end; /* Used to parse longs, ttls, etc. */ + uint16_t *r = NULL; + + r = (uint16_t *) region_alloc(region, + sizeof(uint16_t) + sizeof(uint8_t)); + + *((uint8_t *)(r+1)) = (uint8_t)strtol(bytestr, &end, 0); + + if(*end != 0) { + error_prev_line("Decimal value is expected"); + } else { + *r = sizeof(uint8_t); + } + return r; +} + #if 0 /** @@ -223,47 +265,6 @@ zparser_conv_period(region_type *region, const char *periodstr) } -uint16_t * -zparser_conv_long(region_type *region, const char *longstr) -{ - char *end; /* Used to parse longs, ttls, etc. */ - uint16_t *r = NULL; - uint32_t l; - - r = (uint16_t *) region_alloc(region, - sizeof(uint16_t) + sizeof(uint32_t)); - l = htonl((uint32_t)strtol(longstr, &end, 0)); - - if(*end != 0) { - error_prev_line("Long decimal value is expected"); - } else { - memcpy(r + 1, &l, sizeof(uint32_t)); - *r = sizeof(uint32_t); - } - return r; -} - -uint16_t * -zparser_conv_byte(region_type *region, const char *bytestr) -{ - - /* convert a byte value to wireformat */ - char *end; /* Used to parse longs, ttls, etc. */ - uint16_t *r = NULL; - - r = (uint16_t *) region_alloc(region, - sizeof(uint16_t) + sizeof(uint8_t)); - - *((uint8_t *)(r+1)) = (uint8_t)strtol(bytestr, &end, 0); - - if(*end != 0) { - error_prev_line("Decimal value is expected"); - } else { - *r = sizeof(uint8_t); - } - return r; -} - uint16_t * zparser_conv_algorithm(region_type *region, const char *algstr) {