Module: wine Branch: master Commit: c5ad37baf0d4a4d14dd9bb07ca7a033ca0cdd018 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c5ad37baf0d4a4d14dd9bb07ca...
Author: Joachim Priesner joachim.priesner@web.de Date: Wed Jun 3 00:14:08 2015 +0200
comdlg32: File dialog: Append multi-part extensions like .abc.def.
---
dlls/comdlg32/filedlg.c | 5 +++-- dlls/comdlg32/tests/filedlg.c | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index 2890108..1453396 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -2596,10 +2596,11 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) filterSearchIndex[0] = '\0'; }
+ /* find the file extension by searching for the first dot in filterExt */ /* strip the * or anything else from the extension, "*.abc" becomes "abc" */ /* if the extension is invalid or contains a glob, ignore it */ - filterSearchIndex = PathFindExtensionW(filterExt); - if (*filterSearchIndex++ && !strchrW(filterSearchIndex, '*') && !strchrW(filterSearchIndex, '?')) + filterSearchIndex = strchrW(filterExt, '.'); + if (filterSearchIndex++ && !strchrW(filterSearchIndex, '*') && !strchrW(filterSearchIndex, '?')) { strcpyW(filterExt, filterSearchIndex); } diff --git a/dlls/comdlg32/tests/filedlg.c b/dlls/comdlg32/tests/filedlg.c index e3d9bc7..49a430c 100644 --- a/dlls/comdlg32/tests/filedlg.c +++ b/dlls/comdlg32/tests/filedlg.c @@ -1130,6 +1130,11 @@ static void test_extension(void) for (i = 0; i < ARRAY_SIZE(defext_wildcard_filters); i++) { test_extension_helper(&ofn, defext_wildcard_filters[i], "deadbeef.xyz"); } + + /* Append valid extensions consisting of multiple parts */ + test_extension_helper(&ofn, "TestFilter (*.abc.def)\0*.abc.def\0", "deadbeef.abc.def"); + test_extension_helper(&ofn, "TestFilter (.abc.def)\0.abc.def\0", "deadbeef.abc.def"); + test_extension_helper(&ofn, "TestFilter (*.*.def)\0*.*.def\0", "deadbeef.xyz"); }
#undef ARRAY_SIZE