use SDL_zeroa at more places where the argument is an array.

This commit is contained in:
Ozkan Sezer 2019-07-31 05:11:40 +03:00
parent 7a47c292c0
commit 4953e050f5
12 changed files with 18 additions and 18 deletions

View File

@ -112,7 +112,7 @@ WaveDebugLogFormat(WaveFile *file)
Uint32 wavebps = format->byterate; Uint32 wavebps = format->byterate;
char channelstr[64]; char channelstr[64];
SDL_zero(channelstr); SDL_zeroa(channelstr);
switch (format->encoding) { switch (format->encoding) {
case PCM_CODE: case PCM_CODE:

View File

@ -619,8 +619,8 @@ QSA_Deinitialize(void)
{ {
/* Clear devices array on shutdown */ /* Clear devices array on shutdown */
/* !!! FIXME: we zero these on init...any reason to do it here? */ /* !!! FIXME: we zero these on init...any reason to do it here? */
SDL_zero(qsa_playback_device); SDL_zeroa(qsa_playback_device);
SDL_zero(qsa_capture_device); SDL_zeroa(qsa_capture_device);
qsa_playback_devices = 0; qsa_playback_devices = 0;
qsa_capture_devices = 0; qsa_capture_devices = 0;
} }
@ -629,8 +629,8 @@ static int
QSA_Init(SDL_AudioDriverImpl * impl) QSA_Init(SDL_AudioDriverImpl * impl)
{ {
/* Clear devices array */ /* Clear devices array */
SDL_zero(qsa_playback_device); SDL_zeroa(qsa_playback_device);
SDL_zero(qsa_capture_device); SDL_zeroa(qsa_capture_device);
qsa_playback_devices = 0; qsa_playback_devices = 0;
qsa_capture_devices = 0; qsa_capture_devices = 0;

View File

@ -387,7 +387,7 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
return SDL_OutOfMemory(); return SDL_OutOfMemory();
} }
SDL_zero(this->hidden->wavebuf); SDL_zeroa(this->hidden->wavebuf);
for (i = 0; i < NUM_BUFFERS; ++i) { for (i = 0; i < NUM_BUFFERS; ++i) {
this->hidden->wavebuf[i].dwBufferLength = this->spec.size; this->hidden->wavebuf[i].dwBufferLength = this->spec.size;
this->hidden->wavebuf[i].dwFlags = WHDR_DONE; this->hidden->wavebuf[i].dwFlags = WHDR_DONE;

View File

@ -223,7 +223,7 @@ SDL_JoystickThread(void *_data)
#if SDL_JOYSTICK_XINPUT #if SDL_JOYSTICK_XINPUT
SDL_bool bOpenedXInputDevices[XUSER_MAX_COUNT]; SDL_bool bOpenedXInputDevices[XUSER_MAX_COUNT];
SDL_zero(bOpenedXInputDevices); SDL_zeroa(bOpenedXInputDevices);
#endif #endif
if (SDL_CreateDeviceNotification(&notification_data) < 0) { if (SDL_CreateDeviceNotification(&notification_data) < 0) {

View File

@ -285,7 +285,7 @@ private:
ssize_t count; ssize_t count;
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void**)&keyUtf8, &count) == B_OK) { if (msg->FindData("key-utf8", B_INT8_TYPE, (const void**)&keyUtf8, &count) == B_OK) {
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
SDL_zero(text); SDL_zeroa(text);
SDL_memcpy(text, keyUtf8, count); SDL_memcpy(text, keyUtf8, count);
SDL_SendKeyboardText(text); SDL_SendKeyboardText(text);
} }

View File

@ -90,7 +90,7 @@ static void SDL_TrackAllocation(void *mem, size_t size)
entry->size = size; entry->size = size;
/* Generate the stack trace for the allocation */ /* Generate the stack trace for the allocation */
SDL_zero(entry->stack); SDL_zeroa(entry->stack);
#ifdef HAVE_LIBUNWIND_H #ifdef HAVE_LIBUNWIND_H
{ {
int stack_index; int stack_index;

View File

@ -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); */ /* printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id); */
SDL_SendKeyboardKey_ex(0, SDL_PRESSED, keysym.scancode); SDL_SendKeyboardKey_ex(0, SDL_PRESSED, keysym.scancode);
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_zero(text); SDL_zeroa(text);
UnicodeToUtf8(unicode, text); UnicodeToUtf8(unicode, text);
if (*text) { if (*text) {
SDL_SendKeyboardText_ex(0, 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); */ /* printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id); */
SDL_SendKeyboardKey_ex(kbd_idx, SDL_PRESSED, keysym.scancode); SDL_SendKeyboardKey_ex(kbd_idx, SDL_PRESSED, keysym.scancode);
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_zero(text); SDL_zeroa(text);
UnicodeToUtf8(unicode, text); UnicodeToUtf8(unicode, text);
if (*text) { if (*text) {
SDL_SendKeyboardText_ex(kbd_idx, text); SDL_SendKeyboardText_ex(kbd_idx, text);

View File

@ -54,7 +54,7 @@ WIN_UpdateDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode *
mode->w = logical_width; mode->w = logical_width;
mode->h = logical_height; mode->h = logical_height;
SDL_zero(bmi_data); SDL_zeroa(bmi_data);
bmi = (LPBITMAPINFO) bmi_data; bmi = (LPBITMAPINFO) bmi_data;
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);

View File

@ -898,7 +898,7 @@ X11_DispatchEvent(_THIS)
} }
#endif #endif
/* */ /* */
SDL_zero(text); SDL_zeroa(text);
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
if (data->ic) { if (data->ic) {
X11_Xutf8LookupString(data->ic, &xevent.xkey, text, sizeof(text), X11_Xutf8LookupString(data->ic, &xevent.xkey, text, sizeof(text),

View File

@ -48,7 +48,7 @@ X11_CreateEmptyCursor()
XColor color; XColor color;
Pixmap pixmap; Pixmap pixmap;
SDL_zero(data); SDL_zeroa(data);
color.red = color.green = color.blue = 0; color.red = color.green = color.blue = 0;
pixmap = X11_XCreateBitmapFromData(display, DefaultRootWindow(display), pixmap = X11_XCreateBitmapFromData(display, DefaultRootWindow(display),
data, 1, 1); data, 1, 1);

View File

@ -626,7 +626,7 @@ static void RunFIFOTest(SDL_bool lock_free)
/* Start the readers first */ /* Start the readers first */
SDL_Log("Starting %d readers\n", NUM_READERS); SDL_Log("Starting %d readers\n", NUM_READERS);
SDL_zero(readerData); SDL_zeroa(readerData);
SDL_AtomicSet(&readersRunning, NUM_READERS); SDL_AtomicSet(&readersRunning, NUM_READERS);
for (i = 0; i < NUM_READERS; ++i) { for (i = 0; i < NUM_READERS; ++i) {
char name[64]; char name[64];
@ -638,7 +638,7 @@ static void RunFIFOTest(SDL_bool lock_free)
/* Start up the writers */ /* Start up the writers */
SDL_Log("Starting %d writers\n", NUM_WRITERS); SDL_Log("Starting %d writers\n", NUM_WRITERS);
SDL_zero(writerData); SDL_zeroa(writerData);
SDL_AtomicSet(&writersRunning, NUM_WRITERS); SDL_AtomicSet(&writersRunning, NUM_WRITERS);
for (i = 0; i < NUM_WRITERS; ++i) { for (i = 0; i < NUM_WRITERS; ++i) {
char name[64]; char name[64];

View File

@ -100,7 +100,7 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write)
int seekPos = SDLTest_RandomIntegerInRange(4, 8); int seekPos = SDLTest_RandomIntegerInRange(4, 8);
/* Clear buffer */ /* Clear buffer */
SDL_zero(buf); SDL_zeroa(buf);
/* Set to start. */ /* Set to start. */
i = SDL_RWseek(rw, 0, RW_SEEK_SET ); i = SDL_RWseek(rw, 0, RW_SEEK_SET );
@ -226,7 +226,7 @@ rwops_testMem (void)
int result; int result;
/* Clear buffer */ /* Clear buffer */
SDL_zero(mem); SDL_zeroa(mem);
/* Open */ /* Open */
rw = SDL_RWFromMem(mem, sizeof(RWopsHelloWorldTestString)-1); rw = SDL_RWFromMem(mem, sizeof(RWopsHelloWorldTestString)-1);