diff options
author | George Hazan <george.hazan@gmail.com> | 2016-05-13 21:06:54 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-05-13 21:06:54 +0000 |
commit | b089826c1a2a9a3ee21528869f7944c396d34f6a (patch) | |
tree | 8565acbdc69ee50e3444179b66719119c5d0ce37 /plugins/AVS | |
parent | 690f3c5828685ffc3c2a11d8d68e4c0b1cf5f0ba (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@16830 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AVS')
-rw-r--r-- | plugins/AVS/src/cache.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
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);
}
|