From 20bb3cf2adf15ca8b74d39dbb898d159b396149a Mon Sep 17 00:00:00 2001 From: Ruby Martin Date: Wed, 22 Jan 2025 12:13:01 -0700 Subject: [PATCH] edits to clear some type cast errors --- tests/api.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/api.c b/tests/api.c index 9aa14b2332..1d4ca8fe15 100644 --- a/tests/api.c +++ b/tests/api.c @@ -830,6 +830,11 @@ int test_memio_setup(struct test_memio_ctx *ctx, } #endif +#ifdef USE_WINDOWS_API + #define MESSAGE_TYPE_CAST char* +#else + #define MESSAGE_TYPE_CAST void* +#endif /*----------------------------------------------------------------------------* | BIO with fixed read/write size *----------------------------------------------------------------------------*/ @@ -8389,7 +8394,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args) if (!sharedCtx) wolfSSL_CTX_free(ctx); - if (clientfd >= 0) + if (clientfd != SOCKET_INVALID) CloseSocket(clientfd); #ifdef WOLFSSL_TIRTOS @@ -76214,7 +76219,7 @@ static int test_wolfSSL_TXT_DB(void) /* Test index */ ExpectIntEQ(TXT_DB_create_index(db, 3, NULL, - (wolf_sk_hash_cb)(long unsigned int)TXT_DB_hash, + (wolf_sk_hash_cb)TXT_DB_hash, (wolf_lh_compare_cb)TXT_DB_cmp), 1); ExpectNotNull(TXT_DB_get_by_index(db, 3, (WOLFSSL_STRING*)fields)); fields[3] = "12DA"; @@ -90343,7 +90348,7 @@ static void test_wolfSSL_dtls_plaintext_client(WOLFSSL* ssl) AssertIntGE(fd, 0); generateDTLSMsg(ch, sizeof(ch), 20, client_hello, 0); /* Server should ignore this datagram */ - AssertIntEQ(send(fd, ch, sizeof(ch), 0), sizeof(ch)); + AssertIntEQ(send(fd, (MESSAGE_TYPE_CAST)ch, sizeof(ch), 0), sizeof(ch)); generateDTLSMsg(ch, sizeof(ch), 20, client_hello, 10000); /* Server should ignore this datagram */ AssertIntEQ(send(fd, ch, sizeof(ch), 0), sizeof(ch)); @@ -90457,7 +90462,7 @@ static void test_wolfSSL_dtls12_fragments_spammer(WOLFSSL* ssl) delay.tv_nsec = 10000000; /* wait 0.01 seconds */ c32toa(seq_number, b + seq_offset); c16toa(msg_number, b + msg_offset); - ret = (int)send(fd, b, 55, 0); + ret = (int)send(fd, (MESSAGE_TYPE_CAST)b, 55, 0); nanosleep(&delay, NULL); } } @@ -90576,7 +90581,7 @@ static void test_wolfSSL_dtls_send_alert(WOLFSSL* ssl) fd = wolfSSL_get_wfd(ssl); AssertIntGE(fd, 0); - ret = (int)send(fd, alert_msg, sizeof(alert_msg), 0); + ret = (int)send(fd, (MESSAGE_TYPE_CAST)alert_msg, sizeof(alert_msg), 0); AssertIntGT(ret, 0); } @@ -90647,7 +90652,7 @@ static void test_wolfSSL_send_bad_record(WOLFSSL* ssl) fd = wolfSSL_get_wfd(ssl); AssertIntGE(fd, 0); - ret = (int)send(fd, bad_msg, sizeof(bad_msg), 0); + ret = (int)send(fd, (MESSAGE_TYPE_CAST)bad_msg, sizeof(bad_msg), 0); AssertIntEQ(ret, sizeof(bad_msg)); ret = wolfSSL_write(ssl, "badrecordtest", sizeof("badrecordtest")); AssertIntEQ(ret, sizeof("badrecordtest")); @@ -90974,10 +90979,10 @@ static void test_wolfSSL_dtls_send_ch(WOLFSSL* ssl) fd = wolfSSL_get_wfd(ssl); AssertIntGE(fd, 0); - ret = (int)send(fd, ch_msg, sizeof(ch_msg), 0); + ret = (int)send(fd, (MESSAGE_TYPE_CAST)ch_msg, sizeof(ch_msg), 0); AssertIntGT(ret, 0); /* consume the HRR otherwise handshake will fail */ - ret = (int)recv(fd, ch_msg, sizeof(ch_msg), 0); + ret = (int)recv(fd, (MESSAGE_TYPE_CAST)ch_msg, sizeof(ch_msg), 0); AssertIntGT(ret, 0); }