Get rid of unkown format specifiers on windows

This commit is contained in:
Willem Toorop 2016-01-11 12:11:17 +01:00
parent a970dd420f
commit 39f7e87f1a
6 changed files with 31 additions and 27 deletions

View File

@ -1025,6 +1025,10 @@ AH_BOTTOM([
* See: https://support.microsoft.com/en-us/kb/111855
*/
#define FD_SETSIZE 1024
#define PRIsz "%Iu"
#else
#define PRIsz "%zu"
#endif
#include <stdint.h>

View File

@ -1761,15 +1761,15 @@ getdns_context_set_dns_root_servers(
else if (addr_bd->size == 16 &&
inet_ntop(AF_INET6, addr_bd->data, dst, sizeof(dst)))
fprintf(fh, ". NS %zu.root-servers.getdnsapi.net.\n"
"%zu.root-servers.getdnsapi.net. AAAA %s\n",
fprintf(fh,". NS "PRIsz".root-servers.getdnsapi.net.\n"
PRIsz".root-servers.getdnsapi.net. AAAA %s\n",
i, i, dst);
else if (addr_bd->size == 4 &&
inet_ntop(AF_INET, addr_bd->data, dst, sizeof(dst)))
fprintf(fh, ". NS %zu.root-servers.getdnsapi.net.\n"
"%zu.root-servers.getdnsapi.net. A %s\n",
fprintf(fh,". NS "PRIsz".root-servers.getdnsapi.net.\n"
PRIsz".root-servers.getdnsapi.net. A %s\n",
i, i, dst);
}
fclose(fh);

View File

@ -44,7 +44,7 @@
\
gettimeofday(&tv, NULL); \
gmtime_r(&tv.tv_sec, &tm); \
strftime(buf, 10, "%T", &tm); \
strftime(buf, 10, "%H:%M:%S", &tm); \
fprintf(stderr, "[%s.%.6d] ", buf, (int)tv.tv_usec); \
fprintf(stderr, __VA_ARGS__); \
} while (0)
@ -56,7 +56,7 @@
\
gettimeofday(&tv, NULL); \
gmtime_r(&tv.tv_sec, &tm); \
strftime(buf, 10, "%T", &tm); \
strftime(buf, 10, "%H:%M:%S", &tm); \
fprintf(stderr, "[%s.%.6d] ", buf, (int)tv.tv_usec); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \

View File

@ -839,7 +839,7 @@ static chain_head *add_rrset2val_chain(struct mem_funcs *mf,
dname_len = *labels - last_label[-1] + 1;
head_sz = (sizeof(chain_head) + dname_len + 7) / 8 * 8;
node_count = last_label - labels - max_labels;
DEBUG_SEC( "%zu labels in common. %zu labels to allocate\n"
DEBUG_SEC( PRIsz" labels in common. "PRIsz" labels to allocate\n"
, max_labels, node_count);
if (! (region = GETDNS_XMALLOC(*mf, uint8_t, head_sz +
@ -1627,7 +1627,7 @@ static int _getdns_verify_rrsig(struct mem_funcs *mf,
/* More space needed for val_rrset */
val_rrset = GETDNS_XMALLOC(*mf, _getdns_rr_iter, n_rrs);
}
DEBUG_SEC( "sizes: %zu rrs, %zu bytes for validation buffer\n"
DEBUG_SEC( "sizes: "PRIsz" rrs, "PRIsz" bytes for validation buffer\n"
, n_rrs, valbuf_sz);
qsort(val_rrset, n_rrs, sizeof(_getdns_rr_iter), _rr_iter_rdata_cmp);
@ -1686,7 +1686,7 @@ static int _getdns_verify_rrsig(struct mem_funcs *mf,
gldns_buffer_write_u16_at(&valbuf, pos,
(uint16_t)(gldns_buffer_position(&valbuf) - pos - 2));
}
DEBUG_SEC( "written to valbuf: %zu bytes\n"
DEBUG_SEC( "written to valbuf: "PRIsz" bytes\n"
, gldns_buffer_position(&valbuf));
assert(gldns_buffer_position(&valbuf) <= valbuf_sz);
@ -2107,7 +2107,7 @@ static int ds_authenticates_keys(struct mem_funcs *mf,
if (digest_buf != digest_buf_spc)
GETDNS_FREE(*mf, digest_buf);
DEBUG_SEC("HASH length mismatch %zu != %zu\n",
DEBUG_SEC("HASH length mismatch "PRIsz" != "PRIsz"\n",
digest_len, ds->rr_i.nxt - ds->rr_i.rr_type-14);
continue;
}
@ -2130,7 +2130,7 @@ static int ds_authenticates_keys(struct mem_funcs *mf,
max_supported_result = SIGNATURE_VERIFIED | keytag;
}
}
DEBUG_SEC("valid_dsses: %zu, supported_dsses: %zu\n",
DEBUG_SEC("valid_dsses: "PRIsz", supported_dsses: "PRIsz"\n",
valid_dsses, supported_dsses);
if (valid_dsses && !supported_dsses)
return NO_SUPPORTED_ALGORITHMS;
@ -3135,7 +3135,7 @@ static void check_chain_complete(chain_head *chain)
rrset_iter tas_iter;
if ((o = count_outstanding_requests(chain)) > 0) {
DEBUG_SEC("%zu outstanding requests\n", o);
DEBUG_SEC(PRIsz" outstanding requests\n", o);
return;
}
DEBUG_SEC("Chain done!\n");
@ -3410,7 +3410,7 @@ getdns_validate_dnssec(getdns_list *records_to_validate,
for (i = 0; !getdns_list_get_dict(records_to_validate,i,&reply); i++) {
DEBUG_SEC("REPLY %zu, r: %d\n", i, r);
DEBUG_SEC("REPLY "PRIsz", r: %d\n", i, r);
if (to_val != to_val_buf)
GETDNS_FREE(*mf, to_val);
to_val_len = sizeof(to_val_buf);
@ -3437,7 +3437,7 @@ getdns_validate_dnssec(getdns_list *records_to_validate,
break;
}
}
DEBUG_SEC("REPLY %zu, r: %d\n", i, r);
DEBUG_SEC("REPLY "PRIsz", r: %d\n", i, r);
exit_free_to_val:
if (to_val != to_val_buf)

View File

@ -415,13 +415,13 @@ _getdns_verify_pinset_match(const sha256_pin_t *pinset,
/* digest the cert with sha256 */
len = i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), NULL);
if (len > sizeof(raw)) {
DEBUG_STUB("--- %s: pubkey %d is larger than %ld octets\n",
DEBUG_STUB("--- %s: pubkey %d is larger than "PRIsz" octets\n",
__FUNCTION__, i, sizeof(raw));
continue;
}
i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &next);
if (next - raw != len) {
DEBUG_STUB("--- %s: pubkey %d claimed it needed %d octets, really needed %ld\n",
DEBUG_STUB("--- %s: pubkey %d claimed it needed %d octets, really needed "PRIsz"\n",
__FUNCTION__, i, len, next - raw);
continue;
}
@ -430,7 +430,7 @@ _getdns_verify_pinset_match(const sha256_pin_t *pinset,
/* compare it */
for (p = pinset; p; p = p->next)
if (0 == memcmp(buf, p->pin, sizeof(p->pin))) {
DEBUG_STUB("--- %s: pubkey %d matched pin %p (%ld)!\n",
DEBUG_STUB("--- %s: pubkey %d matched pin %p ("PRIsz")!\n",
__FUNCTION__, i, p, sizeof(p->pin));
return GETDNS_RETURN_GOOD;
} else

View File

@ -588,7 +588,7 @@ static getdns_return_t validate_chain(getdns_dict *response)
if ((r = getdns_list_set_dict(to_validate, 0, reply)))
goto error;
printf("reply %u, dnssec_status: ", (unsigned)i);
printf("reply "PRIsz", dnssec_status: ", i);
switch ((s = getdns_validate_dnssec(
to_validate, validation_chain, trust_anchor))) {
@ -646,7 +646,7 @@ void callback(getdns_context *context, getdns_callback_type_t callback_type,
else {
fprintf(stderr,
"An error occurred: The callback got a callback_type of %d. Exiting.\n",
callback_type);
(int)callback_type);
fprintf(stderr,
"Error : '%s'\n",
getdns_get_errorstr_by_id(callback_type));
@ -737,7 +737,7 @@ getdns_return_t parse_args(int argc, char **argv)
(arg[4] == '=' || arg[4] == '\0')) {
if ((r = set_cookie(extensions, arg+4))) {
fprintf(stderr, "Could not set cookie:"
" %d", r);
" %d", (int)r);
break;
}
} else if (strncmp(arg+1, "specify_class=", 14) == 0) {
@ -777,7 +777,7 @@ getdns_return_t parse_args(int argc, char **argv)
} else if ((r = getdns_dict_set_int(extensions, arg+1,
GETDNS_EXTENSION_TRUE))) {
fprintf(stderr, "Could not set extension "
"\"%s\": %d\n", argv[i], r);
"\"%s\": %d\n", argv[i], (int)r);
break;
}
continue;
@ -912,7 +912,7 @@ getdns_return_t parse_args(int argc, char **argv)
if (r = getdns_list_set_dict(pubkey_pinset, pincount++,
pubkey_pin), r) {
fprintf(stderr, "Failed to add pin to pinset (error %d: %s)\n",
r, getdns_get_errorstr_by_id(r));
(int)r, getdns_get_errorstr_by_id(r));
getdns_dict_destroy(pubkey_pin);
pubkey_pin = NULL;
return GETDNS_RETURN_GENERIC_ERROR;
@ -1122,11 +1122,11 @@ next: ;
/* apply the accumulated pubkey pinset to all upstreams: */
for (i = 0; i < upstream_count; i++) {
if (r = getdns_list_get_dict(upstream_list, i, &upstream), r) {
fprintf(stderr, "Failed to get upstream %lu when adding pinset\n", (long unsigned int)i);
fprintf(stderr, "Failed to get upstream "PRIsz" when adding pinset\n", i);
return r;
}
if (r = getdns_dict_set_list(upstream, "tls_pubkey_pinset", pubkey_pinset), r) {
fprintf(stderr, "Failed to set pubkey pinset on upstream %lu\n", (long unsigned int)i);
fprintf(stderr, "Failed to set pubkey pinset on upstream "PRIsz"\n", i);
return r;
}
}
@ -1191,7 +1191,7 @@ getdns_return_t do_the_call(void)
if (r == GETDNS_RETURN_GOOD && !batch_mode)
getdns_context_run(context);
if (r != GETDNS_RETURN_GOOD)
fprintf(stderr, "An error occurred: %d '%s'\n", r,
fprintf(stderr, "An error occurred: %d '%s'\n", (int)r,
getdns_get_errorstr_by_id(r));
} else {
switch (calltype) {
@ -1216,7 +1216,7 @@ getdns_return_t do_the_call(void)
break;
}
if (r != GETDNS_RETURN_GOOD) {
fprintf(stderr, "An error occurred: %d '%s'\n", r,
fprintf(stderr, "An error occurred: %d '%s'\n", (int)r,
getdns_get_errorstr_by_id(r));
return r;
}
@ -1301,7 +1301,7 @@ main(int argc, char **argv)
name = the_root;
if ((r = getdns_context_create(&context, 1))) {
fprintf(stderr, "Create context failed: %d\n", r);
fprintf(stderr, "Create context failed: %d\n", (int)r);
return r;
}
my_eventloop_init(&my_loop);