Drop h and hh length modifiers from printf format strings.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 11 May 2014 14:35:37 +0000 (16:35 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 11 May 2014 14:35:37 +0000 (16:35 +0200)
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.

src/multicast_device.c
src/protocol_auth.c
src/route.c
src/subnet.c

index ad0185a3797f1000c4933102a83b958a497ce380..ea43e2c04a6efbaf4abb555ea97b098ce5fd9fe6 100644 (file)
@@ -1,7 +1,7 @@
 /*
     device.c -- multicast socket
     Copyright (C) 2002-2005 Ivo Timmermans,
-                  2002-2013 Guus Sliepen <guus@tinc-vpn.org>
+                  2002-2014 Guus Sliepen <guus@tinc-vpn.org>
 
     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;
index 66b7d037ffe6b16b8bee628adade17db4a533563..971341f7e4a37cbf8d044131c5a4dad83a87c837 100644 (file)
@@ -1,7 +1,7 @@
 /*
     protocol_auth.c -- handle the meta-protocol, authentication
     Copyright (C) 1999-2005 Ivo Timmermans,
-                  2000-2013 Guus Sliepen <guus@tinc-vpn.org>
+                  2000-2014 Guus Sliepen <guus@tinc-vpn.org>
 
     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)
index e196f44873854b75a882638ed1f5bd546a1ffc39..c11267b159efe51fe11bd8629807859b528692a6 100644 (file)
@@ -1,7 +1,7 @@
 /*
     route.c -- routing
     Copyright (C) 2000-2005 Ivo Timmermans,
-                  2000-2013 Guus Sliepen <guus@tinc-vpn.org>
+                  2000-2014 Guus Sliepen <guus@tinc-vpn.org>
 
     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]);
 
index f8a34614963711ae8ab17028900b1099fac4e7a9..6e8ad07f9da31b909e927017d0d7ed97a019ba92 100644 (file)
@@ -1,6 +1,6 @@
 /*
     subnet.c -- handle subnet lookups and lists
-    Copyright (C) 2000-2013 Guus Sliepen <guus@tinc-vpn.org>,
+    Copyright (C) 2000-2014 Guus Sliepen <guus@tinc-vpn.org>,
                   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]),