From 13eb83bea655c3302c74a82d826d75bceb9232a2 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Mon, 8 Dec 2014 22:13:57 +0000 Subject: code cleanup around mir_snprintf git-svn-id: http://svn.miranda-ng.org/main/trunk@11285 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/classMAnnivDate.cpp | 12 ++++++------ plugins/UserInfoEx/src/ctrl_contact.cpp | 8 ++++---- plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 4 ++-- plugins/UserInfoEx/src/mir_db.cpp | 4 ++-- plugins/UserInfoEx/src/psp_profile.cpp | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) (limited to 'plugins/UserInfoEx/src') diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index 3078c2f4bd..b736d434d4 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -265,13 +265,13 @@ int MAnnivDate::DBGetReminderOpts(MCONTACT hContact) _wDaysEarlier = db_get_w(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET, (WORD)-1); } else if (_wID <= ANID_LAST) { - CHAR pszSetting[MAXSETTING]; + char pszSetting[MAXSETTING]; // read reminder option - mir_snprintf(pszSetting, MAXSETTING, "Anniv%dReminder", _wID); + mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dReminder", _wID); _bRemind = db_get_b(hContact, Module(), pszSetting, BST_INDETERMINATE); // read offset - mir_snprintf(pszSetting, MAXSETTING, "Anniv%dOffset", _wID); + mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dOffset", _wID); _wDaysEarlier = db_get_w(hContact, Module(), pszSetting, (WORD)-1); } else { @@ -305,16 +305,16 @@ int MAnnivDate::DBWriteReminderOpts(MCONTACT hContact) db_set_w(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET, _wDaysEarlier); } else if (_wID <= ANID_LAST) { - CHAR pszSetting[MAXSETTING]; + char pszSetting[MAXSETTING]; // read reminder option - mir_snprintf(pszSetting, MAXSETTING, "Anniv%dReminder", _wID); + mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dReminder", _wID); if (_bRemind == BST_INDETERMINATE) db_unset(hContact, USERINFO, pszSetting); else db_set_b(hContact, USERINFO, pszSetting, _bRemind); // read offset - mir_snprintf(pszSetting, MAXSETTING, "Anniv%dOffset", _wID); + mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dOffset", _wID); if (_wDaysEarlier == (WORD)-1) db_unset(hContact, USERINFO, pszSetting); else diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index 8028dbc8a1..438c37dd4e 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -1349,7 +1349,7 @@ int CtrlContactAddMyItemsFromDB( cbi.pszIcon = szIcon; for (i = 0; - SUCCEEDED(mir_snprintf(pszSetting, MAXSETTING, szFormatVal, i)) && + SUCCEEDED(mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatVal, i)) && (cbi.wFlags = DB::Setting::GetTStringCtrl(hContact, pszModule, pszModule, pszProto, pszSetting, &dbv)); i++) { @@ -1360,7 +1360,7 @@ int CtrlContactAddMyItemsFromDB( dbv.ptszVal = NULL; // read category - if (SUCCEEDED(mir_snprintf(pszSetting, MAXSETTING, szFormatCat, i))) { + if (SUCCEEDED(mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatCat, i))) { if (cbi.wFlags & CTRLF_HASCUSTOM) { if (DB::Setting::GetTString(hContact, pszModule, pszSetting, &dbv)) dbv.type = DBVT_DELETED; @@ -1480,13 +1480,13 @@ int CtrlContactWriteMyItemsToDB( if (cbi.wFlags & CBEXIF_SMS) { mir_tstrncat(szVal, _T(" SMS"), SIZEOF(szVal)); } - mir_snprintf(pszSetting, MAXSETTING, szFormatCat, i); + mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatCat, i); if (*szCat && _tcsncmp(szCat, pszOther, ccOther)) { if (db_set_ts(hContact, pszModule, pszSetting, szCat)) return 1; } else db_unset(hContact, pszModule, pszSetting); - mir_snprintf(pszSetting, MAXSETTING, szFormatVal, i); + mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatVal, i); if (db_set_ts(hContact, pszModule, pszSetting, szVal)) return 1; cbi.wFlags &= ~CTRLF_CHANGED; cbi.wMask = CBEXIM_FLAGS; diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index 234c070383..3f24799ba9 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -868,11 +868,11 @@ public: if (_hDlg) { // save list state if (_hList) { - CHAR pszSetting[MAXSETTING]; + char pszSetting[MAXSETTING]; int c, cc = Header_GetItemCount(ListView_GetHeader(_hList)); for (c = 0; c < cc; c++) { - mir_snprintf(pszSetting, MAXSETTING, "AnnivDlg_Col%d", c); + mir_snprintf(pszSetting, SIZEOF(pszSetting), "AnnivDlg_Col%d", c); db_set_w(NULL, MODNAME, pszSetting, (WORD)ListView_GetColumnWidth(_hList, c)); } DeleteAllItems(); diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index e0a577d7b8..6730104dfd 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -387,9 +387,9 @@ BYTE Exists(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) void DeleteArray(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszFormat, int iStart) { - CHAR pszSetting[MAXSETTING]; + char pszSetting[MAXSETTING]; do { - mir_snprintf(pszSetting, MAXSETTING, pszFormat, iStart++); + mir_snprintf(pszSetting, SIZEOF(pszSetting), pszFormat, iStart++); } while (!db_unset(hContact, pszModule, pszSetting)); } diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index d8267f28bc..edeb7e472c 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -487,12 +487,12 @@ static int ProfileList_AddItemlistFromDB( for (i = 0, lvi.iItem = iItem; ; i++) { // read the setting from db - mir_snprintf(pszSetting, MAXSETTING, szValFormat, i); + mir_snprintf(pszSetting, SIZEOF(pszSetting), szValFormat, i); if (DB::Setting::GetTString(hContact, pszModule, pszSetting, &dbvVal)) break; if (dbvVal.type != DBVT_TCHAR) continue; - mir_snprintf(pszSetting, MAXSETTING, szCatFormat, i); + mir_snprintf(pszSetting, SIZEOF(pszSetting), szCatFormat, i); DB::Setting::GetAString(hContact, pszModule, pszSetting, &dbvCat); // create the itemobject if (!(pItem = (LPLCITEM)mir_alloc(sizeof(LCITEM)))) { @@ -1219,10 +1219,10 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR if (!pItem->pszText[1] || !*pItem->pszText[1]) continue; if (!(pItem->wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA))) { - mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szValFmt, iItem); + mir_snprintf(pszSetting, SIZEOF(pszSetting), pFmt[iFmt].szValFmt, iItem); db_set_ts(hContact, pszModule, pszSetting, pItem->pszText[1]); // save category - mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szCatFmt, iItem); + mir_snprintf(pszSetting, SIZEOF(pszSetting), pFmt[iFmt].szCatFmt, iItem); if (pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount) db_set_s(hContact, pszModule, pszSetting, (LPSTR)pItem->idstrList[pItem->iListItem].pszText); else if (pItem->pszText[0] && *pItem->pszText[0]) -- cgit v1.2.3