Peer review feedback: Improve workaround for variadic macros and cast warnings.

This commit is contained in:
David Garske 2024-11-04 11:15:00 -08:00
parent 671f93135b
commit aad0f6e08d
3 changed files with 23 additions and 16 deletions

View File

@ -1634,8 +1634,7 @@ int wolfSSL_OCSP_REQ_CTX_nbio(WOLFSSL_OCSP_REQ_CTX *ctx)
case ORIOS_WRITE:
{
const unsigned char *req;
int reqLen = wolfSSL_BIO_get_mem_data(ctx->reqResp,
(unsigned char*)&req);
int reqLen = wolfSSL_BIO_get_mem_data(ctx->reqResp, (void*)&req);
if (reqLen <= 0) {
WOLFSSL_MSG("wolfSSL_BIO_get_mem_data error");
return WOLFSSL_FAILURE;
@ -1711,8 +1710,7 @@ int wolfSSL_OCSP_sendreq_nbio(OcspResponse **presp, WOLFSSL_OCSP_REQ_CTX *ctx)
if (ret != WOLFSSL_SUCCESS)
return ret;
len = wolfSSL_BIO_get_mem_data(ctx->reqResp,
(unsigned char*)&resp);
len = wolfSSL_BIO_get_mem_data(ctx->reqResp, (void*)&resp);
if (len <= 0)
return WOLFSSL_FAILURE;
return wolfSSL_d2i_OCSP_RESPONSE(presp, &resp, len) != NULL

View File

@ -7168,15 +7168,16 @@ static int TLSX_CA_Names_Parse(WOLFSSL *ssl, const byte* input,
return 0;
}
#define CAN_GET_SIZE TLSX_CA_Names_GetSize
#define CAN_WRITE TLSX_CA_Names_Write
#define CAN_PARSE TLSX_CA_Names_Parse
#define CAN_GET_SIZE(data) TLSX_CA_Names_GetSize(data)
#define CAN_WRITE(data, output) TLSX_CA_Names_Write(data, output)
#define CAN_PARSE(ssl, input, length, isRequest) \
TLSX_CA_Names_Parse(ssl, input, length, isRequest)
#else
#define CAN_GET_SIZE() 0
#define CAN_WRITE() 0
#define CAN_PARSE() 0
#define CAN_GET_SIZE(data) 0
#define CAN_WRITE(data, output) 0
#define CAN_PARSE(ssl, input, length, isRequest) 0
#endif
@ -14762,9 +14763,9 @@ static word16 TLSX_GetMinSize_Client(word16* type)
return 0;
}
}
#define TLSX_GET_MIN_SIZE_CLIENT TLSX_GetMinSize_Client
#define TLSX_GET_MIN_SIZE_CLIENT(type) TLSX_GetMinSize_Client(type)
#else
#define TLSX_GET_MIN_SIZE_CLIENT() 0
#define TLSX_GET_MIN_SIZE_CLIENT(type) 0
#endif
@ -14831,9 +14832,9 @@ static word16 TLSX_GetMinSize_Server(const word16 *type)
return 0;
}
}
#define TLSX_GET_MIN_SIZE_SERVER TLSX_GetMinSize_Server
#define TLSX_GET_MIN_SIZE_SERVER(type) TLSX_GetMinSize_Server(type)
#else
#define TLSX_GET_MIN_SIZE_SERVER() 0
#define TLSX_GET_MIN_SIZE_SERVER(type) 0
#endif

View File

@ -178,7 +178,11 @@ WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix);
WOLFSSL_API void WOLFSSL_MSG_EX(const char* fmt, ...);
#define HAVE_WOLFSSL_MSG_EX
#else
#define WOLFSSL_MSG_EX() WC_DO_NOTHING
#ifdef __WATCOMC__ /* does not allow variadic macros */
#define WOLFSSL_MSG_EX() WC_DO_NOTHING
#else
#define WOLFSSL_MSG_EX(...) WC_DO_NOTHING
#endif
#endif
WOLFSSL_API void WOLFSSL_MSG(const char* msg);
#ifdef WOLFSSL_DEBUG_CODEPOINTS
@ -209,7 +213,11 @@ WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix);
#define WOLFSSL_STUB(m) WC_DO_NOTHING
#define WOLFSSL_IS_DEBUG_ON() 0
#define WOLFSSL_MSG_EX(...) WC_DO_NOTHING
#ifdef __WATCOMC__ /* does not allow variadic macros */
#define WOLFSSL_MSG_EX() WC_DO_NOTHING
#else
#define WOLFSSL_MSG_EX(...) WC_DO_NOTHING
#endif
#define WOLFSSL_MSG(m) WC_DO_NOTHING
#define WOLFSSL_BUFFER(b, l) WC_DO_NOTHING