Skip to content

Commit

Permalink
Fixed some compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
danpascu committed May 28, 2019
1 parent 04be335 commit 66f0f60
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion bin_interface.c
Expand Up @@ -58,7 +58,7 @@ int bin_init(bin_packet_t *packet, str *capability, int packet_type,
short version, int length)
{
if (length != 0 && length < MIN_BIN_PACKET_SIZE + capability->len) {
LM_ERR("Length parameter has to be greater than: %lu\n",
LM_ERR("Length parameter has to be greater than: %u\n",
MIN_BIN_PACKET_SIZE + capability->len);
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion cfg_pp.c
Expand Up @@ -221,7 +221,7 @@ static int __flatten_opensips_cfg(FILE *cfg, const char *cfg_path,
*bytes_left -= cfgtok_filebegin.len + 1 +1+cfg_path_len+1 + 1;

for (;;) {
line_len = getline(&line, &line_buf_sz, cfg);
line_len = getline(&line, (size_t*)&line_buf_sz, cfg);
if (line_len == -1) {
if (ferror(cfg)) {
if (errno == EINTR) {
Expand Down
2 changes: 1 addition & 1 deletion cfg_reload.c
Expand Up @@ -169,7 +169,7 @@ static int reindex_new_sroutes(struct script_route *new_sr,

my_sr = (struct script_route*)pkg_malloc(size*sizeof(struct script_route));
if (my_sr==NULL) {
LM_ERR("failed to allocate pkg mem (needing %lu)\n",
LM_ERR("failed to allocate pkg mem (needing %zu)\n",
size*sizeof(struct script_route));
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions modules/cachedb_mongodb/cachedb_mongodb_dbase.c
Expand Up @@ -1973,7 +1973,7 @@ int mongo_cdb_dict_to_bson(const cdb_dict_t *dict, bson_t *out_doc)
case CDB_INT64:
if (!bson_append_int64(out_doc, key.s, key.len,
pair->val.val.i64)) {
LM_ERR("failed to append %.*s: %ld\n", key.len,
LM_ERR("failed to append %.*s: %lld\n", key.len,
key.s, pair->val.val.i64);
goto out_err;
}
Expand Down Expand Up @@ -2073,7 +2073,7 @@ int mongo_con_update(cachedb_con *con, const cdb_filter_t *row_filter,
case CDB_INT64:
if (!bson_append_int64(&set_keys, key.s, key.len,
pair->val.val.i64)) {
LM_ERR("failed to append i64 val: %ld\n", pair->val.val.i64);
LM_ERR("failed to append i64 val: %lld\n", pair->val.val.i64);
ret = -1;
goto out;
}
Expand Down
30 changes: 15 additions & 15 deletions modules/cachedb_redis/cachedb_redis_dbase.c
Expand Up @@ -81,26 +81,26 @@ int redis_connect_node(redis_con *con,cluster_node *node)
rpl = redisCommand(node->context,"AUTH %s",con->id->password);
if (rpl == NULL || rpl->type == REDIS_REPLY_ERROR) {
LM_ERR("failed to auth to redis - %.*s\n",
rpl?rpl->len:7,rpl?rpl->str:"FAILURE");
rpl?(unsigned)rpl->len:7,rpl?rpl->str:"FAILURE");
freeReplyObject(rpl);
redisFree(node->context);
return -1;
}
LM_DBG("AUTH [password] - %.*s\n",rpl->len,rpl->str);
LM_DBG("AUTH [password] - %.*s\n",(unsigned)rpl->len,rpl->str);
freeReplyObject(rpl);
}

if ((con->flags & REDIS_SINGLE_INSTANCE) && con->id->database) {
rpl = redisCommand(node->context,"SELECT %s",con->id->database);
if (rpl == NULL || rpl->type == REDIS_REPLY_ERROR) {
LM_ERR("failed to select database %s - %.*s\n",con->id->database,
rpl?rpl->len:7,rpl?rpl->str:"FAILURE");
rpl?(unsigned)rpl->len:7,rpl?rpl->str:"FAILURE");
freeReplyObject(rpl);
redisFree(node->context);
return -1;
}

LM_DBG("SELECT [%s] - %.*s\n",con->id->database,rpl->len,rpl->str);
LM_DBG("SELECT [%s] - %.*s\n",con->id->database,(unsigned)rpl->len,rpl->str);
freeReplyObject(rpl);
}

Expand Down Expand Up @@ -136,13 +136,13 @@ int redis_connect(redis_con *con)
rpl = redisCommand(ctx,"AUTH %s",con->id->password);
if (rpl == NULL || rpl->type == REDIS_REPLY_ERROR) {
LM_ERR("failed to auth to redis - %.*s\n",
rpl?rpl->len:7,rpl?rpl->str:"FAILURE");
rpl?(unsigned)rpl->len:7,rpl?rpl->str:"FAILURE");
if (rpl!=NULL)
freeReplyObject(rpl);
redisFree(ctx);
return -1;
}
LM_DBG("AUTH [password] - %.*s\n",rpl->len,rpl->str);
LM_DBG("AUTH [password] - %.*s\n",(unsigned)rpl->len,rpl->str);
freeReplyObject(rpl);
}

Expand Down Expand Up @@ -279,7 +279,7 @@ void redis_destroy(cachedb_con *con) {
reply = redisCommand(node->context,fmt,##args); \
if (reply == NULL || reply->type == REDIS_REPLY_ERROR) { \
LM_ERR("Redis operation failure - %p %.*s\n",\
reply,reply?reply->len:7,reply?reply->str:"FAILURE"); \
reply,reply?(unsigned)reply->len:7,reply?reply->str:"FAILURE"); \
if (reply) \
freeReplyObject(reply); \
if (node->context->err == REDIS_OK || redis_reconnect_node(con,node) < 0) { \
Expand Down Expand Up @@ -316,7 +316,7 @@ int redis_get(cachedb_con *connection,str *attr,str *val)
return -2;
}

LM_DBG("GET %.*s - %.*s\n",attr->len,attr->s,reply->len,reply->str);
LM_DBG("GET %.*s - %.*s\n",attr->len,attr->s,(unsigned)reply->len,reply->str);

val->s = pkg_malloc(reply->len);
if (val->s == NULL) {
Expand Down Expand Up @@ -346,15 +346,15 @@ int redis_set(cachedb_con *connection,str *attr,str *val,int expires)
redis_run_command(con,attr,"SET %b %b",attr->s,attr->len,val->s,val->len);

LM_DBG("set %.*s to %.*s - status = %d - %.*s\n",attr->len,attr->s,val->len,
val->s,reply->type,reply->len,reply->str);
val->s,reply->type,(unsigned)reply->len,reply->str);

freeReplyObject(reply);

if (expires) {
redis_run_command(con,attr,"EXPIRE %b %d",attr->s,attr->len,expires);

LM_DBG("set %.*s to expire in %d s - %.*s\n",attr->len,attr->s,expires,
reply->len,reply->str);
(unsigned)reply->len,reply->str);

freeReplyObject(reply);
}
Expand Down Expand Up @@ -412,7 +412,7 @@ int redis_add(cachedb_con *connection,str *attr,int val,int expires,int *new_val
redis_run_command(con,attr,"EXPIRE %b %d",attr->s,attr->len,expires);

LM_DBG("set %.*s to expire in %d s - %.*s\n",attr->len,attr->s,expires,
reply->len,reply->str);
(unsigned)reply->len,reply->str);

freeReplyObject(reply);
}
Expand Down Expand Up @@ -442,7 +442,7 @@ int redis_sub(cachedb_con *connection,str *attr,int val,int expires,int *new_val
redis_run_command(con,attr,"EXPIRE %b %d",attr->s,attr->len,expires);

LM_DBG("set %.*s to expire in %d s - %.*s\n",attr->len,attr->s,expires,
reply->len,reply->str);
(unsigned)reply->len,reply->str);

freeReplyObject(reply);
}
Expand Down Expand Up @@ -471,7 +471,7 @@ int redis_get_counter(cachedb_con *connection,str *attr,int *val)
return -2;
}

LM_DBG("GET %.*s - %.*s\n",attr->len,attr->s,reply->len,reply->str);
LM_DBG("GET %.*s - %.*s\n",attr->len,attr->s,(unsigned)reply->len,reply->str);

response.s=reply->str;
response.len=reply->len;
Expand Down Expand Up @@ -679,7 +679,7 @@ int redis_raw_query_send(cachedb_con *connection,redisReply **reply,cdb_raw_entr
*reply = redisvCommand(node->context,attr->s,ap);
if (*reply == NULL || (*reply)->type == REDIS_REPLY_ERROR) {
LM_ERR("Redis operation failure - %.*s\n",
*reply?(*reply)->len:7,*reply?(*reply)->str:"FAILURE");
*reply?(unsigned)((*reply)->len):7,*reply?(*reply)->str:"FAILURE");
if (*reply)
freeReplyObject(*reply);
if (node->context->err == REDIS_OK || redis_reconnect_node(con,node) < 0) {
Expand Down Expand Up @@ -724,7 +724,7 @@ int redis_raw_query(cachedb_con *connection,str *attr,cdb_raw_entry ***rpl,int e
freeReplyObject(reply);
return -2;
case REDIS_REPLY_STATUS:
LM_DBG("Received a status of %.*s from Redis \n",reply->len,reply->str);
LM_DBG("Received a status of %.*s from Redis \n",(unsigned)reply->len,reply->str);
if (reply_no)
*reply_no = 0;
freeReplyObject(reply);
Expand Down
2 changes: 1 addition & 1 deletion modules/mid_registrar/lookup.c
Expand Up @@ -209,7 +209,7 @@ int mid_reg_lookup(struct sip_msg* req, void* _t, str* flags_s, str* uri)
}
}

LM_DBG("getting ucontact from contact_id %lu\n", contact_id);
LM_DBG("getting ucontact from contact_id %llu\n", contact_id);

ptr = ul_api.get_ucontact_from_id((udomain_t *)_t, contact_id, &r);
if (!ptr) {
Expand Down
2 changes: 1 addition & 1 deletion modules/mid_registrar/save.c
Expand Up @@ -380,7 +380,7 @@ static int overwrite_req_contacts(struct sip_msg *req,
if (ctid_insertion == MR_APPEND_PARAM) {
LM_DBG("param insertion\n");
len1 = snprintf(lump_buf, len,
"<sip:%.*s@%.*s:%.*s;%.*s=%lu%.*s>;expires=%d",
"<sip:%.*s@%.*s:%.*s;%.*s=%llu%.*s>;expires=%d",
new_username.len, new_username.s,
adv_host->len, adv_host->s, adv_port->len, adv_port->s,
ctid_param.len, ctid_param.s, ctid,
Expand Down
6 changes: 3 additions & 3 deletions modules/nathelper/nathelper.c
Expand Up @@ -1665,7 +1665,7 @@ ping_checker_timer(unsigned int ticks, void *timer_idx)
* cell from the list or not */
lock_hash(cell->hash_id);

LM_DBG("ping expiring ping cell %lu state=%d\n",
LM_DBG("ping expiring ping cell %llu state=%d\n",
cell->ct_coords, cell->state);

if (cell->state == PING_CELL_STATE_ANSWERED) {
Expand Down Expand Up @@ -1721,7 +1721,7 @@ ping_checker_timer(unsigned int ticks, void *timer_idx)

cell->state = PING_CELL_STATE_WAITING;

LM_DBG("moving ping cell %lu into WAIT timer with state=%d\n",
LM_DBG("moving ping cell %llu into WAIT timer with state=%d\n",
cell->ct_coords, cell->state);

/* insert into waiting time */
Expand Down Expand Up @@ -1749,7 +1749,7 @@ ping_checker_timer(unsigned int ticks, void *timer_idx)

lock_hash(cell->hash_id);

LM_DBG("wait expiring ping cell %lu state=%d\n",
LM_DBG("wait expiring ping cell %llu state=%d\n",
cell->ct_coords, cell->state);

/* if not found in the mean while (via hash), delete it */
Expand Down
4 changes: 2 additions & 2 deletions modules/nathelper/sip_pinger.h
Expand Up @@ -136,7 +136,7 @@ static int parse_branch(str branch)
unlock_hash(hash_id);
return 0;
}
LM_DBG("ping received for %lu\n", ct_coords);
LM_DBG("ping received for %llu\n", ct_coords);

sipping_latency =
(timeval_st.tv_sec - p_cell->last_send_time.tv_sec) * 1000000 +
Expand Down Expand Up @@ -286,7 +286,7 @@ build_branch(char *branch, int *size,

lock_release(&htable->timer_list.mutex);

LM_DBG("ping cell acquired (new=%d, old_state=%d) for %lu\n",
LM_DBG("ping cell acquired (new=%d, old_state=%d) for %llu\n",
(old_state==PING_CELL_STATE_NONE)?1:0, old_state, ct_coords);
} else {
label = sipping_callid_cnt;
Expand Down
2 changes: 1 addition & 1 deletion modules/proto_hep/hep.c
Expand Up @@ -1104,7 +1104,7 @@ static int add_generic_chunk(struct hep_desc* hep_msg, void* data, int len, int
{
#define CHECK_LEN(__len, __cmp, __field) \
if (__len != __cmp) { \
LM_ERR(__field" size should be %ld!\n", __cmp); \
LM_ERR(__field" size should be %zd!\n", __cmp); \
return -1; \
}

Expand Down
6 changes: 3 additions & 3 deletions modules/rtpproxy/rtpproxy.c
Expand Up @@ -3891,7 +3891,7 @@ static int rtpp_init_extra_stats(void)
len += 1 /* ' ' */ + strlen(rtpp_stats[stat]);
rtpp_stats_chunks[chunk].iov_base = pkg_malloc(len);
if (!rtpp_stats_chunks) {
LM_WARN("cannot allocate %d chunk. Only %d stats out of %ld "
LM_WARN("cannot allocate %d chunk. Only %d stats out of %zu "
"can be used!\n", chunk, chunk * RTPP_QUERY_ONCE_STATS_NO,
RTPP_QUERY_STATS_SIZE);
goto error;
Expand All @@ -3904,8 +3904,8 @@ static int rtpp_init_extra_stats(void)
p += len;
}
rtpp_stats_chunks[chunk].iov_len = p - (char *)rtpp_stats_chunks[chunk].iov_base;
LM_INFO("%d %ld [%.*s]\n", chunk, rtpp_stats_chunks[chunk].iov_len,
(int)rtpp_stats_chunks[chunk].iov_len, (char *)rtpp_stats_chunks[chunk].iov_base);
LM_INFO("%d %zu [%.*s]\n", chunk, rtpp_stats_chunks[chunk].iov_len,
(unsigned)rtpp_stats_chunks[chunk].iov_len, (char *)rtpp_stats_chunks[chunk].iov_base);
}
return 0;

Expand Down
2 changes: 1 addition & 1 deletion modules/tm/t_msgbuilder.h
Expand Up @@ -90,7 +90,7 @@ static inline struct sip_msg* buf_to_sip_msg(char *buf, unsigned int len,

req = (struct sip_msg*)pkg_malloc( sizeof(struct sip_msg));
if (req==NULL) {
LM_ERR("no more pkg mem, needed %lu\n",sizeof(struct sip_msg));
LM_ERR("no more pkg mem, needed %zu\n",sizeof(struct sip_msg));
return NULL;
}
memset( req, 0, sizeof(struct sip_msg) );
Expand Down
2 changes: 1 addition & 1 deletion modules/tracer/tracer.c
Expand Up @@ -3128,7 +3128,7 @@ int register_traced_type(char* name)
}

if (traced_protos_no + 1 == MAX_TRACED_PROTOS) {
LM_BUG("more than %ld types of tracing!"
LM_BUG("more than %zu types of tracing!"
"Increase MAX_TRACE_NAMES value!\n", MAX_TRACED_PROTOS);
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/usrloc/dlist.c
Expand Up @@ -389,7 +389,7 @@ cdb_pack_ping_data(const str *aor, const cdb_pair_t *contact,
struct socket_info *sock = NULL;
struct proxy_l next_hop;
str ct_uri, received = STR_NULL, path, next_hop_uri;
char *next_hop_host;
char *next_hop_host = NULL;
int needed;
char *cp = *cpos;
int cols_needed = COL_CONTACT | COL_RECEIVED | COL_PATH | COL_CFLAGS;
Expand Down

0 comments on commit 66f0f60

Please sign in to comment.