diff --git a/src/agent.c b/src/agent.c index 93092dcb..3481ae41 100644 --- a/src/agent.c +++ b/src/agent.c @@ -789,8 +789,8 @@ static int PostSignRequest(WOLFSSH_AGENT_CTX* agent, WLOG_ENTER(); - (void)flags; - (void)curveId; + WOLFSSH_UNUSED(flags); + WOLFSSH_UNUSED(curveId); if (agent == NULL || keyBlob == NULL || keyBlobSz == 0) ret = WS_BAD_ARGUMENT; @@ -860,7 +860,7 @@ static int PostSignRequest(WOLFSSH_AGENT_CTX* agent, ret = SignHashRsa(&id->key.rsa, hashType, digest, digestSz, sig, &sigSz, &agent->rng, agent->heap); #else - (void)signRsa; + WOLFSSH_UNUSED(signRsa); #endif #if !defined(WOLFSSH_NO_ECDSA_SHA2_NISTP256) || \ !defined(WOLFSSH_NO_ECDSA_SHA2_NISTP384) || \ @@ -869,7 +869,7 @@ static int PostSignRequest(WOLFSSH_AGENT_CTX* agent, ret = SignHashEcc(&id->key.ecdsa, curveId, digest, digestSz, sig, &sigSz, &agent->rng); #else - (void)signEcc; + WOLFSSH_UNUSED(signEcc); #endif if (ret == WS_SUCCESS) @@ -887,8 +887,8 @@ static int DoFailure(WOLFSSH_AGENT_CTX* agent, int ret = WS_SUCCESS; WLOG(WS_LOG_AGENT, "Entering DoFailure()"); - (void)buf; - (void)idx; + WOLFSSH_UNUSED(buf); + WOLFSSH_UNUSED(idx); if (len != 0) ret = WS_PARSE_E; @@ -907,8 +907,8 @@ static int DoSuccess(WOLFSSH_AGENT_CTX* agent, int ret = WS_SUCCESS; WLOG_ENTER(); - (void)buf; - (void)idx; + WOLFSSH_UNUSED(buf); + WOLFSSH_UNUSED(idx); if (len != 0) ret = WS_PARSE_E; @@ -927,8 +927,8 @@ static int DoRequestIdentities(WOLFSSH_AGENT_CTX* agent, int ret = WS_SUCCESS; WLOG_ENTER(); - (void)buf; - (void)idx; + WOLFSSH_UNUSED(buf); + WOLFSSH_UNUSED(idx); if (len != 0) ret = WS_PARSE_E; @@ -946,10 +946,10 @@ static int DoIdentitiesAnswer(WOLFSSH_AGENT_CTX* agent, { int ret = WS_SUCCESS; WLOG(WS_LOG_AGENT, "Entering DoIdentitiesAnswer()"); - (void)agent; - (void)buf; - (void)len; - (void)idx; + WOLFSSH_UNUSED(agent); + WOLFSSH_UNUSED(buf); + WOLFSSH_UNUSED(len); + WOLFSSH_UNUSED(idx); DUMP(buf + *idx, len); WLOG(WS_LOG_AGENT, "Leaving DoIdentitiesAnswer(), ret = %d", ret); return ret; @@ -1085,7 +1085,7 @@ static int DoAddIdentity(WOLFSSH_AGENT_CTX* agent, ret = GetStringRef(&commentSz, &scratch, buf, len, &begin); if (ret == WS_SUCCESS) { - (void)scratch; + WOLFSSH_UNUSED(scratch); keySz = nSz + eSz + dSz + iqmpSz + pSz + qSz + commentSz + (LENGTH_SZ * 7); @@ -1298,7 +1298,7 @@ static int DoUnimplemented(WOLFSSH_AGENT_CTX* agent, if (agent == NULL || idx == NULL) ret = WS_BAD_ARGUMENT; - (void)buf; + WOLFSSH_UNUSED(buf); DUMP(buf + *idx, len); /* Just skip the message. */ @@ -1545,7 +1545,7 @@ WOLFSSH_AGENT_ID* wolfSSH_AGENT_ID_new(byte keyType, word32 keySz, void* heap) void wolfSSH_AGENT_ID_free(WOLFSSH_AGENT_ID* id, void* heap) { WLOG(WS_LOG_AGENT, "Entering wolfSSH_AGENT_ID_free()"); - (void)heap; + WOLFSSH_UNUSED(heap); if (id != NULL) { if (id->keyBuffer != NULL) { diff --git a/src/certman.c b/src/certman.c index 19ae584a..f2b76265 100644 --- a/src/certman.c +++ b/src/certman.c @@ -121,7 +121,7 @@ static WOLFSSH_CERTMAN* _CertMan_init(WOLFSSH_CERTMAN* cm, void* heap) static void _CertMan_ResourceFree(WOLFSSH_CERTMAN* cm, void* heap) { - (void)heap; + WOLFSSH_UNUSED(heap); WLOG_ENTER(); if (cm != NULL) { diff --git a/src/internal.c b/src/internal.c index 816be83d..84be2dbe 100644 --- a/src/internal.c +++ b/src/internal.c @@ -144,9 +144,8 @@ static const char OpenSSH[] = "SSH-2.0-OpenSSH"; const char* GetErrorString(int err) { - (void)err; - #ifdef NO_WOLFSSH_STRINGS + WOLFSSH_UNUSED(err); return "No wolfSSH strings available"; #else switch (err) { @@ -422,7 +421,7 @@ static int wsHighwater(byte dir, void* ctx) { int ret = WS_SUCCESS; - (void)dir; + WOLFSSH_UNUSED(dir); if (ctx) { WOLFSSH* ssh = (WOLFSSH*)ctx; @@ -506,7 +505,7 @@ static HandshakeInfo* HandshakeInfoNew(void* heap) static void HandshakeInfoFree(HandshakeInfo* hs, void* heap) { - (void)heap; + WOLFSSH_UNUSED(heap); WLOG(WS_LOG_DEBUG, "Entering HandshakeInfoFree()"); if (hs) { @@ -651,7 +650,7 @@ static void UpdateKeyID(WOLFSSH_CTX* ctx) } } #endif - (void)ctx; + WOLFSSH_UNUSED(ctx); } @@ -763,7 +762,7 @@ WOLFSSH* SshInit(WOLFSSH* ssh, WOLFSSH_CTX* ctx) void SshResourceFree(WOLFSSH* ssh, void* heap) { /* when ssh holds resources, free here */ - (void)heap; + WOLFSSH_UNUSED(heap); WLOG(WS_LOG_DEBUG, "Entering sshResourceFree()"); @@ -1012,7 +1011,7 @@ static int SetHostPrivateKey(WOLFSSH_CTX* ctx, byte keyId, int isKey, word32 destIdx = 0; int ret = WS_SUCCESS; - (void)dynamicType; + WOLFSSH_UNUSED(dynamicType); while (destIdx < ctx->privateKeyCount && ctx->privateKeyId[destIdx] != keyId) { @@ -1161,9 +1160,9 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx, } #endif /* WOLFSSH_CERTS */ - (void)dynamicType; - (void)wcType; - (void)heap; + WOLFSSH_UNUSED(dynamicType); + WOLFSSH_UNUSED(wcType); + WOLFSSH_UNUSED(heap); return ret; } @@ -1576,7 +1575,7 @@ WOLFSSH_CHANNEL* ChannelNew(WOLFSSH* ssh, byte channelType, void ChannelDelete(WOLFSSH_CHANNEL* channel, void* heap) { - (void)heap; + WOLFSSH_UNUSED(heap); if (channel) { #ifdef WOLFSSH_FWD @@ -3355,10 +3354,10 @@ static int ParseRSAPubKey(WOLFSSH *ssh, else ret = WS_RSA_E; #else - (void)ssh; - (void)sigKeyBlock_ptr; - (void)pubKey; - (void)pubKeySz; + WOLFSSH_UNUSED(ssh); + WOLFSSH_UNUSED(sigKeyBlock_ptr); + WOLFSSH_UNUSED(pubKey); + WOLFSSH_UNUSED(pubKeySz); ret = WS_INVALID_ALGO_ID; #endif return ret; @@ -3415,10 +3414,10 @@ static int ParseECCPubKey(WOLFSSH *ssh, ret = WS_ECC_E; } #else - (void)ssh; - (void)sigKeyBlock_ptr; - (void)pubKey; - (void)pubKeySz; + WOLFSSH_UNUSED(ssh); + WOLFSSH_UNUSED(sigKeyBlock_ptr); + WOLFSSH_UNUSED(pubKey); + WOLFSSH_UNUSED(pubKeySz); ret = WS_INVALID_ALGO_ID; #endif return ret; @@ -3577,10 +3576,10 @@ static int ParseECCPubKeyCert(WOLFSSH *ssh, WFREE(der, NULL, 0); } #else - (void)ssh; - (void)sigKeyBlock_ptr; - (void)pubKey; - (void)pubKeySz; + WOLFSSH_UNUSED(ssh); + WOLFSSH_UNUSED(sigKeyBlock_ptr); + WOLFSSH_UNUSED(pubKey); + WOLFSSH_UNUSED(pubKeySz); ret = WS_INVALID_ALGO_ID; #endif @@ -3612,10 +3611,10 @@ static int ParseRSAPubKeyCert(WOLFSSH *ssh, WFREE(der, NULL, 0); } #else - (void)ssh; - (void)sigKeyBlock_ptr; - (void)pubKey; - (void)pubKeySz; + WOLFSSH_UNUSED(ssh); + WOLFSSH_UNUSED(sigKeyBlock_ptr); + WOLFSSH_UNUSED(pubKey); + WOLFSSH_UNUSED(pubKeySz); ret = WS_INVALID_ALGO_ID; #endif @@ -4197,9 +4196,9 @@ static int DoNewKeys(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) { int ret = WS_SUCCESS; - (void)buf; - (void)len; - (void)idx; + WOLFSSH_UNUSED(buf); + WOLFSSH_UNUSED(len); + WOLFSSH_UNUSED(idx); if (ssh == NULL || ssh->handshake == NULL) ret = WS_BAD_ARGUMENT; @@ -4375,8 +4374,8 @@ static int DoIgnore(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) word32 dataSz; word32 begin = *idx; - (void)ssh; - (void)len; + WOLFSSH_UNUSED(ssh); + WOLFSSH_UNUSED(len); ato32(buf + begin, &dataSz); begin += LENGTH_SZ + dataSz; @@ -4392,8 +4391,8 @@ static int DoRequestSuccess(WOLFSSH *ssh, byte *buf, word32 len, word32 *idx) word32 begin = *idx; int ret=WS_SUCCESS; - (void)ssh; - (void)len; + WOLFSSH_UNUSED(ssh); + WOLFSSH_UNUSED(len); WLOG(WS_LOG_DEBUG, "DoRequestSuccess, *idx=%d, len=%d", *idx, len); ato32(buf + begin, &dataSz); @@ -4413,8 +4412,8 @@ static int DoRequestFailure(WOLFSSH *ssh, byte *buf, word32 len, word32 *idx) word32 begin = *idx; int ret = WS_SUCCESS; - (void)ssh; - (void)len; + WOLFSSH_UNUSED(ssh); + WOLFSSH_UNUSED(len); WLOG(WS_LOG_DEBUG, "DoRequestFalure, *idx=%d, len=%d", *idx, len); ato32(buf + begin, &dataSz); @@ -4509,8 +4508,8 @@ static int DoUnimplemented(WOLFSSH* ssh, word32 seq; word32 begin = *idx; - (void)ssh; - (void)len; + WOLFSSH_UNUSED(ssh); + WOLFSSH_UNUSED(len); ato32(buf + begin, &seq); begin += UINT32_SZ; @@ -4529,9 +4528,9 @@ static int DoDisconnect(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) const char* reasonStr = NULL; word32 begin = *idx; - (void)ssh; - (void)len; - (void)reasonStr; + WOLFSSH_UNUSED(ssh); + WOLFSSH_UNUSED(len); + WOLFSSH_UNUSED(reasonStr); ato32(buf + begin, &reason); begin += UINT32_SZ; @@ -4589,7 +4588,7 @@ static int DoServiceRequest(WOLFSSH* ssh, word32 nameSz; char serviceName[WOLFSSH_MAX_NAMESZ]; - (void)len; + WOLFSSH_UNUSED(len); ato32(buf + begin, &nameSz); begin += LENGTH_SZ; @@ -4618,7 +4617,7 @@ static int DoServiceAccept(WOLFSSH* ssh, word32 nameSz; char serviceName[WOLFSSH_MAX_NAMESZ]; - (void)len; + WOLFSSH_UNUSED(len); ato32(buf + begin, &nameSz); begin += LENGTH_SZ; @@ -4648,7 +4647,7 @@ static int DoUserAuthRequestNone(WOLFSSH* ssh, WS_UserAuthData* authData, int ret = WS_SUCCESS; WLOG(WS_LOG_DEBUG, "Entering DoUserAuthRequestNone()"); - (void)len; + WOLFSSH_UNUSED(len); if (ssh == NULL || authData == NULL || buf == NULL || idx == NULL) { @@ -5056,7 +5055,7 @@ static int DoUserAuthRequestRsaCert(WOLFSSH* ssh, WS_UserAuthData_PublicKey* pk, if (ret == WS_SUCCESS) { publicKeyType = pk->signature + i; i += publicKeyTypeSz; - (void)publicKeyType; + WOLFSSH_UNUSED(publicKeyType); } if (ret == WS_SUCCESS) @@ -5194,7 +5193,8 @@ static int DoUserAuthRequestEcc(WOLFSSH* ssh, WS_UserAuthData_PublicKey* pk, if (ret == WS_SUCCESS) { curveName = pk->publicKey + i; - (void)curveName; /* Not used at the moment, hush the compiler. */ + WOLFSSH_UNUSED(curveName); + /* Not used at the moment, hush the compiler. */ i += curveNameSz; ret = GetSize(&qSz, pk->publicKey, pk->publicKeySz, &i); } @@ -5380,7 +5380,7 @@ static int DoUserAuthRequestEccCert(WOLFSSH* ssh, WS_UserAuthData_PublicKey* pk, if (ret == WS_SUCCESS) { publicKeyType = pk->signature + i; i += publicKeyTypeSz; - (void)publicKeyType; + WOLFSSH_UNUSED(publicKeyType); } if (ret == WS_SUCCESS) { @@ -8108,8 +8108,8 @@ static int BuildRFC6187Info(WOLFSSH* ssh, int pubKeyID, localIdx += UINT32_SZ; /* here is where OCSP's would be appended [ocsp size][ocsp] */ - (void)ocsp; - (void)ocspSz; + WOLFSSH_UNUSED(ocsp); + WOLFSSH_UNUSED(ocspSz); /* update idx on success */ if (output) { @@ -8120,8 +8120,8 @@ static int BuildRFC6187Info(WOLFSSH* ssh, int pubKeyID, ret = LENGTH_ONLY_E; } - (void)ssh; - (void)outputSz; + WOLFSSH_UNUSED(ssh); + WOLFSSH_UNUSED(outputSz); return ret; } #endif /* WOLFSSH_CERTS */ @@ -11022,7 +11022,7 @@ int SendUserAuthRequest(WOLFSSH* ssh, byte authId, int addSig) WS_UserAuthData authData; WS_KeySignature *keySig_ptr = NULL; - (void)addSig; + WOLFSSH_UNUSED(addSig); WLOG(WS_LOG_DEBUG, "Entering SendUserAuthRequest()"); @@ -11134,8 +11134,8 @@ int SendUserAuthRequest(WOLFSSH* ssh, byte authId, int addSig) idx += authNameSz; if (authId == ID_USERAUTH_PASSWORD) { - (void)sigStart; - (void)sigStartIdx; + WOLFSSH_UNUSED(sigStart); + WOLFSSH_UNUSED(sigStartIdx); ret = BuildUserAuthRequestPassword(ssh, output, &idx, &authData); } @@ -12211,7 +12211,7 @@ static int CreateMode(WOLFSSH* ssh, byte* mode) mode[idx++] = WOLFSSH_TTY_OP_ISPEED; c32toa(baud, mode + idx); idx += UINT32_SZ; - (void)ssh; + WOLFSSH_UNUSED(ssh); mode[idx++] = WOLFSSH_TTY_OP_END; return idx; } diff --git a/src/io.c b/src/io.c index 08376808..4663a08a 100644 --- a/src/io.c +++ b/src/io.c @@ -266,7 +266,7 @@ void* wolfSSH_GetIOWriteCtx(WOLFSSH* ssh) /* Translates return codes returned from send() and recv() if need be. */ static INLINE int wsReturnCode(int old, WS_SOCKET_T sd) { - (void)sd; + WOLFSSH_UNUSED(sd); #ifdef FREESCALE_MQX if (old == 0) { diff --git a/src/keygen.c b/src/keygen.c index f14cc2fa..e5724d77 100644 --- a/src/keygen.c +++ b/src/keygen.c @@ -114,10 +114,10 @@ int wolfSSH_MakeRsaKey(byte* out, word32 outSz, word32 size, word32 e) WLOG(WS_LOG_DEBUG, "Leaving wolfSSH_MakeRsaKey(), ret = %d", ret); return ret; #else - (void)out; - (void)outSz; - (void)size; - (void)e; + WOLFSSH_UNUSED(out); + WOLFSSH_UNUSED(outSz); + WOLFSSH_UNUSED(size); + WOLFSSH_UNUSED(e); return WS_NOT_COMPILED; #endif } @@ -179,9 +179,9 @@ int wolfSSH_MakeEcdsaKey(byte* out, word32 outSz, word32 size) WLOG(WS_LOG_DEBUG, "Leaving wolfSSH_MakeEcdsaKey(), ret = %d", ret); return ret; #else - (void)out; - (void)outSz; - (void)size; + WOLFSSH_UNUSED(out); + WOLFSSH_UNUSED(outSz); + WOLFSSH_UNUSED(size); return WS_NOT_COMPILED; #endif } diff --git a/src/log.c b/src/log.c index fff15fd0..b46805a7 100644 --- a/src/log.c +++ b/src/log.c @@ -183,15 +183,15 @@ void wolfSSH_Log(enum wolfSSH_LogLevel level, const char *const fmt, ...) #else void DefaultLoggingCb(enum wolfSSH_LogLevel level, const char *const msgStr) { - (void)level; - (void)msgStr; + WOLFSSH_UNUSED(level); + WOLFSSH_UNUSED(msgStr); } void wolfSSH_Log(enum wolfSSH_LogLevel level, const char *const fmt, ...) { - (void)logFunction; - (void)level; - (void)fmt; + WOLFSSH_UNUSED(logFunction); + WOLFSSH_UNUSED(level); + WOLFSSH_UNUSED(fmt); } #endif /* DEBUG_WOLFSSH */ diff --git a/src/ssh.c b/src/ssh.c index c290be13..8c5e2f34 100644 --- a/src/ssh.c +++ b/src/ssh.c @@ -130,7 +130,7 @@ WOLFSSH* wolfSSH_new(WOLFSSH_CTX* ctx) WOLFSSH* ssh; void* heap = NULL; - (void)heap; + WOLFSSH_UNUSED(heap); WLOG(WS_LOG_DEBUG, "Entering wolfSSH_new()"); @@ -1197,8 +1197,8 @@ int wolfSSH_SendIgnore(WOLFSSH* ssh, const byte* buf, word32 bufSz) { byte scratch[128]; - (void)buf; - (void)bufSz; + WOLFSSH_UNUSED(buf); + WOLFSSH_UNUSED(bufSz); WMEMSET(scratch, 0, sizeof(scratch)); return SendIgnore(ssh, scratch, sizeof(scratch)); @@ -1433,7 +1433,7 @@ int wolfSSH_ReadKey_buffer(const byte* in, word32 inSz, int format, int ret = WS_SUCCESS; byte* newKey = NULL; - (void)heap; + WOLFSSH_UNUSED(heap); if (in == NULL || inSz == 0 || out == NULL || outSz == NULL || outType == NULL || outTypeSz == NULL) diff --git a/src/wolfscp.c b/src/wolfscp.c index e53a07f9..add6abb3 100644 --- a/src/wolfscp.c +++ b/src/wolfscp.c @@ -2040,8 +2040,8 @@ int wsScpRecvCallback(WOLFSSH* ssh, int state, const char* basePath, ret = WS_SCP_ABORT; } - (void)totalFileSz; - (void)fileOffset; + WOLFSSH_UNUSED(totalFileSz); + WOLFSSH_UNUSED(fileOffset); return ret; } @@ -2194,7 +2194,7 @@ int ScpPopDir(ScpSendCtx* ctx, void* heap) if (ctx->currentDir == NULL) return WS_SCP_DIR_STACK_EMPTY_E; - (void)heap; + WOLFSSH_UNUSED(heap); return WS_SUCCESS; } @@ -2369,7 +2369,7 @@ static int ScpProcessEntry(WOLFSSH* ssh, char* fileName, word64* mTime, } } - (void)ctx; + WOLFSSH_UNUSED(ctx); return ret; } @@ -2702,10 +2702,10 @@ int wsScpRecvCallback(WOLFSSH* ssh, int state, const char* basePath, ret = WS_SCP_ABORT; } - (void)totalFileSz; - (void)fileOffset; - (void)aTime; - (void)basePath; + WOLFSSH_UNUSED(totalFileSz); + WOLFSSH_UNUSED(fileOffset); + WOLFSSH_UNUSED(aTime); + WOLFSSH_UNUSED(basePath); return ret; } @@ -2808,7 +2808,7 @@ int wsScpSendCallback(WOLFSSH* ssh, int state, const char* peerRequest, WLOG(WS_LOG_DEBUG, scpState, "bad state"); ret = WS_SCP_ABORT; } - (void)fileOffset; + WOLFSSH_UNUSED(fileOffset); return ret; } diff --git a/src/wolfsftp.c b/src/wolfsftp.c index f81a8d14..f1e0f910 100644 --- a/src/wolfsftp.c +++ b/src/wolfsftp.c @@ -836,7 +836,7 @@ static int SFTP_SetHeader(WOLFSSH* ssh, word32 reqId, byte type, word32 len, buf[LENGTH_SZ] = type; c32toa(reqId, buf + LENGTH_SZ + MSG_ID_SZ); - (void)ssh; + WOLFSSH_UNUSED(ssh); return WS_SUCCESS; } @@ -871,7 +871,7 @@ static int SFTP_AtributesSz(WOLFSSH* ssh, WS_SFTP_FILEATRB* atr) { word32 sz = 0; - (void)ssh; + WOLFSSH_UNUSED(ssh); sz += UINT32_SZ; /* flag */ @@ -915,8 +915,8 @@ static int SFTP_SetAttributes(WOLFSSH* ssh, byte* buf, word32 bufSz, { word32 idx = 0; - (void)ssh; - (void)bufSz; + WOLFSSH_UNUSED(ssh); + WOLFSSH_UNUSED(bufSz); /* get flags */ c32toa(atr->flags, buf); idx += UINT32_SZ; @@ -1788,7 +1788,7 @@ int ff_open(const char *fname, int flag, int perm) { int i; BYTE mode; - (void)perm; + WOLFSSH_UNUSED(perm); PRINTF("\r\nfatFS open: %s", fname); if (flag & WOLFSSH_O_RDONLY) { @@ -1998,7 +1998,7 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz) /* set send out buffer, "out" is taken by ssh */ wolfSSH_SFTP_RecvSetSend(ssh, out, outSz); - (void)ier; + WOLFSSH_UNUSED(ier); return ret; } #else /* USE_WINDOWS_API */ @@ -2123,7 +2123,7 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz) /* set send out buffer, "out" is taken by ssh */ wolfSSH_SFTP_RecvSetSend(ssh, out, outSz); - (void)ier; + WOLFSSH_UNUSED(ier); return ret; } #endif /* USE_WINDOWS_API */ @@ -2194,7 +2194,7 @@ int wolfSSH_SFTP_RecvOpenDir(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz) ret = WS_BAD_FILE_E; } - (void)reqId; + WOLFSSH_UNUSED(reqId); /* add to directory list @TODO locking for thread safety */ if (ret == WS_SUCCESS) { @@ -2347,7 +2347,7 @@ int wolfSSH_SFTP_RecvOpenDir(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz) FindClose(findHandle); } - (void)reqId; + WOLFSSH_UNUSED(reqId); /* add to directory list @TODO locking for thread safety */ if (ret == WS_SUCCESS) { @@ -4075,8 +4075,8 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr, int sz = (int)WSTRLEN(fileName); int ret; - (void)heap; - (void)fs; + WOLFSSH_UNUSED(heap); + WOLFSSH_UNUSED(fs); if (noFollow) { ret = WLSTAT(fileName, &stats); @@ -4215,8 +4215,8 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr, WIN32_FILE_ATTRIBUTE_DATA stats; WLOG(WS_LOG_SFTP, "Entering SFTP_GetAttributes()"); - (void)noFollow; - (void)fs; + WOLFSSH_UNUSED(noFollow); + WOLFSSH_UNUSED(fs); /* @TODO add proper Windows link support */ /* Note, for windows, we treat WSTAT and WLSTAT the same. */ @@ -4496,8 +4496,8 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr, { WSTAT_T stats; - (void)heap; - (void)fs; + WOLFSSH_UNUSED(heap); + WOLFSSH_UNUSED(fs); if (noFollow) { /* Note, for windows, we treat WSTAT and WLSTAT the same. */ @@ -4576,7 +4576,7 @@ int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz, /* @TODO handle attribute extensions */ - (void)ssh; + WOLFSSH_UNUSED(ssh); return WS_SUCCESS; } #endif @@ -4815,7 +4815,7 @@ int wolfSSH_SFTP_RecvLSTAT(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz) /* Set the files mode * return WS_SUCCESS on success */ static int SFTP_SetMode(WOLFSSH* ssh, char* name, word32 mode) { - (void)ssh; + WOLFSSH_UNUSED(ssh); if (WCHMOD(ssh->fs, name, mode) != 0) { return WS_BAD_FILE_E; } @@ -4859,7 +4859,7 @@ static int SFTP_SetFileAttributes(WOLFSSH* ssh, char* name, WS_SFTP_FILEATRB* at /* @TODO handle extensions */ } - (void)ssh; + WOLFSSH_UNUSED(ssh); return ret ; } @@ -5242,7 +5242,7 @@ static int wolfSSH_SFTP_DoStatus(WOLFSSH* ssh, word32 reqId, word32 maxIdx = wolfSSH_SFTP_buffer_size(buffer); byte* buf = wolfSSH_SFTP_buffer_data(buffer); - (void)reqId; + WOLFSSH_UNUSED(reqId); if (localIdx + UINT32_SZ > maxIdx) { return WS_FATAL_ERROR; } @@ -5443,7 +5443,7 @@ int SFTP_ParseAtributes_buffer(WOLFSSH* ssh, WS_SFTP_FILEATRB* atr, byte* buf, } *idx = localIdx; - (void)ssh; + WOLFSSH_UNUSED(ssh); return WS_SUCCESS; } @@ -5783,7 +5783,7 @@ static WS_SFTPNAME* wolfSSH_SFTP_DoName(WOLFSSH* ssh) break; } - (void)maxSz; + WOLFSSH_UNUSED(maxSz); return n; } @@ -6546,7 +6546,7 @@ int wolfSSH_SFTP_Open(WOLFSSH* ssh, char* dir, word32 reason, wolfSSH_SFTP_buffer_c32toa(&state->buffer, reason); /* @TODO handle adding attributes here */ - (void)atr; + WOLFSSH_UNUSED(atr); wolfSSH_SFTP_buffer_c32toa(&state->buffer, 0x00000000); ret = wolfSSH_SFTP_buffer_set_size(&state->buffer, wolfSSH_SFTP_buffer_idx(&state->buffer)); @@ -7143,7 +7143,7 @@ int wolfSSH_SFTP_MKDIR(WOLFSSH* ssh, char* dir, WS_SFTP_FILEATRB* atr) wolfSSH_SFTP_buffer_c32toa(&state->buffer, UINT32_SZ); /* @TODO handle setting attributes */ - (void)atr; + WOLFSSH_UNUSED(atr); wolfSSH_SFTP_buffer_c32toa(&state->buffer, 0x000001FF); ret = wolfSSH_SFTP_buffer_set_size(&state->buffer, @@ -8434,7 +8434,7 @@ int wolfSSH_SFTP_Put(WOLFSSH* ssh, char* from, char* to, byte resume, * return WS_SUCCESS on success */ int wolfSSH_SFTP_free(WOLFSSH* ssh) { - (void)ssh; + WOLFSSH_UNUSED(ssh); #ifdef WOLFSSH_STOREHANDLE { WS_HANDLE_LIST* cur = ssh->handleList; diff --git a/wolfssh/port.h b/wolfssh/port.h index 56ed2b73..b848bb59 100644 --- a/wolfssh/port.h +++ b/wolfssh/port.h @@ -1264,6 +1264,11 @@ extern "C" { #endif +#ifndef WOLFSSH_UNUSED + #define WOLFSSH_UNUSED(arg) (void)(arg); +#endif + + #if defined(USE_WINDOWS_API) #define WS_SOCKET_T SOCKET #define WS_SOCKLEN_T int