Skip to content

Commit

Permalink
Remove newlines from error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Sackzement authored and slouken committed Jan 23, 2025
1 parent d0ae093 commit a336b62
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/joystick/hidapi/SDL_hidapi_xboxone.c
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ static bool HIDAPI_GIP_SendPacket(SDL_DriverXboxOne_Context *ctx, struct gip_hea
hdr_len = HIDAPI_GIP_GetHeaderLength(hdr);
size = (hdr_len + hdr->packet_length);
if (size > sizeof(packet)) {
SDL_SetError("Couldn't send GIP packet, size (%d) too large\n", size);
SDL_SetError("Couldn't send GIP packet, size (%d) too large", size);
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/joystick/hidapi/SDL_hidapijoystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ static bool HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index)

if (!device || !device->driver) {
// This should never happen - validated before being called
return SDL_SetError("Couldn't find HIDAPI device at index %d\n", device_index);
return SDL_SetError("Couldn't find HIDAPI device at index %d", device_index);
}

hwdata = (struct joystick_hwdata *)SDL_calloc(1, sizeof(*hwdata));
Expand Down
6 changes: 3 additions & 3 deletions src/joystick/windows/SDL_rawinputjoystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,12 +703,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\n", hr);
SDL_SetError("add_GamepadAdded() failed: 0x%lx", 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\n", hr);
SDL_SetError("add_GamepadRemoved() failed: 0x%lx", hr);
}
}
}
Expand Down Expand Up @@ -1511,7 +1511,7 @@ static bool RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_
gamepad_state->vibration.RightTrigger = (DOUBLE)right_rumble / SDL_MAX_UINT16;
hr = __x_ABI_CWindows_CGaming_CInput_CIGamepad_put_Vibration(gamepad_state->gamepad, gamepad_state->vibration);
if (!SUCCEEDED(hr)) {
return SDL_SetError("Setting vibration failed: 0x%lx\n", hr);
return SDL_SetError("Setting vibration failed: 0x%lx", hr);
}
return true;
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/render/direct3d11/SDL_render_d3d11.c
Original file line number Diff line number Diff line change
Expand Up @@ -2315,7 +2315,7 @@ static bool D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *
textureSampler = rendererData->samplers[D3D11_SAMPLER_NEAREST_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
case D3D11_FILTER_MIN_MAG_MIP_LINEAR:
Expand All @@ -2327,11 +2327,11 @@ static bool D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *
textureSampler = rendererData->samplers[D3D11_SAMPLER_LINEAR_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
default:
return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode);
return SDL_SetError("Unknown scale mode: %d", textureData->scaleMode);
}
#ifdef SDL_HAVE_YUV
if (textureData->yuv) {
Expand Down
6 changes: 3 additions & 3 deletions src/render/direct3d12/SDL_render_d3d12.c
Original file line number Diff line number Diff line change
Expand Up @@ -2742,7 +2742,7 @@ static bool D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *
textureSampler = &rendererData->samplers[D3D12_SAMPLER_NEAREST_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
case D3D12_FILTER_MIN_MAG_MIP_LINEAR:
Expand All @@ -2754,11 +2754,11 @@ static bool D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *
textureSampler = &rendererData->samplers[D3D12_SAMPLER_LINEAR_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
default:
return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode);
return SDL_SetError("Unknown scale mode: %d", textureData->scaleMode);
}
#ifdef SDL_HAVE_YUV
if (textureData->yuv) {
Expand Down
4 changes: 2 additions & 2 deletions src/render/metal/SDL_render_metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ static bool SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, c
mtlsampler = data.mtlsamplers[SDL_METAL_SAMPLER_NEAREST_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
} else {
switch (cmd->data.draw.texture_address_mode) {
Expand All @@ -1493,7 +1493,7 @@ static bool SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, c
mtlsampler = data.mtlsamplers[SDL_METAL_SAMPLER_LINEAR_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
}
[data.mtlcmdencoder setFragmentSamplerState:mtlsampler atIndex:0];
Expand Down
2 changes: 1 addition & 1 deletion src/render/opengl/SDL_render_gl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ static bool SetTextureAddressMode(GL_RenderData *data, GLenum textype, SDL_Textu
data->glTexParameteri(textype, GL_TEXTURE_WRAP_T, GL_REPEAT);
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", addressMode);
return SDL_SetError("Unknown texture address mode: %d", addressMode);
}
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/render/opengles2/SDL_render_gles2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ static bool SetTextureAddressMode(GLES2_RenderData *data, GLenum textype, SDL_Te
data->glTexParameteri(textype, GL_TEXTURE_WRAP_T, GL_REPEAT);
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", addressMode);
return SDL_SetError("Unknown texture address mode: %d", addressMode);
}
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/render/vulkan/SDL_render_vulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -3778,7 +3778,7 @@ static bool VULKAN_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand
textureSampler = rendererData->samplers[VULKAN_SAMPLER_NEAREST_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
case VK_FILTER_LINEAR:
Expand All @@ -3790,7 +3790,7 @@ static bool VULKAN_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand
textureSampler = rendererData->samplers[VULKAN_SAMPLER_LINEAR_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_yuv.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ static bool SDL_ConvertPixels_XRGB8888_to_YUV(int width, int height, const void
int plane_skip;

if (dst_pitch < row_size) {
return SDL_SetError("Destination pitch is too small, expected at least %d\n", row_size);
return SDL_SetError("Destination pitch is too small, expected at least %d", row_size);
}
plane_skip = (dst_pitch - row_size);

Expand Down
2 changes: 1 addition & 1 deletion src/video/kmsdrm/SDL_kmsdrmvulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ bool KMSDRM_Vulkan_CreateSurface(SDL_VideoDevice *_this,
&mode_count, NULL);

if (mode_count == 0) {
SDL_SetError("Vulkan can't find any video modes for display %i (%s)\n", 0,
SDL_SetError("Vulkan can't find any video modes for display %i (%s)", 0,
display_props[display_index].displayName);
goto clean;
}
Expand Down
6 changes: 3 additions & 3 deletions src/video/wayland/SDL_waylandevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
close(fd);

if (!input->xkb.keymap) {
SDL_SetError("failed to compile keymap\n");
SDL_SetError("failed to compile keymap");
return;
}

Expand All @@ -1422,7 +1422,7 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
}
input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap);
if (!input->xkb.state) {
SDL_SetError("failed to create XKB state\n");
SDL_SetError("failed to create XKB state");
WAYLAND_xkb_keymap_unref(input->xkb.keymap);
input->xkb.keymap = NULL;
return;
Expand Down Expand Up @@ -1472,7 +1472,7 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
input->xkb.compose_state = WAYLAND_xkb_compose_state_new(input->xkb.compose_table,
XKB_COMPOSE_STATE_NO_FLAGS);
if (!input->xkb.compose_state) {
SDL_SetError("could not create XKB compose state\n");
SDL_SetError("could not create XKB compose state");
WAYLAND_xkb_compose_table_unref(input->xkb.compose_table);
input->xkb.compose_table = NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/video/x11/SDL_x11window.c
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,7 @@ void *X11_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window, size_t

icc_profile_atom = X11_XInternAtom(display, icc_atom_string, True);
if (icc_profile_atom == None) {
SDL_SetError("Screen is not calibrated.\n");
SDL_SetError("Screen is not calibrated.");
return NULL;
}

Expand All @@ -1887,7 +1887,7 @@ void *X11_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window, size_t
real_nitems = atomProp.count;
icc_profile_data = atomProp.data;
if (real_format == None) {
SDL_SetError("Screen is not calibrated.\n");
SDL_SetError("Screen is not calibrated.");
return NULL;
}

Expand Down
4 changes: 2 additions & 2 deletions test/testffmpeg_vulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static int loadDeviceFunctions(VulkanVideoContext *context)
#define VULKAN_DEVICE_FUNCTION(name) \
context->name = (PFN_##name)context->vkGetDeviceProcAddr(context->device, #name); \
if (!context->name) { \
return SDL_SetError("vkGetDeviceProcAddr(device, \"" #name "\") failed\n"); \
return SDL_SetError("vkGetDeviceProcAddr(device, \"" #name "\") failed"); \
}
VULKAN_FUNCTIONS()
#undef VULKAN_GLOBAL_FUNCTION
Expand Down Expand Up @@ -243,7 +243,7 @@ static int createInstance(VulkanVideoContext *context)
result = context->vkCreateInstance(&instanceCreateInfo, NULL, &context->instance);
if (result != VK_SUCCESS) {
context->instance = VK_NULL_HANDLE;
return SDL_SetError("vkCreateInstance(): %s\n", getVulkanResultString(result));
return SDL_SetError("vkCreateInstance(): %s", getVulkanResultString(result));
}
if (loadInstanceFunctions(context) < 0) {
return -1;
Expand Down

0 comments on commit a336b62

Please sign in to comment.