From ba4ad789fe472f2eb0f52d181a1a7994ef26b1e9 Mon Sep 17 00:00:00 2001 From: Tom L <98499638+expressvpn-tom-l@users.noreply.github.com> Date: Fri, 13 Oct 2023 07:58:38 +0800 Subject: [PATCH 1/3] test: fix compiler warnings in test_conn.c test/he/test_conn.c:604:22: warning: incompatible function pointer types passing 'int (WOLFSSL *, const void *, int)' (aka 'int (struct WOLFSSL *, const void *, int)') to parameter of type 'CMOCK_wolfSSL_write_CALLBACK' (aka 'int (*)(struct WOLFSSL *, const void *, int, int)') [-Wincompatible-function-pointer-types] wolfSSL_write_Stub(wolfSSL_write_ping_stub); ^~~~~~~~~~~~~~~~~~~~~~~ build/test/mocks/mock_ssl.h:1230:54: note: passing argument to parameter 'Callback' here void wolfSSL_write_Stub(CMOCK_wolfSSL_write_CALLBACK Callback); ^ 1 warning generated. --- test/he/test_conn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/he/test_conn.c b/test/he/test_conn.c index 5c23340e..cf5056ce 100644 --- a/test/he/test_conn.c +++ b/test/he/test_conn.c @@ -1,4 +1,4 @@ -/* * +/** * Lightway Core * Copyright (C) 2021 Express VPN International Ltd. * @@ -575,7 +575,7 @@ void test_send_keepalive_error_when_not_connected(void) { } // Stub function for writing a he_msg_ping_t to wolfssl -static int wolfSSL_write_ping_stub(WOLFSSL *ssl, const void *data, int sz) { +static int wolfSSL_write_ping_stub(WOLFSSL *ssl, const void *data, int sz, int num_calls) { TEST_ASSERT_EQUAL_PTR(conn.wolf_ssl, ssl); TEST_ASSERT_NOT_NULL(data); TEST_ASSERT_GREATER_OR_EQUAL(sizeof(he_msg_ping_t), sz); From 84fc64020a2300fa81cf794f90f4a4e8af62a14e Mon Sep 17 00:00:00 2001 From: Tom L <98499638+expressvpn-tom-l@users.noreply.github.com> Date: Fri, 13 Oct 2023 08:01:44 +0800 Subject: [PATCH 2/3] test: fix compiler warnings in test_ssl_ctx.c test/he/test_ssl_ctx.c:962:80: warning: passing 'uint8_t[5]' (aka 'unsigned char[5]') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign] he_return_code_t res = he_ssl_ctx_set_server_cert_key_files(NULL, fake_cert, fake_cert); --- test/he/test_ssl_ctx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/he/test_ssl_ctx.c b/test/he/test_ssl_ctx.c index 6d6106d8..c89d659e 100644 --- a/test/he/test_ssl_ctx.c +++ b/test/he/test_ssl_ctx.c @@ -1,4 +1,4 @@ -/* * +/** * Lightway Core * Copyright (C) 2021 Express VPN International Ltd. * @@ -949,7 +949,8 @@ void test_he_ssl_ctx_is_ca_set_set_ctx_null(void) { } void test_he_ssl_ctx_set_server_cert_key_files_ctx_null(void) { - he_return_code_t res = he_ssl_ctx_set_server_cert_key_files(NULL, fake_cert, fake_cert); + he_return_code_t res = + he_ssl_ctx_set_server_cert_key_files(NULL, (const char *)fake_cert, (const char *)fake_cert); TEST_ASSERT_EQUAL(HE_ERR_NULL_POINTER, res); } From 0522e3ba4f5cbe994b30c5c0f2c18e5314fce711 Mon Sep 17 00:00:00 2001 From: Tom L <98499638+expressvpn-tom-l@users.noreply.github.com> Date: Fri, 13 Oct 2023 08:04:43 +0800 Subject: [PATCH 3/3] test: fix compiler warnings in test_msg_handlers.c test/he/test_msg_handlers.c:187:34: warning: incompatible pointer types passing 'he_msg_pong_t *' (aka 'struct he_msg_pong *') to parameter of type 'uint8_t *' (aka 'unsigned char *') [-Wincompatible-pointer-types] ret = he_handle_msg_pong(conn, pong, sizeof(he_msg_pong_t)); --- test/he/test_msg_handlers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/he/test_msg_handlers.c b/test/he/test_msg_handlers.c index f9dc4809..d74be3b4 100644 --- a/test/he/test_msg_handlers.c +++ b/test/he/test_msg_handlers.c @@ -184,7 +184,7 @@ void test_msg_handler_pong(void) { he_msg_pong_t *pong = (he_msg_pong_t *)empty_data; pong->id = htons(42); - ret = he_handle_msg_pong(conn, pong, sizeof(he_msg_pong_t)); + ret = he_handle_msg_pong(conn, (uint8_t *)pong, sizeof(he_msg_pong_t)); TEST_ASSERT_EQUAL(HE_SUCCESS, ret); } @@ -193,7 +193,7 @@ void test_msg_handler_pong_mismatch_id(void) { he_msg_pong_t *pong = (he_msg_pong_t *)empty_data; pong->id = htons(999); - ret = he_handle_msg_pong(conn, pong, sizeof(he_msg_pong_t)); + ret = he_handle_msg_pong(conn, (uint8_t *)pong, sizeof(he_msg_pong_t)); TEST_ASSERT_EQUAL(HE_SUCCESS, ret); }