64bit: Fix compiler warnings in regard to 64bit
vty_interface_layer3.c:584:4: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Wformat=]
sizeof(subscr->extension)-1, VTY_NEWLINE);
diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c
index 1515aea..71fff93 100644
--- a/openbsc/src/libmsc/vty_interface_layer3.c
+++ b/openbsc/src/libmsc/vty_interface_layer3.c
@@ -547,7 +547,7 @@
if (strlen(name) > sizeof(subscr->name)-1) {
vty_out(vty,
- "%% NAME is too long, max. %d characters are allowed%s",
+ "%% NAME is too long, max. %zu characters are allowed%s",
sizeof(subscr->name)-1, VTY_NEWLINE);
return CMD_WARNING;
}
@@ -580,7 +580,7 @@
if (strlen(ext) > sizeof(subscr->extension)-1) {
vty_out(vty,
- "%% EXTENSION is too long, max. %d characters are allowed%s",
+ "%% EXTENSION is too long, max. %zu characters are allowed%s",
sizeof(subscr->extension)-1, VTY_NEWLINE);
return CMD_WARNING;
}
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
index 5f703c2..1c03f27 100644
--- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
+++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
@@ -156,7 +156,7 @@
return -1;
} else if (slen > sizeof(addr)) {
fprintf(stderr, "Gateway received message from outerspace: %zu %zu\n",
- slen, sizeof(addr));
+ (size_t) slen, sizeof(addr));
return -1;
}
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_rewrite_trie.c b/openbsc/src/osmo-bsc_nat/bsc_nat_rewrite_trie.c
index faceb59..9291c89 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_rewrite_trie.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_rewrite_trie.c
@@ -45,10 +45,10 @@
{
struct nat_rewrite_rule *new = &root->rule;
- const size_t len = strlen(rule->prefix);
+ const int len = strlen(rule->prefix);
int i;
- if (len == 0) {
+ if (len <= 0) {
LOGP(DNAT, LOGL_ERROR, "An empty prefix does not make sense.\n");
goto fail;
}
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index b830eb0..a4b313c 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -645,7 +645,7 @@
}
if (msgb_l2len(output) != strlen(patc)) {
- printf("Wrong sizes for test: %d %d != %d != %d\n", i, msgb_l2len(output), strlen(patc), strlen(orig));
+ printf("Wrong sizes for test: %d %u != %zu != %zu\n", i, msgb_l2len(output), strlen(patc), strlen(orig));
printf("String '%s' vs '%s'\n", (const char *) output->l2h, patc);
abort();
}
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c
index 214d477..17f0a17 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.c
+++ b/openbsc/tests/gbproxy/gbproxy_test.c
@@ -956,7 +956,7 @@
int gprs_ns_callback(enum gprs_ns_evt event, struct gprs_nsvc *nsvc,
struct msgb *msg, uint16_t bvci)
{
- printf("CALLBACK, event %d, msg length %d, bvci 0x%04x\n%s\n\n",
+ printf("CALLBACK, event %d, msg length %zu, bvci 0x%04x\n%s\n\n",
event, msgb_bssgp_len(msg), bvci,
osmo_hexdump(msgb_l2(msg), msgb_l2len(msg)));
diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c
index 692ec90..781ef61 100644
--- a/openbsc/tests/gsm0408/gsm0408_test.c
+++ b/openbsc/tests/gsm0408/gsm0408_test.c
@@ -48,7 +48,7 @@
#define VERIFY(res, cmp, wanted) \
if (!(res cmp wanted)) { \
printf("ASSERT failed: %s:%d Wanted: %d %s %d\n", \
- __FILE__, __LINE__, res, # cmp, wanted); \
+ __FILE__, __LINE__, (int) res, # cmp, (int) wanted); \
}