Skip to content

Commit

Permalink
use SDL_zeroa at more places where the argument is an array.
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Jul 31, 2019
1 parent 7a47c29 commit 4953e05
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/audio/SDL_wave.c
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions src/audio/qsa/SDL_qsa_audio.c
Expand Up @@ -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;
}
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/audio/winmm/SDL_winmm.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/joystick/windows/SDL_windowsjoystick.c
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/haiku/SDL_BApp.h
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/SDL_test_memory.c
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/video/directfb/SDL_DirectFB_events.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/video/windows/SDL_windowsmodes.c
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/video/x11/SDL_x11events.c
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/video/x11/SDL_x11mouse.c
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions test/testatomic.c
Expand Up @@ -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];
Expand All @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions test/testautomation_rwops.c
Expand Up @@ -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 );
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4953e05

Please sign in to comment.