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
ef06b4a6
Commit
ef06b4a6
authored
Jul 22, 2001
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Got rid of HEAP_strdupW.
parent
a9eae850
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
51 deletions
+65
-51
menu.c
controls/menu.c
+48
-28
shell32_main.c
dlls/shell32/shell32_main.c
+15
-14
heap.h
include/heap.h
+0
-8
mdi.c
windows/mdi.c
+2
-1
No files found.
controls/menu.c
View file @
ef06b4a6
...
...
@@ -25,7 +25,6 @@
#include "wine/unicode.h"
#include "wine/port.h"
#include "win.h"
#include "heap.h"
#include "controls.h"
#include "nonclient.h"
#include "user.h"
...
...
@@ -1736,7 +1735,9 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT id,
flags
|=
MF_HELP
;
str
++
;
}
if
(
!
(
text
=
HEAP_strdupW
(
GetProcessHeap
(),
0
,
str
)))
return
FALSE
;
if
(
!
(
text
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
)
)))
return
FALSE
;
strcpyW
(
text
,
str
);
item
->
text
=
text
;
}
}
...
...
@@ -3531,13 +3532,18 @@ BOOL WINAPI InsertMenuW( HMENU hMenu, UINT pos, UINT flags,
BOOL
WINAPI
InsertMenuA
(
HMENU
hMenu
,
UINT
pos
,
UINT
flags
,
UINT
id
,
LPCSTR
str
)
{
BOOL
ret
;
BOOL
ret
=
FALSE
;
if
(
IS_STRING_ITEM
(
flags
)
&&
str
)
{
LPWSTR
newstr
=
HEAP_strdupAtoW
(
GetProcessHeap
(),
0
,
str
);
ret
=
InsertMenuW
(
hMenu
,
pos
,
flags
,
id
,
newstr
);
HeapFree
(
GetProcessHeap
(),
0
,
newstr
);
INT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
LPWSTR
newstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
newstr
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
newstr
,
len
);
ret
=
InsertMenuW
(
hMenu
,
pos
,
flags
,
id
,
newstr
);
HeapFree
(
GetProcessHeap
(),
0
,
newstr
);
}
return
ret
;
}
else
return
InsertMenuW
(
hMenu
,
pos
,
flags
,
id
,
(
LPCWSTR
)
str
);
...
...
@@ -3684,13 +3690,18 @@ BOOL WINAPI ModifyMenuW( HMENU hMenu, UINT pos, UINT flags,
BOOL
WINAPI
ModifyMenuA
(
HMENU
hMenu
,
UINT
pos
,
UINT
flags
,
UINT
id
,
LPCSTR
str
)
{
BOOL
ret
;
BOOL
ret
=
FALSE
;
if
(
IS_STRING_ITEM
(
flags
)
&&
str
)
{
LPWSTR
newstr
=
HEAP_strdupAtoW
(
GetProcessHeap
(),
0
,
str
);
ret
=
ModifyMenuW
(
hMenu
,
pos
,
flags
,
id
,
newstr
);
HeapFree
(
GetProcessHeap
(),
0
,
newstr
);
INT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
LPWSTR
newstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
newstr
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
newstr
,
len
);
ret
=
ModifyMenuW
(
hMenu
,
pos
,
flags
,
id
,
newstr
);
HeapFree
(
GetProcessHeap
(),
0
,
newstr
);
}
return
ret
;
}
else
return
ModifyMenuW
(
hMenu
,
pos
,
flags
,
id
,
(
LPCWSTR
)
str
);
...
...
@@ -4366,6 +4377,30 @@ BOOL WINAPI GetMenuItemInfoW( HMENU hmenu, UINT item, BOOL bypos,
lpmii
,
TRUE
);
}
/* set a menu item text from a ASCII or Unicode string */
inline
static
void
set_menu_item_text
(
MENUITEM
*
menu
,
LPCWSTR
text
,
BOOL
unicode
)
{
if
(
!
text
)
{
menu
->
text
=
NULL
;
menu
->
fType
|=
MF_SEPARATOR
;
}
else
if
(
unicode
)
{
if
((
menu
->
text
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
text
)
+
1
)
*
sizeof
(
WCHAR
)
)))
strcpyW
(
menu
->
text
,
text
);
}
else
{
LPCSTR
str
=
(
LPCSTR
)
text
;
int
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
if
((
menu
->
text
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
menu
->
text
,
len
);
}
}
/**********************************************************************
* SetMenuItemInfo_common
*/
...
...
@@ -4391,16 +4426,8 @@ static BOOL SetMenuItemInfo_common(MENUITEM * menu,
menu
->
text
=
lpmii
->
dwTypeData
;
if
(
IS_STRING_ITEM
(
menu
->
fType
))
{
if
(
menu
->
text
)
{
if
(
unicode
)
menu
->
text
=
HEAP_strdupW
(
GetProcessHeap
(),
0
,
lpmii
->
dwTypeData
);
else
menu
->
text
=
HEAP_strdupAtoW
(
GetProcessHeap
(),
0
,
(
LPSTR
)
lpmii
->
dwTypeData
);
}
else
menu
->
fType
|=
MF_SEPARATOR
;
}
if
(
IS_STRING_ITEM
(
menu
->
fType
))
set_menu_item_text
(
menu
,
lpmii
->
dwTypeData
,
unicode
);
}
if
(
lpmii
->
fMask
&
MIIM_FTYPE
)
{
...
...
@@ -4419,14 +4446,7 @@ static BOOL SetMenuItemInfo_common(MENUITEM * menu,
/* free the string when used */
if
(
IS_STRING_ITEM
(
menu
->
fType
)
&&
menu
->
text
)
{
HeapFree
(
GetProcessHeap
(),
0
,
menu
->
text
);
if
(
lpmii
->
dwTypeData
)
{
if
(
unicode
)
menu
->
text
=
HEAP_strdupW
(
GetProcessHeap
(),
0
,
lpmii
->
dwTypeData
);
else
menu
->
text
=
HEAP_strdupAtoW
(
GetProcessHeap
(),
0
,
(
LPSTR
)
lpmii
->
dwTypeData
);
}
else
menu
->
fType
|=
MF_SEPARATOR
;
set_menu_item_text
(
menu
,
lpmii
->
dwTypeData
,
unicode
);
}
}
...
...
dlls/shell32/shell32_main.c
View file @
ef06b4a6
...
...
@@ -43,8 +43,11 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
TRACE
(
"
\n
"
);
/* to get writeable copy */
cmdline
=
HEAP_strdupW
(
GetProcessHeap
(),
0
,
lpCmdline
);
s
=
cmdline
;
i
=
0
;
if
(
!
(
cmdline
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
lpCmdline
)
+
1
)
*
sizeof
(
WCHAR
)
)))
return
NULL
;
strcpyW
(
cmdline
,
lpCmdline
);
s
=
cmdline
;
i
=
0
;
while
(
*
s
)
{
/* space */
if
(
*
s
==
0x0020
)
...
...
@@ -60,21 +63,19 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
s
=
t
=
cmdline
;
i
=
0
;
while
(
*
s
)
{
if
(
*
s
==
0x0020
)
{
*
s
=
0
;
argv
[
i
++
]
=
HEAP_strdupW
(
GetProcessHeap
(),
0
,
t
);
*
s
=
0x0020
;
while
(
*
s
&&
*
s
==
0x0020
)
s
++
;
t
=
s
;
continue
;
}
s
++
;
{
if
(
*
s
==
0x0020
)
{
argv
[
i
++
]
=
t
;
while
(
*
s
==
0x0020
)
*
s
++
=
0
;
t
=
s
;
continue
;
}
s
++
;
}
if
(
*
t
)
argv
[
i
++
]
=
(
LPWSTR
)
HEAP_strdupW
(
GetProcessHeap
(),
0
,
t
)
;
argv
[
i
++
]
=
t
;
HeapFree
(
GetProcessHeap
(),
0
,
cmdline
);
argv
[
i
]
=
NULL
;
*
numargs
=
i
;
return
argv
;
...
...
include/heap.h
View file @
ef06b4a6
...
...
@@ -43,14 +43,6 @@ inline static LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str )
return
p
;
}
inline
static
LPWSTR
HEAP_strdupW
(
HANDLE
heap
,
DWORD
flags
,
LPCWSTR
str
)
{
INT
len
=
strlenW
(
str
)
+
1
;
LPWSTR
p
=
HeapAlloc
(
heap
,
flags
,
len
*
sizeof
(
WCHAR
)
);
if
(
p
)
memcpy
(
p
,
str
,
len
*
sizeof
(
WCHAR
)
);
return
p
;
}
inline
static
LPWSTR
HEAP_strdupAtoW
(
HANDLE
heap
,
DWORD
flags
,
LPCSTR
str
)
{
LPWSTR
ret
;
...
...
windows/mdi.c
View file @
ef06b4a6
...
...
@@ -1183,7 +1183,8 @@ static void MDI_UpdateFrameText( WND *frameWnd, HWND hClient,
if
(
lpTitle
)
{
if
(
ci
->
frameTitle
)
HeapFree
(
GetProcessHeap
(),
0
,
ci
->
frameTitle
);
ci
->
frameTitle
=
HEAP_strdupW
(
GetProcessHeap
(),
0
,
lpTitle
);
if
((
ci
->
frameTitle
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
lpTitle
)
+
1
)
*
sizeof
(
WCHAR
))))
strcpyW
(
ci
->
frameTitle
,
lpTitle
);
}
if
(
ci
->
frameTitle
)
...
...
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