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
38713298
Commit
38713298
authored
May 23, 2011
by
Dylan Smith
Committed by
Alexandre Julliard
May 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Avoid clearing some memory unnecessarily.
parent
953c7a34
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
16 deletions
+9
-16
ddraw.c
dlls/ddraw/ddraw.c
+0
-2
ddraw_private.h
dlls/ddraw/ddraw_private.h
+9
-14
No files found.
dlls/ddraw/ddraw.c
View file @
38713298
...
...
@@ -3125,10 +3125,8 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD,
DDSD
->
ddsCaps
.
dwCaps2
&=
~
DDSCAPS2_MIPMAPSUBLEVEL
;
/* Modify some flags */
memset
(
&
desc2
,
0
,
sizeof
(
desc2
));
desc2
.
dwSize
=
sizeof
(
desc2
);
/* For the struct copy */
DD_STRUCT_COPY_BYSIZE
(
&
desc2
,
DDSD
);
desc2
.
dwSize
=
sizeof
(
desc2
);
/* To override a possibly smaller size */
desc2
.
u4
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
DDPIXELFORMAT
);
/* Just to be sure */
/* Get the video mode from WineD3D - we will need it */
...
...
dlls/ddraw/ddraw_private.h
View file @
38713298
...
...
@@ -588,20 +588,15 @@ typedef struct
/* Structure copy */
#define ME(x,f,e) { x, #x, (void (*)(const void *))(f), offsetof(STRUCT, e) }
#define DD_STRUCT_COPY_BYSIZE(to,from) \
do { \
DWORD __size = (to)->dwSize; \
DWORD __copysize = __size; \
DWORD __resetsize = __size; \
assert(to != from); \
if (__resetsize > sizeof(*to)) \
__resetsize = sizeof(*to); \
memset(to,0,__resetsize); \
if ((from)->dwSize < __size) \
__copysize = (from)->dwSize; \
memcpy(to,from,__copysize); \
(to)->dwSize = __size;
/*restore size*/
\
} while (0)
#define DD_STRUCT_COPY_BYSIZE(to,from) \
do { \
DWORD __size = (to)->dwSize; \
DWORD __copysize = min(__size, (from)->dwSize); \
assert(to != from); \
memcpy(to, from, __copysize); \
memset((char*)(to) + __copysize, 0, __size - __copysize); \
(to)->dwSize = __size;
/* restore size */
\
} while (0)
#endif
...
...
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