Commit f74cc540 authored by Daniel Salzman's avatar Daniel Salzman

fix some unused variables and comparison of different types

parent 157f5fa3
......@@ -35,6 +35,7 @@ typedef struct timeval timev_t;
#endif
struct fdset_backend_t _fdset_backend = {
NULL
};
/*! \brief Set backend implementation. */
......
......@@ -43,6 +43,7 @@ static void sleep_consumer(struct queue *q)
static void sleep_producer(struct queue *q)
{
(void)q;
Please register or sign in to reply
/* sleep_consumer(q); */
}
......@@ -55,6 +56,7 @@ static void wake_consumer(struct queue *q)
static void wake_producer(struct queue *q)
{
(void)q;
Please register or sign in to reply
/* wake_consumer(q); */
}
......
......@@ -109,7 +109,7 @@ knot_cmd_t knot_cmd_tbl[] = {
};
/*! \brief Print help. */
void help(int argc, char **argv)
void help()
Please register or sign in to reply
{
printf("Usage: %sc [parameters] <action>\n", PACKAGE_NAME);
printf("\nParameters:\n"
......@@ -484,11 +484,11 @@ int main(int argc, char **argv)
case 'h':
case '?':
rc = 0;
help(argc, argv);
help();
goto exit;
default:
rc = 1;
help(argc, argv);
help();
goto exit;
}
}
......@@ -496,7 +496,7 @@ int main(int argc, char **argv)
/* Check if there's at least one remaining non-option. */
if (argc - optind < 1) {
rc = 1;
help(argc, argv);
help();
goto exit;
}
......@@ -660,6 +660,9 @@ static int cmd_start(int argc, char *argv[], unsigned flags)
static int cmd_stop(int argc, char *argv[], unsigned flags)
{
UNUSED(argc);
UNUSED(argv);
/* Check config. */
if (has_flag(flags, F_NOCONF)) {
log_server_error("Couldn't parse config file, refusing to "
......@@ -732,31 +735,51 @@ static int cmd_restart(int argc, char *argv[], unsigned flags)
static int cmd_reload(int argc, char *argv[], unsigned flags)
{
UNUSED(argc);
UNUSED(argv);
UNUSED(flags);
return cmd_remote("reload", KNOT_RRTYPE_TXT, 0, NULL);
}
static int cmd_refresh(int argc, char *argv[], unsigned flags)
{
UNUSED(flags);
return cmd_remote("refresh", KNOT_RRTYPE_NS, argc, argv);
}
static int cmd_flush(int argc, char *argv[], unsigned flags)
{
UNUSED(flags);
return cmd_remote("flush", KNOT_RRTYPE_NS, argc, argv);
}
static int cmd_status(int argc, char *argv[], unsigned flags)
{
UNUSED(argc);
UNUSED(argv);
UNUSED(flags);
return cmd_remote("status", KNOT_RRTYPE_TXT, 0, NULL);
}
static int cmd_zonestatus(int argc, char *argv[], unsigned flags)
{
UNUSED(argc);
UNUSED(argv);
UNUSED(flags);
return cmd_remote("zonestatus", KNOT_RRTYPE_TXT, 0, NULL);
}
static int cmd_checkconf(int argc, char *argv[], unsigned flags)
{
UNUSED(argc);
UNUSED(argv);
UNUSED(flags);
/* Check config. */
if (has_flag(flags, F_NOCONF)) {
log_server_error("Couldn't parse config file, refusing to "
......@@ -771,6 +794,8 @@ static int cmd_checkconf(int argc, char *argv[], unsigned flags)
static int cmd_checkzone(int argc, char *argv[], unsigned flags)
{
UNUSED(flags);
/* Zone checking */
int rc = 0;
node *n = 0;
......@@ -780,7 +805,7 @@ static int cmd_checkzone(int argc, char *argv[], unsigned flags)
/* Fetch zone */
conf_zone_t *zone = (conf_zone_t *) n;
int zone_match = 0;
for (unsigned i = 0; i < argc; ++i) {
for (unsigned i = 0; i < (unsigned)argc; ++i) {
size_t len = strlen(zone->name);
/* All (except root) without final dot */
......
......@@ -73,7 +73,7 @@ void interrupt_handle(int s)
}
}
void help(int argc, char **argv)
void help()
Please register or sign in to reply
{
printf("Usage: %sd [parameters]\n",
PACKAGE_NAME);
......@@ -121,11 +121,11 @@ int main(int argc, char **argv)
case 'h':
case '?':
free(config_fn);
help(argc, argv);
help();
return 0;
default:
free(config_fn);
help(argc, argv);
help();
return 1;
}
}
......
......@@ -100,7 +100,7 @@ static void wire_num8_to_str(rrset_dump_params_t *p)
// Write number.
int ret = snprintf(p->out, p->out_max, "%u", data);
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
out_len = ret;
......@@ -132,7 +132,7 @@ static void wire_num16_to_str(rrset_dump_params_t *p)
// Write number.
int ret = snprintf(p->out, p->out_max, "%u", data);
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
out_len = ret;
......@@ -164,7 +164,7 @@ static void wire_num32_to_str(rrset_dump_params_t *p)
// Write number.
int ret = snprintf(p->out, p->out_max, "%u", data);
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
out_len = ret;
......@@ -196,7 +196,7 @@ static void wire_num48_to_str(rrset_dump_params_t *p)
// Write number.
int ret = snprintf(p->out, p->out_max, "%"PRIu64"", data);
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
out_len = ret;
......@@ -302,7 +302,7 @@ static void wire_type_to_str(rrset_dump_params_t *p)
// Write string.
int ret = snprintf(p->out, p->out_max, "%s", type);
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
out_len = ret;
......@@ -404,7 +404,7 @@ static void wire_data_encode_to_str(rrset_dump_params_t *p,
src_len = (ret - src_begin) < BLOCK_WIDTH ?
(ret - src_begin) : BLOCK_WIDTH;
if (src_len > p->out_max) {
if ((size_t)src_len > p->out_max) {
free(buf);
return;
}
......@@ -572,7 +572,7 @@ static void wire_text_to_str(rrset_dump_params_t *p)
} else {
// Unprintable character encode via \ddd notation.
int ret = snprintf(p->out, p->out_max,"\\%03u", ch);
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
......@@ -632,7 +632,7 @@ static void wire_timestamp_to_str(rrset_dump_params_t *p)
} else {
// Write timestamp only.
ret = snprintf(p->out, p->out_max, "%u", ntohl(data));
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
}
......@@ -660,7 +660,7 @@ static int time_to_human_str(char *out,
if (num > 0) {
ret = snprintf(out + total_len, out_len - total_len,
"%ud", num);
if (ret <= 0 || ret >= out_len - total_len) {
if (ret <= 0 || (size_t)ret >= out_len - total_len) {
return -1;
}
......@@ -673,7 +673,7 @@ static int time_to_human_str(char *out,
if (num > 0) {
ret = snprintf(out + total_len, out_len - total_len,
"%uh", num);
if (ret <= 0 || ret >= out_len - total_len) {
if (ret <= 0 || (size_t)ret >= out_len - total_len) {
return -1;
}
......@@ -686,7 +686,7 @@ static int time_to_human_str(char *out,
if (num > 0) {
ret = snprintf(out + total_len, out_len - total_len,
"%um", num);
if (ret <= 0 || ret >= out_len - total_len) {
if (ret <= 0 || (size_t)ret >= out_len - total_len) {
return -1;
}
......@@ -699,7 +699,7 @@ static int time_to_human_str(char *out,
if (num > 0 || total_len == 0) {
ret = snprintf(out + total_len, out_len - total_len,
"%us", num);
if (ret <= 0 || ret >= out_len - total_len) {
if (ret <= 0 || (size_t)ret >= out_len - total_len) {
return -1;
}
......@@ -737,7 +737,7 @@ static void wire_ttl_to_str(rrset_dump_params_t *p)
} else {
// Write timestamp only.
ret = snprintf(p->out, p->out_max, "%u", ntohl(data));
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
}
......@@ -798,7 +798,7 @@ static void wire_bitmap_to_str(rrset_dump_params_t *p)
ret = snprintf(p->out, p->out_max,
"%s", type);
}
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
out_len += ret;
......@@ -856,7 +856,7 @@ static void wire_dname_to_str(rrset_dump_params_t *p)
knot_dname_release(dname);
int ret = snprintf(p->out, p->out_max, "%s", dname_str);
free(dname_str);
if (ret < 0 || ret >= p->out_max) {
if (ret < 0 || (size_t)ret >= p->out_max) {
return;
}
out_len = ret;
......@@ -890,7 +890,7 @@ static void ptr_dname_to_str(rrset_dump_params_t *p)
char *dname_str = knot_dname_to_str(dname);
int ret = snprintf(p->out, p->out_max, "%s", dname_str);
free(dname_str);
if (ret < 0 || ret >= p->out_max) {
if (ret < 0 || (size_t)ret >= p->out_max) {
return;
}
out_len = ret;
......@@ -936,7 +936,7 @@ static void wire_apl_to_str(rrset_dump_params_t *p)
// Write address family with colon.
ret = snprintf(p->out, p->out_max, "%u:", family);
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
p->out += ret;
......@@ -992,7 +992,7 @@ static void wire_apl_to_str(rrset_dump_params_t *p)
// Write prefix length with forward slash.
ret = snprintf(p->out, p->out_max, "/%u", prefix);
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
p->out += ret;
......@@ -1071,7 +1071,7 @@ static void wire_loc_to_str(rrset_dump_params_t *p)
ret = snprintf(p->out, p->out_max, "%u %u %.*f %c %u %u %.*f %c",
d1, m1, (uint32_t)s1 != s1 ? 3 : 0, s1, lat_mark,
d2, m2, (uint32_t)s2 != s2 ? 3 : 0, s2, lon_mark);
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
p->out += ret;
......@@ -1106,7 +1106,7 @@ static void wire_loc_to_str(rrset_dump_params_t *p)
(uint32_t)size != size ? 2 : 0, size,
(uint32_t)hpre != hpre ? 2 : 0, hpre,
(uint32_t)vpre != vpre ? 2 : 0, vpre);
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
p->out += ret;
......@@ -1308,7 +1308,7 @@ static void wire_unknown_to_str(rrset_dump_params_t *p)
} else {
ret = snprintf(p->out, p->out_max, "\\# 0");
}
if (ret <= 0 || ret >= p->out_max) {
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
out_len = ret;
......@@ -1341,7 +1341,7 @@ static void wire_unknown_to_str(rrset_dump_params_t *p)
const size_t out_max, const knot_dump_style_t *style
#define DUMP_INIT rrset_dump_params_t p = { .style = style, .in = in, \
.in_max = in_len, .out = out, .out_max = out_max };
#define DUMP_END return (p.in_max == 0 ? p.total : KNOT_EPARSEFAIL);
#define DUMP_END return (p.in_max == 0 ? (int)p.total : KNOT_EPARSEFAIL);
#define CHECK_RET(p) if (p.ret != 0) return -1;
......@@ -1966,7 +1966,7 @@ int knot_rrset_txt_dump_header(const knot_rrset_t *rrset,
}
}
free(name);
if (ret < 0 || ret >= maxlen - len) {
if (ret < 0 || (size_t)ret >= maxlen - len) {
return KNOT_ESPACE;
}
len += ret;
......@@ -1988,7 +1988,7 @@ int knot_rrset_txt_dump_header(const knot_rrset_t *rrset,
ret = snprintf(dst + len, maxlen - len, "%u%c",
rrset->ttl, sep);
}
if (ret < 0 || ret >= maxlen - len) {
if (ret < 0 || (size_t)ret >= maxlen - len) {
return KNOT_ESPACE;
}
len += ret;
......@@ -2001,7 +2001,7 @@ int knot_rrset_txt_dump_header(const knot_rrset_t *rrset,
return KNOT_ESPACE;
}
ret = snprintf(dst + len, maxlen - len, "%-2s%c", buf, sep);
if (ret < 0 || ret >= maxlen - len) {
if (ret < 0 || (size_t)ret >= maxlen - len) {
return KNOT_ESPACE;
}
len += ret;
......@@ -2012,7 +2012,7 @@ int knot_rrset_txt_dump_header(const knot_rrset_t *rrset,
return KNOT_ESPACE;
}
ret = snprintf(dst + len, maxlen - len, "%s%c", buf, sep);
if (ret < 0 || ret >= maxlen - len) {
if (ret < 0 || (size_t)ret >= maxlen - len) {
return KNOT_ESPACE;
}
len += ret;
......
......@@ -243,6 +243,7 @@ static int dsa_create_pkey(const knot_key_params_t *params, EVP_PKEY *key)
*/
static size_t dsa_sign_size(const knot_dnssec_key_t *key)
{
(void)key;
// RFC 2536 (section 3 - DSA SIG Resource Record)
return 41;
}
......
......@@ -89,6 +89,7 @@ static char *strndup_with_suffix(const char *base, int length, char *suffix)
static void key_scan_noop(const scanner_t *s)
{
UNUSED(s);
}
/*!
......
......@@ -26,46 +26,6 @@
#include "common/descriptor.h"
#include "common/print.h"
void knot_rdata_dump(const knot_rrset_t *rrset, size_t rdata_pos)
{
#if defined(KNOT_ZONE_DEBUG) || defined(KNOT_RDATA_DEBUG)
#endif
}
//void knot_rrset_dump(const knot_rrset_t *rrset)
//{
//#if defined(KNOT_ZONE_DEBUG) || defined(KNOT_RRSET_DEBUG)
// fprintf(stderr, " ------- RRSET -------\n");
// fprintf(stderr, " %p\n", rrset);
// if (!rrset) {
// return;
// }
// char *name = knot_dname_to_str(rrset->owner);
// fprintf(stderr, " owner: %s\n", name);
// free(name);
// fprintf(stderr, " type: %u\n", rrset->type);
// fprintf(stderr, " class: %d\n", rrset->rclass);
// fprintf(stderr, " ttl: %d\n", rrset->ttl);
// fprintf(stderr, " RRSIGs:\n");
// if (rrset->rrsigs != NULL) {
// knot_rrset_dump(rrset->rrsigs);
// } else {
// fprintf(stderr, " none\n");
// }
// if (rrset->rdata == NULL) {
// fprintf(stderr, " NO RDATA!\n");
// fprintf(stderr, " ------- RRSET -------\n");
// return;
// }
// // TODO dump rdata
// fprintf(stderr, " ------- RRSET -------\n");
//#endif
//}
#if defined(KNOT_ZONE_DEBUG)
static void knot_node_dump_from_tree(knot_node_t *node, void *data)
{
......@@ -158,6 +118,8 @@ void knot_node_dump(knot_node_t *node)
free(rrsets);
//assert(node->owner->node == node);
dbg_node_detail("------- NODE --------\n");
#else
UNUSED(node);
#endif
}
......@@ -182,5 +144,7 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone)
NULL);
dbg_zone_detail("------- NSEC 3 tree -\n");
#else
UNUSED(zone);
#endif
}
......@@ -79,19 +79,6 @@
#include "util/utils.h"
#include "common/print.h"
/*!
* \brief Dumps RDATA of the given type.
*
* This function is empty if neither KNOT_ZONE_DEBUG nor KNOT_RDATA_DEBUG
* is defined.
*
* \param rdata RDATA to dump.
* \param type Type of the RDATA (needed to properly parse the RDATA).
* \param loaded_zone Set to <> 0 if the RDATA is part of a zone loaded into
* the server. Set to 0 otherwise.
*/
void knot_rdata_dump(const knot_rrset_t *rrset, size_t rdata_pos);
/*!
* \brief Dumps RRSet.
*
......
......@@ -321,7 +321,7 @@ int net_send(const net_t *net, const uint8_t *buf, const size_t buf_len)
} else {
// Send data.
if (sendto(net->sockfd, buf, buf_len, 0, net->srv->ai_addr,
net->srv->ai_addrlen) != buf_len) {
net->srv->ai_addrlen) != (ssize_t)buf_len) {
WARN("can't send query to %s\n", net->remote_str);
return KNOT_NET_ESEND;
}
......
......@@ -55,7 +55,7 @@ char* get_reverse_name(const char *name)
(num >> 0) & 0xFF, (num >> 8) & 0xFF,
(num >> 16) & 0xFF, (num >> 24) & 0xFF,
IPV4_REVERSE_DOMAIN);
if (ret < 0 || ret >= sizeof(buf)) {
if (ret < 0 || (size_t)ret >= sizeof(buf)) {
return NULL;
}
......@@ -71,7 +71,7 @@ char* get_reverse_name(const char *name)
right = (addr6.s6_addr)[i] & 0x0F;
ret = snprintf(pos, len, "%x.%x.", right, left);
if (ret < 0 || ret >= len) {
if (ret < 0 || (size_t)ret >= len) {
return NULL;
}
......@@ -81,7 +81,7 @@ char* get_reverse_name(const char *name)
// Add IPv6 reverse domain.
ret = snprintf(pos, len, "%s", IPV6_REVERSE_DOMAIN);
if (ret < 0 || ret >= len) {
if (ret < 0 || (size_t)ret >= len) {
return NULL;
}
......
......@@ -169,7 +169,7 @@ static int parse_name(const char *value, list *queries, const query_t *conf)
return KNOT_EOK;
}
static void host_help(int argc, char *argv[])
static void host_help()
{
printf("Usage: khost [-4] [-6] [-adhrsTvVw] [-c class] [-t type]\n"
" [-R retries] [-W time] name [server]\n\n"
......@@ -236,7 +236,7 @@ int host_parse(dig_params_t *params, int argc, char *argv[])
msg_enable_debug(1);
break;
case 'h':
host_help(argc, argv);
host_help();
params->stop = false;
return KNOT_EOK;
case 'r':
......@@ -291,7 +291,7 @@ int host_parse(dig_params_t *params, int argc, char *argv[])
}
break;
default:
host_help(argc, argv);
host_help();
return KNOT_ENOTSUP;
}
}
......@@ -311,7 +311,7 @@ int host_parse(dig_params_t *params, int argc, char *argv[])
}
break;
default:
host_help(argc, argv);
host_help();
return KNOT_ENOTSUP;
}
......
......@@ -603,14 +603,18 @@ int cmd_ttl(const char* lp, nsupdate_params_t *params)
int cmd_debug(const char* lp, nsupdate_params_t *params)
{
UNUSED(params);
DBG("%s: lp='%s'\n", __func__, lp);
msg_enable_debug(1);
return KNOT_EOK;
}
int cmd_prereq_domain(const char *lp, nsupdate_params_t *params, unsigned type)
{
UNUSED(type);
DBG("%s: lp='%s'\n", __func__, lp);
scanner_t *s = params->rrp;
int ret = parse_partial_rr(s, lp, PARSE_NODEFAULT|PARSE_NAMEONLY);
if (ret != KNOT_EOK) {
......@@ -622,6 +626,7 @@ int cmd_prereq_domain(const char *lp, nsupdate_params_t *params, unsigned type)
int cmd_prereq_rrset(const char *lp, nsupdate_params_t *params, unsigned type)
{
UNUSED(type);
DBG("%s: lp='%s'\n", __func__, lp);
scanner_t *rrp = params->rrp;
......@@ -830,6 +835,7 @@ int cmd_local(const char* lp, nsupdate_params_t *params)
int cmd_show(const char* lp, nsupdate_params_t *params)
{
DBG("%s: lp='%s'\n", __func__, lp);
/* Show current packet. */
if (!params->pkt) return KNOT_EOK;
printf("Outgoing update query:\n");
......@@ -841,6 +847,7 @@ int cmd_show(const char* lp, nsupdate_params_t *params)
int cmd_answer(const char* lp, nsupdate_params_t *params)
{
DBG("%s: lp='%s'\n", __func__, lp);
/* Show current answer. */
if (!params->resp) return KNOT_EOK;
printf("\nAnswer:\n");
......@@ -852,10 +859,10 @@ int cmd_answer(const char* lp, nsupdate_params_t *params)
int cmd_key(const char* lp, nsupdate_params_t *params)
{
DBG("%s: lp='%s'\n", __func__, lp);
char *kstr = strdup(lp); /* Convert to default format. */
if (!kstr) return KNOT_ENOMEM;
int ret = KNOT_EOK;
size_t len = strcspn(lp, SEP_CHARS);
if(kstr[len] == '\0') {
......@@ -879,13 +886,17 @@ int cmd_key(const char* lp, nsupdate_params_t *params)
int cmd_gsstsig(const char* lp, nsupdate_params_t *params)
{
UNUSED(params);
DBG("%s: lp='%s'\n", __func__, lp);
return KNOT_ENOTSUP;
}
int cmd_oldgsstsig(const char* lp, nsupdate_params_t *params)
{
UNUSED(params);
DBG("%s: lp='%s'\n", __func__, lp);
return KNOT_ENOTSUP;
}
......@@ -911,6 +922,8 @@ int cmd_origin(const char* lp, nsupdate_params_t *params)
int cmd_realm(const char* lp, nsupdate_params_t *params)
{
UNUSED(params);
DBG("%s: lp='%s'\n", __func__, lp);
return KNOT_ENOTSUP;
}
......@@ -46,8 +46,9 @@ static const style_t DEFAULT_STYLE_NSUPDATE = {
.show_footer = false,
};
static void parse_rr(const scanner_t *s) {
return; /* Dummy */
static void parse_rr(const scanner_t *s)
{
UNUSED(s);
}
static void parse_err(const scanner_t *s) {
......@@ -63,7 +64,7 @@ static int parser_set_default(scanner_t *s, const char *fmt, ...)
int n = vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
if (n < 0 || n >= sizeof(buf)) {
if (n < 0 || (size_t)n >= sizeof(buf)) {
return KNOT_ESPACE;
}
......@@ -138,11 +139,10 @@ void nsupdate_clean(nsupdate_params_t *params)
memset(params, 0, sizeof(*params));
}
static void nsupdate_help(int argc, char *argv[])
static void nsupdate_help()
{
printf("Usage: %s [-d] [-v] [-k keyfile | -y [hmac:]name:key] "
"[-p port] [-t timeout] [-r retries] [filename]\n",
argv[0]);
printf("Usage: knsupdate [-d] [-v] [-k keyfile | -y [hmac:]name:key]\n"
" [-p port] [-t timeout] [-r retries] [filename]\n");
}
int nsupdate_parse(nsupdate_params_t *params, int argc, char *argv[])
......@@ -175,7 +175,7 @@ int nsupdate_parse(nsupdate_params_t *params, int argc, char *argv[])
msg_enable_debug(1);
break;
case 'h':
nsupdate_help(argc, argv);
nsupdate_help();
params->stop = true;
return KNOT_EOK;
case 'v':
......@@ -210,7 +210,7 @@ int nsupdate_parse(nsupdate_params_t *params, int argc, char *argv[])
if (ret != KNOT_EOK) return ret;
break;
default:
nsupdate_help(argc, argv);
nsupdate_help();
return KNOT_ENOTSUP;
}
}
......@@ -220,7 +220,8 @@ int nsupdate_parse(nsupdate_params_t *params, int argc, char *argv[])
params->retries = 0;
} else {
/* If wait/tries < 1 s, set 1 second for each try. */
if (params->wait > 0 && params->wait < ( 1 + params->retries)) {
if (params->wait > 0 &&
(uint32_t)params->wait < ( 1 + params->retries)) {
params->wait = 1;
} else {
params->wait /= (1 + params->retries);
......
......@@ -55,7 +55,7 @@ static int load_settings(file_loader_t *fl)
settings_name = malloc(buf_len);
ret = snprintf(settings_name, buf_len, "ZONE DEFAULTS <%s>",
fl->file_name);
if (ret < 0 || ret >= buf_len) {
if (ret < 0 || (size_t)ret >= buf_len) {
free(settings_name);
return -1;
}
......@@ -137,7 +137,7 @@ file_loader_t* file_loader_create(const char *file_name,
"$ORIGIN %s\n"
"$TTL %u\n",
zone_origin, default_ttl);
if (ret <= 0 || ret >= sizeof(fl->settings_buffer)) {
if (ret <= 0 || (size_t)ret >= sizeof(fl->settings_buffer)) {
file_loader_free(fl);
return NULL;
}
......
This diff is collapsed.
......@@ -266,7 +266,7 @@
// Overflow check: 10*(s->number64) + fc - ASCII_0 <= UINT64_MAX
if ((s->number64 < (UINT64_MAX / 10)) || // Dominant fast check.
((s->number64 == (UINT64_MAX / 10)) && // Marginal case.
(fc <= (UINT64_MAX % 10) + ASCII_0)
((uint8_t)fc <= (UINT64_MAX % 10) + ASCII_0)
)
) {
s->number64 *= 10;
......@@ -617,7 +617,8 @@
sizeof(s->include_filename));
// Check for correct string copy.
if (strlen(s->include_filename) != rdata_tail - s->r_data) {
if (strlen(s->include_filename) !=
(size_t)(rdata_tail - s->r_data)) {
SCANNER_ERROR(ZSCANNER_EBAD_INCLUDE_FILENAME);
fhold; fgoto err_line;
}
......