Fixed printf format warnings (#3813)

This commit is contained in:
sauwming 2023-12-27 10:32:32 +08:00 committed by GitHub
parent 5601a20c1e
commit 033e4d7ae3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 135 additions and 97 deletions

View File

@ -163,7 +163,7 @@ static void on_data_read(pj_http_req *hreq, void *data, pj_size_t size)
PJ_UNUSED_ARG(hreq); PJ_UNUSED_ARG(hreq);
PJ_UNUSED_ARG(data); PJ_UNUSED_ARG(data);
PJ_LOG(5, (THIS_FILE, "\nData received: %ld bytes", size)); PJ_LOG(5, (THIS_FILE, "\nData received: %lu bytes", (unsigned long)size));
if (size > 0) { if (size > 0) {
#ifdef VERBOSE #ifdef VERBOSE
printf("%.*s\n", (int)size, (char *)data); printf("%.*s\n", (int)size, (char *)data);
@ -190,8 +190,8 @@ static void on_send_data(pj_http_req *hreq,
*data = sdata; *data = sdata;
*size = sendsz; *size = sendsz;
PJ_LOG(5, (THIS_FILE, "\nSending data progress: %ld out of %ld bytes", PJ_LOG(5, (THIS_FILE, "\nSending data progress: %lu out of %lu bytes",
send_size, total_size)); (unsigned long)send_size, (unsigned long)total_size));
} }
@ -210,7 +210,8 @@ static void on_complete(pj_http_req *hreq, pj_status_t status,
PJ_LOG(3, (THIS_FILE, "Error %d", status)); PJ_LOG(3, (THIS_FILE, "Error %d", status));
return; return;
} }
PJ_LOG(5, (THIS_FILE, "\nData completed: %ld bytes", resp->size)); PJ_LOG(5, (THIS_FILE, "\nData completed: %lu bytes",
(unsigned long)resp->size));
if (resp->size > 0 && resp->data) { if (resp->size > 0 && resp->data) {
#ifdef VERBOSE #ifdef VERBOSE
printf("%.*s\n", (int)resp->size, (char *)resp->data); printf("%.*s\n", (int)resp->size, (char *)resp->data);

View File

@ -1942,12 +1942,12 @@ PJ_DEF(void) pj_dns_resolver_dump(pj_dns_resolver *resolver,
} }
} }
PJ_LOG(3,(resolver->name.ptr, " Nb. of pending query free nodes: %lu", PJ_LOG(3,(resolver->name.ptr, " Nb. of pending query free nodes: %lu",
pj_list_size(&resolver->query_free_nodes))); (unsigned long)pj_list_size(&resolver->query_free_nodes)));
PJ_LOG(3,(resolver->name.ptr, " Nb. of timer entries: %lu", PJ_LOG(3,(resolver->name.ptr, " Nb. of timer entries: %lu",
pj_timer_heap_count(resolver->timer))); (unsigned long)pj_timer_heap_count(resolver->timer)));
PJ_LOG(3,(resolver->name.ptr, " Pool capacity: %lu, used size: %lu", PJ_LOG(3,(resolver->name.ptr, " Pool capacity: %lu, used size: %lu",
pj_pool_get_capacity(resolver->pool), (unsigned long)pj_pool_get_capacity(resolver->pool),
pj_pool_get_used_size(resolver->pool))); (unsigned long)pj_pool_get_used_size(resolver->pool)));
pj_grp_lock_release(resolver->grp_lock); pj_grp_lock_release(resolver->grp_lock);
#endif #endif

View File

@ -76,7 +76,8 @@ PJ_DEF(pj_status_t) pjstun_parse_msg( void *buf, pj_size_t buf_len,
msg_len = pj_ntohs(msg->hdr->length); msg_len = pj_ntohs(msg->hdr->length);
if (msg_len != buf_len - sizeof(pjstun_msg_hdr)) { if (msg_len != buf_len - sizeof(pjstun_msg_hdr)) {
PJ_LOG(4,(THIS_FILE, "Error: invalid msg_len %d (expecting %lu)", PJ_LOG(4,(THIS_FILE, "Error: invalid msg_len %d (expecting %lu)",
msg_len, buf_len - sizeof(pjstun_msg_hdr))); msg_len, (unsigned long)
(buf_len - sizeof(pjstun_msg_hdr))));
return PJLIB_UTIL_ESTUNINMSGLEN; return PJLIB_UTIL_ESTUNINMSGLEN;
} }

View File

@ -345,8 +345,9 @@ PJ_DEF(pj_status_t) pjstun_get_mapped_addr2(pj_pool_factory *pf,
} }
} }
TRACE_((THIS_FILE, " Pool usage=%ld of %ld", pj_pool_get_used_size(pool), TRACE_((THIS_FILE, " Pool usage=%lu of %lu",
pj_pool_get_capacity(pool))); (unsigned long)pj_pool_get_used_size(pool),
(unsigned long)pj_pool_get_capacity(pool)));
pj_pool_release(pool); pj_pool_release(pool);

View File

@ -188,8 +188,8 @@ static pj_hash_entry **find_entry( pj_pool_t *pool, pj_hash_table_t *ht,
entry = PJ_POOL_ALLOC_T(pool, pj_hash_entry); entry = PJ_POOL_ALLOC_T(pool, pj_hash_entry);
PJ_LOG(6, ("hashtbl", PJ_LOG(6, ("hashtbl",
"%p: New p_entry %p created, pool used=%lu, cap=%lu", "%p: New p_entry %p created, pool used=%lu, cap=%lu",
ht, entry, pj_pool_get_used_size(pool), ht, entry, (unsigned long)pj_pool_get_used_size(pool),
pj_pool_get_capacity(pool))); (unsigned long)pj_pool_get_capacity(pool)));
} }
entry->next = NULL; entry->next = NULL;
entry->hash = hash; entry->hash = hash;

