diff options
-rw-r--r-- | src/mir_app/src/netlib_websocket.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/mir_app/src/netlib_websocket.cpp b/src/mir_app/src/netlib_websocket.cpp index ab676b7a6a..9117980074 100644 --- a/src/mir_app/src/netlib_websocket.cpp +++ b/src/mir_app/src/netlib_websocket.cpp @@ -107,21 +107,21 @@ MIR_APP_DLL(bool) WebSocket_InitHeader(WSHeader &hdr, const void *pData, size_t /////////////////////////////////////////////////////////////////////////////////////////
-static void WebSocket_Send(HNETLIBCONN nlc, const void *pData, size_t dataLen, uint8_t opCode)
+static void WebSocket_Send(HNETLIBCONN nlc, const void *pData, int64_t dataLen, uint8_t opCode)
{
uint8_t header[20];
- size_t datalen;
+ size_t cbLen;
header[0] = 0x80 + (opCode & 0x7F);
if (dataLen < 126) {
header[1] = (dataLen & 0xFF);
- datalen = 2;
+ cbLen = 2;
}
else if (dataLen < 65536) {
header[1] = 0x7E;
header[2] = (dataLen >> 8) & 0xFF;
header[3] = dataLen & 0xFF;
- datalen = 4;
+ cbLen = 4;
}
else {
header[1] = 0x7F;
@@ -133,7 +133,7 @@ static void WebSocket_Send(HNETLIBCONN nlc, const void *pData, size_t dataLen, u header[7] = (dataLen >> 16) & 0xff;
header[8] = (dataLen >> 8) & 0xff;
header[9] = dataLen & 0xff;
- datalen = 10;
+ cbLen = 10;
}
union {
@@ -142,18 +142,18 @@ static void WebSocket_Send(HNETLIBCONN nlc, const void *pData, size_t dataLen, u };
dwMask = crc32(rand(), (uint8_t*)pData, (unsigned)dataLen);
- memcpy(header + datalen, arMask, _countof(arMask));
- datalen += _countof(arMask);
+ memcpy(header + cbLen, arMask, _countof(arMask));
+ cbLen += _countof(arMask);
header[1] |= 0x80;
- ptrA sendBuf((char*)mir_alloc(dataLen + datalen));
- memcpy(sendBuf, header, datalen);
+ ptrA sendBuf((char*)mir_alloc(dataLen + cbLen));
+ memcpy(sendBuf, header, cbLen);
if (dataLen) {
- memcpy(sendBuf.get() + datalen, pData, dataLen);
+ memcpy(sendBuf.get() + cbLen, pData, dataLen);
for (size_t i = 0; i < dataLen; i++)
- sendBuf[i + datalen] ^= arMask[i & 3];
+ sendBuf[i + cbLen] ^= arMask[i & 3];
}
- Netlib_Send(nlc, sendBuf, int(dataLen + datalen), MSG_NODUMP);
+ Netlib_Send(nlc, sendBuf, int(dataLen + cbLen), MSG_NODUMP);
}
MIR_APP_DLL(void) WebSocket_SendText(HNETLIBCONN nlc, const char *pData)
|