Commit 8446d4a05a8dfb6c4c44085881a34538c34e42ae

Sam Lantinga 2017-10-10T20:11:05

Changed overlapping memcpy to memmove

diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c
index 27444d7..0049c90 100644
--- a/src/events/SDL_events.c
+++ b/src/events/SDL_events.c
@@ -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) {
@@ -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]));
                             }
                         }
                     }
@@ -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;