View File

@ -53,7 +53,8 @@ static pj_pool_block *pj_pool_create_block( pj_pool_t *pool, pj_size_t size)
pj_assert(size >= sizeof(pj_pool_block)); pj_assert(size >= sizeof(pj_pool_block));
LOG((pool->obj_name, "create_block(sz=%lu), cur.cap=%lu, cur.used=%lu", LOG((pool->obj_name, "create_block(sz=%lu), cur.cap=%lu, cur.used=%lu",
size, pool->capacity, pj_pool_get_used_size(pool))); (unsigned long)size, (unsigned long)pool->capacity,
(unsigned long)pj_pool_get_used_size(pool)));
/* Request memory from allocator. */ /* Request memory from allocator. */
block = (pj_pool_block*) block = (pj_pool_block*)
@ -118,7 +119,8 @@ PJ_DEF(void*) pj_pool_allocate_find(pj_pool_t *pool, pj_size_t size)
if (pool->increment_size == 0) { if (pool->increment_size == 0) {
LOG((pool->obj_name, "Can't expand pool to allocate %lu bytes " LOG((pool->obj_name, "Can't expand pool to allocate %lu bytes "
"(used=%lu, cap=%lu)", "(used=%lu, cap=%lu)",
size, pj_pool_get_used_size(pool), pool->capacity)); (unsigned long)size, (unsigned long)pj_pool_get_used_size(pool),
(unsigned long)pool->capacity));
(*pool->callback)(pool, size); (*pool->callback)(pool, size);
return NULL; return NULL;
} }
@ -143,7 +145,9 @@ PJ_DEF(void*) pj_pool_allocate_find(pj_pool_t *pool, pj_size_t size)
LOG((pool->obj_name, LOG((pool->obj_name,
"%lu bytes requested, resizing pool by %lu bytes (used=%lu, cap=%lu)", "%lu bytes requested, resizing pool by %lu bytes (used=%lu, cap=%lu)",
size, block_size, pj_pool_get_used_size(pool), pool->capacity)); (unsigned long)size, (unsigned long)block_size,
(unsigned long)pj_pool_get_used_size(pool),
(unsigned long)pool->capacity));
block = pj_pool_create_block(pool, block_size); block = pj_pool_create_block(pool, block_size);
if (!block) if (!block)
@ -233,7 +237,8 @@ PJ_DEF(pj_pool_t*) pj_pool_create_int( pj_pool_factory *f, const char *name,
/* Pool initial capacity and used size */ /* Pool initial capacity and used size */
pool->capacity = initial_size; pool->capacity = initial_size;
LOG((pool->obj_name, "pool created, size=%lu", pool->capacity)); LOG((pool->obj_name, "pool created, size=%lu",
(unsigned long)pool->capacity));
return pool; return pool;
} }
@ -278,9 +283,10 @@ static void reset_pool(pj_pool_t *pool)
*/ */
PJ_DEF(void) pj_pool_reset(pj_pool_t *pool) PJ_DEF(void) pj_pool_reset(pj_pool_t *pool)
{ {
LOG((pool->obj_name, "reset(): cap=%ld, used=%ld(%ld%%)", LOG((pool->obj_name, "reset(): cap=%lu, used=%lu(%lu%%)",
pool->capacity, pj_pool_get_used_size(pool), (unsigned long)pool->capacity,
pj_pool_get_used_size(pool)*100/pool->capacity)); (unsigned long)pj_pool_get_used_size(pool),
(unsigned long)(pj_pool_get_used_size(pool)*100/pool->capacity)));
reset_pool(pool); reset_pool(pool);
} }
@ -292,9 +298,10 @@ PJ_DEF(void) pj_pool_destroy_int(pj_pool_t *pool)
{ {
pj_size_t initial_size; pj_size_t initial_size;
LOG((pool->obj_name, "destroy(): cap=%ld, used=%ld(%ld%%), block0=%p-%p", LOG((pool->obj_name, "destroy(): cap=%lu, used=%lu(%lu%%), block0=%p-%p",
pool->capacity, pj_pool_get_used_size(pool), (unsigned long)pool->capacity,
pj_pool_get_used_size(pool)*100/pool->capacity, (unsigned long)pj_pool_get_used_size(pool),
(unsigned long)(pj_pool_get_used_size(pool)*100/pool->capacity),
((pj_pool_block*)pool->block_list.next)->buf, ((pj_pool_block*)pool->block_list.next)->buf,
((pj_pool_block*)pool->block_list.next)->end)); ((pj_pool_block*)pool->block_list.next)->end));

View File

@ -188,7 +188,8 @@ static pj_pool_t* cpool_create_pool(pj_pool_factory *pf,
cp->capacity = 0; cp->capacity = 0;
} }
PJ_LOG(6, (pool->obj_name, "pool reused, size=%lu", pool->capacity)); PJ_LOG(6, (pool->obj_name, "pool reused, size=%lu",
(unsigned long)pool->capacity));
} }
/* Put in used list. */ /* Put in used list. */
@ -245,9 +246,11 @@ static void cpool_release_pool( pj_pool_factory *pf, pj_pool_t *pool)
} }
/* Reset pool. */ /* Reset pool. */
PJ_LOG(6, (pool->obj_name, "recycle(): cap=%ld, used=%ld(%ld%%)", PJ_LOG(6, (pool->obj_name, "recycle(): cap=%lu, used=%lu(%lu%%)",
pool_capacity, pj_pool_get_used_size(pool), (unsigned long)pool_capacity,
pj_pool_get_used_size(pool)*100/pool_capacity)); (unsigned long)pj_pool_get_used_size(pool),
(unsigned long)(pj_pool_get_used_size(pool)*100/
pool_capacity)));
pj_pool_reset(pool); pj_pool_reset(pool);
pool_capacity = pj_pool_get_capacity(pool); pool_capacity = pj_pool_get_capacity(pool);
@ -279,8 +282,9 @@ static void cpool_dump_status(pj_pool_factory *factory, pj_bool_t detail )
pj_lock_acquire(cp->lock); pj_lock_acquire(cp->lock);
PJ_LOG(3,("cachpool", " Dumping caching pool:")); PJ_LOG(3,("cachpool", " Dumping caching pool:"));
PJ_LOG(3,("cachpool", " Capacity=%lu, max_capacity=%lu, used_cnt=%lu", \ PJ_LOG(3,("cachpool", " Capacity=%lu, max_capacity=%lu, used_cnt=%lu",
cp->capacity, cp->max_capacity, cp->used_count)); (unsigned long)cp->capacity, (unsigned long)cp->max_capacity,
(unsigned long)cp->used_count));
if (detail) { if (detail) {
pj_pool_t *pool = (pj_pool_t*) cp->used_list.next; pj_pool_t *pool = (pj_pool_t*) cp->used_list.next;
pj_size_t total_used = 0, total_capacity = 0; pj_size_t total_used = 0, total_capacity = 0;
@ -294,7 +298,7 @@ static void cpool_dump_status(pj_pool_factory *factory, pj_bool_t detail )
#if 0 #if 0
PJ_LOG(6, ("cachpool", " %16s block %u, size %ld", PJ_LOG(6, ("cachpool", " %16s block %u, size %ld",
pj_pool_getobjname(pool), nblocks, pj_pool_getobjname(pool), nblocks,
block->end - block->buf + 1)); (long)(block->end - block->buf + 1)));
#endif #endif
nblocks++; nblocks++;
block = block->next; block = block->next;
@ -303,9 +307,10 @@ static void cpool_dump_status(pj_pool_factory *factory, pj_bool_t detail )
PJ_LOG(3,("cachpool", " %16s: %8lu of %8lu (%lu%%) used, " PJ_LOG(3,("cachpool", " %16s: %8lu of %8lu (%lu%%) used, "
"nblocks: %d", "nblocks: %d",
pj_pool_getobjname(pool), pj_pool_getobjname(pool),
pj_pool_get_used_size(pool), (unsigned long)pj_pool_get_used_size(pool),
pool_capacity, (unsigned long)pool_capacity,
pj_pool_get_used_size(pool)*100/pool_capacity, (unsigned long)(pj_pool_get_used_size(pool)*
100/pool_capacity),
nblocks)); nblocks));
#if PJ_POOL_MAX_SEARCH_BLOCK_COUNT == 0 #if PJ_POOL_MAX_SEARCH_BLOCK_COUNT == 0
@ -323,8 +328,10 @@ static void cpool_dump_status(pj_pool_factory *factory, pj_bool_t detail )
} }
if (total_capacity) { if (total_capacity) {
PJ_LOG(3,("cachpool", " Total %9lu of %9lu (%lu %%) used!", PJ_LOG(3,("cachpool", " Total %9lu of %9lu (%lu %%) used!",
total_used, total_capacity, (unsigned long)total_used,
total_used * 100 / total_capacity)); (unsigned long)total_capacity,
(unsigned long)(total_used * 100 /
total_capacity)));
} }
} }

