Skip to content

Commit

Permalink
Add casts for output formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
blechschmidt committed Apr 9, 2018
1 parent 18a341a commit 89d754b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ char *dns_opcode2str(dns_opcode opcode)
case DNS_OPCODE_UPDATE:
return "UPDATE";
default:
snprintf(numbuf, sizeof(numbuf), "%" PRIu16, opcode);
snprintf(numbuf, sizeof(numbuf), "%" PRIu16, (uint16_t)opcode);
return numbuf;
}
}
Expand Down Expand Up @@ -818,7 +818,7 @@ char *dns_rcode2str(dns_rcode rcode)
case DNS_RCODE_BADCOOKIE:
return "BADCOOKIE";
default:
snprintf(numbuf, sizeof(numbuf), "%" PRIu16, rcode);
snprintf(numbuf, sizeof(numbuf), "%" PRIu16, (uint16_t)rcode);
return numbuf;
}
}
Expand Down Expand Up @@ -910,7 +910,7 @@ char *dns_record_type2str(dns_record_type type)
case DNS_REC_URI:
return "URI";
default:
snprintf(numbuf, sizeof(numbuf), "%" PRIu16, type);
snprintf(numbuf, sizeof(numbuf), "%" PRIu16, (uint16_t)type);
return numbuf;
}
}
Expand Down Expand Up @@ -1398,7 +1398,7 @@ char* dns_raw_record_data2str(dns_record_t *record, uint8_t *begin, uint8_t *end
{
goto raw;
}
int written = sprintf(ptr, "%" PRIu8 " ", record->data.raw[0] >> 7);
int written = sprintf(ptr, "%" PRIu8 " ", (uint8_t)(record->data.raw[0] >> 7));
if(written < 0)
{
return buf;
Expand All @@ -1408,7 +1408,7 @@ char* dns_raw_record_data2str(dns_record_t *record, uint8_t *begin, uint8_t *end
*(ptr++) = ' ';
*(ptr++) = '"';
dns_print_readable(&ptr, sizeof(buf), record->data.raw + 2 + record->data.raw[1],
record->length - record->data.raw[1] - 2);
(size_t)(record->length - record->data.raw[1] - 2));
*(ptr++) = '"';
*ptr = 0;
break;
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ void do_read(uint8_t *offset, size_t len, struct sockaddr_storage *recvaddr)
else
{
fprintf(context.outfile,
"%s%s%s %s %" PRIu16 " %s %s\n",
"%s%s%s %s %" PRIu32 " %s %s\n",
section_separator,
context.format.indent_sections ? "\t" : "",
dns_name2str(&rec.name),
Expand Down

0 comments on commit 89d754b

Please sign in to comment.