summaryrefslogtreecommitdiff
path: root/pjsip/src/test-pjsip
diff options
context:
space:
mode:
Diffstat (limited to 'pjsip/src/test-pjsip')
-rw-r--r--pjsip/src/test-pjsip/dns_test.c2
-rw-r--r--pjsip/src/test-pjsip/msg_test.c22
-rw-r--r--pjsip/src/test-pjsip/transport_test.c2
-rw-r--r--pjsip/src/test-pjsip/tsx_bench.c12
-rw-r--r--pjsip/src/test-pjsip/tsx_uac_test.c18
-rw-r--r--pjsip/src/test-pjsip/tsx_uas_test.c14
-rw-r--r--pjsip/src/test-pjsip/txdata_test.c14
-rw-r--r--pjsip/src/test-pjsip/uri_test.c8
8 files changed, 47 insertions, 45 deletions
diff --git a/pjsip/src/test-pjsip/dns_test.c b/pjsip/src/test-pjsip/dns_test.c
index cefc4ed2..62484d4d 100644
--- a/pjsip/src/test-pjsip/dns_test.c
+++ b/pjsip/src/test-pjsip/dns_test.c
@@ -35,7 +35,7 @@ static void cb(pj_status_t status,
void *token,
const struct pjsip_server_addresses *addr)
{
- struct result *result = token;
+ struct result *result = (struct result*) token;
result->status = status;
if (status == PJ_SUCCESS)
diff --git a/pjsip/src/test-pjsip/msg_test.c b/pjsip/src/test-pjsip/msg_test.c
index 7bdc49dc..7491a0d7 100644
--- a/pjsip/src/test-pjsip/msg_test.c
+++ b/pjsip/src/test-pjsip/msg_test.c
@@ -186,8 +186,8 @@ parse_msg:
ref_msg = entry->creator(pool);
/* Create buffer for comparison. */
- str1.ptr = pj_pool_alloc(pool, BUFLEN);
- str2.ptr = pj_pool_alloc(pool, BUFLEN);
+ str1.ptr = (char*)pj_pool_alloc(pool, BUFLEN);
+ str2.ptr = (char*)pj_pool_alloc(pool, BUFLEN);
/* Compare message type. */
if (parsed_msg->type != ref_msg->type) {
@@ -660,11 +660,11 @@ static pjsip_msg *create_msg1(pj_pool_t *pool)
clen->len = 150;
// Body
- body = pj_pool_zalloc(pool, sizeof(*body));
+ body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
msg->body = body;
body->content_type.type = pj_str("application");
body->content_type.subtype = pj_str("sdp");
- body->data =
+ body->data = (void*)
"v=0\r\n"
"o=alice 53655765 2353687637 IN IP4 pc33.atlanta.com\r\n"
"s=-\r\n"
@@ -672,7 +672,7 @@ static pjsip_msg *create_msg1(pj_pool_t *pool)
"c=IN IP4 pc33.atlanta.com\r\n"
"m=audio 3456 RTP/AVP 0 1 3 99\r\n"
"a=rtpmap:0 PCMU/8000\r\n";
- body->len = pj_native_strlen(body->data);
+ body->len = pj_native_strlen((const char*) body->data);
body->print_body = &pjsip_print_text_body;
return msg;
@@ -715,7 +715,7 @@ static int msg_benchmark(unsigned *p_detect, unsigned *p_parse,
zero.u64 = 0;
for (loop=0; loop<LOOP; ++loop) {
- for (i=0; i<PJ_ARRAY_SIZE(test_array); ++i) {
+ for (i=0; i<(int)PJ_ARRAY_SIZE(test_array); ++i) {
pool = pjsip_endpt_create_pool(endpt, NULL, POOL_SIZE, POOL_SIZE);
status = test_entry( pool, &test_array[i] );
pjsip_endpt_release_pool(endpt, pool);
@@ -1453,7 +1453,9 @@ static int hdr_test(void)
/* Parse the header */
hname = pj_str(test->hname);
len = strlen(test->hcontent);
- parsed_hdr1 = pjsip_parse_hdr(pool, &hname, test->hcontent, len, &parsed_len);
+ parsed_hdr1 = (pjsip_hdr*) pjsip_parse_hdr(pool, &hname,
+ test->hcontent, len,
+ &parsed_len);
if (parsed_hdr1 == NULL) {
if (test->flags & HDR_FLAG_PARSE_FAIL) {
pj_pool_release(pool);
@@ -1475,7 +1477,7 @@ static int hdr_test(void)
if (test->hshort_name) {
hname = pj_str(test->hshort_name);
len = strlen(test->hcontent);
- parsed_hdr2 = pjsip_parse_hdr(pool, &hname, test->hcontent, len, &parsed_len);
+ parsed_hdr2 = (pjsip_hdr*) pjsip_parse_hdr(pool, &hname, test->hcontent, len, &parsed_len);
if (parsed_hdr2 == NULL) {
PJ_LOG(3,(THIS_FILE, " error parsing header %s: %s", test->hshort_name, test->hcontent));
return -510;
@@ -1489,13 +1491,13 @@ static int hdr_test(void)
}
/* Print the original header */
- input = pj_pool_alloc(pool, 1024);
+ input = (char*) pj_pool_alloc(pool, 1024);
len = pj_ansi_snprintf(input, 1024, "%s: %s", test->hname, test->hcontent);
if (len < 1 || len >= 1024)
return -520;
/* Print the parsed header*/
- output = pj_pool_alloc(pool, 1024);
+ output = (char*) pj_pool_alloc(pool, 1024);
len = pjsip_hdr_print_on(parsed_hdr1, output, 1024);
if (len < 1 || len >= 1024) {
PJ_LOG(3,(THIS_FILE, " header too long: %s: %s", test->hname, test->hcontent));
diff --git a/pjsip/src/test-pjsip/transport_test.c b/pjsip/src/test-pjsip/transport_test.c
index d7ad4366..b751c573 100644
--- a/pjsip/src/test-pjsip/transport_test.c
+++ b/pjsip/src/test-pjsip/transport_test.c
@@ -560,7 +560,7 @@ int transport_rt_test( pjsip_transport_type_e tp_type,
rt_test_data[i].timeout_timer.cb = &rt_timeout_timer;
/* Generate Call-ID for each thread. */
- rt_test_data[i].call_id.ptr = pj_pool_alloc(pool, rt_call_id.slen+1);
+ rt_test_data[i].call_id.ptr = (char*) pj_pool_alloc(pool, rt_call_id.slen+1);
pj_strcpy(&rt_test_data[i].call_id, &rt_call_id);
buf[0] = '0' + i;
pj_strcat(&rt_test_data[i].call_id, &str_id);
diff --git a/pjsip/src/test-pjsip/tsx_bench.c b/pjsip/src/test-pjsip/tsx_bench.c
index d14a82f2..3950827c 100644
--- a/pjsip/src/test-pjsip/tsx_bench.c
+++ b/pjsip/src/test-pjsip/tsx_bench.c
@@ -53,7 +53,7 @@ static int uac_tsx_bench(unsigned working_set, pj_timestamp *p_elapsed)
NULL);
/* Create transaction array */
- tsx = pj_pool_zalloc(request->pool, working_set * sizeof(pj_pool_t*));
+ tsx = (pjsip_transaction**) pj_pool_zalloc(request->pool, working_set * sizeof(pj_pool_t*));
pj_bzero(&mod_tsx_user, sizeof(mod_tsx_user));
mod_tsx_user.id = -1;
@@ -130,10 +130,10 @@ static int uas_tsx_bench(unsigned working_set, pj_timestamp *p_elapsed)
pj_bzero(&rdata, sizeof(pjsip_rx_data));
rdata.tp_info.pool = request->pool;
rdata.msg_info.msg = request->msg;
- rdata.msg_info.from = pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL);
- rdata.msg_info.to = pjsip_msg_find_hdr(request->msg, PJSIP_H_TO, NULL);
- rdata.msg_info.cseq = pjsip_msg_find_hdr(request->msg, PJSIP_H_CSEQ, NULL);
- rdata.msg_info.cid = pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL);
+ rdata.msg_info.from = (pjsip_from_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL);
+ rdata.msg_info.to = (pjsip_to_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_TO, NULL);
+ rdata.msg_info.cseq = (pjsip_cseq_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_CSEQ, NULL);
+ rdata.msg_info.cid = (pjsip_cid_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL);
rdata.msg_info.via = via;
pj_sockaddr_in_init(&remote, 0, 0);
@@ -147,7 +147,7 @@ static int uas_tsx_bench(unsigned working_set, pj_timestamp *p_elapsed)
/* Create transaction array */
- tsx = pj_pool_zalloc(request->pool, working_set * sizeof(pj_pool_t*));
+ tsx = (pjsip_transaction**) pj_pool_zalloc(request->pool, working_set * sizeof(pj_pool_t*));
pj_bzero(&mod_tsx_user, sizeof(mod_tsx_user));
mod_tsx_user.id = -1;
diff --git a/pjsip/src/test-pjsip/tsx_uac_test.c b/pjsip/src/test-pjsip/tsx_uac_test.c
index fa6bf771..0e128474 100644
--- a/pjsip/src/test-pjsip/tsx_uac_test.c
+++ b/pjsip/src/test-pjsip/tsx_uac_test.c
@@ -364,7 +364,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e)
if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_PROCEEDING) {
PJ_LOG(3,(THIS_FILE,
" error: prev state is %s instead of %s",
- pjsip_tsx_state_str(e->body.tsx_state.prev_state),
+ pjsip_tsx_state_str((pjsip_tsx_state_e)e->body.tsx_state.prev_state),
pjsip_tsx_state_str(PJSIP_TSX_STATE_PROCEEDING)));
test_complete = -739;
}
@@ -547,7 +547,7 @@ struct response
static void send_response_callback( pj_timer_heap_t *timer_heap,
struct pj_timer_entry *entry)
{
- struct response *r = entry->user_data;
+ struct response *r = (struct response*) entry->user_data;
pjsip_transport *tp = r->res_addr.transport;
pjsip_endpt_send_response(endpt, &r->res_addr, r->tdata, NULL, NULL);
@@ -759,7 +759,7 @@ static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata)
pj_assert(status == PJ_SUCCESS);
/* Schedule sending final response in couple of of secs. */
- r = pj_pool_alloc(tdata->pool, sizeof(*r));
+ r = PJ_POOL_ALLOC_T(tdata->pool, struct response);
r->res_addr = res_addr;
r->tdata = tdata;
if (r->res_addr.transport)
@@ -880,7 +880,7 @@ static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata)
pj_assert(status == PJ_SUCCESS);
/* Schedule sending final response in couple of of secs. */
- r = pj_pool_alloc(tdata->pool, sizeof(*r));
+ r = PJ_POOL_ALLOC_T(tdata->pool, struct response);
r->res_addr = res_addr;
r->tdata = tdata;
if (r->res_addr.transport)
@@ -968,7 +968,7 @@ static int perform_tsx_test(int dummy, char *target_uri, char *from_uri,
}
/* Set the branch param for test 1. */
- via = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
+ via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
via->branch_param = pj_str(branch_param);
/* Add additional reference to tdata to prevent transaction from
@@ -1097,7 +1097,7 @@ static int tsx_uac_retransmit_test(void)
*/
enabled = msg_logger_set_enabled(0);
- for (i=0; i<PJ_ARRAY_SIZE(sub_test); ++i) {
+ for (i=0; i<(int)PJ_ARRAY_SIZE(sub_test); ++i) {
PJ_LOG(3,(THIS_FILE,
" variant %c: %s with %d ms network delay",
@@ -1231,7 +1231,7 @@ static int tsx_retransmit_fail_test(void)
" test4: transport fails after several retransmissions test"));
- for (i=0; i<PJ_ARRAY_SIZE(delay); ++i) {
+ for (i=0; i<(int)PJ_ARRAY_SIZE(delay); ++i) {
PJ_LOG(3,(THIS_FILE,
" variant %c: transport delay %d ms", ('a'+i), delay[i]));
@@ -1302,7 +1302,7 @@ static int perform_generic_test( const char *title,
PJ_LOG(3,(THIS_FILE, " %s", title));
/* Do the test. */
- for (i=0; i<PJ_ARRAY_SIZE(delay); ++i) {
+ for (i=0; i<(int)PJ_ARRAY_SIZE(delay); ++i) {
if (test_param->type == PJSIP_TRANSPORT_LOOP_DGRAM) {
PJ_LOG(3,(THIS_FILE, " variant %c: with %d ms transport delay",
@@ -1343,7 +1343,7 @@ int tsx_uac_test(struct tsx_test_param *param)
test_param = param;
/* Get transport flag */
- tp_flag = pjsip_transport_get_flag_from_type(test_param->type);
+ tp_flag = pjsip_transport_get_flag_from_type((pjsip_transport_type_e)test_param->type);
pj_ansi_sprintf(TARGET_URI, "sip:bob@127.0.0.1:%d;transport=%s",
param->port, param->tp_type);
diff --git a/pjsip/src/test-pjsip/tsx_uas_test.c b/pjsip/src/test-pjsip/tsx_uas_test.c
index cd9aa056..7ca05a89 100644
--- a/pjsip/src/test-pjsip/tsx_uas_test.c
+++ b/pjsip/src/test-pjsip/tsx_uas_test.c
@@ -208,7 +208,7 @@ static void send_response_timer( pj_timer_heap_t *timer_heap,
struct pj_timer_entry *entry)
{
pjsip_transaction *tsx;
- struct response *r = entry->user_data;
+ struct response *r = (struct response*) entry->user_data;
pj_status_t status;
tsx = pjsip_tsx_layer_find_tsx(&r->tsx_key, PJ_TRUE);
@@ -276,7 +276,7 @@ static void schedule_send_response( pjsip_rx_data *rdata,
return;
}
- r = pj_pool_alloc(tdata->pool, sizeof(*r));
+ r = PJ_POOL_ALLOC_T(tdata->pool, struct response);
pj_strdup(tdata->pool, &r->tsx_key, tsx_key);
r->tdata = tdata;
@@ -284,7 +284,7 @@ static void schedule_send_response( pjsip_rx_data *rdata,
delay.msec = msec_delay;
pj_time_val_normalize(&delay);
- t = pj_pool_zalloc(tdata->pool, sizeof(*t));
+ t = PJ_POOL_ZALLOC_T(tdata->pool, pj_timer_entry);
t->user_data = r;
t->cb = &send_response_timer;
@@ -1096,7 +1096,7 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata)
uri=(pjsip_sip_uri*)pjsip_uri_get_uri(tdata->msg->line.req.uri);
uri->transport_param = pj_str("loop-dgram");
- via = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
+ via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
via->branch_param = pj_str(TEST9_BRANCH_ID);
status = pjsip_endpt_send_request_stateless(endpt, tdata,
@@ -1197,7 +1197,7 @@ static int perform_test( char *target_uri, char *from_uri,
}
/* Set the branch param for test 1. */
- via = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
+ via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
via->branch_param = pj_str(branch_param);
/* Schedule first send. */
@@ -1471,7 +1471,7 @@ static int tsx_transport_failure_test(void)
};
int i, status;
- for (i=0; i<PJ_ARRAY_SIZE(tests); ++i) {
+ for (i=0; i<(int)PJ_ARRAY_SIZE(tests); ++i) {
pj_time_val fail_time, end_test, now;
PJ_LOG(3,(THIS_FILE, " %s", tests[i].title));
@@ -1532,7 +1532,7 @@ int tsx_uas_test(struct tsx_test_param *param)
pj_status_t status;
test_param = param;
- tp_flag = pjsip_transport_get_flag_from_type(param->type);
+ tp_flag = pjsip_transport_get_flag_from_type((pjsip_transport_type_e)param->type);
pj_ansi_sprintf(TARGET_URI, "sip:bob@127.0.0.1:%d;transport=%s",
param->port, param->tp_type);
diff --git a/pjsip/src/test-pjsip/txdata_test.c b/pjsip/src/test-pjsip/txdata_test.c
index 851983f5..b9272ca1 100644
--- a/pjsip/src/test-pjsip/txdata_test.c
+++ b/pjsip/src/test-pjsip/txdata_test.c
@@ -444,7 +444,7 @@ static int txdata_test_uri_params(void)
}
/* Fill up the Via header to prevent syntax error on parsing */
- via = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
+ via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
via->transport = pj_str("TCP");
via->sent_by.host = pj_str("127.0.0.1");
@@ -707,8 +707,8 @@ static int create_response_bench(pj_timestamp *p_elapsed)
via->rport_param = 0;
via->branch_param = pj_str("012345678901234567890123456789");
via->recvd_param = pj_str("192.168.0.7");
- pjsip_msg_insert_first_hdr(request->msg, pjsip_hdr_clone(request->pool, via));
- pjsip_msg_insert_first_hdr(request->msg, pjsip_hdr_clone(request->pool, via));
+ pjsip_msg_insert_first_hdr(request->msg, (pjsip_hdr*) pjsip_hdr_clone(request->pool, via));
+ pjsip_msg_insert_first_hdr(request->msg, (pjsip_hdr*) pjsip_hdr_clone(request->pool, via));
pjsip_msg_insert_first_hdr(request->msg, (pjsip_hdr*)via);
@@ -716,10 +716,10 @@ static int create_response_bench(pj_timestamp *p_elapsed)
pj_bzero(&rdata, sizeof(pjsip_rx_data));
rdata.tp_info.pool = request->pool;
rdata.msg_info.msg = request->msg;
- rdata.msg_info.from = pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL);
- rdata.msg_info.to = pjsip_msg_find_hdr(request->msg, PJSIP_H_TO, NULL);
- rdata.msg_info.cseq = pjsip_msg_find_hdr(request->msg, PJSIP_H_CSEQ, NULL);
- rdata.msg_info.cid = pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL);
+ rdata.msg_info.from = (pjsip_from_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL);
+ rdata.msg_info.to = (pjsip_to_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_TO, NULL);
+ rdata.msg_info.cseq = (pjsip_cseq_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_CSEQ, NULL);
+ rdata.msg_info.cid = (pjsip_cid_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL);
rdata.msg_info.via = via;
/*
diff --git a/pjsip/src/test-pjsip/uri_test.c b/pjsip/src/test-pjsip/uri_test.c
index 0cf34e97..d26df14c 100644
--- a/pjsip/src/test-pjsip/uri_test.c
+++ b/pjsip/src/test-pjsip/uri_test.c
@@ -382,7 +382,7 @@ static pjsip_uri *create_uri4(pj_pool_t *pool)
#define param_add(list,pname,pvalue) \
do { \
pjsip_param *param; \
- param=pj_pool_alloc(pool, sizeof(pjsip_param)); \
+ param=PJ_POOL_ALLOC_T(pool, pjsip_param); \
param->name = pj_str(pname); \
param->value = pj_str(pvalue); \
pj_list_insert_before(&list, param); \
@@ -662,7 +662,7 @@ static pjsip_uri *create_uri34(pj_pool_t *pool)
uri->number = pj_str("911");
- p = pj_pool_alloc(pool, sizeof(*p));
+ p = PJ_POOL_ALLOC_T(pool, pjsip_param);
p->name = p->value = pj_str("p1");
pj_list_insert_before(&uri->other_param, p);
@@ -725,8 +725,8 @@ static pj_status_t do_uri_test(pj_pool_t *pool, struct uri_test *entry)
ref_uri = entry->creator(pool);
/* Print both URI. */
- s1.ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
- s2.ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
+ s1.ptr = (char*) pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
+ s2.ptr = (char*) pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
pj_get_timestamp(&t1);
len = pjsip_uri_print( PJSIP_URI_IN_OTHER, parsed_uri, s1.ptr, PJSIP_MAX_URL_SIZE);