Module: wine Branch: master Commit: 54a376f2286c42164c8ba869da66739410feb6ae URL: http://source.winehq.org/git/wine.git/?a=commit;h=54a376f2286c42164c8ba869da...
Author: Andrew Talbot andrew.talbot@talbotville.com Date: Mon Mar 3 22:27:46 2008 +0000
kernel32: Assign to structs instead of using memcpy.
---
dlls/kernel32/comm.c | 12 +++++++----- dlls/kernel32/cpu.c | 6 +++--- dlls/kernel32/environ.c | 4 ++-- dlls/kernel32/heap.c | 4 ++-- dlls/kernel32/thunk.c | 8 ++++---- dlls/kernel32/time.c | 4 ++-- 6 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/dlls/kernel32/comm.c b/dlls/kernel32/comm.c index ea71a26..7986636 100644 --- a/dlls/kernel32/comm.c +++ b/dlls/kernel32/comm.c @@ -477,17 +477,19 @@ BOOL WINAPI BuildCommDCBAndTimeoutsW( COMMTIMEOUTS timeouts; BOOL result; LPCWSTR ptr = devid; - + TRACE("(%s,%p,%p)\n",debugstr_w(devid),lpdcb,lptimeouts);
+ memset(&timeouts, 0, sizeof timeouts); + /* Set DCBlength. (Windows NT does not do this, but 9x does) */ lpdcb->DCBlength = sizeof(DCB);
/* Make a copy of the original data structures to work with since if if there is an error in the device control string the originals should not be modified (except possibly DCBlength) */ - memcpy(&dcb, lpdcb, sizeof(DCB)); - if(lptimeouts) memcpy(&timeouts, lptimeouts, sizeof(COMMTIMEOUTS)); + dcb = *lpdcb; + if(lptimeouts) timeouts = *lptimeouts;
ptr = COMM_ParseStart(ptr);
@@ -500,8 +502,8 @@ BOOL WINAPI BuildCommDCBAndTimeoutsW(
if(result) { - memcpy(lpdcb, &dcb, sizeof(DCB)); - if(lptimeouts) memcpy(lptimeouts, &timeouts, sizeof(COMMTIMEOUTS)); + *lpdcb = dcb; + if(lptimeouts) *lptimeouts = timeouts; return TRUE; } else diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c index 1f3d945..85027eb 100644 --- a/dlls/kernel32/cpu.c +++ b/dlls/kernel32/cpu.c @@ -370,7 +370,7 @@ VOID WINAPI GetSystemInfo(
TRACE("si=0x%p\n", si); if (cache) { - memcpy(si,&cachedsi,sizeof(*si)); + *si = cachedsi; return; } memset(PF,0,sizeof(PF)); @@ -392,7 +392,7 @@ VOID WINAPI GetSystemInfo( cachedsi.wProcessorRevision = 0;
cache = 1; /* even if there is no more info, we now have a cache entry */ - memcpy(si,&cachedsi,sizeof(*si)); + *si = cachedsi;
/* Hmm, reasonable processor feature defaults? */
@@ -788,7 +788,7 @@ VOID WINAPI GetSystemInfo( if (!cachedsi.dwActiveProcessorMask) cachedsi.dwActiveProcessorMask = (1 << cachedsi.dwNumberOfProcessors) - 1;
- memcpy(si,&cachedsi,sizeof(*si)); + *si = cachedsi;
TRACE("<- CPU arch %d, res'd %d, pagesize %d, minappaddr %p, maxappaddr %p," " act.cpumask %08x, numcpus %d, CPU type %d, allocgran. %d, CPU level %d, CPU rev %d\n", diff --git a/dlls/kernel32/environ.c b/dlls/kernel32/environ.c index 7089c20..aaa9d6e 100644 --- a/dlls/kernel32/environ.c +++ b/dlls/kernel32/environ.c @@ -421,7 +421,7 @@ BOOL WINAPI SetStdHandle( DWORD std_handle, HANDLE handle ) */ VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info ) { - memcpy(info, &startup_infoA, sizeof(startup_infoA)); + *info = startup_infoA; }
@@ -430,7 +430,7 @@ VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info ) */ VOID WINAPI GetStartupInfoW( LPSTARTUPINFOW info ) { - memcpy(info, &startup_infoW, sizeof(startup_infoW)); + *info = startup_infoW; }
/****************************************************************** diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c index 34d4f20..9931c09 100644 --- a/dlls/kernel32/heap.c +++ b/dlls/kernel32/heap.c @@ -1227,7 +1227,7 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex ) }
if (time(NULL)==cache_lastchecked) { - memcpy(lpmemex,&cached_memstatus,sizeof(*lpmemex)); + *lpmemex = cached_memstatus; return TRUE; } cache_lastchecked = time(NULL); @@ -1347,7 +1347,7 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex ) */ lpmemex->ullAvailExtendedVirtual = 0;
- memcpy(&cached_memstatus,lpmemex,sizeof(*lpmemex)); + cached_memstatus = *lpmemex;
TRACE("<-- LPMEMORYSTATUSEX: dwLength %d, dwMemoryLoad %d, ullTotalPhys %s, ullAvailPhys %s," " ullTotalPageFile %s, ullAvailPageFile %s, ullTotalVirtual %s, ullAvailVirtual %s\n", diff --git a/dlls/kernel32/thunk.c b/dlls/kernel32/thunk.c index 5487b34..3533051 100644 --- a/dlls/kernel32/thunk.c +++ b/dlls/kernel32/thunk.c @@ -454,7 +454,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT86 *context ) CONTEXT86 context16; DWORD argsize;
- memcpy(&context16,context,sizeof(context16)); + context16 = *context;
context16.SegFs = wine_get_fs(); context16.SegGs = wine_get_gs(); @@ -588,7 +588,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT86 *context ) DWORD newstack[32]; LPBYTE oldstack;
- memcpy(&context16,context,sizeof(context16)); + context16 = *context;
context16.SegFs = wine_get_fs(); context16.SegGs = wine_get_gs(); @@ -753,7 +753,7 @@ void WINAPI __regs_Common32ThkLS( CONTEXT86 *context ) CONTEXT86 context16; DWORD argsize;
- memcpy(&context16,context,sizeof(context16)); + context16 = *context;
context16.SegFs = wine_get_fs(); context16.SegGs = wine_get_gs(); @@ -814,7 +814,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT86 *context ) CONTEXT86 context16; DWORD argsize;
- memcpy(&context16,context,sizeof(context16)); + context16 = *context;
context16.SegFs = wine_get_fs(); context16.SegGs = wine_get_gs(); diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c index 0ad612d..0a255ed 100644 --- a/dlls/kernel32/time.c +++ b/dlls/kernel32/time.c @@ -453,7 +453,7 @@ BOOL WINAPI SystemTimeToTzSpecificLocalTime(
if (lpTimeZoneInformation != NULL) { - memcpy(&tzinfo, lpTimeZoneInformation, sizeof(TIME_ZONE_INFORMATION)); + tzinfo = *lpTimeZoneInformation; } else { @@ -499,7 +499,7 @@ BOOL WINAPI TzSpecificLocalTimeToSystemTime(
if (lpTimeZoneInformation != NULL) { - memcpy(&tzinfo, lpTimeZoneInformation, sizeof(TIME_ZONE_INFORMATION)); + tzinfo = *lpTimeZoneInformation; } else {