Skip to content

Commit

Permalink
Use the size_t modifier to avoid an unnecessary cast
Browse files Browse the repository at this point in the history
(cherry picked from commit 8f49a55)
  • Loading branch information
danpascu authored and liviuchircu committed Feb 24, 2021
1 parent 263b15b commit 947d254
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion modules/db_postgres/pg_con.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion modules/gflags/gflags.c
Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions modules/mediaproxy/mediaproxy.c
Expand Up @@ -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,",
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/nat_traversal/nat_traversal.c
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/sql_cacher/sql_cacher.c
Expand Up @@ -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 */
Expand Down

0 comments on commit 947d254

Please sign in to comment.