View File

@ -381,8 +381,9 @@ static pj_status_t grow_heap(pj_timer_heap_t *ht)
pj_timer_entry_dup *new_dup; pj_timer_entry_dup *new_dup;
#endif #endif
PJ_LOG(6,(THIS_FILE, "Growing heap size from %ld to %ld", PJ_LOG(6,(THIS_FILE, "Growing heap size from %lu to %lu",
ht->max_size, new_size)); (unsigned long)ht->max_size,
(unsigned long)new_size));
// First grow the heap itself. // First grow the heap itself.
new_heap = (pj_timer_entry_dup**) new_heap = (pj_timer_entry_dup**)

View File

@ -121,8 +121,8 @@ static void on_read_complete(pj_ioqueue_key_t *key,
PJ_LOG(3,(THIS_FILE, PJ_LOG(3,(THIS_FILE,
".....additional info: type=%s, total read=%lu, " ".....additional info: type=%s, total read=%lu, "
"total sent=%lu", "total sent=%lu",
item->type_name, item->bytes_recv, item->type_name, (unsigned long)item->bytes_recv,
item->bytes_sent)); (unsigned long)item->bytes_sent));
} }
} else { } else {
last_error_counter++; last_error_counter++;
@ -480,8 +480,10 @@ static int perform_test(const pj_ioqueue_cfg *cfg,
if (display_report) { if (display_report) {
PJ_LOG(3,(THIS_FILE, " %s %d threads, %d pairs", type_name, PJ_LOG(3,(THIS_FILE, " %s %d threads, %d pairs", type_name,
thread_cnt, sockpair_cnt)); thread_cnt, sockpair_cnt));
PJ_LOG(3,(THIS_FILE, " Elapsed : %lu msec", total_elapsed_usec/1000)); PJ_LOG(3,(THIS_FILE, " Elapsed : %lu msec",
PJ_LOG(3,(THIS_FILE, " Bandwidth: %lu KB/s", *p_bandwidth)); (unsigned long)(total_elapsed_usec/1000)));
PJ_LOG(3,(THIS_FILE, " Bandwidth: %lu KB/s",
(unsigned long)*p_bandwidth));
PJ_LOG(3,(THIS_FILE, " Threads statistics:")); PJ_LOG(3,(THIS_FILE, " Threads statistics:"));
PJ_LOG(3,(THIS_FILE, " =============================")); PJ_LOG(3,(THIS_FILE, " ============================="));
PJ_LOG(3,(THIS_FILE, " Thread Loops Events Errors")); PJ_LOG(3,(THIS_FILE, " Thread Loops Events Errors"));
@ -506,7 +508,7 @@ static int perform_test(const pj_ioqueue_cfg *cfg,
} else { } else {
PJ_LOG(3,(THIS_FILE, " %.4s %2d %2d %8lu KB/s", PJ_LOG(3,(THIS_FILE, " %.4s %2d %2d %8lu KB/s",
type_name, thread_cnt, sockpair_cnt, type_name, thread_cnt, sockpair_cnt,
*p_bandwidth)); (unsigned long)*p_bandwidth));
} }
/* Done. */ /* Done. */
@ -578,7 +580,7 @@ static int ioqueue_perf_test_imp(const pj_ioqueue_cfg *cfg)
test_param[best_index].type_name, test_param[best_index].type_name,
test_param[best_index].thread_cnt, test_param[best_index].thread_cnt,
test_param[best_index].sockpair_cnt, test_param[best_index].sockpair_cnt,
best_bandwidth)); (unsigned long)best_bandwidth));
PJ_LOG(3,(THIS_FILE, " (Note: packet size=%d, total errors=%u)", PJ_LOG(3,(THIS_FILE, " (Note: packet size=%d, total errors=%u)",
BUF_SIZE, last_error_counter)); BUF_SIZE, last_error_counter));
return 0; return 0;

