aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bssmap_le/bssmap_le_test.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-10-09 09:37:36 +0200
committerHarald Welte <laforge@osmocom.org>2020-10-09 09:55:53 +0200
commitf445150c57ab5205f52ba98924b9e3c9602b2701 (patch)
tree72e96677e32e8aa01167ddda749c0707abab9e76 /tests/bssmap_le/bssmap_le_test.c
parenta5218ea9b3a6329a3ce9b56bc1434ca96a0e35aa (diff)
bssmap_le/bsslap tests: We must use %td for ptrdiff_t printing
Otherwise we get (valid!) format string warnings like these on 32bit targets: [ 372s] bssmap_le/bssmap_le_test.c: In function 'test_bssmap_le_enc_dec': [ 372s] bssmap_le/bssmap_le_test.c:141:15: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'int' [-Wformat=] [ 372s] printf("[%ld] %s: ERROR: failed to encode pdu\n", (pdu - bssmap_le_test_pdus), [ 372s] ^ Closes: OS#4786 Change-Id: Ib1c16b8adc5c8c0a2b418db51d12089f9b49a844
Diffstat (limited to 'tests/bssmap_le/bssmap_le_test.c')
-rw-r--r--tests/bssmap_le/bssmap_le_test.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/bssmap_le/bssmap_le_test.c b/tests/bssmap_le/bssmap_le_test.c
index 59c7ed25..f9ebd920 100644
--- a/tests/bssmap_le/bssmap_le_test.c
+++ b/tests/bssmap_le/bssmap_le_test.c
@@ -138,7 +138,7 @@ void test_bssmap_le_enc_dec()
msg = osmo_bssap_le_enc(&enc_pdu);
if (!msg) {
- printf("[%ld] %s: ERROR: failed to encode pdu\n", (pdu - bssmap_le_test_pdus),
+ printf("[%td] %s: ERROR: failed to encode pdu\n", (pdu - bssmap_le_test_pdus),
osmo_bssmap_le_msgt_name(pdu->msg_type));
goto loop_end;
}
@@ -147,14 +147,14 @@ void test_bssmap_le_enc_dec()
memset(&dec_pdu, 0xff, sizeof(dec_pdu));
rc = osmo_bssap_le_dec(&dec_pdu, &err, loop_ctx, msg);
if (rc) {
- printf("[%ld] %s: ERROR: failed to decode pdu: %s\n", (pdu - bssmap_le_test_pdus),
+ printf("[%td] %s: ERROR: failed to decode pdu: %s\n", (pdu - bssmap_le_test_pdus),
osmo_bssmap_le_msgt_name(pdu->msg_type), err->logmsg);
printf(" encoded data: %s\n", osmo_hexdump(msg->data, msg->len));
goto loop_end;
}
if (memcmp(&enc_pdu, &dec_pdu, sizeof(dec_pdu))) {
- printf("[%ld] %s: ERROR: decoded PDU != encoded PDU\n", (pdu - bssmap_le_test_pdus),
+ printf("[%td] %s: ERROR: decoded PDU != encoded PDU\n", (pdu - bssmap_le_test_pdus),
osmo_bssmap_le_msgt_name(pdu->msg_type));
printf(" original struct: %s\n", osmo_hexdump((void*)&enc_pdu, sizeof(enc_pdu)));
printf(" decoded struct: %s\n", osmo_hexdump((void*)&dec_pdu, sizeof(dec_pdu)));
@@ -162,7 +162,7 @@ void test_bssmap_le_enc_dec()
goto loop_end;
}
- printf("[%ld] %s: ok (encoded len = %d)\n", (pdu - bssmap_le_test_pdus),
+ printf("[%td] %s: ok (encoded len = %d)\n", (pdu - bssmap_le_test_pdus),
osmo_bssmap_le_msgt_name(pdu->msg_type), msg->len);
loop_end: