Commit 54a376f2 authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

kernel32: Assign to structs instead of using memcpy.

parent 90b7baa2
...@@ -480,14 +480,16 @@ BOOL WINAPI BuildCommDCBAndTimeoutsW( ...@@ -480,14 +480,16 @@ BOOL WINAPI BuildCommDCBAndTimeoutsW(
TRACE("(%s,%p,%p)\n",debugstr_w(devid),lpdcb,lptimeouts); 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) */ /* Set DCBlength. (Windows NT does not do this, but 9x does) */
lpdcb->DCBlength = sizeof(DCB); lpdcb->DCBlength = sizeof(DCB);
/* Make a copy of the original data structures to work with since if /* 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 if there is an error in the device control string the originals
should not be modified (except possibly DCBlength) */ should not be modified (except possibly DCBlength) */
memcpy(&dcb, lpdcb, sizeof(DCB)); dcb = *lpdcb;
if(lptimeouts) memcpy(&timeouts, lptimeouts, sizeof(COMMTIMEOUTS)); if(lptimeouts) timeouts = *lptimeouts;
ptr = COMM_ParseStart(ptr); ptr = COMM_ParseStart(ptr);
...@@ -500,8 +502,8 @@ BOOL WINAPI BuildCommDCBAndTimeoutsW( ...@@ -500,8 +502,8 @@ BOOL WINAPI BuildCommDCBAndTimeoutsW(
if(result) if(result)
{ {
memcpy(lpdcb, &dcb, sizeof(DCB)); *lpdcb = dcb;
if(lptimeouts) memcpy(lptimeouts, &timeouts, sizeof(COMMTIMEOUTS)); if(lptimeouts) *lptimeouts = timeouts;
return TRUE; return TRUE;
} }
else else
......
...@@ -370,7 +370,7 @@ VOID WINAPI GetSystemInfo( ...@@ -370,7 +370,7 @@ VOID WINAPI GetSystemInfo(
TRACE("si=0x%p\n", si); TRACE("si=0x%p\n", si);
if (cache) { if (cache) {
memcpy(si,&cachedsi,sizeof(*si)); *si = cachedsi;
return; return;
} }
memset(PF,0,sizeof(PF)); memset(PF,0,sizeof(PF));
...@@ -392,7 +392,7 @@ VOID WINAPI GetSystemInfo( ...@@ -392,7 +392,7 @@ VOID WINAPI GetSystemInfo(
cachedsi.wProcessorRevision = 0; cachedsi.wProcessorRevision = 0;
cache = 1; /* even if there is no more info, we now have a cache entry */ 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? */ /* Hmm, reasonable processor feature defaults? */
...@@ -788,7 +788,7 @@ VOID WINAPI GetSystemInfo( ...@@ -788,7 +788,7 @@ VOID WINAPI GetSystemInfo(
if (!cachedsi.dwActiveProcessorMask) if (!cachedsi.dwActiveProcessorMask)
cachedsi.dwActiveProcessorMask = (1 << cachedsi.dwNumberOfProcessors) - 1; 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," 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", " act.cpumask %08x, numcpus %d, CPU type %d, allocgran. %d, CPU level %d, CPU rev %d\n",
......
...@@ -421,7 +421,7 @@ BOOL WINAPI SetStdHandle( DWORD std_handle, HANDLE handle ) ...@@ -421,7 +421,7 @@ BOOL WINAPI SetStdHandle( DWORD std_handle, HANDLE handle )
*/ */
VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info ) VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info )
{ {
memcpy(info, &startup_infoA, sizeof(startup_infoA)); *info = startup_infoA;
} }
...@@ -430,7 +430,7 @@ VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info ) ...@@ -430,7 +430,7 @@ VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info )
*/ */
VOID WINAPI GetStartupInfoW( LPSTARTUPINFOW info ) VOID WINAPI GetStartupInfoW( LPSTARTUPINFOW info )
{ {
memcpy(info, &startup_infoW, sizeof(startup_infoW)); *info = startup_infoW;
} }
/****************************************************************** /******************************************************************
......
...@@ -1227,7 +1227,7 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex ) ...@@ -1227,7 +1227,7 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
} }
if (time(NULL)==cache_lastchecked) { if (time(NULL)==cache_lastchecked) {
memcpy(lpmemex,&cached_memstatus,sizeof(*lpmemex)); *lpmemex = cached_memstatus;
return TRUE; return TRUE;
} }
cache_lastchecked = time(NULL); cache_lastchecked = time(NULL);
...@@ -1347,7 +1347,7 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex ) ...@@ -1347,7 +1347,7 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
*/ */
lpmemex->ullAvailExtendedVirtual = 0; lpmemex->ullAvailExtendedVirtual = 0;
memcpy(&cached_memstatus,lpmemex,sizeof(*lpmemex)); cached_memstatus = *lpmemex;
TRACE("<-- LPMEMORYSTATUSEX: dwLength %d, dwMemoryLoad %d, ullTotalPhys %s, ullAvailPhys %s," TRACE("<-- LPMEMORYSTATUSEX: dwLength %d, dwMemoryLoad %d, ullTotalPhys %s, ullAvailPhys %s,"
" ullTotalPageFile %s, ullAvailPageFile %s, ullTotalVirtual %s, ullAvailVirtual %s\n", " ullTotalPageFile %s, ullAvailPageFile %s, ullTotalVirtual %s, ullAvailVirtual %s\n",
......
...@@ -454,7 +454,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT86 *context ) ...@@ -454,7 +454,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT86 *context )
CONTEXT86 context16; CONTEXT86 context16;
DWORD argsize; DWORD argsize;
memcpy(&context16,context,sizeof(context16)); context16 = *context;
context16.SegFs = wine_get_fs(); context16.SegFs = wine_get_fs();
context16.SegGs = wine_get_gs(); context16.SegGs = wine_get_gs();
...@@ -588,7 +588,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT86 *context ) ...@@ -588,7 +588,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT86 *context )
DWORD newstack[32]; DWORD newstack[32];
LPBYTE oldstack; LPBYTE oldstack;
memcpy(&context16,context,sizeof(context16)); context16 = *context;
context16.SegFs = wine_get_fs(); context16.SegFs = wine_get_fs();
context16.SegGs = wine_get_gs(); context16.SegGs = wine_get_gs();
...@@ -753,7 +753,7 @@ void WINAPI __regs_Common32ThkLS( CONTEXT86 *context ) ...@@ -753,7 +753,7 @@ void WINAPI __regs_Common32ThkLS( CONTEXT86 *context )
CONTEXT86 context16; CONTEXT86 context16;
DWORD argsize; DWORD argsize;
memcpy(&context16,context,sizeof(context16)); context16 = *context;
context16.SegFs = wine_get_fs(); context16.SegFs = wine_get_fs();
context16.SegGs = wine_get_gs(); context16.SegGs = wine_get_gs();
...@@ -814,7 +814,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT86 *context ) ...@@ -814,7 +814,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT86 *context )
CONTEXT86 context16; CONTEXT86 context16;
DWORD argsize; DWORD argsize;
memcpy(&context16,context,sizeof(context16)); context16 = *context;
context16.SegFs = wine_get_fs(); context16.SegFs = wine_get_fs();
context16.SegGs = wine_get_gs(); context16.SegGs = wine_get_gs();
......
...@@ -453,7 +453,7 @@ BOOL WINAPI SystemTimeToTzSpecificLocalTime( ...@@ -453,7 +453,7 @@ BOOL WINAPI SystemTimeToTzSpecificLocalTime(
if (lpTimeZoneInformation != NULL) if (lpTimeZoneInformation != NULL)
{ {
memcpy(&tzinfo, lpTimeZoneInformation, sizeof(TIME_ZONE_INFORMATION)); tzinfo = *lpTimeZoneInformation;
} }
else else
{ {
...@@ -499,7 +499,7 @@ BOOL WINAPI TzSpecificLocalTimeToSystemTime( ...@@ -499,7 +499,7 @@ BOOL WINAPI TzSpecificLocalTimeToSystemTime(
if (lpTimeZoneInformation != NULL) if (lpTimeZoneInformation != NULL)
{ {
memcpy(&tzinfo, lpTimeZoneInformation, sizeof(TIME_ZONE_INFORMATION)); tzinfo = *lpTimeZoneInformation;
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment