Code style: changed "sizeof foo" to "sizeof(foo)" (thanks @sezero!)

This commit is contained in:
Sam Lantinga
2023-03-09 15:10:00 -08:00
parent ad95c93bf4
commit c6443d86c9
57 changed files with 176 additions and 179 deletions

View File

@@ -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();
SDL_UnlockJoysticks();

View File

@@ -88,7 +88,7 @@ int SDL_XINPUT_HapticMaybeAddDevice(const DWORD dwUserid)
/* !!! FIXME: I'm not bothering to query for a real name right now (can we even?) */
{
char buf[64];
(void)SDL_snprintf(buf, sizeof buf, "XInput Controller #%u", userid + 1);
(void)SDL_snprintf(buf, sizeof(buf), "XInput Controller #%u", userid + 1);
item->name = SDL_strdup(buf);
}
@@ -199,7 +199,7 @@ static int SDL_XINPUT_HapticOpenFromUserIndex(SDL_Haptic *haptic, const Uint8 us
return SDL_SetError("Couldn't create XInput haptic mutex");
}
(void)SDL_snprintf(threadName, sizeof threadName, "SDLXInputDev%u", userid);
(void)SDL_snprintf(threadName, sizeof(threadName), "SDLXInputDev%d", userid);
haptic->hwdata->thread = SDL_CreateThreadInternal(SDL_RunXInputHaptic, threadName, 64 * 1024, haptic->hwdata);
if (haptic->hwdata->thread == NULL) {