From 688f55ba998c19304a29727c910504903f4cc49a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Nov 2014 18:51:36 +0000 Subject: lstr* replacements git-svn-id: http://svn.miranda-ng.org/main/trunk@11176 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/src/icq_avatar.cpp | 4 ++-- protocols/IcqOscarJ/src/icq_filerequests.cpp | 13 +++---------- protocols/IcqOscarJ/src/icqosc_svcs.cpp | 4 ++-- 3 files changed, 7 insertions(+), 14 deletions(-) (limited to 'protocols/IcqOscarJ') diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index 048195df0b..1dbc41d834 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -1223,7 +1223,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen PROTO_AVATAR_INFORMATIONT ai = { sizeof(ai) }; ai.format = PA_FORMAT_JPEG; // this is for error only ai.hContact = pCookieData->hContact; - lstrcpyn(ai.filename, pCookieData->szFile, SIZEOF(ai.filename)); + mir_tstrncpy(ai.filename, pCookieData->szFile, SIZEOF(ai.filename)); AddAvatarExt(PA_FORMAT_JPEG, ai.filename); ppro->FreeCookie(pSnacHeader->dwRef); @@ -1280,7 +1280,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen ppro->setByte(pCookieData->hContact, "AvatarType", (BYTE)dwPaFormat); ai.format = dwPaFormat; // set the format - lstrcpyn(ai.filename, tszImageFile, SIZEOF(ai.filename)); + mir_tstrncpy(ai.filename, tszImageFile, SIZEOF(ai.filename)); int out = _topen(tszImageFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE); if (out != -1) { diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp index e66aedc990..b357356640 100644 --- a/protocols/IcqOscarJ/src/icq_filerequests.cpp +++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp @@ -80,12 +80,10 @@ void CIcqProto::handleFileAck(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwCooki unpackString(&buf, pszFileName, wFilenameLength); pszFileName[wFilenameLength] = '\0'; } - wLen = wLen - 2 - wFilenameLength; + wLen -= wFilenameLength+2; - if (wLen >= 4) { // Total filesize + if (wLen >= 4) unpackLEDWord(&buf, &dwFileSize); - wLen -= 4; - } else dwFileSize = 0; @@ -111,7 +109,7 @@ filetransfer* CIcqProto::CreateFileTransfer(MCONTACT hContact, DWORD dwUin, int // pszDescription points to a string with the reason // buf points to the first data after the string -void CIcqProto::handleFileRequest(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwCookie, DWORD dwID1, DWORD dwID2, char* pszDescription, int nVersion, BOOL bDC) +void CIcqProto::handleFileRequest(PBYTE buf, size_t cbLen, DWORD dwUin, DWORD dwCookie, DWORD dwID1, DWORD dwID2, char* pszDescription, int nVersion, BOOL bDC) { BOOL bEmptyDesc = FALSE; if (mir_strlen(pszDescription) == 0) { @@ -121,7 +119,6 @@ void CIcqProto::handleFileRequest(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwC // Empty port+pad buf += 4; - wLen -= 4; // Filename size_t wFilenameLength; @@ -135,12 +132,9 @@ void CIcqProto::handleFileRequest(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwC unpackString(&buf, pszFileName, wFilenameLength); pszFileName[wFilenameLength] = '\0'; - wLen = wLen - 2 - wFilenameLength; - // Total filesize DWORD dwFileSize; unpackLEDWord(&buf, &dwFileSize); - wLen -= 4; int bAdded; MCONTACT hContact = HContactFromUIN(dwUin, &bAdded); @@ -183,7 +177,6 @@ void CIcqProto::handleDirectCancel(directconnect *dc, PBYTE buf, size_t wLen, WO void CIcqProto::icq_CancelFileTransfer(MCONTACT hContact, filetransfer* ft) { DWORD dwCookie; - if (FindCookieByData(ft, &dwCookie, NULL)) FreeCookie(dwCookie); /* this bit stops a send that's waiting for acceptance */ diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index 4e1f00b779..5c91037b7c 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -352,7 +352,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) GetFullAvatarFileName(dwUIN, szUID, dwPaFormat, tszFile, MAX_PATH * 2); - lstrcpyn(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-( + mir_tstrncpy(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-( pai->format = dwPaFormat; if (!IsAvatarChanged(pai->hContact, dbv.pbVal, dbv.cpbVal)) { // hashes are the same @@ -370,7 +370,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) GetAvatarFileName(dwUIN, szUID, tszFile, MAX_PATH * 2); GetAvatarData(pai->hContact, dwUIN, szUID, dbv.pbVal, dbv.cpbVal, tszFile); - lstrcpyn(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-( + mir_tstrncpy(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-( db_free(&dbv); -- cgit v1.2.3