From 4953e050f5dd690ae2f22eeb3ba8db524ddaeabc Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Wed, 31 Jul 2019 05:11:40 +0300 Subject: [PATCH] use SDL_zeroa at more places where the argument is an array. --- src/audio/SDL_wave.c | 2 +- src/audio/qsa/SDL_qsa_audio.c | 8 ++++---- src/audio/winmm/SDL_winmm.c | 2 +- src/joystick/windows/SDL_windowsjoystick.c | 2 +- src/main/haiku/SDL_BApp.h | 2 +- src/test/SDL_test_memory.c | 2 +- src/video/directfb/SDL_DirectFB_events.c | 4 ++-- src/video/windows/SDL_windowsmodes.c | 2 +- src/video/x11/SDL_x11events.c | 2 +- src/video/x11/SDL_x11mouse.c | 2 +- test/testatomic.c | 4 ++-- test/testautomation_rwops.c | 4 ++-- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c index ed6e41036..71cda8929 100644 --- a/src/audio/SDL_wave.c +++ b/src/audio/SDL_wave.c @@ -112,7 +112,7 @@ WaveDebugLogFormat(WaveFile *file) Uint32 wavebps = format->byterate; char channelstr[64]; - SDL_zero(channelstr); + SDL_zeroa(channelstr); switch (format->encoding) { case PCM_CODE: diff --git a/src/audio/qsa/SDL_qsa_audio.c b/src/audio/qsa/SDL_qsa_audio.c index b601f8541..7d0e27e7c 100644 --- a/src/audio/qsa/SDL_qsa_audio.c +++ b/src/audio/qsa/SDL_qsa_audio.c @@ -619,8 +619,8 @@ QSA_Deinitialize(void) { /* Clear devices array on shutdown */ /* !!! FIXME: we zero these on init...any reason to do it here? */ - SDL_zero(qsa_playback_device); - SDL_zero(qsa_capture_device); + SDL_zeroa(qsa_playback_device); + SDL_zeroa(qsa_capture_device); qsa_playback_devices = 0; qsa_capture_devices = 0; } @@ -629,8 +629,8 @@ static int QSA_Init(SDL_AudioDriverImpl * impl) { /* Clear devices array */ - SDL_zero(qsa_playback_device); - SDL_zero(qsa_capture_device); + SDL_zeroa(qsa_playback_device); + SDL_zeroa(qsa_capture_device); qsa_playback_devices = 0; qsa_capture_devices = 0; diff --git a/src/audio/winmm/SDL_winmm.c b/src/audio/winmm/SDL_winmm.c index dca2f9734..c52913956 100644 --- a/src/audio/winmm/SDL_winmm.c +++ b/src/audio/winmm/SDL_winmm.c @@ -387,7 +387,7 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_OutOfMemory(); } - SDL_zero(this->hidden->wavebuf); + SDL_zeroa(this->hidden->wavebuf); for (i = 0; i < NUM_BUFFERS; ++i) { this->hidden->wavebuf[i].dwBufferLength = this->spec.size; this->hidden->wavebuf[i].dwFlags = WHDR_DONE; diff --git a/src/joystick/windows/SDL_windowsjoystick.c b/src/joystick/windows/SDL_windowsjoystick.c index cc2c2026f..2d2db153d 100644 --- a/src/joystick/windows/SDL_windowsjoystick.c +++ b/src/joystick/windows/SDL_windowsjoystick.c @@ -223,7 +223,7 @@ SDL_JoystickThread(void *_data) #if SDL_JOYSTICK_XINPUT SDL_bool bOpenedXInputDevices[XUSER_MAX_COUNT]; - SDL_zero(bOpenedXInputDevices); + SDL_zeroa(bOpenedXInputDevices); #endif if (SDL_CreateDeviceNotification(¬ification_data) < 0) { diff --git a/src/main/haiku/SDL_BApp.h b/src/main/haiku/SDL_BApp.h index ae51ebc16..48a29799a 100644 --- a/src/main/haiku/SDL_BApp.h +++ b/src/main/haiku/SDL_BApp.h @@ -285,7 +285,7 @@ private: ssize_t count; if (msg->FindData("key-utf8", B_INT8_TYPE, (const void**)&keyUtf8, &count) == B_OK) { char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; - SDL_zero(text); + SDL_zeroa(text); SDL_memcpy(text, keyUtf8, count); SDL_SendKeyboardText(text); } diff --git a/src/test/SDL_test_memory.c b/src/test/SDL_test_memory.c index 6fb9682b0..611f76fcc 100644 --- a/src/test/SDL_test_memory.c +++ b/src/test/SDL_test_memory.c @@ -90,7 +90,7 @@ static void SDL_TrackAllocation(void *mem, size_t size) entry->size = size; /* Generate the stack trace for the allocation */ - SDL_zero(entry->stack); + SDL_zeroa(entry->stack); #ifdef HAVE_LIBUNWIND_H { int stack_index; diff --git a/src/video/directfb/SDL_DirectFB_events.c b/src/video/directfb/SDL_DirectFB_events.c index 010f133cb..f24268683 100644 --- a/src/video/directfb/SDL_DirectFB_events.c +++ b/src/video/directfb/SDL_DirectFB_events.c @@ -236,7 +236,7 @@ ProcessWindowEvent(_THIS, SDL_Window *sdlwin, DFBWindowEvent * evt) /* printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id); */ SDL_SendKeyboardKey_ex(0, SDL_PRESSED, keysym.scancode); if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { - SDL_zero(text); + SDL_zeroa(text); UnicodeToUtf8(unicode, text); if (*text) { SDL_SendKeyboardText_ex(0, text); @@ -372,7 +372,7 @@ ProcessInputEvent(_THIS, DFBInputEvent * ievt) /* printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id); */ SDL_SendKeyboardKey_ex(kbd_idx, SDL_PRESSED, keysym.scancode); if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { - SDL_zero(text); + SDL_zeroa(text); UnicodeToUtf8(unicode, text); if (*text) { SDL_SendKeyboardText_ex(kbd_idx, text); diff --git a/src/video/windows/SDL_windowsmodes.c b/src/video/windows/SDL_windowsmodes.c index 960030213..15fa4427c 100644 --- a/src/video/windows/SDL_windowsmodes.c +++ b/src/video/windows/SDL_windowsmodes.c @@ -54,7 +54,7 @@ WIN_UpdateDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode->w = logical_width; mode->h = logical_height; - SDL_zero(bmi_data); + SDL_zeroa(bmi_data); bmi = (LPBITMAPINFO) bmi_data; bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index cd46effb7..dd37b2ce3 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -898,7 +898,7 @@ X11_DispatchEvent(_THIS) } #endif /* */ - SDL_zero(text); + SDL_zeroa(text); #ifdef X_HAVE_UTF8_STRING if (data->ic) { X11_Xutf8LookupString(data->ic, &xevent.xkey, text, sizeof(text), diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 044035d0d..380b2e7f3 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -48,7 +48,7 @@ X11_CreateEmptyCursor() XColor color; Pixmap pixmap; - SDL_zero(data); + SDL_zeroa(data); color.red = color.green = color.blue = 0; pixmap = X11_XCreateBitmapFromData(display, DefaultRootWindow(display), data, 1, 1); diff --git a/test/testatomic.c b/test/testatomic.c index 0a7d08424..1095dd0e4 100644 --- a/test/testatomic.c +++ b/test/testatomic.c @@ -626,7 +626,7 @@ static void RunFIFOTest(SDL_bool lock_free) /* Start the readers first */ SDL_Log("Starting %d readers\n", NUM_READERS); - SDL_zero(readerData); + SDL_zeroa(readerData); SDL_AtomicSet(&readersRunning, NUM_READERS); for (i = 0; i < NUM_READERS; ++i) { char name[64]; @@ -638,7 +638,7 @@ static void RunFIFOTest(SDL_bool lock_free) /* Start up the writers */ SDL_Log("Starting %d writers\n", NUM_WRITERS); - SDL_zero(writerData); + SDL_zeroa(writerData); SDL_AtomicSet(&writersRunning, NUM_WRITERS); for (i = 0; i < NUM_WRITERS; ++i) { char name[64]; diff --git a/test/testautomation_rwops.c b/test/testautomation_rwops.c index 9a1a29a72..b5d5b1d32 100644 --- a/test/testautomation_rwops.c +++ b/test/testautomation_rwops.c @@ -100,7 +100,7 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) int seekPos = SDLTest_RandomIntegerInRange(4, 8); /* Clear buffer */ - SDL_zero(buf); + SDL_zeroa(buf); /* Set to start. */ i = SDL_RWseek(rw, 0, RW_SEEK_SET ); @@ -226,7 +226,7 @@ rwops_testMem (void) int result; /* Clear buffer */ - SDL_zero(mem); + SDL_zeroa(mem); /* Open */ rw = SDL_RWFromMem(mem, sizeof(RWopsHelloWorldTestString)-1);