Commit aaa76dc6 authored by Ondřej Surý's avatar Ondřej Surý
Browse files

Replace custom isc_u?intNN_t types with C99 u?intNN_t types

(cherry picked from commit cb6a185c)
(cherry picked from commit d61e6a31)
parent 07970c50
......@@ -15,6 +15,7 @@
#include <config.h>
#include <stdio.h>
#include <inttypes.h>
#ifdef _WIN32
#include <Winsock2.h>
......@@ -739,7 +740,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
isc_result_t
dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
dns_masterformat_t fileformat, const dns_master_style_t *style,
const isc_uint32_t rawversion)
const uint32_t rawversion)
{
isc_result_t result;
FILE *output = stdout;
......
......@@ -15,6 +15,8 @@
/*! \file */
#include <inttypes.h>
#include <isc/lang.h>
#include <isc/stdio.h>
#include <isc/types.h>
......@@ -35,7 +37,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
isc_result_t
dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
dns_masterformat_t fileformat, const dns_master_style_t *style,
const isc_uint32_t rawversion);
const uint32_t rawversion);
#ifdef _WIN32
void InitSockets(void);
......
......@@ -15,6 +15,7 @@
#include <config.h>
#include <stdlib.h>
#include <inttypes.h>
#include <isc/app.h>
#include <isc/commandline.h>
......@@ -108,7 +109,7 @@ main(int argc, char **argv) {
dns_masterformat_t inputformat = dns_masterformat_text;
dns_masterformat_t outputformat = dns_masterformat_text;
dns_masterrawheader_t header;
isc_uint32_t rawversion = 1, serialnum = 0;
uint32_t rawversion = 1, serialnum = 0;
dns_ttl_t maxttl = 0;
isc_boolean_t snset = ISC_FALSE;
isc_boolean_t logdump = ISC_FALSE;
......
......@@ -25,6 +25,7 @@
#endif
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
......@@ -99,7 +100,7 @@ static dns_rdatatype_t qtype = dns_rdatatype_none;
static isc_boolean_t typeset = ISC_FALSE;
static unsigned int styleflags = 0;
static isc_uint32_t splitwidth = 0xffffffff;
static uint32_t splitwidth = 0xffffffff;
static isc_boolean_t
showcomments = ISC_TRUE,
showdnssec = ISC_TRUE,
......@@ -147,7 +148,7 @@ static isc_result_t
get_reverse(char *reverse, size_t len, char *value, isc_boolean_t strict);
static isc_result_t
parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
parse_uint(uint32_t *uip, const char *value, uint32_t max,
const char *desc);
static void
......@@ -566,7 +567,7 @@ convert_name(dns_fixedname_t *fn, dns_name_t **name, const char *text) {
static isc_result_t
key_fromconfig(const cfg_obj_t *key, dns_client_t *client) {
dns_rdata_dnskey_t keystruct;
isc_uint32_t flags, proto, alg;
uint32_t flags, proto, alg;
const char *keystr, *keynamestr;
unsigned char keydata[4096];
isc_buffer_t keydatabuf;
......@@ -621,9 +622,9 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client) {
if (alg > 0xff)
CHECK(ISC_R_RANGE);
keystruct.flags = (isc_uint16_t)flags;
keystruct.protocol = (isc_uint8_t)proto;
keystruct.algorithm = (isc_uint8_t)alg;
keystruct.flags = (uint16_t)flags;
keystruct.protocol = (uint8_t)proto;
keystruct.algorithm = (uint8_t)alg;
isc_buffer_init(&keydatabuf, keydata, sizeof(keydata));
isc_buffer_init(&rrdatabuf, rrdata, sizeof(rrdata));
......@@ -778,7 +779,7 @@ addserver(dns_client_t *client) {
struct in6_addr in6;
isc_sockaddr_t *sa;
isc_sockaddrlist_t servers;
isc_uint32_t destport;
uint32_t destport;
isc_result_t result;
dns_name_t *name = NULL;
......@@ -869,7 +870,7 @@ findserver(dns_client_t *client) {
irs_resconf_t *resconf = NULL;
isc_sockaddrlist_t *nameservers;
isc_sockaddr_t *sa, *next;
isc_uint32_t destport;
uint32_t destport;
result = parse_uint(&destport, port, 0xffff, "port");
if (result != ISC_R_SUCCESS)
......@@ -956,9 +957,9 @@ next_token(char **stringp, const char *delim) {
}
static isc_result_t
parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
parse_uint(uint32_t *uip, const char *value, uint32_t max,
const char *desc) {
isc_uint32_t n;
uint32_t n;
isc_result_t result = isc_parse_uint32(&n, value, 10);
if (result == ISC_R_SUCCESS && n > max)
result = ISC_R_RANGE;
......@@ -1189,7 +1190,7 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) {
struct in_addr in4;
struct in6_addr in6;
in_port_t srcport;
isc_uint32_t num;
uint32_t num;
char *hash;
while (strpbrk(option, single_dash_opts) == &option[0]) {
......
......@@ -12,10 +12,11 @@
/*! \file */
#include <config.h>
#include <inttypes.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <inttypes.h>
#include <isc/app.h>
#include <isc/netaddr.h>
......@@ -68,7 +69,7 @@ static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE,
onesoa = ISC_FALSE, use_usec = ISC_FALSE,
nocrypto = ISC_FALSE, ttlunits = ISC_FALSE,
ipv4only = ISC_FALSE, ipv6only = ISC_FALSE;
static isc_uint32_t splitwidth = 0xffffffff;
static uint32_t splitwidth = 0xffffffff;
/*% rrcomments are neither explicitly enabled nor disabled by default */
static int rrcomments = 0;
......@@ -246,7 +247,7 @@ help(void) {
*/
static void
received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
isc_uint64_t diff;
uint64_t diff;
time_t tnow;
struct tm tmnow;
#ifdef WIN32
......@@ -309,14 +310,14 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
"from %s(%s) in %ld us\n\n",
query->lookup->doing_xfr
? query->byte_count
: (isc_uint64_t)bytes,
: (uint64_t)bytes,
fromtext, query->userarg, (long) diff);
else
printf(";; Received %" PRIu64 " bytes "
"from %s(%s) in %ld ms\n\n",
query->lookup->doing_xfr
? query->byte_count
: (isc_uint64_t)bytes,
: (uint64_t)bytes,
fromtext, query->userarg, (long) diff / 1000);
}
}
......@@ -338,7 +339,7 @@ trying(char *frm, dig_lookup_t *lookup) {
static isc_result_t
say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
isc_result_t result;
isc_uint64_t diff;
uint64_t diff;
char store[sizeof(" in 18446744073709551616 us.")];
unsigned int styleflags = 0;
......@@ -800,7 +801,7 @@ plus_option(const char *option, isc_boolean_t is_batchfile,
isc_result_t result;
char option_store[256];
char *cmd, *value, *ptr, *code;
isc_uint32_t num;
uint32_t num;
isc_boolean_t state = ISC_TRUE;
size_t n;
......@@ -1542,7 +1543,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
struct in6_addr in6;
in_port_t srcport;
char *hash, *cmd;
isc_uint32_t num;
uint32_t num;
while (strpbrk(option, single_dash_opts) == &option[0]) {
/*
......@@ -1714,7 +1715,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
"extra type option\n");
}
if (rdtype == dns_rdatatype_ixfr) {
isc_uint32_t serial;
uint32_t serial;
(*lookup)->rdtype = dns_rdatatype_ixfr;
(*lookup)->rdtypeset = ISC_TRUE;
result = parse_uint(&serial, &value[5],
......@@ -2016,7 +2017,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
"extra type option\n");
}
if (rdtype == dns_rdatatype_ixfr) {
isc_uint32_t serial;
uint32_t serial;
lookup->rdtype =
dns_rdatatype_ixfr;
lookup->rdtypeset = ISC_TRUE;
......
......@@ -20,6 +20,8 @@
*/
#include <config.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
......@@ -1111,9 +1113,9 @@ setup_text_key(void) {
}
static isc_result_t
parse_uint_helper(isc_uint32_t *uip, const char *value, isc_uint32_t max,
parse_uint_helper(uint32_t *uip, const char *value, uint32_t max,
const char *desc, int base) {
isc_uint32_t n;
uint32_t n;
isc_result_t result = isc_parse_uint32(&n, value, base);
if (result == ISC_R_SUCCESS && n > max)
result = ISC_R_RANGE;
......@@ -1127,21 +1129,21 @@ parse_uint_helper(isc_uint32_t *uip, const char *value, isc_uint32_t max,
}
isc_result_t
parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
parse_uint(uint32_t *uip, const char *value, uint32_t max,
const char *desc) {
return (parse_uint_helper(uip, value, max, desc, 10));
}
isc_result_t
parse_xint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
parse_xint(uint32_t *uip, const char *value, uint32_t max,
const char *desc) {
return (parse_uint_helper(uip, value, max, desc, 0));
}
static isc_uint32_t
parse_bits(char *arg, const char *desc, isc_uint32_t max) {
static uint32_t
parse_bits(char *arg, const char *desc, uint32_t max) {
isc_result_t result;
isc_uint32_t tmp;
uint32_t tmp;
result = parse_uint(&tmp, arg, max, desc);
if (result != ISC_R_SUCCESS)
......@@ -1156,7 +1158,7 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) {
isc_sockaddr_t *sa = NULL;
struct in_addr in4;
struct in6_addr in6;
isc_uint32_t prefix_length = 0xffffffff;
uint32_t prefix_length = 0xffffffff;
char *slash = NULL;
isc_boolean_t parsed = ISC_FALSE;
isc_boolean_t prefix_parsed = ISC_FALSE;
......@@ -1662,7 +1664,7 @@ setup_libs(void) {
}
typedef struct dig_ednsoptname {
isc_uint32_t code;
uint32_t code;
const char *name;
} dig_ednsoptname_t;
......@@ -1687,7 +1689,7 @@ dig_ednsoptname_t optnames[] = {
void
save_opt(dig_lookup_t *lookup, char *code, char *value) {
isc_result_t result;
isc_uint32_t num = 0;
uint32_t num = 0;
isc_buffer_t b;
isc_boolean_t found = ISC_FALSE;
unsigned int i;
......@@ -1743,7 +1745,7 @@ save_opt(dig_lookup_t *lookup, char *code, char *value) {
* (e.g., NSID, COOKIE, client-subnet)
*/
static void
add_opt(dns_message_t *msg, isc_uint16_t udpsize, isc_uint16_t edns,
add_opt(dns_message_t *msg, uint16_t udpsize, uint16_t edns,
unsigned int flags, dns_ednsopt_t *opts, size_t count)
{
dns_rdataset_t *rdataset = NULL;
......@@ -2200,7 +2202,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
* Randomize the order the nameserver will be tried.
*/
if (numLookups > 1) {
isc_uint32_t i, j;
uint32_t i, j;
dig_serverlist_t my_server_list;
dig_server_t *next;
......@@ -2364,7 +2366,7 @@ compute_cookie(unsigned char *clientcookie, size_t len) {
isc_boolean_t
setup_lookup(dig_lookup_t *lookup) {
isc_result_t result;
isc_uint32_t id;
uint32_t id;
unsigned int len;
dig_server_t *serv;
dig_query_t *query;
......@@ -2644,9 +2646,9 @@ setup_lookup(dig_lookup_t *lookup) {
}
if (lookup->ecs_addr != NULL) {
isc_uint8_t addr[16];
isc_uint16_t family;
isc_uint32_t plen;
uint8_t addr[16];
uint16_t family;
uint32_t plen;
struct sockaddr *sa;
struct sockaddr_in *sin;
struct sockaddr_in6 *sin6;
......@@ -2660,7 +2662,7 @@ setup_lookup(dig_lookup_t *lookup) {
INSIST(i < MAXOPTS);
opts[i].code = DNS_OPT_CLIENT_SUBNET;
opts[i].length = (isc_uint16_t) addrl + 4;
opts[i].length = (uint16_t) addrl + 4;
check_result(result, "isc_buffer_allocate");
/*
......@@ -2722,7 +2724,7 @@ setup_lookup(dig_lookup_t *lookup) {
(unsigned)addrl);
}
opts[i].value = (isc_uint8_t *) ecsbuf;
opts[i].value = (uint8_t *) ecsbuf;
i++;
}
......@@ -3296,7 +3298,7 @@ tcp_length_done(isc_task_t *task, isc_event_t *event) {
isc_result_t result;
dig_query_t *query = NULL;
dig_lookup_t *l, *n;
isc_uint16_t length;
uint16_t length;
REQUIRE(event->ev_type == ISC_SOCKEVENT_RECVDONE);
INSIST(!free_now);
......@@ -3405,7 +3407,7 @@ launch_next_query(dig_query_t *query, isc_boolean_t include_question) {
isc_buffer_clear(&query->slbuf);
isc_buffer_clear(&query->lengthbuf);
isc_buffer_putuint16(&query->slbuf, (isc_uint16_t) query->sendbuf.used);
isc_buffer_putuint16(&query->slbuf, (uint16_t) query->sendbuf.used);
ISC_LIST_INIT(query->sendlist);
ISC_LINK_INIT(&query->slbuf, link);
if (!query->first_soa_rcvd) {
......@@ -3547,7 +3549,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
dns_rdataset_t *rdataset = NULL;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_rdata_soa_t soa;
isc_uint32_t ixfr_serial = query->lookup->ixfr_serial, serial;
uint32_t ixfr_serial = query->lookup->ixfr_serial, serial;
isc_result_t result;
isc_boolean_t ixfr = query->lookup->rdtype == dns_rdatatype_ixfr;
isc_boolean_t axfr = query->lookup->rdtype == dns_rdatatype_axfr;
......@@ -3735,7 +3737,7 @@ process_opt(dig_lookup_t *l, dns_message_t *msg) {
dns_rdata_t rdata;
isc_result_t result;
isc_buffer_t optbuf;
isc_uint16_t optcode, optlen;
uint16_t optcode, optlen;
dns_rdataset_t *opt = msg->opt;
isc_boolean_t seen_cookie = ISC_FALSE;
......
......@@ -12,6 +12,8 @@
/*! \file */
#include <config.h>
#include <inttypes.h>
#include <stdlib.h>
#include <limits.h>
......@@ -673,7 +675,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
isc_result_t result = ISC_R_SUCCESS;
dns_rdatatype_t rdtype;
dns_rdataclass_t rdclass;
isc_uint32_t serial = 0;
uint32_t serial = 0;
UNUSED(is_batchfile);
......
......@@ -14,6 +14,8 @@
/*! \file */
#include <inttypes.h>
#include <dns/rdatalist.h>
#include <dst/dst.h>
......@@ -176,16 +178,16 @@ isc_boolean_t sigchase;
dig_serverlist_t my_server_list;
dig_searchlist_t *origin;
dig_query_t *xfr_q;
isc_uint32_t retries;
uint32_t retries;
int nsfound;
isc_uint16_t udpsize;
isc_int16_t edns;
isc_uint32_t ixfr_serial;
uint16_t udpsize;
int16_t edns;
uint32_t ixfr_serial;
isc_buffer_t rdatabuf;
char rdatastore[MXNAME];
dst_context_t *tsigctx;
isc_buffer_t *querysig;
isc_uint32_t msgcounter;
uint32_t msgcounter;
dns_fixedname_t fdomain;
isc_sockaddr_t *ecs_addr;
char *cookie;
......@@ -210,10 +212,10 @@ struct dig_query {
recv_made,
warn_id,
timedout;
isc_uint32_t first_rr_serial;
isc_uint32_t second_rr_serial;
isc_uint32_t msg_count;
isc_uint32_t rr_count;
uint32_t first_rr_serial;
uint32_t second_rr_serial;
uint32_t msg_count;
uint32_t rr_count;
isc_boolean_t ixfr_axfr;
char *servname;
char *userarg;
......@@ -232,7 +234,7 @@ struct dig_query {
isc_sockaddr_t sockaddr;
isc_time_t time_sent;
isc_time_t time_recv;
isc_uint64_t byte_count;
uint64_t byte_count;
isc_buffer_t sendbuf;
isc_timer_t *timer;
};
......@@ -348,11 +350,11 @@ void
setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only);
isc_result_t
parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
parse_uint(uint32_t *uip, const char *value, uint32_t max,
const char *desc);
isc_result_t
parse_xint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
parse_xint(uint32_t *uip, const char *value, uint32_t max,
const char *desc);
isc_result_t
......
......@@ -11,6 +11,7 @@
#include <config.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
......@@ -613,15 +614,15 @@ testclass(char *typetext) {
static void
set_port(const char *value) {
isc_uint32_t n;
uint32_t n;
isc_result_t result = parse_uint(&n, value, 65535, "port");
if (result == ISC_R_SUCCESS)
port = (isc_uint16_t) n;
port = (uint16_t) n;
}
static void
set_timeout(const char *value) {
isc_uint32_t n;
uint32_t n;
isc_result_t result = parse_uint(&n, value, UINT_MAX, "timeout");
if (result == ISC_R_SUCCESS)
timeout = n;
......@@ -629,7 +630,7 @@ set_timeout(const char *value) {
static void
set_tries(const char *value) {
isc_uint32_t n;
uint32_t n;
isc_result_t result = parse_uint(&n, value, INT_MAX, "tries");
if (result == ISC_R_SUCCESS)
tries = n;
......@@ -637,7 +638,7 @@ set_tries(const char *value) {
static void
set_ndots(const char *value) {
isc_uint32_t n;
uint32_t n;
isc_result_t result = parse_uint(&n, value, 128, "ndots");
if (result == ISC_R_SUCCESS)
ndots = n;
......
......@@ -13,6 +13,7 @@
#include <config.h>
#include <inttypes.h>
#include <stdlib.h>
#include <isc/buffer.h>
......@@ -59,7 +60,7 @@ static dns_rdataclass_t rdclass;
static dns_fixedname_t fixed;
static dns_name_t *name = NULL;
static isc_mem_t *mctx = NULL;
static isc_uint32_t ttl;
static uint32_t ttl;
static isc_boolean_t emitttl = ISC_FALSE;
static isc_result_t
......
......@@ -14,6 +14,7 @@
#include <config.h>
#include <ctype.h>
#include <inttypes.h>
#include <stdlib.h>
#include <isc/buffer.h>
......@@ -142,7 +143,7 @@ main(int argc, char **argv) {
dst_key_t *key = NULL;
dns_fixedname_t fname;
dns_name_t *name;
isc_uint16_t flags = 0, kskflag = 0, revflag = 0;
uint16_t flags = 0, kskflag = 0, revflag = 0;
dns_secalg_t alg;
isc_boolean_t oldstyle = ISC_FALSE;
isc_mem_t *mctx = NULL;
......
......@@ -28,6 +28,7 @@
#include <config.h>
#include <ctype.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
......@@ -218,7 +219,7 @@ main(int argc, char **argv) {
dst_key_t *key = NULL;
dns_fixedname_t fname;
dns_name_t *name;
isc_uint16_t flags = 0, kskflag = 0, revflag = 0;
uint16_t flags = 0, kskflag = 0, revflag = 0;
dns_secalg_t alg;
isc_boolean_t conflict = ISC_FALSE, null_key = ISC_FALSE;
isc_boolean_t oldstyle = ISC_FALSE;
......
......@@ -13,6 +13,7 @@
#include <config.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
......@@ -89,7 +90,7 @@ main(int argc, char **argv) {
int ch;
isc_entropy_t *ectx = NULL;
dst_key_t *key = NULL;
isc_uint32_t flags;
uint32_t flags;
isc_buffer_t buf;
isc_boolean_t force = ISC_FALSE;
isc_boolean_t removefile = ISC_FALSE;
......
......@@ -13,6 +13,7 @@
#include <config.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
......@@ -147,7 +148,7 @@ main(int argc, char **argv) {
dns_name_t *name = NULL;
dns_secalg_t alg = 0;
unsigned int size = 0;
isc_uint16_t flags = 0;
uint16_t flags = 0;
int prepub = -1;
dns_ttl_t ttl = 0;
isc_stdtime_t now;
......
......@@ -138,7 +138,7 @@ static char *tempfile = NULL;
static const dns_master_style_t *masterstyle;
static dns_masterformat_t inputformat = dns_masterformat_text;
static dns_masterformat_t outputformat = dns_masterformat_text;
static isc_uint32_t rawversion = 1, serialnum = 0;
static uint32_t rawversion = 1, serialnum = 0;
static isc_boolean_t snset = ISC_FALSE;
static unsigned int nsigned = 0, nretained = 0, ndropped = 0;
static unsigned int nverified = 0, nverifyfailed = 0;
......@@ -928,7 +928,7 @@ opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass,
* dnssec-signzone, and build DS records from that.
*/
static isc_result_t
loadds(dns_name_t *name, isc_uint32_t ttl, dns_rdataset_t *dsset) {
loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
dns_db_t *db = NULL;
dns_dbversion_t *ver = NULL;
dns_dbnode_t *node = NULL;
......@@ -1272,12 +1272,12 @@ get_soa_ttls(void) {
* Increment (or set if nonzero) the SOA serial
*/
static isc_result_t
setsoaserial(isc_uint32_t serial, dns_updatemethod_t method) {
setsoaserial(uint32_t serial, dns_updatemethod_t method) {
isc_result_t result;
dns_dbnode_t *node = NULL;
dns_rdataset_t rdataset;