Make SDL_SetError and friends unconditionally return -1.

This lets us change things like this...

    if (Failed) {
        SDL_SetError("We failed");
        return -1;
    }

...into this...

    if (Failed) {
        return SDL_SetError("We failed");
    }


 Fixes Bugzilla #1778.
This commit is contained in:
Ryan C. Gordon 2013-03-31 12:48:50 -04:00
parent 8c6b9f4743
commit 4f438b70a2
106 changed files with 616 additions and 1189 deletions

View file

@ -72,8 +72,7 @@ DirectFB_GL_Initialize(_THIS)
sizeof(struct
SDL_GLDriverData));
if (!_this->gl_data) {
SDL_OutOfMemory();
return -1;
return SDL_OutOfMemory();
}
_this->gl_data->initialized = 0;
@ -115,8 +114,7 @@ DirectFB_GL_LoadLibrary(_THIS, const char *path)
SDL_DFB_DEBUG("Loadlibrary : %s\n", path);
if (_this->gl_data->gl_active) {
SDL_SetError("OpenGL context already created");
return -1;
return SDL_SetError("OpenGL context already created");
}
@ -243,8 +241,7 @@ DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
int
DirectFB_GL_SetSwapInterval(_THIS, int interval)
{
SDL_Unsupported();
return -1;
return SDL_Unsupported();
}
int

View file

@ -657,8 +657,7 @@ DirectFB_SetTexturePalette(SDL_Renderer * renderer,
palette->SetEntries(data->palette, entries, ncolors, firstcolor));
return 0;
} else {
SDL_SetError("YUV textures don't have a palette");
return -1;
return SDL_SetError("YUV textures don't have a palette");
}
error:
return -1;
@ -688,8 +687,7 @@ DirectFB_GetTexturePalette(SDL_Renderer * renderer,
}
return 0;
} else {
SDL_SetError("YUV textures don't have a palette");
return -1;
return SDL_SetError("YUV textures don't have a palette");
}
error:
return -1;
@ -718,9 +716,8 @@ DirectFB_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
case SDL_BLENDMODE_MOD:
return 0;
default:
SDL_Unsupported();
texture->blendMode = SDL_BLENDMODE_NONE;
return -1;
return SDL_Unsupported();
}
}
@ -735,9 +732,8 @@ DirectFB_SetDrawBlendMode(SDL_Renderer * renderer)
case SDL_BLENDMODE_MOD:
return 0;
default:
SDL_Unsupported();
renderer->blendMode = SDL_BLENDMODE_NONE;
return -1;
return SDL_Unsupported();
}
}
@ -762,10 +758,9 @@ DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
DSRO_SMOOTH_UPSCALE | DSRO_SMOOTH_DOWNSCALE | DSRO_ANTIALIAS;
break;
default:
SDL_Unsupported();
data->render_options = DSRO_NONE;
texture->scaleMode = SDL_SCALEMODE_NONE;
return -1;
return SDL_Unsupported();
}
#endif
return 0;

View file

@ -176,8 +176,7 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
int
DirectFB_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
{
SDL_Unsupported();
return -1;
return SDL_Unsupported();
}
void
@ -188,8 +187,9 @@ DirectFB_SetWindowTitle(_THIS, SDL_Window * window)
if (windata->is_managed) {
windata->wm_needs_redraw = 1;
DirectFB_WM_RedrawLayout(_this, window);
} else
} else {
SDL_Unsupported();
}
}
void