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 --- src/core/stdclist/src/clcopts.cpp | 15 +++--- src/mir_core/mir_core_10.vcxproj | 1 + src/mir_core/mir_core_10.vcxproj.filters | 3 ++ src/mir_core/mir_core_12.vcxproj | 2 + src/mir_core/mir_core_12.vcxproj.filters | 6 +++ src/mir_core/src/mir_core.def | 9 ++-- src/mir_core/src/mir_core64.def | 9 ++-- src/modules/utils/bmpfilter.cpp | 92 -------------------------------- 8 files changed, 25 insertions(+), 112 deletions(-) (limited to 'src') diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index 83e9154511..2350d7d947 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -334,24 +334,23 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } 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)); - 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); + BmpFilterGetStrings(filter, SIZEOF(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/src/mir_core/mir_core_10.vcxproj b/src/mir_core/mir_core_10.vcxproj index 24abcbe7f0..8770eb8e40 100644 --- a/src/mir_core/mir_core_10.vcxproj +++ b/src/mir_core/mir_core_10.vcxproj @@ -37,6 +37,7 @@ + diff --git a/src/mir_core/mir_core_10.vcxproj.filters b/src/mir_core/mir_core_10.vcxproj.filters index 8162971b59..7160a06293 100644 --- a/src/mir_core/mir_core_10.vcxproj.filters +++ b/src/mir_core/mir_core_10.vcxproj.filters @@ -112,6 +112,9 @@ Source Files + + Source Files + diff --git a/src/mir_core/mir_core_12.vcxproj b/src/mir_core/mir_core_12.vcxproj index 3c9ae7f200..626835ac80 100644 --- a/src/mir_core/mir_core_12.vcxproj +++ b/src/mir_core/mir_core_12.vcxproj @@ -28,6 +28,7 @@ + @@ -40,6 +41,7 @@ + diff --git a/src/mir_core/mir_core_12.vcxproj.filters b/src/mir_core/mir_core_12.vcxproj.filters index 18af03d46d..ec0939a562 100644 --- a/src/mir_core/mir_core_12.vcxproj.filters +++ b/src/mir_core/mir_core_12.vcxproj.filters @@ -112,6 +112,9 @@ Source Files\json + + Source Files + @@ -171,6 +174,9 @@ Header Files + + Header Files + diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index ef180d7bdd..838a1d4b0b 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -372,8 +372,6 @@ mir_wstrcmpi @280 ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QAEAAV0@PBD@Z @370 NONAME ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QAEAAV0@PB_W@Z @371 NONAME ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QAEAAV0@_W@Z @372 NONAME -?AllocSysString@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBEPA_WXZ @373 NONAME -?AllocSysString@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QBEPA_WXZ @374 NONAME ?Append@?$CMSimpleStringT@D@@QAEXABV1@@Z @375 NONAME ?Append@?$CMSimpleStringT@D@@QAEXPBD@Z @376 NONAME ?Append@?$CMSimpleStringT@D@@QAEXPBDH@Z @377 NONAME @@ -500,8 +498,6 @@ mir_wstrcmpi @280 ?SetString@?$CMSimpleStringT@D@@QAEXPBDH@Z @498 NONAME ?SetString@?$CMSimpleStringT@_W@@QAEXPB_W@Z @499 NONAME ?SetString@?$CMSimpleStringT@_W@@QAEXPB_WH@Z @500 NONAME -?SetSysString@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBEPA_WPAPA_W@Z @501 NONAME -?SetSysString@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QBEPA_WPAPA_W@Z @502 NONAME ?SpanExcluding@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBE?AV1@PBD@Z @503 NONAME ?SpanExcluding@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QBE?AV1@PB_W@Z @504 NONAME ?SpanIncluding@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBE?AV1@PBD@Z @505 NONAME @@ -731,8 +727,8 @@ mir_wstrcmpi @280 ?DeleteItem@CCtrlTreeView@@QAEXPAU_TREEITEM@@@Z @731 NONAME ?DeleteString@CCtrlCombo@@QAEXH@Z @732 NONAME ?DeleteString@CCtrlListBox@@QAEXH@Z @733 NONAME -?Detouch@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBEPADXZ @734 NONAME -?Detouch@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QBEPA_WXZ @735 NONAME +?Detach@?$CMStringT@DV?$ChTraitsCRT@D@@@@QBEPADXZ @734 NONAME +?Detach@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QBEPA_WXZ @735 NONAME ?Disable@CCtrlBase@@QAEXXZ @736 NONAME ?DlgProc@CDlgBase@@MAEHIIJ@Z @737 NONAME ?DlgProc@CProtoIntDlgBase@@MAEHIIJ@Z @738 NONAME @@ -1242,3 +1238,4 @@ Proto_RegisterModule @1074 NONAME ?isnull@JSONNode@@QBE_NXZ @1245 NONAME ??BJSONNode@@QBE_NXZ @1246 NONAME ?as_mstring@JSONNode@@QBE?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@XZ @1247 NONAME +BmpFilterGetStrings @1248 diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index c75553762f..248599e8b9 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -372,8 +372,6 @@ mir_wstrcmpi @280 ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEAAAEAV0@PEBD@Z @370 NONAME ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEAAAEAV0@PEB_W@Z @371 NONAME ??Y?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEAAAEAV0@_W@Z @372 NONAME -?AllocSysString@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBAPEA_WXZ @373 NONAME -?AllocSysString@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEBAPEA_WXZ @374 NONAME ?Append@?$CMSimpleStringT@D@@QEAAXAEBV1@@Z @375 NONAME ?Append@?$CMSimpleStringT@D@@QEAAXPEBD@Z @376 NONAME ?Append@?$CMSimpleStringT@D@@QEAAXPEBDH@Z @377 NONAME @@ -500,8 +498,6 @@ mir_wstrcmpi @280 ?SetString@?$CMSimpleStringT@D@@QEAAXPEBDH@Z @498 NONAME ?SetString@?$CMSimpleStringT@_W@@QEAAXPEB_W@Z @499 NONAME ?SetString@?$CMSimpleStringT@_W@@QEAAXPEB_WH@Z @500 NONAME -?SetSysString@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBAPEA_WPEAPEA_W@Z @501 NONAME -?SetSysString@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEBAPEA_WPEAPEA_W@Z @502 NONAME ?SpanExcluding@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBA?AV1@PEBD@Z @503 NONAME ?SpanExcluding@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEBA?AV1@PEB_W@Z @504 NONAME ?SpanIncluding@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBA?AV1@PEBD@Z @505 NONAME @@ -731,8 +727,8 @@ mir_wstrcmpi @280 ?DeleteItem@CCtrlTreeView@@QEAAXPEAU_TREEITEM@@@Z @731 NONAME ?DeleteString@CCtrlCombo@@QEAAXH@Z @732 NONAME ?DeleteString@CCtrlListBox@@QEAAXH@Z @733 NONAME -?Detouch@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBAPEADXZ @734 NONAME -?Detouch@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEBAPEA_WXZ @735 NONAME +?Detach@?$CMStringT@DV?$ChTraitsCRT@D@@@@QEBAPEADXZ @734 NONAME +?Detach@?$CMStringT@_WV?$ChTraitsCRT@_W@@@@QEBAPEA_WXZ @735 NONAME ?Disable@CCtrlBase@@QEAAXXZ @736 NONAME ?DlgProc@CDlgBase@@MEAA_JI_K_J@Z @737 NONAME ?DlgProc@CProtoIntDlgBase@@MEAA_JI_K_J@Z @738 NONAME @@ -1242,3 +1238,4 @@ Proto_RegisterModule @1074 NONAME ?isnull@JSONNode@@QEBA_NXZ @1245 NONAME ??BJSONNode@@QEBA_NXZ @1246 NONAME ?as_mstring@JSONNode@@QEBA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@XZ @1247 NONAME +BmpFilterGetStrings @1248 diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp index dddc7b8ca0..cd9d061e20 100644 --- a/src/modules/utils/bmpfilter.cpp +++ b/src/modules/utils/bmpfilter.cpp @@ -138,101 +138,9 @@ static INT_PTR BmpFilterLoadBitmapW(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////////////// -static INT_PTR BmpFilterGetStrings(WPARAM wParam, LPARAM lParam) -{ - size_t bytesLeft = wParam; - char *filter = (char*)lParam, *pfilter; - - mir_strncpy(filter, Translate("All bitmaps"), bytesLeft); bytesLeft -= mir_strlen(filter); - mir_strncat(filter, " (*.bmp;*.jpg;*.gif;*.png)", bytesLeft); - pfilter = filter + mir_strlen(filter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_strncpy(pfilter, "*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG", bytesLeft); - pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - mir_strncpy(pfilter, Translate("Windows bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter); - mir_strncat(pfilter, " (*.bmp;*.rle)", bytesLeft); - pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_strncpy(pfilter, "*.BMP;*.RLE", bytesLeft); - pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - mir_strncpy(pfilter, Translate("JPEG bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter); - mir_strncat(pfilter, " (*.jpg;*.jpeg)", bytesLeft); - pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_strncpy(pfilter, "*.JPG;*.JPEG", bytesLeft); - pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - mir_strncpy(pfilter, Translate("GIF bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter); - mir_strncat(pfilter, " (*.gif)", bytesLeft); - pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_strncpy(pfilter, "*.GIF", bytesLeft); - pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - mir_strncpy(pfilter, Translate("PNG bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter); - mir_strncat(pfilter, " (*.png)", bytesLeft); - pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_strncpy(pfilter, "*.PNG", bytesLeft); - pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - mir_strncpy(pfilter, Translate("All files"), bytesLeft); bytesLeft -= mir_strlen(pfilter); - mir_strncat(pfilter, " (*)", bytesLeft); - pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_strncpy(pfilter, "*", bytesLeft); - pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - if (bytesLeft) *pfilter = '\0'; - return 0; -} - -static INT_PTR BmpFilterGetStringsW(WPARAM wParam, LPARAM lParam) -{ - size_t bytesLeft = wParam; - TCHAR *filter = (TCHAR*)lParam, *pfilter; - - mir_tstrncpy(filter, TranslateT("All bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(filter); - mir_tstrncat(filter, _T(" (*.bmp;*.jpg;*.gif;*.png)"), bytesLeft); - pfilter = filter + mir_tstrlen(filter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_tstrncpy(pfilter, _T("*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG"), bytesLeft); - pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - mir_tstrncpy(pfilter, TranslateT("Windows bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter); - mir_tstrncat(pfilter, _T(" (*.bmp;*.rle)"), bytesLeft); - pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_tstrncpy(pfilter, _T("*.BMP;*.RLE"), bytesLeft); - pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - mir_tstrncpy(pfilter, TranslateT("JPEG bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter); - mir_tstrncat(pfilter, _T(" (*.jpg;*.jpeg)"), bytesLeft); - pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_tstrncpy(pfilter, _T("*.JPG;*.JPEG"), bytesLeft); - pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - mir_tstrncpy(pfilter, TranslateT("GIF bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter); - mir_tstrncat(pfilter, _T(" (*.gif)"), bytesLeft); - pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_tstrncpy(pfilter, _T("*.GIF"), bytesLeft); - pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - mir_tstrncpy(pfilter, TranslateT("PNG bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter); - mir_tstrncat(pfilter, _T(" (*.png)"), bytesLeft); - pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_tstrncpy(pfilter, _T("*.PNG"), bytesLeft); - pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - mir_tstrncpy(pfilter, TranslateT("All files"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter); - mir_tstrncat(pfilter, _T(" (*)"), bytesLeft); - pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - mir_tstrncpy(pfilter, _T("*"), bytesLeft); - pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter); - - if (bytesLeft) *pfilter = '\0'; - return 0; -} - int InitBitmapFilter(void) { CreateServiceFunction(MS_UTILS_LOADBITMAP, BmpFilterLoadBitmap); - CreateServiceFunction(MS_UTILS_GETBITMAPFILTERSTRINGS, BmpFilterGetStrings); - CreateServiceFunction(MS_UTILS_GETBITMAPFILTERSTRINGSW, BmpFilterGetStringsW); CreateServiceFunction(MS_UTILS_LOADBITMAPW, BmpFilterLoadBitmapW); return 0; } -- cgit v1.2.3