From 5989a29d7b53b25e8ed2f60bc3a0e089e423c02c Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 3 Jun 2011 00:46:56 +0200 Subject: [PATCH] Fix format strings for Windows. Windows doesn't like %zd, so cast (s)size_t to int. Also, some shorts were incorrectly printed with %d instead of %hd. --- src/net_socket.c | 2 +- src/node.c | 6 +++--- src/route.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/net_socket.c b/src/net_socket.c index d470fef5..a1dfcd35 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -456,7 +456,7 @@ static void handle_meta_write(int sock, short events, void *data) { ssize_t outlen = send(c->socket, c->outbuf.data + c->outbuf.offset, c->outbuf.len - c->outbuf.offset, 0); if(outlen <= 0) { - logger(LOG_ERR, "Onoes, outlen = %zd (%s)", outlen, strerror(errno)); + logger(LOG_ERR, "Onoes, outlen = %d (%s)", (int)outlen, strerror(errno)); terminate_connection(c, c->status.active); return; } diff --git a/src/node.c b/src/node.c index dbc5a7eb..96b557a1 100644 --- a/src/node.c +++ b/src/node.c @@ -171,11 +171,11 @@ bool dump_nodes(connection_t *c) { for(node = node_tree->head; node; node = node->next) { n = node->data; - send_request(c, "%d %d %s at %s cipher %d digest %d maclength %zd compression %d options %x status %04x nexthop %s via %s distance %d pmtu %d (min %d max %d)", CONTROL, REQ_DUMP_NODES, + send_request(c, "%d %d %s at %s cipher %d digest %d maclength %d compression %d options %x status %04x nexthop %s via %s distance %d pmtu %hd (min %hd max %hd)", CONTROL, REQ_DUMP_NODES, n->name, n->hostname, cipher_get_nid(&n->outcipher), - digest_get_nid(&n->outdigest), digest_length(&n->outdigest), n->outcompression, + digest_get_nid(&n->outdigest), (int)digest_length(&n->outdigest), n->outcompression, n->options, bitfield_to_int(&n->status, sizeof n->status), n->nexthop ? n->nexthop->name : "-", - n->via ? n->via->name : "-", n->distance, n->mtu, n->minmtu, n->maxmtu); + n->via ? n->via->name ?: "-" : "-", n->distance, n->mtu, n->minmtu, n->maxmtu); } return send_request(c, "%d %d", CONTROL, REQ_DUMP_NODES); diff --git a/src/route.c b/src/route.c index 618b0ab9..0b2d22eb 100644 --- a/src/route.c +++ b/src/route.c @@ -347,7 +347,7 @@ static void fragment_ipv4_packet(node_t *dest, vpn_packet_t *packet) { todo = ntohs(ip.ip_len) - ip_size; if(ether_size + ip_size + todo != packet->len) { - ifdebug(TRAFFIC) logger(LOG_WARNING, "Length of packet (%d) doesn't match length in IPv4 header (%zd)", packet->len, ether_size + ip_size + todo); + ifdebug(TRAFFIC) logger(LOG_WARNING, "Length of packet (%d) doesn't match length in IPv4 header (%d)", packet->len, (int)(ether_size + ip_size + todo)); return; } -- 2.20.1