mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-24 18:30:38 -05:00
Merge branch 'ondrej-unsigned-to-unsigned_int' into 'main'
Add semantic patch to use 'unsigned int' instead of 'unsigned' See merge request isc-projects/bind9!6741
This commit is contained in:
commit
de75595575
35 changed files with 87 additions and 79 deletions
|
|
@ -2542,7 +2542,8 @@ setup_lookup(dig_lookup_t *lookup) {
|
|||
addr[addrl - 1] &= ~0U
|
||||
<< (8 - (plen % 8));
|
||||
}
|
||||
isc_buffer_putmem(&b, addr, (unsigned)addrl);
|
||||
isc_buffer_putmem(&b, addr,
|
||||
(unsigned int)addrl);
|
||||
}
|
||||
|
||||
opts[i].value = (uint8_t *)ecsbuf;
|
||||
|
|
@ -4680,7 +4681,7 @@ destroy_libs(void) {
|
|||
#ifdef HAVE_LIBIDN2
|
||||
|
||||
static isc_result_t
|
||||
idn_filter(isc_buffer_t *buffer, unsigned start) {
|
||||
idn_filter(isc_buffer_t *buffer, unsigned int start) {
|
||||
char src[MXNAME];
|
||||
char *dst = NULL;
|
||||
size_t srclen, dstlen;
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ emit(dns_dsdigest_t dt, bool showall, bool cds, dns_rdata_t *rdata) {
|
|||
|
||||
static void
|
||||
emits(bool showall, bool cds, dns_rdata_t *rdata) {
|
||||
unsigned i, n;
|
||||
unsigned int i, n;
|
||||
|
||||
n = sizeof(dtype) / sizeof(dtype[0]);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ dumpnode(dns_name_t *name, dns_dbnode_t *node) {
|
|||
isc_buffer_t *buffer = NULL;
|
||||
isc_region_t r;
|
||||
isc_result_t result;
|
||||
unsigned bufsize = 4096;
|
||||
unsigned int bufsize = 4096;
|
||||
|
||||
if (outputformat != dns_masterformat_text) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ cmp_dtype(const void *ap, const void *bp) {
|
|||
|
||||
void
|
||||
add_dtype(unsigned int dt) {
|
||||
unsigned i, n;
|
||||
unsigned int i, n;
|
||||
|
||||
/* ensure there is space for a zero terminator */
|
||||
n = sizeof(dtype) / sizeof(dtype[0]) - 1;
|
||||
|
|
|
|||
|
|
@ -7209,13 +7209,13 @@ get_tat_qname(dns_name_t *target, dns_name_t *keyname, dns_keynode_t *keynode) {
|
|||
r.base = label;
|
||||
r.length = sizeof(label);
|
||||
m = snprintf(r.base, r.length, "_ta");
|
||||
if (m < 0 || (unsigned)m > r.length) {
|
||||
if (m < 0 || (unsigned int)m > r.length) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
isc_textregion_consume(&r, m);
|
||||
for (i = 0; i < n; i++) {
|
||||
m = snprintf(r.base, r.length, "-%04x", ids[i]);
|
||||
if (m < 0 || (unsigned)m > r.length) {
|
||||
if (m < 0 || (unsigned int)m > r.length) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
isc_textregion_consume(&r, m);
|
||||
|
|
@ -8615,7 +8615,7 @@ load_configuration(const char *filename, named_server_t *server,
|
|||
|
||||
max = isc_quota_getmax(&server->sctx->recursionquota);
|
||||
if (max > 1000) {
|
||||
unsigned margin = ISC_MAX(100, named_g_cpus + 1);
|
||||
unsigned int margin = ISC_MAX(100, named_g_cpus + 1);
|
||||
if (margin + 100 > max) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
|
||||
|
|
@ -12461,8 +12461,8 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
|
|||
CHECK(putstr(text, line));
|
||||
|
||||
snprintf(line, sizeof(line), "TCP high-water: %u\n",
|
||||
(unsigned)ns_stats_get_counter(server->sctx->nsstats,
|
||||
ns_statscounter_tcphighwater));
|
||||
(unsigned int)ns_stats_get_counter(
|
||||
server->sctx->nsstats, ns_statscounter_tcphighwater));
|
||||
CHECK(putstr(text, line));
|
||||
|
||||
reload_status = atomic_load(&server->reload_status);
|
||||
|
|
@ -16793,7 +16793,7 @@ named_server_fetchlimit(named_server_t *server, isc_lex_t *lex,
|
|||
dns_adb_getquota(view->adb, &val, NULL, NULL, NULL, NULL);
|
||||
s = snprintf(tbuf, sizeof(tbuf),
|
||||
" (fetches-per-server %u):", val);
|
||||
if (s < 0 || (unsigned)s > sizeof(tbuf)) {
|
||||
if (s < 0 || (unsigned int)s > sizeof(tbuf)) {
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
first = false;
|
||||
|
|
@ -16809,7 +16809,7 @@ named_server_fetchlimit(named_server_t *server, isc_lex_t *lex,
|
|||
val = dns_resolver_getfetchesperzone(view->resolver);
|
||||
s = snprintf(tbuf, sizeof(tbuf),
|
||||
" (fetches-per-zone %u):", val);
|
||||
if (s < 0 || (unsigned)s > sizeof(tbuf)) {
|
||||
if (s < 0 || (unsigned int)s > sizeof(tbuf)) {
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
CHECK(putstr(text, tbuf));
|
||||
|
|
|
|||
|
|
@ -701,7 +701,8 @@ sendquery(struct query *query) {
|
|||
isc_buffer_putuint8(&b, 0);
|
||||
/* address */
|
||||
if (addrl > 0) {
|
||||
isc_buffer_putmem(&b, addr, (unsigned)addrl);
|
||||
isc_buffer_putmem(&b, addr,
|
||||
(unsigned int)addrl);
|
||||
}
|
||||
|
||||
opts[i].value = (uint8_t *)ecsbuf;
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ usage(void) {
|
|||
}
|
||||
|
||||
typedef void
|
||||
nsec3printer(unsigned algo, unsigned flags, unsigned iters, const char *saltstr,
|
||||
const char *domain, const char *digest);
|
||||
nsec3printer(unsigned int algo, unsigned int flags, unsigned int iters,
|
||||
const char *saltstr, const char *domain, const char *digest);
|
||||
|
||||
static void
|
||||
nsec3hash(nsec3printer *nsec3print, const char *algostr, const char *flagstr,
|
||||
|
|
@ -138,7 +138,7 @@ nsec3hash(nsec3printer *nsec3print, const char *algostr, const char *flagstr,
|
|||
}
|
||||
|
||||
static void
|
||||
nsec3hash_print(unsigned algo, unsigned flags, unsigned iters,
|
||||
nsec3hash_print(unsigned int algo, unsigned int flags, unsigned int iters,
|
||||
const char *saltstr, const char *domain, const char *digest) {
|
||||
UNUSED(flags);
|
||||
UNUSED(domain);
|
||||
|
|
@ -148,7 +148,7 @@ nsec3hash_print(unsigned algo, unsigned flags, unsigned iters,
|
|||
}
|
||||
|
||||
static void
|
||||
nsec3hash_rdata_print(unsigned algo, unsigned flags, unsigned iters,
|
||||
nsec3hash_rdata_print(unsigned int algo, unsigned int flags, unsigned int iters,
|
||||
const char *saltstr, const char *domain,
|
||||
const char *digest) {
|
||||
fprintf(stdout, "%s NSEC3 %u %u %u %s %s\n", domain, algo, flags, iters,
|
||||
|
|
|
|||
5
cocci/unsigned-int.spatch
Normal file
5
cocci/unsigned-int.spatch
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
@@
|
||||
@@
|
||||
|
||||
- unsigned
|
||||
+ unsigned int
|
||||
|
|
@ -278,7 +278,7 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
|||
if (n < 0) {
|
||||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
if ((unsigned)n >= sizeof(soa_data)) {
|
||||
if ((unsigned int)n >= sizeof(soa_data)) {
|
||||
CHECK(ISC_R_NOSPACE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ dns_badcache_add(dns_badcache_t *bc, const dns_name_t *name,
|
|||
}
|
||||
|
||||
if (bad == NULL) {
|
||||
unsigned count;
|
||||
unsigned int count;
|
||||
isc_buffer_t buffer;
|
||||
|
||||
bad = isc_mem_get(bc->mctx, sizeof(*bad));
|
||||
|
|
|
|||
|
|
@ -2205,7 +2205,7 @@ write_public_key(const dst_key_t *key, int type, const char *directory) {
|
|||
}
|
||||
|
||||
isc_buffer_usedregion(&classb, &r);
|
||||
if ((unsigned)fwrite(r.base, 1, r.length, fp) != r.length) {
|
||||
if ((unsigned int)fwrite(r.base, 1, r.length, fp) != r.length) {
|
||||
ret = DST_R_WRITEERROR;
|
||||
}
|
||||
|
||||
|
|
@ -2216,7 +2216,7 @@ write_public_key(const dst_key_t *key, int type, const char *directory) {
|
|||
}
|
||||
|
||||
isc_buffer_usedregion(&textb, &r);
|
||||
if ((unsigned)fwrite(r.base, 1, r.length, fp) != r.length) {
|
||||
if ((unsigned int)fwrite(r.base, 1, r.length, fp) != r.length) {
|
||||
ret = DST_R_WRITEERROR;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ insert_into_typenames(int type, const char *typebuf, const char *attr) {
|
|||
if (attr == NULL) {
|
||||
n = snprintf(tmp, sizeof(tmp), "RRTYPE_%s_ATTRIBUTES",
|
||||
upper(ttn->macroname));
|
||||
INSIST(n > 0 && (unsigned)n < sizeof(tmp));
|
||||
INSIST(n > 0 && (unsigned int)n < sizeof(tmp));
|
||||
attr = tmp;
|
||||
}
|
||||
|
||||
|
|
@ -548,7 +548,7 @@ sd(unsigned int rdclass, const char *classbuf, const char *dirbuf,
|
|||
*/
|
||||
n = snprintf(buf, sizeof(buf), "%s_%u.%c", typebuf, type,
|
||||
filetype);
|
||||
INSIST(n > 0 && (unsigned)n < sizeof(buf));
|
||||
INSIST(n > 0 && (unsigned int)n < sizeof(buf));
|
||||
if (strcmp(buf, dir.filename) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -657,7 +657,7 @@ main(int argc, char **argv) {
|
|||
exit(1);
|
||||
}
|
||||
n = snprintf(srcdir, sizeof(srcdir), "%s/", optarg);
|
||||
INSIST(n > 0 && (unsigned)n < sizeof(srcdir));
|
||||
INSIST(n > 0 && (unsigned int)n < sizeof(srcdir));
|
||||
break;
|
||||
case 'F':
|
||||
file = optarg;
|
||||
|
|
@ -674,7 +674,7 @@ main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
n = snprintf(buf, sizeof(buf), "%srdata", srcdir);
|
||||
INSIST(n > 0 && (unsigned)n < sizeof(srcdir));
|
||||
INSIST(n > 0 && (unsigned int)n < sizeof(srcdir));
|
||||
|
||||
if (!start_directory(buf, &dir)) {
|
||||
exit(1);
|
||||
|
|
@ -693,7 +693,7 @@ main(int argc, char **argv) {
|
|||
*/
|
||||
n = snprintf(buf, sizeof(buf), "%srdata/%s_%u", srcdir,
|
||||
classbuf, rdclass);
|
||||
INSIST(n > 0 && (unsigned)n < sizeof(buf));
|
||||
INSIST(n > 0 && (unsigned int)n < sizeof(buf));
|
||||
if (strcmp(buf + 6 + strlen(srcdir), dir.filename) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -706,7 +706,7 @@ main(int argc, char **argv) {
|
|||
}
|
||||
end_directory(&dir);
|
||||
n = snprintf(buf, sizeof(buf), "%srdata/generic", srcdir);
|
||||
INSIST(n > 0 && (unsigned)n < sizeof(srcdir));
|
||||
INSIST(n > 0 && (unsigned int)n < sizeof(srcdir));
|
||||
sd(0, "", buf, filetype);
|
||||
|
||||
source_date_epoch = getenv("SOURCE_DATE_EPOCH");
|
||||
|
|
@ -757,7 +757,7 @@ main(int argc, char **argv) {
|
|||
if (tm != NULL && tm->tm_year > 104) {
|
||||
n = snprintf(year, sizeof(year), "-%d",
|
||||
tm->tm_year + 1900);
|
||||
INSIST(n > 0 && (unsigned)n < sizeof(year));
|
||||
INSIST(n > 0 && (unsigned int)n < sizeof(year));
|
||||
} else {
|
||||
snprintf(year, sizeof(year), "-2016");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,10 +244,10 @@ typedef void(librpz_fatal_t)(int ex_code, const char *p, ...) LIBRPZ_PF(2, 3);
|
|||
extern void
|
||||
librpz_fatal(int ex_code, const char *p, ...) LIBRPZ_PF(2, 3) LIBRPZ_NORET;
|
||||
|
||||
typedef void(librpz_rpz_assert_t)(const char *file, unsigned line,
|
||||
typedef void(librpz_rpz_assert_t)(const char *file, unsigned int line,
|
||||
const char *p, ...) LIBRPZ_PF(3, 4);
|
||||
extern void
|
||||
librpz_rpz_assert(const char *file, unsigned line, const char *p, ...)
|
||||
librpz_rpz_assert(const char *file, unsigned int line, const char *p, ...)
|
||||
LIBRPZ_PF(3, 4) LIBRPZ_NORET;
|
||||
|
||||
typedef void(librpz_rpz_vassert_t)(const char *file, uint line, const char *p,
|
||||
|
|
|
|||
|
|
@ -1837,7 +1837,7 @@ read_one_rr(dns_journal_t *j);
|
|||
*/
|
||||
|
||||
static isc_result_t
|
||||
size_buffer(isc_mem_t *mctx, isc_buffer_t *b, unsigned size) {
|
||||
size_buffer(isc_mem_t *mctx, isc_buffer_t *b, unsigned int size) {
|
||||
if (b->length < size) {
|
||||
void *mem = isc_mem_get(mctx, size);
|
||||
if (mem == NULL) {
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ indent(unsigned int *current, unsigned int to, int tabwidth,
|
|||
|
||||
if (ntabs > 0) {
|
||||
isc_buffer_availableregion(target, &r);
|
||||
if (r.length < (unsigned)ntabs) {
|
||||
if (r.length < (unsigned int)ntabs) {
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
p = r.base;
|
||||
|
|
@ -330,7 +330,7 @@ indent(unsigned int *current, unsigned int to, int tabwidth,
|
|||
INSIST(nspaces >= 0);
|
||||
|
||||
isc_buffer_availableregion(target, &r);
|
||||
if (r.length < (unsigned)nspaces) {
|
||||
if (r.length < (unsigned int)nspaces) {
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
p = r.base;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ hexdump(const char *msg, const char *msg2, void *base, size_t len) {
|
|||
p = base;
|
||||
cnt = 0;
|
||||
|
||||
printf("*** %s [%s] (%u bytes @ %p)\n", msg, msg2, (unsigned)len, base);
|
||||
printf("*** %s [%s] (%u bytes @ %p)\n", msg, msg2, (unsigned int)len,
|
||||
base);
|
||||
|
||||
while (cnt < len) {
|
||||
if (cnt % 16 == 0) {
|
||||
|
|
|
|||
|
|
@ -2421,7 +2421,7 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, bool commit) {
|
|||
serial = version->serial;
|
||||
if (version->writer) {
|
||||
if (commit) {
|
||||
unsigned cur_ref;
|
||||
unsigned int cur_ref;
|
||||
rbtdb_version_t *cur_version;
|
||||
|
||||
INSIST(version->commit_ok);
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ maybe_numeric(unsigned int *valuep, isc_textregion_t *source, unsigned int max,
|
|||
*/
|
||||
v = snprintf(buffer, sizeof(buffer), "%.*s", (int)source->length,
|
||||
source->base);
|
||||
if (v < 0 || (unsigned)v != source->length) {
|
||||
if (v < 0 || (unsigned int)v != source->length) {
|
||||
return (ISC_R_BADNUMBER);
|
||||
}
|
||||
INSIST(buffer[source->length] == '\0');
|
||||
|
|
|
|||
|
|
@ -476,8 +476,8 @@ casecompare_hip(ARGS_COMPARE) {
|
|||
isc_region_consume(&r1, 2); /* key length */
|
||||
isc_region_consume(&r2, 4);
|
||||
|
||||
INSIST(r1.length >= (unsigned)(hit_len + key_len));
|
||||
INSIST(r2.length >= (unsigned)(hit_len + key_len));
|
||||
INSIST(r1.length >= (unsigned int)(hit_len + key_len));
|
||||
INSIST(r2.length >= (unsigned int)(hit_len + key_len));
|
||||
order = memcmp(r1.base, r2.base, hit_len + key_len);
|
||||
if (order != 0) {
|
||||
return (order);
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ svcparamkey(unsigned short value, enum encoding *encoding, char *buf,
|
|||
}
|
||||
}
|
||||
n = snprintf(buf, len, "key%u", value);
|
||||
INSIST(n > 0 && (unsigned)n < len);
|
||||
INSIST(n > 0 && (unsigned int)n < len);
|
||||
*encoding = sbpr_text;
|
||||
return (buf);
|
||||
}
|
||||
|
|
@ -630,7 +630,7 @@ generic_totext_in_svcb(ARGS_TOTEXT) {
|
|||
num = uint16_fromregion(®ion);
|
||||
isc_region_consume(®ion, 2);
|
||||
n = snprintf(buf, sizeof(buf), "%u ", num);
|
||||
INSIST(n > 0 && (unsigned)n < sizeof(buf));
|
||||
INSIST(n > 0 && (unsigned int)n < sizeof(buf));
|
||||
RETERR(str_totext(buf, target));
|
||||
|
||||
/*
|
||||
|
|
@ -675,7 +675,7 @@ generic_totext_in_svcb(ARGS_TOTEXT) {
|
|||
num = uint16_fromregion(&r);
|
||||
isc_region_consume(&r, 2);
|
||||
n = snprintf(buf, sizeof(buf), "%u", num);
|
||||
INSIST(n > 0 && (unsigned)n < sizeof(buf));
|
||||
INSIST(n > 0 && (unsigned int)n < sizeof(buf));
|
||||
RETERR(str_totext(buf, target));
|
||||
INSIST(r.length == 0U);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ compare_rdata(const void *p1, const void *p2) {
|
|||
#if DNS_RDATASET_FIXED
|
||||
static void
|
||||
fillin_offsets(unsigned char *offsetbase, unsigned int *offsettable,
|
||||
unsigned length) {
|
||||
unsigned int length) {
|
||||
unsigned int i, j;
|
||||
unsigned char *raw;
|
||||
|
||||
|
|
|
|||
|
|
@ -2468,7 +2468,7 @@ resquery_send(resquery_t *query) {
|
|||
bool secure_domain;
|
||||
bool tcp = ((query->options & DNS_FETCHOPT_TCP) != 0);
|
||||
dns_ednsopt_t ednsopts[DNS_EDNSOPTIONS];
|
||||
unsigned ednsopt = 0;
|
||||
unsigned int ednsopt = 0;
|
||||
uint16_t hint = 0, udpsize = 0; /* No EDNS */
|
||||
#ifdef HAVE_DNSTAP
|
||||
isc_sockaddr_t localaddr, *la = NULL;
|
||||
|
|
@ -5361,7 +5361,7 @@ validated(isc_task_t *task, isc_event_t *event) {
|
|||
isc_result_t result = ISC_R_SUCCESS;
|
||||
isc_stdtime_t now;
|
||||
uint32_t ttl;
|
||||
unsigned options;
|
||||
unsigned int options;
|
||||
dns_fixedname_t fwild;
|
||||
dns_name_t *wild = NULL;
|
||||
dns_message_t *message = NULL;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ ttlfmt(unsigned int t, const char *s, bool verbose, bool space,
|
|||
*/
|
||||
isc_result_t
|
||||
dns_ttl_totext(uint32_t src, bool verbose, bool upcase, isc_buffer_t *target) {
|
||||
unsigned secs, mins, hours, days, weeks, x;
|
||||
unsigned int secs, mins, hours, days, weeks, x;
|
||||
|
||||
secs = src % 60;
|
||||
src /= 60;
|
||||
|
|
|
|||
|
|
@ -734,7 +734,7 @@ isc_file_sanitize(const char *dir, const char *base, const char *ext,
|
|||
l += strlen(ext) + 1;
|
||||
}
|
||||
|
||||
if (l > length || l > (unsigned)PATH_MAX) {
|
||||
if (l > length || l > (unsigned int)PATH_MAX) {
|
||||
return (ISC_R_NOSPACE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ isc__ascii_tolower1(uint8_t c) {
|
|||
* Copy `len` bytes from `src` to `dst`, converting to lower case.
|
||||
*/
|
||||
static inline void
|
||||
isc_ascii_lowercopy(uint8_t *dst, const uint8_t *src, unsigned len) {
|
||||
isc_ascii_lowercopy(uint8_t *dst, const uint8_t *src, unsigned int len) {
|
||||
while (len-- > 0) {
|
||||
*dst++ = isc__ascii_tolower1(*src++);
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ isc_ascii_lowercopy(uint8_t *dst, const uint8_t *src, unsigned len) {
|
|||
static inline void
|
||||
isc_ascii_strtolower(char *str) {
|
||||
isc_ascii_lowercopy((uint8_t *)str, (uint8_t *)str,
|
||||
(unsigned)strlen(str));
|
||||
(unsigned int)strlen(str));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -117,7 +117,7 @@ isc__ascii_load8(const uint8_t *ptr) {
|
|||
* Compare `len` bytes at `a` and `b` for case-insensitive equality
|
||||
*/
|
||||
static inline bool
|
||||
isc_ascii_lowerequal(const uint8_t *a, const uint8_t *b, unsigned len) {
|
||||
isc_ascii_lowerequal(const uint8_t *a, const uint8_t *b, unsigned int len) {
|
||||
uint64_t a8 = 0, b8 = 0;
|
||||
while (len >= 8) {
|
||||
a8 = isc__ascii_tolower8(isc__ascii_load8(a));
|
||||
|
|
@ -144,7 +144,7 @@ isc_ascii_lowerequal(const uint8_t *a, const uint8_t *b, unsigned len) {
|
|||
* i.e. they treat the strings as big-endian numbers.
|
||||
*/
|
||||
static inline int
|
||||
isc_ascii_lowercmp(const uint8_t *a, const uint8_t *b, unsigned len) {
|
||||
isc_ascii_lowercmp(const uint8_t *a, const uint8_t *b, unsigned int len) {
|
||||
uint64_t a8 = 0, b8 = 0;
|
||||
while (len >= 8) {
|
||||
a8 = isc__ascii_tolower8(htobe64(isc__ascii_load8(a)));
|
||||
|
|
|
|||
|
|
@ -1236,7 +1236,7 @@ roll_increment(isc_logfile_t *file) {
|
|||
*/
|
||||
for (greatest = 0; greatest < INT_MAX; greatest++) {
|
||||
n = snprintf(current, sizeof(current), "%s.%u", path,
|
||||
(unsigned)greatest);
|
||||
(unsigned int)greatest);
|
||||
if (n >= (int)sizeof(current) || n < 0 ||
|
||||
!isc_file_exists(current)) {
|
||||
break;
|
||||
|
|
@ -1263,13 +1263,13 @@ roll_increment(isc_logfile_t *file) {
|
|||
for (i = greatest; i > 0; i--) {
|
||||
result = ISC_R_SUCCESS;
|
||||
n = snprintf(current, sizeof(current), "%s.%u", path,
|
||||
(unsigned)(i - 1));
|
||||
(unsigned int)(i - 1));
|
||||
if (n >= (int)sizeof(current) || n < 0) {
|
||||
result = ISC_R_NOSPACE;
|
||||
}
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
n = snprintf(newpath, sizeof(newpath), "%s.%u", path,
|
||||
(unsigned)i);
|
||||
(unsigned int)i);
|
||||
if (n >= (int)sizeof(newpath) || n < 0) {
|
||||
result = ISC_R_NOSPACE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1955,7 +1955,7 @@ isc__nm_alloc_cb(uv_handle_t *handle, size_t size, uv_buf_t *buf);
|
|||
|
||||
void
|
||||
isc__nm_udp_read_cb(uv_udp_t *handle, ssize_t nrecv, const uv_buf_t *buf,
|
||||
const struct sockaddr *addr, unsigned flags);
|
||||
const struct sockaddr *addr, unsigned int flags);
|
||||
void
|
||||
isc__nm_tcp_read_cb(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf);
|
||||
void
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ isc__nm_async_udpstop(isc__networker_t *worker, isc__netievent_t *ev0) {
|
|||
*/
|
||||
void
|
||||
isc__nm_udp_read_cb(uv_udp_t *handle, ssize_t nrecv, const uv_buf_t *buf,
|
||||
const struct sockaddr *addr, unsigned flags) {
|
||||
const struct sockaddr *addr, unsigned int flags) {
|
||||
isc_nmsocket_t *sock = uv_handle_get_data((uv_handle_t *)handle);
|
||||
isc__nm_uvreq_t *req = NULL;
|
||||
uint32_t maxudp;
|
||||
|
|
|
|||
|
|
@ -1090,7 +1090,7 @@ no_nsid:
|
|||
if ((plen % 8) != 0) {
|
||||
addr[addrl - 1] &= ~0U << (8 - (plen % 8));
|
||||
}
|
||||
isc_buffer_putmem(&buf, addr, (unsigned)addrl);
|
||||
isc_buffer_putmem(&buf, addr, (unsigned int)addrl);
|
||||
}
|
||||
|
||||
ednsopts[count].code = DNS_OPT_CLIENT_SUBNET;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#define SIZE (1024 * 1024)
|
||||
|
||||
typedef void
|
||||
copy_fn(void *a, void *b, unsigned len);
|
||||
copy_fn(void *a, void *b, unsigned int len);
|
||||
|
||||
static void
|
||||
time_it(copy_fn *copier, void *a, void *b, const char *name) {
|
||||
|
|
@ -40,12 +40,12 @@ time_it(copy_fn *copier, void *a, void *b, const char *name) {
|
|||
}
|
||||
|
||||
static void
|
||||
copy_raw(void *a, void *b, unsigned size) {
|
||||
copy_raw(void *a, void *b, unsigned int size) {
|
||||
memmove(a, b, size);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_toupper(void *va, void *vb, unsigned size) {
|
||||
copy_toupper(void *va, void *vb, unsigned int size) {
|
||||
uint8_t *a = va, *b = vb;
|
||||
while (size-- > 0) {
|
||||
*a++ = isc_ascii_toupper(*b++);
|
||||
|
|
@ -53,21 +53,21 @@ copy_toupper(void *va, void *vb, unsigned size) {
|
|||
}
|
||||
|
||||
static void
|
||||
copy_tolower8(void *a, void *b, unsigned size) {
|
||||
copy_tolower8(void *a, void *b, unsigned int size) {
|
||||
isc_ascii_lowercopy(a, b, size);
|
||||
}
|
||||
|
||||
#define TOLOWER(c) ((c) + ('a' - 'A') * (((c) >= 'A') ^ ((c) > 'Z')))
|
||||
|
||||
static void
|
||||
copy_tolower1(void *va, void *vb, unsigned size) {
|
||||
copy_tolower1(void *va, void *vb, unsigned int size) {
|
||||
for (uint8_t *a = va, *b = vb; size-- > 0; a++, b++) {
|
||||
*a = TOLOWER(*b);
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
cmp_tolower1(void *va, void *vb, unsigned size) {
|
||||
cmp_tolower1(void *va, void *vb, unsigned int size) {
|
||||
for (uint8_t *a = va, *b = vb; size-- > 0; a++, b++) {
|
||||
if (TOLOWER(*a) != TOLOWER(*b)) {
|
||||
return false;
|
||||
|
|
@ -79,7 +79,7 @@ cmp_tolower1(void *va, void *vb, unsigned size) {
|
|||
static bool oldskool_result;
|
||||
|
||||
static void
|
||||
cmp_oldskool(void *va, void *vb, unsigned size) {
|
||||
cmp_oldskool(void *va, void *vb, unsigned int size) {
|
||||
uint8_t *a = va, *b = vb, c;
|
||||
|
||||
while (size > 3) {
|
||||
|
|
@ -119,22 +119,22 @@ diff:
|
|||
static bool tolower1_result;
|
||||
|
||||
static void
|
||||
vcmp_tolower1(void *a, void *b, unsigned size) {
|
||||
vcmp_tolower1(void *a, void *b, unsigned int size) {
|
||||
tolower1_result = cmp_tolower1(a, b, size);
|
||||
}
|
||||
|
||||
static bool swar_result;
|
||||
|
||||
static void
|
||||
cmp_swar(void *a, void *b, unsigned size) {
|
||||
cmp_swar(void *a, void *b, unsigned int size) {
|
||||
swar_result = isc_ascii_lowerequal(a, b, size);
|
||||
}
|
||||
|
||||
static bool chunk_result;
|
||||
static unsigned chunk_size;
|
||||
static unsigned int chunk_size;
|
||||
|
||||
static void
|
||||
cmp_chunks1(void *va, void *vb, unsigned size) {
|
||||
cmp_chunks1(void *va, void *vb, unsigned int size) {
|
||||
uint8_t *a = va, *b = vb;
|
||||
|
||||
chunk_result = false;
|
||||
|
|
@ -150,7 +150,7 @@ cmp_chunks1(void *va, void *vb, unsigned size) {
|
|||
}
|
||||
|
||||
static void
|
||||
cmp_chunks8(void *va, void *vb, unsigned size) {
|
||||
cmp_chunks8(void *va, void *vb, unsigned int size) {
|
||||
uint8_t *a = va, *b = vb;
|
||||
|
||||
while (size >= chunk_size) {
|
||||
|
|
@ -169,7 +169,7 @@ diff:
|
|||
}
|
||||
|
||||
static void
|
||||
cmp_oldchunks(void *va, void *vb, unsigned size) {
|
||||
cmp_oldchunks(void *va, void *vb, unsigned int size) {
|
||||
uint8_t *a = va, *b = vb;
|
||||
|
||||
while (size >= chunk_size) {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ verify_active_counters(dns_rdatastatstype_t which, uint64_t value, void *arg) {
|
|||
ATTRIBUTE_SET(DNS_RDATASTATSTYPE_ATTR_ANCIENT) ? "~" : " ",
|
||||
ATTRIBUTE_SET(DNS_RDATASTATSTYPE_ATTR_STALE) ? "#" : " ",
|
||||
ATTRIBUTE_SET(DNS_RDATASTATSTYPE_ATTR_NXDOMAIN) ? "X" : " ",
|
||||
type, (unsigned)value);
|
||||
type, (unsigned int)value);
|
||||
#endif /* if debug */
|
||||
if ((attributes & DNS_RDATASTATSTYPE_ATTR_ANCIENT) == 0 &&
|
||||
(attributes & DNS_RDATASTATSTYPE_ATTR_STALE) == 0)
|
||||
|
|
@ -143,7 +143,7 @@ verify_stale_counters(dns_rdatastatstype_t which, uint64_t value, void *arg) {
|
|||
ATTRIBUTE_SET(DNS_RDATASTATSTYPE_ATTR_ANCIENT) ? "~" : " ",
|
||||
ATTRIBUTE_SET(DNS_RDATASTATSTYPE_ATTR_STALE) ? "#" : " ",
|
||||
ATTRIBUTE_SET(DNS_RDATASTATSTYPE_ATTR_NXDOMAIN) ? "X" : " ",
|
||||
type, (unsigned)value);
|
||||
type, (unsigned int)value);
|
||||
#endif /* if debug */
|
||||
if ((attributes & DNS_RDATASTATSTYPE_ATTR_STALE) != 0) {
|
||||
assert_int_equal(value, 1);
|
||||
|
|
@ -172,7 +172,7 @@ verify_ancient_counters(dns_rdatastatstype_t which, uint64_t value, void *arg) {
|
|||
ATTRIBUTE_SET(DNS_RDATASTATSTYPE_ATTR_ANCIENT) ? "~" : " ",
|
||||
ATTRIBUTE_SET(DNS_RDATASTATSTYPE_ATTR_STALE) ? "#" : " ",
|
||||
ATTRIBUTE_SET(DNS_RDATASTATSTYPE_ATTR_NXDOMAIN) ? "X" : " ",
|
||||
type, (unsigned)value);
|
||||
type, (unsigned int)value);
|
||||
#endif /* if debug */
|
||||
if ((attributes & DNS_RDATASTATSTYPE_ATTR_ANCIENT) != 0) {
|
||||
assert_int_equal(value, 1);
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ printmessage(dns_message_t *msg) {
|
|||
}
|
||||
|
||||
static void
|
||||
render(isc_buffer_t *buf, unsigned flags, dns_tsigkey_t *key,
|
||||
render(isc_buffer_t *buf, unsigned int flags, dns_tsigkey_t *key,
|
||||
isc_buffer_t **tsigin, isc_buffer_t **tsigout, dst_context_t *tsigctx) {
|
||||
dns_message_t *msg = NULL;
|
||||
dns_compress_t cctx;
|
||||
|
|
|
|||
|
|
@ -111,13 +111,13 @@ ISC_RUN_TEST_IMPL(lowerequal) {
|
|||
for (size_t n = 0; n < ARRAY_SIZE(same); n++) {
|
||||
const uint8_t *a = (void *)same[n][0];
|
||||
const uint8_t *b = (void *)same[n][1];
|
||||
unsigned len = (unsigned)strlen(same[n][0]);
|
||||
unsigned int len = (unsigned int)strlen(same[n][0]);
|
||||
assert_true(isc_ascii_lowerequal(a, b, len));
|
||||
}
|
||||
for (size_t n = 0; n < ARRAY_SIZE(diff); n++) {
|
||||
const uint8_t *a = (void *)diff[n].a;
|
||||
const uint8_t *b = (void *)diff[n].b;
|
||||
unsigned len = (unsigned)strlen(diff[n].a);
|
||||
unsigned int len = (unsigned int)strlen(diff[n].a);
|
||||
assert_true(!isc_ascii_lowerequal(a, b, len));
|
||||
}
|
||||
}
|
||||
|
|
@ -126,13 +126,13 @@ ISC_RUN_TEST_IMPL(lowercmp) {
|
|||
for (size_t n = 0; n < ARRAY_SIZE(same); n++) {
|
||||
const uint8_t *a = (void *)same[n][0];
|
||||
const uint8_t *b = (void *)same[n][1];
|
||||
unsigned len = (unsigned)strlen(same[n][0]);
|
||||
unsigned int len = (unsigned int)strlen(same[n][0]);
|
||||
assert_true(isc_ascii_lowercmp(a, b, len) == 0);
|
||||
}
|
||||
for (size_t n = 0; n < ARRAY_SIZE(diff); n++) {
|
||||
const uint8_t *a = (void *)diff[n].a;
|
||||
const uint8_t *b = (void *)diff[n].b;
|
||||
unsigned len = (unsigned)strlen(diff[n].a);
|
||||
unsigned int len = (unsigned int)strlen(diff[n].a);
|
||||
assert_true(isc_ascii_lowercmp(a, b, len) == diff[n].cmp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ static isc_quota_t *
|
|||
init_listener_quota(size_t nthreads) {
|
||||
isc_quota_t *quotap = NULL;
|
||||
if (atomic_load(&check_listener_quota)) {
|
||||
unsigned max_quota = ISC_MAX(nthreads / 2, 1);
|
||||
unsigned int max_quota = ISC_MAX(nthreads / 2, 1);
|
||||
isc_quota_max(&listener_quota, max_quota);
|
||||
quotap = &listener_quota;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -574,7 +574,7 @@ isc_quota_t *
|
|||
tcp_listener_init_quota(size_t nthreads) {
|
||||
isc_quota_t *quotap = NULL;
|
||||
if (atomic_load(&check_listener_quota)) {
|
||||
unsigned max_quota = ISC_MAX(nthreads / 2, 1);
|
||||
unsigned int max_quota = ISC_MAX(nthreads / 2, 1);
|
||||
isc_quota_max(&listener_quota, max_quota);
|
||||
quotap = &listener_quota;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue