update sdl to 2.32.6

This commit is contained in:
AzaezelX 2025-05-24 13:39:03 -05:00
parent e557f5962b
commit ddc1f8c1e2
1339 changed files with 53966 additions and 19207 deletions

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -157,7 +157,7 @@ int SDL_SYS_HapticInit(void)
/* Get HID devices. */
match = IOServiceMatching(kIOHIDDeviceKey);
if (match == NULL) {
if (!match) {
return SDL_SetError("Haptic: Failed to get IOServiceMatching.");
}
@ -229,7 +229,7 @@ int MacHaptic_MaybeAddDevice(io_object_t device)
}
item = (SDL_hapticlist_item *)SDL_calloc(1, sizeof(SDL_hapticlist_item));
if (item == NULL) {
if (!item) {
return SDL_SetError("Could not allocate haptic storage");
}
@ -265,7 +265,7 @@ int MacHaptic_MaybeAddDevice(io_object_t device)
CFRelease(hidProperties);
}
if (SDL_hapticlist_tail == NULL) {
if (!SDL_hapticlist_tail) {
SDL_hapticlist = SDL_hapticlist_tail = item;
} else {
SDL_hapticlist_tail->next = item;
@ -287,12 +287,12 @@ int MacHaptic_MaybeRemoveDevice(io_object_t device)
return -1; /* not initialized. ignore this. */
}
for (item = SDL_hapticlist; item != NULL; item = item->next) {
for (item = SDL_hapticlist; item; item = item->next) {
/* found it, remove it. */
if (IOObjectIsEqualTo((io_object_t)item->dev, device)) {
const int retval = item->haptic ? item->haptic->index : -1;
if (prev != NULL) {
if (prev) {
prev->next = item->next;
} else {
SDL_assert(SDL_hapticlist == item);
@ -478,7 +478,7 @@ static int SDL_SYS_HapticOpenFromService(SDL_Haptic *haptic, io_service_t servic
/* Allocate the hwdata */
haptic->hwdata = (struct haptic_hwdata *)
SDL_malloc(sizeof(*haptic->hwdata));
if (haptic->hwdata == NULL) {
if (!haptic->hwdata) {
SDL_OutOfMemory();
goto creat_err;
}
@ -516,7 +516,7 @@ static int SDL_SYS_HapticOpenFromService(SDL_Haptic *haptic, io_service_t servic
/* Allocate effects memory. */
haptic->effects = (struct haptic_effect *)
SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
if (haptic->effects == NULL) {
if (!haptic->effects) {
SDL_OutOfMemory();
goto open_err;
}
@ -530,7 +530,7 @@ static int SDL_SYS_HapticOpenFromService(SDL_Haptic *haptic, io_service_t servic
open_err:
FFReleaseDevice(haptic->hwdata->device);
creat_err:
if (haptic->hwdata != NULL) {
if (haptic->hwdata) {
SDL_free(haptic->hwdata);
haptic->hwdata = NULL;
}
@ -703,7 +703,7 @@ static int SDL_SYS_SetDirection(FFEFFECT *effect, SDL_HapticDirection *dir, int
/* Has axes. */
rglDir = SDL_malloc(sizeof(LONG) * naxes);
if (rglDir == NULL) {
if (!rglDir) {
return SDL_OutOfMemory();
}
SDL_memset(rglDir, 0, sizeof(LONG) * naxes);
@ -776,7 +776,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe
/* Envelope. */
envelope = SDL_malloc(sizeof(FFENVELOPE));
if (envelope == NULL) {
if (!envelope) {
return SDL_OutOfMemory();
}
SDL_memset(envelope, 0, sizeof(FFENVELOPE));
@ -791,7 +791,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe
}
if (dest->cAxes > 0) {
axes = SDL_malloc(sizeof(DWORD) * dest->cAxes);
if (axes == NULL) {
if (!axes) {
return SDL_OutOfMemory();
}
axes[0] = haptic->hwdata->axes[0]; /* Always at least one axis. */
@ -809,7 +809,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe
case SDL_HAPTIC_CONSTANT:
hap_constant = &src->constant;
constant = SDL_malloc(sizeof(FFCONSTANTFORCE));
if (constant == NULL) {
if (!constant) {
return SDL_OutOfMemory();
}
SDL_memset(constant, 0, sizeof(FFCONSTANTFORCE));
@ -851,7 +851,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe
case SDL_HAPTIC_SAWTOOTHDOWN:
hap_periodic = &src->periodic;
periodic = SDL_malloc(sizeof(FFPERIODIC));
if (periodic == NULL) {
if (!periodic) {
return SDL_OutOfMemory();
}
SDL_memset(periodic, 0, sizeof(FFPERIODIC));
@ -896,7 +896,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe
hap_condition = &src->condition;
if (dest->cAxes > 0) {
condition = SDL_malloc(sizeof(FFCONDITION) * dest->cAxes);
if (condition == NULL) {
if (!condition) {
return SDL_OutOfMemory();
}
SDL_memset(condition, 0, sizeof(FFCONDITION));
@ -939,7 +939,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe
case SDL_HAPTIC_RAMP:
hap_ramp = &src->ramp;
ramp = SDL_malloc(sizeof(FFRAMPFORCE));
if (ramp == NULL) {
if (!ramp) {
return SDL_OutOfMemory();
}
SDL_memset(ramp, 0, sizeof(FFRAMPFORCE));
@ -977,7 +977,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe
case SDL_HAPTIC_CUSTOM:
hap_custom = &src->custom;
custom = SDL_malloc(sizeof(FFCUSTOMFORCE));
if (custom == NULL) {
if (!custom) {
return SDL_OutOfMemory();
}
SDL_memset(custom, 0, sizeof(FFCUSTOMFORCE));
@ -1037,7 +1037,7 @@ static void SDL_SYS_HapticFreeFFEFFECT(FFEFFECT *effect, int type)
effect->lpEnvelope = NULL;
SDL_free(effect->rgdwAxes);
effect->rgdwAxes = NULL;
if (effect->lpvTypeSpecificParams != NULL) {
if (effect->lpvTypeSpecificParams) {
if (type == SDL_HAPTIC_CUSTOM) { /* Must free the custom data. */
custom = (FFCUSTOMFORCE *)effect->lpvTypeSpecificParams;
SDL_free(custom->rglForceData);
@ -1112,14 +1112,14 @@ int SDL_SYS_HapticNewEffect(SDL_Haptic *haptic, struct haptic_effect *effect,
/* Alloc the effect. */
effect->hweffect = (struct haptic_hweffect *)
SDL_malloc(sizeof(struct haptic_hweffect));
if (effect->hweffect == NULL) {
if (!effect->hweffect) {
SDL_OutOfMemory();
goto err_hweffect;
}
/* Get the type. */
type = SDL_SYS_HapticEffectType(base->type);
if (type == NULL) {
if (!type) {
goto err_hweffect;
}

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages