diff options
author | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-09 00:59:27 +0000 |
---|---|---|
committer | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-09 00:59:27 +0000 |
commit | 36472b00443e23acf28b0dd26ddc2c2e6216d909 (patch) | |
tree | a526bbc6d309e05f1728b772620c9272f9ab8c4a /plugins/BasicHistory | |
parent | 163ce5127e5c8244bccbdae72107ad101f70575f (diff) |
code cleanup over mir_sntprintf + small bug fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@11295 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BasicHistory')
-rw-r--r-- | plugins/BasicHistory/src/EventList.cpp | 4 | ||||
-rw-r--r-- | plugins/BasicHistory/src/ExportManager.cpp | 3 | ||||
-rw-r--r-- | plugins/BasicHistory/src/Options.cpp | 4 | ||||
-rw-r--r-- | plugins/BasicHistory/src/Searcher.cpp | 4 |
4 files changed, 8 insertions, 7 deletions
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 2e4056c843..c10b883001 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -346,11 +346,11 @@ void EventList::InitNames() TCHAR str[200];
if (hContact) {
_tcscpy_s(contactName, 256, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR ));
- mir_sntprintf(str,200,TranslateT("History for %s"),contactName);
+ mir_sntprintf(str, SIZEOF(str), TranslateT("History for %s"),contactName);
}
else {
_tcscpy_s(contactName, 256, TranslateT("System"));
- mir_sntprintf(str,200,TranslateT("History"));
+ mir_sntprintf(str, SIZEOF(str), TranslateT("History"));
}
if (isWnd)
diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index 853d2d0229..734ef0971d 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -38,11 +38,12 @@ std::wstring GetFile(const TCHAR* ext, HWND hwnd, bool open) TCHAR filter[512];
std::locale loc;
TCHAR extUpper[32];
+
_tcscpy_s(extUpper, ext);
extUpper[0] = std::toupper(ext[0], loc);
mir_sntprintf(filter, SIZEOF(filter), TranslateT("%s Files (*.%s)"), extUpper, ext);
size_t len = _tcslen(filter) + 1;
- mir_sntprintf(filter + len, 512 - len, _T("*.%s"), ext);
+ mir_sntprintf(filter + len, SIZEOF(filter) - len, _T("*.%s"), ext);
len += _tcslen(filter + len);
filter[++len] = 0;
TCHAR stzFilePath[1024];
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 8f4f9fcc09..a8b45afc8c 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -815,7 +815,7 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const TCHAR* defName, const TCHAR* extUpper[0] = std::toupper(ext[0], loc);
mir_sntprintf(filter, SIZEOF(filter), TranslateT("%s Files (*.%s)"), extUpper, ext);
size_t len = _tcslen(filter) + 1;
- mir_sntprintf(filter + len, 1024 - len, _T("*.%s"), ext);
+ mir_sntprintf(filter + len, SIZEOF(filter) - len, _T("*.%s"), ext);
len += _tcslen(filter + len) + 1;
_tcscpy_s(filter + len, 1024 - len, TranslateT("All Files (*.*)"));
len += _tcslen(filter + len) + 1;
@@ -1291,7 +1291,7 @@ void InitCodepageCB(HWND hwndCB, unsigned int codepage, const std::wstring& name if (selCpIdx == -1) {
TCHAR buf[300];
- mir_sntprintf(buf, 300, _T("%d;%s"), codepage, name.c_str());
+ mir_sntprintf(buf, SIZEOF(buf), _T("%d;%s"), codepage, name.c_str());
ComboBox_SetText(hwndCB, buf);
}
else ComboBox_SetCurSel(hwndCB, selCpIdx);
diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp index 5282df39d6..6370ce783e 100644 --- a/plugins/BasicHistory/src/Searcher.cpp +++ b/plugins/BasicHistory/src/Searcher.cpp @@ -105,7 +105,7 @@ void Searcher::Find() GetWindowText(context->findWindow, str, SIZEOF(str));
if (!str[0]) {
TCHAR buf[256];
- mir_sntprintf(buf, 256, TranslateT("\"%s\" not found"), str);
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("\"%s\" not found"), str);
MessageBox(context->hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
return;
}
@@ -299,7 +299,7 @@ void Searcher::Find() if (isStart) {
TCHAR buf[256];
GetWindowText(context->findWindow, str, SIZEOF(str));
- mir_sntprintf(buf, 256, TranslateT("\"%s\" not found"), str);
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("\"%s\" not found"), str);
MessageBox(context->hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
}
else MessageBox(context->hWnd, TranslateTS(onlyGroup ? LPGENT("You have reached the end of the group.") : LPGENT("You have reached the end of the history.")), TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
|