View File

@ -69,7 +69,7 @@ static int capacity_test(void)
if (pj_pool_alloc(pool, freesize) == NULL) { if (pj_pool_alloc(pool, freesize) == NULL) {
PJ_LOG(3,("test", "...error: wrong freesize %lu reported", PJ_LOG(3,("test", "...error: wrong freesize %lu reported",
freesize)); (unsigned long)freesize));
pj_pool_release(pool); pj_pool_release(pool);
return -210; return -210;
} }
@ -175,7 +175,8 @@ static int drain_test(pj_size_t size, pj_size_t increment)
void *p; void *p;
int status = 0; int status = 0;
PJ_LOG(3,("test", "...drain_test(%lu,%lu)", size, increment)); PJ_LOG(3,("test", "...drain_test(%lu,%lu)", (unsigned long)size,
(unsigned long)increment));
if (!pool) if (!pool)
return -10; return -10;
@ -208,7 +209,7 @@ static int drain_test(pj_size_t size, pj_size_t increment)
/* Check that capacity is zero. */ /* Check that capacity is zero. */
if (GET_FREE(pool) != 0) { if (GET_FREE(pool) != 0) {
PJ_LOG(3,("test", "....error: returned free=%lu (expecting 0)", PJ_LOG(3,("test", "....error: returned free=%lu (expecting 0)",
GET_FREE(pool))); (unsigned long)(GET_FREE(pool))));
status=-30; goto on_error; status=-30; goto on_error;
} }

View File

@ -541,14 +541,15 @@ static int send_recv_test(int sock_type,
rc = -155; goto on_error; rc = -155; goto on_error;
} }
if (received <= 0) { if (received <= 0) {
PJ_LOG(3,("", "...error: socket has closed! (received=%ld)", PJ_LOG(3,("", "...error: socket has closed! (received=%lu)",
received)); (unsigned long)received));
rc = -156; goto on_error; rc = -156; goto on_error;
} }
if (received != DATA_LEN-total_received) { if (received != DATA_LEN-total_received) {
if (sock_type != pj_SOCK_STREAM()) { if (sock_type != pj_SOCK_STREAM()) {
PJ_LOG(3,("", "...error: expecting %lu bytes, got %lu bytes", PJ_LOG(3,("", "...error: expecting %lu bytes, got %lu bytes",
DATA_LEN-total_received, received)); (unsigned long)(DATA_LEN-total_received),
(unsigned long)received));
rc = -157; goto on_error; rc = -157; goto on_error;
} }
} }
@ -599,14 +600,15 @@ static int send_recv_test(int sock_type,
rc = -170; goto on_error; rc = -170; goto on_error;
} }
if (received <= 0) { if (received <= 0) {
PJ_LOG(3,("", "...error: socket has closed! (received=%ld)", PJ_LOG(3,("", "...error: socket has closed! (received=%lu)",
received)); (unsigned long)received));
rc = -173; goto on_error; rc = -173; goto on_error;
} }
if (received != BIG_DATA_LEN-total_received) { if (received != BIG_DATA_LEN-total_received) {
if (sock_type != pj_SOCK_STREAM()) { if (sock_type != pj_SOCK_STREAM()) {
PJ_LOG(3,("", "...error: expecting %lu bytes, got %lu bytes", PJ_LOG(3,("", "...error: expecting %lu bytes, got %lu bytes",
BIG_DATA_LEN-total_received, received)); (unsigned long)BIG_DATA_LEN-total_received,
(unsigned long)received));
rc = -176; goto on_error; rc = -176; goto on_error;
} }
} }

