[MERGED] osmocom-bb[master]: mobile: Fix compiler warning on printing ptrdiff_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/.

Holger Freyther gerrit-no-reply at lists.osmocom.org
Sun Dec 3 17:35:37 UTC 2017


Holger Freyther has submitted this change and it was merged.

Change subject: mobile: Fix compiler warning on printing ptrdiff_t
......................................................................


mobile: Fix compiler warning on printing ptrdiff_t

The "msg->tail - msg->l4h" subtract two unsigned char*
pointers and should result in a ptrdiff_t. Fix the
compiler warning by using "%ti" in the printf.

Fixes:
gsm411_sms.c: In function ‘gsm411_rx_rp_ud’:
gsm411_sms.c:382:25: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
  LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h,
                         ^
/home/ich/install/openbsc/include/osmocom/core/logging.h:93:54: note: in definition of macro ‘LOGPSRCC’
     logp2(ss, level, caller_file, caller_line, cont, fmt, ##args); \
                                                      ^~~
/home/ich/install/openbsc/include/osmocom/core/logging.h:47:2: note: in expansion of macro ‘LOGPSRC’
  LOGPSRC(ss, level, NULL, 0, fmt, ## args)
  ^~~~~~~
gsm411_sms.c:382:2: note: in expansion of macro ‘LOGP’
  LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h,
  ^~~~
gsm411_sms.c:382:25: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
  LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h,
                         ^
/home/ich/install/openbsc/include/osmocom/core/logging.h:95:53: note: in definition of macro ‘LOGPSRCC’
     logp2(ss, level, __BASE_FILE__, __LINE__, cont, fmt, ##args); \
                                                     ^~~
/home/ich/install/openbsc/include/osmocom/core/logging.h:47:2: note: in expansion of macro ‘LOGPSRC’
  LOGPSRC(ss, level, NULL, 0, fmt, ## args)
  ^~~~~~~
gsm411_sms.c:382:2: note: in expansion of macro ‘LOGP’
  LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h,

Change-Id: Ia574fc7849bd00a94cf6651eb0d26fdc91ef1443
---
M src/host/layer23/src/mobile/gsm411_sms.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/layer23/src/mobile/gsm411_sms.c b/src/host/layer23/src/mobile/gsm411_sms.c
index eb09854..b635bb2 100644
--- a/src/host/layer23/src/mobile/gsm411_sms.c
+++ b/src/host/layer23/src/mobile/gsm411_sms.c
@@ -375,7 +375,7 @@
 
 	LOGP(DLSMS, LOGL_INFO, "DST(%u,%s)\n", src_len,
 		osmo_hexdump(src, src_len));
-	LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h,
+	LOGP(DLSMS, LOGL_INFO, "TPDU(%ti,%s)\n", msg->tail-msg->l4h,
 		osmo_hexdump(msg->l4h, msg->tail-msg->l4h));
 
 	rc = gsm340_rx_tpdu(trans, msg, rph->msg_ref);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia574fc7849bd00a94cf6651eb0d26fdc91ef1443
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list