summaryrefslogtreecommitdiff
path: root/src/modules/netlib/netlibpktrecver.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-07-12 15:42:51 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-07-12 15:42:51 +0000
commitc1d0bec52e19d51117b05d3f7d80a366df657817 (patch)
tree105a7086ad9fe99af8ff8e5859f67a11b3b5370a /src/modules/netlib/netlibpktrecver.cpp
parent01ab72c6afb99b7403eb577a44f35b09eda594f7 (diff)
minor code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@9774 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib/netlibpktrecver.cpp')
-rw-r--r--src/modules/netlib/netlibpktrecver.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/modules/netlib/netlibpktrecver.cpp b/src/modules/netlib/netlibpktrecver.cpp
index 9ba78d299a..b8abc81144 100644
--- a/src/modules/netlib/netlibpktrecver.cpp
+++ b/src/modules/netlib/netlibpktrecver.cpp
@@ -53,9 +53,8 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam)
{
struct NetlibPacketRecver *nlpr = (struct NetlibPacketRecver*)wParam;
NETLIBPACKETRECVER *nlprParam = (NETLIBPACKETRECVER*)lParam;
- INT_PTR recvResult;
- if (GetNetlibHandleType(nlpr) != NLH_PACKETRECVER || nlprParam == NULL || nlprParam->cbSize != sizeof(NETLIBPACKETRECVER) || nlprParam->bytesUsed>nlpr->packetRecver.bytesAvailable) {
+ if (GetNetlibHandleType(nlpr) != NLH_PACKETRECVER || nlprParam == NULL || nlprParam->cbSize != sizeof(NETLIBPACKETRECVER) || nlprParam->bytesUsed > nlpr->packetRecver.bytesAvailable) {
SetLastError(ERROR_INVALID_PARAMETER);
return SOCKET_ERROR;
}
@@ -71,17 +70,20 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam)
}
}
else {
- MoveMemory(nlpr->packetRecver.buffer, nlpr->packetRecver.buffer+nlprParam->bytesUsed, nlpr->packetRecver.bytesAvailable-nlprParam->bytesUsed);
- nlpr->packetRecver.bytesAvailable-=nlprParam->bytesUsed;
+ MoveMemory(nlpr->packetRecver.buffer, nlpr->packetRecver.buffer + nlprParam->bytesUsed, nlpr->packetRecver.bytesAvailable - nlprParam->bytesUsed);
+ nlpr->packetRecver.bytesAvailable -= nlprParam->bytesUsed;
}
+
if (nlprParam->dwTimeout != INFINITE) {
if (!si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s, nlprParam->dwTimeout) <= 0) {
*nlprParam = nlpr->packetRecver;
return SOCKET_ERROR;
}
}
- recvResult = NLRecv(nlpr->nlc, (char*)nlpr->packetRecver.buffer+nlpr->packetRecver.bytesAvailable, nlpr->packetRecver.bufferSize-nlpr->packetRecver.bytesAvailable, 0);
- if (recvResult>0) nlpr->packetRecver.bytesAvailable+=recvResult;
+
+ INT_PTR recvResult = NLRecv(nlpr->nlc, (char*)nlpr->packetRecver.buffer + nlpr->packetRecver.bytesAvailable, nlpr->packetRecver.bufferSize - nlpr->packetRecver.bytesAvailable, 0);
+ if (recvResult > 0)
+ nlpr->packetRecver.bytesAvailable += recvResult;
*nlprParam = nlpr->packetRecver;
return recvResult;
}