View File

@ -350,7 +350,8 @@ static pj_bool_t ssl_on_data_read(pj_ssl_sock_t *ssock,
} }
pj_sockaddr_print((pj_sockaddr_t*)&info.local_addr, buf, sizeof(buf), 1); pj_sockaddr_print((pj_sockaddr_t*)&info.local_addr, buf, sizeof(buf), 1);
PJ_LOG(3, ("", "...%s successfully recv %lu bytes echo", buf, st->recv)); PJ_LOG(3, ("", "...%s successfully recv %lu bytes echo", buf,
(unsigned long)st->recv));
st->done = PJ_TRUE; st->done = PJ_TRUE;
} }
} }
@ -501,7 +502,8 @@ static int https_client_test(unsigned ms_timeout)
} }
PJ_LOG(3, ("", "...Done!")); PJ_LOG(3, ("", "...Done!"));
PJ_LOG(3, ("", ".....Sent/recv: %lu/%lu bytes", state.sent, state.recv)); PJ_LOG(3, ("", ".....Sent/recv: %lu/%lu bytes", (unsigned long)state.sent,
(unsigned long)state.recv));
on_return: on_return:
if (ssock && !state.err && !state.done) if (ssock && !state.err && !state.done)
@ -755,7 +757,8 @@ static int echo_test(pj_ssl_sock_proto srv_proto, pj_ssl_sock_proto cli_proto,
} }
PJ_LOG(3, ("", "...Done!")); PJ_LOG(3, ("", "...Done!"));
PJ_LOG(3, ("", ".....Sent/recv: %lu/%lu bytes", state_cli.sent, state_cli.recv)); PJ_LOG(3, ("", ".....Sent/recv: %lu/%lu bytes", (unsigned long)state_cli.sent,
(unsigned long)state_cli.recv));
on_return: on_return:
#if (PJ_SSL_SOCK_IMP == PJ_SSL_SOCK_IMP_DARWIN) || \ #if (PJ_SSL_SOCK_IMP == PJ_SSL_SOCK_IMP_DARWIN) || \
@ -1464,7 +1467,8 @@ static int perf_test(unsigned clients, unsigned ms_handshake_timeout)
} }
PJ_LOG(3, ("", ".....Clients: %d (%d errors)", clients, cli_err)); PJ_LOG(3, ("", ".....Clients: %d (%d errors)", clients, cli_err));
PJ_LOG(3, ("", ".....Total sent/recv: %lu/%lu bytes", tot_sent, tot_recv)); PJ_LOG(3, ("", ".....Total sent/recv: %lu/%lu bytes",
(unsigned long)tot_sent, (unsigned long)tot_recv));
on_return: on_return:
if (ssock_serv) if (ssock_serv)

View File

@ -68,7 +68,7 @@ static int test_timer_heap(void)
pool = pj_pool_create( mem, NULL, size, 4000, NULL); pool = pj_pool_create( mem, NULL, size, 4000, NULL);
if (!pool) { if (!pool) {
PJ_LOG(3,("test", "...error: unable to create pool of %lu bytes", PJ_LOG(3,("test", "...error: unable to create pool of %lu bytes",
size)); (unsigned long)size));
return -10; return -10;
} }
@ -161,8 +161,8 @@ static int test_timer_heap(void)
} while (PJ_TIME_VAL_LTE(now, expire)&&pj_timer_heap_count(timer) > 0); } while (PJ_TIME_VAL_LTE(now, expire)&&pj_timer_heap_count(timer) > 0);
if (pj_timer_heap_count(timer)) { if (pj_timer_heap_count(timer)) {
PJ_LOG(3, (THIS_FILE, "ERROR: %ld timers left", PJ_LOG(3, (THIS_FILE, "ERROR: %lu timers left",
pj_timer_heap_count(timer))); (unsigned long)pj_timer_heap_count(timer)));
++err; ++err;
} }
t_sched.u32.lo /= count; t_sched.u32.lo /= count;
@ -715,8 +715,8 @@ on_return:
if (timer) if (timer)
pj_timer_heap_destroy(timer); pj_timer_heap_destroy(timer);
PJ_LOG(3,("test", "Total memory of timer heap: %ld", PJ_LOG(3,("test", "Total memory of timer heap: %lu",
pj_timer_heap_mem_size(ST_ENTRY_COUNT))); (unsigned long)pj_timer_heap_mem_size(ST_ENTRY_COUNT)));
if (tparam.idx) if (tparam.idx)
pj_atomic_destroy(tparam.idx); pj_atomic_destroy(tparam.idx);

View File

@ -1141,7 +1141,8 @@ static pj_status_t and_media_codec_encode(pjmedia_codec *codec,
} else { } else {
PJ_LOG(4,(THIS_FILE, "Encoder getInputBuffer " PJ_LOG(4,(THIS_FILE, "Encoder getInputBuffer "
"size: %lu, expecting %d.", "size: %lu, expecting %d.",
output_size, input_size)); (unsigned long)output_size,
input_size));
} }
goto on_return; goto on_return;
} }
@ -1262,7 +1263,8 @@ static pj_status_t and_media_codec_decode(pjmedia_codec *codec,
&input_size); &input_size);
if (input_buf == 0) { if (input_buf == 0) {
PJ_LOG(4,(THIS_FILE, "Decoder getInputBuffer failed " PJ_LOG(4,(THIS_FILE, "Decoder getInputBuffer failed "
"return input_buf=%d, size=%lu", *input_buf, input_size)); "return input_buf=%d, size=%lu", *input_buf,
(unsigned long)input_size));
goto on_return; goto on_return;
} }

