[PATCH] libosmocore[master]: Fix compilation warnings: use correct log type for uint32_t

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/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Sun Jun 18 12:17:20 UTC 2017


Review at  https://gerrit.osmocom.org/2962

Fix compilation warnings: use correct log type for uint32_t

Change-Id: Ic1e3255800999669ca9619bfceb4124c773eff2d
---
M src/gsm/gsm48.c
M src/utils.c
2 files changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/62/2962/1

diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index 405c904..996c70e 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdbool.h>
+#include <inttypes.h>
 
 #include <osmocom/core/utils.h>
 #include <osmocom/core/byteswap.h>
@@ -636,7 +637,7 @@
 		/* Table 10.5.4.3, reverse generate_mid_from_tmsi */
 		if (mi_len == GSM48_TMSI_LEN && mi[0] == (0xf0 | GSM_MI_TYPE_TMSI)) {
 			tmsi = osmo_load32be(&mi[1]);
-			return snprintf(string, str_len, "%u", tmsi);
+			return snprintf(string, str_len, "%"PRIu32, tmsi);
 		}
 		break;
 	case GSM_MI_TYPE_IMSI:
diff --git a/src/utils.c b/src/utils.c
index e7c6bcf..6392918 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -26,6 +26,7 @@
 #include <stdint.h>
 #include <errno.h>
 #include <stdio.h>
+#include <inttypes.h>
 
 #include <osmocom/core/utils.h>
 #include <osmocom/core/bit64gen.h>
@@ -55,7 +56,7 @@
 	if (str)
 		return str;
 
-	snprintf(namebuf, sizeof(namebuf), "unknown 0x%x", val);
+	snprintf(namebuf, sizeof(namebuf), "unknown 0x%"PRIx32, val);
 	namebuf[sizeof(namebuf) - 1] = '\0';
 	return namebuf;
 }

-- 
To view, visit https://gerrit.osmocom.org/2962
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1e3255800999669ca9619bfceb4124c773eff2d
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list