Skip to content

Commit 33e31ed

Browse files
Merge pull request #6675 from douzzer/20230805-clang-18-tidy-fixes
20230805-clang-18-tidy-fixes
2 parents c9b72d7 + e51ca79 commit 33e31ed

6 files changed

Lines changed: 26 additions & 9 deletions

File tree

examples/server/server.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3759,8 +3759,12 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
37593759
resumeCount = 0;
37603760

37613761
cnt++;
3762-
if (loops > 0 && --loops == 0) {
3763-
break; /* out of while loop, done with normal and resume option */
3762+
if (loops > 0) {
3763+
if (--loops == 0) {
3764+
break; /* out of while loop, done with normal and resume
3765+
* option
3766+
*/
3767+
}
37643768
}
37653769
} /* while(1) */
37663770

src/internal.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11853,8 +11853,11 @@ int MatchDomainName(const char* pattern, int len, const char* str)
1185311853
if (p == '*') {
1185411854
char s;
1185511855

11856-
while (--len > 0 &&
11857-
(p = (char)XTOLOWER((unsigned char)*pattern++)) == '*') {
11856+
while (--len > 0) {
11857+
p = (char)XTOLOWER((unsigned char)*pattern);
11858+
pattern++;
11859+
if (p != '*')
11860+
break;
1185811861
}
1185911862

1186011863
if (len == 0)

src/x509.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,9 @@ WOLFSSL_X509_EXTENSION* wolfSSL_X509_set_ext(WOLFSSL_X509* x509, int loc)
11921192

11931193
/* Get extension data and copy as ASN1_STRING */
11941194
tmpIdx = idx + length;
1195-
if ((tmpIdx >= (word32)sz) || (input[tmpIdx++] != ASN_OCTET_STRING)) {
1195+
if ((tmpIdx >= (word32)sz) ||
1196+
(input[tmpIdx] != ASN_OCTET_STRING))
1197+
{
11961198
WOLFSSL_MSG("Error decoding unknown extension data");
11971199
wolfSSL_ASN1_OBJECT_free(ext->obj);
11981200
wolfSSL_X509_EXTENSION_free(ext);
@@ -1203,6 +1205,8 @@ WOLFSSL_X509_EXTENSION* wolfSSL_X509_set_ext(WOLFSSL_X509* x509, int loc)
12031205
return NULL;
12041206
}
12051207

1208+
tmpIdx++;
1209+
12061210
if (GetLength(input, &tmpIdx, &length, sz) <= 0) {
12071211
WOLFSSL_MSG("Error: Invalid Input Length.");
12081212
wolfSSL_ASN1_OBJECT_free(ext->obj);

wolfcrypt/src/asn.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17218,9 +17218,11 @@ static int MatchBaseName(int type, const char* name, int nameSz,
1721817218
}
1721917219

1722017220
while (nameSz > 0) {
17221-
if (XTOLOWER((unsigned char)*name++) !=
17222-
XTOLOWER((unsigned char)*base++))
17221+
if (XTOLOWER((unsigned char)*name) !=
17222+
XTOLOWER((unsigned char)*base))
1722317223
return 0;
17224+
name++;
17225+
base++;
1722417226
nameSz--;
1722517227
}
1722617228

wolfcrypt/src/wc_port.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3593,6 +3593,7 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
35933593
/* TODO: maybe have to use tx_thread_delete? */
35943594
free(thread.threadStack);
35953595
thread.threadStack = NULL;
3596+
return 0;
35963597
}
35973598

35983599
#elif defined(WOLFSSL_ZEPHYR)
@@ -3680,7 +3681,7 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
36803681
XMEMSET(&thread, 0, sizeof(thread));
36813682
ret = wolfSSL_NewThread(&thread, cb, arg);
36823683
if (ret == 0)
3683-
pthread_detach(thread);
3684+
ret = pthread_detach(thread);
36843685
return ret;
36853686
}
36863687
#endif

wolfssl/test.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,8 @@ static WC_INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
22152215
if (bind(*sockfd, (const struct sockaddr*)&addr, sizeof(addr)) != 0)
22162216
err_sys_with_errno("tcp bind failed");
22172217

2218-
#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_TIRTOS)
2218+
#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_TIRTOS) && \
2219+
!defined(SINGLE_THREADED)
22192220
if (port == 0) {
22202221
socklen_t len = sizeof(addr);
22212222
if (getsockname(*sockfd, (struct sockaddr*)&addr, &len) == 0) {
@@ -2226,6 +2227,8 @@ static WC_INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
22262227
#endif
22272228
}
22282229
}
2230+
#else
2231+
(void)port;
22292232
#endif
22302233

22312234
if (args != NULL && args->signal != NULL) {

0 commit comments

Comments
 (0)