mirror of https://github.com/encounter/SDL.git
Fix bug 4746 - introduce SDL_zeroa macro.
This commit is contained in:
parent
f96d7cc0fd
commit
7a47c292c0
|
@ -415,6 +415,7 @@ extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c,
|
||||||
|
|
||||||
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
|
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
|
||||||
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
|
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
|
||||||
|
#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
|
||||||
|
|
||||||
/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
|
/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
|
||||||
SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
|
SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
|
||||||
|
|
|
@ -948,7 +948,7 @@ SDL_AudioInit(const char *driver_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_zero(current_audio);
|
SDL_zero(current_audio);
|
||||||
SDL_zero(open_devices);
|
SDL_zeroa(open_devices);
|
||||||
|
|
||||||
/* Select the proper audio driver */
|
/* Select the proper audio driver */
|
||||||
if (driver_name == NULL) {
|
if (driver_name == NULL) {
|
||||||
|
@ -1608,7 +1608,7 @@ SDL_AudioQuit(void)
|
||||||
SDL_DestroyMutex(current_audio.detectionLock);
|
SDL_DestroyMutex(current_audio.detectionLock);
|
||||||
|
|
||||||
SDL_zero(current_audio);
|
SDL_zero(current_audio);
|
||||||
SDL_zero(open_devices);
|
SDL_zeroa(open_devices);
|
||||||
|
|
||||||
#ifdef HAVE_LIBSAMPLERATE_H
|
#ifdef HAVE_LIBSAMPLERATE_H
|
||||||
UnloadLibSampleRate();
|
UnloadLibSampleRate();
|
||||||
|
|
|
@ -915,7 +915,7 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
|
||||||
cvt->dst_format = dst_fmt;
|
cvt->dst_format = dst_fmt;
|
||||||
cvt->needed = 0;
|
cvt->needed = 0;
|
||||||
cvt->filter_index = 0;
|
cvt->filter_index = 0;
|
||||||
SDL_zero(cvt->filters);
|
SDL_zeroa(cvt->filters);
|
||||||
cvt->len_mult = 1;
|
cvt->len_mult = 1;
|
||||||
cvt->len_ratio = 1.0;
|
cvt->len_ratio = 1.0;
|
||||||
cvt->rate_incr = ((double) dst_rate) / ((double) src_rate);
|
cvt->rate_incr = ((double) dst_rate) / ((double) src_rate);
|
||||||
|
|
|
@ -647,7 +647,7 @@ MS_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len)
|
||||||
MS_ADPCM_ChannelState cstate[2];
|
MS_ADPCM_ChannelState cstate[2];
|
||||||
|
|
||||||
SDL_zero(state);
|
SDL_zero(state);
|
||||||
SDL_zero(cstate);
|
SDL_zeroa(cstate);
|
||||||
|
|
||||||
if (chunk->size != chunk->length) {
|
if (chunk->size != chunk->length) {
|
||||||
/* Could not read everything. Recalculate number of sample frames. */
|
/* Could not read everything. Recalculate number of sample frames. */
|
||||||
|
|
|
@ -642,8 +642,8 @@ SDL_PrivateGameControllerParseControllerConfigString(SDL_GameController *gamecon
|
||||||
int i = 0;
|
int i = 0;
|
||||||
const char *pchPos = pchString;
|
const char *pchPos = pchString;
|
||||||
|
|
||||||
SDL_zero(szGameButton);
|
SDL_zeroa(szGameButton);
|
||||||
SDL_zero(szJoystickButton);
|
SDL_zeroa(szJoystickButton);
|
||||||
|
|
||||||
while (pchPos && *pchPos) {
|
while (pchPos && *pchPos) {
|
||||||
if (*pchPos == ':') {
|
if (*pchPos == ':') {
|
||||||
|
@ -655,8 +655,8 @@ SDL_PrivateGameControllerParseControllerConfigString(SDL_GameController *gamecon
|
||||||
i = 0;
|
i = 0;
|
||||||
bGameButton = SDL_TRUE;
|
bGameButton = SDL_TRUE;
|
||||||
SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton);
|
SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton);
|
||||||
SDL_zero(szGameButton);
|
SDL_zeroa(szGameButton);
|
||||||
SDL_zero(szJoystickButton);
|
SDL_zeroa(szJoystickButton);
|
||||||
|
|
||||||
} else if (bGameButton) {
|
} else if (bGameButton) {
|
||||||
if (i >= sizeof(szGameButton)) {
|
if (i >= sizeof(szGameButton)) {
|
||||||
|
|
Loading…
Reference in New Issue