From 84b5cac8e0f148250c44fc91d7d9752dca13dbb6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 28 May 2015 17:16:36 +0000 Subject: - MS_UTILS_GETBITMAPFILTERSTRINGS - end of story, replaced with BmpFilterGetStrings(); - parasite mir_strncat's removed from bitmap filter creation; - CMString::AllocSysString/SetSysString removed due to complete uselessness; - CMString::Detouch - typo fixed. git-svn-id: http://svn.miranda-ng.org/main/trunk@13881 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AVS/src/options.cpp | 9 +++------ plugins/AVS/src/services.cpp | 20 +++++++++----------- plugins/AvatarHistory/src/AvatarDlg.cpp | 11 +++++------ plugins/Clist_modern/src/modern_clcopts.cpp | 7 +++---- plugins/Clist_nicer/src/clcopts.cpp | 16 ++++++++-------- plugins/FloatingContacts/src/options.cpp | 18 ++++++++---------- plugins/Nudge/src/headers.h | 2 -- plugins/TabSRMM/src/chat/log.cpp | 4 ++-- plugins/TabSRMM/src/msglog.cpp | 4 ++-- plugins/Variables/src/parse_metacontacts.cpp | 6 +++--- 10 files changed, 43 insertions(+), 54 deletions(-) (limited to 'plugins') diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 4506c4011f..02ec9a34e0 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -99,13 +99,10 @@ static void RemoveProtoPic(const char *szProto) static void SetProtoPic(char *szProto) { - TCHAR FileName[MAX_PATH]; - OPENFILENAME ofn = { 0 }; - TCHAR filter[256]; - - filter[0] = '\0'; - CallService(MS_UTILS_GETBITMAPFILTERSTRINGST, SIZEOF(filter), (LPARAM)filter); + TCHAR FileName[MAX_PATH], filter[256]; + BmpFilterGetStrings(filter, SIZEOF(filter)); + OPENFILENAME ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.lpstrFilter = filter; ofn.hwndOwner = 0; diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index e7e19cab09..7411849efa 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -127,12 +127,10 @@ static INT_PTR avSetAvatar(MCONTACT hContact, TCHAR *tszPath) int is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); if (tszPath == NULL) { - OPENFILENAME ofn = { 0 }; TCHAR filter[256]; + BmpFilterGetStrings(filter, SIZEOF(filter)); - filter[0] = '\0'; - CallService(MS_UTILS_GETBITMAPFILTERSTRINGST, SIZEOF(filter), (LPARAM)filter); - + OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = 0; ofn.lpstrFile = FileName; @@ -257,7 +255,7 @@ static int InternalRemoveMyAvatar(char *protocol) static void FilterGetStrings(CMString &filter, BOOL xml, BOOL swf) { - filter.AppendFormat(_T("%s (*.bmp;*.jpg;*.gif;*.png"), TranslateT("All Files")); + filter.AppendFormat(_T("%s (*.bmp;*.jpg;*.gif;*.png"), TranslateT("All files")); if (swf) filter.Append(_T(";*.swf")); if (xml) filter.Append(_T(";*.xml")); @@ -266,16 +264,16 @@ static void FilterGetStrings(CMString &filter, BOOL xml, BOOL swf) if (xml) filter.Append(_T(";*.XML")); filter.AppendChar(0); - filter.AppendFormat(_T("%s (*.bmp;*.rle)%c*.BMP;*.RLE%c"), TranslateT("Windows Bitmaps"), 0, 0); - filter.AppendFormat(_T("%s (*.jpg;*.jpeg)%c*.JPG;*.JPEG%c"), TranslateT("JPEG Bitmaps"), 0, 0); - filter.AppendFormat(_T("%s (*.gif)%c*.GIF%c"), TranslateT("GIF Bitmaps"), 0, 0); - filter.AppendFormat(_T("%s (*.png)%c*.PNG%c"), TranslateT("PNG Bitmaps"), 0, 0); + filter.AppendFormat(_T("%s (*.bmp;*.rle)%c*.BMP;*.RLE%c"), TranslateT("Windows bitmaps"), 0, 0); + filter.AppendFormat(_T("%s (*.jpg;*.jpeg)%c*.JPG;*.JPEG%c"), TranslateT("JPEG bitmaps"), 0, 0); + filter.AppendFormat(_T("%s (*.gif)%c*.GIF%c"), TranslateT("GIF bitmaps"), 0, 0); + filter.AppendFormat(_T("%s (*.png)%c*.PNG%c"), TranslateT("PNG bitmaps"), 0, 0); if (swf) - filter.AppendFormat(_T("%s (*.swf)%c*.SWF%c"), TranslateT("Flash Animations"), 0, 0); + filter.AppendFormat(_T("%s (*.swf)%c*.SWF%c"), TranslateT("Flash animations"), 0, 0); if (xml) - filter.AppendFormat(_T("%s (*.xml)%c*.XML%c"), TranslateT("XML Files"), 0, 0); + filter.AppendFormat(_T("%s (*.xml)%c*.XML%c"), TranslateT("XML files"), 0, 0); filter.AppendChar(0); } diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index d94c292e82..3489960f50 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -537,15 +537,14 @@ static INT_PTR ShowDialogSvc(WPARAM wParam, LPARAM lParam) int ShowSaveDialog(HWND hwnd, TCHAR* fn, MCONTACT hContact) { - TCHAR filter[MAX_PATH]; - TCHAR file[MAX_PATH]; - OPENFILENAME ofn; - memset(&ofn, 0, sizeof(OPENFILENAME)); - ofn.lStructSize = sizeof(OPENFILENAME); + TCHAR filter[MAX_PATH], file[MAX_PATH]; + BmpFilterGetStrings(filter, SIZEOF(filter)); + + OPENFILENAME ofn = { 0 }; + ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwnd; ofn.hInstance = hInst; - CallService(MS_UTILS_GETBITMAPFILTERSTRINGST, MAX_PATH, (LPARAM)filter); ofn.lpstrFilter = filter; ofn.nFilterIndex = 1; diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index dacd58ece0..57c9025fe5 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -1368,14 +1368,13 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_COMMAND: if (LOWORD(wParam) == IDC_BROWSE) { - TCHAR str[MAX_PATH]; - TCHAR filter[512]; + TCHAR str[MAX_PATH], filter[512]; + BmpFilterGetStrings(filter, SIZEOF(filter)); + GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); OPENFILENAME ofn = { 0 }; - GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; - CallService(MS_UTILS_GETBITMAPFILTERSTRINGST, SIZEOF(filter), (LPARAM)filter); ofn.lpstrFilter = filter; ofn.lpstrFile = str; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index 9948c37ed3..23a6b172d4 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -740,26 +740,26 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, Utils::enableDlgControl(hwndDlg, IDC_SCROLL, IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); Utils::enableDlgControl(hwndDlg, IDC_PROPORTIONAL, IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); break; + case WM_COMMAND: if (LOWORD(wParam) == IDC_BROWSE) { - char str[MAX_PATH]; - OPENFILENAMEA ofn = { 0 }; - char filter[512]; + TCHAR str[MAX_PATH], filter[512]; + GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); + BmpFilterGetStrings(filter, SIZEOF(filter)); - GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); + OPENFILENAME ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; ofn.hInstance = NULL; - CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof(filter), (LPARAM)filter); ofn.lpstrFilter = filter; ofn.lpstrFile = str; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.nMaxFile = SIZEOF(str); ofn.nMaxFileTitle = MAX_PATH; - ofn.lpstrDefExt = "bmp"; - if (!GetOpenFileNameA(&ofn)) + ofn.lpstrDefExt = _T("bmp"); + if (!GetOpenFileName(&ofn)) break; - SetDlgItemTextA(hwndDlg, IDC_FILENAME, str); + SetDlgItemText(hwndDlg, IDC_FILENAME, str); } else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE) break; diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index b913ee7822..0571b83aa8 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -244,24 +244,22 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP case IDC_BROWSE: { - char str[MAX_PATH]; - OPENFILENAMEA ofn = {0}; - char filter[512]; + TCHAR str[MAX_PATH], filter[512]; + GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); + BmpFilterGetStrings(filter, SIZEOF(filter)); - GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); - ofn.lStructSize = sizeof(OPENFILENAMEA); + OPENFILENAME ofn = {0}; + ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; - CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof(filter), (LPARAM)filter); ofn.lpstrFilter = filter; ofn.lpstrFile = str; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.nMaxFile = SIZEOF(str); ofn.nMaxFileTitle = MAX_PATH; - ofn.lpstrDefExt = "bmp"; - if (!GetOpenFileNameA(&ofn)) + ofn.lpstrDefExt = _T("bmp"); + if (!GetOpenFileName(&ofn)) return FALSE; - SetDlgItemTextA(hwndDlg, IDC_FILENAME, str); + SetDlgItemText(hwndDlg, IDC_FILENAME, str); } break; diff --git a/plugins/Nudge/src/headers.h b/plugins/Nudge/src/headers.h index 26e9bb388c..5a1fa0e324 100644 --- a/plugins/Nudge/src/headers.h +++ b/plugins/Nudge/src/headers.h @@ -5,8 +5,6 @@ #define _CRT_SECURE_NO_WARNINGS -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - #include #include #include diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 1733c367ba..55bfc761b6 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -693,7 +693,7 @@ char* Log_CreateRtfHeader(MODULEINFO *mi) } str.AppendFormat("\\fi-%u\\li%u", iIndent, iIndent); - return str.Detouch(); + return str.Detach(); } static char* Log_CreateRTF(LOGSTREAMDATA *streamData) @@ -824,7 +824,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) str.Append("\\par}"); else str.Append("}"); - return str.Detouch(); + return str.Detach(); } static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb) diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 570065774e..abf43caaa6 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -334,7 +334,7 @@ static char* CreateRTFHeader(TWindowData *dat) { CMStringA str; Build_RTF_Header(str, dat); - return str.Detouch(); + return str.Detach(); } static void AppendTimeStamp(TCHAR *szFinalTimestamp, int isSent, CMStringA &str, int skipFont, TWindowData *dat, int iFontIDOffset) @@ -970,7 +970,7 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, dat->iLastEventType = MAKELONG((dbei.flags & (DBEF_SENT | DBEF_READ | DBEF_RTL)), dbei.eventType); dat->lastEventTime = dbei.timestamp; - return str.Detouch(); + return str.Detach(); } static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb) diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index 131b24518f..9992d0af5a 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -55,7 +55,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai) szUniqueID = mir_tstrdup(tszID); } - return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detouch(); + return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detach(); } static TCHAR *parseGetDefault(ARGUMENTSINFO *ai) @@ -95,7 +95,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai) szUniqueID = mir_tstrdup(tszID); } - return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detouch(); + return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detach(); } static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) @@ -135,7 +135,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) szUniqueID = mir_tstrdup(tszID); } - return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detouch(); + return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detach(); } void registerMetaContactsTokens() -- cgit v1.2.3