Skip to content
Permalink
Browse files

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

  • Loading branch information
sezero committed Jul 31, 2019
1 parent 7a47c29 commit 4953e050f5dd690ae2f22eeb3ba8db524ddaeabc
@@ -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:
@@ -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;

@@ -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;
@@ -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(&notification_data) < 0) {
@@ -285,7 +285,7 @@ class SDL_BApp : public BApplication {
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);
}
@@ -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;
@@ -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);
@@ -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);

@@ -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),
@@ -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);
@@ -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];
@@ -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);

0 comments on commit 4953e05

Please sign in to comment.