summaryrefslogtreecommitdiff
path: root/protocols/AimOscar
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-01 20:40:05 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-01 20:40:05 +0000
commitacd4daf132c8ff3b05df7615e95f60be2fb82ddb (patch)
treeff5836cfc26ab245a356d15c90d36ece29f07189 /protocols/AimOscar
parent9de7eaca48475e8e5c7f04b72451983ace0ccee5 (diff)
various quirks with PROTO_AVATAR_INFORMATION declarations
git-svn-id: http://svn.miranda-ng.org/main/trunk@13965 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/AimOscar')
-rw-r--r--protocols/AimOscar/src/avatars.cpp12
-rw-r--r--protocols/AimOscar/src/services.cpp23
2 files changed, 16 insertions, 19 deletions
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp
index 2a961d7cd6..2de60d0ed4 100644
--- a/protocols/AimOscar/src/avatars.cpp
+++ b/protocols/AimOscar/src/avatars.cpp
@@ -98,15 +98,15 @@ void CAimProto::avatar_request_handler(MCONTACT hContact, char* hash, unsigned c
void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, const char* data, int data_len)
{
bool res = false;
- PROTO_AVATAR_INFORMATION AI = {0};
- AI.hContact = contact_from_sn(sn);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = contact_from_sn(sn);
if (data_len > 0) {
const TCHAR *type;
- AI.format = ProtoGetBufferFormat(data, &type);
- get_avatar_filename(AI.hContact, AI.filename, SIZEOF(AI.filename), type);
+ ai.format = ProtoGetBufferFormat(data, &type);
+ get_avatar_filename(ai.hContact, ai.filename, SIZEOF(ai.filename), type);
- int fileId = _topen(AI.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
+ int fileId = _topen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId >= 0) {
_write(fileId, data, data_len);
_close(fileId);
@@ -120,7 +120,7 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, c
}
else debugLogA("AIM sent avatar of zero length for %s.(Usually caused by repeated request for the same icon)", sn);
- ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, res ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, &AI, 0);
+ ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, res ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, &ai, 0);
}
int CAimProto::get_avatar_filename(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext)
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp
index 6e35b76a1f..9d5b86d317 100644
--- a/protocols/AimOscar/src/services.cpp
+++ b/protocols/AimOscar/src/services.cpp
@@ -339,21 +339,21 @@ INT_PTR CAimProto::ManageAccount(WPARAM, LPARAM)
INT_PTR CAimProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
{
- PROTO_AVATAR_INFORMATION* AI = (PROTO_AVATAR_INFORMATION*)lParam;
+ PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
- AI->filename[0] = 0;
- AI->format = PA_FORMAT_UNKNOWN;
+ pai->filename[0] = 0;
+ pai->format = PA_FORMAT_UNKNOWN;
if (getByte(AIM_KEY_DA, 0)) return GAIR_NOAVATAR;
- switch (get_avatar_filename(AI->hContact, AI->filename, SIZEOF(AI->filename), NULL))
+ switch (get_avatar_filename(pai->hContact, pai->filename, SIZEOF(pai->filename), NULL))
{
case GAIR_SUCCESS:
if (!(wParam & GAIF_FORCE) || state != 1 )
return GAIR_SUCCESS;
case GAIR_WAITFOR:
- AI->format = ProtoGetAvatarFormat(AI->filename);
+ pai->format = ProtoGetAvatarFormat(pai->filename);
break;
default:
@@ -362,7 +362,7 @@ INT_PTR CAimProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
if (state == 1)
{
- ForkThread(&CAimProto::avatar_request_thread, (void*)AI->hContact);
+ ForkThread(&CAimProto::avatar_request_thread, (void*)pai->hContact);
return GAIR_WAITFOR;
}
@@ -405,16 +405,13 @@ INT_PTR CAimProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam)
INT_PTR CAimProto::GetAvatar(WPARAM wParam, LPARAM lParam)
{
TCHAR* buf = (TCHAR*)wParam;
- int size = (int)lParam;
-
+ size_t size = (size_t)lParam;
if (buf == NULL || size <= 0)
return -1;
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai) };
- if (GetAvatarInfo(0, (LPARAM)&ai) == GAIR_SUCCESS)
- {
- _tcsncpy(buf, ai.filename, size);
- buf[size-1] = 0;
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ if (GetAvatarInfo(0, (LPARAM)&ai) == GAIR_SUCCESS) {
+ _tcsncpy_s(buf, size, ai.filename, _TRUNCATE);
return 0;
}