test: fix compilation warnings with VC++

C6011 and C4244
This commit is contained in:
Rasmus Pedersen 2014-04-16 22:24:52 +02:00 committed by Saúl Ibarra Corretgé
parent f212ceffae
commit cd6e74dd80
5 changed files with 12 additions and 2 deletions

View File

@ -119,8 +119,9 @@ static void after_read(uv_stream_t* handle,
}
wr = (write_req_t*) malloc(sizeof *wr);
ASSERT(wr != NULL);
wr->buf = uv_buf_init(buf->base, nread);
if (uv_write(&wr->req, handle, &wr->buf, 1, after_write)) {
FATAL("uv_write failed");
}

View File

@ -126,6 +126,7 @@ TEST_IMPL(getaddrinfo_concurrent) {
callback_counts[i] = 0;
data = (int*)malloc(sizeof(int));
ASSERT(data != NULL);
*data = i;
getaddrinfo_handles[i].data = data;

View File

@ -155,8 +155,10 @@ static void tcp_pinger_v6_new(void) {
struct sockaddr_in6 server_addr;
pinger_t *pinger;
ASSERT(0 ==uv_ip6_addr("::1", TEST_PORT, &server_addr));
pinger = malloc(sizeof(*pinger));
ASSERT(pinger != NULL);
pinger->state = 0;
pinger->pongs = 0;
@ -185,6 +187,7 @@ static void tcp_pinger_new(void) {
ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &server_addr));
pinger = malloc(sizeof(*pinger));
ASSERT(pinger != NULL);
pinger->state = 0;
pinger->pongs = 0;
@ -211,6 +214,7 @@ static void pipe_pinger_new(void) {
pinger_t *pinger;
pinger = (pinger_t*)malloc(sizeof(*pinger));
ASSERT(pinger != NULL);
pinger->state = 0;
pinger->pongs = 0;

View File

@ -837,6 +837,7 @@ TEST_IMPL(argument_escaping) {
WCHAR* non_verbatim_output;
test_output = calloc(count, sizeof(WCHAR*));
ASSERT(test_output != NULL);
for (i = 0; i < count; ++i) {
test_output[i] = calloc(2 * (wcslen(test_str[i]) + 2), sizeof(WCHAR));
quote_cmd_arg(test_str[i], test_output[i]);
@ -845,6 +846,7 @@ TEST_IMPL(argument_escaping) {
total_size += wcslen(test_output[i]) + 1;
}
command_line = calloc(total_size + 1, sizeof(WCHAR));
ASSERT(command_line != NULL);
for (i = 0; i < count; ++i) {
wcscat(command_line, test_output[i]);
wcscat(command_line, L" ");

View File

@ -86,7 +86,9 @@ static void saturate_threadpool(void) {
* the thread pool is saturated. As with any timing dependent test,
* this is obviously not ideal.
*/
if (uv_cond_timedwait(&signal_cond, &signal_mutex, (uint64_t)(350 * 1e6))) {
if (uv_cond_timedwait(&signal_cond,
&signal_mutex,
(uint64_t) (350 * 1e6))) {
ASSERT(0 == uv_cancel((uv_req_t*) req));
break;
}