Remove a few more Win32 memory functions. (PR #888)

CopyMemory, MoveMemory, FillMemory.
This commit is contained in:
Andrea 2020-12-12 11:09:14 +00:00 committed by GitHub
parent 50a0e81941
commit 30d3269fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 18 deletions

View File

@ -554,7 +554,7 @@ DWORD CImageBase::NibblizeTrack(LPBYTE trackimagebuffer, SectorOrder_e SectorOrd
*(imageptr++) = 0xD5;
*(imageptr++) = 0xAA;
*(imageptr++) = 0xAD;
CopyMemory(imageptr, Code62(ms_SectorNumber[SectorOrder][sector]), 343);
memcpy(imageptr, Code62(ms_SectorNumber[SectorOrder][sector]), 343);
imageptr += 343;
*(imageptr++) = 0xDE;
*(imageptr++) = 0xAA;
@ -575,9 +575,9 @@ DWORD CImageBase::NibblizeTrack(LPBYTE trackimagebuffer, SectorOrder_e SectorOrd
void CImageBase::SkewTrack(const int nTrack, const int nNumNibbles, const LPBYTE pTrackImageBuffer)
{
int nSkewBytes = (nTrack*768) % nNumNibbles;
CopyMemory(m_pWorkBuffer, pTrackImageBuffer, nNumNibbles);
CopyMemory(pTrackImageBuffer, m_pWorkBuffer+nSkewBytes, nNumNibbles-nSkewBytes);
CopyMemory(pTrackImageBuffer+nNumNibbles-nSkewBytes, m_pWorkBuffer, nSkewBytes);
memcpy(m_pWorkBuffer, pTrackImageBuffer, nNumNibbles);
memcpy(pTrackImageBuffer, m_pWorkBuffer+nSkewBytes, nNumNibbles-nSkewBytes);
memcpy(pTrackImageBuffer+nNumNibbles-nSkewBytes, m_pWorkBuffer, nSkewBytes);
}
//-------------------------------------

View File

@ -597,7 +597,7 @@ static BYTE __stdcall HD_IO_EMUL(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
}
}
MoveMemory(pHDD->hd_buf, mem+pHDD->hd_memblock, HD_BLOCK_SIZE);
memmove(pHDD->hd_buf, mem+pHDD->hd_memblock, HD_BLOCK_SIZE);
if (bRes)
bRes = ImageWriteBlock(pHDD->imagehandle, pHDD->hd_diskblock, pHDD->hd_buf);

View File

@ -1132,7 +1132,7 @@ static void UpdatePaging(BOOL initialize)
// SAVE THE CURRENT PAGING SHADOW TABLE
LPBYTE oldshadow[256];
if (!initialize)
CopyMemory(oldshadow,memshadow,256*sizeof(LPBYTE));
memcpy(oldshadow,memshadow,256*sizeof(LPBYTE));
// UPDATE THE PAGING TABLES BASED ON THE NEW PAGING SWITCH VALUES
UINT loop;
@ -1245,10 +1245,10 @@ static void UpdatePaging(BOOL initialize)
((*(memdirty+loop) & 1) || (loop <= 1)))
{
*(memdirty+loop) &= ~1;
CopyMemory(oldshadow[loop],mem+(loop << 8),256);
memcpy(oldshadow[loop],mem+(loop << 8),256);
}
CopyMemory(mem+(loop << 8),memshadow[loop],256);
memcpy(mem+(loop << 8),memshadow[loop],256);
}
}
}
@ -1320,7 +1320,7 @@ static void BackMainImage(void)
for (UINT loop = 0; loop < 256; loop++)
{
if (memshadow[loop] && ((*(memdirty+loop) & 1) || (loop <= 1)))
CopyMemory(memshadow[loop], mem+(loop << 8), 256);
memcpy(memshadow[loop], mem+(loop << 8), 256);
*(memdirty+loop) &= ~1;
}

View File

@ -151,7 +151,7 @@ void VideoBenchmark () {
DWORD totaltextfps = 0;
g_uVideoMode = VF_TEXT;
FillMemory(mem+0x400,0x400,0x14);
memset(mem+0x400,0x14,0x400);
VideoRedrawScreen();
DWORD milliseconds = GetTickCount();
while (GetTickCount() == milliseconds) ;
@ -159,9 +159,9 @@ void VideoBenchmark () {
DWORD cycle = 0;
do {
if (cycle & 1)
FillMemory(mem+0x400,0x400,0x14);
memset(mem+0x400,0x14,0x400);
else
CopyMemory(mem+0x400,mem+((cycle & 2) ? 0x4000 : 0x6000),0x400);
memcpy(mem+0x400,mem+((cycle & 2) ? 0x4000 : 0x6000),0x400);
VideoRefreshScreen();
if (cycle++ >= 3)
cycle = 0;
@ -173,7 +173,7 @@ void VideoBenchmark () {
// SIMULATE THE ACTIVITY OF AN AVERAGE GAME
DWORD totalhiresfps = 0;
g_uVideoMode = VF_HIRES;
FillMemory(mem+0x2000,0x2000,0x14);
memset(mem+0x2000,0x14,0x2000);
VideoRedrawScreen();
milliseconds = GetTickCount();
while (GetTickCount() == milliseconds) ;
@ -181,9 +181,9 @@ void VideoBenchmark () {
cycle = 0;
do {
if (cycle & 1)
FillMemory(mem+0x2000,0x2000,0x14);
memset(mem+0x2000,0x14,0x2000);
else
CopyMemory(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000);
memcpy(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000);
VideoRefreshScreen();
if (cycle++ >= 3)
cycle = 0;
@ -257,7 +257,7 @@ void VideoBenchmark () {
// WITH FULL EMULATION OF THE CPU, JOYSTICK, AND DISK HAPPENING AT
// THE SAME TIME
DWORD realisticfps = 0;
FillMemory(mem+0x2000,0x2000,0xAA);
memset(mem+0x2000,0xAA,0x2000);
VideoRedrawScreen();
milliseconds = GetTickCount();
while (GetTickCount() == milliseconds) ;
@ -274,9 +274,9 @@ void VideoBenchmark () {
}
}
if (cycle & 1)
FillMemory(mem+0x2000,0x2000,0xAA);
memset(mem+0x2000,0xAA,0x2000);
else
CopyMemory(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000);
memcpy(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000);
VideoRedrawScreen();
if (cycle++ >= 3)
cycle = 0;