Fix bug 4746 - introduce SDL_zeroa macro.
authorOzkan Sezer <sezeroz@gmail.com>
Wed, 31 Jul 2019 01:22:02 +0300
changeset 129660262d439e9c6
parent 12965 cac903c755a1
child 12968 0e3948762c96
Fix bug 4746 - introduce SDL_zeroa macro.
include/SDL_stdinc.h
src/audio/SDL_audio.c
src/audio/SDL_audiocvt.c
src/audio/SDL_wave.c
src/joystick/SDL_gamecontroller.c
     1.1 --- a/include/SDL_stdinc.h	Wed Jul 31 01:19:26 2019 +0300
     1.2 +++ b/include/SDL_stdinc.h	Wed Jul 31 01:22:02 2019 +0300
     1.3 @@ -415,6 +415,7 @@
     1.4  
     1.5  #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
     1.6  #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
     1.7 +#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
     1.8  
     1.9  /* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
    1.10  SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
     2.1 --- a/src/audio/SDL_audio.c	Wed Jul 31 01:19:26 2019 +0300
     2.2 +++ b/src/audio/SDL_audio.c	Wed Jul 31 01:22:02 2019 +0300
     2.3 @@ -948,7 +948,7 @@
     2.4      }
     2.5  
     2.6      SDL_zero(current_audio);
     2.7 -    SDL_zero(open_devices);
     2.8 +    SDL_zeroa(open_devices);
     2.9  
    2.10      /* Select the proper audio driver */
    2.11      if (driver_name == NULL) {
    2.12 @@ -1608,7 +1608,7 @@
    2.13      SDL_DestroyMutex(current_audio.detectionLock);
    2.14  
    2.15      SDL_zero(current_audio);
    2.16 -    SDL_zero(open_devices);
    2.17 +    SDL_zeroa(open_devices);
    2.18  
    2.19  #ifdef HAVE_LIBSAMPLERATE_H
    2.20      UnloadLibSampleRate();
     3.1 --- a/src/audio/SDL_audiocvt.c	Wed Jul 31 01:19:26 2019 +0300
     3.2 +++ b/src/audio/SDL_audiocvt.c	Wed Jul 31 01:22:02 2019 +0300
     3.3 @@ -915,7 +915,7 @@
     3.4      cvt->dst_format = dst_fmt;
     3.5      cvt->needed = 0;
     3.6      cvt->filter_index = 0;
     3.7 -    SDL_zero(cvt->filters);
     3.8 +    SDL_zeroa(cvt->filters);
     3.9      cvt->len_mult = 1;
    3.10      cvt->len_ratio = 1.0;
    3.11      cvt->rate_incr = ((double) dst_rate) / ((double) src_rate);
     4.1 --- a/src/audio/SDL_wave.c	Wed Jul 31 01:19:26 2019 +0300
     4.2 +++ b/src/audio/SDL_wave.c	Wed Jul 31 01:22:02 2019 +0300
     4.3 @@ -647,7 +647,7 @@
     4.4      MS_ADPCM_ChannelState cstate[2];
     4.5  
     4.6      SDL_zero(state);
     4.7 -    SDL_zero(cstate);
     4.8 +    SDL_zeroa(cstate);
     4.9  
    4.10      if (chunk->size != chunk->length) {
    4.11          /* Could not read everything. Recalculate number of sample frames. */
     5.1 --- a/src/joystick/SDL_gamecontroller.c	Wed Jul 31 01:19:26 2019 +0300
     5.2 +++ b/src/joystick/SDL_gamecontroller.c	Wed Jul 31 01:22:02 2019 +0300
     5.3 @@ -642,8 +642,8 @@
     5.4      int i = 0;
     5.5      const char *pchPos = pchString;
     5.6  
     5.7 -    SDL_zero(szGameButton);
     5.8 -    SDL_zero(szJoystickButton);
     5.9 +    SDL_zeroa(szGameButton);
    5.10 +    SDL_zeroa(szJoystickButton);
    5.11  
    5.12      while (pchPos && *pchPos) {
    5.13          if (*pchPos == ':') {
    5.14 @@ -655,8 +655,8 @@
    5.15              i = 0;
    5.16              bGameButton = SDL_TRUE;
    5.17              SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton);
    5.18 -            SDL_zero(szGameButton);
    5.19 -            SDL_zero(szJoystickButton);
    5.20 +            SDL_zeroa(szGameButton);
    5.21 +            SDL_zeroa(szJoystickButton);
    5.22  
    5.23          } else if (bGameButton) {
    5.24              if (i >= sizeof(szGameButton)) {