[Commits] SDL: Fixed bug 3992 - SDL_GetColorKey doesn't set error message

libsdl.org revision control commits-owner at libsdl.org
Tue Dec 12 16:37:28 PST 2017


details:   https://hg.libsdl.org/SDL/rev/cf9c6a79123f
changeset: 11772:cf9c6a79123f
user:      Sam Lantinga <slouken at libsdl.org>
date:      Tue Dec 12 16:37:23 2017 -0800
description:
Fixed bug 3992 - SDL_GetColorKey doesn't set error message

Luke A. Guest

SDL_GetColorKey does not set an error message on failure. The current source just returns -1.

The documentation https://wiki.libsdl.org/SDL_GetColorKey?highlight=%28%5CbCategoryAPI%5Cb%29%7C%28SDLFunctionTemplate%29 says to call SDL_GetError but that is useless in this case.

diffstat:

 src/video/SDL_surface.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (17 lines):

diff -r cb68160b3ace -r cf9c6a79123f src/video/SDL_surface.c
--- a/src/video/SDL_surface.c	Tue Dec 12 16:34:16 2017 -0800
+++ b/src/video/SDL_surface.c	Tue Dec 12 16:37:23 2017 -0800
@@ -296,11 +296,11 @@
 SDL_GetColorKey(SDL_Surface * surface, Uint32 * key)
 {
     if (!surface) {
-        return -1;
+        return SDL_InvalidParamError("surface");
     }
 
     if (!(surface->map->info.flags & SDL_COPY_COLORKEY)) {
-        return -1;
+        return SDL_SetError("Surface doesn't have a colorkey");
     }
 
     if (key) {


More information about the commits mailing list