summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/IcqOscarJ/src/fam_01service.cpp2
-rw-r--r--protocols/IcqOscarJ/src/fam_15icqserver.cpp24
-rw-r--r--protocols/IcqOscarJ/src/icq_direct.cpp18
-rw-r--r--protocols/IcqOscarJ/src/icq_http.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_rates.cpp13
-rw-r--r--protocols/IcqOscarJ/src/oscar_filetransfer.cpp4
7 files changed, 31 insertions, 34 deletions
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp
index e756f8c2f0..0e25f56b21 100644
--- a/protocols/IcqOscarJ/src/fam_01service.cpp
+++ b/protocols/IcqOscarJ/src/fam_01service.cpp
@@ -393,7 +393,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_heade
while (wBufferLength > 4) { // loop thru all items
WORD itemType = pBuffer[0] * 0x10 | pBuffer[1];
BYTE itemFlags = pBuffer[2];
- BYTE itemLen = pBuffer[3];
+ size_t itemLen = pBuffer[3];
if (itemType == AVATAR_HASH_PHOTO) { /// TODO: handle photo item
// skip photo item
diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
index 901b126891..c96e527c64 100644
--- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp
+++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
@@ -207,31 +207,27 @@ void CIcqProto::handleExtensionMetaResponse(BYTE *databuf, size_t wPacketLen, WO
// Todo: This overlaps with META_SET_AFFINFO_ACK.
// Todo: Check what happens if result != A
if (wPacketLen > 8) {
- WORD wNetworkNameLen;
- WORD wAckLen;
- char *pszInfo;
-
databuf += 6; // Some unknowns
wPacketLen -= 6;
+ size_t wNetworkNameLen, wAckLen;
unpackWord(&databuf, &wNetworkNameLen);
if (wPacketLen >= (wNetworkNameLen + 2)) {
databuf += wNetworkNameLen;
wPacketLen -= wNetworkNameLen;
unpackWord(&databuf, &wAckLen);
- if (pszInfo = (char *)_alloca(wAckLen + 1)) {
- // Terminate buffer
- if (wAckLen > 0)
- memcpy(pszInfo, databuf, wAckLen);
- pszInfo[wAckLen] = 0;
+ char *pszInfo = (char*)_alloca(wAckLen + 1);
+ // Terminate buffer
+ if (wAckLen > 0)
+ memcpy(pszInfo, databuf, wAckLen);
+ pszInfo[wAckLen] = 0;
- ProtoBroadcastAck(NULL, ICQACKTYPE_SMS, ACKRESULT_SENTREQUEST, (HANDLE)wCookie, (LPARAM)pszInfo);
- FreeCookie(wCookie);
+ ProtoBroadcastAck(NULL, ICQACKTYPE_SMS, ACKRESULT_SENTREQUEST, (HANDLE)wCookie, (LPARAM)pszInfo);
+ FreeCookie(wCookie);
- // Parsing success
- break;
- }
+ // Parsing success
+ break;
}
}
diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp
index bed952d8fe..959b986015 100644
--- a/protocols/IcqOscarJ/src/icq_direct.cpp
+++ b/protocols/IcqOscarJ/src/icq_direct.cpp
@@ -372,13 +372,13 @@ void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi)
if (dc.type == DIRECTCONN_CLOSING)
packetRecv.bytesUsed = packetRecv.bytesAvailable;
- else if (packetRecv.bytesAvailable < nSkipPacketBytes) { // the whole buffer needs to be skipped
+ else if (packetRecv.bytesAvailable < (int)nSkipPacketBytes) { // the whole buffer needs to be skipped
nSkipPacketBytes -= packetRecv.bytesAvailable;
packetRecv.bytesUsed = packetRecv.bytesAvailable;
}
else {
size_t i;
- for (i = nSkipPacketBytes, nSkipPacketBytes = 0; i + 2 <= packetRecv.bytesAvailable;) {
+ for (i = nSkipPacketBytes, nSkipPacketBytes = 0; (int)i + 2 <= packetRecv.bytesAvailable;) {
size_t wLen = *(WORD*)(packetRecv.buffer + i);
if (bFirstPacket) {
@@ -389,16 +389,14 @@ void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi)
}
bFirstPacket = FALSE;
}
- else {
- if (packetRecv.bytesAvailable >= i + 2 && wLen > 8190) { // check for too big packages
- NetLog_Direct("Error: Package too big: %d bytes, skipping.");
- nSkipPacketBytes = wLen;
- packetRecv.bytesUsed = int(i + 2);
- break;
- }
+ else if (packetRecv.bytesAvailable >= (int)i + 2 && wLen > 8190) { // check for too big packages
+ NetLog_Direct("Error: Package too big: %d bytes, skipping.");
+ nSkipPacketBytes = wLen;
+ packetRecv.bytesUsed = int(i + 2);
+ break;
}
- if (wLen + 2 + i > packetRecv.bytesAvailable)
+ if (wLen + 2 + i > (size_t)packetRecv.bytesAvailable)
break;
if (dc.type == DIRECTCONN_STANDARD && wLen && packetRecv.buffer[i + 2] == 2) {
diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp
index 1d0283456a..545d52a7f3 100644
--- a/protocols/IcqOscarJ/src/icq_http.cpp
+++ b/protocols/IcqOscarJ/src/icq_http.cpp
@@ -154,7 +154,7 @@ PBYTE icq_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST* nlhr, PBYTE buf, int len, int
unpackWord(&tbuf, &wLen);
if (wLen < 12)
break;
- if (tbuf - buf + wLen > len)
+ if (tbuf - buf + wLen > (size_t)len)
break;
tbuf += 2; /* version */
unpackWord(&tbuf, &wType);
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp
index 746987b17e..b2965b9888 100644
--- a/protocols/IcqOscarJ/src/icq_proto.cpp
+++ b/protocols/IcqOscarJ/src/icq_proto.cpp
@@ -773,7 +773,7 @@ HANDLE __cdecl CIcqProto::SearchBasic(const PROTOCHAR *pszSearch)
char pszUIN[255];
int nHandle = 0;
- int i, j;
+ size_t i, j;
if (!m_bAimEnabled) {
for (i = j = 0; (i < mir_wstrlen(pszSearch)) && (j < 255); i++) { // we take only numbers
diff --git a/protocols/IcqOscarJ/src/icq_rates.cpp b/protocols/IcqOscarJ/src/icq_rates.cpp
index 5c2f857bbd..5d4c5740cd 100644
--- a/protocols/IcqOscarJ/src/icq_rates.cpp
+++ b/protocols/IcqOscarJ/src/icq_rates.cpp
@@ -76,18 +76,21 @@ rates::rates(CIcqProto *ppro, BYTE *pBuffer, size_t wLen)
// Parse Group associated pairs
for (i = 0; i < wCount; i++) {
rates_group *pGroup = &groups[i];
- WORD wNum;
- if (wLen < 4) break;
+ if (wLen < 4)
+ break;
+
pBuffer += 2; // Group ID
+ WORD wNum;
unpackWord(&pBuffer, &wNum);
wLen -= 4;
- if (wLen < wNum * 4) break;
+ if (wLen < (size_t)wNum * 4)
+ break;
+
pGroup->nPairs = wNum;
pGroup->pPairs = (WORD*)SAFE_MALLOC(wNum * 4);
- for (int n = 0; n < wNum * 2; n++) {
+ for (size_t n = 0; n < (size_t)wNum * 2; n++) {
WORD wItem;
-
unpackWord(&pBuffer, &wItem);
pGroup->pPairs[n] = wItem;
}
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
index ade1819f0b..02a67bb89d 100644
--- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
+++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
@@ -1722,7 +1722,7 @@ void CIcqProto::handleOFT2FramePacket(oscar_connection *oc, WORD datatype, BYTE
ft->szThisFile = ansi_to_utf8(ft->rawFileName);
// convert dir markings to normal backslashes
- for (int i = 0; i < mir_strlen(ft->szThisFile); i++)
+ for (size_t i = 0; i < mir_strlen(ft->szThisFile); i++)
if (ft->szThisFile[i] == 0x01)
ft->szThisFile[i] = '\\';
@@ -2044,7 +2044,7 @@ void CIcqProto::oft_sendPeerInit(oscar_connection *oc)
strcat(pszThisFileName, ExtractFileName(ft->szThisFile));
// convert backslashes to dir markings
- for (int i = 0; i < mir_strlen(pszThisFileName); i++)
+ for (size_t i = 0; i < mir_strlen(pszThisFileName); i++)
if (pszThisFileName[i] == '\\' || pszThisFileName[i] == '/')
pszThisFileName[i] = 0x01;