View File

@ -1033,7 +1033,8 @@ static pj_status_t and_media_codec_encode_begin(pjmedia_vid_codec *codec,
} else { } else {
PJ_LOG(4,(THIS_FILE, "Encoder getInputBuffer " PJ_LOG(4,(THIS_FILE, "Encoder getInputBuffer "
"size: %lu, expecting %lu.", "size: %lu, expecting %lu.",
output_size, input->size)); (unsigned long)output_size,
(unsigned long)input->size));
} }
goto on_return; goto on_return;
} }

View File

@ -1182,7 +1182,7 @@ static pj_status_t oh264_codec_decode(pjmedia_vid_codec *codec,
PJ_LOG(5,(THIS_FILE, "Decode couldn't produce picture, " PJ_LOG(5,(THIS_FILE, "Decode couldn't produce picture, "
"input nframes=%lu, concatenated size=%d bytes, ret=%d", "input nframes=%lu, concatenated size=%d bytes, ret=%d",
count, whole_len, ret)); (unsigned long)count, whole_len, ret));
} }
return status; return status;

View File

@ -931,7 +931,7 @@ static pj_status_t codec_parse( pjmedia_codec *codec,
sizeof(tmp_buf)); sizeof(tmp_buf));
if (size < 0) { if (size < 0) {
PJ_LOG(5, (THIS_FILE, "Parse failed! (pkt_size=%lu, err=%d)", PJ_LOG(5, (THIS_FILE, "Parse failed! (pkt_size=%lu, err=%d)",
pkt_size, size)); (unsigned long)pkt_size, size));
pj_mutex_unlock (opus_data->mutex); pj_mutex_unlock (opus_data->mutex);
return PJMEDIA_CODEC_EFAILED; return PJMEDIA_CODEC_EFAILED;
} }

View File

@ -1404,8 +1404,8 @@ on_return:
PJMEDIA_EVENT_PUBLISH_DEFAULT); PJMEDIA_EVENT_PUBLISH_DEFAULT);
PJ_LOG(5,(THIS_FILE, "Decode couldn't produce picture, " PJ_LOG(5,(THIS_FILE, "Decode couldn't produce picture, "
"input nframes=%ld, concatenated size=%d bytes", "input nframes=%lu, concatenated size=%d bytes",
count, whole_len)); (unsigned long)count, whole_len));
output->type = PJMEDIA_FRAME_TYPE_NONE; output->type = PJMEDIA_FRAME_TYPE_NONE;
output->size = 0; output->size = 0;

View File

@ -830,7 +830,7 @@ on_return:
PJ_LOG(4,(THIS_FILE, "Decode couldn't produce picture, " PJ_LOG(4,(THIS_FILE, "Decode couldn't produce picture, "
"input nframes=%lu, concatenated size=%d bytes", "input nframes=%lu, concatenated size=%d bytes",
count, whole_len)); (unsigned long)count, whole_len));
output->type = PJMEDIA_FRAME_TYPE_NONE; output->type = PJMEDIA_FRAME_TYPE_NONE;
output->size = 0; output->size = 0;

View File

