From ce745b5c14b000c3aec9b9c92769da5adebda5e9 Mon Sep 17 00:00:00 2001 From: Tobias Weimer <wishmaster51@googlemail.com> Date: Sun, 1 Mar 2015 17:40:01 +0000 Subject: NewXStatusNotify: - minor bugfixes git-svn-id: http://svn.miranda-ng.org/main/trunk@12292 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewXstatusNotify/src/indsnd.cpp | 10 +++++----- plugins/NewXstatusNotify/src/main.cpp | 2 +- plugins/NewXstatusNotify/src/options.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp index a8d421353c..66f761b171 100644 --- a/plugins/NewXstatusNotify/src/indsnd.cpp +++ b/plugins/NewXstatusNotify/src/indsnd.cpp @@ -58,7 +58,7 @@ BOOL RemoveSoundFromList(HWND hList) return FALSE; } -TCHAR *SelectSound(HWND hwndDlg, TCHAR *buff) +TCHAR *SelectSound(HWND hwndDlg, TCHAR *buff, size_t bufflen) { OPENFILENAME ofn = { 0 }; @@ -171,11 +171,11 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA lvi.iItem = ListView_InsertItem(hList, &lvi); if (!db_get_ts(hContact, MODULE, StatusList[i].lpzSkinSoundName, &dbv)) { - _tcscpy(buff, dbv.ptszVal); + _tcsncpy(buff, dbv.ptszVal, SIZEOF(buff)-1); db_free(&dbv); } else - _tcscpy(buff, TranslateT(DEFAULT_SOUND)); + _tcsncpy(buff, TranslateT(DEFAULT_SOUND), SIZEOF(buff)-1); ListView_SetItemText(hList, lvi.iItem, 1, buff); } @@ -203,7 +203,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int iSel = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_INDSNDLIST), -1, LVNI_SELECTED); if (iSel != -1) { TCHAR stzFilePath[MAX_PATH]; - if (SelectSound(hwndDlg, stzFilePath) != NULL) { + if (SelectSound(hwndDlg, stzFilePath, MAX_PATH - 1) != NULL) { iSel = -1; while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1) ListView_SetItemText(hList, iSel, 1, stzFilePath); @@ -263,7 +263,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_INDSNDLIST: if (((LPNMHDR)lParam)->code == NM_DBLCLK) { TCHAR stzFilePath[MAX_PATH]; - if (SelectSound(hwndDlg, stzFilePath) != NULL) { + if (SelectSound(hwndDlg, stzFilePath, MAX_PATH - 1) != NULL) { int iSel = -1; HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST); while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1) diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 14cdf6b503..6c20f4b169 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -343,7 +343,7 @@ void PlayChangeSound(MCONTACT hContact, const char *name) DBVARIANT dbv; TCHAR stzSoundFile[MAX_PATH] = { 0 }; if (!db_get_ts(hContact, MODULE, name, &dbv)) { - _tcscpy(stzSoundFile, dbv.ptszVal); + _tcsncpy(stzSoundFile, dbv.ptszVal, SIZEOF(stzSoundFile)-1); db_free(&dbv); } diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 811fe50d2a..950486472f 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -352,9 +352,9 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM { WORD idCtrl = LOWORD(wParam); if (HIWORD(wParam) == CPN_COLOURCHANGED) { - if (idCtrl > 40070) { + if (idCtrl >= IDC_CHK_OFFLINE) { COLORREF colour = SendDlgItemMessage(hwndDlg, idCtrl, CPM_GETCOLOUR, 0, 0); - if ((idCtrl > 41070) && (idCtrl < 42070)) //Text colour + if ((idCtrl >= IDC_OFFLINE_TX) && (idCtrl <= IDC_ONTHEPHONE_TX)) //Text colour StatusList[Index(idCtrl - 1000)].colorText = colour; else //Background colour StatusList[Index(idCtrl - 2000)].colorBack = colour; -- cgit v1.2.3