From 947d25473f9be3bea1757cc8e150d681da89e012 Mon Sep 17 00:00:00 2001 From: Dan Pascu Date: Tue, 28 May 2019 11:09:19 +0300 Subject: [PATCH] Use the size_t modifier to avoid an unnecessary cast (cherry picked from commit 8f49a55c03ea8a2340f56124567bbe610906df9d) --- modules/db_postgres/pg_con.c | 2 +- modules/gflags/gflags.c | 2 +- modules/mediaproxy/mediaproxy.c | 6 +++--- modules/nat_traversal/nat_traversal.c | 2 +- modules/sql_cacher/sql_cacher.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/db_postgres/pg_con.c b/modules/db_postgres/pg_con.c index f7ef0728be5..420eb1f1579 100644 --- a/modules/db_postgres/pg_con.c +++ b/modules/db_postgres/pg_con.c @@ -60,7 +60,7 @@ struct pg_con* db_postgres_new_connection(struct db_id* id) "\n", (unsigned long)sizeof(struct pg_con)); return 0; } - LM_DBG("%p=pkg_malloc(%lu)\n", ptr, (unsigned long)sizeof(struct pg_con)); + LM_DBG("%p=pkg_malloc(%zu)\n", ptr, sizeof(struct pg_con)); memset(ptr, 0, sizeof(struct pg_con)); ptr->ref = 1; diff --git a/modules/gflags/gflags.c b/modules/gflags/gflags.c index 138a663532d..002b1c951a0 100644 --- a/modules/gflags/gflags.c +++ b/modules/gflags/gflags.c @@ -150,7 +150,7 @@ static int fixup_gflags( void** param, int param_no) } if ( myint >= 8*sizeof(*gflags) ) { LM_ERR("flag <%d> out of " - "range [0..%lu]\n", myint, ((unsigned long)8*sizeof(*gflags))-1 ); + "range [0..%zu]\n", myint, 8*sizeof(*gflags)-1); return E_CFG; } /* convert from flag index to flag bitmap */ diff --git a/modules/mediaproxy/mediaproxy.c b/modules/mediaproxy/mediaproxy.c index e85814fd980..a3f2e007450 100644 --- a/modules/mediaproxy/mediaproxy.c +++ b/modules/mediaproxy/mediaproxy.c @@ -1537,7 +1537,7 @@ use_media_proxy(struct sip_msg *msg, char *dialog_id, ice_candidate_data *ice_da if (stream.transport != TSupported) continue; // skip streams with unsupported transports if (stream.type.len + stream.ip.len + stream.port.len + stream.direction.len + 4 > str_buf.len) { - LM_ERR("media stream description is longer than %lu bytes\n", (unsigned long)sizeof(media_str)); + LM_ERR("media stream description is longer than %zu bytes\n", sizeof(media_str)); return -1; } len = sprintf(str_buf.s, "%.*s:%.*s:%.*s:%.*s:%s,", @@ -1586,7 +1586,7 @@ use_media_proxy(struct sip_msg *msg, char *dialog_id, ice_candidate_data *ice_da media_relay.len, media_relay.s, media_str); if (len >= sizeof(request)) { - LM_ERR("mediaproxy request is longer than %lu bytes\n", (unsigned long)sizeof(request)); + LM_ERR("mediaproxy request is longer than %zu bytes\n", sizeof(request)); return -1; } @@ -1773,7 +1773,7 @@ end_media_session(str callid, str from_tag, str to_tag) to_tag.len, to_tag.s); if (len >= sizeof(request)) { - LM_ERR("mediaproxy request is longer than %lu bytes\n", (unsigned long)sizeof(request)); + LM_ERR("mediaproxy request is longer than %zu bytes\n", sizeof(request)); return -1; } diff --git a/modules/nat_traversal/nat_traversal.c b/modules/nat_traversal/nat_traversal.c index 01eb8baf9b8..c15a7206f57 100644 --- a/modules/nat_traversal/nat_traversal.c +++ b/modules/nat_traversal/nat_traversal.c @@ -1617,7 +1617,7 @@ send_keepalive(NAT_Contact *contact) keepalive_params.extra_headers); if (len >= sizeof(buffer)) { - LM_ERR("keepalive message is longer than %lu bytes\n", (unsigned long)sizeof(buffer)); + LM_ERR("keepalive message is longer than %zu bytes\n", sizeof(buffer)); return; } diff --git a/modules/sql_cacher/sql_cacher.c b/modules/sql_cacher/sql_cacher.c index 4a275112ced..5e8719bc566 100644 --- a/modules/sql_cacher/sql_cacher.c +++ b/modules/sql_cacher/sql_cacher.c @@ -316,7 +316,7 @@ static int parse_cache_entry(unsigned int type, void *val) } if (new_entry->nr_columns > sizeof(long long) * 8) { - LM_WARN("Too many columns, maximum number is %lu\n", sizeof(long long) * 8); + LM_WARN("Too many columns, maximum number is %zu\n", sizeof(long long) * 8); goto parse_err; } /* allocate array of columns and actually parse */