mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-27 13:38:29 +00:00
Fix warnings: calloc-transposed-args
This commit is contained in:

committed by
Sam Lantinga

parent
0da2bd49c8
commit
d2ef15d8e6
@@ -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_open_container(&filter_array, DBUS_TYPE_STRUCT, NULL, &filter_array_entry);
|
||||||
dbus->message_iter_append_basic(&filter_array_entry, DBUS_TYPE_UINT32, &zero);
|
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) {
|
if (!glob_pattern) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@@ -1086,7 +1086,7 @@ SDL_Joystick *SDL_OpenJoystick(SDL_JoystickID instance_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create and initialize the joystick
|
// Create and initialize the joystick
|
||||||
joystick = (SDL_Joystick *)SDL_calloc(sizeof(*joystick), 1);
|
joystick = (SDL_Joystick *)SDL_calloc(1, sizeof(*joystick));
|
||||||
if (!joystick) {
|
if (!joystick) {
|
||||||
SDL_UnlockJoysticks();
|
SDL_UnlockJoysticks();
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -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
|
/* We temporarily open the device to check how it's configured. Make
|
||||||
a fake SDL_Joystick object to do so. */
|
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) {
|
if (!joystick) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -1599,7 +1599,7 @@ static bool VULKAN_DeviceExtensionsFound(VULKAN_RenderData *rendererData, int ex
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (extensionCount > 0 ) {
|
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);
|
result = vkEnumerateDeviceExtensionProperties(rendererData->physicalDevice, NULL, &extensionCount, extensionProperties);
|
||||||
if (result != VK_SUCCESS ) {
|
if (result != VK_SUCCESS ) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "vkEnumerateDeviceExtensionProperties): %s.\n", SDL_Vulkan_GetResultString(result));
|
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);
|
SDL_free(rendererData->renderingFinishedSemaphores);
|
||||||
}
|
}
|
||||||
rendererData->imageAvailableSemaphores = (VkSemaphore *)SDL_calloc(sizeof(VkSemaphore), rendererData->swapchainImageCount);
|
rendererData->imageAvailableSemaphores = (VkSemaphore *)SDL_calloc(rendererData->swapchainImageCount, sizeof(VkSemaphore));
|
||||||
rendererData->renderingFinishedSemaphores = (VkSemaphore *)SDL_calloc(sizeof(VkSemaphore), rendererData->swapchainImageCount);
|
rendererData->renderingFinishedSemaphores = (VkSemaphore *)SDL_calloc(rendererData->swapchainImageCount, sizeof(VkSemaphore));
|
||||||
for (uint32_t i = 0; i < rendererData->swapchainImageCount; i++) {
|
for (uint32_t i = 0; i < rendererData->swapchainImageCount; i++) {
|
||||||
rendererData->imageAvailableSemaphores[i] = VULKAN_CreateSemaphore(rendererData);
|
rendererData->imageAvailableSemaphores[i] = VULKAN_CreateSemaphore(rendererData);
|
||||||
if (rendererData->imageAvailableSemaphores[i] == VK_NULL_HANDLE) {
|
if (rendererData->imageAvailableSemaphores[i] == VK_NULL_HANDLE) {
|
||||||
|
@@ -321,7 +321,7 @@ SDL_Sensor *SDL_OpenSensor(SDL_SensorID instance_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create and initialize the sensor
|
// Create and initialize the sensor
|
||||||
sensor = (SDL_Sensor *)SDL_calloc(sizeof(*sensor), 1);
|
sensor = (SDL_Sensor *)SDL_calloc(1, sizeof(*sensor));
|
||||||
if (!sensor) {
|
if (!sensor) {
|
||||||
SDL_UnlockSensors();
|
SDL_UnlockSensors();
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -57,7 +57,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
|||||||
if (!SDLTest_CommonInit(state)) {
|
if (!SDLTest_CommonInit(state)) {
|
||||||
goto onerror;
|
goto onerror;
|
||||||
}
|
}
|
||||||
dialog = SDL_calloc(sizeof(dropfile_dialog), 1);
|
dialog = SDL_calloc(1, sizeof(dropfile_dialog));
|
||||||
if (!dialog) {
|
if (!dialog) {
|
||||||
goto onerror;
|
goto onerror;
|
||||||
}
|
}
|
||||||
|
@@ -221,7 +221,7 @@ static int createInstance(VulkanVideoContext *context)
|
|||||||
{
|
{
|
||||||
uint32_t extensionCount;
|
uint32_t extensionCount;
|
||||||
if (context->vkEnumerateInstanceExtensionProperties(NULL, &extensionCount, NULL) == VK_SUCCESS && extensionCount > 0) {
|
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) {
|
if (context->vkEnumerateInstanceExtensionProperties(NULL, &extensionCount, extensionProperties) == VK_SUCCESS) {
|
||||||
for (uint32_t i = 0; i < SDL_arraysize(optional_extensions); ++i) {
|
for (uint32_t i = 0; i < SDL_arraysize(optional_extensions); ++i) {
|
||||||
for (uint32_t j = 0; j < extensionCount; ++j) {
|
for (uint32_t j = 0; j < extensionCount; ++j) {
|
||||||
@@ -595,7 +595,7 @@ static int createDevice(VulkanVideoContext *context)
|
|||||||
{
|
{
|
||||||
uint32_t extensionCount;
|
uint32_t extensionCount;
|
||||||
if (context->vkEnumerateDeviceExtensionProperties(context->physicalDevice, NULL, &extensionCount, NULL) == VK_SUCCESS && extensionCount > 0) {
|
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) {
|
if (context->vkEnumerateDeviceExtensionProperties(context->physicalDevice, NULL, &extensionCount, extensionProperties) == VK_SUCCESS) {
|
||||||
for (uint32_t i = 0; i < SDL_arraysize(optional_extensions); ++i) {
|
for (uint32_t i = 0; i < SDL_arraysize(optional_extensions); ++i) {
|
||||||
for (uint32_t j = 0; j < extensionCount; ++j) {
|
for (uint32_t j = 0; j < extensionCount; ++j) {
|
||||||
|
Reference in New Issue
Block a user