Commit d61e6a31 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)
parent 35238500
......@@ -15,6 +15,7 @@
#include <config.h>
#include <stdio.h>
#include <inttypes.h>
#ifdef _WIN32
#include <Winsock2.h>
......@@ -735,7 +736,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>
......@@ -65,7 +66,7 @@ static char hexcookie[81];
static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE,
ip6_int = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE,
ipv4only = ISC_FALSE, ipv6only = ISC_FALSE;
static isc_uint32_t splitwidth = 0xffffffff;
static uint32_t splitwidth = 0xffffffff;
/*% opcode text */
static const char * const opcodetext[] = {
......@@ -239,7 +240,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
......@@ -302,14 +303,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);
}
}
......@@ -331,7 +332,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;
......@@ -737,7 +738,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;
......@@ -1229,7 +1230,7 @@ plus_option(const char *option, isc_boolean_t is_batchfile,
warn("Couldn't parse padding");
goto exit_or_usage;
}
lookup->padding = (isc_uint16_t)num;
lookup->padding = (uint16_t)num;
break;
case 'q':
switch (cmd[1]) {
......@@ -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>
......@@ -936,9 +938,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;
......@@ -952,21 +954,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)
......@@ -981,7 +983,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;
......@@ -1427,7 +1429,7 @@ setup_libs(void) {
}
typedef struct dig_ednsoptname {
isc_uint32_t code;
uint32_t code;
const char *name;
} dig_ednsoptname_t;
......@@ -1452,7 +1454,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;
......@@ -1508,7 +1510,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;
......@@ -1883,7 +1885,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;
......@@ -2047,7 +2049,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;
......@@ -2339,9 +2341,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;
......@@ -2355,7 +2357,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");
/*
......@@ -2417,7 +2419,7 @@ setup_lookup(dig_lookup_t *lookup) {
(unsigned)addrl);
}
opts[i].value = (isc_uint8_t *) ecsbuf;
opts[i].value = (uint8_t *) ecsbuf;
i++;
}
......@@ -3014,7 +3016,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);
......@@ -3123,7 +3125,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) {
......@@ -3265,7 +3267,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;
......@@ -3453,7 +3455,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>
......@@ -671,7 +673,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>
......@@ -156,17 +158,17 @@ struct dig_lookup {
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_int16_t padding;
isc_uint32_t ixfr_serial;
uint16_t udpsize;
int16_t edns;
int16_t padding;
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;
......@@ -192,10 +194,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;
......@@ -214,7 +216,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;
};
......@@ -328,11 +330,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>
......@@ -601,15 +602,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;
......@@ -617,7 +618,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;
......@@ -625,7 +626,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;
......
......@@ -19,6 +19,7 @@
#include <config.h>
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#include <isc/buffer.h>
......@@ -86,7 +87,7 @@ static dns_rdataclass_t rdclass = dns_rdataclass_in;
* List of digest types used by ds_from_cdnskey(), filled in by add_dtype()
* from -a arguments. The size of the array is an arbitrary limit.
*/
static isc_uint8_t dtype[8];
static uint8_t dtype[8];
static const char *startstr = NULL; /* from which we derive notbefore */
static isc_stdtime_t notbefore = 0; /* restrict sig inception times */
......@@ -129,7 +130,7 @@ static int nkey; /* number of child zone DNSKEY records */
typedef struct keyinfo {
dns_rdata_t rdata;
dst_key_t *dst;
isc_uint8_t algo;
uint8_t algo;
dns_keytag_t tag;
} keyinfo_t;
......@@ -619,12 +620,12 @@ free_keytable(keyinfo_t **keytable_p) {
* otherwise the key algorithm. This is used by the signature coverage
* check functions below.
*/
static isc_uint8_t *
static uint8_t *
matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
dns_rdataset_t *sigset)
{
isc_result_t result;
isc_uint8_t *algo;
uint8_t *algo;
int i;
algo = isc_mem_get(mctx, nkey);
......@@ -704,7 +705,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
* fetched from the child zone, any working signature is enough.
*/
static isc_boolean_t
signed_loose(isc_uint8_t *algo) {
signed_loose(uint8_t *algo) {
isc_boolean_t ok = ISC_FALSE;
int i;
for (i = 0; i < nkey; i++) {
......@@ -723,7 +724,7 @@ signed_loose(isc_uint8_t *algo) {
* RRset.
*/
static isc_boolean_t
signed_strict(dns_rdataset_t *dsset, isc_uint8_t *algo) {
signed_strict(dns_rdataset_t *dsset, uint8_t *algo) {
isc_result_t result;
isc_boolean_t all_ok = ISC_TRUE;
......@@ -847,14 +848,14 @@ ds_from_cdnskey(dns_rdatalist_t *dslist, isc_buffer_t *buf,
*/
static int
cmp_dtype(const void *ap, const void *bp) {
int a = *(const isc_uint8_t *)ap;
int b = *(const isc_uint8_t *)bp;
int a = *(const uint8_t *)ap;
int b = *(const uint8_t *)bp;
return (a - b);
}
static void
add_dtype(const char *dn) {
isc_uint8_t dt;
uint8_t dt;
unsigned i, n;
dt = strtodsdigest(dn);
......@@ -871,7 +872,7 @@ add_dtype(const char *dn) {
static void
make_new_ds_set(ds_maker_func_t *ds_from_rdata,
isc_uint32_t ttl, dns_rdataset_t *rdset)
uint32_t ttl, dns_rdataset_t *rdset)
{
unsigned int size = 16;
for (;;) {
......@@ -939,7 +940,7 @@ consistent_digests(dns_rdataset_t *dsset) {
dns_rdata_t *arrdata;
dns_rdata_ds_t *ds;
dns_keytag_t key_tag;
isc_uint8_t algorithm;
uint8_t algorithm;
isc_boolean_t match;
int i, j, n, d;
......@@ -1038,7 +1039,7 @@ print_diff(const char *cmd, dns_rdataset_t *rdataset) {
}
static void
update_diff(const char *cmd, isc_uint32_t ttl,
update_diff(const char *cmd, uint32_t ttl,
dns_rdataset_t *addset, dns_rdataset_t *delset)
{
isc_result_t result;
......@@ -1046,7 +1047,7 @@ update_diff(const char *cmd, isc_uint32_t ttl,
dns_dbnode_t *node;
dns_dbversion_t *ver;
dns_rdataset_t diffset;
isc_uint32_t save;
uint32_t save;