Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7b7f4c61
Commit
7b7f4c61
authored
Sep 03, 2014
by
David Hedberg
Committed by
Alexandre Julliard
Sep 04, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32: ::SetFileTypeIndex and ::GetFileTypeIndex uses a one-based index.
parent
4cda4195
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
itemdlg.c
dlls/comdlg32/itemdlg.c
+7
-5
itemdlg.c
dlls/comdlg32/tests/itemdlg.c
+17
-5
No files found.
dlls/comdlg32/itemdlg.c
View file @
7b7f4c61
...
...
@@ -1880,10 +1880,9 @@ static HRESULT WINAPI IFileDialog2_fnSetFileTypeIndex(IFileDialog2 *iface, UINT
if
(
!
This
->
filterspecs
)
return
E_FAIL
;
if
(
iFileType
>=
This
->
filterspec_count
)
This
->
filetypeindex
=
This
->
filterspec_count
-
1
;
else
This
->
filetypeindex
=
iFileType
;
iFileType
=
max
(
iFileType
,
1
);
iFileType
=
min
(
iFileType
,
This
->
filterspec_count
);
This
->
filetypeindex
=
iFileType
-
1
;
return
S_OK
;
}
...
...
@@ -1896,7 +1895,10 @@ static HRESULT WINAPI IFileDialog2_fnGetFileTypeIndex(IFileDialog2 *iface, UINT
if
(
!
piFileType
)
return
E_INVALIDARG
;
*
piFileType
=
This
->
filetypeindex
;
if
(
This
->
filterspec_count
==
0
)
*
piFileType
=
0
;
else
*
piFileType
=
This
->
filetypeindex
+
1
;
return
S_OK
;
}
...
...
dlls/comdlg32/tests/itemdlg.c
View file @
7b7f4c61
...
...
@@ -643,8 +643,6 @@ static void test_basics(void)
hr
=
IFileOpenDialog_SetFileTypes
(
pfod
,
0
,
filterspec
);
ok
(
hr
==
S_OK
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileOpenDialog_SetFileTypeIndex
(
pfod
,
-
1
);
ok
(
hr
==
E_FAIL
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileOpenDialog_SetFileTypeIndex
(
pfod
,
0
);
ok
(
hr
==
E_FAIL
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileOpenDialog_SetFileTypeIndex
(
pfod
,
1
);
...
...
@@ -655,25 +653,39 @@ static void test_basics(void)
ok
(
hr
==
E_UNEXPECTED
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileOpenDialog_SetFileTypeIndex
(
pfod
,
0
);
ok
(
hr
==
S_OK
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileOpenDialog_GetFileTypeIndex
(
pfod
,
&
filetype
);
ok
(
hr
==
S_OK
,
"got 0x%08x.
\n
"
,
hr
);
ok
(
filetype
==
1
,
"got %d
\n
"
,
filetype
);
hr
=
IFileOpenDialog_SetFileTypeIndex
(
pfod
,
100
);
ok
(
hr
==
S_OK
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileOpenDialog_GetFileTypeIndex
(
pfod
,
&
filetype
);
ok
(
hr
==
S_OK
,
"got 0x%08x.
\n
"
,
hr
);
ok
(
filetype
==
1
,
"got %d
\n
"
,
filetype
);
hr
=
IFileOpenDialog_SetFileTypes
(
pfod
,
1
,
filterspec
);
ok
(
hr
==
E_UNEXPECTED
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileOpenDialog_SetFileTypes
(
pfod
,
1
,
&
filterspec
[
1
]);
ok
(
hr
==
E_UNEXPECTED
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileSaveDialog_SetFileTypeIndex
(
pfsd
,
-
1
);
ok
(
hr
==
E_FAIL
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileSaveDialog_SetFileTypeIndex
(
pfsd
,
0
);
ok
(
hr
==
E_FAIL
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileSaveDialog_SetFileTypeIndex
(
pfsd
,
1
);
ok
(
hr
==
E_FAIL
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileSaveDialog_SetFileTypes
(
pfsd
,
1
,
filterspec
);
hr
=
IFileSaveDialog_SetFileTypes
(
pfsd
,
2
,
filterspec
);
ok
(
hr
==
S_OK
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileSaveDialog_GetFileTypeIndex
(
pfsd
,
&
filetype
);
ok
(
hr
==
S_OK
,
"got 0x%08x.
\n
"
,
hr
);
/* I hope noone relies on this one */
todo_wine
ok
(
filetype
==
0
,
"got %d
\n
"
,
filetype
);
hr
=
IFileSaveDialog_SetFileTypeIndex
(
pfsd
,
0
);
ok
(
hr
==
S_OK
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileSaveDialog_GetFileTypeIndex
(
pfsd
,
&
filetype
);
ok
(
hr
==
S_OK
,
"got 0x%08x.
\n
"
,
hr
);
ok
(
filetype
==
1
,
"got %d
\n
"
,
filetype
);
hr
=
IFileSaveDialog_SetFileTypeIndex
(
pfsd
,
100
);
ok
(
hr
==
S_OK
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileSaveDialog_GetFileTypeIndex
(
pfsd
,
&
filetype
);
ok
(
hr
==
S_OK
,
"got 0x%08x.
\n
"
,
hr
);
ok
(
filetype
==
2
,
"got %d
\n
"
,
filetype
);
hr
=
IFileSaveDialog_SetFileTypes
(
pfsd
,
1
,
filterspec
);
ok
(
hr
==
E_UNEXPECTED
,
"got 0x%08x.
\n
"
,
hr
);
hr
=
IFileSaveDialog_SetFileTypes
(
pfsd
,
1
,
&
filterspec
[
1
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment