From 3f9536c5cc9ed6659ad2514859bd1716cbf7b26b Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 12 Jan 2017 15:35:29 +0000 Subject: Types fix, first pass. Some places marked XXX for the skalibs API change. --- src/clients/s6-dnsip4.c | 10 +++-- src/clients/s6-dnsip6.c | 10 +++-- src/clients/s6-dnsmx.c | 10 +++-- src/clients/s6-dnsname-filter.c | 5 ++- src/clients/s6-dnsname.c | 9 +++-- src/clients/s6-dnsns.c | 9 +++-- src/clients/s6-dnsq.c | 7 ++-- src/clients/s6-dnsqr.c | 3 +- src/clients/s6-dnsqualify.c | 3 +- src/clients/s6-dnssoa.c | 10 +++-- src/clients/s6-dnssrv.c | 16 ++++---- src/clients/s6-dnstxt.c | 24 ++++++------ src/clients/s6-randomip.c | 5 ++- src/clients/s6dns-generic-filter.h | 9 +++-- src/clients/s6dns_generic_filter_main.c | 26 +++++++------ src/clients/s6dns_namescanner.c | 8 +++- src/include/s6-dns/s6dns-analyze.h | 4 +- src/include/s6-dns/s6dns-domain.h | 21 +++++----- src/include/s6-dns/s6dns-engine.h | 9 ++--- src/include/s6-dns/s6dns-fmt.h | 11 +++--- src/include/s6-dns/s6dns-message.h | 45 +++++++++++----------- src/include/s6-dns/s6dns-rci.h | 4 +- src/include/s6-dns/s6dns-resolve.h | 27 +++++++------ src/include/s6-dns/skadns.h | 14 +++---- src/libs6dns/s6dns-message-internal.h | 5 ++- src/libs6dns/s6dns_analyze_packet.c | 3 +- src/libs6dns/s6dns_analyze_qtype_parse.c | 7 ++-- src/libs6dns/s6dns_analyze_record.c | 3 +- src/libs6dns/s6dns_analyze_record_domain.c | 5 ++- src/libs6dns/s6dns_analyze_record_hinfo.c | 5 ++- src/libs6dns/s6dns_analyze_record_mx.c | 5 ++- src/libs6dns/s6dns_analyze_record_soa.c | 5 ++- src/libs6dns/s6dns_analyze_record_srv.c | 5 ++- src/libs6dns/s6dns_analyze_record_unknown.c | 3 +- src/libs6dns/s6dns_debug_dumpdt_post_send.c | 10 +++-- src/libs6dns/s6dns_debug_dumpdt_pre_send.c | 6 ++- src/libs6dns/s6dns_domain_fromstring.c | 9 +++-- .../s6dns_domain_fromstring_noqualify_encode.c | 3 +- .../s6dns_domain_fromstring_qualify_encode.c | 2 +- src/libs6dns/s6dns_domain_qualify.c | 3 +- src/libs6dns/s6dns_domain_tostring.c | 3 +- src/libs6dns/s6dns_engine.c | 13 ++++--- src/libs6dns/s6dns_fmt_domainlist.c | 5 ++- src/libs6dns/s6dns_fmt_hinfo.c | 5 ++- src/libs6dns/s6dns_fmt_mx.c | 5 ++- src/libs6dns/s6dns_fmt_soa.c | 7 ++-- src/libs6dns/s6dns_fmt_srv.c | 7 ++-- src/libs6dns/s6dns_message_get_domain_internal.c | 5 ++- src/libs6dns/s6dns_message_get_string_internal.c | 3 +- src/libs6dns/s6dns_message_parse_answer_strings.c | 13 +++---- src/libs6dns/s6dns_rci_init.c | 29 +++++++------- src/libs6dns/s6dns_resolve_core.c | 4 +- src/libs6dns/s6dns_resolve_dpag.c | 4 +- src/libs6dns/s6dns_resolve_mpag.c | 4 +- src/libs6dns/s6dns_resolve_parse.c | 4 +- src/libs6dns/s6dns_resolvenoq.c | 4 +- src/libs6dns/s6dns_resolvenoq_aaaaa.c | 5 ++- src/libs6dns/s6dns_resolveq.c | 4 +- src/libs6dns/s6dns_resolveq_aaaaa.c | 8 ++-- src/skadns/skadns_cancel.c | 3 +- src/skadns/skadns_end.c | 3 +- src/skadns/skadns_packet.c | 4 +- src/skadns/skadns_packetlen.c | 4 +- src/skadns/skadns_release.c | 4 +- src/skadns/skadns_send.c | 5 ++- src/skadns/skadnsd.c | 7 ++-- 66 files changed, 298 insertions(+), 242 deletions(-) diff --git a/src/clients/s6-dnsip4.c b/src/clients/s6-dnsip4.c index 03c52dd..1f1eb28 100644 --- a/src/clients/s6-dnsip4.c +++ b/src/clients/s6-dnsip4.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -17,7 +18,8 @@ int main (int argc, char const *const *argv) { stralloc ips = STRALLOC_ZERO ; tain_t deadline ; - unsigned int i = 0 ; + size_t i = 0 ; + unsigned int t = 0 ; int flagqualify = 0 ; int flagunsort = 0 ; PROG = "s6-dnsip4" ; @@ -30,7 +32,7 @@ int main (int argc, char const *const *argv) { case 'q' : flagqualify = 1 ; break ; case 'r' : flagunsort = 1 ; break ; - case 't' : if (!uint0_scan(subgetopt_here.arg, &i)) dieusage() ; break ; + case 't' : if (!uint0_scan(subgetopt_here.arg, &t)) dieusage() ; break ; default : dieusage() ; } } @@ -38,7 +40,7 @@ int main (int argc, char const *const *argv) if (argc < 1) dieusage() ; tain_now_g() ; - if (i) tain_from_millisecs(&deadline, i) ; else deadline = tain_infinite_relative ; + if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { @@ -51,7 +53,7 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < ips.len / 4 ; i++) { char fmt[IP4_FMT] ; - register unsigned int n = ip4_fmt(fmt, ips.s + 4 * i) ; + register size_t n = ip4_fmt(fmt, ips.s + 4 * i) ; fmt[n++] = '\n' ; if (buffer_put(buffer_1small, fmt, n) < (int)n) strerr_diefu1sys(111, "write to stdout") ; diff --git a/src/clients/s6-dnsip6.c b/src/clients/s6-dnsip6.c index e07ba53..a948b49 100644 --- a/src/clients/s6-dnsip6.c +++ b/src/clients/s6-dnsip6.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -17,7 +18,8 @@ int main (int argc, char const *const *argv) { stralloc ips = STRALLOC_ZERO ; tain_t deadline ; - unsigned int i = 0 ; + size_t i = 0 ; + unsigned int t = 0 ; int flagqualify = 0 ; int flagunsort = 0 ; PROG = "s6-dnsip6" ; @@ -30,7 +32,7 @@ int main (int argc, char const *const *argv) { case 'q' : flagqualify = 1 ; break ; case 'r' : flagunsort = 1 ; break ; - case 't' : if (!uint0_scan(subgetopt_here.arg, &i)) dieusage() ; break ; + case 't' : if (!uint0_scan(subgetopt_here.arg, &t)) dieusage() ; break ; default : dieusage() ; } } @@ -38,7 +40,7 @@ int main (int argc, char const *const *argv) if (argc < 1) dieusage() ; tain_now_g() ; - if (i) tain_from_millisecs(&deadline, i) ; else deadline = tain_infinite_relative ; + if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { @@ -51,7 +53,7 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < ips.len / 16 ; i++) { char fmt[IP6_FMT] ; - register unsigned int n = ip6_fmt(fmt, ips.s + 16 * i) ; + register size_t n = ip6_fmt(fmt, ips.s + 16 * i) ; fmt[n++] = '\n' ; if (buffer_put(buffer_1small, fmt, n) < (int)n) strerr_diefu1sys(111, "write to stdout") ; diff --git a/src/clients/s6-dnsmx.c b/src/clients/s6-dnsmx.c index a495cb2..5b8359c 100644 --- a/src/clients/s6-dnsmx.c +++ b/src/clients/s6-dnsmx.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -19,7 +20,8 @@ int main (int argc, char const *const *argv) { genalloc mxs = GENALLOC_ZERO ; /* array of s6dns_message_rr_mx_t */ tain_t deadline ; - unsigned int i = 0 ; + size_t i = 0 ; + unsigned int t = 0 ; int flagqualify = 0 ; int flagunsort = 0 ; PROG = "s6-dnsmx" ; @@ -31,7 +33,7 @@ int main (int argc, char const *const *argv) { case 'q' : flagqualify = 1 ; break ; case 'r' : flagunsort = 1 ; break ; - case 't' : if (!uint0_scan(subgetopt_here.arg, &i)) dieusage() ; break ; + case 't' : if (!uint0_scan(subgetopt_here.arg, &t)) dieusage() ; break ; default : dieusage() ; } } @@ -39,7 +41,7 @@ int main (int argc, char const *const *argv) if (argc < 1) dieusage() ; tain_now_g() ; - if (i) tain_from_millisecs(&deadline, i) ; else deadline = tain_infinite_relative ; + if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { @@ -52,7 +54,7 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < genalloc_len(s6dns_message_rr_mx_t, &mxs) ; i++) { char buf[S6DNS_FMT_MX] ; - register unsigned int len = s6dns_fmt_mx(buf, S6DNS_FMT_MX, genalloc_s(s6dns_message_rr_mx_t, &mxs) + i) ; + register size_t len = s6dns_fmt_mx(buf, S6DNS_FMT_MX, genalloc_s(s6dns_message_rr_mx_t, &mxs) + i) ; if (!len) strerr_diefu1sys(111, "format result") ; if (buffer_put(buffer_1, buf, len) < 0) goto err ; if (buffer_put(buffer_1, "\n", 1) < 0) goto err ; diff --git a/src/clients/s6-dnsname-filter.c b/src/clients/s6-dnsname-filter.c index 99dad32..0edbe7a 100644 --- a/src/clients/s6-dnsname-filter.c +++ b/src/clients/s6-dnsname-filter.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -12,10 +13,10 @@ #define USAGE "s6-dnsname-filter [ -4 ] [ -6 ] [ -l lines ] [ -c concurrency ] [ -t timeout ] [ -f format ] [ -e errorformat ]" -static unsigned int ipscanner (s6dns_domain_t *d, char const *s) +static size_t ipscanner (s6dns_domain_t *d, char const *s) { char ip[16] ; - register unsigned int pos ; + register size_t pos ; if (flag6) { pos = ip6_scan(s, ip) ; diff --git a/src/clients/s6-dnsname.c b/src/clients/s6-dnsname.c index fe5ab9a..103edad 100644 --- a/src/clients/s6-dnsname.c +++ b/src/clients/s6-dnsname.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -20,7 +21,7 @@ int main (int argc, char const *const *argv) genalloc ds = GENALLOC_ZERO ; /* array of s6dns_domain_t */ tain_t deadline ; ip46full_t ip = IP46FULL_ZERO ; - unsigned int i = 0 ; + unsigned int t = 0 ; int flagunsort = 0 ; int do4 = 0 ; int do6 = 0 ; @@ -34,7 +35,7 @@ int main (int argc, char const *const *argv) case '4' : do4 = 1 ; break ; case '6' : do6 = 1 ; break ; case 'r' : flagunsort = 1 ; break ; - case 't' : if (!uint0_scan(subgetopt_here.arg, &i)) dieusage() ; break ; + case 't' : if (!uint0_scan(subgetopt_here.arg, &t)) dieusage() ; break ; default : dieusage() ; } } @@ -53,7 +54,7 @@ int main (int argc, char const *const *argv) else if (!ip4_scan(argv[0], ip.ip)) dieusage() ; tain_now_g() ; - if (i) tain_from_millisecs(&deadline, i) ; else deadline = tain_infinite_relative ; + if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { @@ -65,7 +66,7 @@ int main (int argc, char const *const *argv) if (flagunsort) random_unsort(ds.s, genalloc_len(s6dns_domain_t, &ds), sizeof(s6dns_domain_t)) ; { char buf[S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds))] ; - unsigned int len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds)), genalloc_s(s6dns_domain_t, &ds), genalloc_len(s6dns_domain_t, &ds), "\n", 1) ; + size_t len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds)), genalloc_s(s6dns_domain_t, &ds), genalloc_len(s6dns_domain_t, &ds), "\n", 1) ; if (!len) strerr_diefu1sys(111, "format result") ; if (buffer_put(buffer_1, buf, len) < 0) goto err ; } diff --git a/src/clients/s6-dnsns.c b/src/clients/s6-dnsns.c index d1caba5..6e86b89 100644 --- a/src/clients/s6-dnsns.c +++ b/src/clients/s6-dnsns.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -18,7 +19,7 @@ int main (int argc, char const *const *argv) { genalloc ds = GENALLOC_ZERO ; /* array of s6dns_domain_t */ tain_t deadline ; - unsigned int i = 0 ; + unsigned int t = 0 ; int flagqualify = 0 ; int flagunsort = 0 ; PROG = "s6-dnsns" ; @@ -30,7 +31,7 @@ int main (int argc, char const *const *argv) { case 'q' : flagqualify = 1 ; break ; case 'r' : flagunsort = 1 ; break ; - case 't' : if (!uint0_scan(subgetopt_here.arg, &i)) dieusage() ; break ; + case 't' : if (!uint0_scan(subgetopt_here.arg, &t)) dieusage() ; break ; default : dieusage() ; } } @@ -38,7 +39,7 @@ int main (int argc, char const *const *argv) if (argc < 1) dieusage() ; tain_now_g() ; - if (i) tain_from_millisecs(&deadline, i) ; else deadline = tain_infinite_relative ; + if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { @@ -50,7 +51,7 @@ int main (int argc, char const *const *argv) if (flagunsort) random_unsort(ds.s, genalloc_len(s6dns_domain_t, &ds), sizeof(s6dns_domain_t)) ; { char buf[S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds))] ; - unsigned int len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds)), genalloc_s(s6dns_domain_t, &ds), genalloc_len(s6dns_domain_t, &ds), "\n", 1) ; + size_t len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds)), genalloc_s(s6dns_domain_t, &ds), genalloc_len(s6dns_domain_t, &ds), "\n", 1) ; if (!len) strerr_diefu1sys(111, "format result") ; if (buffer_put(buffer_1, buf, len) < 0) goto err ; } diff --git a/src/clients/s6-dnsq.c b/src/clients/s6-dnsq.c index 76ca4ea..538c925 100644 --- a/src/clients/s6-dnsq.c +++ b/src/clients/s6-dnsq.c @@ -1,8 +1,9 @@ /* ISC license. */ +#include +#include #include #include -#include #include #include #include @@ -23,7 +24,7 @@ int main (int argc, char const *const *argv) { tain_t deadline ; unsigned int debuglevel = 0 ; - uint16 qtype ; + uint16_t qtype ; genwrite_t *where = &genwrite_stderr ; PROG = "s6-dnsq" ; { @@ -60,7 +61,7 @@ int main (int argc, char const *const *argv) for (; (i < (unsigned int)(argc - 2)) && (j < S6DNS_MAX_SERVERS) ; i++) { ip46_t z[S6DNS_MAX_SERVERS] ; - unsigned int n ; + unsigned int n ; /* XXX: depends on ip46_scanlist API */ register unsigned int k = 0 ; if (!*argv[2+i]) continue ; if (!ip46_scanlist(z, S6DNS_MAX_SERVERS - j, argv[2 + i], &n)) diff --git a/src/clients/s6-dnsqr.c b/src/clients/s6-dnsqr.c index 1effe68..f1bb896 100644 --- a/src/clients/s6-dnsqr.c +++ b/src/clients/s6-dnsqr.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -45,7 +46,7 @@ int main (int argc, char const *const *argv) { s6dns_debughook_t dbh = { .post_recv = 0, .pre_send = 0, .post_send = 0 } ; s6dns_domain_t d ; - uint16 qtype = s6dns_analyze_qtype_parse(argv[0]) ; + uint16_t qtype = s6dns_analyze_qtype_parse(argv[0]) ; if (!qtype) dieusage() ; if (!s6dns_domain_fromstring_noqualify_encode(&d, argv[1], str_len(argv[1]))) strerr_diefu2sys(100, "encode ", argv[1]) ; diff --git a/src/clients/s6-dnsqualify.c b/src/clients/s6-dnsqualify.c index 64767ae..94405db 100644 --- a/src/clients/s6-dnsqualify.c +++ b/src/clients/s6-dnsqualify.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -22,7 +23,7 @@ int main (int argc, char const *const *argv) if (!n) strerr_diefu2sys(111, "qualify ", argv[1]) ; { char buf[S6DNS_FMT_DOMAINLIST(n)] ; - unsigned int len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(n), list, n, "\n", 1) ; + size_t len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(n), list, n, "\n", 1) ; if (!len) strerr_diefu1sys(111, "format result") ; if (buffer_put(buffer_1, buf, len) < 0) goto err ; } diff --git a/src/clients/s6-dnssoa.c b/src/clients/s6-dnssoa.c index 1b02ff6..e620c85 100644 --- a/src/clients/s6-dnssoa.c +++ b/src/clients/s6-dnssoa.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -18,7 +19,8 @@ int main (int argc, char const *const *argv) { genalloc soas = GENALLOC_ZERO ; /* array of s6dns_message_rr_soa_t */ tain_t deadline ; - unsigned int i = 0 ; + size_t i = 0 ; + unsigned int t = 0 ; int flagqualify = 0 ; int flagunsort = 0 ; PROG = "s6-dnssoa" ; @@ -30,7 +32,7 @@ int main (int argc, char const *const *argv) { case 'q' : flagqualify = 1 ; break ; case 'r' : flagunsort = 1 ; break ; - case 't' : if (!uint0_scan(subgetopt_here.arg, &i)) dieusage() ; break ; + case 't' : if (!uint0_scan(subgetopt_here.arg, &t)) dieusage() ; break ; default : dieusage() ; } } @@ -38,7 +40,7 @@ int main (int argc, char const *const *argv) if (argc < 1) dieusage() ; tain_now_g() ; - if (i) tain_from_millisecs(&deadline, i) ; else deadline = tain_infinite_relative ; + if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { @@ -51,7 +53,7 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < genalloc_len(s6dns_message_rr_soa_t, &soas) ; i++) { char buf[S6DNS_FMT_SOA] ; - register unsigned int len = s6dns_fmt_soa(buf, S6DNS_FMT_SOA, genalloc_s(s6dns_message_rr_soa_t, &soas) + i) ; + register size_t len = s6dns_fmt_soa(buf, S6DNS_FMT_SOA, genalloc_s(s6dns_message_rr_soa_t, &soas) + i) ; if (!len) strerr_diefu1sys(111, "format result") ; if (buffer_put(buffer_1, buf, len) < 0) goto err ; if (buffer_put(buffer_1, "\n", 1) < 0) goto err ; diff --git a/src/clients/s6-dnssrv.c b/src/clients/s6-dnssrv.c index 283f1cd..47f5df0 100644 --- a/src/clients/s6-dnssrv.c +++ b/src/clients/s6-dnssrv.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -18,7 +19,8 @@ int main (int argc, char const *const *argv) { genalloc srvs = GENALLOC_ZERO ; /* array of s6dns_message_rr_srv_t */ tain_t deadline ; - unsigned int i = 0 ; + size_t i = 0 ; + unsigned int t = 0 ; int flagqualify = 0 ; int flagunsort = 0 ; PROG = "s6-dnssrv" ; @@ -30,7 +32,7 @@ int main (int argc, char const *const *argv) { case 'q' : flagqualify = 1 ; break ; case 'r' : flagunsort = 1 ; break ; - case 't' : if (!uint0_scan(subgetopt_here.arg, &i)) dieusage() ; break ; + case 't' : if (!uint0_scan(subgetopt_here.arg, &t)) dieusage() ; break ; default : dieusage() ; } } @@ -38,13 +40,13 @@ int main (int argc, char const *const *argv) if (argc < 3) dieusage() ; tain_now_g() ; - if (i) tain_from_millisecs(&deadline, i) ; else deadline = tain_infinite_relative ; + if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { - unsigned int n0 = str_len(argv[0]) ; - unsigned int n1 = str_len(argv[1]) ; - unsigned int n2 = str_len(argv[2]) ; + size_t n0 = str_len(argv[0]) ; + size_t n1 = str_len(argv[1]) ; + size_t n2 = str_len(argv[2]) ; char name[n0 + n1 + n2 + 5] ; name[0] = '_' ; byte_copy(name + 1, n0, argv[0]) ; @@ -63,7 +65,7 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < genalloc_len(s6dns_message_rr_srv_t, &srvs) ; i++) { char buf[S6DNS_FMT_SRV] ; - register unsigned int len = s6dns_fmt_srv(buf, S6DNS_FMT_SRV, genalloc_s(s6dns_message_rr_srv_t, &srvs) + i) ; + register size_t len = s6dns_fmt_srv(buf, S6DNS_FMT_SRV, genalloc_s(s6dns_message_rr_srv_t, &srvs) + i) ; if (!len) strerr_diefu1sys(111, "format result") ; if (buffer_put(buffer_1, buf, len) < 0) goto err ; if (buffer_put(buffer_1, "\n", 1) < 0) goto err ; diff --git a/src/clients/s6-dnstxt.c b/src/clients/s6-dnstxt.c index fde69d2..5ee1427 100644 --- a/src/clients/s6-dnstxt.c +++ b/src/clients/s6-dnstxt.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -20,10 +21,11 @@ int main (int argc, char const *const *argv) { stralloc quoted = STRALLOC_ZERO ; stralloc sa = STRALLOC_ZERO ; - genalloc offsets = GENALLOC_ZERO ; /* array of unsigned int */ + genalloc offsets = GENALLOC_ZERO ; /* array of size_t */ tain_t deadline, stamp ; - unsigned int n ; - unsigned int i = 0 ; + size_t n ; + size_t i = 0 ; + unsigned int t = 0 ; int flagqualify = 0 ; int flagunsort = 0 ; PROG = "s6-dnstxt" ; @@ -35,7 +37,7 @@ int main (int argc, char const *const *argv) { case 'q' : flagqualify = 1 ; break ; case 'r' : flagunsort = 1 ; break ; - case 't' : if (!uint0_scan(subgetopt_here.arg, &i)) dieusage() ; break ; + case 't' : if (!uint0_scan(subgetopt_here.arg, &t)) dieusage() ; break ; default : dieusage() ; } } @@ -43,7 +45,7 @@ int main (int argc, char const *const *argv) if (argc < 1) dieusage() ; tain_now(&stamp) ; - if (i) tain_from_millisecs(&deadline, i) ; else deadline = tain_infinite_relative ; + if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add(&deadline, &deadline, &stamp) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { @@ -51,21 +53,21 @@ int main (int argc, char const *const *argv) if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ; if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ; } - n = genalloc_len(unsigned int, &offsets) ; + n = genalloc_len(size_t, &offsets) ; if (!n) return 1 ; { - unsigned int printable_offsets[n] ; + size_t printable_offsets[n] ; for (i = 0 ; i < n ; i++) { - unsigned int beg = genalloc_s(unsigned int, &offsets)[i] ; - unsigned int end = (i < n-1 ? genalloc_s(unsigned int, &offsets)[i+1] : sa.len) - 1 ; + size_t beg = genalloc_s(size_t, &offsets)[i] ; + size_t end = (i < n-1 ? genalloc_s(size_t, &offsets)[i+1] : sa.len) - 1 ; printable_offsets[i] = quoted.len ; if (!string_quote("ed, sa.s + beg, end - beg) || !stralloc_0("ed)) strerr_diefu2sys(111, "quote ", sa.s + beg) ; } - genalloc_free(unsigned int, &offsets) ; + genalloc_free(size_t, &offsets) ; stralloc_free(&sa) ; - if (flagunsort) random_unsort((char *)printable_offsets, n, sizeof(unsigned int)) ; + if (flagunsort) random_unsort((char *)printable_offsets, n, sizeof(size_t)) ; for (i = 0 ; i < n ; i++) if ((buffer_puts(buffer_1small, quoted.s + printable_offsets[i]) < 0) || (buffer_put(buffer_1small, "\n", 1) < 1)) diff --git a/src/clients/s6-randomip.c b/src/clients/s6-randomip.c index 2c1581a..95ce042 100644 --- a/src/clients/s6-randomip.c +++ b/src/clients/s6-randomip.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -17,7 +18,7 @@ int main (int argc, char const *const *argv) char ip[16] ; unsigned int n ; unsigned int i = 0 ; - unsigned int what = 0 ; + size_t what = 0 ; int finite = 0 ; PROG = "s6-randomip" ; for (;;) @@ -41,7 +42,7 @@ int main (int argc, char const *const *argv) if (!random_init()) strerr_diefu1sys(111, "init random generator") ; for (i = 0 ; !finite || (i < n) ; i++) { - unsigned int len = what ; + size_t len = what ; if (len > 16) { unsigned char c = random_char() ; diff --git a/src/clients/s6dns-generic-filter.h b/src/clients/s6dns-generic-filter.h index 53fa560..8b2c738 100644 --- a/src/clients/s6dns-generic-filter.h +++ b/src/clients/s6dns-generic-filter.h @@ -3,18 +3,19 @@ #ifndef SKADNS_GENERIC_FILTER_H #define SKADNS_GENERIC_FILTER_H -#include +#include +#include #include #include -typedef unsigned int scan_func_t (s6dns_domain_t *, char const *) ; +typedef size_t scan_func_t (s6dns_domain_t *, char const *) ; typedef scan_func_t *scan_func_t_ref ; typedef int fmt_func_t (stralloc *, char const *, unsigned int) ; typedef fmt_func_t *fmt_func_t_ref ; -extern unsigned int s6dns_namescanner (s6dns_domain_t *, char const *) ; +extern size_t s6dns_namescanner (s6dns_domain_t *, char const *) ; extern int s6dns_domainformatter (stralloc *, char const *, unsigned int) ; -extern int s6dns_generic_filter_main (int, char const *const *, char const *const *, uint16, scan_func_t_ref, fmt_func_t_ref, char const *) ; +extern int s6dns_generic_filter_main (int, char const *const *, char const *const *, uint16_t, scan_func_t_ref, fmt_func_t_ref, char const *) ; extern int flag4 ; extern int flag6 ; diff --git a/src/clients/s6dns_generic_filter_main.c b/src/clients/s6dns_generic_filter_main.c index 664edef..6d51e67 100644 --- a/src/clients/s6dns_generic_filter_main.c +++ b/src/clients/s6dns_generic_filter_main.c @@ -1,5 +1,7 @@ /* ISC license. */ +#include +#include #include #include #include @@ -25,8 +27,8 @@ typedef struct line_s line_t, *line_t_ref ; struct line_s { stralloc swrd ; - unsigned int wpos ; - int dpos ; + size_t wpos ; + ssize_t dpos ; char w[2] ; unsigned int pending : 1 ; } ; @@ -42,14 +44,14 @@ static void line_recycle (line_t *l) int flag4 = 0 ; int flag6 = 0 ; -int s6dns_generic_filter_main (int argc, char const *const *argv, char const *const *envp, uint16 qtype, scan_func_t_ref scanner, fmt_func_t_ref formatter, char const *USAGE) +int s6dns_generic_filter_main (int argc, char const *const *argv, char const *const *envp, uint16_t qtype, scan_func_t_ref scanner, fmt_func_t_ref formatter, char const *USAGE) { skadns_t a = SKADNS_ZERO ; tain_t deadline, tto ; char const *normalformat = "%s=%d%w%r" ; char const *errorformat = "%s=<%e>%w%r" ; - uint16 maxlines = 256 ; - uint16 maxconn = 128 ; + uint16_t maxlines = 256 ; + uint16_t maxconn = 128 ; { subgetopt_t l = SUBGETOPT_ZERO ; unsigned int t = 0 ; @@ -86,13 +88,13 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co { iopause_fd x[3] = { { .fd = 0, .events = 0, .revents = 0 }, { .fd = 1, .events = 0, .revents = 0 }, { .fd = skadns_fd(&a), .events = 0, .revents = 0 } } ; - uint16 lhead = 0, ltail = 0, numlines = 0, pending = 0 ; + uint16_t lhead = 0, ltail = 0, numlines = 0, pending = 0 ; line_t storage[maxlines+1] ; - uint16 lineindex[maxconn] ; + uint16_t lineindex[maxconn] ; { line_t line_zero = LINE_ZERO ; char const *args[4] = { "", "", "", "" } ; - uint16 i = 0 ; + uint16_t i = 0 ; for (; i <= maxlines ; i++) storage[i] = line_zero ; if (!string_format(&storage[0].swrd, "sdwr", normalformat, args) || !string_format(&storage[0].swrd, "sewr", errorformat, args)) @@ -126,13 +128,13 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co if (x[2].revents) { register int j = 0 ; - register uint16 const *list ; + register uint16_t const *list ; int n = skadns_update(&a) ; if (n < 0) strerr_diefu1sys(111, "skadns_update") ; list = skadns_list(&a) ; for (; j < n ; j++) { - register uint16 i = lineindex[list[j]] ; + register uint16_t i = lineindex[list[j]] ; register char const *packet = skadns_packet(&a, list[j]) ; if (packet) { @@ -185,7 +187,7 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co else { tain_t sendlimit ; - uint16 id ; + uint16_t id ; line->w[0] = line->swrd.s[line->wpos] ; line->swrd.s[line->wpos] = 0 ; tain_addsec_g(&sendlimit, 2) ; @@ -209,7 +211,7 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co for (; ltail != lhead ; ltail = (ltail+1) % (maxlines+1), numlines--) { char *args[4] ; - register line_t_ref line = storage + ltail ; + register line_t *line = storage + ltail ; if (line->pending) break ; args[0] = line->swrd.s ; args[1] = line->dpos < 0 ? (char *)s6dns_constants_error_str(-line->dpos) : line->swrd.s + line->dpos ; diff --git a/src/clients/s6dns_namescanner.c b/src/clients/s6dns_namescanner.c index 136b1e8..c2110d2 100644 --- a/src/clients/s6dns_namescanner.c +++ b/src/clients/s6dns_namescanner.c @@ -1,12 +1,16 @@ /* ISC license. */ +#include +#include +#include #include #include "s6dns-generic-filter.h" -unsigned int s6dns_namescanner (s6dns_domain_t *d, char const *s) +size_t s6dns_namescanner (s6dns_domain_t *d, char const *s) { - register unsigned int pos = 0 ; + register size_t pos = 0 ; while (s[pos] && (s[pos] != ' ') && (s[pos] != '\t') && (s[pos] != '\r') && (s[pos] != '\n')) pos++ ; + if (pos > UINT_MAX) return (errno = ENAMETOOLONG, 0) ; if (!s6dns_domain_fromstring_noqualify_encode(d, s, pos)) return 0 ; return pos ; } diff --git a/src/include/s6-dns/s6dns-analyze.h b/src/include/s6-dns/s6dns-analyze.h index 2908763..ff74025 100644 --- a/src/include/s6-dns/s6dns-analyze.h +++ b/src/include/s6-dns/s6dns-analyze.h @@ -3,7 +3,7 @@ #ifndef S6DNS_ANALYZE_H #define S6DNS_ANALYZE_H -#include +#include #include #include @@ -13,7 +13,7 @@ typedef s6dns_analyze_record_func_t *s6dns_analyze_record_func_t_ref ; typedef struct s6dns_analyze_rtypetable_s s6dns_analyze_rtypetable_t, *s6dns_analyze_rtypetable_t_ref ; struct s6dns_analyze_rtypetable_s { - uint16 rtype ; + uint16_t rtype ; char const *string ; s6dns_analyze_record_func_t_ref f ; } ; diff --git a/src/include/s6-dns/s6dns-domain.h b/src/include/s6-dns/s6dns-domain.h index 3faae07..d5ed077 100644 --- a/src/include/s6-dns/s6dns-domain.h +++ b/src/include/s6-dns/s6dns-domain.h @@ -3,6 +3,7 @@ #ifndef S6DNS_DOMAIN_H #define S6DNS_DOMAIN_H +#include #include typedef struct s6dns_domain_s s6dns_domain_t, *s6dns_domain_t_ref ; @@ -15,33 +16,33 @@ struct s6dns_domain_s /* Conversions from/to user strings */ -extern int s6dns_domain_fromstring (s6dns_domain_t_ref, char const *, unsigned int) ; -extern unsigned int s6dns_domain_tostring (char *, unsigned int, s6dns_domain_t const *) ; +extern int s6dns_domain_fromstring (s6dns_domain_t *, char const *, size_t) ; +extern unsigned int s6dns_domain_tostring (char *, size_t, s6dns_domain_t const *) ; /* Qualification */ -extern int s6dns_domain_noqualify (s6dns_domain_t_ref) ; +extern int s6dns_domain_noqualify (s6dns_domain_t *) ; extern unsigned int s6dns_domain_qualify (s6dns_domain_t *, s6dns_domain_t const *, char const *, unsigned int) ; /* Internal coding/encoding to/from protocol form */ -extern int s6dns_domain_encode (s6dns_domain_t_ref) ; -extern unsigned int s6dns_domain_encodelist (s6dns_domain_t_ref, unsigned int) ; -extern int s6dns_domain_decode (s6dns_domain_t_ref) ; +extern int s6dns_domain_encode (s6dns_domain_t *) ; +extern unsigned int s6dns_domain_encodelist (s6dns_domain_t *, unsigned int) ; +extern int s6dns_domain_decode (s6dns_domain_t *) ; /* Useful shortcuts */ -extern int s6dns_domain_fromstring_noqualify_encode (s6dns_domain_t_ref, char const *, unsigned int) ; -extern unsigned int s6dns_domain_fromstring_qualify_encode (s6dns_domain_t *, char const *, unsigned int, char const *, unsigned int) ; +extern int s6dns_domain_fromstring_noqualify_encode (s6dns_domain_t *, char const *, size_t) ; +extern unsigned int s6dns_domain_fromstring_qualify_encode (s6dns_domain_t *, char const *, size_t, char const *, unsigned int) ; /* Helpers for PTR */ -extern void s6dns_domain_arpafromip4 (s6dns_domain_t_ref, char const *) ; -extern void s6dns_domain_arpafromip6 (s6dns_domain_t_ref, char const *, unsigned int) ; +extern void s6dns_domain_arpafromip4 (s6dns_domain_t *, char const *) ; +extern void s6dns_domain_arpafromip6 (s6dns_domain_t *, char const *, unsigned int) ; #define s6dns_domain_arpafromip46(d, i) (ip46_is6(i) ? s6dns_domain_arpafromip6(d, (i)->ip, 128) : s6dns_domain_arpafromip4(d, (i)->ip)) #endif diff --git a/src/include/s6-dns/s6dns-engine.h b/src/include/s6-dns/s6dns-engine.h index d6b0503..bcb1a46 100644 --- a/src/include/s6-dns/s6dns-engine.h +++ b/src/include/s6-dns/s6dns-engine.h @@ -3,9 +3,8 @@ #ifndef S6DNS_ENGINE_H #define S6DNS_ENGINE_H +#include #include -#include -#include #include #include #include @@ -45,7 +44,7 @@ struct s6dns_engine_s tain_t localdeadline ; unsigned int querylen ; int fd ; - uint32 protostate ; + uint32_t protostate ; s6dns_ip46list_t servers ; s6dns_debughook_t const *debughook ; unsigned int curserver ; @@ -84,7 +83,7 @@ extern void s6dns_engine_freen (s6dns_engine_t *, unsigned int) ; #define s6dns_engine_init(dt, servers, options, q, qlen, qtype, deadline, stamp) s6dns_engine_init_r(dt, servers, options, q, qlen, qtype, &s6dns_debughook_zero, deadline, stamp) #define s6dns_engine_init_g(dt, servers, options, q, qlen, qtype, deadline) s6dns_engine_init(dt, servers, options, q, qlen, qtype, (deadline), &STAMP) -extern int s6dns_engine_init_r (s6dns_engine_t *, s6dns_ip46list_t const *, uint32, char const *, unsigned int, uint16, s6dns_debughook_t const *, tain_t const *, tain_t const *) ; +extern int s6dns_engine_init_r (s6dns_engine_t *, s6dns_ip46list_t const *, uint32_t, char const *, unsigned int, uint16_t, s6dns_debughook_t const *, tain_t const *, tain_t const *) ; #define s6dns_engine_init_r_g(dt, servers, options, q, qlen, qtype, dbh, deadline) s6dns_engine_init_r(dt, servers, options, q, qlen, qtype, dbh, (deadline), &STAMP) @@ -103,6 +102,6 @@ extern int s6dns_engine_event (s6dns_engine_t *, tain_t const *) ; #define s6dns_engine_event_g(dt) s6dns_engine_event((dt), &STAMP) #define s6dns_engine_packet(dt) ((dt)->sa.s + (dt)->querylen) -#define s6dns_engine_packetlen(dt) ((dt)->sa.len - (dt)->querylen) +#define s6dns_engine_packetlen(dt) ((unsigned int)((dt)->sa.len - (dt)->querylen)) #endif diff --git a/src/include/s6-dns/s6dns-fmt.h b/src/include/s6-dns/s6dns-fmt.h index fd4dfc5..e9d379b 100644 --- a/src/include/s6-dns/s6dns-fmt.h +++ b/src/include/s6-dns/s6dns-fmt.h @@ -3,6 +3,7 @@ #ifndef S6DNS_FMT_H #define S6DNS_FMT_H +#include #include #include #include @@ -12,18 +13,18 @@ #define s6dns_fmt_domain(s, max, d) s6dns_domain_tostring(s, max, d) #define S6DNS_FMT_DOMAINLIST(n) ((n) * S6DNS_FMT_DOMAIN) -extern unsigned int s6dns_fmt_domainlist (char *, unsigned int, s6dns_domain_t const *, unsigned int, char const *, unsigned int) ; +extern size_t s6dns_fmt_domainlist (char *, size_t, s6dns_domain_t const *, unsigned int, char const *, size_t) ; #define S6DNS_FMT_HINFO 512 -extern unsigned int s6dns_fmt_hinfo (char *, unsigned int, s6dns_message_rr_hinfo_t const *) ; +extern size_t s6dns_fmt_hinfo (char *, size_t, s6dns_message_rr_hinfo_t const *) ; #define S6DNS_FMT_MX (S6DNS_FMT_DOMAIN + UINT16_FMT) -extern unsigned int s6dns_fmt_mx (char *, unsigned int, s6dns_message_rr_mx_t const *) ; +extern size_t s6dns_fmt_mx (char *, size_t, s6dns_message_rr_mx_t const *) ; #define S6DNS_FMT_SOA (S6DNS_FMT_DOMAIN * 2 + 5 * UINT32_FMT) -extern unsigned int s6dns_fmt_soa (char *, unsigned int, s6dns_message_rr_soa_t const *) ; +extern size_t s6dns_fmt_soa (char *, size_t, s6dns_message_rr_soa_t const *) ; #define S6DNS_FMT_SRV (S6DNS_FMT_DOMAIN + 3 * UINT16_FMT) -extern unsigned int s6dns_fmt_srv (char *, unsigned int, s6dns_message_rr_srv_t const *) ; +extern size_t s6dns_fmt_srv (char *, size_t, s6dns_message_rr_srv_t const *) ; #endif diff --git a/src/include/s6-dns/s6dns-message.h b/src/include/s6-dns/s6dns-message.h index d26106b..cc3e68e 100644 --- a/src/include/s6-dns/s6dns-message.h +++ b/src/include/s6-dns/s6dns-message.h @@ -3,8 +3,7 @@ #ifndef S6DNS_MESSAGE_H #define S6DNS_MESSAGE_H -#include -#include +#include #include #include #include @@ -15,10 +14,10 @@ typedef struct s6dns_message_counts_s s6dns_message_counts_t, *s6dns_message_counts_t_ref ; struct s6dns_message_counts_s { - uint16 qd ; - uint16 an ; - uint16 ns ; - uint16 nr ; + uint16_t qd ; + uint16_t an ; + uint16_t ns ; + uint16_t nr ; } ; #define S6DNS_MESSAGE_COUNTS_ZERO { .qd = 0, .an = 0, .ns = 0, .nr = 0 } @@ -31,7 +30,7 @@ extern unsigned int s6dns_message_counts_next (s6dns_message_counts_t *) ; typedef struct s6dns_message_header_s s6dns_message_header_t, *s6dns_message_header_t_ref ; struct s6dns_message_header_s { - uint16 id ; + uint16_t id ; unsigned int qr : 1 ; unsigned int opcode : 4 ; unsigned int aa : 1 ; @@ -79,7 +78,7 @@ extern int s6dns_message_get_hinfo (s6dns_message_rr_hinfo_t *, char const *, un typedef struct s6dns_message_rr_mx_s s6dns_message_rr_mx_t, *s6dns_message_rr_mx_t_ref ; struct s6dns_message_rr_mx_s { - uint16 preference ; + uint16_t preference ; s6dns_domain_t exchange ; } ; @@ -90,11 +89,11 @@ struct s6dns_message_rr_soa_s { s6dns_domain_t mname ; s6dns_domain_t rname ; - uint32 serial ; - uint32 refresh ; - uint32 retry ; - uint32 expire ; - uint32 minimum ; + uint32_t serial ; + uint32_t refresh ; + uint32_t retry ; + uint32_t expire ; + uint32_t minimum ; } ; extern int s6dns_message_get_soa (s6dns_message_rr_soa_t *, char const *, unsigned int, unsigned int *) ; @@ -102,9 +101,9 @@ extern int s6dns_message_get_soa (s6dns_message_rr_soa_t *, char const *, unsign typedef struct s6dns_message_rr_srv_s s6dns_message_rr_srv_t, *s6dns_message_rr_srv_t_ref ; struct s6dns_message_rr_srv_s { - uint16 priority ; - uint16 weight ; - uint16 port ; + uint16_t priority ; + uint16_t weight ; + uint16_t port ; s6dns_domain_t target ; } ; @@ -117,10 +116,10 @@ typedef struct s6dns_message_rr_s s6dns_message_rr_t, *s6dns_message_rr_t_ref ; struct s6dns_message_rr_s { s6dns_domain_t name ; - uint16 rtype ; - uint16 rclass ; - uint32 ttl ; - uint16 rdlength ; + uint16_t rtype ; + uint16_t rclass ; + uint32_t ttl ; + uint16_t rdlength ; } ; typedef int s6dns_message_rr_func_t (s6dns_message_rr_t const *, char const *, unsigned int, unsigned int, unsigned int, void *) ; @@ -133,8 +132,8 @@ typedef struct s6dns_mpag_s s6dns_mpag_t, *s6dns_mpag_t_ref ; struct s6dns_mpag_s { stralloc sa ; - genalloc offsets ; /* array of unsigned int */ - uint16 rtype ; + genalloc offsets ; /* array of size_t */ + uint16_t rtype ; } ; #define S6DNS_MPAG_ZERO { .sa = STRALLOC_ZERO, .offsets = GENALLOC_ZERO, .rtype = 0 } @@ -145,7 +144,7 @@ typedef struct s6dns_dpag_s s6dns_dpag_t, *s6dns_dpag_t_ref ; struct s6dns_dpag_s { genalloc ds ; /* array of s6dns_domain_t */ - uint16 rtype ; + uint16_t rtype ; } ; #define S6DNS_DPAG_ZERO { .ds = GENALLOC_ZERO, .rtype = 0 } diff --git a/src/include/s6-dns/s6dns-rci.h b/src/include/s6-dns/s6dns-rci.h index 326e029..bad364c 100644 --- a/src/include/s6-dns/s6dns-rci.h +++ b/src/include/s6-dns/s6dns-rci.h @@ -21,8 +21,8 @@ struct s6dns_rci_s extern s6dns_rci_t const s6dns_rci_zero ; extern s6dns_rci_t s6dns_rci_here ; -extern int s6dns_rci_init (s6dns_rci_t_ref, char const *) ; -extern void s6dns_rci_free (s6dns_rci_t_ref) ; +extern int s6dns_rci_init (s6dns_rci_t *, char const *) ; +extern void s6dns_rci_free (s6dns_rci_t *) ; #define s6dns_qualify(list, d) s6dns_domain_qualify(list, (d), s6dns_rci_here.rules.s, s6dns_rci_here.rulesnum) diff --git a/src/include/s6-dns/s6dns-resolve.h b/src/include/s6-dns/s6dns-resolve.h index 805ea2a..4ee566a 100644 --- a/src/include/s6-dns/s6dns-resolve.h +++ b/src/include/s6-dns/s6dns-resolve.h @@ -3,9 +3,8 @@ #ifndef S6DNS_RESOLVE_H #define S6DNS_RESOLVE_H +#include #include -#include -#include #include #include #include @@ -46,7 +45,7 @@ #define s6dns_resolve_core(d, qtype, deadline, stamp) s6dns_resolve_core_r(d, qtype, &s6dns_engine_here, &s6dns_rci_here.servers, &s6dns_debughook_zero, deadline, stamp) #define s6dns_resolve_core_g(d, qtype, deadline) s6dns_resolve_core(d, qtype, (deadline), &STAMP) -extern int s6dns_resolve_core_r (s6dns_domain_t const *, uint16, s6dns_engine_t_ref, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; +extern int s6dns_resolve_core_r (s6dns_domain_t const *, uint16_t, s6dns_engine_t *, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; #define s6dns_resolve_core_r_g(d, qtype, dt, servers, dbh, deadline) s6dns_resolve_core_r(d, qtype, dt, servers, dbh, (deadline), &STAMP) @@ -59,7 +58,7 @@ extern int s6dns_resolve_core_r (s6dns_domain_t const *, uint16, s6dns_engine_t_ #define s6dns_resolve_parse(d, qtype, parsefunc, parsedata, deadline, stamp) s6dns_resolve_parse_r(d, qtype, parsefunc, parsedata, &s6dns_engine_here, &s6dns_rci_here.servers, &s6dns_debughook_zero, deadline, stamp) #define s6dns_resolve_parse_g(d, qtype, parsefunc, parsedata, deadline) s6dns_resolve_parse(d, qtype, parsefunc, parsedata, (deadline), &STAMP) -extern int s6dns_resolve_parse_r (s6dns_domain_t const *, uint16, s6dns_message_rr_func_t_ref, void *, s6dns_engine_t_ref, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; +extern int s6dns_resolve_parse_r (s6dns_domain_t const *, uint16_t, s6dns_message_rr_func_t_ref, void *, s6dns_engine_t *, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; #define s6dns_resolve_parse_r_g(d, qtype, parsefunc, parsedata, dt, servers, dbh, deadline) s6dns_resolve_parse_r(d, qtype, parsefunc, parsedata, dt, servers, dbh, (deadline), &STAMP) @@ -69,7 +68,7 @@ extern int s6dns_resolve_parse_r (s6dns_domain_t const *, uint16, s6dns_message_ #define s6dns_resolvenoq(name, len, qtype, parsefunc, parsedata, deadline, stamp) s6dns_resolvenoq_r(name, len, qtype, parsefunc, parsedata, &s6dns_engine_here, &s6dns_rci_here.servers, &s6dns_debughook_zero, deadline, stamp) #define s6dns_resolvenoq_g(name, len, qtype, parsefunc, parsedata, deadline) s6dns_resolvenoq(name, len, qtype, parsefunc, parsedata, (deadline), &STAMP) -extern int s6dns_resolvenoq_r (char const *, unsigned int, uint16, s6dns_message_rr_func_t_ref, void *, s6dns_engine_t_ref, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; +extern int s6dns_resolvenoq_r (char const *, unsigned int, uint16_t, s6dns_message_rr_func_t_ref, void *, s6dns_engine_t *, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; #define s6dns_resolvenoq_r_g(name, len, qtype, parsefunc, parsedata, dt, servers, dbh, deadline) s6dns_resolvenoq_r(name, len, qtype, parsefunc, parsedata, dt, servers, dbh, (deadline), &STAMP) @@ -80,7 +79,7 @@ extern int s6dns_resolvenoq_r (char const *, unsigned int, uint16, s6dns_message #define s6dns_resolveq(name, len, qtype, parsefunc, parsedata, deadline, stamp) s6dns_resolveq_r(name, len, qtype, parsefunc, parsedata, &s6dns_rci_here, &s6dns_debughook_zero, deadline, stamp) #define s6dns_resolveq_g(name, len, qtype, parsefunc, parsedata, deadline) s6dns_resolveq(name, len, qtype, parsefunc, parsedata, (deadline), &STAMP) -extern int s6dns_resolveq_r (char const *, unsigned int, uint16, s6dns_message_rr_func_t_ref, void *, s6dns_rci_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; +extern int s6dns_resolveq_r (char const *, unsigned int, uint16_t, s6dns_message_rr_func_t_ref, void *, s6dns_rci_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; #define s6dns_resolveq_r_g(name, len, qtype, parsefunc, parsedata, rci, dbh, deadline) s6dns_resolveq_r(name, len, qtype, parsefunc, parsedata, rci, dbh, (deadline), &STAMP) @@ -146,12 +145,12 @@ extern int s6dns_resolveq_aaaaa_r(genalloc *, char const *, unsigned int, s6dns_ #define s6dns_resolve_name4(ds, ip, deadline, stamp) s6dns_resolve_name4_r(ds, ip, &s6dns_engine_here, &s6dns_rci_here.servers, &s6dns_debughook_zero, deadline, stamp) #define s6dns_resolve_name4_g(ds, ip, deadline) s6dns_resolve_name4(ds, ip, (deadline), &STAMP) -extern int s6dns_resolve_name4_r (genalloc *, char const *, s6dns_engine_t_ref, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; +extern int s6dns_resolve_name4_r (genalloc *, char const *, s6dns_engine_t *, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; #define s6dns_resolve_name4_r_g(ds, ip, dt, servers, dbh, deadline) s6dns_resolve_name4_r(ds, ip, dt, servers, dbh, (deadline), &STAMP) #define s6dns_resolve_name6(ds, ip6, deadline, stamp) s6dns_resolve_name6_r(ds, ip6, &s6dns_engine_here, &s6dns_rci_here.servers, &s6dns_debughook_zero, deadline, stamp) #define s6dns_resolve_name6_g(ds, ip6, deadline) s6dns_resolve_name6(ds, ip6, (deadline), &STAMP) -extern int s6dns_resolve_name6_r (genalloc *, char const *, s6dns_engine_t_ref, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; +extern int s6dns_resolve_name6_r (genalloc *, char const *, s6dns_engine_t *, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; #define s6dns_resolve_name6_r_g(ds, ip6, dt, servers, dbh, deadline) s6dns_resolve_name6_r(ds, ip6, dt, servers, dbh, (deadline), &STAMP) #define s6dns_resolve_name46(ds, i, deadline, stamp) s6dns_resolve_name46_r(ds, i, &s6dns_engine_here, &s6dns_rci_here.servers, &s6dns_debughook_zero, deadline, stamp) @@ -202,12 +201,12 @@ extern int s6dns_resolve_name6_r (genalloc *, char const *, s6dns_engine_t_ref, #define s6dns_resolve_dpag(ds, name, len, qtype, qualif, deadline, stamp) s6dns_resolve_dpag_r(ds, name, len, qtype, qualif, &s6dns_engine_here, &s6dns_rci_here, &s6dns_debughook_zero, deadline, stamp) #define s6dns_resolve_dpag_g(ds, name, len, qtype, qualif, deadline) s6dns_resolve_dpag(ds, name, len, qtype, qualif, (deadline), &STAMP) -extern int s6dns_resolve_dpag_r (genalloc *, char const *, unsigned int, uint16, int, s6dns_engine_t_ref, s6dns_rci_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; +extern int s6dns_resolve_dpag_r (genalloc *, char const *, unsigned int, uint16_t, int, s6dns_engine_t *, s6dns_rci_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; #define s6dns_resolve_dpag_r_g(ds, name, len, qtype, qualif, dt, rci, dbh, deadline) s6dns_resolve_dpag_r(ds, name, len, qtype, qualif, dt, rci, dbh, (deadline), &STAMP) #define s6dns_resolve_mpag(sa, offsets, name, len, qtype, parsefunc, qualif, deadline, stamp) s6dns_resolve_mpag_r(sa, offsets, name, len, qtype, parsefunc, qualif, &s6dns_engine_here, &s6dns_rci_here, &s6dns_debughook_zero, deadline, stamp) #define s6dns_resolve_mpag_g(sa, offsets, name, len, qtype, parsefunc, qualif, deadline) s6dns_resolve_mpag(sa, offsets, name, len, qtype, parsefunc, qualif, (deadline), &STAMP) -extern int s6dns_resolve_mpag_r (stralloc *, genalloc *, char const *, unsigned int, uint16, s6dns_message_rr_func_t_ref, int, s6dns_engine_t_ref, s6dns_rci_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; +extern int s6dns_resolve_mpag_r (stralloc *, genalloc *, char const *, unsigned int, uint16_t, s6dns_message_rr_func_t_ref, int, s6dns_engine_t *, s6dns_rci_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; #define s6dns_resolve_mpag_r_g(sa, offsets, name, len, qtype, parsefunc, qualif, dt, rci, dbh, deadline) s6dns_resolve_mpag_r(sa, offsets, name, len, qtype, parsefunc, qualif, dt, rci, dbh, (deadline), &STAMP) @@ -219,7 +218,7 @@ extern int s6dns_resolve_mpag_r (stralloc *, genalloc *, char const *, unsigned asynchronous resolution, use the skadns library. */ -extern int s6dns_resolven_loop (s6dns_engine_t_ref, unsigned int, unsigned int, tain_t const *, tain_t *) ; +extern int s6dns_resolven_loop (s6dns_engine_t *, unsigned int, unsigned int, tain_t const *, tain_t *) ; #define s6dns_resolven_loop_g(list, n, zor, deadline) s6dns_resolven(list, n, zor, (deadline), &STAMP) typedef struct s6dns_resolve_s s6dns_resolve_t, *s6dns_resolve_t_ref ; @@ -229,14 +228,14 @@ struct s6dns_resolve_s tain_t deadline ; s6dns_message_rr_func_t_ref parsefunc ; void *data ; - uint32 options ; + uint32_t options ; int status ; - uint16 qtype ; + uint16_t qtype ; } ; #define s6dns_resolven_parse(list, n, deadline, stamp) s6dns_resolven_parse_r(list, n, &s6dns_rci_here.servers, &s6dns_debughook_zero, deadline, stamp) #define s6dns_resolven_parse_g(list, n, deadline) s6dns_resolven_parse(list, n, (deadline), &STAMP) -extern int s6dns_resolven_parse_r (s6dns_resolve_t_ref, unsigned int, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; +extern int s6dns_resolven_parse_r (s6dns_resolve_t *, unsigned int, s6dns_ip46list_t const *, s6dns_debughook_t const *, tain_t const *, tain_t *) ; #define s6dns_resolven_parse_r_g(list, n, servers, dbh, deadline) s6dns_resolven_parse_r(list, n, servers, dbh, (deadline), &STAMP) #endif diff --git a/src/include/s6-dns/skadns.h b/src/include/s6-dns/skadns.h index b58363a..04803ea 100644 --- a/src/include/s6-dns/skadns.h +++ b/src/include/s6-dns/skadns.h @@ -3,8 +3,8 @@ #ifndef SKADNS_H #define SKADNS_H +#include #include -#include #include #include #include @@ -32,7 +32,7 @@ typedef struct skadns_s skadns_t, *skadns_t_ref ; struct skadns_s { skaclient_t connection ; - genalloc list ; /* array of uint16 */ + genalloc list ; /* array of uint16_t */ gensetdyn q ; /* set of skadnsanswer_t */ skaclient_buffer_t buffers ; } ; @@ -51,9 +51,9 @@ extern void skadns_end (skadns_t *) ; /* Synchronous functions */ -extern int skadns_send (skadns_t *, uint16 *, s6dns_domain_t const *, uint16, tain_t const *, tain_t const *, tain_t *) ; +extern int skadns_send (skadns_t *, uint16_t *, s6dns_domain_t const *, uint16_t, tain_t const *, tain_t const *, tain_t *) ; #define skadns_send_g(a, id, d, qtype, limit, deadline) skadns_send(a, id, d, qtype, limit, (deadline), &STAMP) -extern int skadns_cancel (skadns_t *, uint16, tain_t const *, tain_t *) ; +extern int skadns_cancel (skadns_t *, uint16_t, tain_t const *, tain_t *) ; #define skadns_cancel_g(a, id, deadline) skadns_cancel(a, id, (deadline), &STAMP) @@ -61,10 +61,10 @@ extern int skadns_cancel (skadns_t *, uint16, tain_t const *, tain_t *) ; #define skadns_fd(a) skaclient_fd(&(a)->connection) extern int skadns_update (skadns_t *) ; -#define skadns_list(a) genalloc_s(uint16 const, &(a)->list) +#define skadns_list(a) genalloc_s(uint16_t const, &(a)->list) #define skadns_clearlist(a) ((a)->list.len = 0) -extern int skadns_packetlen (skadns_t const *, uint16) ; -extern char const *skadns_packet (skadns_t const *, uint16) ; +extern int skadns_packetlen (skadns_t const *, uint16_t) ; +extern char const *skadns_packet (skadns_t const *, uint16_t) ; extern int skadns_release (skadns_t *, uint16) ; #endif diff --git a/src/libs6dns/s6dns-message-internal.h b/src/libs6dns/s6dns-message-internal.h index e0d10d6..9b63bcf 100644 --- a/src/libs6dns/s6dns-message-internal.h +++ b/src/libs6dns/s6dns-message-internal.h @@ -3,10 +3,11 @@ #ifndef S6DNS_MESSAGE_INTERNAL_H #define S6DNS_MESSAGE_INTERNAL_H +#include /* Low-level packet parsing */ -extern int s6dns_message_get_string_internal (char *, unsigned int, char const *, unsigned int, unsigned int *) ; -extern unsigned int s6dns_message_get_domain_internal (char *, unsigned int, char const *, unsigned int, unsigned int *) ; +extern int s6dns_message_get_string_internal (char *, size_t, char const *, unsigned int, unsigned int *) ; +extern size_t s6dns_message_get_domain_internal (char *, size_t, char const *, unsigned int, unsigned int *) ; #endif diff --git a/src/libs6dns/s6dns_analyze_packet.c b/src/libs6dns/s6dns_analyze_packet.c index 8932ab3..11c14e6 100644 --- a/src/libs6dns/s6dns_analyze_packet.c +++ b/src/libs6dns/s6dns_analyze_packet.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -84,7 +85,7 @@ int s6dns_analyze_packet (genwrite_t *gp, char const *packet, unsigned int packe s6dns_domain_t d ; char buf[257] ; unsigned int len ; - uint16 qtype ; + uint16_t qtype ; uint16 qclass ; section = s6dns_message_counts_next(&counts) ; if (section != 1) break ; diff --git a/src/libs6dns/s6dns_analyze_qtype_parse.c b/src/libs6dns/s6dns_analyze_qtype_parse.c index 8c04137..383dcde 100644 --- a/src/libs6dns/s6dns_analyze_qtype_parse.c +++ b/src/libs6dns/s6dns_analyze_qtype_parse.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -9,7 +10,7 @@ typedef struct lookuptable_s lookuptable_t, *lookuptable_t_ref ; struct lookuptable_s { char const *text ; - uint16 qtype ; + uint16_t qtype ; } ; static lookuptable_t const table[] = @@ -32,10 +33,10 @@ static lookuptable_t const table[] = { 0, 0 } } ; -uint16 s6dns_analyze_qtype_parse (char const *s) +uint16_t s6dns_analyze_qtype_parse (char const *s) { { - uint16 u ; + uint16_t u ; if (uint160_scan(s, &u)) return u ; } { diff --git a/src/libs6dns/s6dns_analyze_record.c b/src/libs6dns/s6dns_analyze_record.c index dd2e7d2..ecc5c26 100644 --- a/src/libs6dns/s6dns_analyze_record.c +++ b/src/libs6dns/s6dns_analyze_record.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -8,7 +9,7 @@ #include #include -static s6dns_analyze_rtypetable_t const *rtypelookup (uint16 rtype) +static s6dns_analyze_rtypetable_t const *rtypelookup (uint16_t rtype) { register s6dns_analyze_rtypetable_t const *wut = s6dns_analyze_rtypetable ; while (wut->rtype && wut->rtype != rtype) wut++ ; diff --git a/src/libs6dns/s6dns_analyze_record_domain.c b/src/libs6dns/s6dns_analyze_record_domain.c index f645dca..9a4b209 100644 --- a/src/libs6dns/s6dns_analyze_record_domain.c +++ b/src/libs6dns/s6dns_analyze_record_domain.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -11,9 +12,9 @@ int s6dns_analyze_record_domain (genwrite_t *gp, s6dns_message_rr_t const *rr, char const *packet, unsigned int packetlen, unsigned int start) { s6dns_domain_t d ; - char buf[S6DNS_FMT_DOMAIN] ; + size_t len ; unsigned int pos = start ; - register unsigned int len ; + char buf[S6DNS_FMT_DOMAIN] ; if (!s6dns_message_get_domain(&d, packet, packetlen, &pos)) return 0 ; if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ; len = s6dns_fmt_domain(buf, 256, &d) ; diff --git a/src/libs6dns/s6dns_analyze_record_hinfo.c b/src/libs6dns/s6dns_analyze_record_hinfo.c index 38d13d9..b294a06 100644 --- a/src/libs6dns/s6dns_analyze_record_hinfo.c +++ b/src/libs6dns/s6dns_analyze_record_hinfo.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -10,9 +11,9 @@ int s6dns_analyze_record_hinfo (genwrite_t *gp, s6dns_message_rr_t const *rr, char const *packet, unsigned int packetlen, unsigned int start) { s6dns_message_rr_hinfo_t hinfo ; - char buf[S6DNS_FMT_HINFO] ; + size_t len ; unsigned int pos = start ; - unsigned int len ; + char buf[S6DNS_FMT_HINFO] ; if (!s6dns_message_get_hinfo(&hinfo, packet, packetlen, &pos)) return 0 ; if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ; len = s6dns_fmt_hinfo(buf, S6DNS_FMT_HINFO, &hinfo) ; diff --git a/src/libs6dns/s6dns_analyze_record_mx.c b/src/libs6dns/s6dns_analyze_record_mx.c index adf9995..442ef2d 100644 --- a/src/libs6dns/s6dns_analyze_record_mx.c +++ b/src/libs6dns/s6dns_analyze_record_mx.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -10,9 +11,9 @@ int s6dns_analyze_record_mx (genwrite_t *gp, s6dns_message_rr_t const *rr, char const *packet, unsigned int packetlen, unsigned int start) { s6dns_message_rr_mx_t mx ; - char buf[S6DNS_FMT_MX] ; + size_t len ; unsigned int pos = start ; - unsigned int len ; + char buf[S6DNS_FMT_MX] ; if (!s6dns_message_get_mx(&mx, packet, packetlen, &pos)) return 0 ; if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ; len = s6dns_fmt_mx(buf, S6DNS_FMT_MX, &mx) ; diff --git a/src/libs6dns/s6dns_analyze_record_soa.c b/src/libs6dns/s6dns_analyze_record_soa.c index 68fc55f..fa4dc3a 100644 --- a/src/libs6dns/s6dns_analyze_record_soa.c +++ b/src/libs6dns/s6dns_analyze_record_soa.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -10,9 +11,9 @@ int s6dns_analyze_record_soa (genwrite_t *gp, s6dns_message_rr_t const *rr, char const *packet, unsigned int packetlen, unsigned int start) { s6dns_message_rr_soa_t soa ; - char buf[S6DNS_FMT_SOA] ; + size_t len ; unsigned int pos = start ; - unsigned int len ; + char buf[S6DNS_FMT_SOA] ; if (!s6dns_message_get_soa(&soa, packet, packetlen, &pos)) return 0 ; if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ; len = s6dns_fmt_soa(buf, S6DNS_FMT_SOA, &soa) ; diff --git a/src/libs6dns/s6dns_analyze_record_srv.c b/src/libs6dns/s6dns_analyze_record_srv.c index 9ce5b6e..a0f8c6a 100644 --- a/src/libs6dns/s6dns_analyze_record_srv.c +++ b/src/libs6dns/s6dns_analyze_record_srv.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -10,9 +11,9 @@ int s6dns_analyze_record_srv (genwrite_t *gp, s6dns_message_rr_t const *rr, char const *packet, unsigned int packetlen, unsigned int start) { s6dns_message_rr_srv_t srv ; - char buf[S6DNS_FMT_SRV] ; + size_t len ; unsigned int pos = start ; - unsigned int len ; + char buf[S6DNS_FMT_SRV] ; if (!s6dns_message_get_srv(&srv, packet, packetlen, &pos)) return 0 ; if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ; len = s6dns_fmt_srv(buf, S6DNS_FMT_SRV, &srv) ; diff --git a/src/libs6dns/s6dns_analyze_record_unknown.c b/src/libs6dns/s6dns_analyze_record_unknown.c index b5e458e..07b2941 100644 --- a/src/libs6dns/s6dns_analyze_record_unknown.c +++ b/src/libs6dns/s6dns_analyze_record_unknown.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -15,7 +16,7 @@ int s6dns_analyze_record_unknown (genwrite_t *gp, s6dns_message_rr_t const *rr, if ((*gp->put)(gp->target, fmt, uint16_fmt(fmt, rr->rdlength)) < 0) return 0 ; if ((*gp->put)(gp->target, ": ", 2) < 0) return 0 ; { - register uint16 i = 0 ; + register uint16_t i = 0 ; for (; i < rr->rdlength ; i++) if ((*gp->put)(gp->target, fmt, ucharn_fmt(fmt, packet + pos + i, 1)) < 0) return 0 ; diff --git a/src/libs6dns/s6dns_debug_dumpdt_post_send.c b/src/libs6dns/s6dns_debug_dumpdt_post_send.c index e41d595..5e7b60c 100644 --- a/src/libs6dns/s6dns_debug_dumpdt_post_send.c +++ b/src/libs6dns/s6dns_debug_dumpdt_post_send.c @@ -1,5 +1,7 @@ /* ISC license */ +#include +#include #include #include #include @@ -9,22 +11,22 @@ int s6dns_debug_dumpdt_post_send (s6dns_engine_t const *dt, void *data) { genwrite_t *gp = data ; + size_t len ; char buf[LOCALTMN_FMT] ; - unsigned int len ; if ((*gp->put)(gp->target, "Sent query ", 11) < 11) return 0 ; { - uint16 id ; + uint16_t id ; uint16_unpack_big(dt->sa.s + 2, &id) ; len = uint16_fmt(buf, id) ; } - if ((*gp->put)(gp->target, buf, len) < (int)len) return 0 ; + if ((*gp->put)(gp->target, buf, len) < (ssize_t)len) return 0 ; if ((*gp->put)(gp->target, " - next recv deadline is ", 25) < 25) return 0 ; { localtmn_t l ; if (!localtmn_from_tain(&l, &dt->localdeadline, 0)) return 0 ; len = localtmn_fmt(buf, &l) ; } - if ((*gp->put)(gp->target, buf, len) < (int)len) return 0 ; + if ((*gp->put)(gp->target, buf, len) < (ssize_t)len) return 0 ; if ((*gp->put)(gp->target, "\n\n", 2) < 2) return 0 ; return (*gp->flush)(gp->target) ; } diff --git a/src/libs6dns/s6dns_debug_dumpdt_pre_send.c b/src/libs6dns/s6dns_debug_dumpdt_pre_send.c index 998eff8..1cd6e6e 100644 --- a/src/libs6dns/s6dns_debug_dumpdt_pre_send.c +++ b/src/libs6dns/s6dns_debug_dumpdt_pre_send.c @@ -5,6 +5,8 @@ #define _BSD_SOURCE #endif +#include +#include #include #include #include @@ -27,8 +29,8 @@ int s6dns_debug_dumpdt_pre_send (s6dns_engine_t const *dt, void *data) { genwrite_t *gp = data ; + size_t len ; char buf[LOCALTMN_FMT] ; - unsigned int len ; if ((*gp->put)(gp->target, "Preparing to send via ", 22) < 22) return 0 ; if ((*gp->put)(gp->target, dt->flagtcp ? "TCP" : "UDP", 3) < 3) return 0 ; if ((*gp->put)(gp->target, " to ", 4) < 4) return 0 ; @@ -52,7 +54,7 @@ int s6dns_debug_dumpdt_pre_send (s6dns_engine_t const *dt, void *data) if (dt->flagstrict && (*gp->put)(gp->target, "strict, ", 8) < 8) return 0 ; if ((*gp->put)(gp->target, "query id ", 9) < 9) return 0 ; { - uint16 id ; + uint16_t id ; uint16_unpack_big(dt->sa.s + 2, &id) ; len = uint16_fmt(buf, id) ; } diff --git a/src/libs6dns/s6dns_domain_fromstring.c b/src/libs6dns/s6dns_domain_fromstring.c index 9346e24..92f3117 100644 --- a/src/libs6dns/s6dns_domain_fromstring.c +++ b/src/libs6dns/s6dns_domain_fromstring.c @@ -1,14 +1,15 @@ /* ISC license. */ +#include #include #include #include -int s6dns_domain_fromstring (s6dns_domain_t *d, char const *s, unsigned int len) +int s6dns_domain_fromstring (s6dns_domain_t *d, char const *s, size_t len) { - register unsigned int j = 1 ; - register unsigned int i = 0 ; - register unsigned int lastdot = 0 ; + register size_t j = 1 ; + register size_t i = 0 ; + unsigned int lastdot = 0 ; d->s[0] = '.' ; for (; i < len ; i++) { diff --git a/src/libs6dns/s6dns_domain_fromstring_noqualify_encode.c b/src/libs6dns/s6dns_domain_fromstring_noqualify_encode.c index a12f979..eb5b55a 100644 --- a/src/libs6dns/s6dns_domain_fromstring_noqualify_encode.c +++ b/src/libs6dns/s6dns_domain_fromstring_noqualify_encode.c @@ -1,8 +1,9 @@ /* ISC license. */ +#include #include -int s6dns_domain_fromstring_noqualify_encode (s6dns_domain_t *d, char const *name, unsigned int len) +int s6dns_domain_fromstring_noqualify_encode (s6dns_domain_t *d, char const *name, size_t len) { return s6dns_domain_fromstring(d, name, len) && s6dns_domain_noqualify(d) diff --git a/src/libs6dns/s6dns_domain_fromstring_qualify_encode.c b/src/libs6dns/s6dns_domain_fromstring_qualify_encode.c index dbdea02..d57a521 100644 --- a/src/libs6dns/s6dns_domain_fromstring_qualify_encode.c +++ b/src/libs6dns/s6dns_domain_fromstring_qualify_encode.c @@ -2,7 +2,7 @@ #include -unsigned int s6dns_domain_fromstring_qualify_encode (s6dns_domain_t *list, char const *name, unsigned int len, char const *rules, unsigned int rulesnum) +unsigned int s6dns_domain_fromstring_qualify_encode (s6dns_domain_t *list, char const *name, size_t len, char const *rules, unsigned int rulesnum) { s6dns_domain_t d ; if (!s6dns_domain_fromstring(&d, name, len)) return 0 ; diff --git a/src/libs6dns/s6dns_domain_qualify.c b/src/libs6dns/s6dns_domain_qualify.c index 6194ab5..8f036be 100644 --- a/src/libs6dns/s6dns_domain_qualify.c +++ b/src/libs6dns/s6dns_domain_qualify.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -17,7 +18,7 @@ unsigned int s6dns_domain_qualify (s6dns_domain_t *list, s6dns_domain_t const *d register unsigned int i = 0 ; for (; i < rulesnum ; i++) { - unsigned int n = str_len(rules) ; + size_t n = str_len(rules) ; if (d->len + n >= 254) return (errno = ENAMETOOLONG, 0) ; list[i] = *d ; list[i].s[d->len] = '.' ; diff --git a/src/libs6dns/s6dns_domain_tostring.c b/src/libs6dns/s6dns_domain_tostring.c index ff72893..d5de7ae 100644 --- a/src/libs6dns/s6dns_domain_tostring.c +++ b/src/libs6dns/s6dns_domain_tostring.c @@ -1,10 +1,11 @@ /* ISC license. */ +#include #include #include #include -unsigned int s6dns_domain_tostring (char *s, unsigned int max, s6dns_domain_t const *d) +unsigned int s6dns_domain_tostring (char *s, size_t max, s6dns_domain_t const *d) { if ((unsigned int)d->len + 1 > max) return (errno = ENAMETOOLONG, 0) ; if (!d->len || (d->s[0] != '.')) return (errno = EINVAL, 0) ; diff --git a/src/libs6dns/s6dns_engine.c b/src/libs6dns/s6dns_engine.c index f903ea9..c991c16 100644 --- a/src/libs6dns/s6dns_engine.c +++ b/src/libs6dns/s6dns_engine.c @@ -1,8 +1,9 @@ /* ISC license. */ +#include +#include #include #include -#include #include #include #include @@ -21,7 +22,7 @@ /* Utility functions */ -static inline int qdomain_diff (char const *s1, unsigned int n1, char const *s2, unsigned int n2) +static inline int qdomain_diff (char const *s1, size_t n1, char const *s2, size_t n2) { return (n1 < n2) ? -1 : (n1 > n2) ? 1 : case_diffb(s1, n1, s2) ; } @@ -30,7 +31,7 @@ static int relevant (char const *q, unsigned int qlen, char const *ans, unsigned { { s6dns_message_header_t h ; - uint16 id ; + uint16_t id ; s6dns_message_header_unpack(ans, &h) ; if (!h.qr || h.opcode || h.z || (h.counts.qd != 1)) return 0 ; if (h.rd != (q[2] & 1)) return 0 ; @@ -208,7 +209,7 @@ static int s6dns_engine_read_udp (s6dns_engine_t *dt, tain_t const *stamp) { s6dns_message_header_t h ; char buf[513] ; - register int r = fd_recv(dt->fd, buf, 513, 0) ; + register ssize_t r = fd_recv(dt->fd, buf, 513, 0) ; if (r < 0) return (prepare_next(dt, stamp, 0), 0) ; if ((r > 512) || (r < 12)) return (errno = EAGAIN, 0) ; switch (relevant(dt->sa.s + 2, dt->querylen - 2, buf, r, dt->flagstrict)) @@ -255,7 +256,7 @@ static int s6dns_engine_read_udp (s6dns_engine_t *dt, tain_t const *stamp) static int s6dns_engine_read_tcp (s6dns_engine_t *dt, tain_t const *stamp) { - register int r = sanitize_read(mininetstring_read(dt->fd, &dt->sa, &dt->protostate)) ; + register ssize_t r = sanitize_read(mininetstring_read(dt->fd, &dt->sa, &dt->protostate)) ; if (r < 0) return (prepare_next(dt, stamp, 1), 0) ; else if (!r) return (errno = EAGAIN, 0) ; else if ((dt->sa.len - dt->querylen) < 12) @@ -351,7 +352,7 @@ int s6dns_engine_event (s6dns_engine_t *dt, tain_t const *stamp) return -1 ; } -int s6dns_engine_init_r (s6dns_engine_t *dt, s6dns_ip46list_t const *servers, uint32 options, char const *q, unsigned int qlen, uint16 qtype, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t const *stamp) +int s6dns_engine_init_r (s6dns_engine_t *dt, s6dns_ip46list_t const *servers, uint32_t options, char const *q, unsigned int qlen, uint16_t qtype, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t const *stamp) { s6dns_message_header_t h = S6DNS_MESSAGE_HEADER_ZERO ; if (!stralloc_ready(&dt->sa, qlen + 18)) return 0 ; diff --git a/src/libs6dns/s6dns_fmt_domainlist.c b/src/libs6dns/s6dns_fmt_domainlist.c index d53050a..625e149 100644 --- a/src/libs6dns/s6dns_fmt_domainlist.c +++ b/src/libs6dns/s6dns_fmt_domainlist.c @@ -1,13 +1,14 @@ /* ISC license. */ +#include #include #include #include #include -unsigned int s6dns_fmt_domainlist (char *s, unsigned int max, s6dns_domain_t const *list, unsigned int n, char const *delim, unsigned int delimlen) +size_t s6dns_fmt_domainlist (char *s, size_t max, s6dns_domain_t const *list, unsigned int n, char const *delim, size_t delimlen) { - unsigned int len = 0 ; + size_t len = 0 ; register unsigned int i = 0 ; for (; i < n ; i++) { diff --git a/src/libs6dns/s6dns_fmt_hinfo.c b/src/libs6dns/s6dns_fmt_hinfo.c index 8c1d7c4..2389926 100644 --- a/src/libs6dns/s6dns_fmt_hinfo.c +++ b/src/libs6dns/s6dns_fmt_hinfo.c @@ -1,13 +1,14 @@ /* ISC license. */ +#include #include #include #include #include -unsigned int s6dns_fmt_hinfo (char *s, unsigned int max, s6dns_message_rr_hinfo_t const *hinfo) +size_t s6dns_fmt_hinfo (char *s, size_t max, s6dns_message_rr_hinfo_t const *hinfo) { - if ((unsigned int)hinfo->cpu.len + 1 + (unsigned int)hinfo->os.len > max) return (errno = ENAMETOOLONG, 0) ; + if (hinfo->cpu.len + 1 + hinfo->os.len > max) return (errno = ENAMETOOLONG, 0) ; byte_copy(s, hinfo->cpu.len, hinfo->cpu.s) ; s[hinfo->cpu.len] = ' ' ; byte_copy(s + hinfo->cpu.len + 1, hinfo->os.len, hinfo->os.s) ; diff --git a/src/libs6dns/s6dns_fmt_mx.c b/src/libs6dns/s6dns_fmt_mx.c index aba538b..303c545 100644 --- a/src/libs6dns/s6dns_fmt_mx.c +++ b/src/libs6dns/s6dns_fmt_mx.c @@ -1,14 +1,15 @@ /* ISC license. */ +#include #include #include #include #include -unsigned int s6dns_fmt_mx (char *s, unsigned int max, s6dns_message_rr_mx_t const *mx) +size_t s6dns_fmt_mx (char *s, size_t max, s6dns_message_rr_mx_t const *mx) { char fmt[UINT16_FMT] ; - unsigned int len = uint16_fmt(fmt, mx->preference) ; + size_t len = uint16_fmt(fmt, mx->preference) ; unsigned int r ; if (len >= max) return 0 ; fmt[len++] = ' ' ; diff --git a/src/libs6dns/s6dns_fmt_soa.c b/src/libs6dns/s6dns_fmt_soa.c index e066c6a..b07ae14 100644 --- a/src/libs6dns/s6dns_fmt_soa.c +++ b/src/libs6dns/s6dns_fmt_soa.c @@ -1,16 +1,17 @@ /* ISC license. */ +#include #include #include #include #include #include -unsigned int s6dns_fmt_soa (char *s, unsigned int max, s6dns_message_rr_soa_t const *soa) +size_t s6dns_fmt_soa (char *s, size_t max, s6dns_message_rr_soa_t const *soa) { + size_t len = 0 ; char fmt[UINT32_FMT] ; - unsigned int len = 0 ; - register unsigned int r = s6dns_domain_tostring(s + len, max - len, &soa->mname) ; + register size_t r = s6dns_domain_tostring(s + len, max - len, &soa->mname) ; if (!r) return 0 ; len += r ; if (len >= max) return (errno = ENAMETOOLONG, 0) ; diff --git a/src/libs6dns/s6dns_fmt_srv.c b/src/libs6dns/s6dns_fmt_srv.c index ad0944b..33bfd49 100644 --- a/src/libs6dns/s6dns_fmt_srv.c +++ b/src/libs6dns/s6dns_fmt_srv.c @@ -1,16 +1,17 @@ /* ISC license. */ +#include #include #include #include #include #include -unsigned int s6dns_fmt_srv (char *s, unsigned int max, s6dns_message_rr_srv_t const *srv) +size_t s6dns_fmt_srv (char *s, size_t max, s6dns_message_rr_srv_t const *srv) { + size_t len = 0 ; char fmt[UINT16_FMT] ; - unsigned int len = 0 ; - register unsigned int r = uint16_fmt(fmt, srv->priority) ; + register size_t r = uint16_fmt(fmt, srv->priority) ; if (len + r >= max) return (errno = ENAMETOOLONG, 0) ; byte_copy(s + len, r, fmt) ; len += r ; s[len++] = ' ' ; diff --git a/src/libs6dns/s6dns_message_get_domain_internal.c b/src/libs6dns/s6dns_message_get_domain_internal.c index 357797d..64e71dc 100644 --- a/src/libs6dns/s6dns_message_get_domain_internal.c +++ b/src/libs6dns/s6dns_message_get_domain_internal.c @@ -1,13 +1,14 @@ /* ISC license. */ +#include #include #include #include #include "s6dns-message-internal.h" -unsigned int s6dns_message_get_domain_internal (char *out, unsigned int outmax, char const *s, unsigned int len, unsigned int *pos) +size_t s6dns_message_get_domain_internal (char *out, size_t outmax, char const *s, unsigned int len, unsigned int *pos) { - unsigned int w = 0 ; /* writing head */ + size_t w = 0 ; /* writing head */ unsigned int r = *pos ; /* reading head */ unsigned int jumps = 0 ; register int hasjumped = 0 ; diff --git a/src/libs6dns/s6dns_message_get_string_internal.c b/src/libs6dns/s6dns_message_get_string_internal.c index 4f6eb0c..7e4105b 100644 --- a/src/libs6dns/s6dns_message_get_string_internal.c +++ b/src/libs6dns/s6dns_message_get_string_internal.c @@ -1,11 +1,12 @@ /* ISC license. */ +#include #include #include #include #include "s6dns-message-internal.h" -int s6dns_message_get_string_internal (char *s, unsigned int max, char const *packet, unsigned int packetlen, unsigned int *pos) +int s6dns_message_get_string_internal (char *s, size_t max, char const *packet, unsigned int packetlen, unsigned int *pos) { register unsigned char len = ((unsigned char const *)packet)[*pos] ; if (*pos + len + 1 > packetlen) return (errno = EPROTO, -1) ; diff --git a/src/libs6dns/s6dns_message_parse_answer_strings.c b/src/libs6dns/s6dns_message_parse_answer_strings.c index 09470c7..f5ac783 100644 --- a/src/libs6dns/s6dns_message_parse_answer_strings.c +++ b/src/libs6dns/s6dns_message_parse_answer_strings.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -8,27 +9,25 @@ int s6dns_message_parse_answer_strings (s6dns_message_rr_t const *rr, char const *packet, unsigned int packetlen, unsigned int pos, unsigned int section, void *stuff) { - s6dns_mpag_t_ref data = stuff ; + s6dns_mpag_t *data = stuff ; if ((section == 2) && (rr->rtype == data->rtype)) { - unsigned int base = data->sa.len ; + size_t base = data->sa.len ; int wasnull = !data->sa.s ; unsigned int start = pos ; register int r ; if (!stralloc_readyplus(&data->sa, rr->rdlength + 1)) return -1 ; - errno = EPROTO ; r = s6dns_message_get_strings(data->sa.s + data->sa.len, rr->rdlength, packet, packetlen, &pos) ; if ((r < 0) || (rr->rdlength != pos - start)) { if (wasnull) stralloc_free(&data->sa) ; else data->sa.len = base ; - return 0 ; + return (errno = EPROTO, 0) ; } - if (!genalloc_append(unsigned int, &data->offsets, &data->sa.len)) + if (!genalloc_append(size_t, &data->offsets, &data->sa.len)) { if (wasnull) stralloc_free(&data->sa) ; else data->sa.len = base ; - return -1 ; + return (errno = EPROTO, -1) ; } - errno = 0 ; data->sa.len += r ; stralloc_0(&data->sa) ; } diff --git a/src/libs6dns/s6dns_rci_init.c b/src/libs6dns/s6dns_rci_init.c index a4f3fcf..e7d3676 100644 --- a/src/libs6dns/s6dns_rci_init.c +++ b/src/libs6dns/s6dns_rci_init.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -12,19 +13,19 @@ #include #include -static unsigned int readit (char const *file, char *buf, unsigned int max) +static size_t readit (char const *file, char *buf, size_t max) { - register int r = openreadnclose(file, buf, max - 1) ; + register ssize_t r = openreadnclose(file, buf, max - 1) ; if (r < 0) { if (errno != ENOENT) return 0 ; else r = 0 ; } buf[r++] = '\n' ; - return (unsigned int)r ; + return r ; } -static inline int s6dns_rci_init_servers (s6dns_rci_t *rci, char const *file, char *tmp, unsigned int max, unsigned int *size) +static inline int s6dns_rci_init_servers (s6dns_rci_t *rci, char const *file, char *tmp, size_t max, size_t *size) { ip46_t tmplist[S6DNS_MAX_SERVERS] ; unsigned int num = 0 ; @@ -32,15 +33,15 @@ static inline int s6dns_rci_init_servers (s6dns_rci_t *rci, char const *file, ch if (x) ip46_scanlist(tmplist, S6DNS_MAX_SERVERS, x, &num) ; if (!num) { - unsigned int i = 0 ; + size_t i = 0 ; *size = readit(file, tmp, max) ; if (!*size) return 0 ; while ((i < *size) && (num < S6DNS_MAX_SERVERS)) { - register unsigned int j = byte_chr(tmp + i, *size - i, '\n') ; + register size_t j = byte_chr(tmp + i, *size - i, '\n') ; if ((i + j < *size) && (j > 13U) && !byte_diff("nameserver", 10, tmp + i)) { - register unsigned int k = 0 ; + register size_t k = 0 ; while ((tmp[i+10+k] == ' ') || (tmp[i+10+k] == '\t')) k++ ; if (k && ip46_scan(tmp+i+10+k, tmplist + num)) num++ ; } @@ -72,10 +73,10 @@ static inline int s6dns_rci_init_servers (s6dns_rci_t *rci, char const *file, ch static inline int stringrules (stralloc *rules, char const *s, unsigned int *num) { + size_t base = rules->len ; + int wasnull = !rules->s ; unsigned int n = 0 ; int crunching = 1 ; - int wasnull = !rules->s ; - unsigned int base = rules->len ; char c = ' ' ; while (c) { @@ -105,7 +106,7 @@ static inline int stringrules (stralloc *rules, char const *s, unsigned int *num return 0 ; } -static inline int s6dns_rci_init_rules (s6dns_rci_t_ref rci, char const *file, char *tmp, unsigned int max, unsigned int *size) +static inline int s6dns_rci_init_rules (s6dns_rci_t_ref rci, char const *file, char *tmp, size_t max, size_t *size) { unsigned int num = 0 ; char const *x = env_get("DNSQUALIFY") ; @@ -115,7 +116,7 @@ static inline int s6dns_rci_init_rules (s6dns_rci_t_ref rci, char const *file, c } else { - unsigned int i = 0 ; + size_t i = 0 ; if (!*size) { *size = readit(file, tmp, max) ; @@ -123,12 +124,12 @@ static inline int s6dns_rci_init_rules (s6dns_rci_t_ref rci, char const *file, c } while (i < *size) { - register unsigned int j = byte_chr(tmp + i, *size - i, '\n') ; + size_t j = byte_chr(tmp + i, *size - i, '\n') ; if ((i + j < *size) && (j > 8U) && (!byte_diff("domain", 6, tmp + i) || !byte_diff("search", 6, tmp + i)) && ((tmp[i+6] == ' ') || (tmp[i+6] == '\t') || (tmp[i+6] == '\r'))) { - unsigned int k = 0 ; + size_t k = 0 ; int copying = 0 ; register int notsearching = (tmp[i] != 's') ; if (!stralloc_readyplus(&rci->rules, j)) return 0 ; @@ -166,7 +167,7 @@ static inline int s6dns_rci_init_rules (s6dns_rci_t_ref rci, char const *file, c int s6dns_rci_init (s6dns_rci_t *rci, char const *file) { char tmp[4096] ; - unsigned int size = 0 ; + size_t size = 0 ; if (!s6dns_rci_init_servers(rci, file, tmp, 4096, &size)) return 0 ; if (!s6dns_rci_init_rules(rci, file, tmp, 4096, &size)) return 0 ; return 1 ; diff --git a/src/libs6dns/s6dns_resolve_core.c b/src/libs6dns/s6dns_resolve_core.c index a3c51c1..c321869 100644 --- a/src/libs6dns/s6dns_resolve_core.c +++ b/src/libs6dns/s6dns_resolve_core.c @@ -1,7 +1,7 @@ /* ISC license. */ +#include #include -#include #include #include #include @@ -9,7 +9,7 @@ #include #include -int s6dns_resolve_core_r (s6dns_domain_t const *d, uint16 qtype, s6dns_engine_t *dt, s6dns_ip46list_t const *servers, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) +int s6dns_resolve_core_r (s6dns_domain_t const *d, uint16_t qtype, s6dns_engine_t *dt, s6dns_ip46list_t const *servers, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) { if (!s6dns_engine_init_r(dt, servers, S6DNS_O_RECURSIVE, d->s, d->len, qtype, dbh, deadline, stamp)) return 0 ; if (!s6dns_resolve_loop_r(dt, deadline, stamp)) diff --git a/src/libs6dns/s6dns_resolve_dpag.c b/src/libs6dns/s6dns_resolve_dpag.c index 7c735b8..0bc5a42 100644 --- a/src/libs6dns/s6dns_resolve_dpag.c +++ b/src/libs6dns/s6dns_resolve_dpag.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include +#include #include #include #include @@ -8,7 +8,7 @@ #include #include -int s6dns_resolve_dpag_r (genalloc *ds, char const *name, unsigned int len, uint16 qtype, int qualif, s6dns_engine_t *dt, s6dns_rci_t const *rci, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) +int s6dns_resolve_dpag_r (genalloc *ds, char const *name, unsigned int len, uint16_t qtype, int qualif, s6dns_engine_t *dt, s6dns_rci_t const *rci, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) { s6dns_dpag_t data ; register int r ; diff --git a/src/libs6dns/s6dns_resolve_mpag.c b/src/libs6dns/s6dns_resolve_mpag.c index a6e04cb..ca0ab1a 100644 --- a/src/libs6dns/s6dns_resolve_mpag.c +++ b/src/libs6dns/s6dns_resolve_mpag.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include +#include #include #include #include @@ -9,7 +9,7 @@ #include #include -int s6dns_resolve_mpag_r (stralloc *sa, genalloc *offsets, char const *name, unsigned int len, uint16 qtype, s6dns_message_rr_func_t_ref parsefunc, int qualif, s6dns_engine_t *dt, s6dns_rci_t const *rci, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) +int s6dns_resolve_mpag_r (stralloc *sa, genalloc *offsets, char const *name, unsigned int len, uint16_t qtype, s6dns_message_rr_func_t_ref parsefunc, int qualif, s6dns_engine_t *dt, s6dns_rci_t const *rci, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) { s6dns_mpag_t data ; register int r ; diff --git a/src/libs6dns/s6dns_resolve_parse.c b/src/libs6dns/s6dns_resolve_parse.c index b00804f..b2e4974 100644 --- a/src/libs6dns/s6dns_resolve_parse.c +++ b/src/libs6dns/s6dns_resolve_parse.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include +#include #include #include #include @@ -8,7 +8,7 @@ #include #include -int s6dns_resolve_parse_r (s6dns_domain_t const *d, uint16 qtype, s6dns_message_rr_func_t_ref parsefunc, void *data, s6dns_engine_t *dt, s6dns_ip46list_t const *servers, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) +int s6dns_resolve_parse_r (s6dns_domain_t const *d, uint16_t qtype, s6dns_message_rr_func_t_ref parsefunc, void *data, s6dns_engine_t *dt, s6dns_ip46list_t const *servers, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) { register int r ; if (!s6dns_resolve_core_r(d, qtype, dt, servers, dbh, deadline, stamp)) return -1 ; diff --git a/src/libs6dns/s6dns_resolvenoq.c b/src/libs6dns/s6dns_resolvenoq.c index 3462076..5269655 100644 --- a/src/libs6dns/s6dns_resolvenoq.c +++ b/src/libs6dns/s6dns_resolvenoq.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include +#include #include #include #include @@ -8,7 +8,7 @@ #include #include -int s6dns_resolvenoq_r (char const *name, unsigned int len, uint16 qtype, s6dns_message_rr_func_t_ref parsefunc, void *data, s6dns_engine_t *dt, s6dns_ip46list_t const *servers, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) +int s6dns_resolvenoq_r (char const *name, unsigned int len, uint16_t qtype, s6dns_message_rr_func_t_ref parsefunc, void *data, s6dns_engine_t *dt, s6dns_ip46list_t const *servers, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) { s6dns_domain_t d ; if (!s6dns_domain_fromstring_noqualify_encode(&d, name, len)) return -1 ; diff --git a/src/libs6dns/s6dns_resolvenoq_aaaaa.c b/src/libs6dns/s6dns_resolvenoq_aaaaa.c index b280fe0..d10b20b 100644 --- a/src/libs6dns/s6dns_resolvenoq_aaaaa.c +++ b/src/libs6dns/s6dns_resolvenoq_aaaaa.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -35,9 +36,9 @@ int s6dns_resolvenoq_aaaaa_r (genalloc *ips, char const *name, unsigned int len, return -1 ; } { - unsigned int n = genalloc_len(ip46_t, ips) ; int e = (!!sa[0].len << 1) | !!sa[1].len ; - register unsigned int i = 0 ; + size_t n = genalloc_len(ip46_t, ips) ; + register size_t i = 0 ; for (; i < (sa[0].len >> 4) ; i++) ip46_from_ip6(genalloc_s(ip46_t, ips) + n++, sa[0].s + (i << 4)) ; for (i = 0 ; i < (sa[1].len >> 2) ; i++) diff --git a/src/libs6dns/s6dns_resolveq.c b/src/libs6dns/s6dns_resolveq.c index c43db1f..7fad70f 100644 --- a/src/libs6dns/s6dns_resolveq.c +++ b/src/libs6dns/s6dns_resolveq.c @@ -1,7 +1,7 @@ /* ISC license. */ +#include #include -#include #include #include #include @@ -10,7 +10,7 @@ #include #include -int s6dns_resolveq_r (char const *name, unsigned int len, uint16 qtype, s6dns_message_rr_func_t_ref parsefunc, void *data, s6dns_rci_t const *rci, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) +int s6dns_resolveq_r (char const *name, unsigned int len, uint16_t qtype, s6dns_message_rr_func_t_ref parsefunc, void *data, s6dns_rci_t const *rci, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) { s6dns_engine_t dtl[rci->rulesnum] ; unsigned int best = 0 ; diff --git a/src/libs6dns/s6dns_resolveq_aaaaa.c b/src/libs6dns/s6dns_resolveq_aaaaa.c index 825e68e..cbc853f 100644 --- a/src/libs6dns/s6dns_resolveq_aaaaa.c +++ b/src/libs6dns/s6dns_resolveq_aaaaa.c @@ -1,7 +1,7 @@ /* ISC license. */ +#include #include -#include #include #include #include @@ -75,9 +75,9 @@ int s6dns_resolveq_aaaaa_r (genalloc *ips, char const *name, unsigned int len, s found: s6dns_engine_freen(dtl, n<<1) ; { - register unsigned int len = data.len >> ((best & 1) ? 2 : 4) ; - register unsigned int i = 0 ; - register unsigned int base = genalloc_len(ip46_t, ips) ; + register size_t len = data.len >> ((best & 1) ? 2 : 4) ; + register size_t i = 0 ; + register size_t base = genalloc_len(ip46_t, ips) ; if (!genalloc_readyplus(ip46_t, ips, len)) return -1 ; for (; i < len ; i++) ip46_from_ip(genalloc_s(ip46_t, ips) + base + i, data.s + (i << ((best & 1) ? 2 : 4)), !(best & 1)) ; diff --git a/src/skadns/skadns_cancel.c b/src/skadns/skadns_cancel.c index 7c76797..a9673ed 100644 --- a/src/skadns/skadns_cancel.c +++ b/src/skadns/skadns_cancel.c @@ -5,6 +5,7 @@ #define _BSD_SOURCE #endif +#include #include #include #include @@ -13,7 +14,7 @@ #include #include -int skadns_cancel (skadns_t *a, uint16 id, tain_t const *deadline, tain_t *stamp) +int skadns_cancel (skadns_t *a, uint16_t id, tain_t const *deadline, tain_t *stamp) { char pack[3] = "--q" ; char err ; diff --git a/src/skadns/skadns_end.c b/src/skadns/skadns_end.c index 6f5f01b..e6e8045 100644 --- a/src/skadns/skadns_end.c +++ b/src/skadns/skadns_end.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -17,7 +18,7 @@ static int skadnsanswer_free (char *p, void *stuff) void skadns_end (skadns_t *a) { skaclient_end(&a->connection) ; - genalloc_free(uint16, &a->list) ; + genalloc_free(uint16_t, &a->list) ; gensetdyn_iter(&a->q, &skadnsanswer_free, 0) ; gensetdyn_free(&a->q) ; *a = skadns_zero ; diff --git a/src/skadns/skadns_packet.c b/src/skadns/skadns_packet.c index c34b3a1..8ef8f1d 100644 --- a/src/skadns/skadns_packet.c +++ b/src/skadns/skadns_packet.c @@ -1,11 +1,11 @@ /* ISC license. */ +#include #include -#include #include #include -char const *skadns_packet (skadns_t const *a, uint16 id) +char const *skadns_packet (skadns_t const *a, uint16_t id) { register skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ; switch (p->status) diff --git a/src/skadns/skadns_packetlen.c b/src/skadns/skadns_packetlen.c index 34cbb28..f69e43f 100644 --- a/src/skadns/skadns_packetlen.c +++ b/src/skadns/skadns_packetlen.c @@ -1,11 +1,11 @@ /* ISC license. */ +#include #include -#include #include #include -int skadns_packetlen (skadns_t const *a, uint16 id) +int skadns_packetlen (skadns_t const *a, uint16_t id) { register skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ; switch (p->status) diff --git a/src/skadns/skadns_release.c b/src/skadns/skadns_release.c index 0cd4dc0..3ce2fc3 100644 --- a/src/skadns/skadns_release.c +++ b/src/skadns/skadns_release.c @@ -5,13 +5,13 @@ #define _BSD_SOURCE #endif +#include #include -#include #include #include #include -int skadns_release (skadns_t *a, uint16 id) +int skadns_release (skadns_t *a, uint16_t id) { register skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ; switch (p->status) diff --git a/src/skadns/skadns_send.c b/src/skadns/skadns_send.c index f8152b7..f485c92 100644 --- a/src/skadns/skadns_send.c +++ b/src/skadns/skadns_send.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -13,14 +14,14 @@ static skadnsanswer_t const skadnsanswer_initial = { .status = EAGAIN, .data = 0, .len = 0 } ; -int skadns_send (skadns_t *a, uint16 *u, s6dns_domain_t const *d, uint16 qtype, tain_t const *limit, tain_t const *deadline, tain_t *stamp) +int skadns_send (skadns_t *a, uint16_t *u, s6dns_domain_t const *d, uint16_t qtype, tain_t const *limit, tain_t const *deadline, tain_t *stamp) { unsigned int i ; char tmp[17] = "--Q" ; char err ; siovec_t v[2] = { { .s = tmp, .len = 17 }, { .s = (char *)d->s, .len = d->len } } ; if (!gensetdyn_new(&a->q, &i)) return 0 ; - uint16_pack_big(tmp, (uint16)i) ; + uint16_pack_big(tmp, (uint16_t)i) ; uint16_pack_big(tmp + 3, qtype) ; if (limit) tain_pack(tmp + 5, limit) ; else byte_zero(tmp + 5, 12) ; if (!skaclient_sendv(&a->connection, v, 2, &skaclient_default_cb, &err, deadline, stamp)) diff --git a/src/skadns/skadnsd.c b/src/skadns/skadnsd.c index 11f52ea..2682ace 100644 --- a/src/skadns/skadnsd.c +++ b/src/skadns/skadnsd.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -19,7 +20,7 @@ struct dnsio_s { unsigned int xindex ; s6dns_engine_t dt ; - uint16 id ; + uint16_t id ; } ; #define DNSIO_ZERO { .xindex = SKADNS_MAXCONCURRENCY, .dt = S6DNS_ENGINE_ZERO, .id = 0 } @@ -55,7 +56,7 @@ static void answer (char c) static int parse_protocol (unixmessage_t const *m, void *context) { - uint16 id ; + uint16_t id ; if (m->len < 3 || m->nfds) strerr_dief1x(100, "invalid client request") ; uint16_unpack_big(m->s, &id) ; switch (m->s[2]) /* protocol parsing */ @@ -63,7 +64,7 @@ static int parse_protocol (unixmessage_t const *m, void *context) case 'Q' : /* send a query */ { tain_t limit ; - uint16 qtype ; + uint16_t qtype ; if (m->len < 21) strerr_dief1x(100, "invalid client request") ; if (sp >= SKADNS_MAXCONCURRENCY) { -- cgit v1.2.3