diff options
Diffstat (limited to 'pjlib/src/pjlib-test')
-rw-r--r-- | pjlib/src/pjlib-test/errno.c | 5 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/ioq_perf.c | 4 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/ioq_tcp.c | 10 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/ioq_udp.c | 7 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/ioq_unreg.c | 4 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/list.c | 5 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/pool.c | 5 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/sock_perf.c | 4 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/ssl_sock.c | 11 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/timer.c | 3 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c | 8 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/udp_echo_srv_sync.c | 2 |
12 files changed, 37 insertions, 31 deletions
diff --git a/pjlib/src/pjlib-test/errno.c b/pjlib/src/pjlib-test/errno.c index a82cfc89..e6d901fe 100644 --- a/pjlib/src/pjlib-test/errno.c +++ b/pjlib/src/pjlib-test/errno.c @@ -28,7 +28,8 @@ #define THIS_FILE "errno" -#if defined(PJ_WIN32) && PJ_WIN32 != 0 +#if (defined(PJ_WIN32) && PJ_WIN32 != 0) || \ + (defined(PJ_WIN64) && PJ_WIN64 != 0) # include <windows.h> #endif @@ -59,7 +60,7 @@ int my_strncasecmp(const char *s1, const char *s2, int max_len) const char *my_stristr(const char *whole, const char *part) { - int part_len = strlen(part); + int part_len = (int)strlen(part); while (*whole) { if (my_strncasecmp(whole, part, part_len) == 0) return whole; diff --git a/pjlib/src/pjlib-test/ioq_perf.c b/pjlib/src/pjlib-test/ioq_perf.c index 54d4d4bd..2dd94442 100644 --- a/pjlib/src/pjlib-test/ioq_perf.c +++ b/pjlib/src/pjlib-test/ioq_perf.c @@ -84,7 +84,7 @@ static void on_read_complete(pj_ioqueue_key_t *key, return; if (bytes_read < 0) { - pj_status_t rc = -bytes_read; + pj_status_t rc = (pj_status_t)-bytes_read; char errmsg[PJ_ERR_MSG_SIZE]; if (rc != last_error) { @@ -424,7 +424,7 @@ static int perform_test(pj_bool_t allow_concur, /* Calculate total bytes received. */ total_received = 0; for (i=0; i<sockpair_cnt; ++i) { - total_received = items[i].bytes_recv; + total_received = (pj_uint32_t)items[i].bytes_recv; } /* bandwidth = total_received*1000/total_elapsed_usec */ diff --git a/pjlib/src/pjlib-test/ioq_tcp.c b/pjlib/src/pjlib-test/ioq_tcp.c index 4d70e3cd..2d6b3876 100644 --- a/pjlib/src/pjlib-test/ioq_tcp.c +++ b/pjlib/src/pjlib-test/ioq_tcp.c @@ -253,8 +253,8 @@ static int compliance_test_0(pj_bool_t allow_concur) pj_ioqueue_key_t *skey=NULL, *ckey0=NULL, *ckey1=NULL; pj_ioqueue_op_key_t accept_op; int bufsize = BUF_MIN_SIZE; - pj_ssize_t status = -1; - int pending_op = 0; + int status = -1; + pj_ssize_t pending_op = 0; pj_timestamp t_elapsed; pj_str_t s; pj_status_t rc; @@ -467,7 +467,7 @@ on_error: if (ioque != NULL) pj_ioqueue_destroy(ioque); pj_pool_release(pool); - return status; + return (int)status; } @@ -482,7 +482,7 @@ static int compliance_test_1(pj_bool_t allow_concur) pj_pool_t *pool = NULL; pj_ioqueue_t *ioque = NULL; pj_ioqueue_key_t *ckey1 = NULL; - pj_ssize_t status = -1; + int status = -1; int pending_op = 0; pj_str_t s; pj_status_t rc; @@ -640,7 +640,7 @@ static int compliance_test_2(pj_bool_t allow_concur) char *send_buf, *recv_buf; pj_ioqueue_t *ioque = NULL; int i, bufsize = BUF_MIN_SIZE; - pj_ssize_t status; + int status; int test_loop, pending_op = 0; pj_timestamp t_elapsed; pj_str_t s; diff --git a/pjlib/src/pjlib-test/ioq_udp.c b/pjlib/src/pjlib-test/ioq_udp.c index 66c856c9..86a01c7e 100644 --- a/pjlib/src/pjlib-test/ioq_udp.c +++ b/pjlib/src/pjlib-test/ioq_udp.c @@ -115,7 +115,7 @@ static pj_ioqueue_callback test_cb = &on_ioqueue_connect, }; -#ifdef PJ_WIN32 +#if defined(PJ_WIN32) || defined(PJ_WIN64) # define S_ADDR S_un.S_addr #else # define S_ADDR s_addr @@ -137,7 +137,8 @@ static int compliance_test(pj_bool_t allow_concur) pj_ioqueue_key_t *skey = NULL, *ckey = NULL; pj_ioqueue_op_key_t read_op, write_op; int bufsize = BUF_MIN_SIZE; - pj_ssize_t bytes, status = -1; + pj_ssize_t bytes; + int status = -1; pj_str_t temp; pj_bool_t send_pending, recv_pending; pj_status_t rc; @@ -768,7 +769,7 @@ static int bench_test(pj_bool_t allow_concur, int bufsize, } if (rc == PJ_SUCCESS) { if (bytes < 0) { - app_perror("...error: pj_ioqueue_sendto()", -bytes); + app_perror("...error: pj_ioqueue_sendto()",(pj_status_t)-bytes); break; } } diff --git a/pjlib/src/pjlib-test/ioq_unreg.c b/pjlib/src/pjlib-test/ioq_unreg.c index beb4e33e..d40c1719 100644 --- a/pjlib/src/pjlib-test/ioq_unreg.c +++ b/pjlib/src/pjlib-test/ioq_unreg.c @@ -58,7 +58,7 @@ struct sock_data char *buffer; pj_size_t bufsize; pj_bool_t unregistered; - unsigned received; + pj_ssize_t received; } sock_data; static void on_read_complete(pj_ioqueue_key_t *key, @@ -81,7 +81,7 @@ static void on_read_complete(pj_ioqueue_key_t *key, if (bytes_read < 0) { if (-bytes_read != PJ_STATUS_FROM_OS(PJ_BLOCKING_ERROR_VAL)) - app_perror("ioqueue reported recv error", -bytes_read); + app_perror("ioqueue reported recv error", (pj_status_t)-bytes_read); } else { sock_data.received += bytes_read; } diff --git a/pjlib/src/pjlib-test/list.c b/pjlib/src/pjlib-test/list.c index b9fbd5ca..a265481e 100644 --- a/pjlib/src/pjlib-test/list.c +++ b/pjlib/src/pjlib-test/list.c @@ -57,7 +57,7 @@ typedef struct list_node static int compare_node(void *value, const pj_list_type *nd) { list_node *node = (list_node*)nd; - return ((long)value == node->value) ? 0 : -1; + return ((long)(pj_ssize_t)value == node->value) ? 0 : -1; } #define PJ_SIGNED_ARRAY_SIZE(a) ((int)PJ_ARRAY_SIZE(a)) @@ -207,7 +207,8 @@ int list_test() if (p != &nodes[i]) { return -1; } - p = (list_node*) pj_list_search(&list, (void*)(long)i, &compare_node); + p = (list_node*) pj_list_search(&list, (void*)(pj_ssize_t)i, + &compare_node); pj_assert( p == &nodes[i] ); if (p != &nodes[i]) { return -1; diff --git a/pjlib/src/pjlib-test/pool.c b/pjlib/src/pjlib-test/pool.c index d7af16e4..e3fbb555 100644 --- a/pjlib/src/pjlib-test/pool.c +++ b/pjlib/src/pjlib-test/pool.c @@ -93,7 +93,8 @@ static int pool_alignment_test(void) if (!pool) return -300; -#define IS_ALIGNED(p) ((((unsigned long)p) & (PJ_POOL_ALIGNMENT-1)) == 0) +#define IS_ALIGNED(p) ((((unsigned long)(pj_ssize_t)p) & \ + (PJ_POOL_ALIGNMENT-1)) == 0) for (i=0; i<LOOP; ++i) { /* Test first allocation */ @@ -195,7 +196,7 @@ static int drain_test(pj_size_t size, pj_size_t increment) size = ((pj_rand() & 0x000000FF) + PJ_POOL_ALIGNMENT) & ~(PJ_POOL_ALIGNMENT - 1); else - size = freesize; + size = (int)freesize; p = pj_pool_alloc(pool, size); if (!p) { diff --git a/pjlib/src/pjlib-test/sock_perf.c b/pjlib/src/pjlib-test/sock_perf.c index f7465f19..4a998b18 100644 --- a/pjlib/src/pjlib-test/sock_perf.c +++ b/pjlib/src/pjlib-test/sock_perf.c @@ -44,7 +44,7 @@ * buf_size size packets as fast as possible. */ static int sock_producer_consumer(int sock_type, - unsigned buf_size, + pj_size_t buf_size, unsigned loop, unsigned *p_bandwidth) { @@ -54,7 +54,7 @@ static int sock_producer_consumer(int sock_type, pj_timestamp start, stop; unsigned i; pj_highprec_t elapsed, bandwidth; - pj_size_t total_received; + pj_highprec_t total_received; pj_status_t rc; /* Create pool. */ diff --git a/pjlib/src/pjlib-test/ssl_sock.c b/pjlib/src/pjlib-test/ssl_sock.c index 242c46e6..4ebf9979 100644 --- a/pjlib/src/pjlib-test/ssl_sock.c +++ b/pjlib/src/pjlib-test/ssl_sock.c @@ -73,12 +73,12 @@ struct test_state pj_bool_t is_verbose; /* verbose flag, e.g: cert info */ pj_bool_t echo; /* echo received data */ pj_status_t err; /* error flag */ - unsigned sent; /* bytes sent */ - unsigned recv; /* bytes received */ + pj_size_t sent; /* bytes sent */ + pj_size_t recv; /* bytes received */ pj_uint8_t read_buf[256]; /* read buffer */ pj_bool_t done; /* test done flag */ char *send_str; /* data to send once connected */ - unsigned send_str_len; /* send data length */ + pj_size_t send_str_len; /* send data length */ pj_bool_t check_echo; /* flag to compare sent & echoed data */ const char *check_echo_ptr; /* pointer/cursor for comparing data */ struct send_key send_key; /* send op key */ @@ -363,7 +363,7 @@ static pj_bool_t ssl_on_data_sent(pj_ssl_sock_t *ssock, PJ_UNUSED_ARG(op_key); if (sent < 0) { - st->err = -sent; + st->err = (pj_status_t)-sent; } else { st->sent += sent; @@ -1113,7 +1113,8 @@ static int perf_test(unsigned clients, unsigned ms_handshake_timeout) pj_sockaddr addr, listen_addr; pj_ssl_cert_t *cert = NULL; pj_status_t status; - unsigned i, cli_err = 0, tot_sent = 0, tot_recv = 0; + unsigned i, cli_err = 0; + pj_size_t tot_sent = 0, tot_recv = 0; pj_time_val start; pool = pj_pool_create(mem, "ssl_perf", 256, 256, NULL); diff --git a/pjlib/src/pjlib-test/timer.c b/pjlib/src/pjlib-test/timer.c index 9bc2a82f..9521aa9e 100644 --- a/pjlib/src/pjlib-test/timer.c +++ b/pjlib/src/pjlib-test/timer.c @@ -59,7 +59,8 @@ static int test_timer_heap(void) pj_timer_heap_t *timer; pj_time_val delay; pj_status_t rc; int err=0; - unsigned size, count; + pj_size_t size; + unsigned count; size = pj_timer_heap_mem_size(MAX_COUNT)+MAX_COUNT*sizeof(pj_timer_entry); pool = pj_pool_create( mem, NULL, size, 4000, NULL); diff --git a/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c b/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c index 217a8d87..bd701655 100644 --- a/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c +++ b/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c @@ -49,13 +49,13 @@ static void on_read_complete(pj_ioqueue_key_t *key, if (bytes_received < 0) { if (-bytes_received != recv_rec->last_err) { - recv_rec->last_err = -bytes_received; - app_perror("...error receiving data", -bytes_received); + recv_rec->last_err = (pj_status_t)-bytes_received; + app_perror("...error receiving data", recv_rec->last_err); } } else if (bytes_received == 0) { /* note: previous error, or write callback */ } else { - pj_atomic_add(total_bytes, bytes_received); + pj_atomic_add(total_bytes, (pj_atomic_value_t)bytes_received); if (!send_rec->is_pending) { pj_ssize_t sent = bytes_received; @@ -106,7 +106,7 @@ static void on_write_complete(pj_ioqueue_key_t *key, struct op_key *send_rec = (struct op_key*)op_key; if (bytes_sent <= 0) { - pj_status_t rc = -bytes_sent; + pj_status_t rc = (pj_status_t)-bytes_sent; if (rc != send_rec->last_err) { send_rec->last_err = rc; app_perror("...send error(2)", rc); diff --git a/pjlib/src/pjlib-test/udp_echo_srv_sync.c b/pjlib/src/pjlib-test/udp_echo_srv_sync.c index a5624208..5e9fdf6b 100644 --- a/pjlib/src/pjlib-test/udp_echo_srv_sync.c +++ b/pjlib/src/pjlib-test/udp_echo_srv_sync.c @@ -46,7 +46,7 @@ static int worker_thread(void *arg) continue; } - pj_atomic_add(total_bytes, len); + pj_atomic_add(total_bytes, (pj_atomic_value_t)len); rc = pj_sock_sendto(sock, buf, &len, 0, &addr, addrlen); if (rc != PJ_SUCCESS) { |