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
1a7d52c9
Commit
1a7d52c9
authored
Aug 21, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Use strdupW to duplicate strings.
parent
08f578a6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
36 deletions
+12
-36
olefont.c
dlls/oleaut32/olefont.c
+12
-36
No files found.
dlls/oleaut32/olefont.c
View file @
1a7d52c9
...
...
@@ -697,32 +697,18 @@ static HRESULT WINAPI OLEFontImpl_put_Name(
IFont
*
iface
,
BSTR
name
)
{
OLEFontImpl
*
t
his
=
impl_from_IFont
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
t
his
,
name
);
OLEFontImpl
*
T
his
=
impl_from_IFont
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
T
his
,
name
);
if
(
!
name
)
return
CTL_E_INVALIDPROPERTYVALUE
;
if
(
this
->
description
.
lpstrName
==
0
)
{
this
->
description
.
lpstrName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
name
)
+
1
)
*
sizeof
(
WCHAR
));
}
else
{
this
->
description
.
lpstrName
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
this
->
description
.
lpstrName
,
(
lstrlenW
(
name
)
+
1
)
*
sizeof
(
WCHAR
));
}
if
(
this
->
description
.
lpstrName
==
0
)
return
E_OUTOFMEMORY
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
description
.
lpstrName
);
This
->
description
.
lpstrName
=
strdupW
(
name
);
if
(
!
This
->
description
.
lpstrName
)
return
E_OUTOFMEMORY
;
strcpyW
(
this
->
description
.
lpstrName
,
name
);
TRACE
(
"new name %s
\n
"
,
debugstr_w
(
this
->
description
.
lpstrName
));
OLEFont_SendNotify
(
this
,
DISPID_FONT_NAME
);
TRACE
(
"new name %s
\n
"
,
debugstr_w
(
This
->
description
.
lpstrName
));
OLEFont_SendNotify
(
This
,
DISPID_FONT_NAME
);
return
S_OK
;
}
...
...
@@ -1025,15 +1011,8 @@ static HRESULT WINAPI OLEFontImpl_Clone(
return
E_OUTOFMEMORY
;
*
newObject
=
*
this
;
/* We need to alloc new memory for the string, otherwise
* we free memory twice.
*/
newObject
->
description
.
lpstrName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
1
+
strlenW
(
this
->
description
.
lpstrName
))
*
2
);
strcpyW
(
newObject
->
description
.
lpstrName
,
this
->
description
.
lpstrName
);
/* allocate separate buffer */
newObject
->
description
.
lpstrName
=
strdupW
(
this
->
description
.
lpstrName
);
/* Increment internal ref in hfont item list */
if
(
newObject
->
gdiFont
)
inc_int_ref
(
newObject
->
gdiFont
);
...
...
@@ -2246,10 +2225,7 @@ static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc)
newObject
->
ref
=
1
;
newObject
->
description
.
cbSizeofstruct
=
sizeof
(
FONTDESC
);
newObject
->
description
.
lpstrName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
fontDesc
->
lpstrName
)
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
newObject
->
description
.
lpstrName
,
fontDesc
->
lpstrName
);
newObject
->
description
.
lpstrName
=
strdupW
(
fontDesc
->
lpstrName
);
newObject
->
description
.
cySize
=
fontDesc
->
cySize
;
newObject
->
description
.
sWeight
=
fontDesc
->
sWeight
;
newObject
->
description
.
sCharset
=
fontDesc
->
sCharset
;
...
...
@@ -2264,8 +2240,8 @@ static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc)
newObject
->
pPropertyNotifyCP
=
NULL
;
newObject
->
pFontEventsCP
=
NULL
;
CreateConnectionPoint
((
IUnknown
*
)
newObject
,
&
IID_IPropertyNotifySink
,
&
newObject
->
pPropertyNotifyCP
);
CreateConnectionPoint
((
IUnknown
*
)
newObject
,
&
IID_IFontEventsDisp
,
&
newObject
->
pFontEventsCP
);
CreateConnectionPoint
((
IUnknown
*
)
&
newObject
->
IFont_iface
,
&
IID_IPropertyNotifySink
,
&
newObject
->
pPropertyNotifyCP
);
CreateConnectionPoint
((
IUnknown
*
)
&
newObject
->
IFont_iface
,
&
IID_IFontEventsDisp
,
&
newObject
->
pFontEventsCP
);
if
(
!
newObject
->
pPropertyNotifyCP
||
!
newObject
->
pFontEventsCP
)
{
...
...
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