summaryrefslogtreecommitdiff
path: root/pjlib-util/src/pjlib-util-test
diff options
context:
space:
mode:
Diffstat (limited to 'pjlib-util/src/pjlib-util-test')
-rw-r--r--pjlib-util/src/pjlib-util-test/encryption.c10
-rw-r--r--pjlib-util/src/pjlib-util-test/http_client.c7
-rw-r--r--pjlib-util/src/pjlib-util-test/resolver_test.c14
3 files changed, 16 insertions, 15 deletions
diff --git a/pjlib-util/src/pjlib-util-test/encryption.c b/pjlib-util/src/pjlib-util-test/encryption.c
index d9af3d9f..4298aa39 100644
--- a/pjlib-util/src/pjlib-util-test/encryption.c
+++ b/pjlib-util/src/pjlib-util-test/encryption.c
@@ -468,7 +468,7 @@ static int crc32_test(void)
for (i=0; i<PJ_ARRAY_SIZE(crc32_test_data); ++i) {
pj_crc32_context ctx;
pj_uint32_t crc0, crc1;
- unsigned len;
+ pj_size_t len;
len = pj_ansi_strlen(crc32_test_data[i].input);
crc0 = pj_crc32_calc((pj_uint8_t*)crc32_test_data[i].input, len);
@@ -591,7 +591,7 @@ static int base64_test(void)
if (base64_test_vec[i].flag & ENCODE) {
out_len = sizeof(output);
rc = pj_base64_encode((pj_uint8_t*)base64_test_vec[i].base256,
- strlen(base64_test_vec[i].base256),
+ (int)strlen(base64_test_vec[i].base256),
output, &out_len);
if (rc != PJ_SUCCESS)
return -90;
@@ -712,7 +712,7 @@ int encryption_benchmark()
double total_len;
input_len = 2048;
- total_len = input_len * LOOP;
+ total_len = (unsigned)input_len * LOOP;
pool = pj_pool_create(mem, "enc", input_len+256, 0, NULL);
if (!pool)
return PJ_ENOMEM;
@@ -726,7 +726,7 @@ int encryption_benchmark()
/* Dry run */
for (i=0; i<PJ_ARRAY_SIZE(algorithms); ++i) {
algorithms[i].init_context(&context);
- algorithms[i].update(&context, input, input_len);
+ algorithms[i].update(&context, input, (unsigned)input_len);
algorithms[i].final(&context, digest);
}
@@ -738,7 +738,7 @@ int encryption_benchmark()
pj_get_timestamp(&t1);
algorithms[i].init_context(&context);
for (j=0; j<LOOP; ++j) {
- algorithms[i].update(&context, input, input_len);
+ algorithms[i].update(&context, input, (unsigned)input_len);
}
algorithms[i].final(&context, digest);
pj_get_timestamp(&t2);
diff --git a/pjlib-util/src/pjlib-util-test/http_client.c b/pjlib-util/src/pjlib-util-test/http_client.c
index dc2fe5f1..ed182065 100644
--- a/pjlib-util/src/pjlib-util-test/http_client.c
+++ b/pjlib-util/src/pjlib-util-test/http_client.c
@@ -76,7 +76,7 @@ static int server_thread(void *p)
while (!thread_quit) {
PJ_FD_ZERO(&rset);
PJ_FD_SET(srv->sock, &rset);
- rc = pj_sock_select(srv->sock+1, &rset, NULL, NULL, &timeout);
+ rc = pj_sock_select((int)srv->sock+1, &rset, NULL, NULL, &timeout);
if (rc != 1) {
continue;
}
@@ -93,7 +93,7 @@ static int server_thread(void *p)
while (!thread_quit) {
PJ_FD_ZERO(&rset);
PJ_FD_SET(newsock, &rset);
- rc = pj_sock_select(newsock+1, &rset, NULL, NULL, &timeout);
+ rc = pj_sock_select((int)newsock+1, &rset, NULL, NULL, &timeout);
if (rc != 1) {
PJ_LOG(3,("http test", "client timeout"));
continue;
@@ -115,7 +115,8 @@ static int server_thread(void *p)
if (srv->action == ACTION_IGNORE) {
continue;
} else if (srv->action == ACTION_REPLY) {
- unsigned send_size = 0, ctr = 0;
+ pj_size_t send_size = 0;
+ unsigned ctr = 0;
pj_ansi_sprintf(pkt, "HTTP/1.0 200 OK\r\n");
if (srv->send_content_length) {
pj_ansi_sprintf(pkt + pj_ansi_strlen(pkt),
diff --git a/pjlib-util/src/pjlib-util-test/resolver_test.c b/pjlib-util/src/pjlib-util-test/resolver_test.c
index ebe466e9..e68efe4f 100644
--- a/pjlib-util/src/pjlib-util-test/resolver_test.c
+++ b/pjlib-util/src/pjlib-util-test/resolver_test.c
@@ -111,7 +111,7 @@ static int print_name(pj_uint8_t *pkt, int size,
return 2;
} else {
if (tab->count < MAX_LABEL) {
- tab->a[tab->count].pos = (p-pkt);
+ tab->a[tab->count].pos = (unsigned)(p-pkt);
tab->a[tab->count].label.ptr = (char*)(p+1);
tab->a[tab->count].label.slen = name->slen;
++tab->count;
@@ -136,7 +136,7 @@ static int print_name(pj_uint8_t *pkt, int size,
*p = (pj_uint8_t)label.slen;
pj_memcpy(p+1, label.ptr, label.slen);
- size -= (label.slen+1);
+ size -= (int)(label.slen+1);
p += (label.slen+1);
if (endlabel != endname && *endlabel == '.')
@@ -149,7 +149,7 @@ static int print_name(pj_uint8_t *pkt, int size,
*p++ = '\0';
- return p-pos;
+ return (int)(p-pos);
}
static int print_rr(pj_uint8_t *pkt, int size, pj_uint8_t *pos,
@@ -232,7 +232,7 @@ static int print_rr(pj_uint8_t *pkt, int size, pj_uint8_t *pos,
return -1;
}
- return p-pos;
+ return (int)(p-pos);
}
static int print_packet(const pj_dns_parsed_packet *rec, pj_uint8_t *pkt,
@@ -319,7 +319,7 @@ static int print_packet(const pj_dns_parsed_packet *rec, pj_uint8_t *pkt,
size -= len;
}
- return p - pkt;
+ return (int)(p - pkt);
}
@@ -339,7 +339,7 @@ static int server_thread(void *p)
PJ_FD_ZERO(&rset);
PJ_FD_SET(srv->sock, &rset);
- rc = pj_sock_select(srv->sock+1, &rset, NULL, NULL, &timeout);
+ rc = pj_sock_select((int)(srv->sock+1), &rset, NULL, NULL, &timeout);
if (rc != 1)
continue;
@@ -355,7 +355,7 @@ static int server_thread(void *p)
PJ_LOG(5,(THIS_FILE, "Server %d processing packet", srv - &g_server[0]));
srv->pkt_count++;
- rc = pj_dns_parse_packet(pool, pkt, pkt_len, &req);
+ rc = pj_dns_parse_packet(pool, pkt, (unsigned)pkt_len, &req);
if (rc != PJ_SUCCESS) {
app_perror("server error parsing packet", rc);
continue;