[PATCH]: fix x86_64 compile warnings in pcsc_funcs.c

Kel Modderman kel
Wed Dec 26 06:08:42 PST 2007


The following compilation warnings can be observed on x86_64 when 
CONFIG_PCSC=y is set:

cc -MMD -O2 -Wall -g -I. -I../src -I../src/crypto -I../src/utils -I../src/common -I../src/rsn_supp -I../src/drivers/driver_madwifi/ -DCONFIG_BACKEND_FILE -DCONFIG_DRIVER_HOSTAP -DCONFIG_DRIVER_WEXT -DCONFIG_DRIVER_MADWIFI -DCONFIG_DRIVER_ATMEL -DCONFIG_DRIVER_WIRED -DCONFIG_DRIVER_TEST -DEAP_TLS -DEAP_PEAP -DEAP_TTLS -DEAP_MD5 -DEAP_MSCHAPv2 -DEAP_GTC -DEAP_OTP -DEAP_SIM -DEAP_LEAP -DEAP_PSK -DEAP_AKA -DEAP_TLV -DEAP_PAX -DIEEE8021X_EAPOL -DPCSC_FUNCS -I/usr/include/PCSC -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL -DPKCS12_FUNCS -DCONFIG_SMARTCARD -DINTERNAL_SHA256 -DCONFIG_WIRELESS_EXTENSION -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX -DCONFIG_CTRL_IFACE_DBUS -DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include   -DDBUS_VERSION_MAJOR=1 -DDBUS_VERSION_MINOR=1 -DCONFIG_READLINE -DCONFIG_PEERKEY -DCONFIG_NO_T_PRF -DCONFIG_DEBUG_FILE   -c -o ../src/utils/pcsc_funcs.o ../src/utils/pcsc_funcs.c
../src/utils/pcsc_funcs.c: In function 'scard_read_record':
../src/utils/pcsc_funcs.c:851: warning: format '%d' expects type 'int', but 
argument 3 has type 'size_t'
../src/utils/pcsc_funcs.c:851: warning: format '%d' expects type 'int', but 
argument 4 has type 'size_t'
../src/utils/pcsc_funcs.c: In function 'scard_read_file':
../src/utils/pcsc_funcs.c:894: warning: format '%d' expects type 'int', but 
argument 3 has type 'size_t'
../src/utils/pcsc_funcs.c:894: warning: format '%d' expects type 'int', but 
argument 4 has type 'size_t'
../src/utils/pcsc_funcs.c: In function 'scard_get_imsi':
../src/utils/pcsc_funcs.c:972: warning: format '%d' expects type 'int', but 
argument 3 has type 'size_t'
../src/utils/pcsc_funcs.c:986: warning: format '%d' expects type 'int', but 
argument 3 has type 'size_t'
../src/utils/pcsc_funcs.c:992: warning: format '%d' expects type 'int', but 
argument 3 has type 'size_t'
../src/utils/pcsc_funcs.c:992: warning: format '%d' expects type 'int', but 
argument 4 has type 'size_t'
../src/utils/pcsc_funcs.c: In function 'scard_gsm_auth':
../src/utils/pcsc_funcs.c:1075: warning: format '%d' expects type 'int', but 
argument 3 has type 'size_t'
../src/utils/pcsc_funcs.c:1089: warning: format '%d' expects type 'int', but 
argument 3 has type 'size_t'
../src/utils/pcsc_funcs.c:1098: warning: format '%d' expects type 'int', but 
argument 3 has type 'size_t'
../src/utils/pcsc_funcs.c: In function 'scard_umts_auth':
../src/utils/pcsc_funcs.c:1180: warning: format '%d' expects type 'int', but 
argument 3 has type 'size_t'

The attached patch makes them go away.

Signed-off-by: Kel Modderman <kel at otaku42.de>
---
--- a/src/utils/pcsc_funcs.c
+++ b/src/utils/pcsc_funcs.c
@@ -848,7 +848,8 @@
 	}
 	if (blen != len + 2) {
 		wpa_printf(MSG_DEBUG, "SCARD: record read returned unexpected "
-			   "length %d (expected %d)", blen, len + 2);
+			   "length %ld (expected %ld)",
+			   (long) blen, (long) len + 2);
 		os_free(buf);
 		return -3;
 	}
@@ -891,7 +892,8 @@
 	}
 	if (blen != len + 2) {
 		wpa_printf(MSG_DEBUG, "SCARD: file read returned unexpected "
-			   "length %d (expected %d)", blen, len + 2);
+			   "length %ld (expected %ld)",
+			   (long) blen, (long) len + 2);
 		os_free(buf);
 		return -3;
 	}
@@ -969,7 +971,7 @@
 		return -1;
 	if (blen < 4) {
 		wpa_printf(MSG_WARNING, "SCARD: too short (GSM) EF-IMSI "
-			   "header (len=%d)", blen);
+			   "header (len=%ld)", (long) blen);
 		return -2;
 	}
 
@@ -982,14 +984,14 @@
 		blen = file_size;
 	}
 	if (blen < 2 || blen > sizeof(buf)) {
-		wpa_printf(MSG_DEBUG, "SCARD: invalid IMSI file length=%d",
-			   blen);
+		wpa_printf(MSG_DEBUG, "SCARD: invalid IMSI file length=%ld",
+			   (long) blen);
 		return -3;
 	}
 
 	imsilen = (blen - 2) * 2 + 1;
-	wpa_printf(MSG_DEBUG, "SCARD: IMSI file length=%d imsilen=%d",
-		   blen, imsilen);
+	wpa_printf(MSG_DEBUG, "SCARD: IMSI file length=%ld imsilen=%ld",
+		   (long) blen, (long) imsilen);
 	if (blen < 2 || imsilen > *len) {
 		*len = imsilen;
 		return -4;
@@ -1071,8 +1073,8 @@
 	    (scard->sim_type == SCARD_USIM &&
 	     (len != 2 || resp[0] != 0x61 || resp[1] != 0x0e))) {
 		wpa_printf(MSG_WARNING, "SCARD: unexpected response for GSM "
-			   "auth request (len=%d resp=%02x %02x)",
-			   len, resp[0], resp[1]);
+			   "auth request (len=%ld resp=%02x %02x)",
+			   (long) len, resp[0], resp[1]);
 		return -3;
 	}
 	get_resp[4] = resp[1];
@@ -1085,8 +1087,8 @@
 	if (scard->sim_type == SCARD_GSM_SIM) {
 		if (len != 4 + 8 + 2) {
 			wpa_printf(MSG_WARNING, "SCARD: unexpected data "
-				   "length for GSM auth (len=%d, expected 14)",
-				   len);
+				   "length for GSM auth (len=%ld, expected 14)",
+				   (long) len);
 			return -5;
 		}
 		os_memcpy(sres, buf, 4);
@@ -1094,8 +1096,8 @@
 	} else {
 		if (len != 1 + 4 + 1 + 8 + 2) {
 			wpa_printf(MSG_WARNING, "SCARD: unexpected data "
-				   "length for USIM auth (len=%d, "
-				   "expected 16)", len);
+				   "length for USIM auth (len=%ld, "
+				   "expected 16)", (long) len);
 			return -5;
 		}
 		if (buf[0] != 4 || buf[5] != 8) {
@@ -1176,8 +1178,8 @@
 		return -1;
 	} else if (len != 2 || resp[0] != 0x61) {
 		wpa_printf(MSG_WARNING, "SCARD: unexpected response for UMTS "
-			   "auth request (len=%d resp=%02x %02x)",
-			   len, resp[0], resp[1]);
+			   "auth request (len=%ld resp=%02x %02x)",
+			   (long) len, resp[0], resp[1]);
 		return -1;
 	}
 	get_resp[4] = resp[1];
---




More information about the Hostap mailing list