Skip to content

Commit

Permalink
Changed overlapping memcpy to memmove
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 11, 2017
1 parent eb9e693 commit 8446d4a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/events/SDL_events.c
Expand Up @@ -705,7 +705,7 @@ SDL_PushEvent(SDL_Event * event)
{
event->common.timestamp = SDL_GetTicks();

if (SDL_EventOK.callback || SDL_event_watchers_count != 0) {
if (SDL_EventOK.callback || SDL_event_watchers_count > 0) {
if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
if (SDL_EventOK.callback && !SDL_EventOK.callback(SDL_EventOK.userdata, event)) {
if (SDL_event_watchers_lock) {
Expand All @@ -731,7 +731,7 @@ SDL_PushEvent(SDL_Event * event)
if (SDL_event_watchers[i].removed) {
--SDL_event_watchers_count;
if (i < SDL_event_watchers_count) {
SDL_memcpy(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i]));
SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i]));
}
}
}
Expand Down Expand Up @@ -831,7 +831,7 @@ SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)
} else {
--SDL_event_watchers_count;
if (i < SDL_event_watchers_count) {
SDL_memcpy(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i]));
SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i]));
}
}
break;
Expand Down

0 comments on commit 8446d4a

Please sign in to comment.