From a57f6c4af308a7d95b6096488f3f95a189bec914 Mon Sep 17 00:00:00 2001
From: Petar Popovic <[EMAIL REDACTED]>
Date: Mon, 9 Sep 2024 03:09:33 +0200
Subject: [PATCH] Fix additional calloc-transposed-args warnings
---
src/core/android/SDL_android.c | 2 +-
src/core/freebsd/SDL_evdev_kbd_freebsd.c | 6 +++---
src/core/openbsd/SDL_wscons_kbd.c | 2 +-
src/video/gdk/SDL_gdktextinput.cpp | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c
index 670160524a746..2a8e310bac0be 100644
--- a/src/core/android/SDL_android.c
+++ b/src/core/android/SDL_android.c
@@ -2710,7 +2710,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeFileDialog)(
// Convert fileList to string
size_t count = (*env)->GetArrayLength(env, fileList);
- char **charFileList = SDL_calloc(sizeof(char*), count + 1);
+ char **charFileList = SDL_calloc(count + 1, sizeof(char*));
if (charFileList == NULL) {
mAndroidFileDialogData.callback(mAndroidFileDialogData.userdata, NULL, -1);
diff --git a/src/core/freebsd/SDL_evdev_kbd_freebsd.c b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
index a421d8b15c131..6f076b100d924 100644
--- a/src/core/freebsd/SDL_evdev_kbd_freebsd.c
+++ b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
@@ -241,9 +241,9 @@ SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
kbd->shift_state = 0;
- kbd->accents = SDL_calloc(sizeof(accentmap_t), 1);
- kbd->key_map = SDL_calloc(sizeof(keymap_t), 1);
- kbd->kbInfo = SDL_calloc(sizeof(keyboard_info_t), 1);
+ kbd->accents = SDL_calloc(1, sizeof(accentmap_t));
+ kbd->key_map = SDL_calloc(1, sizeof(keymap_t));
+ kbd->kbInfo = SDL_calloc(1, sizeof(keyboard_info_t));
ioctl(kbd->console_fd, KDGKBINFO, kbd->kbInfo);
ioctl(kbd->console_fd, CONS_MOUSECTL, &mData);
diff --git a/src/core/openbsd/SDL_wscons_kbd.c b/src/core/openbsd/SDL_wscons_kbd.c
index b6d924302a6b8..f23574c4df0eb 100644
--- a/src/core/openbsd/SDL_wscons_kbd.c
+++ b/src/core/openbsd/SDL_wscons_kbd.c
@@ -435,7 +435,7 @@ static SDL_WSCONS_input_data *SDL_WSCONS_Init_Keyboard(const char *dev)
input->keyboardID = SDL_GetNextObjectID();
SDL_AddKeyboard(input->keyboardID, NULL, false);
- input->keymap.map = SDL_calloc(sizeof(struct wscons_keymap), KS_NUMKEYCODES);
+ input->keymap.map = SDL_calloc(KS_NUMKEYCODES, sizeof(struct wscons_keymap));
if (!input->keymap.map) {
SDL_free(input);
return NULL;
diff --git a/src/video/gdk/SDL_gdktextinput.cpp b/src/video/gdk/SDL_gdktextinput.cpp
index dec725c1e8b85..c2b8294a7ce8f 100644
--- a/src/video/gdk/SDL_gdktextinput.cpp
+++ b/src/video/gdk/SDL_gdktextinput.cpp
@@ -123,7 +123,7 @@ static void CALLBACK GDK_InternalTextEntryCallback(XAsyncBlock *asyncBlock)
SDL_SetError("XGameUiShowTextEntryResultSize failure with HRESULT of %08X", hR);
} else if (resultSize > 0) {
// +1 to be super sure that the buffer will be null terminated
- resultBuffer = (char *)SDL_calloc(sizeof(*resultBuffer), 1 + (size_t)resultSize);
+ resultBuffer = (char *)SDL_calloc(1 + (size_t)resultSize, sizeof(*resultBuffer));
if (resultBuffer) {
// still pass the original size that we got from ResultSize
if (FAILED(hR = XGameUiShowTextEntryResult(