Commit 244c7238 authored by Daniel Salzman's avatar Daniel Salzman

fix some unused variables and comparison of different types II

parent f74cc540
......@@ -42,7 +42,7 @@ static knot_lookup_table_t dns_classes[] = {
*/
static const rdata_descriptor_t rdata_descriptors[] = {
[0] = { { KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END } },
KNOT_RDATA_WF_END }, "" },
[KNOT_RRTYPE_A] = { { 4, KNOT_RDATA_WF_END }, "A" },
[KNOT_RRTYPE_NS] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
KNOT_RDATA_WF_END }, "NS" },
......@@ -159,7 +159,7 @@ int knot_rrtype_to_string(const uint16_t rrtype,
ret = snprintf(out, out_len, "TYPE%u", rrtype);
}
if (ret <= 0 || ret >= out_len) {
if (ret <= 0 || (size_t)ret >= out_len) {
return -1;
} else {
return ret;
......@@ -168,8 +168,8 @@ int knot_rrtype_to_string(const uint16_t rrtype,
int knot_rrtype_from_string(const char *name, uint16_t *num)
{
int i;
char *end;
unsigned i;
unsigned long n;
// Try to find name in descriptors table.
......@@ -212,7 +212,7 @@ int knot_rrclass_to_string(const uint16_t rrclass,
ret = snprintf(out, out_len, "CLASS%u", rrclass);
}
if (ret <= 0 || ret >= out_len) {
if (ret <= 0 || (size_t)ret >= out_len) {
return -1;
} else {
return ret;
......
......@@ -226,6 +226,7 @@ exit_status () {
int
bail_out (int ignore, const char *fmt, ...) {
(void)ignore;
va_list args;
va_start(args, fmt);
printf("Bail out! ");
......@@ -252,6 +253,7 @@ skippy (int n, const char *fmt, ...) {
void
ctodo (int ignore, const char *fmt, ...) {
(void)ignore;
va_list args;
va_start(args, fmt);
todo_mesg = vstrdupf(fmt, args);
......
......@@ -27,6 +27,7 @@
static void *mm_malloc(void *ctx, size_t n)
{
(void)ctx;
return malloc(n);
}
......
......@@ -61,9 +61,9 @@ void txt_print(const uint8_t *data, unsigned length)
void bit_printf(const uint8_t *data, unsigned length, printf_t print_handler)
{
unsigned char mask = 0x01;
int ptr = 0;
unsigned ptr;
int bit = 0;
for (; ptr < length; ptr++) {
for (ptr = 0; ptr < length; ptr++) {
for (bit = 7; bit >= 0; bit--) {
if ((mask << bit) & (unsigned char)*(data + ptr)) {
print_handler("1");
......
......@@ -71,7 +71,7 @@ static slab_depot_t _depot_g; /*! \brief Global slab depot. */
*/
static void* slab_depot_alloc(size_t bufsize)
{
void *page = 0;
void *page = 0;
#ifdef MEM_SLAB_DEPOT
if (_depot_g.available) {
for (int i = _depot_g.available - 1; i > -1 ; --i) {
......@@ -91,12 +91,14 @@ static void* slab_depot_alloc(size_t bufsize)
}
#else // MEM_SLAB_DEPOT
if(posix_memalign(&page, SLAB_SZ, SLAB_SZ) == 0) {
((slab_t*)page)->bufsize = 0;
} else {
page = 0;
}
(void)bufsize;
if(posix_memalign(&page, SLAB_SZ, SLAB_SZ) == 0) {
((slab_t*)page)->bufsize = 0;
} else {
page = 0;
}
#endif // MEM_SLAB_DEPOT
(void)bufsize;
return page;
}
......@@ -155,7 +157,7 @@ void __attribute__ ((constructor)) slab_init()
// Compute slab page mask
SLAB_MASK = 0;
for (int i = 0; i < slab_logsz; ++i) {
for (unsigned i = 0; i < slab_logsz; ++i) {
SLAB_MASK |= 1 << i;
}
SLAB_MASK = ~SLAB_MASK;
......
......@@ -154,7 +154,7 @@ static int rrl_clsname(char *dst, size_t maxlen, uint8_t cls,
}
/* Write to wire */
if (nb > maxlen) return KNOT_ESPACE;
if ((size_t)nb > maxlen) return KNOT_ESPACE;
if (memcpy(dst, n, nb) == NULL) {
dbg_rrl("%s: failed to serialize name=%p len=%u\n",
__func__, n, nb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment