diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 670160524..2a8e310ba 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 a421d8b15..6f076b100 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 b6d924302..f23574c4d 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 dec725c1e..c2b8294a7 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(