Fix various warnings and an uninitialized XFILE

This commit is contained in:
kaleb-himes 2022-06-03 09:37:17 -06:00
parent 8fbd4d70e6
commit 3bcdef1972
3 changed files with 10 additions and 6 deletions

View File

@ -544,7 +544,8 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
int version, int earlyData) int version, int earlyData)
{ {
/* time passed in number of connects give average */ /* time passed in number of connects give average */
int times = benchmark, skip = times * 0.1; int times = benchmark;
double skip = (double) times * 0.1;
int loops = resumeSession ? 2 : 1; int loops = resumeSession ? 2 : 1;
int i = 0, err, ret; int i = 0, err, ret;
#ifndef NO_SESSION_CACHE #ifndef NO_SESSION_CACHE
@ -569,13 +570,16 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
#ifndef NO_SESSION_CACHE #ifndef NO_SESSION_CACHE
int benchResume = resumeSession && loops == 0; int benchResume = resumeSession && loops == 0;
#endif #endif
double start = current_time(1), avg; double start = current_time(1), avg, check;
for (i = 0; i < times; i++) { for (i = 0; i < times; i++) {
SOCKET_T sockfd; SOCKET_T sockfd;
WOLFSSL* ssl; WOLFSSL* ssl;
if (i == skip) /* cannot compare doubles with == or != instead subtract and if
* result is 0 then they were equal */
check = (double)i - skip;
if (check > -1.0 && check < 1.0)
start = current_time(1); start = current_time(1);
ssl = wolfSSL_new(ctx); ssl = wolfSSL_new(ctx);

View File

@ -335,7 +335,7 @@ static int sockAddrEqual(
if (a->ss_family == AF_INET) { if (a->ss_family == AF_INET) {
if (aLen < sizeof(SOCKADDR_IN)) if (aLen < (XSOCKLENT)sizeof(SOCKADDR_IN))
return 0; return 0;
if (((SOCKADDR_IN*)a)->sin_port != ((SOCKADDR_IN*)b)->sin_port) if (((SOCKADDR_IN*)a)->sin_port != ((SOCKADDR_IN*)b)->sin_port)
@ -352,7 +352,7 @@ static int sockAddrEqual(
if (a->ss_family == AF_INET6) { if (a->ss_family == AF_INET6) {
SOCKADDR_IN6 *a6, *b6; SOCKADDR_IN6 *a6, *b6;
if (aLen < sizeof(SOCKADDR_IN6)) if (aLen < (XSOCKLENT)sizeof(SOCKADDR_IN6))
return 0; return 0;
a6 = (SOCKADDR_IN6*)a; a6 = (SOCKADDR_IN6*)a;

View File

@ -20654,7 +20654,7 @@ int wc_PemPubKeyToDer_ex(const char* fileName, DerBuffer** der)
int dynamic = 0; int dynamic = 0;
int ret = 0; int ret = 0;
long sz = 0; long sz = 0;
XFILE file; XFILE file = NULL;
WOLFSSL_ENTER("wc_PemPubKeyToDer"); WOLFSSL_ENTER("wc_PemPubKeyToDer");