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
aa8e2a16
Commit
aa8e2a16
authored
Aug 17, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Aug 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Combine the two strdupAtoW functions.
parent
42811d77
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
21 deletions
+9
-21
shell32_main.c
dlls/shell32/shell32_main.c
+1
-1
shell32_main.h
dlls/shell32/shell32_main.h
+1
-1
shelllink.c
dlls/shell32/shelllink.c
+7
-19
No files found.
dlls/shell32/shell32_main.c
View file @
aa8e2a16
...
...
@@ -585,7 +585,7 @@ HICON WINAPI ExtractIconA(HINSTANCE hInstance, const char *file, UINT nIconIndex
fileW
=
strdupAtoW
(
file
);
ret
=
ExtractIconW
(
hInstance
,
fileW
,
nIconIndex
);
heap_
free
(
fileW
);
free
(
fileW
);
return
ret
;
}
...
...
dlls/shell32/shell32_main.h
View file @
aa8e2a16
...
...
@@ -239,7 +239,7 @@ static inline WCHAR *strdupAtoW(const char *str)
if
(
!
str
)
return
NULL
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
ret
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
));
ret
=
m
alloc
(
len
*
sizeof
(
WCHAR
));
if
(
ret
)
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
...
...
dlls/shell32/shelllink.c
View file @
aa8e2a16
...
...
@@ -202,17 +202,6 @@ static inline IShellLinkImpl *impl_from_IPropertyStore(IPropertyStore *iface)
static
HRESULT
ShellLink_UpdatePath
(
LPCWSTR
sPathRel
,
LPCWSTR
path
,
LPCWSTR
sWorkDir
,
LPWSTR
*
psPath
);
/* strdup on the process heap */
static
inline
LPWSTR
heap_strdupAtoW
(
LPCSTR
str
)
{
INT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
WCHAR
*
p
=
malloc
(
len
*
sizeof
(
WCHAR
)
);
if
(
!
p
)
return
p
;
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
p
,
len
);
return
p
;
}
/**************************************************************************
* IPersistFile_QueryInterface
*/
...
...
@@ -1342,7 +1331,7 @@ static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA *iface, LPCSTR ps
if
(
pszName
)
{
descrW
=
heap_
strdupAtoW
(
pszName
);
descrW
=
strdupAtoW
(
pszName
);
if
(
!
descrW
)
return
E_OUTOFMEMORY
;
}
else
...
...
@@ -1378,7 +1367,7 @@ static HRESULT WINAPI IShellLinkA_fnSetWorkingDirectory(IShellLinkA *iface, LPCS
TRACE
(
"(%p)->(dir=%s)
\n
"
,
This
,
pszDir
);
dirW
=
heap_
strdupAtoW
(
pszDir
);
dirW
=
strdupAtoW
(
pszDir
);
if
(
!
dirW
)
return
E_OUTOFMEMORY
;
hr
=
IShellLinkW_SetWorkingDirectory
(
&
This
->
IShellLinkW_iface
,
dirW
);
...
...
@@ -1412,7 +1401,7 @@ static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA *iface, LPCSTR pszA
if
(
pszArgs
)
{
argsW
=
heap_
strdupAtoW
(
pszArgs
);
argsW
=
strdupAtoW
(
pszArgs
);
if
(
!
argsW
)
return
E_OUTOFMEMORY
;
}
else
...
...
@@ -1475,7 +1464,7 @@ static HRESULT WINAPI IShellLinkA_fnSetIconLocation(IShellLinkA *iface, LPCSTR p
if
(
path
)
{
pathW
=
heap_
strdupAtoW
(
path
);
pathW
=
strdupAtoW
(
path
);
if
(
!
pathW
)
return
E_OUTOFMEMORY
;
}
...
...
@@ -1495,7 +1484,7 @@ static HRESULT WINAPI IShellLinkA_fnSetRelativePath(IShellLinkA *iface, LPCSTR p
TRACE
(
"(%p)->(path=%s %lx)
\n
"
,
This
,
pszPathRel
,
dwReserved
);
pathW
=
heap_
strdupAtoW
(
pszPathRel
);
pathW
=
strdupAtoW
(
pszPathRel
);
if
(
!
pathW
)
return
E_OUTOFMEMORY
;
hr
=
IShellLinkW_SetRelativePath
(
&
This
->
IShellLinkW_iface
,
pathW
,
dwReserved
);
...
...
@@ -1523,9 +1512,8 @@ static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA *iface, LPCSTR pszFile)
if
(
!
pszFile
)
return
E_INVALIDARG
;
str
=
heap_strdupAtoW
(
pszFile
);
if
(
!
str
)
return
E_OUTOFMEMORY
;
str
=
strdupAtoW
(
pszFile
);
if
(
!
str
)
return
E_OUTOFMEMORY
;
r
=
IShellLinkW_SetPath
(
&
This
->
IShellLinkW_iface
,
str
);
free
(
str
);
...
...
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