From c370af60855db957c5b200914bf0bde743845528 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 28 Aug 2015 16:22:41 +0000 Subject: mir_sntprintf / mir_snprintf: obsoleted second parameter removed wherever possible git-svn-id: http://svn.miranda-ng.org/main/trunk@15064 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/src/fam_01service.cpp | 2 +- protocols/IcqOscarJ/src/fam_04message.cpp | 2 +- protocols/IcqOscarJ/src/fam_13servclist.cpp | 2 +- protocols/IcqOscarJ/src/fam_15icqserver.cpp | 4 +- protocols/IcqOscarJ/src/icq_avatar.cpp | 2 +- protocols/IcqOscarJ/src/icq_clients.cpp | 12 +- protocols/IcqOscarJ/src/icq_firstrun.cpp | 2 +- protocols/IcqOscarJ/src/icq_http.cpp | 6 +- protocols/IcqOscarJ/src/icq_proto.cpp | 16 +-- protocols/IcqOscarJ/src/icq_servlist.cpp | 18 +-- protocols/IcqOscarJ/src/icq_uploadui.cpp | 2 +- protocols/IcqOscarJ/src/icq_xstatus.cpp | 187 +++++++++++++------------ protocols/IcqOscarJ/src/log.cpp | 2 +- protocols/IcqOscarJ/src/loginpassword.cpp | 2 +- protocols/IcqOscarJ/src/oscar_filetransfer.cpp | 2 +- 15 files changed, 132 insertions(+), 129 deletions(-) (limited to 'protocols/IcqOscarJ') diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index d1361cf9f3..25610a5bf7 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -735,7 +735,7 @@ void CIcqProto::handleServUINSettings(int nPort, serverthread_info *info) // prepare mood id if (m_bMoodsEnabled && bXStatus && moodXStatus[bXStatus - 1] != -1) - mir_snprintf(szMoodData, _countof(szMoodData), "icqmood%d", moodXStatus[bXStatus - 1]); + mir_snprintf(szMoodData, "icqmood%d", moodXStatus[bXStatus - 1]); else szMoodData[0] = '\0'; diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index e8afe60295..f0f32a831b 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -2602,7 +2602,7 @@ void CIcqProto::handleTypingNotification(BYTE *buf, size_t wLen) char szMsg[MAX_PATH]; char *nick = NickFromHandleUtf(hContact); - mir_snprintf(szMsg, _countof(szMsg), ICQTranslateUtfStatic(LPGEN("Contact \"%s\" has closed the message window."), szFormat, MAX_PATH), nick); + mir_snprintf(szMsg, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" has closed the message window."), szFormat, MAX_PATH), nick); ShowPopupMsg(hContact, ICQTranslateUtfStatic(LPGEN("ICQ Note"), szFormat, MAX_PATH), szMsg, LOG_NOTE); SAFE_FREE((void**)&nick); diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index 4d52f6fc21..a447dfe7dc 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -181,7 +181,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, size_t wBufferLength, snac_hea break; char szLogText[MAX_PATH]; - mir_snprintf(szLogText, _countof(szLogText), szChange, nItems); + mir_snprintf(szLogText, szChange, nItems); debugLogA("Server sent SNAC(x13,x%02x) - %s", pSnacHeader->wSubtype, szLogText); } break; diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp index 7c6a406454..654bfa7f2e 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -525,7 +525,7 @@ int CIcqProto::parseUserInfoRecord(MCONTACT hContact, oscar_tlv *pData, UserInfo for (int i = 0; i < nRecordDef; i++) { char szItemKey[MAX_PATH]; - mir_snprintf(szItemKey, _countof(szItemKey), pRecordDef[i].szDbSetting, nRecords); + mir_snprintf(szItemKey, pRecordDef[i].szDbSetting, nRecords); switch (pRecordDef[i].dbType) { case DBVT_UTF8: @@ -550,7 +550,7 @@ int CIcqProto::parseUserInfoRecord(MCONTACT hContact, oscar_tlv *pData, UserInfo for (int i = nRecords; i <= nMaxRecords; i++) for (int j = 0; j < nRecordDef; j++) { char szItemKey[MAX_PATH]; - mir_snprintf(szItemKey, _countof(szItemKey), pRecordDef[j].szDbSetting, i); + mir_snprintf(szItemKey, pRecordDef[j].szDbSetting, i); delSetting(hContact, szItemKey); } diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index 53caf1b702..284ccf03d4 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -1211,7 +1211,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen const TCHAR *ptszExt; int dwPaFormat = ProtoGetBufferFormat(pBuffer, &ptszExt); TCHAR tszImageFile[MAX_PATH]; - mir_sntprintf(tszImageFile, _countof(tszImageFile), _T("%s%s"), pCookieData->szFile, ptszExt); + mir_sntprintf(tszImageFile, _T("%s%s"), pCookieData->szFile, ptszExt); ppro->setByte(pCookieData->hContact, "AvatarType", (BYTE)dwPaFormat); ai.format = dwPaFormat; // set the format diff --git a/protocols/IcqOscarJ/src/icq_clients.cpp b/protocols/IcqOscarJ/src/icq_clients.cpp index 0993175820..1eaa7898ae 100644 --- a/protocols/IcqOscarJ/src/icq_clients.cpp +++ b/protocols/IcqOscarJ/src/icq_clients.cpp @@ -473,7 +473,7 @@ const char* CIcqProto::detectUserClient( else if (MatchCapability(caps, wLen, &capQipInfium)) { mir_strcpy(szClientBuf, "QIP Infium"); if (dwFT1) { - mir_snprintf(ver, _countof(ver), " (%d)", dwFT1); + mir_snprintf(ver, " (%d)", dwFT1); mir_strcat(szClientBuf, ver); } if (dwFT2 == 0x0B) @@ -484,7 +484,7 @@ const char* CIcqProto::detectUserClient( else if (MatchCapability(caps, wLen, &capQip2010, 12)) { mir_strcpy(szClientBuf, "QIP 2010"); if (dwFT1) { - mir_snprintf(ver, _countof(ver), " (%d)", dwFT1); + mir_snprintf(ver, " (%d)", dwFT1); mir_strcat(szClientBuf, ver); } @@ -493,7 +493,7 @@ const char* CIcqProto::detectUserClient( else if (MatchCapability(caps, wLen, &capQip2012, 12)) { mir_strcpy(szClientBuf, "QIP 2012"); if (dwFT1) { - mir_snprintf(ver, _countof(ver), " (%d)", dwFT1); + mir_snprintf(ver, " (%d)", dwFT1); mir_strcat(szClientBuf, ver); } @@ -507,7 +507,7 @@ const char* CIcqProto::detectUserClient( mir_snprintf(szClientBuf, 64, cliQip, ver); if (dwFT1 && dwFT2 == 0x0E) { - mir_snprintf(ver, _countof(ver), " (%d%d%d%d)", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF, (dwFT1 >> 0x08) & 0xFF, dwFT1 & 0xFF); + mir_snprintf(ver, " (%d%d%d%d)", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF, (dwFT1 >> 0x08) & 0xFF, dwFT1 & 0xFF); mir_strcat(szClientBuf, ver); } szClient = szClientBuf; @@ -528,7 +528,7 @@ const char* CIcqProto::detectUserClient( if (dwFT2 == 0x0FFFF0011 && dwFT3 == 0x1100FFFF && (dwFT1 >> 0x18)) { char ver[16]; - mir_snprintf(ver, _countof(ver), " %d.%d", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF); + mir_snprintf(ver, " %d.%d", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF); if ((dwFT1 & 0xFF) == 0x0B) mir_strcat(ver, " Beta"); mir_strcat(szClientBuf, ver); @@ -943,7 +943,7 @@ const char* CIcqProto::detectUserClient( capstr *capId = MatchCapability(caps, wLen, &capMimPack, 4); if (capId) { char szPack[16]; - mir_snprintf(szPack, _countof(szPack), " [%.12s]", (*capId) + 4); + mir_snprintf(szPack, " [%.12s]", (*capId) + 4); // make sure client string is not constant if (szClient != szClientBuf) { diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 7570cb68fc..91a5de00f0 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -30,7 +30,7 @@ static void accountLoadDetails(CIcqProto *ppro, HWND hwndDlg) char pszUIN[20]; DWORD dwUIN = ppro->getContactUin(NULL); if (dwUIN) { - mir_snprintf(pszUIN, _countof(pszUIN), "%u", dwUIN); + mir_snprintf(pszUIN, "%u", dwUIN); SetDlgItemTextA(hwndDlg, IDC_UIN, pszUIN); } diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp index 6a46f8e35b..5c5492cbc3 100644 --- a/protocols/IcqOscarJ/src/icq_http.cpp +++ b/protocols/IcqOscarJ/src/icq_http.cpp @@ -54,7 +54,7 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST * unpackDWord(&buf, &dwSid2); unpackDWord(&buf, &dwSid3); unpackDWord(&buf, &dwSid4); - mir_snprintf(szSid, _countof(szSid), "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4); + mir_snprintf(szSid, "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4); unpackWord(&buf, &wIpLen); if(nlhr->dataLength < 30 + wIpLen || wIpLen == 0 || wIpLen > sizeof(szHttpServer) - 1) @@ -73,8 +73,8 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST * nlhpi.szHttpGetUrl = szHttpGetUrl; nlhpi.szHttpPostUrl = szHttpPostUrl; nlhpi.firstPostSequence = 1; - mir_snprintf(szHttpGetUrl, _countof(szHttpGetUrl), "http://%s/monitor?sid=%s", szHttpServer, szSid); - mir_snprintf(szHttpPostUrl, _countof(szHttpPostUrl), "http://%s/data?sid=%s&seq=", szHttpServer, szSid); + mir_snprintf(szHttpGetUrl, "http://%s/monitor?sid=%s", szHttpServer, szSid); + mir_snprintf(szHttpPostUrl, "http://%s/data?sid=%s&seq=", szHttpServer, szSid); return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi); } diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index f420108707..6f79e313c8 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -172,7 +172,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const TCHAR* aUserName) : m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); char szP2PModuleName[MAX_PATH]; - mir_snprintf(szP2PModuleName, _countof(szP2PModuleName), "%sP2P", m_szModuleName); + mir_snprintf(szP2PModuleName, "%sP2P", m_szModuleName); mir_sntprintf(szBuffer, TranslateT("%s client-to-client connections"), m_tszUserName); nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR; nlu.ptszDescriptiveName = szBuffer; @@ -241,9 +241,9 @@ int CIcqProto::OnModulesLoaded(WPARAM, LPARAM) char pszSrvGroupsName[MAX_PATH]; char* modules[5] = { 0, 0, 0, 0, 0 }; - mir_snprintf(pszP2PName, _countof(pszP2PName), "%sP2P", m_szModuleName); - mir_snprintf(pszGroupsName, _countof(pszGroupsName), "%sGroups", m_szModuleName); - mir_snprintf(pszSrvGroupsName, _countof(pszSrvGroupsName), "%sSrvGroups", m_szModuleName); + mir_snprintf(pszP2PName, "%sP2P", m_szModuleName); + mir_snprintf(pszGroupsName, "%sGroups", m_szModuleName); + mir_snprintf(pszSrvGroupsName, "%sSrvGroups", m_szModuleName); modules[0] = m_szModuleName; modules[1] = pszP2PName; modules[2] = pszGroupsName; @@ -1215,7 +1215,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const TCHAR* szDescription } else { char tmp[64]; - mir_snprintf(szFiles, _countof(szFiles), ICQTranslateUtfStatic("%d Files", tmp, _countof(tmp)), ft->dwFileCount); + mir_snprintf(szFiles, ICQTranslateUtfStatic("%d Files", tmp, _countof(tmp)), ft->dwFileCount); pszFiles = szFiles; } @@ -1857,11 +1857,11 @@ int __cdecl CIcqProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l case EV_PROTO_ONERASE: { char szDbSetting[MAX_PATH]; - mir_snprintf(szDbSetting, _countof(szDbSetting), "%sP2P", m_szModuleName); + mir_snprintf(szDbSetting, "%sP2P", m_szModuleName); CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting); - mir_snprintf(szDbSetting, _countof(szDbSetting), "%sSrvGroups", m_szModuleName); + mir_snprintf(szDbSetting, "%sSrvGroups", m_szModuleName); CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting); - mir_snprintf(szDbSetting, _countof(szDbSetting), "%sGroups", m_szModuleName); + mir_snprintf(szDbSetting, "%sGroups", m_szModuleName); CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting); } break; diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 3b7745d7d0..8f2b8ba7bb 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -850,7 +850,7 @@ void CIcqProto::LoadServerIDs() int nStart = nServerIDListCount; char szModule[MAX_PATH]; - mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName); + mir_snprintf(szModule, "%sSrvGroups", m_szModuleName); GroupReserveIdsEnumParam param = { this, szModule }; DBCONTACTENUMSETTINGS dbces = { 0 }; @@ -1178,7 +1178,7 @@ int CIcqProto::IsServerGroupsDefined() char szModule[MAX_PATH]; // flush obsolete linking data - mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName); + mir_snprintf(szModule, "%sGroups", m_szModuleName); CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule); iRes = 0; // no groups defined, or older version @@ -1193,7 +1193,7 @@ void CIcqProto::FlushSrvGroupsCache() { char szModule[MAX_PATH]; - mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName); + mir_snprintf(szModule, "%sSrvGroups", m_szModuleName); CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule); } @@ -1273,7 +1273,7 @@ void CIcqProto::removeGroupPathLinks(WORD wGroupID) char szModule[MAX_PATH]; char* pars[3]; - mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName); + mir_snprintf(szModule, "%sGroups", m_szModuleName); pars[0] = NULL; pars[1] = (char*)wGroupID; @@ -1308,7 +1308,7 @@ char* CIcqProto::getServListGroupName(WORD wGroupID) return NULL; } - mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName); + mir_snprintf(szModule, "%sSrvGroups", m_szModuleName); _itoa(wGroupID, szGroup, 0x10); if (!CheckServerID(wGroupID, 0)) { // check if valid id, if not give empty and remove @@ -1330,7 +1330,7 @@ void CIcqProto::setServListGroupName(WORD wGroupID, const char *szGroupName) return; } - mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName); + mir_snprintf(szModule, "%sSrvGroups", m_szModuleName); _itoa(wGroupID, szGroup, 0x10); if (szGroupName) @@ -1344,7 +1344,7 @@ void CIcqProto::setServListGroupName(WORD wGroupID, const char *szGroupName) WORD CIcqProto::getServListGroupLinkID(const char *szPath) { char szModule[MAX_PATH]; - mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName); + mir_snprintf(szModule, "%sGroups", m_szModuleName); WORD wGroupId = db_get_w(NULL, szModule, szPath, 0); @@ -1360,7 +1360,7 @@ WORD CIcqProto::getServListGroupLinkID(const char *szPath) void CIcqProto::setServListGroupLinkID(const char *szPath, WORD wGroupID) { char szModule[MAX_PATH]; - mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName); + mir_snprintf(szModule, "%sGroups", m_szModuleName); if (wGroupID) db_set_w(NULL, szModule, szPath, wGroupID); @@ -1530,7 +1530,7 @@ char* CIcqProto::getServListUniqueGroupName(const char *szGroupName, int bAlloce szGroupNameBase = null_strdup(szGroupName); null_strcut(szGroupNameBase, m_wServerListRecordNameMaxLength); - mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName); + mir_snprintf(szModule, "%sSrvGroups", m_szModuleName); do { pars[0] = (char*)this; diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index 51b58641c9..a39ec5864f 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -155,7 +155,7 @@ static int GroupEnumIdsEnumProc(const char *szSetting,LPARAM lParam) static void enumServerGroups(CIcqProto* ppro) { char szModule[MAX_PATH+9]; - mir_snprintf(szModule, _countof(szModule), "%s%s", ppro->m_szModuleName, "SrvGroups"); + mir_snprintf(szModule, "%s%s", ppro->m_szModuleName, "SrvGroups"); DBCONTACTENUMSETTINGS dbces = { 0 }; dbces.pfnEnumProc = &GroupEnumIdsEnumProc; diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index e663d4ee38..251841a4c9 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -78,9 +78,11 @@ DWORD CIcqProto::requestXStatusDetails(MCONTACT hContact, BOOL bAllowDelay) if (!CheckContactCapabilities(hContact, CAPF_XTRAZ) && bAllowDelay) return 0; // Contact does not support xtraz, do not request details - struct rates_xstatus_request: public rates_queue_item { + struct rates_xstatus_request : public rates_queue_item + { protected: - virtual rates_queue_item* copyItem(rates_queue_item *aDest = NULL) { + virtual rates_queue_item* copyItem(rates_queue_item *aDest = NULL) + { rates_xstatus_request *pDest = (rates_xstatus_request*)aDest; if (!pDest) pDest = new rates_xstatus_request(ppro, wGroup); @@ -89,10 +91,11 @@ DWORD CIcqProto::requestXStatusDetails(MCONTACT hContact, BOOL bAllowDelay) return rates_queue_item::copyItem(pDest); }; public: - rates_xstatus_request(CIcqProto *ppro, WORD wGroup): rates_queue_item(ppro, wGroup) { }; - virtual ~rates_xstatus_request() { }; + rates_xstatus_request(CIcqProto *ppro, WORD wGroup) : rates_queue_item(ppro, wGroup) {}; + virtual ~rates_xstatus_request() {}; - virtual void execute() { + virtual void execute() + { dwCookie = ppro->sendXStatusDetailsRequest(hContact, bForced); }; @@ -136,7 +139,7 @@ static HANDLE LoadXStatusIconLibrary(TCHAR *path, const TCHAR *sub) static TCHAR* InitXStatusIconLibrary(TCHAR *buf, size_t buf_size) { - TCHAR path[2*MAX_PATH]; + TCHAR path[2 * MAX_PATH]; HMODULE hXStatusIconsDLL; // get miranda's exe path @@ -150,7 +153,7 @@ static TCHAR* InitXStatusIconLibrary(TCHAR *buf, size_t buf_size) null_strcpy(buf, path, buf_size - 1); char ident[MAX_PATH]; - if ( LoadStringA(hXStatusIconsDLL, IDS_IDENTIFY, ident, sizeof(ident)) == 0 || mir_strcmp(ident, "# Custom Status Icons #")) + if (LoadStringA(hXStatusIconsDLL, IDS_IDENTIFY, ident, sizeof(ident)) == 0 || mir_strcmp(ident, "# Custom Status Icons #")) *buf = 0; FreeLibrary(hXStatusIconsDLL); @@ -165,14 +168,14 @@ HICON CIcqProto::getXStatusIcon(int bStatus, UINT flags) HICON icon = NULL; if (bStatus > 0 && bStatus <= XSTATUS_COUNT) - icon = IcoLib_GetIconByHandle(hXStatusIcons[bStatus-1], (flags & LR_BIGICON) != 0); + icon = IcoLib_GetIconByHandle(hXStatusIcons[bStatus - 1], (flags & LR_BIGICON) != 0); return (flags & LR_SHARED || !icon) ? icon : CopyIcon(icon); } void setContactExtraIcon(MCONTACT hContact, int xstatus) { - ExtraIcon_SetIcon(hExtraXStatus, hContact, (xstatus > 0) ? hXStatusIcons[xstatus-1] : NULL); + ExtraIcon_SetIcon(hExtraXStatus, hContact, (xstatus > 0) ? hXStatusIcons[xstatus - 1] : NULL); } #define NULLCAP {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} @@ -207,7 +210,7 @@ capstr capXStatus[XSTATUS_COUNT] = { {0x16, 0x0C, 0x60, 0xBB, 0xDD, 0x44, 0x43, 0xF3, 0x91, 0x40, 0x05, 0x0F, 0x00, 0xE6, 0xC0, 0x09}, {0x64, 0x43, 0xC6, 0xAF, 0x22, 0x60, 0x45, 0x17, 0xB5, 0x8C, 0xD7, 0xDF, 0x8E, 0x29, 0x03, 0x52}, {0x16, 0xF5, 0xB7, 0x6F, 0xA9, 0xD2, 0x40, 0x35, 0x8C, 0xC5, 0xC0, 0x84, 0x70, 0x3C, 0x98, 0xFA}, - {0x63, 0x14, 0x36, 0xff, 0x3f, 0x8a, 0x40, 0xd0, 0xa5, 0xcb, 0x7b, 0x66, 0xe0, 0x51, 0xb3, 0x64}, + {0x63, 0x14, 0x36, 0xff, 0x3f, 0x8a, 0x40, 0xd0, 0xa5, 0xcb, 0x7b, 0x66, 0xe0, 0x51, 0xb3, 0x64}, {0xb7, 0x08, 0x67, 0xf5, 0x38, 0x25, 0x43, 0x27, 0xa1, 0xff, 0xcf, 0x4c, 0xc1, 0x93, 0x97, 0x97}, {0xdd, 0xcf, 0x0e, 0xa9, 0x71, 0x95, 0x40, 0x48, 0xa9, 0xc6, 0x41, 0x32, 0x06, 0xd6, 0xf2, 0x80}, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, @@ -215,7 +218,7 @@ capstr capXStatus[XSTATUS_COUNT] = { NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, NULLCAP, - NULLCAP, NULLCAP, NULLCAP, NULLCAP}; + NULLCAP, NULLCAP, NULLCAP, NULLCAP }; const char *nameXStatus[XSTATUS_COUNT] = { LPGEN("Angry"), // 23 @@ -304,7 +307,7 @@ const char *nameXStatus[XSTATUS_COUNT] = { LPGEN("Sushi"), //79 LPGEN("Playing"), //81 LPGEN("Writing") //84 - }; +}; const int moodXStatus[XSTATUS_COUNT] = { 23, @@ -392,7 +395,7 @@ const int moodXStatus[XSTATUS_COUNT] = { 78, 79, 81, - 84}; + 84 }; void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, MCONTACT hContact, BYTE *caps, int capsize, char *moods, int moodsize) { @@ -406,40 +409,40 @@ void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, MCONTACT hContact, B int nOldXStatusID = getContactXStatus(hContact); if (m_bMoodsEnabled) { - // process custom statuses (moods) from ICQ6 + // process custom statuses (moods) from ICQ6 if (moods) { if (moodsize > 0) if (moodsize >= 32) moods[32] = '\0'; - for (int i = 0; i < XSTATUS_COUNT; i++) { - char szMoodId[32], szMoodData[32]; + for (int i = 0; i < XSTATUS_COUNT; i++) { + char szMoodId[32], szMoodData[32]; - null_strcpy(szMoodData, moods, moodsize); + null_strcpy(szMoodData, moods, moodsize); - if (moodXStatus[i] == -1) continue; - mir_snprintf(szMoodId, _countof(szMoodId), "0icqmood%d", moodXStatus[i]); - if (!mir_strcmp(szMoodId, szMoodData)) { - BYTE bXStatusId = (BYTE)(i+1); - char str[MAX_PATH]; + if (moodXStatus[i] == -1) continue; + mir_snprintf(szMoodId, "0icqmood%d", moodXStatus[i]); + if (!mir_strcmp(szMoodId, szMoodData)) { + BYTE bXStatusId = (BYTE)(i + 1); + char str[MAX_PATH]; - SetContactCapabilities(hContact, CAPF_STATUS_MOOD); + SetContactCapabilities(hContact, CAPF_STATUS_MOOD); - // only write default name when it is really needed, i.e. on Custom Status change - if (nOldXStatusID != bXStatusId) { - setByte(hContact, DBSETTING_XSTATUS_ID, bXStatusId); - db_set_utf(hContact, m_szModuleName, DBSETTING_XSTATUS_NAME, ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH)); - delSetting(hContact, DBSETTING_XSTATUS_MSG); + // only write default name when it is really needed, i.e. on Custom Status change + if (nOldXStatusID != bXStatusId) { + setByte(hContact, DBSETTING_XSTATUS_ID, bXStatusId); + db_set_utf(hContact, m_szModuleName, DBSETTING_XSTATUS_NAME, ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH)); + delSetting(hContact, DBSETTING_XSTATUS_MSG); - debugLogA("%s changed mood to %s.", strUID(dwUIN, szUID), ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH)); - bChanged = TRUE; - } + debugLogA("%s changed mood to %s.", strUID(dwUIN, szUID), ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH)); + bChanged = TRUE; + } - // cannot retrieve mood details here - need to be processed with new user details - nMoodID = bXStatusId; + // cannot retrieve mood details here - need to be processed with new user details + nMoodID = bXStatusId; - break; - } + break; + } } if (nMoodID == 0 && moods) @@ -448,17 +451,17 @@ void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, MCONTACT hContact, B } if (m_bXStatusEnabled) { - // detect custom status capabilities + // detect custom status capabilities if (caps) { if (capsize > 0) for (int i = 0; i < XSTATUS_COUNT; i++) { if (MatchCapability(caps, capsize, (const capstr*)capXStatus[i], BINARY_CAP_SIZE)) { - BYTE bXStatusId = (BYTE)(i+1); + BYTE bXStatusId = (BYTE)(i + 1); char str[MAX_PATH]; SetContactCapabilities(hContact, CAPF_XSTATUS); - // only write default name when it is really needed, i.e. on Custom Status change + // only write default name when it is really needed, i.e. on Custom Status change if (nMoodID == 0 && nOldXStatusID != bXStatusId) { setByte(hContact, DBSETTING_XSTATUS_ID, bXStatusId); db_set_utf(hContact, m_szModuleName, DBSETTING_XSTATUS_NAME, ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH)); @@ -509,8 +512,8 @@ void CIcqProto::updateServerCustomStatus(int fullUpdate) char szMoodData[32]; // prepare mood id - if (m_bMoodsEnabled && bXStatus && moodXStatus[bXStatus-1] != -1) - mir_snprintf(szMoodData, _countof(szMoodData), "0icqmood%d", moodXStatus[bXStatus-1]); + if (m_bMoodsEnabled && bXStatus && moodXStatus[bXStatus - 1] != -1) + mir_snprintf(szMoodData, "0icqmood%d", moodXStatus[bXStatus - 1]); else szMoodData[0] = '\0'; @@ -523,14 +526,14 @@ void CIcqProto::updateServerCustomStatus(int fullUpdate) if (bXStatus && (m_bXStatusEnabled || m_bMoodsEnabled)) szStatusNote = getSettingStringUtf(NULL, DBSETTING_XSTATUS_MSG, ""); // retrieve standard status message (e.g. custom status set to none) - else { + else { char **pszMsg = MirandaStatusToAwayMsg(m_iStatus); { mir_cslock l(m_modeMsgsMutex); if (pszMsg) szStatusNote = null_strdup(*pszMsg); } - + // no default status message, set empty if (!szStatusNote) szStatusNote = null_strdup(""); @@ -542,12 +545,12 @@ void CIcqProto::updateServerCustomStatus(int fullUpdate) SAFE_FREE(&szStatusNote); } -static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch(msg) { + switch (msg) { case WM_CHAR: - if(wParam=='\n' && GetKeyState(VK_CONTROL) & 0x8000) { - PostMessage(GetParent(hwnd),WM_COMMAND,IDOK,0); + if (wParam == '\n' && GetKeyState(VK_CONTROL) & 0x8000) { + PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); return 0; } if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-a @@ -560,15 +563,15 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam } if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-backspace DWORD start, end; - SendMessage(hwnd, EM_GETSEL, (WPARAM)&end, (LPARAM) (PDWORD) NULL); + SendMessage(hwnd, EM_GETSEL, (WPARAM)&end, (LPARAM)(PDWORD)NULL); SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0); - SendMessage(hwnd, EM_GETSEL, (WPARAM)&start, (LPARAM) (PDWORD) NULL); + SendMessage(hwnd, EM_GETSEL, (WPARAM)&start, (LPARAM)(PDWORD)NULL); WCHAR *text = GetWindowTextUcs(hwnd); memmove(text + start, text + end, sizeof(WCHAR) * (mir_wstrlen(text) + 1 - end)); SetWindowTextUcs(hwnd, text); SAFE_FREE(&text); SendMessage(hwnd, EM_SETSEL, start, start); - SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM) hwnd); + SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd); return 0; } break; @@ -599,23 +602,23 @@ struct InitXStatusData }; #define HM_PROTOACK (WM_USER+10) -static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { SetXStatusData *dat = (SetXStatusData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); char str[MAX_PATH]; - switch(message) { + switch (message) { case HM_PROTOACK: { ACKDATA *ack = (ACKDATA*)lParam; - if (ack->type != ICQACKTYPE_XSTATUS_RESPONSE) break; + if (ack->type != ICQACKTYPE_XSTATUS_RESPONSE) break; if (ack->hContact != dat->hContact) break; if ((UINT_PTR)ack->hProcess != dat->iEvent) break; ShowDlgItem(hwndDlg, IDC_RETRXSTATUS, SW_HIDE); ShowDlgItem(hwndDlg, IDC_XMSG, SW_SHOW); ShowDlgItem(hwndDlg, IDC_XTITLE, SW_SHOW); - SetDlgItemText(hwndDlg,IDOK,TranslateT("Close")); + SetDlgItemText(hwndDlg, IDOK, TranslateT("Close")); UnhookEvent(dat->hEvent); dat->hEvent = NULL; char *szText = dat->ppro->getSettingStringUtf(dat->hContact, DBSETTING_XSTATUS_NAME, ""); SetDlgItemTextUtf(hwndDlg, IDC_XTITLE, szText); @@ -633,18 +636,18 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara TranslateDialogDefault(hwndDlg); dat = (SetXStatusData*)SAFE_MALLOC(sizeof(SetXStatusData)); dat->ppro = init->ppro; - SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)dat); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); dat->bAction = init->bAction; if (!init->bAction) { // set our xStatus dat->bXStatus = init->bXStatus; SendDlgItemMessage(hwndDlg, IDC_XMSG, EM_LIMITTEXT, 1024, 0); - mir_subclassWindow( GetDlgItem(hwndDlg,IDC_XMSG), MessageEditSubclassProc); + mir_subclassWindow(GetDlgItem(hwndDlg, IDC_XMSG), MessageEditSubclassProc); SetDlgItemTextUtf(hwndDlg, IDC_XMSG, init->szXStatusMsg); if (dat->ppro->m_bXStatusEnabled) { // custom status enabled, prepare title edit SendDlgItemMessage(hwndDlg, IDC_XTITLE, EM_LIMITTEXT, 256, 0); - mir_subclassWindow( GetDlgItem(hwndDlg,IDC_XTITLE), MessageEditSubclassProc); + mir_subclassWindow(GetDlgItem(hwndDlg, IDC_XTITLE), MessageEditSubclassProc); SetDlgItemTextUtf(hwndDlg, IDC_XTITLE, init->szXStatusName); } else { // only moods enabled, hide title, resize message edit control @@ -654,10 +657,10 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara MoveDlgItem(hwndDlg, IDC_XMSG, 5, 9, 179, 65); } - dat->okButtonFormat = GetDlgItemTextUtf(hwndDlg,IDOK); + dat->okButtonFormat = GetDlgItemTextUtf(hwndDlg, IDOK); dat->countdown = 5; SendMessage(hwndDlg, WM_TIMER, 0, 0); - SetTimer(hwndDlg,1,1000,0); + SetTimer(hwndDlg, 1, 1000, 0); } else { // retrieve contact's xStatus dat->hContact = init->hContact; @@ -667,7 +670,7 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara SendDlgItemMessage(hwndDlg, IDC_XMSG, EM_SETREADONLY, 1, 0); if (dat->ppro->CheckContactCapabilities(dat->hContact, CAPF_XSTATUS) && !dat->ppro->getByte("XStatusAuto", DEFAULT_XSTATUS_AUTO)) { - SetDlgItemText(hwndDlg,IDOK,TranslateT("Cancel")); + SetDlgItemText(hwndDlg, IDOK, TranslateT("Cancel")); dat->hEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_PROTOACK); ShowDlgItem(hwndDlg, IDC_RETRXSTATUS, SW_SHOW); ShowDlgItem(hwndDlg, IDC_XMSG, SW_HIDE); @@ -675,7 +678,7 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara dat->iEvent = dat->ppro->requestXStatusDetails(dat->hContact, FALSE); } else { - SetDlgItemText(hwndDlg,IDOK,TranslateT("Close")); + SetDlgItemText(hwndDlg, IDOK, TranslateT("Close")); dat->hEvent = NULL; char *szText = dat->ppro->getSettingStringUtf(dat->hContact, DBSETTING_XSTATUS_NAME, ""); SetDlgItemTextUtf(hwndDlg, IDC_XTITLE, szText); @@ -698,41 +701,41 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara } if (dat->bXStatus) { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)dat->ppro->getXStatusIcon(dat->bXStatus, LR_SHARED | LR_BIGICON)); + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)dat->ppro->getXStatusIcon(dat->bXStatus, LR_SHARED | LR_BIGICON)); SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)dat->ppro->getXStatusIcon(dat->bXStatus, LR_SHARED)); } char buf[MAX_PATH]; char *format = GetWindowTextUtf(hwndDlg); - mir_snprintf(str, format, dat->bXStatus?ICQTranslateUtfStatic(nameXStatus[dat->bXStatus-1], buf, MAX_PATH):""); + mir_snprintf(str, format, dat->bXStatus ? ICQTranslateUtfStatic(nameXStatus[dat->bXStatus - 1], buf, MAX_PATH) : ""); SetWindowTextUtf(hwndDlg, str); SAFE_FREE(&format); } return TRUE; case WM_TIMER: - if(dat->countdown == -1) { - DestroyWindow(hwndDlg); + if (dat->countdown == -1) { + DestroyWindow(hwndDlg); break; } - mir_snprintf(str,_countof(str),dat->okButtonFormat,dat->countdown); - SetDlgItemTextUtf(hwndDlg,IDOK,str); + mir_snprintf(str, dat->okButtonFormat, dat->countdown); + SetDlgItemTextUtf(hwndDlg, IDOK, str); dat->countdown--; break; case WM_COMMAND: - switch(LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDOK: DestroyWindow(hwndDlg); break; - + case IDC_XTITLE: case IDC_XMSG: if (!dat->bAction) { // set our xStatus - KillTimer(hwndDlg,1); - SetDlgItemText(hwndDlg,IDOK,TranslateT("OK")); + KillTimer(hwndDlg, 1); + SetDlgItemText(hwndDlg, IDOK, TranslateT("OK")); } } break; @@ -742,14 +745,14 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara char szSetting[64]; dat->ppro->setByte(DBSETTING_XSTATUS_ID, dat->bXStatus); - char *szValue = GetDlgItemTextUtf(hwndDlg,IDC_XMSG); + char *szValue = GetDlgItemTextUtf(hwndDlg, IDC_XMSG); mir_snprintf(szSetting, "XStatus%dMsg", dat->bXStatus); db_set_utf(NULL, dat->ppro->m_szModuleName, szSetting, szValue); db_set_utf(NULL, dat->ppro->m_szModuleName, DBSETTING_XSTATUS_MSG, szValue); SAFE_FREE(&szValue); if (dat->ppro->m_bXStatusEnabled) { - szValue = GetDlgItemTextUtf(hwndDlg,IDC_XTITLE); + szValue = GetDlgItemTextUtf(hwndDlg, IDC_XTITLE); mir_snprintf(szSetting, "XStatus%dName", dat->bXStatus); db_set_utf(NULL, dat->ppro->m_szModuleName, szSetting, szValue); db_set_utf(NULL, dat->ppro->m_szModuleName, DBSETTING_XSTATUS_NAME, szValue); @@ -793,7 +796,7 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) if (m_bXStatusEnabled) { mir_snprintf(szSetting, "XStatus%dName", bXStatus); - szName = getSettingStringUtf(NULL, szSetting, ICQTranslateUtfStatic(nameXStatus[bXStatus-1], str, MAX_PATH)); + szName = getSettingStringUtf(NULL, szSetting, ICQTranslateUtfStatic(nameXStatus[bXStatus - 1], str, MAX_PATH)); } mir_snprintf(szSetting, "XStatus%dMsg", bXStatus); szMsg = getSettingStringUtf(NULL, szSetting, ""); @@ -851,7 +854,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) HGENMENU hRoot; { TCHAR szItem[MAX_PATH + 64]; - mir_sntprintf(szItem, _countof(szItem), TranslateT("%s Custom Status"), m_tszUserName); + mir_sntprintf(szItem, TranslateT("%s Custom Status"), m_tszUserName); CMenuItem mi; mi.root = pcli->pfnGetProtocolMenu(m_szModuleName); @@ -867,7 +870,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) int bXStatusMenuBuilt = 0; for (int i = 0; i <= XSTATUS_COUNT; i++) { char srvFce[MAX_PATH + 64]; - mir_snprintf(srvFce, _countof(srvFce), "/menuXStatus%d", i); + mir_snprintf(srvFce, "/menuXStatus%d", i); mi.position++; if (!i) @@ -877,8 +880,8 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) CreateProtoServiceParam(srvFce, &CIcqProto::menuXStatus, i); mi.flags = (bXStatus == i ? CMIF_CHECKED : 0); - mi.hIcolibItem = i ? hXStatusIcons[i-1] : NULL; - mi.name.a = i ? (char*)nameXStatus[i-1] : (char *)LPGEN("None"); + mi.hIcolibItem = i ? hXStatusIcons[i - 1] : NULL; + mi.name.a = i ? (char*)nameXStatus[i - 1] : (char *)LPGEN("None"); mi.pszService = srvFce; hXStatusItems[i] = Menu_AddStatusMenuItem(&mi, m_szModuleName); @@ -888,7 +891,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) void InitXStatusIcons() { - TCHAR lib[2*MAX_PATH] = {0}; + TCHAR lib[2 * MAX_PATH] = { 0 }; SKINICONDESC sid = { 0 }; sid.section.a = "Protocols/" ICQ_PROTOCOL_NAME "/" LPGEN("Custom Status"); @@ -900,7 +903,7 @@ void InitXStatusIcons() mir_snprintf(szTemp, "icq_xstatus%d", i); sid.pszName = szTemp; sid.description.a = (LPSTR)nameXStatus[i]; - sid.iDefaultIndex = -(IDI_XSTATUS1+i); + sid.iDefaultIndex = -(IDI_XSTATUS1 + i); hXStatusIcons[i] = IcoLib_AddIcon(&sid); } @@ -982,7 +985,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM hContact, LPARAM lParam) // fill status member if (pData->flags & CSSF_MASK_STATUS) *pData->status = getContactXStatus(hContact); - + // fill status name member if (pData->flags & CSSF_MASK_NAME) { if (pData->flags & CSSF_DEFAULT_NAME) { @@ -991,10 +994,10 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM hContact, LPARAM lParam) return 1; // Failure if (pData->flags & CSSF_UNICODE) { - char *text = (char*)nameXStatus[status-1]; + char *text = (char*)nameXStatus[status - 1]; MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, text, -1, pData->pwszName, MAX_PATH); } - else mir_strcpy(pData->pszName, (char*)nameXStatus[status-1]); + else mir_strcpy(pData->pszName, (char*)nameXStatus[status - 1]); } else { // moods does not support status title if (!m_bXStatusEnabled) return 1; @@ -1009,7 +1012,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM hContact, LPARAM lParam) } else { DBVARIANT dbv; - if ( !getString(hContact, DBSETTING_XSTATUS_NAME, &dbv) && dbv.pszVal) { + if (!getString(hContact, DBSETTING_XSTATUS_NAME, &dbv) && dbv.pszVal) { mir_strcpy(pData->pszName, dbv.pszVal); db_free(&dbv); } @@ -1028,7 +1031,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM hContact, LPARAM lParam) SAFE_FREE(&wstr); } else { - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; if (!getString(hContact, CheckContactCapabilities(hContact, CAPF_STATUS_MOOD) ? DBSETTING_STATUS_NOTE : DBSETTING_XSTATUS_MSG, &dbv) && dbv.pszVal) mir_strcpy(pData->pszMessage, dbv.pszVal); @@ -1052,7 +1055,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM hContact, LPARAM lParam) *pData->wParam = XSTATUS_COUNT; if (pData->flags & CSSF_STR_SIZES) { - DBVARIANT dbv = {DBVT_DELETED}; + DBVARIANT dbv = { DBVT_DELETED }; if (pData->wParam) { if (m_bXStatusEnabled && !getString(hContact, DBSETTING_XSTATUS_NAME, &dbv)) @@ -1107,24 +1110,24 @@ INT_PTR CIcqProto::RequestAdvStatusIconIdx(WPARAM wParam, LPARAM) BYTE bXStatus = getContactXStatus(wParam); if (bXStatus) { - if (!bXStatusCListIconsValid[bXStatus-1]) { // adding icon - int idx = hXStatusCListIcons[bXStatus-1]; - HIMAGELIST hCListImageList = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0); + if (!bXStatusCListIconsValid[bXStatus - 1]) { // adding icon + int idx = hXStatusCListIcons[bXStatus - 1]; + HIMAGELIST hCListImageList = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0); if (hCListImageList) { HICON hXStatusIcon = getXStatusIcon(bXStatus, LR_SHARED); if (idx > 0) ImageList_ReplaceIcon(hCListImageList, idx, hXStatusIcon); else - hXStatusCListIcons[bXStatus-1] = ImageList_AddIcon(hCListImageList, hXStatusIcon); + hXStatusCListIcons[bXStatus - 1] = ImageList_AddIcon(hCListImageList, hXStatusIcon); // mark icon index in the array as valid - bXStatusCListIconsValid[bXStatus-1] = TRUE; + bXStatusCListIconsValid[bXStatus - 1] = TRUE; IcoLib_ReleaseIcon(hXStatusIcon); - } + } } - int idx = bXStatusCListIconsValid[bXStatus-1] ? hXStatusCListIcons[bXStatus-1] : -1; + int idx = bXStatusCListIconsValid[bXStatus - 1] ? hXStatusCListIcons[bXStatus - 1] : -1; if (idx > 0) return (idx & 0xFFFF) << 16; } diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp index 644fef9e5c..04709b2579 100644 --- a/protocols/IcqOscarJ/src/log.cpp +++ b/protocols/IcqOscarJ/src/log.cpp @@ -126,7 +126,7 @@ void CIcqProto::icq_LogUsingErrorCode(int level, DWORD dwError, const char *szMs break; } - mir_snprintf(szBuf, _countof(szBuf), "%s%s%s (%s %d)", + mir_snprintf(szBuf, "%s%s%s (%s %d)", szMsg ? ICQTranslateUtfStatic(szMsg, str, 1024) : "", szMsg ? "\r\n\r\n" : "", ICQTranslateUtfStatic(pszErrorMsg, szErrorMsg, 512), diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp index 2b19ad07eb..81ea3741ed 100644 --- a/protocols/IcqOscarJ/src/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/loginpassword.cpp @@ -42,7 +42,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA DWORD dwUin = ppro->getContactUin(NULL); TCHAR pszUIN[MAX_PATH]; - mir_sntprintf(pszUIN, _countof(pszUIN), TranslateT("Enter a password for UIN %u:"), dwUin); + mir_sntprintf(pszUIN, TranslateT("Enter a password for UIN %u:"), dwUin); SetDlgItemText(hwndDlg, IDC_INSTRUCTION, pszUIN); SendDlgItemMessage(hwndDlg, IDC_LOGINPW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0); diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index d378d71dba..4367dadc88 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -1586,7 +1586,7 @@ int CIcqProto::oft_handleFileData(oscar_connection *oc, BYTE *buf, size_t len) char *pszMsg = ICQTranslateUtf(LPGEN("The checksum of file \"%s\" does not match, the file is probably damaged.")); char szBuf[MAX_PATH]; - mir_snprintf(szBuf, _countof(szBuf), pszMsg, ExtractFileName(ft->szThisFile)); + mir_snprintf(szBuf, pszMsg, ExtractFileName(ft->szThisFile)); icq_LogMessage(LOG_ERROR, szBuf); SAFE_FREE(&pszMsg); -- cgit v1.2.3