Commit 86ec3118 ("msgb: Let msgb_hexdump be more tolerant") added new format warnings to my 64bit build of libosmocore.
It's not a pressing matter, really, but the libosmocore build is otherwise clean of such warnings so it'd be nice to keep it that way.
This patch fixes the warnings by using PRIdPTR. That seems to be the Correct Way to fix it, but I'm a bit unsure.
Thanks for any thoughts!
Neels Hofmeyr (1): Fix some recently added formats on 64bit
src/msgb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
86ec311896dd5d4 adds compiler warnings on 64bit. The build is clean otherwise, so let's keep it that way. --- src/msgb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/msgb.c b/src/msgb.c index 4b108a4..6361913 100644 --- a/src/msgb.c +++ b/src/msgb.c @@ -28,6 +28,7 @@ #include <unistd.h> #include <string.h> #include <stdlib.h> +#include <inttypes.h>
#include <osmocom/core/msgb.h> //#include <openbsc/gsm_data.h> @@ -274,14 +275,15 @@ const char *msgb_hexdump(const struct msgb *msg) continue; if (lxhs[i] < msg->data || lxhs[i] > msg->tail) { nchars = snprintf(buf + buf_offs, sizeof(buf) - buf_offs, - "(L%d=data%+d) ", + "(L%d=data%+" PRIdPTR ") ", i+1, lxhs[i] - msg->data); buf_offs += nchars; continue; } if (lxhs[i] < start) { nchars = snprintf(buf + buf_offs, sizeof(buf) - buf_offs, - "(L%d%+d) ", i+1, start - lxhs[i]); + "(L%d%+" PRIdPTR ") ", i+1, + start - lxhs[i]); buf_offs += nchars; continue; } @@ -312,7 +314,7 @@ const char *msgb_hexdump(const struct msgb *msg) } else if (lxhs[i] <= msg->data + msg->data_len && lxhs[i] > msg->tail) { nchars = snprintf(buf + buf_offs, sizeof(buf) - buf_offs, - "(L%d=tail%+d) ", + "(L%d=tail%+" PRIdPTR ") ", i+1, lxhs[i] - msg->tail); } else continue;
Hi Neels,
On Wed, Dec 23, 2015 at 03:12:40PM +0100, Neels Hofmeyr wrote:
86ec311896dd5d4 adds compiler warnings on 64bit. The build is clean otherwise, so let's keep it that way.
looks fine, merged, thanks.