mirror of
https://github.com/encounter/SDL.git
synced 2025-12-16 00:17:18 +00:00
re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory
This commit is contained in:
@@ -1404,8 +1404,7 @@ int SDL_ConvertPixels(int width, int height,
|
||||
}
|
||||
#else
|
||||
if (SDL_ISPIXELFORMAT_FOURCC(src_format) || SDL_ISPIXELFORMAT_FOURCC(dst_format)) {
|
||||
SDL_SetError("SDL not built with YUV support");
|
||||
return -1;
|
||||
return SDL_SetError("SDL not built with YUV support");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1879,18 +1879,15 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
||||
}
|
||||
|
||||
if ((flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) {
|
||||
SDL_SetError("Vulkan and OpenGL not supported on same window");
|
||||
return -1;
|
||||
return SDL_SetError("Vulkan and OpenGL not supported on same window");
|
||||
}
|
||||
|
||||
if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_OPENGL)) {
|
||||
SDL_SetError("Metal and OpenGL not supported on same window");
|
||||
return -1;
|
||||
return SDL_SetError("Metal and OpenGL not supported on same window");
|
||||
}
|
||||
|
||||
if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_VULKAN)) {
|
||||
SDL_SetError("Metal and Vulkan not supported on same window");
|
||||
return -1;
|
||||
return SDL_SetError("Metal and Vulkan not supported on same window");
|
||||
}
|
||||
|
||||
if (need_gl_unload) {
|
||||
|
||||
@@ -35,8 +35,7 @@ NACL_CreateWindow(_THIS, SDL_Window * window)
|
||||
SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
|
||||
|
||||
if (driverdata->window) {
|
||||
SDL_SetError("NaCl only supports one window");
|
||||
return -1;
|
||||
return SDL_SetError("NaCl only supports one window");
|
||||
}
|
||||
driverdata->window = window;
|
||||
|
||||
|
||||
@@ -259,8 +259,7 @@ VITA_CreateWindow(_THIS, SDL_Window * window)
|
||||
// Vita can only have one window
|
||||
if (Vita_Window != NULL)
|
||||
{
|
||||
SDL_SetError("Only one window supported");
|
||||
return -1;
|
||||
return SDL_SetError("Only one window supported");
|
||||
}
|
||||
|
||||
Vita_Window = window;
|
||||
|
||||
@@ -478,8 +478,7 @@ WINRT_InitModes(_THIS)
|
||||
|
||||
hr = CreateDXGIFactory1(SDL_IID_IDXGIFactory2, (void **)&dxgiFactory2);
|
||||
if (FAILED(hr)) {
|
||||
WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory1() failed", hr);
|
||||
return -1;
|
||||
return WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory1() failed", hr);
|
||||
}
|
||||
|
||||
for (int adapterIndex = 0; ; ++adapterIndex) {
|
||||
@@ -630,14 +629,12 @@ WINRT_CreateWindow(_THIS, SDL_Window * window)
|
||||
// Make sure that only one window gets created, at least until multimonitor
|
||||
// support is added.
|
||||
if (WINRT_GlobalSDLWindow != NULL) {
|
||||
SDL_SetError("WinRT only supports one window");
|
||||
return -1;
|
||||
return SDL_SetError("WinRT only supports one window");
|
||||
}
|
||||
|
||||
SDL_WindowData *data = new SDL_WindowData; /* use 'new' here as SDL_WindowData may use WinRT/C++ types */
|
||||
if (!data) {
|
||||
SDL_OutOfMemory();
|
||||
return -1;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
window->driverdata = data;
|
||||
data->sdlWindow = window;
|
||||
|
||||
Reference in New Issue
Block a user