Commit cb6a185c 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

parent 055278c9
Pipeline #3753 passed with stages
in 9 minutes and 1 second
......@@ -15,6 +15,7 @@
#include <config.h>
#include <stdio.h>
#include <inttypes.h>
#ifdef _WIN32
#include <Winsock2.h>
......@@ -734,7 +735,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>
......@@ -36,7 +38,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>
......@@ -106,7 +107,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)
......@@ -944,9 +945,9 @@ cleanup:
}
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;
......@@ -1177,7 +1178,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[] = {
......@@ -241,7 +242,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
......@@ -304,14 +305,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);
}
}
......@@ -333,7 +334,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;
......@@ -738,7 +739,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
{
isc_result_t result;
char *cmd, *value, *last = NULL, *code, *extra;
isc_uint32_t num;
uint32_t num;
isc_boolean_t state = ISC_TRUE;
size_t n;
......@@ -1232,7 +1233,7 @@ plus_option(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]) {
......@@ -1559,7 +1560,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]) {
/*
......@@ -1731,7 +1732,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],
......@@ -2034,7 +2035,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>
......@@ -901,9 +903,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;
......@@ -917,21 +919,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)
......@@ -946,7 +948,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;
......@@ -1373,7 +1375,7 @@ setup_libs(void) {
}
typedef struct dig_ednsoptname {
isc_uint32_t code;
uint32_t code;
const char *name;
} dig_ednsoptname_t;
......@@ -1398,7 +1400,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;
......@@ -1454,7 +1456,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;
......@@ -1829,7 +1831,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;
......@@ -2289,9 +2291,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;
......@@ -2305,7 +2307,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");
/*
......@@ -2367,7 +2369,7 @@ setup_lookup(dig_lookup_t *lookup) {
(unsigned)addrl);
}
opts[i].value = (isc_uint8_t *) ecsbuf;
opts[i].value = (uint8_t *) ecsbuf;
i++;
}
......@@ -2972,7 +2974,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);
......@@ -3081,7 +3083,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) {
......@@ -3223,7 +3225,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;
......@@ -3411,7 +3413,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>
......@@ -664,7 +666,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>
......@@ -158,17 +160,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;
......@@ -194,10 +196,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;
......@@ -216,7 +218,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;
};
......@@ -327,11 +329,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>
......@@ -84,7 +85,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 */
......@@ -127,7 +128,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;
......@@ -617,12 +618,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);
......@@ -705,7 +706,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++) {
......@@ -724,7 +725,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;
......@@ -848,14 +849,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);
......@@ -872,7 +873,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 (;;) {
......@@ -940,7 +941,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;