From: Guus Sliepen Date: Sun, 11 May 2014 14:35:37 +0000 (+0200) Subject: Drop h and hh length modifiers from printf format strings. X-Git-Tag: release-1.0.24~4 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=8fce1eacd7fd7496a740be3ffc236fde37c681d7;p=tinc Drop h and hh length modifiers from printf format strings. C already guarantees that chars and shorts get passed as int. The few uses in tinc are mainly to print fields of struct addrinfo, and fields like ai_family have different sizes on different platforms, which actually caused some warnings to be generated. --- diff --git a/src/multicast_device.c b/src/multicast_device.c index ad0185a3..ea43e2c0 100644 --- a/src/multicast_device.c +++ b/src/multicast_device.c @@ -1,7 +1,7 @@ /* device.c -- multicast socket Copyright (C) 2002-2005 Ivo Timmermans, - 2002-2013 Guus Sliepen + 2002-2014 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -140,7 +140,7 @@ static bool setup_device(void) { #endif default: - logger(LOG_ERR, "Multicast for address family %hx unsupported", ai->ai_family); + logger(LOG_ERR, "Multicast for address family %x unsupported", ai->ai_family); closesocket(device_fd); free(host); return false; diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 66b7d037..971341f7 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -1,7 +1,7 @@ /* protocol_auth.c -- handle the meta-protocol, authentication Copyright (C) 1999-2005 Ivo Timmermans, - 2000-2013 Guus Sliepen + 2000-2014 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -107,7 +107,7 @@ static bool send_proxyrequest(connection_t *c) { i += 2; c->tcplen += 22; } else { - logger(LOG_ERR, "Address family %hx not supported for SOCKS 5 proxies!", c->address.sa.sa_family); + logger(LOG_ERR, "Address family %x not supported for SOCKS 5 proxies!", c->address.sa.sa_family); return false; } if(i > len) diff --git a/src/route.c b/src/route.c index e196f448..c11267b1 100644 --- a/src/route.c +++ b/src/route.c @@ -1,7 +1,7 @@ /* route.c -- routing Copyright (C) 2000-2005 Ivo Timmermans, - 2000-2013 Guus Sliepen + 2000-2014 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -197,7 +197,7 @@ static void learn_mac(mac_t *address) { /* If we don't know this MAC address yet, store it */ if(!subnet) { - ifdebug(TRAFFIC) logger(LOG_INFO, "Learned new MAC address %hx:%hx:%hx:%hx:%hx:%hx", + ifdebug(TRAFFIC) logger(LOG_INFO, "Learned new MAC address %x:%x:%x:%x:%x:%x", address->x[0], address->x[1], address->x[2], address->x[3], address->x[4], address->x[5]); diff --git a/src/subnet.c b/src/subnet.c index f8a34614..6e8ad07f 100644 --- a/src/subnet.c +++ b/src/subnet.c @@ -1,6 +1,6 @@ /* subnet.c -- handle subnet lookups and lists - Copyright (C) 2000-2013 Guus Sliepen , + Copyright (C) 2000-2014 Guus Sliepen , 2000-2005 Ivo Timmermans This program is free software; you can redistribute it and/or modify @@ -351,7 +351,7 @@ bool net2str(char *netstr, int len, const subnet_t *subnet) { switch (subnet->type) { case SUBNET_MAC: - snprintf(netstr, len, "%hx:%hx:%hx:%hx:%hx:%hx#%d", + snprintf(netstr, len, "%x:%x:%x:%x:%x:%x#%d", subnet->net.mac.address.x[0], subnet->net.mac.address.x[1], subnet->net.mac.address.x[2], @@ -362,7 +362,7 @@ bool net2str(char *netstr, int len, const subnet_t *subnet) { break; case SUBNET_IPV4: - snprintf(netstr, len, "%hu.%hu.%hu.%hu/%d#%d", + snprintf(netstr, len, "%u.%u.%u.%u/%d#%d", subnet->net.ipv4.address.x[0], subnet->net.ipv4.address.x[1], subnet->net.ipv4.address.x[2], @@ -372,7 +372,7 @@ bool net2str(char *netstr, int len, const subnet_t *subnet) { break; case SUBNET_IPV6: - snprintf(netstr, len, "%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx/%d#%d", + snprintf(netstr, len, "%x:%x:%x:%x:%x:%x:%x:%x/%d#%d", ntohs(subnet->net.ipv6.address.x[0]), ntohs(subnet->net.ipv6.address.x[1]), ntohs(subnet->net.ipv6.address.x[2]),