From b089826c1a2a9a3ee21528869f7944c396d34f6a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 13 May 2016 21:06:54 +0000 Subject: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@16830 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AVS/src/cache.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'plugins/AVS/src/cache.cpp') diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index 76526891be..01e3c65a23 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -125,12 +125,11 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace) // Fire the event for avatar history node->dwFlags &= ~AVH_MUSTNOTIFY; if (node->szFilename[0] != '\0') { - CONTACTAVATARCHANGEDNOTIFICATION cacn = { 0 }; + CONTACTAVATARCHANGEDNOTIFICATION cacn = {}; cacn.cbSize = sizeof(CONTACTAVATARCHANGEDNOTIFICATION); cacn.hContact = hContact; cacn.format = node->pa_format; - _tcsncpy(cacn.filename, node->szFilename, MAX_PATH); - cacn.filename[MAX_PATH - 1] = 0; + _tcsncpy_s(cacn.filename, node->szFilename, _TRUNCATE); // Get hash char *szProto = GetContactProto(hContact); @@ -139,6 +138,8 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace) if (!db_get_s(hContact, szProto, "AvatarHash", &dbv)) { if (dbv.type == DBVT_TCHAR) _tcsncpy_s(cacn.hash, dbv.ptszVal, _TRUNCATE); + else if (dbv.type == DBVT_ASCIIZ) + _tcsncpy_s(cacn.hash, _A2T(dbv.pszVal), _TRUNCATE); else if (dbv.type == DBVT_BLOB) { ptrA szHash(mir_base64_encode(dbv.pbVal, dbv.cpbVal)); _tcsncpy_s(cacn.hash, _A2T(szHash), _TRUNCATE); @@ -151,7 +152,7 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace) if (cacn.hash[0] == '\0') mir_sntprintf(cacn.hash, _T("AVS-HASH-%x"), GetFileHash(cacn.filename)); - NotifyEventHooks(hEventContactAvatarChanged, (WPARAM)cacn.hContact, (LPARAM)&cacn); + NotifyEventHooks(hEventContactAvatarChanged, hContact, (LPARAM)&cacn); } else NotifyEventHooks(hEventContactAvatarChanged, hContact, NULL); } -- cgit v1.2.3