diff --git a/src/dialog/unix/SDL_portaldialog.c b/src/dialog/unix/SDL_portaldialog.c index 7938567a0..ac6b575c4 100644 --- a/src/dialog/unix/SDL_portaldialog.c +++ b/src/dialog/unix/SDL_portaldialog.c @@ -96,7 +96,7 @@ static void DBus_AppendFilter(SDL_DBusContext *dbus, DBusMessageIter *parent, co dbus->message_iter_open_container(&filter_array, DBUS_TYPE_STRUCT, NULL, &filter_array_entry); dbus->message_iter_append_basic(&filter_array_entry, DBUS_TYPE_UINT32, &zero); - glob_pattern = SDL_calloc(sizeof(char), max_len); + glob_pattern = SDL_calloc(max_len, sizeof(char)); if (!glob_pattern) { goto cleanup; } diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 6d44bdf3b..7d76fece9 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1086,7 +1086,7 @@ SDL_Joystick *SDL_OpenJoystick(SDL_JoystickID instance_id) } // Create and initialize the joystick - joystick = (SDL_Joystick *)SDL_calloc(sizeof(*joystick), 1); + joystick = (SDL_Joystick *)SDL_calloc(1, sizeof(*joystick)); if (!joystick) { SDL_UnlockJoysticks(); return NULL; diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index e9355d07f..67b8c566b 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -2335,7 +2335,7 @@ static bool LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping /* We temporarily open the device to check how it's configured. Make a fake SDL_Joystick object to do so. */ - joystick = (SDL_Joystick *)SDL_calloc(sizeof(*joystick), 1); + joystick = (SDL_Joystick *)SDL_calloc(1, sizeof(*joystick)); if (!joystick) { return false; } diff --git a/src/render/vulkan/SDL_render_vulkan.c b/src/render/vulkan/SDL_render_vulkan.c index 87ae0708a..b504c0108 100644 --- a/src/render/vulkan/SDL_render_vulkan.c +++ b/src/render/vulkan/SDL_render_vulkan.c @@ -1599,7 +1599,7 @@ static bool VULKAN_DeviceExtensionsFound(VULKAN_RenderData *rendererData, int ex return false; } if (extensionCount > 0 ) { - VkExtensionProperties *extensionProperties = (VkExtensionProperties *)SDL_calloc(sizeof(VkExtensionProperties), extensionCount); + VkExtensionProperties *extensionProperties = (VkExtensionProperties *)SDL_calloc(extensionCount, sizeof(VkExtensionProperties)); result = vkEnumerateDeviceExtensionProperties(rendererData->physicalDevice, NULL, &extensionCount, extensionProperties); if (result != VK_SUCCESS ) { SDL_LogError(SDL_LOG_CATEGORY_RENDER, "vkEnumerateDeviceExtensionProperties): %s.\n", SDL_Vulkan_GetResultString(result)); @@ -2356,8 +2356,8 @@ static VkResult VULKAN_CreateSwapChain(SDL_Renderer *renderer, int w, int h) } SDL_free(rendererData->renderingFinishedSemaphores); } - rendererData->imageAvailableSemaphores = (VkSemaphore *)SDL_calloc(sizeof(VkSemaphore), rendererData->swapchainImageCount); - rendererData->renderingFinishedSemaphores = (VkSemaphore *)SDL_calloc(sizeof(VkSemaphore), rendererData->swapchainImageCount); + rendererData->imageAvailableSemaphores = (VkSemaphore *)SDL_calloc(rendererData->swapchainImageCount, sizeof(VkSemaphore)); + rendererData->renderingFinishedSemaphores = (VkSemaphore *)SDL_calloc(rendererData->swapchainImageCount, sizeof(VkSemaphore)); for (uint32_t i = 0; i < rendererData->swapchainImageCount; i++) { rendererData->imageAvailableSemaphores[i] = VULKAN_CreateSemaphore(rendererData); if (rendererData->imageAvailableSemaphores[i] == VK_NULL_HANDLE) { diff --git a/src/sensor/SDL_sensor.c b/src/sensor/SDL_sensor.c index 069571ffe..67353f907 100644 --- a/src/sensor/SDL_sensor.c +++ b/src/sensor/SDL_sensor.c @@ -321,7 +321,7 @@ SDL_Sensor *SDL_OpenSensor(SDL_SensorID instance_id) } // Create and initialize the sensor - sensor = (SDL_Sensor *)SDL_calloc(sizeof(*sensor), 1); + sensor = (SDL_Sensor *)SDL_calloc(1, sizeof(*sensor)); if (!sensor) { SDL_UnlockSensors(); return NULL; diff --git a/test/testdropfile.c b/test/testdropfile.c index 78f69498d..d778ec724 100644 --- a/test/testdropfile.c +++ b/test/testdropfile.c @@ -57,7 +57,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) if (!SDLTest_CommonInit(state)) { goto onerror; } - dialog = SDL_calloc(sizeof(dropfile_dialog), 1); + dialog = SDL_calloc(1, sizeof(dropfile_dialog)); if (!dialog) { goto onerror; } diff --git a/test/testffmpeg_vulkan.c b/test/testffmpeg_vulkan.c index 268e82c59..5e14728bf 100644 --- a/test/testffmpeg_vulkan.c +++ b/test/testffmpeg_vulkan.c @@ -221,7 +221,7 @@ static int createInstance(VulkanVideoContext *context) { uint32_t extensionCount; if (context->vkEnumerateInstanceExtensionProperties(NULL, &extensionCount, NULL) == VK_SUCCESS && extensionCount > 0) { - VkExtensionProperties *extensionProperties = SDL_calloc(sizeof(VkExtensionProperties), extensionCount); + VkExtensionProperties *extensionProperties = SDL_calloc(extensionCount, sizeof(VkExtensionProperties)); if (context->vkEnumerateInstanceExtensionProperties(NULL, &extensionCount, extensionProperties) == VK_SUCCESS) { for (uint32_t i = 0; i < SDL_arraysize(optional_extensions); ++i) { for (uint32_t j = 0; j < extensionCount; ++j) { @@ -595,7 +595,7 @@ static int createDevice(VulkanVideoContext *context) { uint32_t extensionCount; if (context->vkEnumerateDeviceExtensionProperties(context->physicalDevice, NULL, &extensionCount, NULL) == VK_SUCCESS && extensionCount > 0) { - VkExtensionProperties *extensionProperties = SDL_calloc(sizeof(VkExtensionProperties), extensionCount); + VkExtensionProperties *extensionProperties = SDL_calloc(extensionCount, sizeof(VkExtensionProperties)); if (context->vkEnumerateDeviceExtensionProperties(context->physicalDevice, NULL, &extensionCount, extensionProperties) == VK_SUCCESS) { for (uint32_t i = 0; i < SDL_arraysize(optional_extensions); ++i) { for (uint32_t j = 0; j < extensionCount; ++j) {