Skip to content

Commit aad0f6e

Browse files
committed
Peer review feedback: Improve workaround for variadic macros and cast warnings.
1 parent 671f931 commit aad0f6e

3 files changed

Lines changed: 23 additions & 16 deletions

File tree

src/ocsp.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,8 +1634,7 @@ int wolfSSL_OCSP_REQ_CTX_nbio(WOLFSSL_OCSP_REQ_CTX *ctx)
16341634
case ORIOS_WRITE:
16351635
{
16361636
const unsigned char *req;
1637-
int reqLen = wolfSSL_BIO_get_mem_data(ctx->reqResp,
1638-
(unsigned char*)&req);
1637+
int reqLen = wolfSSL_BIO_get_mem_data(ctx->reqResp, (void*)&req);
16391638
if (reqLen <= 0) {
16401639
WOLFSSL_MSG("wolfSSL_BIO_get_mem_data error");
16411640
return WOLFSSL_FAILURE;
@@ -1711,8 +1710,7 @@ int wolfSSL_OCSP_sendreq_nbio(OcspResponse **presp, WOLFSSL_OCSP_REQ_CTX *ctx)
17111710
if (ret != WOLFSSL_SUCCESS)
17121711
return ret;
17131712

1714-
len = wolfSSL_BIO_get_mem_data(ctx->reqResp,
1715-
(unsigned char*)&resp);
1713+
len = wolfSSL_BIO_get_mem_data(ctx->reqResp, (void*)&resp);
17161714
if (len <= 0)
17171715
return WOLFSSL_FAILURE;
17181716
return wolfSSL_d2i_OCSP_RESPONSE(presp, &resp, len) != NULL

src/tls.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7168,15 +7168,16 @@ static int TLSX_CA_Names_Parse(WOLFSSL *ssl, const byte* input,
71687168
return 0;
71697169
}
71707170

7171-
#define CAN_GET_SIZE TLSX_CA_Names_GetSize
7172-
#define CAN_WRITE TLSX_CA_Names_Write
7173-
#define CAN_PARSE TLSX_CA_Names_Parse
7171+
#define CAN_GET_SIZE(data) TLSX_CA_Names_GetSize(data)
7172+
#define CAN_WRITE(data, output) TLSX_CA_Names_Write(data, output)
7173+
#define CAN_PARSE(ssl, input, length, isRequest) \
7174+
TLSX_CA_Names_Parse(ssl, input, length, isRequest)
71747175

71757176
#else
71767177

7177-
#define CAN_GET_SIZE() 0
7178-
#define CAN_WRITE() 0
7179-
#define CAN_PARSE() 0
7178+
#define CAN_GET_SIZE(data) 0
7179+
#define CAN_WRITE(data, output) 0
7180+
#define CAN_PARSE(ssl, input, length, isRequest) 0
71807181

71817182
#endif
71827183

@@ -14762,9 +14763,9 @@ static word16 TLSX_GetMinSize_Client(word16* type)
1476214763
return 0;
1476314764
}
1476414765
}
14765-
#define TLSX_GET_MIN_SIZE_CLIENT TLSX_GetMinSize_Client
14766+
#define TLSX_GET_MIN_SIZE_CLIENT(type) TLSX_GetMinSize_Client(type)
1476614767
#else
14767-
#define TLSX_GET_MIN_SIZE_CLIENT() 0
14768+
#define TLSX_GET_MIN_SIZE_CLIENT(type) 0
1476814769
#endif
1476914770

1477014771

@@ -14831,9 +14832,9 @@ static word16 TLSX_GetMinSize_Server(const word16 *type)
1483114832
return 0;
1483214833
}
1483314834
}
14834-
#define TLSX_GET_MIN_SIZE_SERVER TLSX_GetMinSize_Server
14835+
#define TLSX_GET_MIN_SIZE_SERVER(type) TLSX_GetMinSize_Server(type)
1483514836
#else
14836-
#define TLSX_GET_MIN_SIZE_SERVER() 0
14837+
#define TLSX_GET_MIN_SIZE_SERVER(type) 0
1483714838
#endif
1483814839

1483914840

wolfssl/wolfcrypt/logging.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix);
178178
WOLFSSL_API void WOLFSSL_MSG_EX(const char* fmt, ...);
179179
#define HAVE_WOLFSSL_MSG_EX
180180
#else
181-
#define WOLFSSL_MSG_EX() WC_DO_NOTHING
181+
#ifdef __WATCOMC__ /* does not allow variadic macros */
182+
#define WOLFSSL_MSG_EX() WC_DO_NOTHING
183+
#else
184+
#define WOLFSSL_MSG_EX(...) WC_DO_NOTHING
185+
#endif
182186
#endif
183187
WOLFSSL_API void WOLFSSL_MSG(const char* msg);
184188
#ifdef WOLFSSL_DEBUG_CODEPOINTS
@@ -209,7 +213,11 @@ WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix);
209213
#define WOLFSSL_STUB(m) WC_DO_NOTHING
210214
#define WOLFSSL_IS_DEBUG_ON() 0
211215

212-
#define WOLFSSL_MSG_EX(...) WC_DO_NOTHING
216+
#ifdef __WATCOMC__ /* does not allow variadic macros */
217+
#define WOLFSSL_MSG_EX() WC_DO_NOTHING
218+
#else
219+
#define WOLFSSL_MSG_EX(...) WC_DO_NOTHING
220+
#endif
213221
#define WOLFSSL_MSG(m) WC_DO_NOTHING
214222
#define WOLFSSL_BUFFER(b, l) WC_DO_NOTHING
215223

0 commit comments

Comments
 (0)