diff options
-rw-r--r-- | engines/tony/gfxcore.cpp | 12 | ||||
-rw-r--r-- | engines/tony/mpal/expr.cpp | 8 | ||||
-rw-r--r-- | engines/tony/mpal/loadmpc.cpp | 10 | ||||
-rw-r--r-- | engines/tony/mpal/memory.cpp | 9 | ||||
-rw-r--r-- | engines/tony/mpal/memory.h | 3 | ||||
-rw-r--r-- | engines/tony/mpal/mpal.cpp | 24 |
6 files changed, 27 insertions, 39 deletions
diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp index 27b90b7d48..806f4d07bb 100644 --- a/engines/tony/gfxcore.cpp +++ b/engines/tony/gfxcore.cpp @@ -135,7 +135,7 @@ RMGfxBuffer::RMGfxBuffer(int dimx, int dimy, int nBpp, bool bUseDDraw) { int RMGfxSourceBuffer::init(const byte *buf, int dimx, int dimy, bool bLoadPalette) { create(dimx, dimy, getBpp()); - copyMemory(_buf, buf, dimx * dimy * getBpp() / 8); + memcpy(_buf, buf, dimx * dimy * getBpp() / 8); // Invokes the method for preparing the surface (inherited) prepareImage(); @@ -484,7 +484,7 @@ int RMGfxSourceBufferPal::loadPaletteWA(const byte *buf, bool bSwapped) { _pal[i * 3 + 2] = buf[i * 3 + 0]; } } else { - copyMemory(_pal, buf, (1 << getBpp()) * 3); + memcpy(_pal, buf, (1 << getBpp()) * 3); } preparePalette(); @@ -496,7 +496,7 @@ int RMGfxSourceBufferPal::loadPalette(const byte *buf) { int i; for (i = 0; i < 256; i++) - copyMemory(_pal + i * 3, buf + i * 4, 3); + memcpy(_pal + i * 3, buf + i * 4, 3); preparePalette(); @@ -984,7 +984,7 @@ void RMGfxSourceBuffer8RLEByte::RLEWriteData(byte *&cur, int rep, byte *src) { *cur ++ = rep; if (rep > 0) { - copyMemory(cur, src, rep); + memcpy(cur, src, rep); cur += rep; src += rep; } @@ -1232,7 +1232,7 @@ void RMGfxSourceBuffer8RLEWord::RLEWriteData(byte *&cur, int rep, byte *src) { cur += 2; if (rep > 0) { - copyMemory(cur, src, rep); + memcpy(cur, src, rep); cur += rep; src += rep; } @@ -1683,7 +1683,7 @@ void RMGfxSourceBuffer8AA::calculateAA() { delete[] _aabuf; _aabuf = new byte[_dimx * _dimy]; - copyMemory(_aabuf, _megaAABuf, _dimx * _dimy); + memcpy(_aabuf, _megaAABuf, _dimx * _dimy); } RMGfxSourceBuffer8AA::RMGfxSourceBuffer8AA() : RMGfxSourceBuffer8() { diff --git a/engines/tony/mpal/expr.cpp b/engines/tony/mpal/expr.cpp index 7cf2cb3fc8..eb6b485ef6 100644 --- a/engines/tony/mpal/expr.cpp +++ b/engines/tony/mpal/expr.cpp @@ -121,7 +121,7 @@ static byte *duplicateExpression(HGLOBAL h) { clone = (byte *)globalAlloc(GMEM_FIXED, sizeof(EXPRESSION) * num + 1); two = (LPEXPRESSION)(clone + 1); - copyMemory(clone, orig, sizeof(EXPRESSION) * num + 1); + memcpy(clone, orig, sizeof(EXPRESSION) * num + 1); for (i = 0; i < num; i++) { if (one->type == ELT_PARENTH) { @@ -191,7 +191,7 @@ static void solve(LPEXPRESSION one, int num) { two = one + 1; if ((two->symbol == 0) || (one->symbol & 0xF0) <= (two->symbol & 0xF0)) { two->val.num = Compute(one->val.num, two->val.num, one->symbol); - copyMemory(one, two, (num - 1) * sizeof(EXPRESSION)); + memcpy(one, two, (num - 1) * sizeof(EXPRESSION)); --num; } else { j = 1; @@ -203,7 +203,7 @@ static void solve(LPEXPRESSION one, int num) { } three->val.num = Compute(two->val.num, three->val.num, two->symbol); - copyMemory(two, three, (num - j - 1) * sizeof(EXPRESSION)); + memcpy(two, three, (num - j - 1) * sizeof(EXPRESSION)); --num; } } @@ -291,7 +291,7 @@ const byte *parseExpression(const byte *lpBuf, HGLOBAL *h) { cur->val.name = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, (*lpBuf) + 1); if (cur->val.name == NULL) return NULL; - copyMemory(cur->val.name, lpBuf + 1, *lpBuf); + memcpy(cur->val.name, lpBuf + 1, *lpBuf); lpBuf += *lpBuf + 1; break; diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp index 371a94e24a..a0dff2927a 100644 --- a/engines/tony/mpal/loadmpc.cpp +++ b/engines/tony/mpal/loadmpc.cpp @@ -102,7 +102,7 @@ static const byte *ParseScript(const byte *lpBuf, LPMPALSCRIPT lpmsScript) { lpmsScript->_command[curCmd].lpszVarName = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1); if (lpmsScript->_command[curCmd].lpszVarName == NULL) return NULL; - copyMemory(lpmsScript->_command[curCmd].lpszVarName, lpBuf, len); + memcpy(lpmsScript->_command[curCmd].lpszVarName, lpBuf, len); lpBuf += len; lpBuf = parseExpression(lpBuf, &lpmsScript->_command[curCmd].expr); @@ -346,7 +346,7 @@ static const byte *parseItem(const byte *lpBuf, LPMPALITEM lpmiItem) { len = *lpBuf; lpBuf++; - copyMemory(lpmiItem->lpszDescribe, lpBuf, MIN((byte)127, len)); + memcpy(lpmiItem->lpszDescribe, lpBuf, MIN((byte)127, len)); lpBuf += len; if (len >= MAX_DESCRIBE_SIZE) @@ -416,7 +416,7 @@ static const byte *parseItem(const byte *lpBuf, LPMPALITEM lpmiItem) { lpmiItem->_command[curCmd].lpszVarName = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1); if (lpmiItem->_command[curCmd].lpszVarName == NULL) return NULL; - copyMemory(lpmiItem->_command[curCmd].lpszVarName, lpBuf, len); + memcpy(lpmiItem->_command[curCmd].lpszVarName, lpBuf, len); lpBuf += len; lpBuf = parseExpression(lpBuf, &lpmiItem->_command[curCmd].expr); @@ -548,7 +548,7 @@ bool ParseMpc(const byte *lpBuf) { for (i = 0; i < GLOBALS._nVars; i++) { wLen = *(const byte *)lpBuf; lpBuf++; - copyMemory(GLOBALS._lpmvVars->lpszVarName, lpBuf, MIN(wLen, (uint16)32)); + memcpy(GLOBALS._lpmvVars->lpszVarName, lpBuf, MIN(wLen, (uint16)32)); lpBuf += wLen; GLOBALS._lpmvVars->dwVal = READ_LE_UINT32(lpBuf); lpBuf += 4; @@ -590,7 +590,7 @@ bool ParseMpc(const byte *lpBuf) { lpTemp = (byte *)globalLock(GLOBALS._lpmmMsgs->_hText); for (j = 0; lpBuf[j] != 0;) { - copyMemory(lpTemp, &lpBuf[j + 1], lpBuf[j]); + memcpy(lpTemp, &lpBuf[j + 1], lpBuf[j]); lpTemp += lpBuf[j]; *lpTemp ++= '\0'; j += lpBuf[j] + 1; diff --git a/engines/tony/mpal/memory.cpp b/engines/tony/mpal/memory.cpp index c5e752d390..3a68ecb559 100644 --- a/engines/tony/mpal/memory.cpp +++ b/engines/tony/mpal/memory.cpp @@ -124,15 +124,6 @@ void MemoryManager::unlockItem(HANDLE handle) { } -/****************************************************************************\ -* Stand-alone methods -\****************************************************************************/ - -void copyMemory(void *dst, const void *first, int size) { - Common::copy((const byte *)first, (const byte *)first + size, (byte *)dst); -} - - } // end of namespace MPAL } // end of namespace Tony diff --git a/engines/tony/mpal/memory.h b/engines/tony/mpal/memory.h index 52d527544a..c7e4896cf9 100644 --- a/engines/tony/mpal/memory.h +++ b/engines/tony/mpal/memory.h @@ -70,9 +70,6 @@ public: #define GMEM_MOVEABLE 2 #define GMEM_ZEROINIT 4 -// Stand-alone methods -extern void copyMemory(void *dst, const void *first, int size); - } // end of namespace MPAL } // end of namespace Tony diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index 20c28c5c93..76ca8a5db3 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -313,7 +313,7 @@ static char *DuplicateMessage(uint32 nMsgOrd) { if (clonemsg == NULL) return NULL; - copyMemory(clonemsg, origmsg, j); + memcpy(clonemsg, origmsg, j); globalUnlock(GLOBALS._lpmmMsgs[nMsgOrd]._hText); return clonemsg; @@ -346,7 +346,7 @@ static char *duplicateDialogPeriod(uint32 nPeriod) { if (clonemsg == NULL) return NULL; - copyMemory(clonemsg, origmsg, i); + memcpy(clonemsg, origmsg, i); globalUnlock(dialog->_periods[j]); @@ -546,7 +546,7 @@ static LPITEM getItemData(uint32 nOrdItem) { if (ret->_frames[i] == NULL) return NULL; - copyMemory(ret->_frames[i], dat, dim); + memcpy(ret->_frames[i], dat, dim); dat += dim; } @@ -906,7 +906,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { _ctx->MyActions[_ctx->k].perc = _ctx->curItem->Action[_ctx->j].perc; _ctx->MyActions[_ctx->k].when = _ctx->curItem->Action[_ctx->j].when; _ctx->MyActions[_ctx->k].nCmds = _ctx->curItem->Action[_ctx->j].nCmds; - copyMemory(_ctx->MyActions[_ctx->k].CmdNum, _ctx->curItem->Action[_ctx->j].CmdNum, + memcpy(_ctx->MyActions[_ctx->k].CmdNum, _ctx->curItem->Action[_ctx->j].CmdNum, MAX_COMMANDS_PER_ACTION * sizeof(uint16)); _ctx->MyActions[_ctx->k].dwLastTime = g_vm->getTime(); @@ -995,12 +995,12 @@ void LocationPollThread(CORO_PARAM, const void *param) { return; } - copyMemory(_ctx->newItem,_ctx->curItem, sizeof(MPALITEM)); + memcpy(_ctx->newItem,_ctx->curItem, sizeof(MPALITEM)); unlockItems(); /* We copy the action in #0 */ // _ctx->newItem->Action[0].nCmds = _ctx->curItem->Action[_ctx->j].nCmds; -// copyMemory(_ctx->newItem->Action[0].CmdNum,_ctx->curItem->Action[_ctx->j].CmdNum,_ctx->newItem->Action[0].nCmds*sizeof(_ctx->newItem->Action[0].CmdNum[0])); +// memcpy(_ctx->newItem->Action[0].CmdNum,_ctx->curItem->Action[_ctx->j].CmdNum,_ctx->newItem->Action[0].nCmds*sizeof(_ctx->newItem->Action[0].CmdNum[0])); _ctx->newItem->dwRes=_ctx->j; /* We will create an action, and will provide the necessary details */ @@ -1298,7 +1298,7 @@ static uint32 doAction(uint32 nAction, uint32 ordItem, uint32 dwParam) { // In the new version number of the action in writing dwRes Common::copy((byte *)item, (byte *)item + sizeof(MPALITEM), (byte *)newitem); /* newitem->Action[0].nCmds=item->Action[i].nCmds; - copyMemory(newitem->Action[0].CmdNum,item->Action[i].CmdNum,newitem->Action[0].nCmds*sizeof(newitem->Action[0].CmdNum[0])); + memcpy(newitem->Action[0].CmdNum,item->Action[i].CmdNum,newitem->Action[0].nCmds*sizeof(newitem->Action[0].CmdNum[0])); */ newitem->dwRes = i; @@ -1679,7 +1679,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { else { lockItems(); y = itemGetOrderFromNum(x); - copyMemory(n, (char *)(GLOBALS._lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE); + memcpy(n, (char *)(GLOBALS._lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE); unlockItems(); } @@ -1857,7 +1857,7 @@ HANDLE mpalQueryHANDLE(uint16 wQueryType, ...) { else { lockItems(); y = itemGetOrderFromNum(x); - copyMemory(n, (char *)(GLOBALS._lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE); + memcpy(n, (char *)(GLOBALS._lpmiItems + y)->lpszDescribe, MAX_DESCRIBE_SIZE); unlockItems(); } @@ -1986,7 +1986,7 @@ bool mpalExecuteScript(int nScript) { if (s == NULL) return false; - copyMemory(s, GLOBALS._lpmsScripts + n, sizeof(MPALSCRIPT)); + memcpy(s, GLOBALS._lpmsScripts + n, sizeof(MPALSCRIPT)); unlockScripts(); // !!! New process management @@ -2095,7 +2095,7 @@ int mpalGetSaveStateSize() { void mpalSaveState(byte *buf) { lockVar(); WRITE_LE_UINT32(buf, GLOBALS._nVars); - copyMemory(buf + 4, (byte *)GLOBALS._lpmvVars, GLOBALS._nVars * sizeof(MPALVAR)); + memcpy(buf + 4, (byte *)GLOBALS._lpmvVars, GLOBALS._nVars * sizeof(MPALVAR)); unlockVar(); } @@ -2114,7 +2114,7 @@ int mpalLoadState(byte *buf) { GLOBALS._hVars = globalAllocate(GMEM_ZEROINIT | GMEM_MOVEABLE, GLOBALS._nVars * sizeof(MPALVAR)); lockVar(); - copyMemory((byte *)GLOBALS._lpmvVars, buf + 4, GLOBALS._nVars * sizeof(MPALVAR)); + memcpy((byte *)GLOBALS._lpmvVars, buf + 4, GLOBALS._nVars * sizeof(MPALVAR)); unlockVar(); return GLOBALS._nVars * sizeof(MPALVAR) + 4; |