From 73a0afaba17f071e48c111a00ecc7468980c6379 Mon Sep 17 00:00:00 2001 From: Chris Conlon Date: Fri, 18 Oct 2019 14:32:33 -0600 Subject: [PATCH] fix compiler warnings with IAR-EWARM 7.50.2 --- src/internal.c | 12 +++++++----- src/ssh.c | 2 ++ src/wolfsftp.c | 21 +-------------------- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/internal.c b/src/internal.c index b826c51..2af9494 100644 --- a/src/internal.c +++ b/src/internal.c @@ -593,11 +593,14 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx, const byte* in, word32 inSz, int format, int type) { - int dynamicType; - void* heap; + int dynamicType = 0; + void* heap = NULL; byte* der; word32 derSz; + (void)dynamicType; + (void)heap; + if (ctx == NULL || in == NULL || inSz == 0) return WS_BAD_ARGUMENT; @@ -3098,7 +3101,7 @@ static int DoUnimplemented(WOLFSSH* ssh, static int DoDisconnect(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) { word32 reason; - const char* reasonStr; + const char* reasonStr = NULL; word32 begin = *idx; (void)ssh; @@ -3404,7 +3407,7 @@ static int DoUserAuthRequestRsa(WOLFSSH* ssh, WS_UserAuthData_PublicKey* pk, encDigestSz); sizeCompare = encDigestSz != (word32)checkDigestSz; - if ((compare | sizeCompare) == 0) + if ((compare == 0) && (sizeCompare == 0)) ret = WS_SUCCESS; else ret = WS_RSA_E; @@ -5197,7 +5200,6 @@ int DoReceive(WOLFSSH* ssh) return WS_SUCCESS; } - return WS_FATAL_ERROR; } diff --git a/src/ssh.c b/src/ssh.c index a8f81f9..ecdcb75 100644 --- a/src/ssh.c +++ b/src/ssh.c @@ -104,6 +104,8 @@ WOLFSSH* wolfSSH_new(WOLFSSH_CTX* ctx) WOLFSSH* ssh; void* heap = NULL; + (void)heap; + WLOG(WS_LOG_DEBUG, "Entering wolfSSH_new()"); if (ctx) diff --git a/src/wolfsftp.c b/src/wolfsftp.c index 93ec11b..e4d7dd1 100644 --- a/src/wolfsftp.c +++ b/src/wolfsftp.c @@ -5211,8 +5211,6 @@ static int wolfSSH_SFTP_GetHandle(WOLFSSH* ssh, byte* handle, word32* handleSz) return WS_INPUT_CASE_E; } } - - return WS_SUCCESS; } @@ -5226,7 +5224,6 @@ WS_SFTPNAME* wolfSSH_SFTP_LS(WOLFSSH* ssh, char* dir) { struct WS_SFTP_LS_STATE* state = NULL; WS_SFTPNAME* name = NULL; - int ret; if (ssh == NULL || dir == NULL) { WLOG(WS_LOG_SFTP, "Bad argument passed in"); @@ -5305,7 +5302,7 @@ WS_SFTPNAME* wolfSSH_SFTP_LS(WOLFSSH* ssh, char* dir) case STATE_LS_CLOSE: /* close dir when finished */ - if ((ret = wolfSSH_SFTP_Close(ssh, state->handle, state->sz)) + if (wolfSSH_SFTP_Close(ssh, state->handle, state->sz) != WS_SUCCESS) { WLOG(WS_LOG_SFTP, "Error closing handle"); if (ssh->error != WS_WANT_READ && ssh->error != WS_WANT_WRITE) { @@ -5544,8 +5541,6 @@ static int SFTP_STAT(WOLFSSH* ssh, char* dir, WS_SFTP_FILEATRB* atr, byte type) return WS_INPUT_CASE_E; } } - - return WS_SUCCESS; } @@ -5836,8 +5831,6 @@ int wolfSSH_SFTP_Open(WOLFSSH* ssh, char* dir, word32 reason, return WS_INPUT_CASE_E; } } - - return WS_SUCCESS; } @@ -6047,8 +6040,6 @@ int wolfSSH_SFTP_SendWritePacket(WOLFSSH* ssh, byte* handle, word32 handleSz, return WS_FATAL_ERROR; } } - - return WS_SUCCESS; } @@ -6279,8 +6270,6 @@ int wolfSSH_SFTP_SendReadPacket(WOLFSSH* ssh, byte* handle, word32 handleSz, return WS_FATAL_ERROR; } } - - return WS_SUCCESS; } @@ -6589,8 +6578,6 @@ int wolfSSH_SFTP_Close(WOLFSSH* ssh, byte* handle, word32 handleSz) return WS_INPUT_CASE_E; } } - - return WS_SUCCESS; } @@ -6856,8 +6843,6 @@ int wolfSSH_SFTP_Rename(WOLFSSH* ssh, const char* old, const char* nw) return WS_FATAL_ERROR; } } - - return WS_SUCCESS; } @@ -7414,8 +7399,6 @@ int wolfSSH_SFTP_Get(WOLFSSH* ssh, char* from, return WS_INPUT_CASE_E; } } - - return WS_SUCCESS; } @@ -7613,8 +7596,6 @@ int wolfSSH_SFTP_Put(WOLFSSH* ssh, char* from, char* to, byte resume, return WS_INPUT_CASE_E; } } - - return ret; }