Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
3cfd0a7a
Commit
3cfd0a7a
authored
May 14, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Use array allocation helper for in-memory loader.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0520b593
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
25 deletions
+11
-25
font.c
dlls/dwrite/font.c
+11
-25
No files found.
dlls/dwrite/font.c
View file @
3cfd0a7a
...
...
@@ -4588,8 +4588,8 @@ struct dwrite_inmemory_fileloader
LONG
ref
;
struct
dwrite_inmemory_stream_data
**
streams
;
UINT32
filecount
;
UINT32
capacity
;
size_t
size
;
size_t
count
;
};
static
inline
struct
dwrite_localfontfileloader
*
impl_from_IDWriteLocalFontFileLoader
(
IDWriteLocalFontFileLoader
*
iface
)
...
...
@@ -6208,13 +6208,12 @@ static ULONG WINAPI inmemoryfontfileloader_Release(IDWriteInMemoryFontFileLoader
{
struct
dwrite_inmemory_fileloader
*
loader
=
impl_from_IDWriteInMemoryFontFileLoader
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
loader
->
ref
);
size_t
i
;
TRACE
(
"(%p)->(%u)
\n
"
,
loader
,
ref
);
if
(
!
ref
)
{
UINT32
i
;
for
(
i
=
0
;
i
<
loader
->
filecount
;
i
++
)
for
(
i
=
0
;
i
<
loader
->
count
;
++
i
)
release_inmemory_stream
(
loader
->
streams
[
i
]);
heap_free
(
loader
->
streams
);
heap_free
(
loader
);
...
...
@@ -6239,7 +6238,7 @@ static HRESULT WINAPI inmemoryfontfileloader_CreateStreamFromKey(IDWriteInMemory
index
=
*
(
DWORD
*
)
key
;
if
(
index
>=
loader
->
file
count
)
if
(
index
>=
loader
->
count
)
return
E_INVALIDARG
;
if
(
!
(
stream
=
heap_alloc
(
sizeof
(
*
stream
))))
...
...
@@ -6266,21 +6265,8 @@ static HRESULT WINAPI inmemoryfontfileloader_CreateInMemoryFontFileReference(IDW
*
fontfile
=
NULL
;
if
(
loader
->
filecount
==
loader
->
capacity
)
{
if
(
loader
->
streams
)
{
struct
dwrite_inmemory_stream_data
**
ptr
;
if
(
!
(
ptr
=
heap_realloc
(
loader
->
streams
,
2
*
loader
->
capacity
*
sizeof
(
*
loader
->
streams
))))
return
E_OUTOFMEMORY
;
loader
->
streams
=
ptr
;
loader
->
capacity
*=
2
;
}
else
{
loader
->
capacity
=
16
;
loader
->
streams
=
heap_calloc
(
loader
->
capacity
,
sizeof
(
*
loader
->
streams
));
}
}
if
(
!
dwrite_array_reserve
((
void
**
)
&
loader
->
streams
,
&
loader
->
size
,
loader
->
count
+
1
,
sizeof
(
*
loader
->
streams
)))
return
E_OUTOFMEMORY
;
if
(
!
(
stream
=
heap_alloc
(
sizeof
(
*
stream
))))
return
E_OUTOFMEMORY
;
...
...
@@ -6300,8 +6286,8 @@ static HRESULT WINAPI inmemoryfontfileloader_CreateInMemoryFontFileReference(IDW
memcpy
(
stream
->
data
,
data
,
data_size
);
}
key
=
loader
->
file
count
;
loader
->
streams
[
loader
->
file
count
++
]
=
stream
;
key
=
loader
->
count
;
loader
->
streams
[
loader
->
count
++
]
=
stream
;
return
IDWriteFactory_CreateCustomFontFileReference
(
factory
,
&
key
,
sizeof
(
key
),
(
IDWriteFontFileLoader
*
)
&
loader
->
IDWriteInMemoryFontFileLoader_iface
,
fontfile
);
...
...
@@ -6311,9 +6297,9 @@ static UINT32 WINAPI inmemoryfontfileloader_GetFileCount(IDWriteInMemoryFontFile
{
struct
dwrite_inmemory_fileloader
*
loader
=
impl_from_IDWriteInMemoryFontFileLoader
(
iface
);
TRACE
(
"
(%p)
\n
"
,
loader
);
TRACE
(
"
%p.
\n
"
,
iface
);
return
loader
->
file
count
;
return
loader
->
count
;
}
static
const
IDWriteInMemoryFontFileLoaderVtbl
inmemoryfontfileloadervtbl
=
...
...
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