From c70f54e28beedcb8ac004963e32a39bf5224c55f Mon Sep 17 00:00:00 2001
From: Petar Popovic <[EMAIL REDACTED]>
Date: Fri, 21 Feb 2025 17:30:24 +0100
Subject: [PATCH] Remove redundant casts
---
.../01-joystick-polling/joystick-polling.c | 6 +-
.../09-scaling-textures/scaling-textures.c | 4 +-
src/audio/SDL_audio.c | 2 +-
src/camera/SDL_camera.c | 16 +++---
src/events/SDL_mouse.c | 2 +-
src/gpu/vulkan/SDL_gpu_vulkan.c | 56 +++++++++----------
src/render/vulkan/SDL_render_vulkan.c | 2 +-
src/test/SDL_test_fuzzer.c | 2 +-
src/video/wayland/SDL_waylandvideo.c | 2 +-
src/video/x11/SDL_x11events.c | 10 ++--
src/video/x11/SDL_x11pen.c | 14 ++---
src/video/x11/SDL_x11shape.c | 2 +-
src/video/x11/SDL_x11xinput2.c | 6 +-
src/video/x11/SDL_x11xsync.c | 12 ++--
test/testaudiohotplug.c | 4 +-
test/testautomation_render.c | 4 +-
test/testdraw.c | 4 +-
test/testdrawchessboard.c | 4 +-
test/testrendercopyex.c | 4 +-
test/testrendertarget.c | 8 +--
test/testscale.c | 4 +-
test/testviewport.c | 2 +-
22 files changed, 85 insertions(+), 85 deletions(-)
diff --git a/examples/input/01-joystick-polling/joystick-polling.c b/examples/input/01-joystick-polling/joystick-polling.c
index 8f7a3156df57a..6eb23b83d8793 100644
--- a/examples/input/01-joystick-polling/joystick-polling.c
+++ b/examples/input/01-joystick-polling/joystick-polling.c
@@ -105,7 +105,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
/* draw axes as bars going across middle of screen. We don't know if it's an X or Y or whatever axis, so we can't do more than this. */
total = SDL_GetNumJoystickAxes(joystick);
- y = (float) ((winh - (total * size)) / 2);
+ y = (winh - (total * size)) / 2;
x = ((float) winw) / 2.0f;
for (i = 0; i < total; i++) {
const SDL_Color *color = &colors[i % SDL_arraysize(colors)];
@@ -119,7 +119,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
/* draw buttons as blocks across top of window. We only know the button numbers, but not where they are on the device. */
total = SDL_GetNumJoystickButtons(joystick);
- x = (float) ((winw - (total * size)) / 2);
+ x = (winw - (total * size)) / 2;
for (i = 0; i < total; i++) {
const SDL_Color *color = &colors[i % SDL_arraysize(colors)];
const SDL_FRect dst = { x, 0.0f, size, size };
@@ -136,7 +136,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
/* draw hats across the bottom of the screen. */
total = SDL_GetNumJoystickHats(joystick);
- x = ((float) ((winw - (total * (size * 2.0f))) / 2.0f)) + (size / 2.0f);
+ x = ((winw - (total * (size * 2.0f))) / 2.0f) + (size / 2.0f);
y = ((float) winh) - size;
for (i = 0; i < total; i++) {
const SDL_Color *color = &colors[i % SDL_arraysize(colors)];
diff --git a/examples/renderer/09-scaling-textures/scaling-textures.c b/examples/renderer/09-scaling-textures/scaling-textures.c
index 71a94c65a7d41..66060ed72806a 100644
--- a/examples/renderer/09-scaling-textures/scaling-textures.c
+++ b/examples/renderer/09-scaling-textures/scaling-textures.c
@@ -92,8 +92,8 @@ SDL_AppResult SDL_AppIterate(void *appstate)
/* center this one and make it grow and shrink. */
dst_rect.w = (float) texture_width + (texture_width * scale);
dst_rect.h = (float) texture_height + (texture_height * scale);
- dst_rect.x = ((float) (WINDOW_WIDTH - dst_rect.w)) / 2.0f;
- dst_rect.y = ((float) (WINDOW_HEIGHT - dst_rect.h)) / 2.0f;
+ dst_rect.x = (WINDOW_WIDTH - dst_rect.w) / 2.0f;
+ dst_rect.y = (WINDOW_HEIGHT - dst_rect.h) / 2.0f;
SDL_RenderTexture(renderer, texture, NULL, &dst_rect);
SDL_RenderPresent(renderer); /* put it all on the screen! */
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index f9d80da5d0a48..583a159110977 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -889,7 +889,7 @@ static bool SDLCALL FindLowestDeviceID(void *userdata, const SDL_HashTable *tabl
static SDL_AudioDevice *GetFirstAddedAudioDevice(const bool recording)
{
- const SDL_AudioDeviceID highest = (SDL_AudioDeviceID) SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK; // According to AssignAudioDeviceInstanceId, nothing can have a value this large.
+ const SDL_AudioDeviceID highest = SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK; // According to AssignAudioDeviceInstanceId, nothing can have a value this large.
// (Device IDs increase as new devices are added, so the first device added has the lowest SDL_AudioDeviceID value.)
FindLowestDeviceIDData data = { recording, highest, NULL };
diff --git a/src/camera/SDL_camera.c b/src/camera/SDL_camera.c
index e2b05c23b3a5c..0640ea968a7f3 100644
--- a/src/camera/SDL_camera.c
+++ b/src/camera/SDL_camera.c
@@ -649,7 +649,7 @@ SDL_Camera *SDL_FindPhysicalCameraByCallback(bool (*callback)(SDL_Camera *device
void SDL_CloseCamera(SDL_Camera *camera)
{
- SDL_Camera *device = (SDL_Camera *) camera; // currently there's no separation between physical and logical device.
+ SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ClosePhysicalCamera(device);
}
@@ -663,7 +663,7 @@ bool SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec)
return SDL_InvalidParamError("spec");
}
- SDL_Camera *device = (SDL_Camera *) camera; // currently there's no separation between physical and logical device.
+ SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
if (device->permission > 0) {
SDL_copyp(spec, &device->spec);
@@ -1208,7 +1208,7 @@ SDL_Camera *SDL_OpenCamera(SDL_CameraID instance_id, const SDL_CameraSpec *spec)
ReleaseCamera(device); // unlock, we're good to go!
- return (SDL_Camera *) device; // currently there's no separation between physical and logical device.
+ return device; // currently there's no separation between physical and logical device.
}
SDL_Surface *SDL_AcquireCameraFrame(SDL_Camera *camera, Uint64 *timestampNS)
@@ -1222,7 +1222,7 @@ SDL_Surface *SDL_AcquireCameraFrame(SDL_Camera *camera, Uint64 *timestampNS)
return NULL;
}
- SDL_Camera *device = (SDL_Camera *) camera; // currently there's no separation between physical and logical device.
+ SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
@@ -1264,7 +1264,7 @@ void SDL_ReleaseCameraFrame(SDL_Camera *camera, SDL_Surface *frame)
return;
}
- SDL_Camera *device = (SDL_Camera *) camera; // currently there's no separation between physical and logical device.
+ SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
SurfaceList *slistprev = &device->app_held_output_surfaces;
@@ -1306,7 +1306,7 @@ SDL_CameraID SDL_GetCameraID(SDL_Camera *camera)
if (!camera) {
SDL_InvalidParamError("camera");
} else {
- SDL_Camera *device = (SDL_Camera *) camera; // currently there's no separation between physical and logical device.
+ SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
result = device->instance_id;
ReleaseCamera(device);
@@ -1321,7 +1321,7 @@ SDL_PropertiesID SDL_GetCameraProperties(SDL_Camera *camera)
if (!camera) {
SDL_InvalidParamError("camera");
} else {
- SDL_Camera *device = (SDL_Camera *) camera; // currently there's no separation between physical and logical device.
+ SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
if (device->props == 0) {
device->props = SDL_CreateProperties();
@@ -1340,7 +1340,7 @@ int SDL_GetCameraPermissionState(SDL_Camera *camera)
SDL_InvalidParamError("camera");
result = -1;
} else {
- SDL_Camera *device = (SDL_Camera *) camera; // currently there's no separation between physical and logical device.
+ SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
result = device->permission;
ReleaseCamera(device);
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 69f4228fe5801..85107b2b35c58 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -484,7 +484,7 @@ SDL_SystemCursor SDL_GetDefaultSystemCursor(void)
const char *value = SDL_GetHint(SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR);
if (value) {
int index = SDL_atoi(value);
- if (0 <= index && index < (int)SDL_SYSTEM_CURSOR_COUNT) {
+ if (0 <= index && index < SDL_SYSTEM_CURSOR_COUNT) {
id = (SDL_SystemCursor)index;
}
}
diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c
index 945175408d8c1..b8c900ea4b762 100644
--- a/src/gpu/vulkan/SDL_gpu_vulkan.c
+++ b/src/gpu/vulkan/SDL_gpu_vulkan.c
@@ -5337,7 +5337,7 @@ static void VULKAN_DrawIndexedPrimitives(
Uint32 firstInstance)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VULKAN_INTERNAL_BindGraphicsDescriptorSets(renderer, vulkanCommandBuffer);
@@ -5358,7 +5358,7 @@ static void VULKAN_DrawPrimitives(
Uint32 firstInstance)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VULKAN_INTERNAL_BindGraphicsDescriptorSets(renderer, vulkanCommandBuffer);
@@ -5377,7 +5377,7 @@ static void VULKAN_DrawPrimitivesIndirect(
Uint32 drawCount)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer *)buffer)->activeBuffer;
Uint32 pitch = sizeof(SDL_GPUIndirectDrawCommand);
Uint32 i;
@@ -5414,7 +5414,7 @@ static void VULKAN_DrawIndexedPrimitivesIndirect(
Uint32 drawCount)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer *)buffer)->activeBuffer;
Uint32 pitch = sizeof(SDL_GPUIndexedIndirectDrawCommand);
Uint32 i;
@@ -5547,7 +5547,7 @@ static void VULKAN_InsertDebugLabel(
const char *text)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VkDebugUtilsLabelEXT labelInfo;
if (renderer->supportsDebugUtils) {
@@ -5566,7 +5566,7 @@ static void VULKAN_PushDebugGroup(
const char *name)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VkDebugUtilsLabelEXT labelInfo;
if (renderer->supportsDebugUtils) {
@@ -5584,7 +5584,7 @@ static void VULKAN_PopDebugGroup(
SDL_GPUCommandBuffer *commandBuffer)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
if (renderer->supportsDebugUtils) {
renderer->vkCmdEndDebugUtilsLabelEXT(vulkanCommandBuffer->commandBuffer);
@@ -7307,8 +7307,8 @@ static void VULKAN_INTERNAL_SetCurrentViewport(
VulkanCommandBuffer *commandBuffer,
const SDL_GPUViewport *viewport)
{
- VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanCommandBuffer *vulkanCommandBuffer = commandBuffer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
vulkanCommandBuffer->currentViewport.x = viewport->x;
vulkanCommandBuffer->currentViewport.width = viewport->w;
@@ -7341,7 +7341,7 @@ static void VULKAN_INTERNAL_SetCurrentScissor(
VulkanCommandBuffer *vulkanCommandBuffer,
const SDL_Rect *scissor)
{
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
vulkanCommandBuffer->currentScissor.offset.x = scissor->x;
vulkanCommandBuffer->currentScissor.offset.y = scissor->y;
@@ -7370,7 +7370,7 @@ static void VULKAN_INTERNAL_SetCurrentBlendConstants(
VulkanCommandBuffer *vulkanCommandBuffer,
SDL_FColor blendConstants)
{
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
vulkanCommandBuffer->blendConstants[0] = blendConstants.r;
vulkanCommandBuffer->blendConstants[1] = blendConstants.g;
@@ -7397,7 +7397,7 @@ static void VULKAN_INTERNAL_SetCurrentStencilReference(
VulkanCommandBuffer *vulkanCommandBuffer,
Uint8 reference)
{
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
vulkanCommandBuffer->stencilRef = reference;
@@ -7706,7 +7706,7 @@ static void VULKAN_BeginRenderPass(
const SDL_GPUDepthStencilTargetInfo *depthStencilTargetInfo)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VkRenderPass renderPass;
VulkanFramebuffer *framebuffer;
@@ -7918,7 +7918,7 @@ static void VULKAN_BindGraphicsPipeline(
SDL_GPUGraphicsPipeline *graphicsPipeline)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanGraphicsPipeline *pipeline = (VulkanGraphicsPipeline *)graphicsPipeline;
renderer->vkCmdBindPipeline(
@@ -7983,7 +7983,7 @@ static void VULKAN_BindIndexBuffer(
SDL_GPUIndexElementSize indexElementSize)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer *)binding->buffer)->activeBuffer;
VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, vulkanBuffer);
@@ -8031,7 +8031,7 @@ static void VULKAN_EndRenderPass(
SDL_GPUCommandBuffer *commandBuffer)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
Uint32 i;
renderer->vkCmdEndRenderPass(
@@ -8146,7 +8146,7 @@ static void VULKAN_BindComputePipeline(
SDL_GPUComputePipeline *computePipeline)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanComputePipeline *vulkanComputePipeline = (VulkanComputePipeline *)computePipeline;
renderer->vkCmdBindPipeline(
@@ -8541,7 +8541,7 @@ static void VULKAN_DispatchCompute(
Uint32 groupcountZ)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VULKAN_INTERNAL_BindComputeDescriptorSets(renderer, vulkanCommandBuffer);
@@ -8558,7 +8558,7 @@ static void VULKAN_DispatchComputeIndirect(
Uint32 offset)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer *)buffer)->activeBuffer;
VULKAN_INTERNAL_BindComputeDescriptorSets(renderer, vulkanCommandBuffer);
@@ -8680,7 +8680,7 @@ static void VULKAN_UploadToTexture(
bool cycle)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)source->transfer_buffer;
VulkanTextureContainer *vulkanTextureContainer = (VulkanTextureContainer *)destination->texture;
VulkanTextureSubresource *vulkanTextureSubresource;
@@ -8736,7 +8736,7 @@ static void VULKAN_UploadToBuffer(
bool cycle)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)source->transfer_buffer;
VulkanBufferContainer *bufferContainer = (VulkanBufferContainer *)destination->buffer;
VkBufferCopy bufferCopy;
@@ -8879,7 +8879,7 @@ static void VULKAN_CopyTextureToTexture(
bool cycle)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanTextureSubresource *srcSubresource;
VulkanTextureSubresource *dstSubresource;
VkImageCopy imageCopy;
@@ -8955,7 +8955,7 @@ static void VULKAN_CopyBufferToBuffer(
bool cycle)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanBufferContainer *srcContainer = (VulkanBufferContainer *)source->buffer;
VulkanBufferContainer *dstContainer = (VulkanBufferContainer *)destination->buffer;
VkBufferCopy bufferCopy;
@@ -9005,7 +9005,7 @@ static void VULKAN_GenerateMipmaps(
SDL_GPUTexture *texture)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanTextureContainer *container = (VulkanTextureContainer *)texture;
VulkanTextureSubresource *srcTextureSubresource;
VulkanTextureSubresource *dstTextureSubresource;
@@ -9106,7 +9106,7 @@ static void VULKAN_Blit(
const SDL_GPUBlitInfo *info)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
TextureCommonHeader *srcHeader = (TextureCommonHeader *)info->source.texture;
TextureCommonHeader *dstHeader = (TextureCommonHeader *)info->destination.texture;
VkImageBlit region;
@@ -9839,7 +9839,7 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
Uint32 *swapchainTextureHeight)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
Uint32 swapchainImageIndex;
WindowData *windowData;
VkResult acquireResult = VK_SUCCESS;
@@ -10457,7 +10457,7 @@ static bool VULKAN_Submit(
SDL_GPUCommandBuffer *commandBuffer)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
- VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
+ VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VkSubmitInfo submitInfo;
VkPresentInfoKHR presentInfo;
VulkanPresentData *presentData;
@@ -11230,7 +11230,7 @@ static Uint8 VULKAN_INTERNAL_IsDeviceSuitable(
&queueFamilyCount,
NULL);
- queueProps = (VkQueueFamilyProperties *)SDL_stack_alloc(
+ queueProps = SDL_stack_alloc(
VkQueueFamilyProperties,
queueFamilyCount);
renderer->vkGetPhysicalDeviceQueueFamilyProperties(
diff --git a/src/render/vulkan/SDL_render_vulkan.c b/src/render/vulkan/SDL_render_vulkan.c
index 8b2a261bdf14a..d2157c30a7846 100644
--- a/src/render/vulkan/SDL_render_vulkan.c
+++ b/src/render/vulkan/SDL_render_vulkan.c
@@ -1235,7 +1235,7 @@ static VULKAN_PipelineState *VULKAN_CreatePipelineState(SDL_Renderer *renderer,
// Input assembly
inputAssemblyStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
- inputAssemblyStateCreateInfo.topology = ( VkPrimitiveTopology ) topology;
+ inputAssemblyStateCreateInfo.topology = topology;
inputAssemblyStateCreateInfo.primitiveRestartEnable = VK_FALSE;
viewportStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
diff --git a/src/test/SDL_test_fuzzer.c b/src/test/SDL_test_fuzzer.c
index caa330c938b86..67638b5e15dc7 100644
--- a/src/test/SDL_test_fuzzer.c
+++ b/src/test/SDL_test_fuzzer.c
@@ -144,7 +144,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max)
Uint64 range = (Sint64)max - (Sint64)min;
if (range < SDL_MAX_SINT32) {
- return min + (Sint32) SDL_rand_r(&rndContext, (Sint32) range + 1);
+ return min + SDL_rand_r(&rndContext, (Sint32) range + 1);
} else {
Uint64 add = SDL_rand_bits_r(&rndContext) | ((Uint64) SDL_rand_bits_r(&rndContext) << 32);
return (Sint32) (min + (Sint64) (add % (range + 1)));
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index e0f835a779b89..853c05eb1f90d 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -727,7 +727,7 @@ static void xdg_output_handle_logical_size(void *data, struct zxdg_output_v1 *xd
static void xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output)
{
- SDL_DisplayData *internal = (void *)data;
+ SDL_DisplayData *internal = data;
/*
* xdg-output.done events are deprecated and only apply below version 3 of the protocol.
diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index 5f264a3483f7e..02c2d905ec4a9 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -233,7 +233,7 @@ void SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata)
#ifdef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
static void X11_HandleGenericEvent(SDL_VideoDevice *_this, XEvent *xev)
{
- SDL_VideoData *videodata = (SDL_VideoData *)_this->internal;
+ SDL_VideoData *videodata = _this->internal;
// event is a union, so cookie == &event, but this is type safe.
XGenericEventCookie *cookie = &xev->xcookie;
@@ -897,7 +897,7 @@ static int XLookupStringAsUTF8(XKeyEvent *event_struct, char *buffer_return, int
SDL_WindowData *X11_FindWindow(SDL_VideoDevice *_this, Window window)
{
- const SDL_VideoData *videodata = (SDL_VideoData *)_this->internal;
+ const SDL_VideoData *videodata = _this->internal;
int i;
if (videodata && videodata->windowlist) {
@@ -919,7 +919,7 @@ Uint64 X11_GetEventTimestamp(unsigned long time)
void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_KeyboardID keyboardID, XEvent *xevent)
{
- SDL_VideoData *videodata = (SDL_VideoData *)_this->internal;
+ SDL_VideoData *videodata = _this->internal;
Display *display = videodata->display;
KeyCode keycode = xevent->xkey.keycode;
KeySym keysym = NoSymbol;
@@ -1001,7 +1001,7 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_
void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_MouseID mouseID, int button, float x, float y, unsigned long time)
{
SDL_Window *window = windowdata->window;
- const SDL_VideoData *videodata = (SDL_VideoData *)_this->internal;
+ const SDL_VideoData *videodata = _this->internal;
Display *display = videodata->display;
int xticks = 0, yticks = 0;
Uint64 timestamp = X11_GetEventTimestamp(time);
@@ -1048,7 +1048,7 @@ void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, S
void X11_HandleButtonRelease(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_MouseID mouseID, int button, unsigned long time)
{
SDL_Window *window = windowdata->window;
- const SDL_VideoData *videodata = (SDL_VideoData *)_this->internal;
+ const SDL_VideoData *videodata = _this->internal;
Display *display = videodata->display;
// The X server sends a Release event for each Press for wheels. Ignore them.
int xticks = 0, yticks = 0;
diff --git a/src/video/x11/SDL_x11pen.c b/src/video/x11/SDL_x11pen.c
index f63654542f1c0..f16da51c5abde 100644
--- a/src/video/x11/SDL_x11pen.c
+++ b/src/video/x11/SDL_x11pen.c
@@ -31,7 +31,7 @@
// Does this device have a valuator for pressure sensitivity?
static bool X11_XInput2DeviceIsPen(SDL_VideoDevice *_this, const XIDeviceInfo *dev)
{
- const SDL_VideoData *data = (SDL_VideoData *)_this->internal;
+ const SDL_VideoData *data = _this->internal;
for (int i = 0; i < dev->num_classes; i++) {
const XIAnyClassInfo *classinfo = dev->classes[i];
if (classinfo->type == XIValuatorClass) {
@@ -49,7 +49,7 @@ static bool X11_XInput2DeviceIsPen(SDL_VideoDevice *_this, const XIDeviceInfo *d
static bool X11_XInput2PenIsEraser(SDL_VideoDevice *_this, int deviceid, char *devicename)
{
#define PEN_ERASER_NAME_TAG "eraser" // String constant to identify erasers
- SDL_VideoData *data = (SDL_VideoData *)_this->internal;
+ SDL_VideoData *data = _this->internal;
if (data->atoms.pen_atom_wacom_tool_type != None) {
Atom type_return;
@@ -105,7 +105,7 @@ static bool X11_XInput2PenIsEraser(SDL_VideoDevice *_this, int deviceid, char *d
// Returns number of Sint32s written (<= max_words), or 0 on error.
static size_t X11_XInput2PenGetIntProperty(SDL_VideoDevice *_this, int deviceid, Atom property, Sint32 *dest, size_t max_words)
{
- const SDL_VideoData *data = (SDL_VideoData *)_this->internal;
+ const SDL_VideoData *data = _this->internal;
Atom type_return;
int format_return;
unsigned long num_items_return;
@@ -153,7 +153,7 @@ static size_t X11_XInput2PenGetIntProperty(SDL_VideoDevice *_this, int deviceid,
// Identify Wacom devices (if true is returned) and extract their device type and serial IDs
static bool X11_XInput2PenWacomDeviceID(SDL_VideoDevice *_this, int deviceid, Uint32 *wacom_devicetype_id, Uint32 *wacom_serial)
{
- SDL_VideoData *data = (SDL_VideoData *)_this->internal;
+ SDL_VideoData *data = _this->internal;
Sint32 serial_id_buf[3];
int result;
@@ -196,7 +196,7 @@ X11_PenHandle *X11_FindPenByDeviceID(int deviceid)
static X11_PenHandle *X11_MaybeAddPen(SDL_VideoDevice *_this, const XIDeviceInfo *dev)
{
- SDL_VideoData *data = (SDL_VideoData *)_this->internal;
+ SDL_VideoData *data = _this->internal;
SDL_PenCapabilityFlags capabilities = 0;
X11_PenHandle *handle = NULL;
@@ -283,7 +283,7 @@ static X11_PenHandle *X11_MaybeAddPen(SDL_VideoDevice *_this, const XIDeviceInfo
X11_PenHandle *X11_MaybeAddPenByDeviceID(SDL_VideoDevice *_this, int deviceid)
{
- SDL_VideoData *data = (SDL_VideoData *)_this->internal;
+ SDL_VideoData *data = _this->internal;
int num_device_info = 0;
XIDeviceInfo *device_info = X11_XIQueryDevice(data->display, deviceid, &num_device_info);
if (device_info) {
@@ -306,7 +306,7 @@ void X11_RemovePenByDeviceID(int deviceid)
void X11_InitPen(SDL_VideoDevice *_this)
{
- SDL_VideoData *data = (SDL_VideoData *)_this->internal;
+ SDL_VideoData *data = _this->internal;
#define LOOKUP_PEN_ATOM(X) X11_XInternAtom(data->display, X, False)
data->atoms.pen_atom_device_product_id = LOOKUP_PEN_ATOM("Device Product ID");
diff --git a/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c
index 92c44f96ee5da..e433598872487 100644
--- a/src/video/x11/SDL_x11shape.c
+++ b/src/video/x11/SDL_x11shape.c
@@ -31,7 +31,7 @@ static Uint8 *GenerateShapeMask(SDL_Surface *shape)
{
int x, y;
const size_t ppb = 8;
- const size_t bytes_per_scanline = (size_t)(shape->w + (ppb - 1)) / ppb;
+ const size_t bytes_per_scanline = (shape->w + (ppb - 1)) / ppb;
const Uint8 *a;
Uint8 *mask;
Uint8 *mask_scanline;
diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c
index 0b7665342e501..afe4a7c85b674 100644
--- a/src/video/x11/SDL_x11xinput2.c
+++ b/src/video/x11/SDL_x11xinput2.c
@@ -284,7 +284,7 @@ static SDL_XInput2DeviceInfo *xinput2_get_device_info(SDL_VideoData *videodata,
void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie)
{
#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
- SDL_VideoData *videodata = (SDL_VideoData *)_this->internal;
+ SDL_VideoData *videodata = _this->internal;
if (cookie->extension != xinput2_opcode) {
return;
@@ -555,10 +555,10 @@ bool X11_Xinput2IsInitialized(void)
bool X11_Xinput2SelectMouseAndKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
{
- SDL_WindowData *windowdata = (SDL_WindowData *)window->internal;
+ SDL_WindowData *windowdata = window->internal;
#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
- const SDL_VideoData *data = (SDL_VideoData *)_this->internal;
+ const SDL_VideoData *data = _this->internal;
if (X11_Xinput2IsInitialized()) {
XIEventMask eventmask;
diff --git a/src/video/x11/SDL_x11xsync.c b/src/video/x11/SDL_x11xsync.c
index 5981f6f153243..5310d6715a18c 100644
--- a/src/video/x11/SDL_x11xsync.c
+++ b/src/video/x11/SDL_x11xsync.c
@@ -42,7 +42,7 @@ static bool xsync_version_atleast(const int version, const int wantmajor, const
void X11_InitXsync(SDL_VideoDevice *_this)
{
- SDL_VideoData *data = (SDL_VideoData *) _this->internal;
+ SDL_VideoData *data = _this->
(Patch may be truncated, please check the link at the top of this post.)