From 0d76380042800417381d871527c33e2c4a3ad9dd Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 9 Mar 2023 15:10:00 -0800
Subject: [PATCH] Code style: changed "sizeof foo" to "sizeof(foo)" (thanks
@sezero!)
(cherry picked from commit c6443d86c92e962683a1efe5f123a144988875b5)
---
src/audio/SDL_audio.c | 2 +-
src/audio/aaudio/SDL_aaudio.c | 2 +-
src/audio/alsa/SDL_alsa_audio.c | 3 +-
src/audio/android/SDL_androidaudio.c | 2 +-
src/audio/arts/SDL_artsaudio.c | 3 +-
src/audio/coreaudio/SDL_coreaudio.m | 3 +-
src/audio/directsound/SDL_directsound.c | 3 +-
src/audio/dsp/SDL_dspaudio.c | 3 +-
src/audio/emscripten/SDL_emscriptenaudio.c | 4 +-
src/audio/esd/SDL_esdaudio.c | 3 +-
src/audio/fusionsound/SDL_fsaudio.c | 3 +-
src/audio/jack/SDL_jackaudio.c | 3 +-
src/audio/n3ds/SDL_n3dsaudio.c | 2 +-
src/audio/nacl/SDL_naclaudio.c | 26 +-
src/audio/nas/SDL_nasaudio.c | 9 +-
src/audio/netbsd/SDL_netbsdaudio.c | 3 +-
src/audio/openslES/SDL_openslES.c | 2 +-
src/audio/paudio/SDL_paudio.c | 3 +-
src/audio/pulseaudio/SDL_pulseaudio.c | 3 +-
src/audio/sun/SDL_sunaudio.c | 3 +-
src/audio/wasapi/SDL_wasapi.c | 4 +-
src/audio/winmm/SDL_winmm.c | 15 +-
src/core/linux/SDL_evdev.c | 2 +-
src/core/linux/SDL_fcitx.c | 4 +-
src/core/linux/SDL_ibus.c | 6 +-
src/core/windows/SDL_windows.c | 2 +-
src/cpuinfo/SDL_cpuinfo.c | 8 +-
src/dynapi/SDL_dynapi.c | 4 +-
src/file/SDL_rwops.c | 2 +-
src/haptic/SDL_haptic.c | 6 +-
src/haptic/windows/SDL_xinputhaptic.c | 4 +-
src/joystick/SDL_gamecontroller.c | 8 +-
src/joystick/bsd/SDL_bsdjoystick.c | 2 +-
src/joystick/haiku/SDL_haikujoystick.cc | 4 +-
src/joystick/hidapi/SDL_hidapi_ps3.c | 2 +-
src/joystick/hidapi/SDL_hidapi_ps4.c | 10 +-
src/joystick/hidapi/SDL_hidapi_ps5.c | 6 +-
src/joystick/hidapi/SDL_hidapi_switch.c | 2 +-
src/joystick/linux/SDL_sysjoystick.c | 4 +-
src/joystick/windows/SDL_dinputjoystick.c | 14 +-
.../windows/SDL_windows_gaming_input.c | 4 +-
src/joystick/windows/SDL_xinputjoystick.c | 22 +-
src/render/metal/SDL_render_metal.m | 26 +-
src/render/ps2/SDL_render_ps2.c | 2 +-
src/sensor/n3ds/SDL_n3dssensor.c | 4 +-
src/test/SDL_test_common.c | 78 ++---
src/test/SDL_test_font.c | 2 +-
src/test/SDL_test_harness.c | 4 +-
src/test/SDL_test_log.c | 2 +-
src/test/SDL_test_memory.c | 10 +-
src/timer/os2/SDL_systimer.c | 4 +-
src/video/directfb/SDL_DirectFB_render.c | 8 +-
src/video/dummy/SDL_nullframebuffer.c | 2 +-
src/video/kmsdrm/SDL_kmsdrmvideo.c | 4 +-
.../offscreen/SDL_offscreenframebuffer.c | 3 +-
src/video/wayland/SDL_waylandevents.c | 26 +-
src/video/wayland/SDL_waylandvideo.c | 2 +-
src/video/wayland/SDL_waylandwindow.c | 2 +-
src/video/x11/SDL_x11keyboard.c | 2 +-
test/checkkeys.c | 2 +-
test/checkkeysthreads.c | 2 +-
test/controllermap.c | 12 +-
test/testatomic.c | 12 +-
test/testdisplayinfo.c | 2 +-
test/testlock.c | 4 +-
test/testoffscreen.c | 3 +-
test/testsem.c | 12 +-
test/testsensor.c | 2 +-
test/testwm.c | 301 ++++++++++++++++++
test/testyuv.c | 2 +-
test/torturethread.c | 4 +-
71 files changed, 525 insertions(+), 234 deletions(-)
create mode 100644 test/testwm.c
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 46ea9fa9bb14..0a34d4f7c0ed 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -1511,7 +1511,7 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture,
const size_t stacksize = is_internal_thread ? 64 * 1024 : 0;
char threadname[64];
- (void)SDL_snprintf(threadname, sizeof threadname, "SDLAudio%c%" SDL_PRIu32, (iscapture) ? 'C' : 'P', device->id);
+ (void)SDL_snprintf(threadname, sizeof(threadname), "SDLAudio%c%" SDL_PRIu32, (iscapture) ? 'C' : 'P', device->id);
device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, threadname, stacksize, device);
if (device->thread == NULL) {
diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c
index 376afa00aab0..35f3b4e01294 100644
--- a/src/audio/aaudio/SDL_aaudio.c
+++ b/src/audio/aaudio/SDL_aaudio.c
@@ -93,7 +93,7 @@ static int aaudio_OpenDevice(_THIS, const char *devname)
audioDevice = this;
}
- this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, (sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c
index 3e49af8271fa..c531613573fa 100644
--- a/src/audio/alsa/SDL_alsa_audio.c
+++ b/src/audio/alsa/SDL_alsa_audio.c
@@ -538,8 +538,7 @@ static int ALSA_OpenDevice(_THIS, const char *devname)
#endif
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c
index 2639aad38720..b46fdda093a7 100644
--- a/src/audio/android/SDL_androidaudio.c
+++ b/src/audio/android/SDL_androidaudio.c
@@ -50,7 +50,7 @@ static int ANDROIDAUDIO_OpenDevice(_THIS, const char *devname)
audioDevice = this;
}
- this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, (sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/arts/SDL_artsaudio.c b/src/audio/arts/SDL_artsaudio.c
index 7c37608a082e..38e11904ae5b 100644
--- a/src/audio/arts/SDL_artsaudio.c
+++ b/src/audio/arts/SDL_artsaudio.c
@@ -223,8 +223,7 @@ ARTS_OpenDevice(_THIS, const char *devname)
SDL_AudioFormat test_format = 0;
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m
index 401971165fe4..1b2db8700dc3 100644
--- a/src/audio/coreaudio/SDL_coreaudio.m
+++ b/src/audio/coreaudio/SDL_coreaudio.m
@@ -1015,8 +1015,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname)
SDL_AudioDevice **new_open_devices;
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c
index d93b064524f3..a61a068f7161 100644
--- a/src/audio/directsound/SDL_directsound.c
+++ b/src/audio/directsound/SDL_directsound.c
@@ -492,8 +492,7 @@ static int DSOUND_OpenDevice(_THIS, const char *devname)
DWORD bufsize;
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c
index baf7a08b2595..441aa2574f41 100644
--- a/src/audio/dsp/SDL_dspaudio.c
+++ b/src/audio/dsp/SDL_dspaudio.c
@@ -85,8 +85,7 @@ static int DSP_OpenDevice(_THIS, const char *devname)
}
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c
index 84fbb0f2c759..af5f09565190 100644
--- a/src/audio/emscripten/SDL_emscriptenaudio.c
+++ b/src/audio/emscripten/SDL_emscriptenaudio.c
@@ -125,7 +125,7 @@ static void HandleCaptureProcess(_THIS)
}
}
}
- }, this->work_buffer, (this->spec.size / sizeof (float)) / this->spec.channels);
+ }, this->work_buffer, (this->spec.size / sizeof(float)) / this->spec.channels);
/* *INDENT-ON* */ /* clang-format on */
/* okay, we've got an interleaved float32 array in C now. */
@@ -255,7 +255,7 @@ static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname)
/* Initialize all variables that we clean on shutdown */
#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */
this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/esd/SDL_esdaudio.c b/src/audio/esd/SDL_esdaudio.c
index db8567b5694a..0f49b09d6189 100644
--- a/src/audio/esd/SDL_esdaudio.c
+++ b/src/audio/esd/SDL_esdaudio.c
@@ -215,8 +215,7 @@ ESD_OpenDevice(_THIS, const char *devname)
int found = 0;
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/fusionsound/SDL_fsaudio.c b/src/audio/fusionsound/SDL_fsaudio.c
index f5ed59a5cd4c..dccf1f864c62 100644
--- a/src/audio/fusionsound/SDL_fsaudio.c
+++ b/src/audio/fusionsound/SDL_fsaudio.c
@@ -183,8 +183,7 @@ SDL_FS_OpenDevice(_THIS, const char *devname)
DirectResult ret;
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/jack/SDL_jackaudio.c b/src/audio/jack/SDL_jackaudio.c
index 1d22a001d743..f9e942c57a93 100644
--- a/src/audio/jack/SDL_jackaudio.c
+++ b/src/audio/jack/SDL_jackaudio.c
@@ -132,6 +132,7 @@ static int load_jack_syms(void)
SDL_JACK_SYM(jack_port_type);
SDL_JACK_SYM(jack_connect);
SDL_JACK_SYM(jack_set_process_callback);
+
return 0;
}
@@ -301,7 +302,7 @@ static int JACK_OpenDevice(_THIS, const char *devname)
}
/* Filter out non-audio ports */
- audio_ports = SDL_calloc(ports, sizeof *audio_ports);
+ audio_ports = SDL_calloc(ports, sizeof(*audio_ports));
for (i = 0; i < ports; i++) {
const jack_port_t *dport = JACK_jack_port_by_name(client, devports[i]);
const char *type = JACK_jack_port_type(dport);
diff --git a/src/audio/n3ds/SDL_n3dsaudio.c b/src/audio/n3ds/SDL_n3dsaudio.c
index 19f385180518..ddf4e3aaebac 100644
--- a/src/audio/n3ds/SDL_n3dsaudio.c
+++ b/src/audio/n3ds/SDL_n3dsaudio.c
@@ -96,7 +96,7 @@ static int N3DSAUDIO_OpenDevice(_THIS, const char *devname)
Result ndsp_init_res;
Uint8 *data_vaddr;
float mix[12];
- this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof *this->hidden);
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
diff --git a/src/audio/nacl/SDL_naclaudio.c b/src/audio/nacl/SDL_naclaudio.c
index aa9d3de773e0..e18f762ee3f8 100644
--- a/src/audio/nacl/SDL_naclaudio.c
+++ b/src/audio/nacl/SDL_naclaudio.c
@@ -89,7 +89,7 @@ static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) {
const PPB_Core *core = PSInterfaceCore();
const PPB_Audio *ppb_audio = PSInterfaceAudio();
SDL_PrivateAudioData *hidden = (SDL_PrivateAudioData *) device->hidden;
-
+
ppb_audio->StopPlayback(hidden->audio);
core->ReleaseResource(hidden->audio);
}
@@ -99,32 +99,32 @@ NACLAUDIO_OpenDevice(_THIS, const char *devname) {
PP_Instance instance = PSGetInstanceId();
const PPB_Audio *ppb_audio = PSInterfaceAudio();
const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig();
-
- private = (SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *private));
+
+ private = (SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*private));
if (private == NULL) {
return SDL_OutOfMemory();
}
-
+
_this->spec.freq = 44100;
_this->spec.format = AUDIO_S16LSB;
_this->spec.channels = 2;
_this->spec.samples = ppb_audiocfg->RecommendSampleFrameCount(
- instance,
- PP_AUDIOSAMPLERATE_44100,
+ instance,
+ PP_AUDIOSAMPLERATE_44100,
SAMPLE_FRAME_COUNT);
-
+
/* Calculate the final parameters for this audio specification */
SDL_CalculateAudioSpec(&_this->spec);
-
+
private->audio = ppb_audio->Create(
instance,
ppb_audiocfg->CreateStereo16Bit(instance, PP_AUDIOSAMPLERATE_44100, _this->spec.samples),
- nacl_audio_callback,
+ nacl_audio_callback,
_this);
-
+
/* Start audio playback while we are still on the main thread. */
ppb_audio->StartPlayback(private->audio);
-
+
return 0;
}
@@ -134,7 +134,7 @@ NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
if (PSGetInstanceId() == 0) {
return SDL_FALSE;
}
-
+
/* Set the function pointers */
impl->OpenDevice = NACLAUDIO_OpenDevice;
impl->CloseDevice = NACLAUDIO_CloseDevice;
@@ -146,7 +146,7 @@ NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
* impl->PlayDevice = NACLAUDIO_PlayDevice;
* impl->Deinitialize = NACLAUDIO_Deinitialize;
*/
-
+
return SDL_TRUE;
}
diff --git a/src/audio/nas/SDL_nasaudio.c b/src/audio/nas/SDL_nasaudio.c
index 0ba7f6a3a22f..0339ea8551d5 100644
--- a/src/audio/nas/SDL_nasaudio.c
+++ b/src/audio/nas/SDL_nasaudio.c
@@ -197,7 +197,7 @@ NAS_CaptureFromDevice(_THIS, void *buffer, int buflen)
while (SDL_TRUE) {
/* just keep the event queue moving and the server chattering. */
NAS_AuHandleEvents(h->aud);
-
+
retval = (int) NAS_AuReadElement(h->aud, h->flow, 1, buflen, buffer, NULL);
/*printf("read %d capture bytes\n", (int) retval);*/
if (retval == 0) {
@@ -221,10 +221,10 @@ NAS_FlushCapture(_THIS)
do {
/* just keep the event queue moving and the server chattering. */
NAS_AuHandleEvents(h->aud);
- br = NAS_AuReadElement(h->aud, h->flow, 1, sizeof (buf), buf, NULL);
+ br = NAS_AuReadElement(h->aud, h->flow, 1, sizeof(buf), buf, NULL);
/*printf("flushed %d capture bytes\n", (int) br);*/
total += br;
- } while ((br == sizeof (buf)) && (total < this->spec.size));
+ } while ((br == sizeof(buf)) && (total < this->spec.size));
}
static void
@@ -319,8 +319,7 @@ NAS_OpenDevice(_THIS, const char *devname)
SDL_AudioFormat test_format, format = 0;
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/netbsd/SDL_netbsdaudio.c b/src/audio/netbsd/SDL_netbsdaudio.c
index 34239605c2fc..d90f28a9431a 100644
--- a/src/audio/netbsd/SDL_netbsdaudio.c
+++ b/src/audio/netbsd/SDL_netbsdaudio.c
@@ -210,8 +210,7 @@ static int NETBSDAUDIO_OpenDevice(_THIS, const char *devname)
}
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/openslES/SDL_openslES.c b/src/audio/openslES/SDL_openslES.c
index 628ad8bc36ef..998104c24ca2 100644
--- a/src/audio/openslES/SDL_openslES.c
+++ b/src/audio/openslES/SDL_openslES.c
@@ -590,7 +590,7 @@ static int openslES_CreatePCMPlayer(_THIS)
static int openslES_OpenDevice(_THIS, const char *devname)
{
- this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, (sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/paudio/SDL_paudio.c b/src/audio/paudio/SDL_paudio.c
index 962c0315c366..64d4fbbcc55d 100644
--- a/src/audio/paudio/SDL_paudio.c
+++ b/src/audio/paudio/SDL_paudio.c
@@ -238,8 +238,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname)
int fd = -1;
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c
index 784c769a223b..27c6e755ea75 100644
--- a/src/audio/pulseaudio/SDL_pulseaudio.c
+++ b/src/audio/pulseaudio/SDL_pulseaudio.c
@@ -533,8 +533,7 @@ static int PULSEAUDIO_OpenDevice(_THIS, const char *devname)
int rc = 0;
/* Initialize all variables that we clean on shutdown */
- h = this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ h = this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/sun/SDL_sunaudio.c b/src/audio/sun/SDL_sunaudio.c
index 4fdd74a738ed..7ad441acc7b4 100644
--- a/src/audio/sun/SDL_sunaudio.c
+++ b/src/audio/sun/SDL_sunaudio.c
@@ -209,8 +209,7 @@ SUNAUDIO_OpenDevice(_THIS, const char *devname)
}
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/wasapi/SDL_wasapi.c b/src/audio/wasapi/SDL_wasapi.c
index 118b42164c64..dc22ecd0c90d 100644
--- a/src/audio/wasapi/SDL_wasapi.c
+++ b/src/audio/wasapi/SDL_wasapi.c
@@ -49,6 +49,7 @@
static const IID SDL_IID_IAudioRenderClient = { 0xf294acfc, 0x3146, 0x4483, { 0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2 } };
static const IID SDL_IID_IAudioCaptureClient = { 0xc8adbd64, 0xe71e, 0x48a0, { 0xa4, 0xde, 0x18, 0x5c, 0x39, 0x5c, 0xd3, 0x17 } };
+
static void WASAPI_DetectDevices(void)
{
WASAPI_EnumerateEndpoints();
@@ -530,8 +531,7 @@ static int WASAPI_OpenDevice(_THIS, const char *devname)
LPCWSTR devid = (LPCWSTR)this->handle;
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/audio/winmm/SDL_winmm.c b/src/audio/winmm/SDL_winmm.c
index 69e492b5b5f8..92e38bd410bc 100644
--- a/src/audio/winmm/SDL_winmm.c
+++ b/src/audio/winmm/SDL_winmm.c
@@ -35,7 +35,7 @@
/* MinGW32 mmsystem.h doesn't include these structures */
#if defined(__MINGW32__) && defined(_MMSYSTEM_H)
-typedef struct tagWAVEINCAPS2W
+typedef struct tagWAVEINCAPS2W
{
WORD wMid;
WORD wPid;
@@ -192,7 +192,7 @@ WINMM_CaptureFromDevice(_THIS, void *buffer, int buflen)
/* requeue the buffer that just finished. */
result = waveInAddBuffer(this->hidden->hin,
&this->hidden->wavebuf[nextbuf],
- sizeof (this->hidden->wavebuf[nextbuf]));
+ sizeof(this->hidden->wavebuf[nextbuf]));
if (result != MMSYSERR_NOERROR) {
return -1; /* uhoh! Disable the device. */
}
@@ -211,7 +211,7 @@ WINMM_FlushCapture(_THIS)
/* requeue the buffer that just finished without reading from it. */
waveInAddBuffer(this->hidden->hin,
&this->hidden->wavebuf[nextbuf],
- sizeof (this->hidden->wavebuf[nextbuf]));
+ sizeof(this->hidden->wavebuf[nextbuf]));
this->hidden->next_buffer = (nextbuf + 1) % NUM_BUFFERS;
}
}
@@ -229,7 +229,7 @@ WINMM_CloseDevice(_THIS)
if (this->hidden->wavebuf[i].dwUser != 0xFFFF) {
waveOutUnprepareHeader(this->hidden->hout,
&this->hidden->wavebuf[i],
- sizeof (this->hidden->wavebuf[i]));
+ sizeof(this->hidden->wavebuf[i]));
}
}
@@ -244,7 +244,7 @@ WINMM_CloseDevice(_THIS)
if (this->hidden->wavebuf[i].dwUser != 0xFFFF) {
waveInUnprepareHeader(this->hidden->hin,
&this->hidden->wavebuf[i],
- sizeof (this->hidden->wavebuf[i]));
+ sizeof(this->hidden->wavebuf[i]));
}
}
waveInClose(this->hidden->hin);
@@ -300,8 +300,7 @@ WINMM_OpenDevice(_THIS, const char *devname)
}
/* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
@@ -361,7 +360,7 @@ WINMM_OpenDevice(_THIS, const char *devname)
if (iscapture) {
WAVEINCAPS caps;
result = waveInGetDevCaps((UINT) this->hidden->hout,
- &caps, sizeof (caps));
+ &caps, sizeof(caps));
if (result != MMSYSERR_NOERROR) {
return SetMMerror("waveInGetDevCaps()", result);
}
diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c
index bd4567c22122..e997aae4923a 100644
--- a/src/core/linux/SDL_evdev.c
+++ b/src/core/linux/SDL_evdev.c
@@ -290,7 +290,7 @@ void SDL_EVDEV_Poll(void)
mouse = SDL_GetMouse();
for (item = _this->first; item != NULL; item = item->next) {
- while ((len = read(item->fd, events, (sizeof events))) > 0) {
+ while ((len = read(item->fd, events, sizeof(events))) > 0) {
len /= sizeof(events[0]);
for (i = 0; i < len; ++i) {
/* special handling for touchscreen, that should eventually be
diff --git a/src/core/linux/SDL_fcitx.c b/src/core/linux/SDL_fcitx.c
index 46cabbb010c7..d6484f708365 100644
--- a/src/core/linux/SDL_fcitx.c
+++ b/src/core/linux/SDL_fcitx.c
@@ -64,9 +64,9 @@ static char *GetAppName()
int linksize;
#if defined(__LINUX__)
- (void)SDL_snprintf(procfile, sizeof procfile, "/proc/%d/exe", getpid());
+ (void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid());
#elif defined(__FREEBSD__)
- (void)SDL_snprintf(procfile, sizeof procfile, "/proc/%d/file", getpid());
+ (void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid());
#endif
linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
if (linksize > 0) {
diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c
index d0e08753d086..f7007c15a6e3 100644
--- a/src/core/linux/SDL_ibus.c
+++ b/src/core/linux/SDL_ibus.c
@@ -407,13 +407,13 @@ static char *IBus_GetDBusAddressFilename(void)
SDL_free(display);
return NULL;
}
- (void)SDL_snprintf(config_dir, sizeof config_dir, "%s/.config", home_env);
+ (void)SDL_snprintf(config_dir, sizeof(config_dir), "%s/.config", home_env);
}
key = dbus->get_local_machine_id();
SDL_memset(file_path, 0, sizeof(file_path));
- (void)SDL_snprintf(file_path, sizeof file_path, "%s/ibus/bus/%s-%s-%s",
+ (void)SDL_snprintf(file_path, sizeof(file_path), "%s/ibus/bus/%s-%s-%s",
config_dir, key, host, disp_num);
dbus->free(key);
SDL_free(display);
@@ -491,7 +491,7 @@ static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char *addr)
if (result) {
char matchstr[128];
- (void)SDL_snprintf(matchstr, sizeof matchstr, "type='signal',interface='%s'", ibus_input_interface);
+ (void)SDL_snprintf(matchstr, sizeof(matchstr), "type='signal',interface='%s'", ibus_input_interface);
SDL_free(input_ctx_path);
input_ctx_path = SDL_strdup(path);
SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL);
diff --git a/src/core/windows/SDL_windows.c b/src/core/windows/SDL_windows.c
index c010956773b8..a2f0d5300790 100644
--- a/src/core/windows/SDL_windows.c
+++ b/src/core/windows/SDL_windows.c
@@ -268,7 +268,7 @@ WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
}
ptr = (const unsigned char *)guid;
- (void)SDL_snprintf(keystr, sizeof keystr,
+ (void)SDL_snprintf(keystr, sizeof(keystr),
"System\\CurrentControlSet\\Control\\MediaCategories\\{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
ptr[3], ptr[2], ptr[1], ptr[0], ptr[5], ptr[4], ptr[7], ptr[6],
ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13], ptr[14], ptr[15]);
diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c
index 65e86a420bad..b82bb791f790 100644
--- a/src/cpuinfo/SDL_cpuinfo.c
+++ b/src/cpuinfo/SDL_cpuinfo.c
@@ -159,7 +159,7 @@ static int CPU_haveCPUID(void)
: "%eax", "%ecx"
);
#elif (defined(__GNUC__) || defined(__llvm__)) && defined(__x86_64__)
-/* Technically, if this is being compiled under __x86_64__ then it has
+/* Technically, if this is being compiled under __x86_64__ then it has
CPUid by definition. But it's nice to be able to prove it. :) */
__asm__ (
" pushfq # Get original EFLAGS \n"
@@ -386,7 +386,7 @@ static int CPU_haveARMSIMD(void)
fd = open("/proc/self/auxv", O_RDONLY | O_CLOEXEC);
if (fd >= 0) {
Elf32_auxv_t aux;
- while (read(fd, &aux, sizeof aux) == sizeof aux) {
+ while (read(fd, &aux, sizeof(aux)) == sizeof(aux)) {
if (aux.a_type == AT_PLATFORM) {
const char *plat = (const char *)aux.a_un.a_val;
if (plat) {
@@ -1173,7 +1173,7 @@ SDL_SIMDAlloc(const size_t len)
Uint8 *ptr;
size_t to_allocate;
- /* alignment + padding + sizeof (void *) is bounded (a few hundred
+ /* alignment + padding + sizeof(void *) is bounded (a few hundred
* bytes max), so no need to check for overflow within that argument */
if (SDL_size_add_overflow(len, alignment + padding + sizeof(void *), &to_allocate)) {
return NULL;
@@ -1200,7 +1200,7 @@ SDL_SIMDRealloc(void *mem, const size_t len)
Uint8 *ptr;
size_t to_allocate;
- /* alignment + padding + sizeof (void *) is bounded (a few hundred
+ /* alignment + padding + sizeof(void *) is bounded (a few hundred
* bytes max), so no need to check for overflow within that argument */
if (SDL_size_add_overflow(len, alignment + padding + sizeof(void *), &to_allocate)) {
return NULL;
diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c
index eac122aef22c..72542ab49083 100644
--- a/src/dynapi/SDL_dynapi.c
+++ b/src/dynapi/SDL_dynapi.c
@@ -42,9 +42,9 @@
/* This is the version of the dynamic API. This doesn't match the SDL version
and should not change until there's been a major revamp in API/ABI.
So 2.0.5 adds functions over 2.0.4? This number doesn't change;
- the sizeof (jump_table) changes instead. But 2.1.0 changes how a function
+ the sizeof(jump_table) changes instead. But 2.1.0 changes how a function
works in an incompatible way or removes a function? This number changes,
- since sizeof (jump_table) isn't sufficient anymore. It's likely
+ since sizeof(jump_table) isn't sufficient anymore. It's likely
we'll forget to bump every time we add a function, so this is the
failsafe switch for major API change decisions. Respect it and use it
sparingly. */
diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c
index 1a3b9d358795..3e3f4bb9e04b 100644
--- a/src/file/SDL_rwops.c
+++ b/src/file/SDL_rwops.c
@@ -704,7 +704,7 @@ SDL_AllocRW(void)
{
SDL_RWops *area;
- area = (SDL_RWops *)SDL_malloc(sizeof *area);
+ area = (SDL_RWops *)SDL_malloc(sizeof(*area));
if (area == NULL) {
SDL_OutOfMemory();
} else {
diff --git a/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c
index f3b931a8d467..c3220dab54a5 100644
--- a/src/haptic/SDL_haptic.c
+++ b/src/haptic/SDL_haptic.c
@@ -125,14 +125,14 @@ SDL_HapticOpen(int device_index)
}
/* Create the haptic device */
- haptic = (SDL_Haptic *)SDL_malloc((sizeof *haptic));
+ haptic = (SDL_Haptic *)SDL_malloc(sizeof(*haptic));
if (haptic == NULL) {
SDL_OutOfMemory();
return NULL;
}
/* Initialize the haptic device */
- SDL_memset(haptic, 0, (sizeof *haptic));
+ SDL_memset(haptic, 0, sizeof(*haptic));
haptic->rumble_id = -1;
haptic->index = device_index;
if (SDL_SYS_HapticOpen(haptic) < 0) {
@@ -299,7 +299,7 @@ SDL_HapticOpenFromJoystick(SDL_Joystick *joystick)
}
/* Create the haptic device */
- haptic = (SDL_Haptic *)SDL_malloc((sizeof *haptic));
+ haptic = (SDL_Haptic *)SDL_malloc(sizeof(*haptic));
if (haptic == NULL) {
SDL_OutOfMemory();
(Patch may be truncated, please check the link at the top of this post.)