Fix build with CFLAGS -Wextra warning reports (#3428)

This commit is contained in:
jimying 2023-03-14 09:56:18 +08:00 committed by GitHub
parent d1c5e4da5b
commit b4184bb56d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 196 additions and 139 deletions

View File

@ -58,7 +58,7 @@ PJ_DECL(void) pj_sha1_init(pj_sha1_context *ctx);
*/
PJ_DECL(void) pj_sha1_update(pj_sha1_context *ctx,
const pj_uint8_t *data,
const pj_size_t nbytes);
pj_size_t nbytes);
/** Finish the message and return the digest.
* @param ctx SHA1 context.

View File

@ -935,7 +935,7 @@ static pj_bool_t handle_backspace(cli_telnet_sess *sess, unsigned char *data)
echo[0] = *data;
telnet_sess_send2(sess, echo, 5);
} else {
const static unsigned char echo[3] = {0x08, 0x20, 0x08};
unsigned char echo[3] = {0x08, 0x20, 0x08};
telnet_sess_send2(sess, echo, 3);
}
return PJ_TRUE;

View File

@ -1507,7 +1507,11 @@ static void str_snprintf(pj_str_t *s, size_t size,
size -= s->slen;
retval = pj_ansi_vsnprintf(s->ptr + s->slen,
size, format, arg);
s->slen += ((retval < (int)size) ? retval : size - 1);
if (retval < 0) {
pj_assert(retval >= 0);
retval = 0;
}
s->slen += (((size_t)retval < size) ? (size_t)retval : size - 1);
va_end(arg);
}

View File

@ -504,7 +504,7 @@ static pj_status_t write_children(const pj_json_list *list,
child = child->next;
}
} else {
if (st->indent < sizeof(st->indent_buf)) {
if (st->indent < (int)sizeof(st->indent_buf)) {
st->indent += PJ_JSON_INDENT_SIZE;
indent_added = PJ_TRUE;
}
@ -577,7 +577,7 @@ static pj_status_t elem_write(const pj_json_elem *elem,
len = pj_ansi_snprintf(num_buf, sizeof(num_buf), "%f",
elem->value.num);
if (len < 0 || len >= sizeof(num_buf))
if (len < 0 || len >= (int)sizeof(num_buf))
return PJ_ETOOBIG;
CHECK( st->writer( num_buf, len, st->user_data) );
}

View File

@ -203,7 +203,7 @@ PJ_DEF(void) pj_sha1_init(pj_sha1_context* context)
/* Run your data through this. */
PJ_DEF(void) pj_sha1_update(pj_sha1_context* context,
const pj_uint8_t* data, const pj_size_t len)
const pj_uint8_t* data, pj_size_t len)
{
pj_size_t i, j;

View File

@ -78,7 +78,7 @@ PJ_BEGIN_DECL
* @param len The length of the string buffer.
*/
#define PJ_CHECK_TRUNC_STR(ret, str, len) \
if ((ret) >= (len) || (ret) < 0) pj_ansi_strcpy((str) + (len) - 3, "..")
if ((int)(ret) >= (int)(len) || (ret) < 0) pj_ansi_strcpy((str) + (len) - 3, "..")
/**
* Create string initializer from a normal C string.

View File

@ -50,7 +50,7 @@ PJ_IDEF(pj_str_t*) pj_strdup_with_null( pj_pool_t *pool,
pj_str_t *dst,
const pj_str_t *src)
{
pj_size_t src_slen = src->slen;
pj_ssize_t src_slen = src->slen;
pj_assert(src->slen >= 0);

View File

@ -193,5 +193,6 @@ PJ_DEF(pj_status_t) pj_ioqueue_connect( pj_ioqueue_t *ioqueue,
PJ_DEF(pj_oshandle_t) pj_ioqueue_get_os_handle( pj_ioqueue_t *ioqueue )
{
PJ_UNUSED_ARG(ioqueue);
return NULL;
}

View File

@ -282,7 +282,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_create2(pj_pool_t *pool,
const unsigned type_mask = PJ_IOQUEUE_EPOLL_EXCLUSIVE |
PJ_IOQUEUE_EPOLL_ONESHOT;
unsigned epoll_support, valid_types;
int i;
pj_size_t i;
/* Check that arguments are valid. */
PJ_ASSERT_RETURN(pool != NULL && p_ioqueue != NULL &&

View File

@ -119,7 +119,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_create2(pj_pool_t *pool,
pj_ioqueue_t *ioqueue;
pj_status_t rc;
pj_lock_t *lock;
int i;
pj_size_t i;
/* Check that arguments are valid. */
PJ_ASSERT_RETURN(pool != NULL && p_ioqueue != NULL && max_fd > 0,

View File

@ -205,7 +205,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_create2(pj_pool_t *pool,
{
pj_ioqueue_t *ioqueue;
pj_lock_t *lock;
unsigned i;
pj_size_t i;
pj_status_t rc;
/* Check that arguments are valid. */
@ -1140,5 +1140,6 @@ PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioqueue, const pj_time_val *timeout)
PJ_DEF(pj_oshandle_t) pj_ioqueue_get_os_handle( pj_ioqueue_t *ioqueue )
{
PJ_UNUSED_ARG(ioqueue);
return NULL;
}

View File

@ -866,5 +866,6 @@ PJ_DEF(pj_status_t) pj_ioqueue_unlock_key(pj_ioqueue_key_t *key)
PJ_DEF(pj_oshandle_t) pj_ioqueue_get_os_handle( pj_ioqueue_t *ioqueue )
{
PJ_UNUSED_ARG(ioqueue);
return NULL;
}

View File

@ -364,5 +364,6 @@ PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioq,
PJ_DEF(pj_oshandle_t) pj_ioqueue_get_os_handle( pj_ioqueue_t *ioqueue )
{
PJ_UNUSED_ARG(ioqueue);
return NULL;
}

View File

@ -361,7 +361,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_create2(pj_pool_t *pool,
pj_ioqueue_t **p_ioqueue)
{
pj_ioqueue_t *ioqueue;
unsigned i;
pj_size_t i;
pj_status_t rc;
PJ_UNUSED_ARG(max_fd);

View File

@ -511,7 +511,7 @@ static pj_status_t get_ipv6_deprecated(unsigned *count, pj_sockaddr addr[])
struct nlmsghdr *nlmsg_ptr = (struct nlmsghdr *) read_buffer;
int nlmsg_len = read_size;
if (nlmsg_len < sizeof (struct nlmsghdr))
if (nlmsg_len < (int)sizeof(struct nlmsghdr))
return PJ_ETOOSMALL;
if (nlmsg_ptr->nlmsg_type == NLMSG_DONE)
@ -587,7 +587,7 @@ PJ_DEF(pj_status_t) pj_enum_ip_interface2( const pj_enum_ip_option *opt,
pj_sockaddr deprecatedAddrs[*p_cnt];
unsigned deprecatedCount = *p_cnt;
unsigned cnt = 0;
int i;
unsigned i;
pj_status_t status;
status = get_ipv6_deprecated(&deprecatedCount, deprecatedAddrs);
@ -599,8 +599,8 @@ PJ_DEF(pj_status_t) pj_enum_ip_interface2( const pj_enum_ip_option *opt,
return status;
for (i = 0; i < *p_cnt; ++i) {
int j;
unsigned j;
ifs[cnt++] = addrs[i];
if (addrs[i].addr.sa_family != pj_AF_INET6())

View File

@ -23,6 +23,7 @@
PJ_DEF(int) pj_run_app(pj_main_func_ptr main_func, int argc, char *argv[],
unsigned flags)
{
PJ_UNUSED_ARG(flags);
return (*main_func)(argc, argv);
}
@ -79,7 +80,8 @@ PJ_DEF(int) pj_run_app(pj_main_func_ptr main_func, int argc, char *argv[],
pthread_t thread;
run_app_t param;
NSAutoreleasePool *pool;
PJ_UNUSED_ARG(flags);
pool = [[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
[DeadThread enterMultiThreadedMode];

View File

@ -138,8 +138,8 @@ struct pj_event_t
pthread_cond_t cond;
pj_bool_t auto_reset;
unsigned threads_waiting;
unsigned threads_to_release;
int threads_waiting;
int threads_to_release;
};
#endif /* PJ_HAS_EVENT_OBJ */
@ -1713,6 +1713,7 @@ PJ_DEF(pj_status_t) pj_sem_create( pj_pool_t *pool,
{
#if PJ_HAS_THREADS
pj_sem_t *sem;
PJ_UNUSED_ARG(max);
PJ_CHECK_STACK();
PJ_ASSERT_RETURN(pool != NULL && ptr_sem != NULL, PJ_EINVAL);
@ -1779,6 +1780,10 @@ PJ_DEF(pj_status_t) pj_sem_create( pj_pool_t *pool,
*ptr_sem = sem;
return PJ_SUCCESS;
#else
PJ_UNUSED_ARG(pool);
PJ_UNUSED_ARG(name);
PJ_UNUSED_ARG(initial);
PJ_UNUSED_ARG(max);
*ptr_sem = (pj_sem_t*)1;
return PJ_SUCCESS;
#endif
@ -2141,6 +2146,7 @@ PJ_DEF(pj_color_t) pj_term_get_color(void)
PJ_DEF(int) pj_run_app(pj_main_func_ptr main_func, int argc, char *argv[],
unsigned flags)
{
PJ_UNUSED_ARG(flags);
return (*main_func)(argc, argv);
}
#endif

View File

@ -543,8 +543,8 @@ static pj_status_t create_identity_from_cert(applessl_sock_t *assock,
pj_bzero(&key_params, sizeof(key_params));
key_params.version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION;
key_params.passphrase = password;
for (i = 0; i < PJ_ARRAY_SIZE(ext_format); i++) {
for (i = 0; i < (CFIndex)PJ_ARRAY_SIZE(ext_format); i++) {
items = NULL;
err = SecItemImport(cert_data, NULL, &ext_format[i],
&ext_type, 0, &key_params, NULL, &items);
@ -735,6 +735,7 @@ static pj_status_t network_send(pj_ssl_sock_t *ssock,
pj_ssize_t *size,
unsigned flags)
{
PJ_UNUSED_ARG(flags);
applessl_sock_t *assock = (applessl_sock_t *)ssock;
dispatch_data_t content;
@ -832,6 +833,8 @@ static pj_status_t network_start_read(pj_ssl_sock_t *ssock,
^(dispatch_data_t region, size_t offset,
const void *buffer, size_t inSize)
{
PJ_UNUSED_ARG(region);
PJ_UNUSED_ARG(offset);
/* This block can be invoked multiple times,
* each for every contiguous memory region in the content.
*/
@ -1013,6 +1016,7 @@ static pj_status_t network_create_params(pj_ssl_sock_t * ssock,
^(sec_protocol_metadata_t metadata,
sec_protocol_challenge_complete_t complete)
{
PJ_UNUSED_ARG(metadata);
complete(assock->identity);
}, assock->queue);
@ -1388,7 +1392,7 @@ static pj_status_t network_start_connect(pj_ssl_sock_t *ssock,
static pj_ssl_sock_t *ssl_alloc(pj_pool_t *pool)
{
applessl_sock_t *assock;
/* Create event manager */
if (event_manager_create() != PJ_SUCCESS)
return NULL;
@ -1401,7 +1405,7 @@ static pj_ssl_sock_t *ssl_alloc(pj_pool_t *pool)
ssl_destroy(&assock->base);
return NULL;
}
return (pj_ssl_sock_t *)assock;
}
@ -1410,6 +1414,7 @@ static pj_status_t ssl_create(pj_ssl_sock_t *ssock)
/* Nothing to do here. SSL has been configured before connection
* is started.
*/
PJ_UNUSED_ARG(ssock);
return PJ_SUCCESS;
}
@ -1791,7 +1796,7 @@ static void get_info_and_cn(CFArrayRef array, CFMutableStringRef info,
int i, n;
*cn = NULL;
for(i = 0; i < sizeof(keys)/sizeof(keys[0]); i++) {
for(i = 0; i < (int)PJ_ARRAY_SIZE(keys); i++) {
for (n = 0 ; n < CFArrayGetCount(array); n++) {
CFDictionaryRef dict;
CFTypeRef dictkey;
@ -2152,7 +2157,7 @@ static pj_status_t ssl_do_handshake(pj_ssl_sock_t *ssock)
/* Nothing to do here, just return EPENDING. Handshake has
* automatically been performed when starting a connection.
*/
PJ_UNUSED_ARG(ssock);
return PJ_EPENDING;
}
@ -2169,7 +2174,7 @@ static pj_status_t ssl_read(pj_ssl_sock_t *ssock, void *data, int *size)
}
circ_buf_size = circ_size(&ssock->circ_buf_input);
read_size = PJ_MIN(circ_buf_size, *size);
read_size = PJ_MIN(circ_buf_size, (pj_size_t)*size);
circ_read(&ssock->circ_buf_input, data, read_size);

View File

@ -289,8 +289,8 @@ static pj_status_t set_cert(darwinssl_sock_t *dssock, pj_ssl_cert_t *cert)
pj_bzero(&key_params, sizeof(key_params));
key_params.version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION;
key_params.passphrase = password;
for (i = 0; i < PJ_ARRAY_SIZE(ext_format); i++) {
for (i = 0; i < (CFIndex)PJ_ARRAY_SIZE(ext_format); i++) {
items = NULL;
err = SecItemImport(cert_data, NULL, &ext_format[i],
&ext_type, 0, &key_params, NULL, &items);
@ -472,12 +472,12 @@ static pj_status_t ssl_create(pj_ssl_sock_t *ssock)
if (ssock->param.ciphers_num > 0) {
int i, n = ssock->param.ciphers_num;
SSLCipherSuite ciphers[MAX_CIPHERS];
if (n > PJ_ARRAY_SIZE(ciphers))
n = PJ_ARRAY_SIZE(ciphers);
if (n > (int)PJ_ARRAY_SIZE(ciphers))
n = (int)PJ_ARRAY_SIZE(ciphers);
for (i = 0; i < n; i++)
ciphers[i] = (SSLCipherSuite)ssock->param.ciphers[i];
err = SSLSetEnabledCiphers(ssl_ctx, ciphers, n);
if (err != noErr)
return pj_status_from_err(dssock, "SetEnabledCiphers", err);
@ -835,7 +835,7 @@ static void get_info_and_cn(CFArrayRef array, CFMutableStringRef info,
int i, n;
*cn = NULL;
for(i = 0; i < sizeof(keys)/sizeof(keys[0]); i++) {
for(i = 0; i < (int)PJ_ARRAY_SIZE(keys); i++) {
for (n = 0 ; n < CFArrayGetCount(array); n++) {
CFDictionaryRef dict;
CFTypeRef dictkey;
@ -1281,6 +1281,7 @@ static pj_status_t verify_cert(darwinssl_sock_t * dssock, pj_ssl_cert_t *cert)
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^(SecTrustRef trust, SecTrustResultType trust_result)
{
PJ_UNUSED_ARG(trust);
/* Unfortunately SecTrustEvaluate() cannot seem to get us
* more specific verification result like the original
* error status returned directly by SSLHandshake()
@ -1413,10 +1414,10 @@ static pj_status_t ssl_write(pj_ssl_sock_t *ssock, const void *data,
*nwritten = (int)processed;
if (err != noErr) {
return pj_status_from_err(dssock, "SSLWrite", err);
} else if (processed < size) {
} else if ((pj_ssize_t)processed < size) {
return PJ_ENOMEM;
}
return PJ_SUCCESS;
}
@ -1429,7 +1430,7 @@ static pj_status_t ssl_renegotiate(pj_ssl_sock_t *ssock)
if (err != noErr) {
return pj_status_from_err(dssock, "SSLReHandshake", err);
}
return PJ_SUCCESS;
}

View File

@ -174,6 +174,7 @@ static pj_status_t tls_status_from_err(pj_ssl_sock_t *ssock, int err)
static pj_str_t tls_strerror(pj_status_t status,
char *buf, pj_size_t bufsize)
{
PJ_UNUSED_ARG(status);
pj_str_t errstr;
const char *tmp = gnutls_strerror(tls_last_error);
@ -444,7 +445,7 @@ static pj_status_t tls_priorities_set(pj_ssl_sock_t *ssock)
pj_strcat2(&priority, "%LATEST_RECORD_VERSION");
pj_strcat(&cipher_list, &priority);
for (i = 0; i < ssock->param.ciphers_num; i++) {
for (i = 0; i < (int)ssock->param.ciphers_num; i++) {
for (j = 0; ; j++) {
pj_ssl_cipher c;
const char *suite;
@ -505,7 +506,7 @@ static pj_status_t tls_priorities_set(pj_ssl_sock_t *ssock)
/* Server will be the one deciding which crypto to use */
if (ssock->is_server) {
if (cipher_list.slen + server.slen + 1 > sizeof(buf))
if (cipher_list.slen + server.slen + 1 > (pj_ssize_t)sizeof(buf))
return PJ_ETOOMANY;
else
pj_strcat(&cipher_list, &server);

View File

@ -849,8 +849,8 @@ static pj_bool_t ssock_on_data_sent (pj_ssl_sock_t *ssock,
pj_ioqueue_op_key_t *app_key = wdata->app_key;
pj_ssize_t sent_len;
sent_len = (sent > 0)? wdata->plain_data_len : sent;
sent_len = (sent > 0)? (pj_ssize_t)wdata->plain_data_len : sent;
/* Update write buffer state */
pj_lock_acquire(ssock->write_mutex);
free_send_data(ssock, wdata);

View File

@ -212,21 +212,29 @@ static pj_status_t circ_write(circ_buf_t *cb,
inline static pj_bool_t io_empty(pj_ssl_sock_t *ssock, circ_buf_t *cb)
{
PJ_UNUSED_ARG(ssock);
return circ_empty(cb);
}
inline static pj_size_t io_size(pj_ssl_sock_t *ssock, circ_buf_t *cb)
{
PJ_UNUSED_ARG(ssock);
return circ_size(cb);
}
inline static void io_reset(pj_ssl_sock_t *ssock, circ_buf_t *cb) {}
inline static void io_reset(pj_ssl_sock_t *ssock, circ_buf_t *cb)
{
PJ_UNUSED_ARG(ssock);
PJ_UNUSED_ARG(cb);
}
inline static void io_read(pj_ssl_sock_t *ssock, circ_buf_t *cb,
pj_uint8_t *dst, pj_size_t len)
{
PJ_UNUSED_ARG(ssock);
return circ_read(cb, dst, len);
}
inline static pj_status_t io_write(pj_ssl_sock_t *ssock, circ_buf_t *cb,
const pj_uint8_t *src, pj_size_t len)
{
PJ_UNUSED_ARG(ssock);
return circ_write(cb, src, len);
}

View File

@ -1454,7 +1454,7 @@ static pj_status_t init_ossl_ctx(pj_ssl_sock_t *ssock)
int i;
/* Check and load ECC & DSA certificates & private keys */
for (i = 0; i < PJ_ARRAY_SIZE(cert_types); ++i) {
for (i = 0; i < (int)PJ_ARRAY_SIZE(cert_types); ++i) {
int err;
pj_memcpy(p, cert_types[i], CERT_TYPE_LEN);

View File

@ -602,7 +602,7 @@ int ioqueue_perf_test(void)
int i, rc;
/* Defailed performance report (concurrency=1) */
for (i=0; i<PJ_ARRAY_SIZE(epoll_flags); ++i) {
for (i=0; i<(int)PJ_ARRAY_SIZE(epoll_flags); ++i) {
pj_ioqueue_cfg_default(&cfg);
cfg.epoll_flags = epoll_flags[i];
@ -637,7 +637,7 @@ int ioqueue_perf_test(void)
return rc;
/* The benchmark across configs */
for (i=0; i<PJ_ARRAY_SIZE(epoll_flags); ++i) {
for (i=0; i<(int)PJ_ARRAY_SIZE(epoll_flags); ++i) {
int concur;
for (concur=0; concur<2; ++concur) {
pj_ioqueue_cfg_default(&cfg);

View File

@ -827,7 +827,6 @@ static test_desc tests[128] = {
.cfg.title = "basic tcp (single thread, EPOLLEXCLUSIVE)",
.cfg.max_fd = 6,
.cfg.allow_concur = 1,
.cfg.epoll_flags = PJ_IOQUEUE_DEFAULT_EPOLL_FLAGS,
.cfg.epoll_flags = PJ_IOQUEUE_EPOLL_EXCLUSIVE,
.cfg.sock_type = SOCK_STREAM,
.cfg.n_threads = 0,
@ -1223,7 +1222,7 @@ int ioqueue_stress_test(void)
test_cb.on_accept_complete = on_accept_complete;
test_cb.on_connect_complete = on_connect_complete;
for (i=0; i<PJ_ARRAY_SIZE(tests); ++i) {
for (i=0; i<(int)PJ_ARRAY_SIZE(tests); ++i) {
int r;
test_desc *test = &tests[i];

View File

@ -959,7 +959,7 @@ int tcp_ioqueue_test()
pj_bool_t concurs[] = { PJ_TRUE, PJ_FALSE };
int i, rc;
for (i=0; i<PJ_ARRAY_SIZE(epoll_flags); ++i) {
for (i=0; i<(int)PJ_ARRAY_SIZE(epoll_flags); ++i) {
pj_ioqueue_cfg cfg;
pj_ioqueue_cfg_default(&cfg);
@ -973,7 +973,7 @@ int tcp_ioqueue_test()
return rc;
}
for (i=0; i<PJ_ARRAY_SIZE(concurs); ++i) {
for (i=0; i<(int)PJ_ARRAY_SIZE(concurs); ++i) {
pj_ioqueue_cfg cfg;
pj_ioqueue_cfg_default(&cfg);

View File

@ -1243,7 +1243,7 @@ int udp_ioqueue_test()
pj_bool_t concurs[] = { PJ_TRUE, PJ_FALSE };
int i, rc, err = 0;
for (i=0; i<PJ_ARRAY_SIZE(epoll_flags); ++i) {
for (i=0; i<(int)PJ_ARRAY_SIZE(epoll_flags); ++i) {
pj_ioqueue_cfg cfg;
pj_ioqueue_cfg_default(&cfg);
@ -1257,7 +1257,7 @@ int udp_ioqueue_test()
err = rc;
}
for (i=0; i<PJ_ARRAY_SIZE(concurs); ++i) {
for (i=0; i<(int)PJ_ARRAY_SIZE(concurs); ++i) {
pj_ioqueue_cfg cfg;
pj_ioqueue_cfg_default(&cfg);
@ -1272,7 +1272,7 @@ int udp_ioqueue_test()
}
#if PJ_HAS_THREADS
for (i=0; i<PJ_ARRAY_SIZE(epoll_flags); ++i) {
for (i=0; i<(int)PJ_ARRAY_SIZE(epoll_flags); ++i) {
pj_ioqueue_cfg cfg;
pj_ioqueue_cfg_default(&cfg);

View File

@ -92,7 +92,7 @@ static int simple_sleep_test(void)
static int sleep_duration_test(void)
{
const int MAX_SLIP = param_ci_mode? 200 : 20;
const unsigned MAX_SLIP = param_ci_mode? 200 : 20;
unsigned duration[] = { 2000, 1000, 500, 200, 100 };
unsigned i;
unsigned avg_diff, max_diff;

View File

@ -67,13 +67,14 @@ static volatile int quit_flag=0;
* Each of the thread mainly will just execute the loop which
* increments a variable.
*/
static void* thread_proc(pj_uint32_t *pcounter)
static int thread_proc(void *data)
{
/* Test that pj_thread_register() works. */
pj_thread_desc desc;
pj_thread_t *this_thread;
unsigned id;
pj_status_t rc;
pj_uint32_t *pcounter = (pj_uint32_t *)data;
id = *pcounter;
PJ_UNUSED_ARG(id); /* Warning about unused var if TRACE__ is disabled */
@ -84,20 +85,20 @@ static void* thread_proc(pj_uint32_t *pcounter)
rc = pj_thread_register("thread", desc, &this_thread);
if (rc != PJ_SUCCESS) {
app_perror("...error in pj_thread_register", rc);
return NULL;
return rc;
}
/* Test that pj_thread_this() works */
this_thread = pj_thread_this();
if (this_thread == NULL) {
PJ_LOG(3,(THIS_FILE, "...error: pj_thread_this() returns NULL!"));
return NULL;
return -1;
}
/* Test that pj_thread_get_name() works */
if (pj_thread_get_name(this_thread) == NULL) {
PJ_LOG(3,(THIS_FILE, "...error: pj_thread_get_name() returns NULL!"));
return NULL;
return -1;
}
/* Main loop */
@ -108,7 +109,7 @@ static void* thread_proc(pj_uint32_t *pcounter)
}
TRACE__((THIS_FILE, " thread %d quitting..", id));
return NULL;
return PJ_SUCCESS;
}
/*

View File

@ -184,8 +184,8 @@ typedef struct ffmpeg_private
pj_timestamp last_dec_keyframe_ts;
/* The ffmpeg codec states. */
AVCodec *enc;
AVCodec *dec;
const AVCodec *enc;
const AVCodec *dec;
AVCodecContext *enc_ctx;
AVCodecContext *dec_ctx;
@ -253,8 +253,8 @@ struct ffmpeg_codec_desc
/* Init time defined info */
pj_bool_t enabled;
AVCodec *enc;
AVCodec *dec;
const AVCodec *enc;
const AVCodec *dec;
};
@ -598,12 +598,13 @@ static pj_status_t h264_postopen(ffmpeg_private *ff)
static FUNC_PACKETIZE(h264_packetize)
{
PJ_UNUSED_ARG(is_keyframe);
h264_data *data = (h264_data*)ff->data;
pj_status_t status;
pj_uint8_t *outbuf = payload;
pj_size_t out_size = *payload_len;
status = pjmedia_h264_packetize(data->pktz, bits, bits_len, bits_pos,
&payload, payload_len);
(const pj_uint8_t **)&payload, payload_len);
if (status != PJ_SUCCESS)
return status;
if (out_size < *payload_len)
@ -671,12 +672,13 @@ static pj_status_t h263_preopen(ffmpeg_private *ff)
static FUNC_PACKETIZE(h263_packetize)
{
PJ_UNUSED_ARG(is_keyframe);
h263_data *data = (h263_data*)ff->data;
pj_status_t status;
pj_uint8_t *outbuf = payload;
pj_size_t out_size = *payload_len;
status = pjmedia_h263_packetize(data->pktz, bits, bits_len, bits_pos,
&payload, payload_len);
(const pj_uint8_t **)&payload, payload_len);
if (status != PJ_SUCCESS)
return status;
if (out_size < *payload_len)
@ -698,7 +700,7 @@ static FUNC_UNPACKETIZE(h263_unpacketize)
static const ffmpeg_codec_desc* find_codec_desc_by_info(
const pjmedia_vid_codec_info *info)
{
int i;
unsigned i;
for (i=0; i<PJ_ARRAY_SIZE(codec_desc); ++i) {
ffmpeg_codec_desc *desc = &codec_desc[i];
@ -719,7 +721,7 @@ static const ffmpeg_codec_desc* find_codec_desc_by_info(
static int find_codec_idx_by_fmt_id(pjmedia_format_id fmt_id)
{
int i;
unsigned i;
for (i=0; i<PJ_ARRAY_SIZE(codec_desc); ++i) {
if (codec_desc[i].info.fmt_id == fmt_id)
return i;
@ -871,7 +873,7 @@ PJ_DEF(pj_status_t) pjmedia_codec_ffmpeg_vid_init(pjmedia_vid_codec_mgr *mgr,
pj_pool_factory *pf)
{
pj_pool_t *pool;
AVCodec *c;
const AVCodec *c;
pj_status_t status;
unsigned i;
@ -1540,7 +1542,8 @@ static pj_status_t ffmpeg_packetize ( pjmedia_vid_codec *codec,
pj_size_t bits_len,
unsigned *bits_pos,
pj_uint8_t *payload,
pj_size_t *payload_len, pj_bool_t is_keyframe)
pj_size_t *payload_len,
pj_bool_t is_keyframe)
{
ffmpeg_private *ff = (ffmpeg_private*)codec->codec_data;
@ -1707,8 +1710,7 @@ static pj_status_t ffmpeg_codec_encode_begin(pjmedia_vid_codec *codec,
*has_more = PJ_FALSE;
if (ff->whole) {
status = ffmpeg_codec_encode_whole(codec, opt, input, out_size,
output);
status = ffmpeg_codec_encode_whole(codec, opt, input, out_size, output);
} else {
pjmedia_frame whole_frm;
pj_bzero(&whole_frm, sizeof(whole_frm));

View File

@ -463,6 +463,8 @@ PJ_DEF(pj_status_t) pjmedia_h264_unpacketize(pjmedia_h264_packetizer *pktz,
#if DBG_UNPACKETIZE
PJ_LOG(3, ("h264unpack", "Unpacked %d H264 NAL units (len=%d)",
cnt, payload_len));
#else
PJ_UNUSED_ARG(cnt);
#endif
}

View File

@ -735,7 +735,7 @@ static pj_status_t codec_open( pjmedia_codec *codec,
/* Set bitrate */
opus_encoder_ctl(opus_data->enc, OPUS_SET_BITRATE(auto_bit_rate?
OPUS_AUTO:
attr->info.avg_bps));
(int)attr->info.avg_bps));
/* Set VAD */
opus_encoder_ctl(opus_data->enc, OPUS_SET_DTX(attr->setting.vad ? 1 : 0));
/* Set PLC */
@ -824,7 +824,7 @@ static pj_status_t codec_modify( pjmedia_codec *codec,
/* Set bitrate */
opus_data->cfg.bit_rate = attr->info.avg_bps;
opus_encoder_ctl(opus_data->enc, OPUS_SET_BITRATE(attr->info.avg_bps?
attr->info.avg_bps:
(int)attr->info.avg_bps:
OPUS_AUTO));
/* Set VAD */
opus_encoder_ctl(opus_data->enc, OPUS_SET_DTX(attr->setting.vad ? 1 : 0));

View File

@ -201,7 +201,7 @@ PJ_DEF(const char*) pjmedia_aud_dev_cap_name(pjmedia_aud_dev_cap cap,
if (p_desc==NULL) p_desc = &desc;
for (i=0; i<PJ_ARRAY_SIZE(cap_infos); ++i) {
if ((1 << i)==cap)
if ((1 << i)==(int)cap)
break;
}

View File

@ -42,7 +42,7 @@
#define AVISF_DISABLED 0x00000001
#define AVISF_VIDEO_PALCHANGES 0x00010000
#define AVI_EOF 0xFFEEFFEE
#define AVI_EOF (int)0xFFEEFFEE
//#define COMPARE_TAG(doc_tag, tag) (doc_tag==*((pj_uint32_t*)avi_tags[tag]))
#define COMPARE_TAG(doc_tag, tag) \
@ -228,8 +228,8 @@ pjmedia_avi_player_create_streams(pj_pool_t *pool,
fport[0]->fsize = pj_file_size(filename);
/* Size must be more than AVI header size */
if (fport[0]->fsize <= sizeof(riff_hdr_t) + sizeof(avih_hdr_t) +
sizeof(strl_hdr_t))
if (fport[0]->fsize <= (pj_off_t)(sizeof(riff_hdr_t) + sizeof(avih_hdr_t) +
sizeof(strl_hdr_t)))
{
return PJMEDIA_EINVALIMEDIATYPE;
}

View File

@ -293,7 +293,7 @@ PJ_DEF(pj_status_t) pjmedia_codec_mgr_get_codec_info( pjmedia_codec_mgr *mgr,
{
unsigned i;
PJ_ASSERT_RETURN(mgr && p_info && pt>=0 && pt < 96, PJ_EINVAL);
PJ_ASSERT_RETURN(mgr && p_info && pt < 96, PJ_EINVAL);
pj_mutex_lock(mgr->mutex);

View File

@ -76,7 +76,7 @@ typedef enum conv_func_type
SCALE_PLANAR
} conv_func_type;
typedef void (*gen_conv_func)();
typedef int (*gen_conv_func)();
typedef int (*conv_pack_to_pack_method)(const uint8* src, int src_stride,
uint8* dst, int dst_stride,

View File

@ -104,7 +104,9 @@ static pj_status_t event_mgr_distribute_events(pjmedia_event_mgr *mgr,
pj_status_t err = PJ_SUCCESS;
esub * sub = mgr->esub_list.next;
pjmedia_event *ev = &ev_queue->events[ev_queue->head];
#ifdef EVENT_TRACE
unsigned i = 0;
#endif
while (sub != &mgr->esub_list) {
*next_sub = sub->next;
@ -138,7 +140,9 @@ static pj_status_t event_mgr_distribute_events(pjmedia_event_mgr *mgr,
}
}
sub = *next_sub;
#ifdef EVENT_TRACE
i++;
#endif
}
*next_sub = NULL;
@ -281,7 +285,9 @@ PJ_DEF(pj_status_t) pjmedia_event_subscribe( pjmedia_event_mgr *mgr,
void *epub)
{
esub *sub;
#ifdef EVENT_TRACE
unsigned i = 0;
#endif
PJ_ASSERT_RETURN(cb, PJ_EINVAL);
@ -303,7 +309,9 @@ PJ_DEF(pj_status_t) pjmedia_event_subscribe( pjmedia_event_mgr *mgr,
return PJ_SUCCESS;
}
sub = next;
#ifdef EVENT_TRACE
i++;
#endif
}
if (mgr->free_esub_list.next != &mgr->free_esub_list) {

View File

@ -168,7 +168,7 @@ pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id,
unsigned i;
for (i=0; i<PJ_ARRAY_SIZE(ffmpeg_codec_table); ++i) {
const struct ffmpeg_codec_table_t *t = &ffmpeg_codec_table[i];
if (t->id==fmt_id && t->codec_id != AV(PIX_FMT_NONE)) {
if (t->id==fmt_id && (int)t->codec_id != AV(PIX_FMT_NONE)) {
*codec_id = t->codec_id;
return PJ_SUCCESS;
}

View File

@ -252,7 +252,7 @@ PJ_DEF(void) pjmedia_rtp_session_update2( pjmedia_rtp_session *ses,
ses->peer_ssrc = pj_ntohl(hdr->ssrc);
if (pj_ntohl(hdr->ssrc) != ses->peer_ssrc) {
seq_st.status.flag.badssrc = 1;
seq_st.status.flag.badssrc = -1;
if (!ses->has_peer_ssrc)
ses->peer_ssrc = pj_ntohl(hdr->ssrc);
}
@ -261,8 +261,8 @@ PJ_DEF(void) pjmedia_rtp_session_update2( pjmedia_rtp_session *ses,
if (check_pt && hdr->pt != ses->out_pt) {
if (p_seq_st) {
p_seq_st->status.value = seq_st.status.value;
p_seq_st->status.flag.bad = 1;
p_seq_st->status.flag.badpt = 1;
p_seq_st->status.flag.bad = -1;
p_seq_st->status.flag.badpt = -1;
}
return;
}
@ -323,8 +323,8 @@ void pjmedia_rtp_seq_update( pjmedia_rtp_seq_session *sess,
*/
if (sess->probation) {
st.status.flag.probation = 1;
st.status.flag.probation = -1;
if (seq == sess->max_seq+ 1) {
/* packet is in sequence */
st.diff = 1;
@ -337,11 +337,11 @@ void pjmedia_rtp_seq_update( pjmedia_rtp_seq_session *sess,
st.diff = 0;
st.status.flag.bad = 1;
st.status.flag.bad = -1;
if (seq == sess->max_seq)
st.status.flag.dup = 1;
st.status.flag.dup = -1;
else
st.status.flag.outorder = 1;
st.status.flag.outorder = -1;
sess->probation = MIN_SEQUENTIAL - 1;
sess->max_seq = seq;
@ -350,7 +350,7 @@ void pjmedia_rtp_seq_update( pjmedia_rtp_seq_session *sess,
} else if (udelta == 0) {
st.status.flag.dup = 1;
st.status.flag.dup = -1;
} else if (udelta < MAX_DROPOUT) {
/* in order, with permissible gap */
@ -371,22 +371,22 @@ void pjmedia_rtp_seq_update( pjmedia_rtp_seq_session *sess,
* (i.e., pretend this was the first packet).
*/
pjmedia_rtp_seq_restart(sess, seq);
st.status.flag.restart = 1;
st.status.flag.probation = 1;
st.status.flag.restart = -1;
st.status.flag.probation = -1;
st.diff = 1;
}
else {
sess->bad_seq = (seq + 1) & (RTP_SEQ_MOD-1);
st.status.flag.bad = 1;
st.status.flag.outorder = 1;
st.status.flag.bad = -1;
st.status.flag.outorder = -1;
}
} else {
/* old duplicate or reordered packet.
* Not necessarily bad packet (?)
*/
st.status.flag.outorder = 1;
st.status.flag.outorder = -1;
}
if (seq_status) {
seq_status->diff = st.diff;

View File

@ -1962,7 +1962,7 @@ static void on_rx_rtp( pjmedia_tp_cb_param *param)
if (!check_pt && hdr->pt != channel->rtp.out_pt &&
hdr->pt != stream->rx_event_pt)
{
seq_st.status.flag.badpt = 1;
seq_st.status.flag.badpt = -1;
}
#endif
if (seq_st.status.value) {

View File

@ -2604,6 +2604,8 @@ static void ice_on_rx_data(pj_ice_strans *ice_st, unsigned comp_id,
sizeof(addr_text), 3)));
}
}
#else
PJ_UNUSED_ARG(rem_switch);
#endif
} else if (comp_id==2 && tp_ice->rtcp_cb) {

View File

@ -56,7 +56,7 @@ PJ_DEF(const char*) pjmedia_type_name(pjmedia_type t)
PJ_DEF(pjmedia_type) pjmedia_get_type(const pj_str_t *name)
{
int i;
for (i = 0; i < PJ_ARRAY_SIZE(media_type_names); ++i) {
for (i = 0; i < (int)PJ_ARRAY_SIZE(media_type_names); ++i) {
if (pj_stricmp2(name, media_type_names[i].name)==0)
return media_type_names[i].type;
}

View File

@ -354,7 +354,7 @@ static struct fmt_prop find_closest_fmt(pj_uint32_t req_fmt_id,
/* Fill the nearest width list. */
if (diff_width1 <= diff_width2) {
int k = 0;
unsigned k = 0;
while (((k < PJ_ARRAY_SIZE(nearest_width)) &&
(!((vfd->size.w == nearest_width[k].w) &&
(vfd->size.h == nearest_width[k].h))))) {

View File

@ -816,7 +816,7 @@ static void on_rx_rtp( pjmedia_tp_cb_param *param)
PJMEDIA_VID_STREAM_CHECK_RTP_PT);
#if !PJMEDIA_VID_STREAM_CHECK_RTP_PT
if (hdr->pt != channel->rtp.out_pt) {
seq_st.status.flag.badpt = 1;
seq_st.status.flag.badpt = -1;
}
#endif
if (seq_st.status.value) {

View File

@ -87,7 +87,7 @@ PJ_DEF(const char*) pjmedia_vid_dev_cap_name(pjmedia_vid_dev_cap cap,
if (p_desc==NULL) p_desc = &desc;
for (i=0; i<PJ_ARRAY_SIZE(cap_infos); ++i) {
if ((1 << i)==cap)
if ((1 << i)==(int)cap)
break;
}
@ -412,8 +412,7 @@ pjmedia_vid_dev_get_global_index(const pjmedia_vid_dev_factory *f,
unsigned local_idx,
pjmedia_vid_dev_index *pid)
{
PJ_ASSERT_RETURN(f->sys.drv_idx >= 0 && f->sys.drv_idx < MAX_DRIVERS,
PJ_EINVALIDOP);
PJ_ASSERT_RETURN(f->sys.drv_idx < MAX_DRIVERS, PJ_EINVALIDOP);
*pid = local_idx;
return make_global_index(f->sys.drv_idx, pid);
}

View File

@ -224,7 +224,7 @@ PJ_DEF(pj_status_t) pjmedia_wav_player_port_create( pj_pool_t *pool,
fport->fsize = pj_file_size(filename);
/* Size must be more than WAVE header size */
if (fport->fsize <= sizeof(pjmedia_wave_hdr)) {
if (fport->fsize <= (pj_off_t)sizeof(pjmedia_wave_hdr)) {
return PJMEDIA_ENOTVALIDWAVE;
}

View File

@ -428,9 +428,9 @@ PJ_DEF(pj_status_t) pjmedia_wav_playlist_create(pj_pool_t *pool,
/* Get the file size. */
fport->current_file = index;
fport->fsize_list[index] = pj_file_size(filename);
/* Size must be more than WAVE header size */
if (fport->fsize_list[index] <= sizeof(pjmedia_wave_hdr)) {
if (fport->fsize_list[index] <= (pj_off_t)sizeof(pjmedia_wave_hdr)) {
status = PJMEDIA_ENOTVALIDWAVE;
goto on_error;
}

View File

@ -104,7 +104,7 @@ static pj_bool_t parse_test_headers(char *line, test_param_t *param,
static pj_bool_t process_test_data(char data, pjmedia_jbuf *jb,
pj_uint16_t *seq, pj_uint16_t *last_seq)
{
char frame[1];
char frame[1] = {0};
char f_type;
pj_bool_t print_state = PJ_TRUE;
pj_bool_t data_eos = PJ_FALSE;
@ -183,7 +183,7 @@ int jbuf_main(void)
/* If that fails, try to open test data file in specified search paths */
if (input == NULL) {
char input_path[PJ_MAXPATH];
int i;
unsigned i;
for (i = 0; !input && i < PJ_ARRAY_SIZE(input_search_path); ++i) {
pj_ansi_snprintf(input_path, PJ_MAXPATH, "%s/%s",

View File

@ -1717,6 +1717,9 @@ static pjmedia_port* create_stream( pj_pool_t *pool,
unsigned flags,
struct test_entry *te)
{
PJ_UNUSED_ARG(srtp_enabled);
PJ_UNUSED_ARG(srtp_80);
PJ_UNUSED_ARG(srtp_auth);
struct stream_port *sp;
pj_str_t codec_id;
pjmedia_port *port;

View File

@ -149,7 +149,7 @@ static const char* dump_codec_info(const pjmedia_vid_codec_info *info)
char *p = str;
/* Raw format ids */
for (i=0; (i<info->dec_fmt_id_cnt) && (p-str+5<sizeof(str)); ++i) {
for (i=0; (i<info->dec_fmt_id_cnt) && (p-str+5<(int)sizeof(str)); ++i) {
pj_memcpy(p, &info->dec_fmt_id[i], 4);
p += 4;
*p++ = ' ';

View File

@ -204,7 +204,7 @@ static int vidport_test(void)
continue;
/* Check various formats to test format conversion. */
for (l = 0; l < PJ_ARRAY_SIZE(test_fmts); ++l) {
for (l = 0; l < (int)PJ_ARRAY_SIZE(test_fmts); ++l) {
pjmedia_format fmt;
PJ_LOG(3,(THIS_FILE,

View File

@ -249,7 +249,7 @@ static void turn_on_state(pj_turn_sock *turn_sock,
sess->result.state_called |= (1 << new_state);
if (new_state >= sess->destroy_on_state && !sess->destroy_called) {
if ((int)new_state >= sess->destroy_on_state && !sess->destroy_called) {
sess->destroy_called = PJ_TRUE;
pj_turn_sock_destroy(turn_sock);
}
@ -495,8 +495,8 @@ static int destroy_test(pj_stun_config *stun_cfg,
poll_events(stun_cfg, 1, PJ_FALSE);
pj_turn_sock_get_info(sess->turn_sock, &info);
if (info.state >= target_state) {
if ((int)info.state >= target_state) {
pj_turn_sock_destroy(sess->turn_sock);
break;
}

View File

@ -1937,7 +1937,7 @@ on_return:
return status;
if (call_cb) {
on_data_sent(ice_st, (status == PJ_SUCCESS? data_len: -status));
on_data_sent(ice_st, (status == PJ_SUCCESS? (pj_ssize_t)data_len: -status));
} else {
check_pending_send(ice_st);
}

View File

@ -318,6 +318,8 @@ static void turn_on_rx_data(pj_turn_sock *relay,
const pj_sockaddr_t *peer_addr,
unsigned addr_len)
{
PJ_UNUSED_ARG(relay);
PJ_UNUSED_ARG(addr_len);
char addrinfo[80];
pj_sockaddr_print(peer_addr, addrinfo, sizeof(addrinfo), 3);
@ -386,6 +388,7 @@ static pj_bool_t stun_sock_on_rx_data(pj_stun_sock *stun_sock,
const pj_sockaddr_t *src_addr,
unsigned addr_len)
{
PJ_UNUSED_ARG(addr_len);
struct peer *peer = (struct peer*) pj_stun_sock_get_user_data(stun_sock);
char straddr[PJ_INET6_ADDRSTRLEN+10];

View File

@ -1135,7 +1135,6 @@ static void simple_registrar(pjsip_rx_data *rdata)
pjsip_tx_data *tdata;
const pjsip_expires_hdr *exp;
const pjsip_hdr *h;
unsigned cnt = 0;
pjsip_generic_string_hdr *srv;
pj_status_t status;
@ -1165,7 +1164,6 @@ static void simple_registrar(pjsip_rx_data *rdata)
tdata->pool, h);
nc->expires = e;
pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)nc);
++cnt;
}
}
h = h->next;

View File

@ -267,7 +267,7 @@ static int aviplay(pj_pool_t *pool, const char *fname)
pjmedia_vid_dev_get_info(param.vidparam.rend_id, &rdr_info);
for (i=0; i<codec_info->dec_fmt_id_cnt; ++i) {
for (k=0; k<rdr_info.fmt_cnt; ++k) {
if (codec_info->dec_fmt_id[i]==(int)rdr_info.fmt[k].id)
if ((int)codec_info->dec_fmt_id[i]==(int)rdr_info.fmt[k].id)
{
param.vidparam.fmt.id = codec_info->dec_fmt_id[i];
i = codec_info->dec_fmt_id_cnt;

View File

@ -151,7 +151,7 @@ int main()
pj_cli_telnet_cfg tcfg;
pj_str_t xml;
pj_status_t status;
int i;
unsigned i;
pj_init();
pj_caching_pool_init(&cp, NULL, 0);
@ -172,8 +172,8 @@ int main()
/*
* Register some commands.
*/
for (i = 0; i < sizeof(cmd_xmls)/sizeof(cmd_xmls[0]); i++) {
xml = pj_str(cmd_xmls[i].xml);
for (i = 0; i < PJ_ARRAY_SIZE(cmd_xmls); i++) {
xml = pj_str(cmd_xmls[i].xml);
status = pj_cli_add_cmd_from_xml(cli, NULL, &xml,
cmd_xmls[i].handler, NULL,
get_codec_list);

View File

@ -978,14 +978,14 @@ static int init_options(int argc, char *argv[])
/* Build format */
format[0] = '\0';
for (c=0; c<PJ_ARRAY_SIZE(long_options)-1; ++c) {
for (c=0; c<(int)PJ_ARRAY_SIZE(long_options)-1; ++c) {
if (long_options[c].has_arg) {
char cmd[10];
pj_ansi_snprintf(cmd, sizeof(cmd), "%c:", long_options[c].val);
pj_ansi_strcat(format, cmd);
}
}
for (c=0; c<PJ_ARRAY_SIZE(long_options)-1; ++c) {
for (c=0; c<(int)PJ_ARRAY_SIZE(long_options)-1; ++c) {
if (long_options[c].has_arg == 0) {
char cmd[10];
pj_ansi_snprintf(cmd, sizeof(cmd), "%c", long_options[c].val);

View File

@ -38,6 +38,7 @@ public:
MyEndpoint() : Endpoint() {};
virtual pj_status_t onCredAuth(OnCredAuthParam &prm)
{
PJ_UNUSED_ARG(prm);
std::cout << "*** Callback onCredAuth called ***" << std::endl;
/* Return PJ_ENOTSUP to use
* pjsip_auth_create_aka_response()/<b>libmilenage</b> (default),

View File

@ -68,6 +68,7 @@ static pj_status_t init_codecs(pj_pool_factory *pf)
/* To suppress warning about unused var when all codecs are disabled */
PJ_UNUSED_ARG(status);
PJ_UNUSED_ARG(pf);
#if defined(PJMEDIA_HAS_OPENH264_CODEC) && PJMEDIA_HAS_OPENH264_CODEC != 0
status = pjmedia_codec_openh264_vid_init(NULL, pf);
@ -251,7 +252,9 @@ int main(int argc, char *argv[])
pj_caching_pool cp;
pjmedia_endpt *med_endpt;
pj_pool_t *pool;
pj_status_t status;
pj_status_t status;
PJ_UNUSED_ARG(argc);
PJ_UNUSED_ARG(argv);
/* Codec */
char *codec_id = (char*)"H264";

View File

@ -238,8 +238,8 @@ static pj_status_t create_stream( pj_pool_t *pool,
info.type = PJMEDIA_TYPE_VIDEO;
info.dir = dir;
info.codec_info = *codec_info;
info.tx_pt = (tx_pt == -1)? codec_info->pt : tx_pt;
info.rx_pt = (rx_pt == -1)? codec_info->pt : rx_pt;
info.tx_pt = (tx_pt == -1)? (pj_uint8_t)codec_info->pt : tx_pt;
info.rx_pt = (rx_pt == -1)? (pj_uint8_t)codec_info->pt : rx_pt;
info.ssrc = pj_rand();
if (codec_param)
info.codec_param = codec_param;

View File

@ -363,7 +363,7 @@ static void inv_set_state(pjsip_inv_session *inv, pjsip_inv_state state,
static void inv_set_cause(pjsip_inv_session *inv, int cause_code,
const pj_str_t *cause_text)
{
if ((cause_code > inv->cause) || inv->pending_bye) {
if ((cause_code > (int)inv->cause) || inv->pending_bye) {
inv->cause = (pjsip_status_code) cause_code;
if (cause_text)
pj_strdup(inv->pool, &inv->cause_text, cause_text);
@ -3038,6 +3038,7 @@ void pjsip_inv_process_hparam(pjsip_inv_session *sess,
const pj_str_t *hvalue,
pjsip_tx_data *tdata)
{
PJ_UNUSED_ARG(sess);
const pjsip_hdr_e ignored_hdrs[] = {
/* According to RFC 3261 section 19.1.5, we should not honor
* the following headers as they can potentially be malicious

View File

@ -2289,7 +2289,7 @@ PJ_DEF(const pjsip_hdr*) pjsip_dlg_get_remote_cap_hdr(pjsip_dialog *dlg,
hdr = dlg->rem_cap_hdr.next;
while (hdr != &dlg->rem_cap_hdr) {
if ((htype != PJSIP_H_OTHER && htype == hdr->type) ||
if ((htype != PJSIP_H_OTHER && htype == (int)hdr->type) ||
(htype == PJSIP_H_OTHER && pj_stricmp(&hdr->name, hname) == 0))
{
pjsip_dlg_dec_lock(dlg);

View File

@ -318,7 +318,7 @@ PJ_DEF(const pjsip_hdr*) pjsip_endpt_get_capability( pjsip_endpoint *endpt,
if (htype != PJSIP_H_OTHER) {
while (hdr != &endpt->cap_hdr) {
if (hdr->type == htype)
if ((int)hdr->type == htype)
return hdr;
hdr = hdr->next;
}

View File

@ -1905,8 +1905,10 @@ static void int_parse_contact_param( pjsip_contact_hdr *hdr,
hdr->expires--;
if (hdr->expires > PJSIP_MAX_EXPIRES)
hdr->expires = PJSIP_MAX_EXPIRES;
#if PJSIP_MIN_EXPIRES > 0
if (hdr->expires < PJSIP_MIN_EXPIRES)
hdr->expires = PJSIP_MIN_EXPIRES;
#endif
} else {
pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
p->name = pname;

View File

@ -3519,7 +3519,7 @@ pj_status_t pjsua_acc_get_uac_addr(pjsua_acc_id acc_id,
{
int i;
for (i = 0; i < sizeof(pjsua_var.tpdata); i++) {
for (i = 0; i < (int)sizeof(pjsua_var.tpdata); i++) {
if (tfla2_prm.ret_tp==(const void *)pjsua_var.tpdata[i].data.tp) {
if (pjsua_var.tpdata[i].has_bound_addr) {
pj_strdup(pool, &addr->host,
@ -4248,7 +4248,7 @@ pj_status_t pjsua_acc_handle_call_on_ip_change(pjsua_acc *acc)
if (acc->cfg.ip_change_cfg.hangup_calls ||
acc->cfg.ip_change_cfg.reinvite_flags)
{
for (i = 0; i < (int)pjsua_var.ua_cfg.max_calls; ++i) {
for (i = 0; i < pjsua_var.ua_cfg.max_calls; ++i) {
pjsua_call_info call_info;
if (!pjsua_call_is_active(i) ||

View File

@ -4930,7 +4930,7 @@ static void pjsua_call_on_state_changed(pjsip_inv_session *inv,
if (call->res_time.sec == 0)
pj_gettimeofday(&call->res_time);
if (e->type == PJSIP_EVENT_TSX_STATE &&
e->body.tsx_state.tsx->status_code > call->last_code)
e->body.tsx_state.tsx->status_code > (int)call->last_code)
{
call->last_code = (pjsip_status_code)
e->body.tsx_state.tsx->status_code;

View File

@ -845,7 +845,7 @@ PJ_DEF(void) pjsua_stop_worker_threads(void)
pjsua_var.thread_quit_flag = 1;
/* Wait worker threads to quit: */
for (i=0; i<(int)pjsua_var.ua_cfg.thread_cnt; ++i) {
for (i=0; i<pjsua_var.ua_cfg.thread_cnt; ++i) {
if (pjsua_var.thread[i]) {
pj_status_t status;
status = pj_thread_join(pjsua_var.thread[i]);
@ -3675,7 +3675,7 @@ static pj_status_t handle_ip_change_on_acc()
continue;
if (acc->regc) {
int j = 0;
unsigned j = 0;
pj_status_t found_restart_tp_fail = PJ_FALSE;
pjsip_regc_get_info(acc->regc, &regc_info);
@ -3736,7 +3736,7 @@ static pj_status_t handle_ip_change_on_acc()
pj_ansi_snprintf(acc_id, sizeof(acc_id), "#%d", i);
if (transport) {
unsigned j = i + 1;
int j = i + 1;
/* Find other account that uses the same transport. */
for (; j < (int)PJ_ARRAY_SIZE(pjsua_var.acc); ++j) {
@ -3887,7 +3887,7 @@ static pj_status_t restart_listener(pjsua_transport_id id,
}
/* Move forward if all listener has been restarted. */
for (; i < PJ_ARRAY_SIZE(pjsua_var.tpdata); ++i) {
for (; i < (int)PJ_ARRAY_SIZE(pjsua_var.tpdata); ++i) {
if (pjsua_var.tpdata[i].data.ptr != NULL &&
pjsua_var.tpdata[i].is_restarting)
{
@ -3956,20 +3956,20 @@ PJ_DEF(pj_status_t) pjsua_handle_ip_change(const pjsua_ip_change_param *param)
/* Restart listener/transport, handle_ip_change_on_acc() will
* be called after listener restart is completed successfully.
*/
for (i = 0; i < PJ_ARRAY_SIZE(pjsua_var.tpdata); ++i) {
for (i = 0; i < (int)PJ_ARRAY_SIZE(pjsua_var.tpdata); ++i) {
if (pjsua_var.tpdata[i].data.ptr != NULL) {
pjsua_var.tpdata[i].is_restarting = PJ_TRUE;
pjsua_var.tpdata[i].restart_status = PJ_EUNKNOWN;
}
}
for (i = 0; i < PJ_ARRAY_SIZE(pjsua_var.tpdata); ++i) {
for (i = 0; i < (int)PJ_ARRAY_SIZE(pjsua_var.tpdata); ++i) {
if (pjsua_var.tpdata[i].data.ptr != NULL) {
status = restart_listener(i, param->restart_lis_delay);
}
}
PJSUA_UNLOCK();
} else {
for (i = 0; i < PJ_ARRAY_SIZE(pjsua_var.tpdata); ++i) {
for (i = 0; i < (int)PJ_ARRAY_SIZE(pjsua_var.tpdata); ++i) {
if (pjsua_var.tpdata[i].data.ptr != NULL) {
pjsua_var.tpdata[i].restart_status = PJ_SUCCESS;
}

View File

@ -1791,7 +1791,7 @@ void pjsua_set_media_tp_state(pjsua_call_media *call_med,
call_med->tp_st = tp_st;
}
#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
/* This callback is called when SRTP negotiation completes */
static void on_srtp_nego_complete(pjmedia_transport *tp,
pj_status_t result)
@ -1819,7 +1819,7 @@ static void on_srtp_nego_complete(pjmedia_transport *tp,
}
}
}
#endif
/* Callback to resume pjsua_call_media_init() after media transport
* creation is completed.
@ -1936,6 +1936,7 @@ static pj_status_t call_media_init_cb(pjsua_call_media *call_med,
#else
call_med->tp_orig = call_med->tp;
PJ_UNUSED_ARG(security_level);
PJ_UNUSED_ARG(acc);
#endif

View File

@ -463,7 +463,7 @@ PJ_DEF(pj_status_t) pjsua_vid_enum_codecs( pjsua_codec_info id[],
id[j].codec_id = pj_str(id[j].buf_);
id[j].priority = (pj_uint8_t) prio[i];
if (id[j].codec_id.slen < sizeof(id[j].buf_)) {
if (id[j].codec_id.slen < (pj_ssize_t)sizeof(id[j].buf_)) {
id[j].desc.ptr = id[j].codec_id.ptr + id[j].codec_id.slen + 1;
pj_strncpy(&id[j].desc, &info[i].encoding_desc,
sizeof(id[j].buf_) - id[j].codec_id.slen - 1);

View File

@ -23,8 +23,9 @@ extern "C"
int main(int argc, char *argv[])
{
Endpoint ep;
EpConfig epCfg;
PJ_UNUSED_ARG(argc);
PJ_UNUSED_ARG(argv);
epCfg.uaConfig.userAgent = "pjsua++-test";