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
038ede84
Commit
038ede84
authored
Sep 03, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid heap reallocation each time a metarecord is written in memory
(based on a patch by Warren Baird).
parent
81c31701
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
init.c
dlls/gdi/mfdrv/init.c
+12
-4
No files found.
dlls/gdi/mfdrv/init.c
View file @
038ede84
...
...
@@ -378,7 +378,7 @@ HMETAFILE WINAPI CloseMetaFile(
*/
BOOL
MFDRV_WriteRecord
(
PHYSDEV
dev
,
METARECORD
*
mr
,
DWORD
rlen
)
{
DWORD
len
;
DWORD
len
,
size
;
METAHEADER
*
mh
;
METAFILEDRV_PDEVICE
*
physDev
=
(
METAFILEDRV_PDEVICE
*
)
dev
;
...
...
@@ -386,9 +386,17 @@ BOOL MFDRV_WriteRecord( PHYSDEV dev, METARECORD *mr, DWORD rlen)
{
case
METAFILE_MEMORY
:
len
=
physDev
->
mh
->
mtSize
*
2
+
rlen
;
mh
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
physDev
->
mh
,
len
);
if
(
!
mh
)
return
FALSE
;
physDev
->
mh
=
mh
;
/* reallocate memory if needed */
size
=
HeapSize
(
GetProcessHeap
(),
0
,
physDev
->
mh
);
if
(
len
>
size
)
{
/*expand size*/
size
+=
size
/
2
+
rlen
;
mh
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
physDev
->
mh
,
size
);
if
(
!
mh
)
return
FALSE
;
physDev
->
mh
=
mh
;
TRACE
(
"Reallocated metafile: new size is %ld
\n
"
,
size
);
}
memcpy
((
WORD
*
)
physDev
->
mh
+
physDev
->
mh
->
mtSize
,
mr
,
rlen
);
break
;
case
METAFILE_DISK
:
...
...
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