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
384ece4d
Commit
384ece4d
authored
Jul 28, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 28, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32/itemdlg: Fix setting NULL file name (Coverity).
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
92e9f440
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
itemdlg.c
dlls/comdlg32/itemdlg.c
+4
-8
itemdlg.c
dlls/comdlg32/tests/itemdlg.c
+15
-0
No files found.
dlls/comdlg32/itemdlg.c
View file @
384ece4d
...
...
@@ -384,14 +384,12 @@ static UINT get_file_name(FileDialogImpl *This, LPWSTR *str)
static
BOOL
set_file_name
(
FileDialogImpl
*
This
,
LPCWSTR
str
)
{
HWND
hwnd_edit
=
GetDlgItem
(
This
->
dlg_hwnd
,
IDC_FILENAME
);
if
(
This
->
set_filename
)
LocalFree
(
This
->
set_filename
);
This
->
set_filename
=
StrDupW
(
str
)
;
This
->
set_filename
=
str
?
StrDupW
(
str
)
:
NULL
;
return
Se
ndMessageW
(
hwnd_edit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
str
);
return
Se
tDlgItemTextW
(
This
->
dlg_hwnd
,
IDC_FILENAME
,
This
->
set_filename
);
}
static
void
fill_filename_from_selection
(
FileDialogImpl
*
This
)
...
...
@@ -2608,10 +2606,8 @@ static HRESULT WINAPI IFileDialog2_fnGetFileName(IFileDialog2 *iface, LPWSTR *ps
return
E_INVALIDARG
;
*
pszName
=
NULL
;
if
(
get_file_name
(
This
,
pszName
))
return
S_OK
;
else
return
E_FAIL
;
get_file_name
(
This
,
pszName
);
return
*
pszName
?
S_OK
:
E_FAIL
;
}
static
HRESULT
WINAPI
IFileDialog2_fnSetTitle
(
IFileDialog2
*
iface
,
LPCWSTR
pszTitle
)
...
...
dlls/comdlg32/tests/itemdlg.c
View file @
384ece4d
...
...
@@ -797,6 +797,21 @@ static void test_basics(void)
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IFileOpenDialog_SetFileName
(
pfod
,
null
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
filename
=
NULL
;
hr
=
IFileOpenDialog_GetFileName
(
pfod
,
&
filename
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
filename
,
null
),
"Strings do not match.
\n
"
);
CoTaskMemFree
(
filename
);
hr
=
IFileOpenDialog_SetFileName
(
pfod
,
NULL
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
filename
=
(
void
*
)
0xdeadbeef
;
hr
=
IFileOpenDialog_GetFileName
(
pfod
,
&
filename
);
ok
(
hr
==
E_FAIL
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
filename
==
NULL
,
"got %p.
\n
"
,
filename
);
hr
=
IFileOpenDialog_SetFileName
(
pfod
,
txt
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IFileOpenDialog_GetFileName
(
pfod
,
&
filename
);
...
...
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