diff --git a/src/SDL_properties.c b/src/SDL_properties.c index 6dd38ca83cb3a..c3ca7b66387bf 100644 --- a/src/SDL_properties.c +++ b/src/SDL_properties.c @@ -789,7 +789,7 @@ static void SDLCALL SDL_DumpPropertiesCallback(void *userdata, SDL_PropertiesID case SDL_PROPERTY_TYPE_NUMBER: { Sint64 value = SDL_GetNumberProperty(props, name, 0); - SDL_Log("%s: %" SDL_PRIs64 " (%" SDL_PRIx64 ")", name, value, value); + SDL_Log("%s: %" SDL_PRIs64 " (%" SDL_PRIx64 ")", name, value, (Uint64)value); } break; case SDL_PROPERTY_TYPE_FLOAT: diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index ba9e10362bc43..b5a19a141a707 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -1132,7 +1132,7 @@ static bool ALSA_OpenDevice(SDL_AudioDevice *device) //device->spec.channels = 8; //SDL_SetLogPriority(SDL_LOG_CATEGORY_AUDIO, SDL_LOG_PRIORITY_VERBOSE); - LOGDEBUG("channels requested %u",device->spec.channels); + LOGDEBUG("channels requested %d",device->spec.channels); // XXX: We do not use the SDL internal swizzler yet. device->chmap = NULL; @@ -1178,7 +1178,7 @@ static bool ALSA_OpenDevice(SDL_AudioDevice *device) snd_pcm_uframes_t bufsize; ALSA_snd_pcm_hw_params_get_buffer_size(cfg_ctx.hwparams, &bufsize); SDL_LogDebug(SDL_LOG_CATEGORY_AUDIO, - "ALSA: period size = %ld, periods = %u, buffer size = %lu", + "ALSA: period size = %lu, periods = %u, buffer size = %lu", cfg_ctx.persize, cfg_ctx.periods, bufsize); #endif diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c index 3a097a3c4bb5c..b52aee04f5b5a 100644 --- a/src/audio/directsound/SDL_directsound.c +++ b/src/audio/directsound/SDL_directsound.c @@ -109,7 +109,7 @@ static bool DSOUND_Load(void) return loaded; } -static bool SetDSerror(const char *function, int code) +static bool SetDSerror(const char *function, HRESULT code) { const char *error; @@ -152,7 +152,7 @@ static bool SetDSerror(const char *function, int code) break; } - return SDL_SetError("%s: %s (0x%x)", function, error, code); + return SDL_SetError("%s: %s (0x%lx)", function, error, (ULONG)code); } static void DSOUND_FreeDeviceHandle(SDL_AudioDevice *device) diff --git a/src/audio/wasapi/SDL_wasapi.c b/src/audio/wasapi/SDL_wasapi.c index 2fb699834ec54..b6151f6689308 100644 --- a/src/audio/wasapi/SDL_wasapi.c +++ b/src/audio/wasapi/SDL_wasapi.c @@ -773,7 +773,7 @@ static bool mgmtthrtask_PrepDevice(void *userdata) ret = IAudioClient2_SetClientProperties(client2, &audioProps); if (FAILED(ret)) { // This isn't fatal, let's log it instead of failing - SDL_LogWarn(SDL_LOG_CATEGORY_AUDIO, "IAudioClient2_SetClientProperties failed: 0x%lx", ret); + SDL_LogWarn(SDL_LOG_CATEGORY_AUDIO, "IAudioClient2_SetClientProperties failed: 0x%lx", (ULONG)ret); } IAudioClient2_Release(client2); } diff --git a/src/dialog/windows/SDL_windowsdialog.c b/src/dialog/windows/SDL_windowsdialog.c index b3d86c53a1176..2b8b905ee590b 100644 --- a/src/dialog/windows/SDL_windowsdialog.c +++ b/src/dialog/windows/SDL_windowsdialog.c @@ -1028,7 +1028,7 @@ void windows_ShowFileDialog(void *ptr) const char *opts[1] = { NULL }; callback(userdata, opts, getFilterIndex(dialog.nFilterIndex)); } else { - SDL_SetError("Windows error, CommDlgExtendedError: %ld", pCommDlgExtendedError()); + SDL_SetError("Windows error, CommDlgExtendedError: %lu", pCommDlgExtendedError()); callback(userdata, NULL, -1); } } diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index a8ac576bc449d..555e6043fce41 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -682,7 +682,7 @@ int SDL_GetEventDescription(const SDL_Event *event, char *buf, int buflen) #undef PRINT_JBUTTON_EVENT SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_BATTERY_UPDATED) - (void)SDL_snprintf(details, sizeof(details), " (timestamp=%" SDL_PRIu64 " which=%d state=%u percent=%d)", + (void)SDL_snprintf(details, sizeof(details), " (timestamp=%" SDL_PRIu64 " which=%d state=%d percent=%d)", event->jbattery.timestamp, (int)event->jbattery.which, event->jbattery.state, event->jbattery.percent); break; diff --git a/src/gpu/d3d12/SDL_gpu_d3d12.c b/src/gpu/d3d12/SDL_gpu_d3d12.c index a2190f7ccdb8e..5ea86a383339a 100644 --- a/src/gpu/d3d12/SDL_gpu_d3d12.c +++ b/src/gpu/d3d12/SDL_gpu_d3d12.c @@ -1328,9 +1328,9 @@ static void D3D12_INTERNAL_SetError( // No message? Screw it, just post the code. if (dwChars == 0) { if (renderer->debug_mode) { - SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s! Error Code: " HRESULT_FMT, msg, res); + SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s! Error Code: " HRESULT_FMT, msg, (ULONG)res); } - SDL_SetError("%s! Error Code: " HRESULT_FMT, msg, res); + SDL_SetError("%s! Error Code: " HRESULT_FMT, msg, (ULONG)res); return; } @@ -1350,9 +1350,9 @@ static void D3D12_INTERNAL_SetError( wszMsgBuff[dwChars] = '\0'; if (renderer->debug_mode) { - SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s! Error Code: %s " HRESULT_FMT, msg, wszMsgBuff, res); + SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s! Error Code: %s " HRESULT_FMT, msg, wszMsgBuff, (ULONG)res); } - SDL_SetError("%s! Error Code: %s " HRESULT_FMT, msg, wszMsgBuff, res); + SDL_SetError("%s! Error Code: %s " HRESULT_FMT, msg, wszMsgBuff, (ULONG)res); } // Release / Cleanup @@ -7069,7 +7069,7 @@ static bool D3D12_INTERNAL_CreateSwapchain( SDL_LogWarn( SDL_LOG_CATEGORY_GPU, "Could not get swapchain parent! Error Code: " HRESULT_FMT, - res); + (ULONG)res); } else { // Disable DXGI window crap res = IDXGIFactory1_MakeWindowAssociation( @@ -7080,7 +7080,7 @@ static bool D3D12_INTERNAL_CreateSwapchain( SDL_LogWarn( SDL_LOG_CATEGORY_GPU, "MakeWindowAssociation failed! Error Code: " HRESULT_FMT, - res); + (ULONG)res); } // We're done with the parent now @@ -8996,7 +8996,7 @@ static bool D3D12_INTERNAL_GetAdapterByLuid(LUID luid, IDXGIFactory1 *factory, I IDXGIAdapter1 *adapter; res = IDXGIFactory1_EnumAdapters1(factory, adapterIndex, &adapter); if (FAILED(res)) { - SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to get an adapter when iterating, i: %d, res: %ld", adapterIndex, res); + SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to get an adapter when iterating, i: %u, res: %ld", adapterIndex, res); return false; } @@ -9004,7 +9004,7 @@ static bool D3D12_INTERNAL_GetAdapterByLuid(LUID luid, IDXGIFactory1 *factory, I res = IDXGIAdapter1_GetDesc1(adapter, &adapterDesc); if (FAILED(res)) { IDXGIAdapter1_Release(adapter); - SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to get description of adapter, i: %d, res %ld", adapterIndex, res); + SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to get description of adapter, i: %u, res %ld", adapterIndex, res); return false; } if (SDL_memcmp(&adapterDesc.AdapterLuid, &luid, sizeof(luid)) == 0) { diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index bb034179757d6..ad9b841bdf265 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -13258,7 +13258,7 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S (void)SDL_snprintf( driverVer, SDL_arraysize(driverVer), - "%d.%d.%d.%d", + "%u.%u.%u.%u", (rawDriverVer >> 22) & 0x3ff, (rawDriverVer >> 14) & 0xff, (rawDriverVer >> 6) & 0xff, @@ -13270,7 +13270,7 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S (void)SDL_snprintf( driverVer, SDL_arraysize(driverVer), - "%d.%d", + "%u.%u", (rawDriverVer >> 14) & 0x3ffff, rawDriverVer & 0x3fff); } @@ -13281,7 +13281,7 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S (void)SDL_snprintf( driverVer, SDL_arraysize(driverVer), - "%d.%d.%d", + "%u.%u.%u", (rawDriverVer >> 22) & 0x3ff, (rawDriverVer >> 12) & 0x3ff, rawDriverVer & 0xfff); diff --git a/src/haptic/hidapi/SDL_hidapihaptic_lg4ff.c b/src/haptic/hidapi/SDL_hidapihaptic_lg4ff.c index 7e6b3dc482f5e..e4f38da334766 100644 --- a/src/haptic/hidapi/SDL_hidapihaptic_lg4ff.c +++ b/src/haptic/hidapi/SDL_hidapihaptic_lg4ff.c @@ -919,7 +919,7 @@ static void *SDL_HIDAPI_HapticDriverLg4ff_Open(SDL_Joystick *joystick) ctx->product_id = SDL_GetJoystickProduct(joystick); ctx->release_number = SDL_GetJoystickProductVersion(joystick); - SDL_snprintf(ctx->thread_name_buf, sizeof(ctx->thread_name_buf), "SDL_hidapihaptic_lg4ff %d %04x:%04x", SDL_GetJoystickID(joystick), USB_VENDOR_ID_LOGITECH, ctx->product_id); + SDL_snprintf(ctx->thread_name_buf, sizeof(ctx->thread_name_buf), "SDL_hidapihaptic_lg4ff %u %04x:%04x", SDL_GetJoystickID(joystick), (unsigned int)USB_VENDOR_ID_LOGITECH, ctx->product_id); ctx->stop_thread = false; ctx->thread = SDL_CreateThread(SDL_HIDAPI_HapticDriverLg4ff_ThreadFunction, ctx->thread_name_buf, ctx); diff --git a/src/joystick/controller_type.c b/src/joystick/controller_type.c index f179d2731bc4f..00f40ba38c534 100644 --- a/src/joystick/controller_type.c +++ b/src/joystick/controller_type.c @@ -31,10 +31,10 @@ static const char *GetControllerTypeOverride( int nVID, int nPID ) char key[32]; const char *spot = NULL; - SDL_snprintf(key, sizeof(key), "0x%.4x/0x%.4x=", nVID, nPID); + SDL_snprintf(key, sizeof(key), "0x%.4x/0x%.4x=", (unsigned int)nVID, (unsigned int)nPID); spot = SDL_strstr(hint, key); if (!spot) { - SDL_snprintf(key, sizeof(key), "0x%.4X/0x%.4X=", nVID, nPID); + SDL_snprintf(key, sizeof(key), "0x%.4X/0x%.4X=", (unsigned int)nVID, (unsigned int)nPID); spot = SDL_strstr(hint, key); } if (spot) { diff --git a/src/joystick/hidapi/SDL_hidapi_gip.c b/src/joystick/hidapi/SDL_hidapi_gip.c index 18df94e772b90..39969b360070e 100644 --- a/src/joystick/hidapi/SDL_hidapi_gip.c +++ b/src/joystick/hidapi/SDL_hidapi_gip.c @@ -2494,7 +2494,7 @@ static void GIP_ReceivePacket(GIP_Device *device, const Uint8 *bytes, int num_by offset += GIP_DecodeLength(&fragment_offset, &bytes[offset], num_bytes - offset); if (fragment_offset != attachment->fragment_offset) { SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, - "GIP: Received out of sequence fragment, (claimed %" SDL_PRIu64 ", expected %d)", + "GIP: Received out of sequence fragment, (claimed %" SDL_PRIu64 ", expected %u)", fragment_offset, attachment->fragment_offset); GIP_Acknowledge(device, &header, diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c index 62ffbb46ec9fa..ee456160eb12f 100644 --- a/src/joystick/windows/SDL_dinputjoystick.c +++ b/src/joystick/windows/SDL_dinputjoystick.c @@ -230,7 +230,7 @@ const DIDATAFORMAT SDL_c_dfDIJoystick2 = { // Convert a DirectInput return code to a text message static bool SetDIerror(const char *function, HRESULT code) { - return SDL_SetError("%s() DirectX error 0x%8.8lx", function, code); + return SDL_SetError("%s() DirectX error 0x%8.8lx", function, (ULONG)code); } static bool SDL_IsXInputDevice(Uint16 vendor_id, Uint16 product_id, const char *hidPath) diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index c8cd9cd3a77b5..261e97456fdc7 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -705,12 +705,12 @@ static void RAWINPUT_InitWindowsGamingInput(RAWINPUT_DeviceContext *ctx) hr = __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics_add_GamepadAdded(wgi_state.gamepad_statics, &gamepad_added.iface, &wgi_state.gamepad_added_token); if (!SUCCEEDED(hr)) { - SDL_SetError("add_GamepadAdded() failed: 0x%lx", hr); + SDL_SetError("add_GamepadAdded() failed: 0x%lx", (ULONG)hr); } hr = __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics_add_GamepadRemoved(wgi_state.gamepad_statics, &gamepad_removed.iface, &wgi_state.gamepad_removed_token); if (!SUCCEEDED(hr)) { - SDL_SetError("add_GamepadRemoved() failed: 0x%lx", hr); + SDL_SetError("add_GamepadRemoved() failed: 0x%lx", (ULONG)hr); } } } @@ -1506,7 +1506,7 @@ static bool RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_ WindowsGamingInputGamepadState *gamepad_state = ctx->wgi_slot; HRESULT hr = __x_ABI_CWindows_CGaming_CInput_CIGamepad_put_Vibration(gamepad_state->gamepad, ctx->vibration); if (!SUCCEEDED(hr)) { - return SDL_SetError("Setting vibration failed: 0x%lx", hr); + return SDL_SetError("Setting vibration failed: 0x%lx", (ULONG)hr); } ctx->triggers_rumbling = (left_rumble > 0 || right_rumble > 0); return true; diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 460d05d02752b..1494439330ebe 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1798,7 +1798,7 @@ void SDLTest_PrintEvent(const SDL_Event *event) event->jaxis.value); break; case SDL_EVENT_JOYSTICK_BALL_MOTION: - SDL_Log("SDL EVENT: Joystick %" SDL_PRIs32 ": ball %d moved by %d,%d", + SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 ": ball %d moved by %d,%d", event->jball.which, event->jball.ball, event->jball.xrel, event->jball.yrel); break; @@ -2018,7 +2018,7 @@ void SDLTest_PrintEvent(const SDL_Event *event) event->pmotion.which, event->pmotion.x, event->pmotion.y); break; case SDL_EVENT_PEN_AXIS: - SDL_Log("SDL EVENT: Pen %" SDL_PRIu32 " axis %d changed to %.2f", + SDL_Log("SDL EVENT: Pen %" SDL_PRIu32 " axis %u changed to %.2f", event->paxis.which, event->paxis.axis, event->paxis.value); break; case SDL_EVENT_LOCALE_CHANGED: diff --git a/src/test/SDL_test_memory.c b/src/test/SDL_test_memory.c index d099c668c3dae..d393096f5e888 100644 --- a/src/test/SDL_test_memory.c +++ b/src/test/SDL_test_memory.c @@ -433,7 +433,7 @@ void SDLTest_LogAllocations(void) } dyn_dbghelp.pSymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)entry->stack[stack_index], &lineColumn, &dbg_line); } - SDL_snprintf(stack_entry_description, sizeof(stack_entry_description), "%s+0x%I64x %s:%u", pSymbol->Name, dwDisplacement, dbg_line.FileName, (Uint32)dbg_line.LineNumber); + SDL_snprintf(stack_entry_description, sizeof(stack_entry_description), "%s+0x%" SDL_PRIx64 " %s:%u", pSymbol->Name, dwDisplacement, dbg_line.FileName, (Uint32)dbg_line.LineNumber); } #endif (void)SDL_snprintf(line, sizeof(line), "\t0x%" SDL_PRIx64 ": %s\n", entry->stack[stack_index], stack_entry_description); diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 169f8a6e88f6a..80ec5e2ae443f 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -2734,7 +2734,7 @@ static void data_offer_handle_source_actions(void *data, struct wl_data_offer *w uint32_t source_actions) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_offer_listener . data_offer_handle_source_actions on data_offer 0x%08x for Source Actions '%d'", + ". In wl_data_offer_listener . data_offer_handle_source_actions on data_offer 0x%08x for Source Actions '%u'", (wl_data_offer ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)wl_data_offer) : -1), source_actions); } @@ -2743,7 +2743,7 @@ static void data_offer_handle_actions(void *data, struct wl_data_offer *wl_data_ uint32_t dnd_action) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_offer_listener . data_offer_handle_actions on data_offer 0x%08x for DND Actions '%d'", + ". In wl_data_offer_listener . data_offer_handle_actions on data_offer 0x%08x for DND Actions '%u'", (wl_data_offer ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)wl_data_offer) : -1), dnd_action); } @@ -2849,26 +2849,26 @@ static void data_device_handle_enter(void *data, struct wl_data_device *wl_data_ const float dy = (float)wl_fixed_to_double(y); SDL_SendDropPosition(data_device->dnd_window, dx, dy); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d into window %d for serial %d", + ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d into window %u for serial %u", WAYLAND_wl_proxy_get_id((struct wl_proxy *)id), wl_fixed_to_int(x), wl_fixed_to_int(y), SDL_GetWindowID(data_device->dnd_window), serial); } else { data_device->dnd_window = NULL; SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d", + ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %u", WAYLAND_wl_proxy_get_id((struct wl_proxy *)id), wl_fixed_to_int(x), wl_fixed_to_int(y), serial); } } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d", + ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %u", WAYLAND_wl_proxy_get_id((struct wl_proxy *)id), wl_fixed_to_int(x), wl_fixed_to_int(y), serial); } } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d", - -1, wl_fixed_to_int(x), wl_fixed_to_int(y), serial); + ". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %u", + (uint32_t)-1, wl_fixed_to_int(x), wl_fixed_to_int(y), serial); } } @@ -2880,12 +2880,12 @@ static void data_device_handle_leave(void *data, struct wl_data_device *wl_data_ if (data_device->dnd_window) { SDL_SendDropComplete(data_device->dnd_window); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x from window %d for serial %d", + ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x from window %u for serial %u", WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer), SDL_GetWindowID(data_device->dnd_window), data_device->drag_serial); } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x for serial %d", + ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x for serial %u", WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer), data_device->drag_serial); } @@ -2893,8 +2893,8 @@ static void data_device_handle_leave(void *data, struct wl_data_device *wl_data_ data_device->drag_offer = NULL; } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x for serial %d", - -1, -1); + ". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x for serial %u", + (uint32_t)-1, (uint32_t)-1); } data_device->has_mime_file = false; data_device->has_mime_text = false; @@ -2915,14 +2915,14 @@ static void data_device_handle_motion(void *data, struct wl_data_device *wl_data */ SDL_SendDropPosition(data_device->dnd_window, dx, dy); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_motion on data_offer 0x%08x at %d x %d in window %d serial %d", + ". In wl_data_device_listener . data_device_handle_motion on data_offer 0x%08x at %d x %d in window %u serial %u", WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer), wl_fixed_to_int(x), wl_fixed_to_int(y), SDL_GetWindowID(data_device->dnd_window), data_device->drag_serial); } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_motion on data_offer 0x%08x at %d x %d serial %d", - -1, wl_fixed_to_int(x), wl_fixed_to_int(y), -1); + ". In wl_data_device_listener . data_device_handle_motion on data_offer 0x%08x at %d x %d serial %u", + (uint32_t)-1, wl_fixed_to_int(x), wl_fixed_to_int(y), (uint32_t)-1); } } @@ -2932,7 +2932,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d if (data_device->drag_offer && data_device->dnd_window && (data_device->has_mime_file || data_device->has_mime_text)) { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x in window %d serial %d", + ". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x in window %u serial %u", WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer), SDL_GetWindowID(data_device->dnd_window), data_device->drag_serial); // TODO: SDL Support more mime types @@ -3011,8 +3011,8 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d } } else { SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x serial %d", - -1, -1); + ". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x serial %u", + (uint32_t)-1, (uint32_t)-1); } Wayland_data_offer_destroy(data_device->drag_offer); diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index d50a8af0ce1f1..38ea9c1f6b38e 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -1055,7 +1055,7 @@ void WIN_CheckKeyboardAndMouseHotplug(SDL_VideoDevice *_this, bool initial_check } *ptr = '\0'; - SDL_sscanf(instance, "HID\\VID_%X&PID_%X&", &vendor, &product); + SDL_sscanf(instance, "HID\\VID_%X&PID_%X&", (unsigned int*)&vendor, (unsigned int*)&product); switch (dwType) { case RIM_TYPEKEYBOARD: diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index 698ae5d75a82a..1ed62dcbea8fe 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -959,7 +959,7 @@ static void IME_AddCandidate(SDL_VideoData *videodata, UINT i, LPCWSTR candidate SDL_COMPILE_TIME_ASSERT(IME_CANDIDATE_INDEXING_REQUIRES, MAX_CANDLIST == 10); char *candidate_utf8 = WIN_StringToUTF8W(candidate); - SDL_asprintf(&videodata->ime_candidates[i], "%d %s", ((i + videodata->ime_candlistindexbase) % 10), candidate_utf8); + SDL_asprintf(&videodata->ime_candidates[i], "%d %s", (((int)i + videodata->ime_candlistindexbase) % 10), candidate_utf8); SDL_free(candidate_utf8); videodata->ime_candcount = (i + 1); diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 367c810f3a882..0ec927ec55450 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -1832,7 +1832,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, HRESULT hres; hres = pDataObject->lpVtbl->EnumFormatEtc(pDataObject, DATADIR_GET, &pEnumFormatEtc); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, - ". In Drop for EnumFormatEtc, HRESULT is %08lx", hres); + ". In Drop for EnumFormatEtc, HRESULT is %08lx", (ULONG)hres); if (hres == S_OK) { FORMATETC fetc; while (pEnumFormatEtc->lpVtbl->Next(pEnumFormatEtc, 1, &fetc, NULL) == S_OK) { @@ -1865,7 +1865,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, ". In Drop File for GetData, format %08x '%s', HRESULT is %08lx", - fetc.cfFormat, format_mime, hres); + fetc.cfFormat, format_mime, (ULONG)hres); if (SUCCEEDED(hres)) { const size_t bsize = GlobalSize(med.hGlobal); const void *buffer = (void *)GlobalLock(med.hGlobal); @@ -1913,7 +1913,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx", - fetc.cfFormat, format_mime, hres); + fetc.cfFormat, format_mime, (ULONG)hres); if (SUCCEEDED(hres)) { const size_t bsize = GlobalSize(med.hGlobal); const void *buffer = (void *)GlobalLock(med.hGlobal); @@ -1959,7 +1959,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx", - fetc.cfFormat, format_mime, hres); + fetc.cfFormat, format_mime, (ULONG)hres); if (SUCCEEDED(hres)) { const size_t bsize = GlobalSize(med.hGlobal); const void *buffer = (void *)GlobalLock(med.hGlobal); @@ -2013,7 +2013,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx", - fetc.cfFormat, format_mime, hres); + fetc.cfFormat, format_mime, (ULONG)hres); if (SUCCEEDED(hres)) { const size_t bsize = GlobalSize(med.hGlobal); const void *buffer = (void *)GlobalLock(med.hGlobal); @@ -2059,7 +2059,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); SDL_LogTrace(SDL_LOG_CATEGORY_INPUT, ". In Drop File for GetData, format %08x '%s', HRESULT is %08lx", - fetc.cfFormat, format_mime, hres); + fetc.cfFormat, format_mime, (ULONG)hres); if (SUCCEEDED(hres)) { const size_t bsize = GlobalSize(med.hGlobal); HDROP drop = (HDROP)GlobalLock(med.hGlobal); diff --git a/src/video/x11/edid-parse.c b/src/video/x11/edid-parse.c index eca187b60049e..8277fe82e1977 100644 --- a/src/video/x11/edid-parse.c +++ b/src/video/x11/edid-parse.c @@ -554,7 +554,7 @@ dump_monitor_info (MonitorInfo *info) printf ("Checksum: %d (%s)\n", info->checksum, info->checksum? "incorrect" : "correct"); printf ("Manufacturer Code: %s\n", info->manufacturer_code); - printf ("Product Code: 0x%x\n", info->product_code); + printf ("Product Code: 0x%x\n", (unsigned int)info->product_code); printf ("Serial Number: %u\n", info->serial_number); if (info->production_week != -1) diff --git a/test/gamepadutils.c b/test/gamepadutils.c index 2f0fcc55ebd92..ec4eb52e91326 100644 --- a/test/gamepadutils.c +++ b/test/gamepadutils.c @@ -2292,27 +2292,27 @@ char *GetJoystickDisplayElementAt(JoystickDisplay *ctx, SDL_Joystick *joystick, dst.w = ctx->button_width; dst.h = ctx->button_height; if (SDL_PointInRectFloat(&point, &dst)) { - SDL_asprintf(&element, "h%d.%d", i, SDL_HAT_LEFT); + SDL_asprintf(&element, "h%d.%u", i, SDL_HAT_LEFT); return element; } dst.x += ctx->button_width; dst.y -= ctx->button_height; if (SDL_PointInRectFloat(&point, &dst)) { - SDL_asprintf(&element, "h%d.%d", i, SDL_HAT_UP); + SDL_asprintf(&element, "h%d.%u", i, SDL_HAT_UP); return element; } dst.y += ctx->button_height * 2; if (SDL_PointInRectFloat(&point, &dst)) { - SDL_asprintf(&element, "h%d.%d", i, SDL_HAT_DOWN); + SDL_asprintf(&element, "h%d.%u", i, SDL_HAT_DOWN); return element; } dst.x += ctx->button_width; dst.y = y + FONT_CHARACTER_SIZE / 2 - ctx->button_height / 2; if (SDL_PointInRectFloat(&point, &dst)) { - SDL_asprintf(&element, "h%d.%d", i, SDL_HAT_RIGHT); + SDL_asprintf(&element, "h%d.%u", i, SDL_HAT_RIGHT); return element; } diff --git a/test/testautomation_events.c b/test/testautomation_events.c index 9b35e477a0851..8f26e0080ab1f 100644 --- a/test/testautomation_events.c +++ b/test/testautomation_events.c @@ -88,8 +88,8 @@ static int SDLCALL events_pushPumpAndPollUserevent(void *arg) } SDLTest_AssertCheck(i < MAX_ITERATIONS, "Check the user event is seen in less then %d polls, got %d poll", MAX_ITERATIONS, i + 1); - SDLTest_AssertCheck(SDL_EVENT_USER == event_out.type, "Check event type is SDL_EVENT_USER, expected: 0x%x, got: 0x%" SDL_PRIx32, SDL_EVENT_USER, event_out.type); - SDLTest_AssertCheck(ref_code == event_out.user.code, "Check SDL_Event.user.code, expected: 0x%" SDL_PRIx32 ", got: 0x%" SDL_PRIx32 , ref_code, event_out.user.code); + SDLTest_AssertCheck(SDL_EVENT_USER == event_out.type, "Check event type is SDL_EVENT_USER, expected: 0x%x, got: 0x%" SDL_PRIx32, (unsigned int)SDL_EVENT_USER, event_out.type); + SDLTest_AssertCheck(ref_code == event_out.user.code, "Check SDL_Event.user.code, expected: 0x%" SDL_PRIx32 ", got: 0x%" SDL_PRIx32 , (Uint32)ref_code, (Uint32)event_out.user.code); SDLTest_AssertCheck(0 == event_out.user.windowID, "Check SDL_Event.user.windowID, expected: NULL , got: %" SDL_PRIu32, event_out.user.windowID); SDLTest_AssertCheck((void *)&g_userdataValue1 == event_out.user.data1, "Check SDL_Event.user.data1, expected: %p, got: %p", &g_userdataValue1, event_out.user.data1); SDLTest_AssertCheck((void *)&g_userdataValue2 == event_out.user.data2, "Check SDL_Event.user.data2, expected: %p, got: %p", &g_userdataValue2, event_out.user.data2); @@ -283,7 +283,7 @@ static int SDLCALL events_mainThreadCallbacks(void *arg) /* Run the main callbacks */ SDL_WaitEvent(&event); - SDLTest_AssertCheck(event.type == SDL_EVENT_USER, "Expected user event (0x%.4x), got 0x%.4x", SDL_EVENT_USER, (int)event.type); + SDLTest_AssertCheck(event.type == SDL_EVENT_USER, "Expected user event (0x%.4x), got 0x%.4x", (unsigned int)SDL_EVENT_USER, (unsigned int)event.type); SDL_WaitThread(thread, NULL); SDLTest_AssertCheck(data.counter == 3, "Incremented counter on main thread, expected 3, got %d", data.counter); @@ -297,7 +297,7 @@ static int SDLCALL events_mainThreadCallbacks(void *arg) /* Run the main callbacks */ SDL_WaitEvent(&event); - SDLTest_AssertCheck(event.type == SDL_EVENT_USER, "Expected user event (0x%.4x), got 0x%.4x", SDL_EVENT_USER, (int)event.type); + SDLTest_AssertCheck(event.type == SDL_EVENT_USER, "Expected user event (0x%.4x), got 0x%.4x", (unsigned int)SDL_EVENT_USER, (unsigned int)event.type); SDL_WaitThread(thread, NULL); SDLTest_AssertCheck(data.counter == 5, "Incremented counter on main thread, expected 5, got %d", data.counter); diff --git a/test/testautomation_intrinsics.c b/test/testautomation_intrinsics.c index 8338d33d35ff5..e5aca15a96179 100644 --- a/test/testautomation_intrinsics.c +++ b/test/testautomation_intrinsics.c @@ -97,7 +97,7 @@ static void verify_uints_addition(const Uint32 *dest, const Uint32 *a, const Uin for (i = 0; i < size; ++i) { Uint32 expected = a[i] + b[i]; if (dest[i] != expected) { - SDLTest_AssertCheck(false, "%" SDL_PRIs32 " + %" SDL_PRIs32 " = %" SDL_PRIs32 ", expected %" SDL_PRIs32 " ([%" SDL_PRIu32 "/%" SDL_PRIu32 "] %s)", + SDLTest_AssertCheck(false, "%" SDL_PRIu32 " + %" SDL_PRIu32 " = %" SDL_PRIu32 ", expected %" SDL_PRIu32 " ([%" SDL_PRIu32 "/%" SDL_PRIu32 "] %s)", a[i], b[i], dest[i], expected, (Uint32)i, (Uint32)size, desc); all_good = 0; } diff --git a/test/testautomation_joystick.c b/test/testautomation_joystick.c index 13ad53c1dd1af..0ade2f9b4231a 100644 --- a/test/testautomation_joystick.c +++ b/test/testautomation_joystick.c @@ -49,7 +49,7 @@ static int SDLCALL joystick_testVirtual(void *arg) desc.product_id = USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V103; desc.name = "Virtual NVIDIA SHIELD Controller"; device_id = SDL_AttachVirtualJoystick(&desc); - SDLTest_AssertCheck(device_id > 0, "SDL_AttachVirtualJoystick() -> %" SDL_PRIs32 " (expected > 0)", device_id); + SDLTest_AssertCheck(device_id > 0, "SDL_AttachVirtualJoystick() -> %" SDL_PRIu32 " (expected > 0)", device_id); SDLTest_AssertCheck(SDL_IsJoystickVirtual(device_id), "SDL_IsJoystickVirtual()"); if (device_id > 0) { joystick = SDL_OpenJoystick(device_id); @@ -69,11 +69,11 @@ static int SDLCALL joystick_testVirtual(void *arg) } { Uint16 product_version = SDL_GetJoystickProductVersion(joystick); - SDLTest_AssertCheck(product_version == 0, "SDL_GetJoystickProductVersion() -> 0x%04x (expected 0x%04x)", product_version, 0); + SDLTest_AssertCheck(product_version == 0, "SDL_GetJoystickProductVersion() -> 0x%04x (expected 0x%04x)", product_version, 0u); } { Uint16 firmware_Version = SDL_GetJoystickFirmwareVersion(joystick); - SDLTest_AssertCheck(firmware_Version == 0, "SDL_GetJoystickFirmwareVersion() -> 0x%04x (expected 0x%04x)", firmware_Version, 0); + SDLTest_AssertCheck(firmware_Version == 0, "SDL_GetJoystickFirmwareVersion() -> 0x%04x (expected 0x%04x)", firmware_Version, 0u); } { const char *serial = SDL_GetJoystickSerial(joystick); @@ -229,7 +229,7 @@ static int SDLCALL joystick_testMappings(void *arg) desc.product_id = USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V104; desc.name = "Virtual NVIDIA SHIELD Controller"; device_id = SDL_AttachVirtualJoystick(&desc); - SDLTest_AssertCheck(device_id > 0, "SDL_AttachVirtualJoystick() -> %" SDL_PRIs32 " (expected > 0)", device_id); + SDLTest_AssertCheck(device_id > 0, "SDL_AttachVirtualJoystick() -> %" SDL_PRIu32 " (expected > 0)", device_id); SDLTest_AssertCheck(SDL_IsJoystickVirtual(device_id), "SDL_IsJoystickVirtual()"); gamepad = SDL_OpenGamepad(device_id); @@ -262,7 +262,7 @@ static int SDLCALL joystick_testMappings(void *arg) /* Try matching mappings with a new CRC */ desc.name = "Virtual NVIDIA SHIELD Controller V2"; device_id = SDL_AttachVirtualJoystick(&desc); - SDLTest_AssertCheck(device_id > 0, "SDL_AttachVirtualJoystick() -> %" SDL_PRIs32 " (expected > 0)", device_id); + SDLTest_AssertCheck(device_id > 0, "SDL_AttachVirtualJoystick() -> %" SDL_PRIu32 " (expected > 0)", device_id); SDLTest_AssertCheck(SDL_IsJoystickVirtual(device_id), "SDL_IsJoystickVirtual()"); gamepad = SDL_OpenGamepad(device_id); diff --git a/test/testautomation_keyboard.c b/test/testautomation_keyboard.c index bf73423e1628c..71ab023a8776d 100644 --- a/test/testautomation_keyboard.c +++ b/test/testautomation_keyboard.c @@ -61,37 +61,37 @@ static int SDLCALL keyboard_getKeyFromName(void *arg) /* Case where Key is known, 1 character input */ result = SDL_GetKeyFromName("A"); SDLTest_AssertPass("Call to SDL_GetKeyFromName('A', true)"); - SDLTest_AssertCheck(result == SDLK_A, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_A, result); + SDLTest_AssertCheck(result == SDLK_A, "Verify result from call, expected: %u, got: %" SDL_PRIu32, SDLK_A, result); /* Case where Key is known, 2 character input */ result = SDL_GetKeyFromName("F1"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/double)"); - SDLTest_AssertCheck(result == SDLK_F1, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_F1, result); + SDLTest_AssertCheck(result == SDLK_F1, "Verify result from call, expected: %u, got: %" SDL_PRIu32, SDLK_F1, result); /* Case where Key is known, 3 character input */ result = SDL_GetKeyFromName("End"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/triple)"); - SDLTest_AssertCheck(result == SDLK_END, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_END, result); + SDLTest_AssertCheck(result == SDLK_END, "Verify result from call, expected: %u, got: %" SDL_PRIu32, SDLK_END, result); /* Case where Key is known, 4 character input */ result = SDL_GetKeyFromName("Find"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/quad)"); - SDLTest_AssertCheck(result == SDLK_FIND, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_FIND, result); + SDLTest_AssertCheck(result == SDLK_FIND, "Verify result from call, expected: %u, got: %" SDL_PRIu32, SDLK_FIND, result); /* Case where Key is known, multiple character input */ result = SDL_GetKeyFromName("MediaStop"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/multi)"); - SDLTest_AssertCheck(result == SDLK_MEDIA_STOP, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_MEDIA_STOP, result); + SDLTest_AssertCheck(result == SDLK_MEDIA_STOP, "Verify result from call, expected: %u, got: %" SDL_PRIu32, SDLK_MEDIA_STOP, result); /* Case where Key is unknown */ result = SDL_GetKeyFromName("NotThere"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(unknown)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %u, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); /* Case where input is NULL/invalid */ result = SDL_GetKeyFromName(NULL); SDLTest_AssertPass("Call to SDL_GetKeyFromName(NULL)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %u, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); return TEST_COMPLETED; } @@ -126,12 +126,12 @@ static int SDLCALL keyboard_getKeyFromScancode(void *arg) /* Case where input is valid */ result = SDL_GetKeyFromScancode(SDL_SCANCODE_SPACE, SDL_KMOD_NONE, false); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(valid)"); - SDLTest_AssertCheck(result == SDLK_SPACE, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_SPACE, result); + SDLTest_AssertCheck(result == SDLK_SPACE, "Verify result from call, expected: %u, got: %" SDL_PRIu32, SDLK_SPACE, result); /* Case where input is zero */ result = SDL_GetKeyFromScancode(SDL_SCANCODE_UNKNOWN, SDL_KMOD_NONE, false); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(0)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %u, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); /* Clear error message */ SDL_ClearError(); @@ -140,13 +140,13 @@ static int SDLCALL keyboard_getKeyFromScancode(void *arg) /* Case where input is invalid (too small) */ result = SDL_GetKeyFromScancode((SDL_Scancode)-999, SDL_KMOD_NONE, false); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(-999)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %u, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); checkInvalidScancodeError(); /* Case where input is invalid (too big) */ result = SDL_GetKeyFromScancode((SDL_Scancode)999, SDL_KMOD_NONE, false); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(999)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %u, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); checkInvalidScancodeError(); return TEST_COMPLETED; diff --git a/test/testautomation_main.c b/test/testautomation_main.c index 89991c02bbb61..4192f5f23da79 100644 --- a/test/testautomation_main.c +++ b/test/testautomation_main.c @@ -20,12 +20,12 @@ */ static int SDLCALL main_testInitQuitSubSystem(void *arg) { - int i; - int subsystems[] = { SDL_INIT_JOYSTICK, SDL_INIT_HAPTIC, SDL_INIT_GAMEPAD }; + size_t i; + unsigned int subsystems[] = { SDL_INIT_JOYSTICK, SDL_INIT_HAPTIC, SDL_INIT_GAMEPAD }; for (i = 0; i < SDL_arraysize(subsystems); ++i) { - int initialized_system; - int subsystem = subsystems[i]; + unsigned int initialized_system; + unsigned int subsystem = subsystems[i]; SDLTest_AssertCheck((SDL_WasInit(subsystem) & subsystem) == 0, "SDL_WasInit(%x) before init should be false", subsystem); SDLTest_AssertCheck(SDL_InitSubSystem(subsystem), "SDL_InitSubSystem(%x)", subsystem); @@ -41,10 +41,10 @@ static int SDLCALL main_testInitQuitSubSystem(void *arg) return TEST_COMPLETED; } -static const int joy_and_controller = SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD; +static const unsigned int joy_and_controller = SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD; static int SDLCALL main_testImpliedJoystickInit(void *arg) { - int initialized_system; + unsigned int initialized_system; /* First initialize the controller */ SDLTest_AssertCheck((SDL_WasInit(joy_and_controller) & joy_and_controller) == 0, "SDL_WasInit() before init should be false for joystick & controller"); @@ -65,7 +65,7 @@ static int SDLCALL main_testImpliedJoystickInit(void *arg) static int SDLCALL main_testImpliedJoystickQuit(void *arg) { - int initialized_system; + unsigned int initialized_system; /* First initialize the controller and the joystick (explicitly) */ SDLTest_AssertCheck((SDL_WasInit(joy_and_controller) & joy_and_controller) == 0, "SDL_WasInit() before init should be false for joystick & controller"); diff --git a/test/testautomation_math.c b/test/testautomation_math.c index 9ba3ca447ebce..80f936315a0cf 100644 --- a/test/testautomation_math.c +++ b/test/testautomation_math.c @@ -12,7 +12,7 @@ /* ================= Test Constants ================== */ /* Range tests parameters */ -#define RANGE_TEST_ITERATIONS 10000000 +#define RANGE_TEST_ITERATIONS 10000000u #define RANGE_TEST_STEP ((Uint32)(SDL_MAX_UINT32 / RANGE_TEST_ITERATIONS)) /* Margin of error for imprecise tests */ diff --git a/test/testautomation_pixels.c b/test/testautomation_pixels.c index e5ae75b52ba53..336b7f893b5a9 100644 --- a/test/testautomation_pixels.c +++ b/test/testautomation_pixels.c @@ -911,7 +911,7 @@ static int SDLCALL pixels_allocFreePalette(void *arg) SDLTest_AssertPass("Call to SDL_CreatePalette(%d)", ncolors); SDLTest_AssertCheck(result != NULL, "Verify result is not NULL"); if (result != NULL) { - SDLTest_AssertCheck(result->ncolors == ncolors, "Verify value of result.ncolors; expected: %u, got %u", ncolors, result->ncolors); + SDLTest_AssertCheck(result->ncolors == ncolors, "Verify value of result.ncolors; expected: %d, got %d", ncolors, result->ncolors); if (result->ncolors > 0) { SDLTest_AssertCheck(result->colors != NULL, "Verify value of result.colors is not NULL"); if (result->colors != NULL) { diff --git a/test/testautomation_properties.c b/test/testautomation_properties.c index 851386d85cae4..8841a46afa991 100644 --- a/test/testautomation_properties.c +++ b/test/testautomation_properties.c @@ -84,7 +84,7 @@ static int SDLCALL properties_testBasic(void *arg) "Verify string property, expected abcd, got: %s", value_string); value_number = SDL_GetNumberProperty(props, "foo", 1234); SDLTest_AssertCheck(value_number == 1234, - "Verify number property, expected 1234, got: %" SDL_PRIu64, value_number); + "Verify number property, expected 1234, got: %" SDL_PRIs64, value_number); value_float = SDL_GetFloatProperty(props, "foo", 1234.0f); SDLTest_AssertCheck(value_float == 1234.0f, "Verify float property, expected 1234, got: %f", value_float); @@ -106,7 +106,7 @@ static int SDLCALL properties_testBasic(void *arg) "Verify string property, expected NULL, got: %s", value_string); value_number = SDL_GetNumberProperty(props, "foo", 0); SDLTest_AssertCheck(value_number == 0, - "Verify number property, expected 0, got: %" SDL_PRIu64, value_number); + "Verify number property, expected 0, got: %" SDL_PRIs64, value_number); value_float = SDL_GetFloatProperty(props, "foo", 0.0f); SDLTest_AssertCheck(value_float == 0.0f, "Verify float property, expected 0, got: %f", value_float); @@ -128,7 +128,7 @@ static int SDLCALL properties_testBasic(void *arg) "Verify string property, expected bar, got: %s", value_string); value_number = SDL_GetNumberProperty(props, "foo", 0); SDLTest_AssertCheck(value_number == 0, - "Verify number property, expected 0, got: %" SDL_PRIu64, value_number); + "Verify number property, expected 0, got: %" SDL_PRIs64, value_number); value_float = SDL_GetFloatProperty(props, "foo", 0.0f); SDLTest_AssertCheck(value_float == 0.0f, "Verify float property, expected 0, got: %f", value_float); @@ -150,7 +150,7 @@ static int SDLCALL properties_testBasic(void *arg) "Verify string property, expected 1, got: %s", value_string); value_number = SDL_GetNumberProperty(props, "foo", 0); SDLTest_AssertCheck(value_number == 1, - "Verify number property, expected 1, got: %" SDL_PRIu64, value_number); + "Verify number property, expected 1, got: %" SDL_PRIs64, value_number); value_float = SDL_GetFloatProperty(props, "foo", 0.0f); SDLTest_AssertCheck(value_float == 1.0f, "Verify float property, expected 1, got: %f", value_float); @@ -172,7 +172,7 @@ static int SDLCALL properties_testBasic(void *arg) "Verify string property, expected 1.750000, got: %s", value_string); value_number = SDL_GetNumberProperty(props, "foo", 0); SDLTest_AssertCheck(value_number == 2, - "Verify number property, expected 2, got: %" SDL_PRIu64, value_number); + "Verify number property, expected 2, got: %" SDL_PRIs64, value_number); value_float = SDL_GetFloatProperty(props, "foo", 0.0f); SDLTest_AssertCheck(value_float == 1.75f, "Verify float property, expected 1.75, got: %f", value_float); @@ -194,7 +194,7 @@ static int SDLCALL properties_testBasic(void *arg) "Verify string property, expected true, got: %s", value_string); value_number = SDL_GetNumberProperty(props, "foo", 0); SDLTest_AssertCheck(value_number == 1, - "Verify number property, expected 1, got: %" SDL_PRIu64, value_number); + "Verify number property, expected 1, got: %" SDL_PRIs64, value_number); value_float = SDL_GetFloatProperty(props, "foo", 0.0f); SDLTest_AssertCheck(value_float == 1.0f, "Verify float property, expected 1, got: %f", value_float); diff --git a/test/testautomation_render.c b/test/testautomation_render.c index c88a3df7eabaa..8529f0236f271 100644 --- a/test/testautomation_render.c +++ b/test/testautomation_render.c @@ -918,7 +918,7 @@ static void testBlendModeOperation(TestRenderOperation op, int mode, SDL_PixelFo SDL_BlendMode blendMode = SDL_BLENDMODE_NONE; ret = SDL_GetTextureBlendMode(dst, &blendMode); SDLTest_AssertCheck(ret == true, "Verify result from SDL_GetTextureBlendMode(), expected: true, got: %i", ret); - SDLTest_AssertCheck(blendMode == SDL_BLENDMODE_BLEND, "Verify alpha texture blend mode, expected %d, got %" SDL_PRIu32, SDL_BLENDMODE_BLEND, blendMode); + SDLTest_AssertCheck(blendMode == SDL_BLENDMODE_BLEND, "Verify alpha texture blend mode, expected %u, got %" SDL_PRIu32, SDL_BLENDMODE_BLEND, blendMode); } /* Set as render target */ @@ -1294,35 +1294,35 @@ static int SDLCALL render_testRGBSurfaceNoAlpha(void* arg) SDLTest_AssertCheck(result == true, "Result is %d, should be %d", result, true); SDLTest_AssertCheck(r == 0xaa && g == 0xbb && b == 0xcc && a == SDL_ALPHA_OPAQUE, "Pixel at (0, 0) is {0x%02x,0x%02x,0x%02x,0x%02x}, should be {0x%02x,0x%02x,0x%02x,0x%02x}", - r, g, b, a, 0xaa, 0xbb, 0xcc, SDL_ALPHA_OPAQUE); + r, g, b, a, 0xaau, 0xbbu, 0xccu, (unsigned int)SDL_ALPHA_OPAQUE); SDLTest_AssertPass("About to call SDL_ReadSurfacePixel(15, 15)"); result = SDL_ReadSurfacePixel(surface, 15, 15, &r, &g, &b, &a); SDLTest_AssertCheck(result == true, "Result is %d, should be %d", result, true); SDLTest_AssertCheck(r == 0xaa && g == 0xbb && b == 0xcc && a == SDL_ALPHA_OPAQUE, "Pixel at (0, 0) is {0x%02x,0x%02x,0x%02x,0x%02x}, should be {0x%02x,0x%02x,0x%02x,0x%02x}", - r, g, b, a, 0xaa, 0xbb, 0xcc, SDL_ALPHA_OPAQUE); + r, g, b, a, 0xaau, 0xbbu, 0xccu, (unsigned int)SDL_ALPHA_OPAQUE); SDLTest_AssertPass("About to call SDL_ReadSurfacePixel(16, 16)"); result = SDL_ReadSurfacePixel(surface, 16, 16, &r, &g, &b, &a); SDLTest_AssertCheck(result == true, "Result is %d, should be %d", result, true); SDLTest_AssertCheck(r == 0x00 && g == 0x00 && b == 0x00 && a == SDL_ALPHA_OPAQUE, "Pixel at (0, 0) is {0x%02x,0x%02x,0x%02x,0x%02x}, should be {0x%02x,0x%02x,0x%02x,0x%02x}", - r, g, b, a, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE); + r, g, b, a, 0x00u, 0x00u, 0x00u, (unsigned int)SDL_ALPHA_OPAQUE); SDLTest_AssertPass("About to call SDL_ReadSurfacePixel(31, 31)"); result = SDL_ReadSurfacePixel(surface, 31, 31, &r, &g, &b, &a); SDLTest_AssertCheck(result == true, "Result is %d, should be %d", result, true); SDLTest_AssertCheck(r == 0x00 && g == 0x00 && b == 0x00 && a == SDL_ALPHA_OPAQUE, "Pixel at (0, 0) is {0x%02x,0x%02x,0x%02x,0x%02x}, should be {0x%02x,0x%02x,0x%02x,0x%02x}", - r, g, b, a, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE); + r, g, b, a, 0x00u, 0x00u, 0x00u, (unsigned int)SDL_ALPHA_OPAQUE); SDLTest_AssertPass("About to call SDL_ReadSurfacePixel(32, 32)"); result = SDL_ReadSurfacePixel(surface, 32, 32, &r, &g, &b, &a); SDLTest_AssertCheck(result == true, "Result is %d, should be %d", result, true); SDLTest_AssertCheck(r == 0xaa && g == 0xbb && b == 0xcc && a == SDL_ALPHA_OPAQUE, "Pixel at (0, 0) is {0x%02x,0x%02x,0x%02x,0x%02x}, should be {0x%02x,0x%02x,0x%02x,0x%02x}", - r, g, b, a, 0xaa, 0xbb, 0xcc, SDL_ALPHA_OPAQUE); + r, g, b, a, 0xaau, 0xbbu, 0xccu, (unsigned int)SDL_ALPHA_OPAQUE); SDL_DestroyTexture(texture2); SDL_DestroySurface(surface2); diff --git a/test/testautomation_sdltest.c b/test/testautomation_sdltest.c index 34941b49e97db..fc103e69be25b 100644 --- a/test/testautomation_sdltest.c +++ b/test/testautomation_sdltest.c @@ -152,63 +152,63 @@ static int SDLCALL sdltest_randomBoundaryNumberUint8(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue"); SDLTest_AssertCheck( uresult == 10, - "Validate result value for parameters (10,10,true); expected: 10, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,10,true); expected: 10, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 11, true) returns 10, 11 */ uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 11, true); SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11, - "Validate result value for parameters (10,11,true); expected: 10|11, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,11,true); expected: 10|11, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 12, true) returns 10, 11, 12 */ uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 12, true); SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 12, - "Validate result value for parameters (10,12,true); expected: 10|11|12, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,12,true); expected: 10|11|12, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 13, true) returns 10, 11, 12, 13 */ uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 13, true); SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13, - "Validate result value for parameters (10,13,true); expected: 10|11|12|13, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,13,true); expected: 10|11|12|13, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 20, true) returns 10, 11, 19 or 20 */ uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 20, true); SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20, - "Validate result value for parameters (10,20,true); expected: 10|11|19|20, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,20,true); expected: 10|11|19|20, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(20, 10, true) returns 10, 11, 19 or 20 */ uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(20, 10, true); SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20, - "Validate result value for parameters (20,10,true); expected: 10|11|19|20, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (20,10,true); expected: 10|11|19|20, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(1, 20, false) returns 0, 21 */ uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(1, 20, false); SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue"); SDLTest_AssertCheck( uresult == 0 || uresult == 21, - "Validate result value for parameters (1,20,false); expected: 0|21, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (1,20,false); expected: 0|21, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(0, 99, false) returns 100 */ uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 99, false); SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue"); SDLTest_AssertCheck( uresult == 100, - "Validate result value for parameters (0,99,false); expected: 100, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (0,99,false); expected: 100, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(1, 0xff, false) returns 0 (no error) */ uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(1, 255, false); SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue"); SDLTest_AssertCheck( uresult == 0, - "Validate result value for parameters (1,255,false); expected: 0, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (1,255,false); expected: 0, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); @@ -218,7 +218,7 @@ static int SDLCALL sdltest_randomBoundaryNumberUint8(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue"); SDLTest_AssertCheck( uresult == 0xff, - "Validate result value for parameters (0,254,false); expected: 0xff, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (0,254,false); expected: 0xff, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); @@ -228,7 +228,7 @@ static int SDLCALL sdltest_randomBoundaryNumberUint8(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue"); SDLTest_AssertCheck( uresult == 0, - "Validate result value for parameters(0,255,false); expected: 0, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters(0,255,false); expected: 0, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0, @@ -261,63 +261,63 @@ static int SDLCALL sdltest_randomBoundaryNumberUint16(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue"); SDLTest_AssertCheck( uresult == 10, - "Validate result value for parameters (10,10,true); expected: 10, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,10,true); expected: 10, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 11, true) returns 10, 11 */ uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 11, true); SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11, - "Validate result value for parameters (10,11,true); expected: 10|11, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,11,true); expected: 10|11, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 12, true) returns 10, 11, 12 */ uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 12, true); SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 12, - "Validate result value for parameters (10,12,true); expected: 10|11|12, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,12,true); expected: 10|11|12, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 13, true) returns 10, 11, 12, 13 */ uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 13, true); SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13, - "Validate result value for parameters (10,13,true); expected: 10|11|12|13, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,13,true); expected: 10|11|12|13, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 20, true) returns 10, 11, 19 or 20 */ uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 20, true); SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20, - "Validate result value for parameters (10,20,true); expected: 10|11|19|20, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,20,true); expected: 10|11|19|20, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(20, 10, true) returns 10, 11, 19 or 20 */ uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(20, 10, true); SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20, - "Validate result value for parameters (20,10,true); expected: 10|11|19|20, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (20,10,true); expected: 10|11|19|20, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(1, 20, false) returns 0, 21 */ uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(1, 20, false); SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue"); SDLTest_AssertCheck( uresult == 0 || uresult == 21, - "Validate result value for parameters (1,20,false); expected: 0|21, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (1,20,false); expected: 0|21, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(0, 99, false) returns 100 */ uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 99, false); SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue"); SDLTest_AssertCheck( uresult == 100, - "Validate result value for parameters (0,99,false); expected: 100, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (0,99,false); expected: 100, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(1, 0xffff, false) returns 0 (no error) */ uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(1, 0xffff, false); SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue"); SDLTest_AssertCheck( uresult == 0, - "Validate result value for parameters (1,0xffff,false); expected: 0, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (1,0xffff,false); expected: 0, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); @@ -327,7 +327,7 @@ static int SDLCALL sdltest_randomBoundaryNumberUint16(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue"); SDLTest_AssertCheck( uresult == 0xffff, - "Validate result value for parameters (0,0xfffe,false); expected: 0xffff, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (0,0xfffe,false); expected: 0xffff, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); @@ -337,7 +337,7 @@ static int SDLCALL sdltest_randomBoundaryNumberUint16(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue"); SDLTest_AssertCheck( uresult == 0, - "Validate result value for parameters(0,0xffff,false); expected: 0, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters(0,0xffff,false); expected: 0, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0, @@ -370,63 +370,63 @@ static int SDLCALL sdltest_randomBoundaryNumberUint32(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue"); SDLTest_AssertCheck( uresult == 10, - "Validate result value for parameters (10,10,true); expected: 10, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,10,true); expected: 10, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 11, true) returns 10, 11 */ uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 11, true); SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11, - "Validate result value for parameters (10,11,true); expected: 10|11, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,11,true); expected: 10|11, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 12, true) returns 10, 11, 12 */ uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 12, true); SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 12, - "Validate result value for parameters (10,12,true); expected: 10|11|12, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,12,true); expected: 10|11|12, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 13, true) returns 10, 11, 12, 13 */ uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 13, true); SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13, - "Validate result value for parameters (10,13,true); expected: 10|11|12|13, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,13,true); expected: 10|11|12|13, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 20, true) returns 10, 11, 19 or 20 */ uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 20, true); SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20, - "Validate result value for parameters (10,20,true); expected: 10|11|19|20, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,20,true); expected: 10|11|19|20, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(20, 10, true) returns 10, 11, 19 or 20 */ uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(20, 10, true); SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20, - "Validate result value for parameters (20,10,true); expected: 10|11|19|20, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (20,10,true); expected: 10|11|19|20, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(1, 20, false) returns 0, 21 */ uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(1, 20, false); SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue"); SDLTest_AssertCheck( uresult == 0 || uresult == 21, - "Validate result value for parameters (1,20,false); expected: 0|21, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (1,20,false); expected: 0|21, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(0, 99, false) returns 100 */ uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 99, false); SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue"); SDLTest_AssertCheck( uresult == 100, - "Validate result value for parameters (0,99,false); expected: 100, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (0,99,false); expected: 100, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(1, 0xffffffff, false) returns 0 (no error) */ uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(1, 0xffffffff, false); SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue"); SDLTest_AssertCheck( uresult == 0, - "Validate result value for parameters (1,0xffffffff,false); expected: 0, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (1,0xffffffff,false); expected: 0, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); @@ -436,7 +436,7 @@ static int SDLCALL sdltest_randomBoundaryNumberUint32(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue"); SDLTest_AssertCheck( uresult == 0xffffffff, - "Validate result value for parameters (0,0xfffffffe,false); expected: 0xffffffff, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (0,0xfffffffe,false); expected: 0xffffffff, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); @@ -446,7 +446,7 @@ static int SDLCALL sdltest_randomBoundaryNumberUint32(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue"); SDLTest_AssertCheck( uresult == 0, - "Validate result value for parameters(0,0xffffffff,false); expected: 0, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters(0,0xffffffff,false); expected: 0, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0, @@ -479,63 +479,63 @@ static int SDLCALL sdltest_randomBoundaryNumberUint64(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue"); SDLTest_AssertCheck( uresult == 10, - "Validate result value for parameters (10,10,true); expected: 10, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,10,true); expected: 10, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 11, true) returns 10, 11 */ uresult = SDLTest_RandomUint64BoundaryValue(10, 11, true); SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11, - "Validate result value for parameters (10,11,true); expected: 10|11, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,11,true); expected: 10|11, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 12, true) returns 10, 11, 12 */ uresult = SDLTest_RandomUint64BoundaryValue(10, 12, true); SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 12, - "Validate result value for parameters (10,12,true); expected: 10|11|12, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,12,true); expected: 10|11|12, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 13, true) returns 10, 11, 12, 13 */ uresult = SDLTest_RandomUint64BoundaryValue(10, 13, true); SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13, - "Validate result value for parameters (10,13,true); expected: 10|11|12|13, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,13,true); expected: 10|11|12|13, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(10, 20, true) returns 10, 11, 19 or 20 */ uresult = SDLTest_RandomUint64BoundaryValue(10, 20, true); SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20, - "Validate result value for parameters (10,20,true); expected: 10|11|19|20, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (10,20,true); expected: 10|11|19|20, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(20, 10, true) returns 10, 11, 19 or 20 */ uresult = SDLTest_RandomUint64BoundaryValue(20, 10, true); SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue"); SDLTest_AssertCheck( uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20, - "Validate result value for parameters (20,10,true); expected: 10|11|19|20, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (20,10,true); expected: 10|11|19|20, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(1, 20, false) returns 0, 21 */ uresult = SDLTest_RandomUint64BoundaryValue(1, 20, false); SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue"); SDLTest_AssertCheck( uresult == 0 || uresult == 21, - "Validate result value for parameters (1,20,false); expected: 0|21, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (1,20,false); expected: 0|21, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(0, 99, false) returns 100 */ uresult = SDLTest_RandomUint64BoundaryValue(0, 99, false); SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue"); SDLTest_AssertCheck( uresult == 100, - "Validate result value for parameters (0,99,false); expected: 100, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (0,99,false); expected: 100, got: %" SDL_PRIu64, uresult); /* RandomUintXBoundaryValue(1, 0xffffffffffffffff, false) returns 0 (no error) */ uresult = SDLTest_RandomUint64BoundaryValue(1, 0xffffffffffffffffULL, false); SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue"); SDLTest_AssertCheck( uresult == 0, - "Validate result value for parameters (1,0xffffffffffffffff,false); expected: 0, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (1,0xffffffffffffffff,false); expected: 0, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); @@ -545,7 +545,7 @@ static int SDLCALL sdltest_randomBoundaryNumberUint64(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue"); SDLTest_AssertCheck( uresult == 0xffffffffffffffffULL, - "Validate result value for parameters (0,0xfffffffffffffffe,false); expected: 0xffffffffffffffff, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters (0,0xfffffffffffffffe,false); expected: 0xffffffffffffffff, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); @@ -555,7 +555,7 @@ static int SDLCALL sdltest_randomBoundaryNumberUint64(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue"); SDLTest_AssertCheck( uresult == 0, - "Validate result value for parameters(0,0xffffffffffffffff,false); expected: 0, got: %" SDL_PRIs64, uresult); + "Validate result value for parameters(0,0xffffffffffffffff,false); expected: 0, got: %" SDL_PRIu64, uresult); lastError = SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0, diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c index ae12c893384d9..54db91c88064d 100644 --- a/test/testautomation_stdlib.c +++ b/test/testautomation_stdlib.c @@ -1410,9 +1410,9 @@ static int SDLCALL stdlib_strtox(void *arg) STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "-9223372036854775809", 10, -9223372036854775807LL - 1, 20); STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "-9999999999999999999999999999999999999999", 10, -9223372036854775807LL - 1, 41); - STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLd, "18446744073709551615", 10, 18446744073709551615ULL, 20); - STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLd, "18446744073709551616", 10, 18446744073709551615ULL, 20); - STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLd, "-18446744073709551615", 10, 1, 21); + STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "18446744073709551615", 10, 18446744073709551615ULL, 20); + STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "18446744073709551616", 10, 18446744073709551615ULL, 20); + STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "-18446744073709551615", 10, 1, 21); } #undef STRTOX_TEST_CASE diff --git a/test/testautomation_subsystems.c b/test/testautomation_subsystems.c index 1904ae0e2593f..b52d94e92a993 100644 --- a/test/testautomation_subsystems.c +++ b/test/testautomation_subsystems.c @@ -42,8 +42,8 @@ static void SDLCALL subsystemsTearDown(void *arg) */ static int SDLCALL subsystems_referenceCount(void *arg) { - const int system = SDL_INIT_VIDEO; - int result; + const unsigned int system = SDL_INIT_VIDEO; + unsigned int result; /* Ensure that we start with a non-initialized subsystem. */ SDLTest_AssertCheck(SDL_WasInit(system) == 0, "Check result from SDL_WasInit(0x%x)", system); @@ -92,7 +92,7 @@ static int SDLCALL subsystems_referenceCount(void *arg) */ static int SDLCALL subsystems_dependRefCountInitAllQuitByOne(void *arg) { - int result; + unsigned int result; /* Ensure that we start with reset subsystems. */ SDLTest_AssertCheck(SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS) == 0, "Check result from SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS)"); @@ -132,7 +132,7 @@ static int SDLCALL subsystems_dependRefCountInitAllQuitByOne(void *arg) */ static int SDLCALL subsystems_dependRefCountInitByOneQuitAll(void *arg) { - int result; + unsigned int result; /* Ensure that we start with reset subsystems. */ SDLTest_AssertCheck(SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS) == 0, "Check result from SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS)"); @@ -167,7 +167,7 @@ static int SDLCALL subsystems_dependRefCountInitByOneQuitAll(void *arg) */ static int SDLCALL subsystems_dependRefCountWithExtraInit(void *arg) { - int result; + unsigned int result; /* Ensure that we start with reset subsystems. */ SDLTest_AssertCheck(SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS) == 0, "Check result from SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS)"); diff --git a/test/testautomation_timer.c b/test/testautomation_timer.c index 03face2d87180..e7f9e8493dcbc 100644 --- a/test/testautomation_timer.c +++ b/test/testautomation_timer.c @@ -88,10 +88,10 @@ static int SDLCALL timer_delayAndGetTicks(void *arg) SDLTest_AssertPass("Call to SDL_GetTicks()"); SDLTest_AssertCheck(result2 > 0, "Check result value, expected: >0, got: %" SDL_PRIu64, result2); difference = result2 - result; - SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%d, got: %" SDL_PRIu64, testDelay - marginOfError, difference); + SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%d, got: %" SDL_PRIs64, testDelay - marginOfError, difference); #if 0 /* Disabled because this might fail on non-interactive systems. Moved to testtimer. */ - SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%d, got: %" SDL_PRIu64, testDelay + marginOfError, difference); + SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%d, got: %" SDL_PRIs64, testDelay + marginOfError, difference); #endif return TEST_COMPLETED; diff --git a/test/testevdev.c b/test/testevdev.c index 291e2ee04285d..67e569a21bd6e 100644 --- a/test/testevdev.c +++ b/test/testevdev.c @@ -2186,7 +2186,7 @@ run_test(void) if (actual == t->expected) { printf("\tOK\n"); } else { - printf("\tExpected 0x%08x\n", t->expected); + printf("\tExpected 0x%08x\n", (unsigned int)t->expected); for (j = 0; device_classes[j].code != 0; j++) { if (t->expected & device_classes[j].code) { @@ -2194,7 +2194,7 @@ run_test(void) } } - printf("\tGot 0x%08x\n", actual); + printf("\tGot 0x%08x\n", (unsigned int)actual); for (j = 0; device_classes[j].code != 0; j++) { if (actual & device_classes[j].code) { diff --git a/test/testffmpeg.c b/test/testffmpeg.c index a68fc09916026..2a84f3a212e7d 100644 --- a/test/testffmpeg.c +++ b/test/testffmpeg.c @@ -730,7 +730,7 @@ static bool GetNV12TextureForDRMFrame(AVFrame *frame, SDL_Texture **texture) EGLImage image = eglCreateImage(display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, NULL, attr); if (image == EGL_NO_IMAGE) { - SDL_Log("Couldn't create image: %d", glGetError()); + SDL_Log("Couldn't create image: %u", glGetError()); return false; } @@ -916,7 +916,7 @@ static bool GetOESTextureForDRMFrame(AVFrame *frame, SDL_Texture **texture) EGLImage image = eglCreateImage(display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, NULL, attr); if (image == EGL_NO_IMAGE) { - SDL_Log("Couldn't create image: %d", glGetError()); + SDL_Log("Couldn't create image: %u", glGetError()); return false; } diff --git a/test/testfile.c b/test/testfile.c index 8c188726d4927..eb137b41be3e5 100644 --- a/test/testfile.c +++ b/test/testfile.c @@ -53,7 +53,7 @@ cleanup(void) static void iostrm_error_quit(unsigned line, SDL_IOStream *iostrm) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed", line); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%u): failed", line); if (iostrm) { SDL_CloseIO(iostrm); } diff --git a/test/testfilesystem.c b/test/testfilesystem.c index 87ba39501f47c..1f1a701bc23a7 100644 --- a/test/testfilesystem.c +++ b/test/testfilesystem.c @@ -36,7 +36,7 @@ static SDL_EnumerationResult SDLCALL enum_callback(void *userdata, const char *o } else { type = "OTHER"; } - SDL_Log("DIRECTORY %s (type=%s, size=%" SDL_PRIu64 ", create=%" SDL_PRIu64 ", mod=%" SDL_PRIu64 ", access=%" SDL_PRIu64 ")", + SDL_Log("DIRECTORY %s (type=%s, size=%" SDL_PRIu64 ", create=%" SDL_PRIs64 ", mod=%" SDL_PRIs64 ", access=%" SDL_PRIs64 ")", fullpath, type, info.size, info.modify_time, info.create_time, info.access_time); if (info.type == SDL_PATHTYPE_DIRECTORY) { @@ -73,7 +73,7 @@ static SDL_EnumerationResult SDLCALL enum_storage_callback(void *userdata, const } else { type = "OTHER"; } - SDL_Log("STORAGE %s (type=%s, size=%" SDL_PRIu64 ", create=%" SDL_PRIu64 ", mod=%" SDL_PRIu64 ", access=%" SDL_PRIu64 ")", + SDL_Log("STORAGE %s (type=%s, size=%" SDL_PRIu64 ", create=%" SDL_PRIs64 ", mod=%" SDL_PRIs64 ", access=%" SDL_PRIs64 ")", fullpath, type, info.size, info.modify_time, info.create_time, info.access_time); if (info.type == SDL_PATHTYPE_DIRECTORY) { diff --git a/test/testgles2.c b/test/testgles2.c index 697158174d266..f7e5672e0144b 100644 --- a/test/testgles2.c +++ b/test/testgles2.c @@ -124,7 +124,7 @@ quit(int rc) { \ GLenum glError = ctx.glGetError(); \ if (glError != GL_NO_ERROR) { \ - SDL_Log("glGetError() = %i (0x%.8x) at line %i", glError, glError, __LINE__); \ + SDL_Log("glGetError() = %u (0x%.8x) at line %i", glError, glError, __LINE__); \ quit(1); \ } \ } diff --git a/test/testhotplug.c b/test/testhotplug.c index 61ecb3bf8976b..df109f3192484 100644 --- a/test/testhotplug.c +++ b/test/testhotplug.c @@ -141,7 +141,7 @@ int main(int argc, char *argv[]) break; case SDL_EVENT_JOYSTICK_REMOVED: if (instance == event.jdevice.which) { - SDL_Log("Joy Removed: %" SDL_PRIs32, event.jdevice.which); + SDL_Log("Joy Removed: %" SDL_PRIu32, event.jdevice.which); instance = 0; if (enable_haptic && haptic) { SDL_CloseHaptic(haptic); diff --git a/test/testime.c b/test/testime.c index 205f96d701d77..520867a37e30f 100644 --- a/test/testime.c +++ b/test/testime.c @@ -223,7 +223,7 @@ static int unifont_init(const char *fontname) return -1; } if (codepoint > UNIFONT_MAX_CODEPOINT) { - SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Codepoint on line %d exceeded limit of 0x%x.", lineNumber, UNIFONT_MAX_CODEPOINT); + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Codepoint on line %d exceeded limit of 0x%x.", lineNumber, (unsigned int)UNIFONT_MAX_CODEPOINT); } /* If there was glyph data read in the last file read, move it to the front of the buffer. */ diff --git a/test/testoffscreen.c b/test/testoffscreen.c index 22ac4eaa73e5d..4575b3a3fc97b 100644 --- a/test/testoffscreen.c +++ b/test/testoffscreen.c @@ -54,7 +54,7 @@ static void save_surface_to_png(void) surface = SDL_RenderReadPixels(renderer, NULL); - (void)SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIs32 "-%8.8d.png", + (void)SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIu32 "-%8.8d.png", SDL_GetWindowID(window), ++frame_number); SDL_SavePNG(surface, file); diff --git a/test/testqsort.c b/test/testqsort.c index 25fa528a24211..14e2b1008af5b 100644 --- a/test/testqsort.c +++ b/test/testqsort.c @@ -111,7 +111,7 @@ generic_compare_r(void *userdata, const void *a, const void *b) } \ } \ SDLTest_AssertCheck(count_non_sorted == 0, \ - STR(TYPE) "Array (size=%d) is sorted (bad count=%" SDL_PRIu64 ")", (SIZE), count_non_sorted); \ + STR(TYPE) "Array (size=%u) is sorted (bad count=%" SDL_PRIu64 ")", (SIZE), count_non_sorted); \ } while (0) /* This test is O(n^2), so very slow (a hashmap can speed this up): @@ -354,7 +354,7 @@ static int SDLCALL qsort_testReverseSorted(void *arg) } \ for (check_index = 0; check_index < MAX_RANDOM_INT_VALUE; check_index++) { \ if (presences[check_index] != 0) { \ - SDLTest_AssertCheck(false, "Value %d appears %s in sorted array", \ + SDLTest_AssertCheck(false, "Value %u appears %s in sorted array", \ check_index, \ presences[check_index] > 0 ? "MORE" : "LESS"); \ } \ @@ -377,7 +377,7 @@ static int SDLCALL qsort_testReverseSorted(void *arg) } \ for (check_index = 0; check_index < 256 * 256 * 256; check_index++) { \ if (presences[check_index] != 0) { \ - SDLTest_AssertCheck(false, STR(TYPE) "Version %d.%d.%d appears %s in sorted array", \ + SDLTest_AssertCheck(false, STR(TYPE) "Version %u.%u.%u appears %s in sorted array", \ INT_VERSION_MAJOR(check_index), \ INT_VERSION_MINOR(check_index), \ INT_VERSION_MICRO(check_index), \ @@ -506,7 +506,7 @@ int main(int argc, char *argv[]) break; } if (count_arraylens >= SDL_arraysize(arraylens)) { - SDL_LogWarn(SDL_LOG_CATEGORY_TEST, "Dropping array length %d", arraylen); + SDL_LogWarn(SDL_LOG_CATEGORY_TEST, "Dropping array length %u", arraylen); } else { arraylens[count_arraylens] = arraylen; } diff --git a/test/testtimer.c b/test/testtimer.c index 83b27e0f0d926..d84249944765e 100644 --- a/test/testtimer.c +++ b/test/testtimer.c @@ -40,9 +40,9 @@ static int test_sdl_delay_within_bounds(void) { SDLTest_AssertPass("Call to SDL_GetTicks()"); SDLTest_AssertCheck(result2 > 0, "Check result value, expected: >0, got: %" SDL_PRIu64, result2); difference = result2 - result; - SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%d, got: %" SDL_PRIu64, testDelay - marginOfError, difference); + SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%d, got: %" SDL_PRIs64, testDelay - marginOfError, difference); /* Disabled because this might fail on non-interactive systems. */ - SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%d, got: %" SDL_PRIu64, testDelay + marginOfError, difference); + SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%d, got: %" SDL_PRIs64, testDelay + marginOfError, difference); return SDLTest_AssertSummaryToTestResult() == TEST_RESULT_PASSED ? 0 : 1; }