Fixed potentially overlapping memcpy() to use memmove()
This commit is contained in:
parent
191a6417d5
commit
49dd24e195
4 changed files with 4 additions and 4 deletions
|
@ -883,7 +883,7 @@ static int FindLifecycleEvent(SDL_AndroidLifecycleEvent event)
|
|||
static void RemoveLifecycleEvent(int index)
|
||||
{
|
||||
if (index < Android_NumLifecycleEvents - 1) {
|
||||
SDL_memcpy(&Android_LifecycleEvents[index], &Android_LifecycleEvents[index+1], (Android_NumLifecycleEvents - index - 1) * sizeof(Android_LifecycleEvents[index]));
|
||||
SDL_memmove(&Android_LifecycleEvents[index], &Android_LifecycleEvents[index+1], (Android_NumLifecycleEvents - index - 1) * sizeof(Android_LifecycleEvents[index]));
|
||||
}
|
||||
--Android_NumLifecycleEvents;
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ static bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
|
|||
j = -1;
|
||||
for (i = 0; i < 12; i += 2) {
|
||||
j += 1;
|
||||
SDL_memcpy(&serial[j], &device->serial[i], 2);
|
||||
SDL_memmove(&serial[j], &device->serial[i], 2);
|
||||
j += 2;
|
||||
serial[j] = '-';
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
|
|||
j = -1;
|
||||
for (i = 0; i < 12; i += 2) {
|
||||
j += 1;
|
||||
SDL_memcpy(&serial[j], &device->serial[i], 2);
|
||||
SDL_memmove(&serial[j], &device->serial[i], 2);
|
||||
j += 2;
|
||||
serial[j] = '-';
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char
|
|||
if (newline) {
|
||||
if (textwin->current == textwin->numlines - 1) {
|
||||
SDL_free(textwin->lines[0]);
|
||||
SDL_memcpy(&textwin->lines[0], &textwin->lines[1], (textwin->numlines - 1) * sizeof(textwin->lines[1]));
|
||||
SDL_memmove(&textwin->lines[0], &textwin->lines[1], (textwin->numlines - 1) * sizeof(textwin->lines[1]));
|
||||
textwin->lines[textwin->current] = NULL;
|
||||
} else {
|
||||
++textwin->current;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue