kernel32: Assign to structs instead of using memcpy.

This commit is contained in:
Andrew Talbot 2008-03-03 22:27:46 +00:00 committed by Alexandre Julliard
parent 90b7baa2bc
commit 54a376f228
6 changed files with 20 additions and 18 deletions

View File

@ -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

View File

@ -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",

View File

@ -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;
}
/******************************************************************

View File

@ -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",

View File

@ -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();

View File

@ -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
{