[PATCH 1/1] Print decimal MCC and MNC unless format is incorrect.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/baseband-devel@lists.osmocom.org/.

Max Max.Suraev at fairwaves.ru
Sat Oct 27 14:17:46 UTC 2012


---
 src/host/layer23/src/common/networks.c   |    6 +++---
 src/host/layer23/src/mobile/subscriber.c |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/host/layer23/src/common/networks.c b/src/host/layer23/src/common/networks.c
index 40b70a1..ad2caa6 100644
--- a/src/host/layer23/src/common/networks.c
+++ b/src/host/layer23/src/common/networks.c
@@ -1824,7 +1824,7 @@ const char *gsm_print_mcc(uint16_t mcc)
 {
 	static char string[5] = "000";
 
-	snprintf(string, 4, "%03x", mcc);
+	snprintf(string, 4, "%03d", mcc);
 	return string;
 }
 
@@ -1843,12 +1843,12 @@ const char *gsm_print_mnc(uint16_t mnc)
 
 	/* two digits */
 	if ((mnc & 0x000f) == 0x000f) {
-		snprintf(string, 6, "%02x", mnc >> 4);
+		snprintf(string, 6, "%02d", mnc >> 4);
 		return string;
 	}
 
 	/* three digits */
-	snprintf(string, 6, "%03x", mnc);
+	snprintf(string, 6, "%03d", mnc);
 	return string;
 }
 
diff --git a/src/host/layer23/src/mobile/subscriber.c b/src/host/layer23/src/mobile/subscriber.c
index 8ebb173..2438637 100644
--- a/src/host/layer23/src/mobile/subscriber.c
+++ b/src/host/layer23/src/mobile/subscriber.c
@@ -256,7 +256,7 @@ static int subscr_sim_imsi(struct osmocom_ms *ms, uint8_t *data,
 	/* decode IMSI, skip first digit (parity) */
 	imsi = sim_decode_bcd(data + 1, length);
 	if (strlen(imsi) - 1 > GSM_IMSI_LENGTH - 1 || strlen(imsi) - 1 < 6) {
-		LOGP(DMM, LOGL_NOTICE, "IMSI invalid length = %d\n",
+		LOGP(DMM, LOGL_NOTICE, "IMSI invalid length = %zu\n",
 			strlen(imsi) - 1);
 		return -EINVAL;
 	}
-- 
1.7.10.4


--------------010606030203030402080109--




More information about the baseband-devel mailing list