@ -745,7 +745,7 @@ static pj_status_t send_raw(dtls_srtp *ds, unsigned idx, const void *buf,
{ {
#if DTLS_DEBUG #if DTLS_DEBUG
PJ_LOG(2,(ds->base.name, "DTLS-SRTP %s sending %lu bytes", PJ_LOG(2,(ds->base.name, "DTLS-SRTP %s sending %lu bytes",
CHANNEL_TO_STRING(idx), len)); CHANNEL_TO_STRING(idx), (unsigned long)len));
#endif #endif
return (idx == RTP_CHANNEL? return (idx == RTP_CHANNEL?
@ -1280,7 +1280,7 @@ static pj_status_t dtls_on_recv(pjmedia_transport *tp, unsigned idx,
#if DTLS_DEBUG #if DTLS_DEBUG
PJ_LOG(2,(ds->base.name, "DTLS-SRTP %s receiving %lu bytes", PJ_LOG(2,(ds->base.name, "DTLS-SRTP %s receiving %lu bytes",
CHANNEL_TO_STRING(idx), size)); CHANNEL_TO_STRING(idx), (unsigned long)size));
#endif #endif
/* This is DTLS packet, let's process it. Note that if DTLS nego has /* This is DTLS packet, let's process it. Note that if DTLS nego has

View File

@ -1398,7 +1398,8 @@ static pj_status_t vid_pasv_port_put_frame(struct pjmedia_port *this_port,
if (frame->size != vp->src_size) { if (frame->size != vp->src_size) {
if (frame->size > 0) { if (frame->size > 0) {
PJ_LOG(4,(THIS_FILE, "Unexpected frame size %lu, expected %lu", PJ_LOG(4,(THIS_FILE, "Unexpected frame size %lu, expected %lu",
frame->size, vp->src_size)); (unsigned long)frame->size,
(unsigned long)vp->src_size));
} }
pj_memcpy(&frame_, frame, sizeof(pjmedia_frame)); pj_memcpy(&frame_, frame, sizeof(pjmedia_frame));

View File

@ -220,7 +220,7 @@ PJ_DEF(pj_status_t) pjmedia_wav_writer_port_create( pj_pool_t *pool,
(int)fport->base.info.name.slen, (int)fport->base.info.name.slen,
fport->base.info.name.ptr, fport->base.info.name.ptr,
PJMEDIA_PIA_SRATE(&fport->base.info), PJMEDIA_PIA_SRATE(&fport->base.info),
fport->bufsize / 1000)); (unsigned long)(fport->bufsize / 1000)));
return PJ_SUCCESS; return PJ_SUCCESS;

View File

@ -178,7 +178,8 @@ static int codec_test_encode(pjmedia_codec_mgr *mgr,
break; break;
} }
PJ_LOG(1,(THIS_FILE," failed: mismatch at pos %ld", pos+i)); PJ_LOG(1,(THIS_FILE," failed: mismatch at pos %lu",
(unsigned long)(pos+i)));
rc = -200; rc = -200;
break; break;
} }

View File

@ -1047,8 +1047,8 @@ static pj_bool_t alloc_on_data_recvfrom(pj_activesock_t *asock,
} }
} }
if (i==alloc->perm_cnt) { if (i==alloc->perm_cnt) {
PJ_LOG(5,("", "Client %s received %ld bytes unauthorized data from peer %s", PJ_LOG(5,("", "Client %s received %lu bytes unauthorized data from peer %s",
client_info, size, peer_info)); client_info, (unsigned long)size, peer_info));
if (alloc->perm_cnt == 0) if (alloc->perm_cnt == 0)
PJ_LOG(5,("", "Client %s has no permission", client_info)); PJ_LOG(5,("", "Client %s has no permission", client_info));
return PJ_TRUE; return PJ_TRUE;
@ -1073,8 +1073,8 @@ static pj_bool_t alloc_on_data_recvfrom(pj_activesock_t *asock,
/* Send */ /* Send */
sent = size; sent = size;
PJ_LOG(5,("", "Forwarding %ld bytes data from peer %s to client %s", PJ_LOG(5,("", "Forwarding %lu bytes data from peer %s to client %s",
sent, peer_info, client_info)); (unsigned long)sent, peer_info, client_info));
pj_activesock_sendto(alloc->test_srv->turn_sock, &alloc->send_key, buffer, pj_activesock_sendto(alloc->test_srv->turn_sock, &alloc->send_key, buffer,
&sent, 0, &alloc->client_addr, &sent, 0, &alloc->client_addr,

View File

@ -2547,8 +2547,8 @@ PJ_DEF(pj_status_t) pj_stun_msg_decode(pj_pool_t *pool,
if (pdu_len > 0) { if (pdu_len > 0) {
/* Stray trailing bytes */ /* Stray trailing bytes */
PJ_LOG(4,(THIS_FILE, PJ_LOG(4,(THIS_FILE,
"Error decoding STUN message: unparsed trailing %ld bytes", "Error decoding STUN message: unparsed trailing %lu bytes",
pdu_len)); (unsigned long)pdu_len));
return PJNATH_EINSTUNMSGLEN; return PJNATH_EINSTUNMSGLEN;
} }

View File

@ -1034,8 +1034,8 @@ static void handle_peer_pkt(pj_turn_allocation *alloc,
char peer_addr[80]; char peer_addr[80];
pj_sockaddr_print(src_addr, peer_addr, sizeof(peer_addr), 3); pj_sockaddr_print(src_addr, peer_addr, sizeof(peer_addr), 3);
PJ_LOG(4,(alloc->obj_name, "Client %s: discarded data from %s " PJ_LOG(4,(alloc->obj_name, "Client %s: discarded data from %s "
"because it's too long (%ld bytes)", "because it's too long (%lu bytes)",
alloc->info, peer_addr, len)); alloc->info, peer_addr, (unsigned long)len));
return; return;
} }

View File

@ -857,8 +857,9 @@ PJ_DEF(pj_status_t) pjsip_100rel_tx_response(pjsip_inv_session *inv,
status = PJ_SUCCESS; status = PJ_SUCCESS;
PJ_LOG(4,(dd->inv->dlg->obj_name, PJ_LOG(4,(dd->inv->dlg->obj_name,
"Reliable %d response enqueued (%ld pending)", "Reliable %d response enqueued (%lu pending)",
code, pj_list_size(&dd->uas_state->tx_data_list))); code, (unsigned long)
pj_list_size(&dd->uas_state->tx_data_list)));
} else { } else {
pj_list_push_back(&dd->uas_state->tx_data_list, tl); pj_list_push_back(&dd->uas_state->tx_data_list, tl);

View File

@ -788,7 +788,8 @@ PJ_DEF(pj_status_t) pjsip_endpt_schedule_timer_dbg(pjsip_endpoint *endpt,
int src_line) int src_line)
{ {
PJ_LOG(6, (THIS_FILE, "pjsip_endpt_schedule_timer(entry=%p, delay=%lu.%lu)", PJ_LOG(6, (THIS_FILE, "pjsip_endpt_schedule_timer(entry=%p, delay=%lu.%lu)",
entry, delay->sec, delay->msec)); entry, (unsigned long)delay->sec,
(unsigned long)delay->msec));
return pj_timer_heap_schedule_dbg(endpt->timer_heap, entry, delay, return pj_timer_heap_schedule_dbg(endpt->timer_heap, entry, delay,
src_file, src_line); src_file, src_line);
} }
@ -797,8 +798,9 @@ PJ_DEF(pj_status_t) pjsip_endpt_schedule_timer( pjsip_endpoint *endpt,
pj_timer_entry *entry, pj_timer_entry *entry,
const pj_time_val *delay ) const pj_time_val *delay )
{ {
PJ_LOG(6, (THIS_FILE, "pjsip_endpt_schedule_timer(entry=%p, delay=%u.%u)", PJ_LOG(6, (THIS_FILE, "pjsip_endpt_schedule_timer(entry=%p, delay=%lu.%lu)",
entry, delay->sec, delay->msec)); entry, (unsigned long)delay->sec,
(unsigned long)delay->msec));
return pj_timer_heap_schedule( endpt->timer_heap, entry, delay ); return pj_timer_heap_schedule( endpt->timer_heap, entry, delay );
} }
#endif #endif
@ -817,8 +819,9 @@ PJ_DEF(pj_status_t) pjsip_endpt_schedule_timer_w_grp_lock_dbg(
int src_line) int src_line)
{ {
PJ_LOG(6, (THIS_FILE, "pjsip_endpt_schedule_timer_w_grp_lock" PJ_LOG(6, (THIS_FILE, "pjsip_endpt_schedule_timer_w_grp_lock"
"(entry=%p, delay=%ld.%ld, grp_lock=%p)", "(entry=%p, delay=%lu.%lu, grp_lock=%p)",
entry, delay->sec, delay->msec, grp_lock)); entry, (unsigned long)delay->sec,
(unsigned long)delay->msec, grp_lock));
return pj_timer_heap_schedule_w_grp_lock_dbg(endpt->timer_heap, entry, return pj_timer_heap_schedule_w_grp_lock_dbg(endpt->timer_heap, entry,
delay, id_val, grp_lock, delay, id_val, grp_lock,
src_file, src_line); src_file, src_line);
@ -832,8 +835,9 @@ PJ_DEF(pj_status_t) pjsip_endpt_schedule_timer_w_grp_lock(
pj_grp_lock_t *grp_lock ) pj_grp_lock_t *grp_lock )
{ {
PJ_LOG(6, (THIS_FILE, "pjsip_endpt_schedule_timer_w_grp_lock" PJ_LOG(6, (THIS_FILE, "pjsip_endpt_schedule_timer_w_grp_lock"
"(entry=%p, delay=%u.%u, grp_lock=%p)", "(entry=%p, delay=%lu.%lu, grp_lock=%p)",
entry, delay->sec, delay->msec, grp_lock)); entry, (unsigned long)delay->sec,
(unsigned long)delay->msec, grp_lock));
return pj_timer_heap_schedule_w_grp_lock( endpt->timer_heap, entry, return pj_timer_heap_schedule_w_grp_lock( endpt->timer_heap, entry,
delay, id_val, grp_lock ); delay, id_val, grp_lock );
} }
@ -1314,8 +1318,8 @@ PJ_DEF(void) pjsip_endpt_dump( pjsip_endpoint *endpt, pj_bool_t detail )
/* Pool health. */ /* Pool health. */
PJ_LOG(3, (THIS_FILE," Endpoint pool capacity=%lu, used_size=%lu", PJ_LOG(3, (THIS_FILE," Endpoint pool capacity=%lu, used_size=%lu",
pj_pool_get_capacity(endpt->pool), (unsigned long)pj_pool_get_capacity(endpt->pool),
pj_pool_get_used_size(endpt->pool))); (unsigned long)pj_pool_get_used_size(endpt->pool)));
/* Resolver */ /* Resolver */
#if PJSIP_HAS_RESOLVER #if PJSIP_HAS_RESOLVER
@ -1333,7 +1337,7 @@ PJ_DEF(void) pjsip_endpt_dump( pjsip_endpoint *endpt, pj_bool_t detail )
pj_timer_heap_dump(endpt->timer_heap); pj_timer_heap_dump(endpt->timer_heap);
#else #else
PJ_LOG(3,(THIS_FILE, " Timer heap has %lu entries", PJ_LOG(3,(THIS_FILE, " Timer heap has %lu entries",
pj_timer_heap_count(endpt->timer_heap))); (unsigned long)pj_timer_heap_count(endpt->timer_heap)));
#endif #endif
/* Unlock mutex. */ /* Unlock mutex. */

View File

@ -2225,8 +2225,8 @@ PJ_DEF(pj_ssize_t) pjsip_tpmgr_receive_packet( pjsip_tpmgr *mgr,
*/ */
if (tmp.slen) { if (tmp.slen) {
PJ_LOG(2, (THIS_FILE, PJ_LOG(2, (THIS_FILE,
"Dropping %ld bytes packet from %s %s:%d %.*s\n", "Dropping %lu bytes packet from %s %s:%d %.*s\n",
msg_fragment_size, (unsigned long)msg_fragment_size,
rdata->tp_info.transport->type_name, rdata->tp_info.transport->type_name,
rdata->pkt_info.src_name, rdata->pkt_info.src_name,
rdata->pkt_info.src_port, rdata->pkt_info.src_port,

View File

@ -503,7 +503,8 @@ on_return:
/* Dumping memory pool usage */ /* Dumping memory pool usage */
PJ_LOG(3,(THIS_FILE, "Peak memory size=%lu MB", PJ_LOG(3,(THIS_FILE, "Peak memory size=%lu MB",
caching_pool.peak_used_size / 1000000)); (unsigned long)
(caching_pool.peak_used_size / 1000000)));
pjsip_endpt_destroy(endpt); pjsip_endpt_destroy(endpt);
pj_caching_pool_destroy(&caching_pool); pj_caching_pool_destroy(&caching_pool);