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
9c1f56f6
Commit
9c1f56f6
authored
Apr 01, 2011
by
David Hedberg
Committed by
Alexandre Julliard
Apr 01, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32: Factor out filename string splitting code.
parent
7f5ccd32
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
38 deletions
+50
-38
cdlg.h
dlls/comdlg32/cdlg.h
+1
-0
filedlg.c
dlls/comdlg32/filedlg.c
+49
-38
No files found.
dlls/comdlg32/cdlg.h
View file @
9c1f56f6
...
@@ -177,6 +177,7 @@ HRESULT FileSaveDialog_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
...
@@ -177,6 +177,7 @@ HRESULT FileSaveDialog_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
void
COMDLG32_GetCanonicalPath
(
PCIDLIST_ABSOLUTE
pidlAbsCurrent
,
LPWSTR
lpstrFile
,
LPWSTR
lpstrPathAndFile
);
void
COMDLG32_GetCanonicalPath
(
PCIDLIST_ABSOLUTE
pidlAbsCurrent
,
LPWSTR
lpstrFile
,
LPWSTR
lpstrPathAndFile
);
int
FILEDLG95_ValidatePathAction
(
LPWSTR
lpstrPathAndFile
,
IShellFolder
**
ppsf
,
int
FILEDLG95_ValidatePathAction
(
LPWSTR
lpstrPathAndFile
,
IShellFolder
**
ppsf
,
HWND
hwnd
,
DWORD
flags
,
BOOL
isSaveDlg
,
int
defAction
);
HWND
hwnd
,
DWORD
flags
,
BOOL
isSaveDlg
,
int
defAction
);
int
COMDLG32_SplitFileNames
(
LPWSTR
lpstrEdit
,
UINT
nStrLen
,
LPWSTR
*
lpstrFileList
,
UINT
*
sizeUsed
);
/* ITEMIDLIST */
/* ITEMIDLIST */
...
...
dlls/comdlg32/filedlg.c
View file @
9c1f56f6
...
@@ -609,6 +609,54 @@ void COMDLG32_GetCanonicalPath(PCIDLIST_ABSOLUTE pidlAbsCurrent,
...
@@ -609,6 +609,54 @@ void COMDLG32_GetCanonicalPath(PCIDLIST_ABSOLUTE pidlAbsCurrent,
}
}
/***********************************************************************
/***********************************************************************
* COMDLG32_SplitFileNames [internal]
*
* Creates a delimited list of filenames.
*/
int
COMDLG32_SplitFileNames
(
LPWSTR
lpstrEdit
,
UINT
nStrLen
,
LPWSTR
*
lpstrFileList
,
UINT
*
sizeUsed
)
{
UINT
nStrCharCount
=
0
;
/* index in src buffer */
UINT
nFileIndex
=
0
;
/* index in dest buffer */
UINT
nFileCount
=
0
;
/* number of files */
/* we might get single filename without any '"',
* so we need nStrLen + terminating \0 + end-of-list \0 */
*
lpstrFileList
=
MemAlloc
(
(
nStrLen
+
2
)
*
sizeof
(
WCHAR
)
);
*
sizeUsed
=
0
;
/* build delimited file list from filenames */
while
(
nStrCharCount
<=
nStrLen
)
{
if
(
lpstrEdit
[
nStrCharCount
]
==
'"'
)
{
nStrCharCount
++
;
while
((
lpstrEdit
[
nStrCharCount
]
!=
'"'
)
&&
(
nStrCharCount
<=
nStrLen
))
{
(
*
lpstrFileList
)[
nFileIndex
++
]
=
lpstrEdit
[
nStrCharCount
];
nStrCharCount
++
;
}
(
*
lpstrFileList
)[
nFileIndex
++
]
=
0
;
nFileCount
++
;
}
nStrCharCount
++
;
}
/* single, unquoted string */
if
((
nStrLen
>
0
)
&&
(
nFileIndex
==
0
)
)
{
lstrcpyW
(
*
lpstrFileList
,
lpstrEdit
);
nFileIndex
=
lstrlenW
(
lpstrEdit
)
+
1
;
nFileCount
=
1
;
}
/* trailing \0 */
(
*
lpstrFileList
)[
nFileIndex
++
]
=
'\0'
;
*
sizeUsed
=
nFileIndex
;
return
nFileCount
;
}
/***********************************************************************
* ArrangeCtrlPositions [internal]
* ArrangeCtrlPositions [internal]
*
*
* NOTE: Make sure to add testcases for any changes made here.
* NOTE: Make sure to add testcases for any changes made here.
...
@@ -3642,14 +3690,10 @@ static HRESULT COMDLG32_StrRetToStrNW (LPWSTR dest, DWORD len, LPSTRRET src, con
...
@@ -3642,14 +3690,10 @@ static HRESULT COMDLG32_StrRetToStrNW (LPWSTR dest, DWORD len, LPSTRRET src, con
* FILEDLG95_FILENAME_GetFileNames
* FILEDLG95_FILENAME_GetFileNames
*
*
* Copies the filenames to a delimited string list.
* Copies the filenames to a delimited string list.
* The delimiter is specified by the parameter 'separator',
* usually either a space or a nul
*/
*/
static
int
FILEDLG95_FILENAME_GetFileNames
(
HWND
hwnd
,
LPWSTR
*
lpstrFileList
,
UINT
*
sizeUsed
)
static
int
FILEDLG95_FILENAME_GetFileNames
(
HWND
hwnd
,
LPWSTR
*
lpstrFileList
,
UINT
*
sizeUsed
)
{
{
FileOpenDlgInfos
*
fodInfos
=
GetPropA
(
hwnd
,
FileOpenDlgInfosStr
);
FileOpenDlgInfos
*
fodInfos
=
GetPropA
(
hwnd
,
FileOpenDlgInfosStr
);
UINT
nStrCharCount
=
0
;
/* index in src buffer */
UINT
nFileIndex
=
0
;
/* index in dest buffer */
UINT
nFileCount
=
0
;
/* number of files */
UINT
nFileCount
=
0
;
/* number of files */
UINT
nStrLen
=
0
;
/* length of string in edit control */
UINT
nStrLen
=
0
;
/* length of string in edit control */
LPWSTR
lpstrEdit
;
/* buffer for string from edit control */
LPWSTR
lpstrEdit
;
/* buffer for string from edit control */
...
@@ -3663,40 +3707,7 @@ static int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPWSTR * lpstrFileList, U
...
@@ -3663,40 +3707,7 @@ static int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPWSTR * lpstrFileList, U
TRACE
(
"nStrLen=%u str=%s
\n
"
,
nStrLen
,
debugstr_w
(
lpstrEdit
));
TRACE
(
"nStrLen=%u str=%s
\n
"
,
nStrLen
,
debugstr_w
(
lpstrEdit
));
/* we might get single filename without any '"',
nFileCount
=
COMDLG32_SplitFileNames
(
lpstrEdit
,
nStrLen
,
lpstrFileList
,
sizeUsed
);
* so we need nStrLen + terminating \0 + end-of-list \0 */
*
lpstrFileList
=
MemAlloc
(
(
nStrLen
+
2
)
*
sizeof
(
WCHAR
)
);
*
sizeUsed
=
0
;
/* build delimited file list from filenames */
while
(
nStrCharCount
<=
nStrLen
)
{
if
(
lpstrEdit
[
nStrCharCount
]
==
'"'
)
{
nStrCharCount
++
;
while
((
lpstrEdit
[
nStrCharCount
]
!=
'"'
)
&&
(
nStrCharCount
<=
nStrLen
))
{
(
*
lpstrFileList
)[
nFileIndex
++
]
=
lpstrEdit
[
nStrCharCount
];
nStrCharCount
++
;
}
(
*
lpstrFileList
)[
nFileIndex
++
]
=
0
;
nFileCount
++
;
}
nStrCharCount
++
;
}
/* single, unquoted string */
if
((
nStrLen
>
0
)
&&
(
nFileIndex
==
0
)
)
{
lstrcpyW
(
*
lpstrFileList
,
lpstrEdit
);
nFileIndex
=
lstrlenW
(
lpstrEdit
)
+
1
;
nFileCount
=
1
;
}
/* trailing \0 */
(
*
lpstrFileList
)[
nFileIndex
++
]
=
'\0'
;
*
sizeUsed
=
nFileIndex
;
MemFree
(
lpstrEdit
);
MemFree
(
lpstrEdit
);
return
nFileCount
;
return
nFileCount
;
}
}
...
...
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