Make SDL_SetError and friends unconditionally return -1.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 31 Mar 2013 12:48:50 -0400
changeset 7037 3fedf1f25b94
parent 7036 8c891504e325
child 7038 7f22b9ba218f
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.
include/SDL_error.h
src/SDL.c
src/SDL_error.c
src/audio/SDL_audiocvt.c
src/audio/SDL_wave.c
src/audio/directsound/SDL_directsound.c
src/audio/sun/SDL_sunaudio.c
src/core/android/SDL_android.cpp
src/core/windows/SDL_windows.c
src/core/windows/SDL_windows.h
src/events/SDL_events.c
src/events/SDL_gesture.c
src/events/SDL_mouse.c
src/events/SDL_touch.c
src/file/SDL_rwops.c
src/haptic/SDL_haptic.c
src/haptic/darwin/SDL_syshaptic.c
src/haptic/linux/SDL_syshaptic.c
src/haptic/windows/SDL_syshaptic.c
src/joystick/SDL_gamecontroller.c
src/joystick/SDL_joystick.c
src/joystick/android/SDL_androidjoystick.c
src/joystick/beos/SDL_bejoystick.cc
src/joystick/bsd/SDL_sysjoystick.c
src/joystick/darwin/SDL_sysjoystick.c
src/joystick/dummy/SDL_sysjoystick.c
src/joystick/iphoneos/SDL_sysjoystick.m
src/joystick/linux/SDL_sysjoystick.c
src/joystick/psp/SDL_sysjoystick.c
src/joystick/windows/SDL_dxjoystick.c
src/joystick/windows/SDL_mmjoystick.c
src/main/beos/SDL_BeApp.cc
src/render/SDL_render.c
src/render/SDL_yuv_sw.c
src/render/direct3d/SDL_render_d3d.c
src/render/opengl/SDL_render_gl.c
src/render/opengles/SDL_render_gles.c
src/render/opengles2/SDL_render_gles2.c
src/render/psp/SDL_render_psp.c
src/render/software/SDL_blendfillrect.c
src/render/software/SDL_blendline.c
src/render/software/SDL_blendpoint.c
src/render/software/SDL_drawline.c
src/render/software/SDL_drawpoint.c
src/render/software/SDL_render_sw.c
src/test/SDL_test_fuzzer.c
src/thread/beos/SDL_syssem.c
src/thread/beos/SDL_systhread.c
src/thread/generic/SDL_syscond.c
src/thread/generic/SDL_sysmutex.c
src/thread/generic/SDL_syssem.c
src/thread/generic/SDL_systhread.c
src/thread/psp/SDL_syscond.c
src/thread/psp/SDL_sysmutex.c
src/thread/psp/SDL_syssem.c
src/thread/psp/SDL_systhread.c
src/thread/pthread/SDL_syscond.c
src/thread/pthread/SDL_sysmutex.c
src/thread/pthread/SDL_syssem.c
src/thread/pthread/SDL_systhread.c
src/thread/windows/SDL_sysmutex.c
src/thread/windows/SDL_syssem.c
src/thread/windows/SDL_systhread.c
src/video/SDL_RLEaccel.c
src/video/SDL_blit.c
src/video/SDL_fillrect.c
src/video/SDL_pixels.c
src/video/SDL_stretch.c
src/video/SDL_surface.c
src/video/SDL_video.c
src/video/android/SDL_androidgl.c
src/video/android/SDL_androidwindow.c
src/video/bwindow/SDL_bframebuffer.cc
src/video/bwindow/SDL_bmodes.cc
src/video/cocoa/SDL_cocoamodes.m
src/video/cocoa/SDL_cocoamouse.m
src/video/cocoa/SDL_cocoaopengl.m
src/video/cocoa/SDL_cocoawindow.m
src/video/directfb/SDL_DirectFB_opengl.c
src/video/directfb/SDL_DirectFB_render.c
src/video/directfb/SDL_DirectFB_window.c
src/video/dummy/SDL_nullframebuffer.c
src/video/pandora/SDL_pandora.c
src/video/psp/SDL_pspgl.c
src/video/psp/SDL_pspvideo.c
src/video/uikit/SDL_uikitmodes.m
src/video/uikit/SDL_uikitopengles.m
src/video/uikit/SDL_uikitvideo.m
src/video/uikit/SDL_uikitwindow.m
src/video/windows/SDL_windowsclipboard.c
src/video/windows/SDL_windowsevents.c
src/video/windows/SDL_windowsframebuffer.c
src/video/windows/SDL_windowsmodes.c
src/video/windows/SDL_windowsmouse.c
src/video/windows/SDL_windowsopengl.c
src/video/windows/SDL_windowsvideo.c
src/video/windows/SDL_windowswindow.c
src/video/x11/SDL_x11clipboard.c
src/video/x11/SDL_x11framebuffer.c
src/video/x11/SDL_x11messagebox.c
src/video/x11/SDL_x11modes.c
src/video/x11/SDL_x11opengl.c
src/video/x11/SDL_x11opengles.c
src/video/x11/SDL_x11shape.c
src/video/x11/SDL_x11video.c
src/video/x11/SDL_x11window.c
--- a/include/SDL_error.h	Fri Mar 29 21:29:57 2013 -0400
+++ b/include/SDL_error.h	Sun Mar 31 12:48:50 2013 -0400
@@ -39,7 +39,8 @@
 #endif
 
 /* Public functions */
-extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
+/* SDL_SetError() unconditionally returns -1. */
+extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...);
 extern DECLSPEC const char *SDLCALL SDL_GetError(void);
 extern DECLSPEC void SDLCALL SDL_ClearError(void);
 
@@ -62,7 +63,8 @@
     SDL_UNSUPPORTED,
     SDL_LASTERROR
 } SDL_errorcode;
-extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
+/* SDL_Error() unconditionally returns -1. */
+extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
 /*@}*//*Internal error functions*/
 
 /* Ends C function definitions when using C++ */
--- a/src/SDL.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/SDL.c	Sun Mar 31 12:48:50 2013 -0400
@@ -109,8 +109,7 @@
         }
         SDL_PrivateSubsystemRefCountIncr(SDL_INIT_TIMER);
 #else
-        SDL_SetError("SDL not built with timer support");
-        return (-1);
+        return SDL_SetError("SDL not built with timer support");
 #endif
     }
 
@@ -124,8 +123,7 @@
         }
         SDL_PrivateSubsystemRefCountIncr(SDL_INIT_VIDEO);
 #else
-        SDL_SetError("SDL not built with video support");
-        return (-1);
+        return SDL_SetError("SDL not built with video support");
 #endif
     }
 
@@ -139,8 +137,7 @@
         }
         SDL_PrivateSubsystemRefCountIncr(SDL_INIT_AUDIO);
 #else
-        SDL_SetError("SDL not built with audio support");
-        return (-1);
+        return SDL_SetError("SDL not built with audio support");
 #endif
     }
 
@@ -159,8 +156,7 @@
         }
         SDL_PrivateSubsystemRefCountIncr(SDL_INIT_JOYSTICK);
 #else
-        SDL_SetError("SDL not built with joystick support");
-        return (-1);
+        return SDL_SetError("SDL not built with joystick support");
 #endif
     }
 
@@ -173,8 +169,7 @@
         }
         SDL_PrivateSubsystemRefCountIncr(SDL_INIT_GAMECONTROLLER);
 #else
-        SDL_SetError("SDL not built with joystick support");
-        return (-1);
+        return SDL_SetError("SDL not built with joystick support");
 #endif
     }
 
@@ -188,8 +183,7 @@
         }
         SDL_PrivateSubsystemRefCountIncr(SDL_INIT_HAPTIC);
 #else
-        SDL_SetError("SDL not built with haptic (force feedback) support");
-        return (-1);
+        return SDL_SetError("SDL not built with haptic (force feedback) support");
 #endif
     }
 
--- a/src/SDL_error.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/SDL_error.c	Sun Mar 31 12:48:50 2013 -0400
@@ -49,14 +49,14 @@
 
 /* Public functions */
 
-void
+int
 SDL_SetError(const char *fmt, ...)
 {
     va_list ap;
     SDL_error *error;
 
     /* Ignore call if invalid format pointer was passed */
-    if (fmt == NULL) return;
+    if (fmt == NULL) return -1;
     
     /* Copy in the key, mark error as valid */
     error = SDL_GetErrBuf();
@@ -112,6 +112,8 @@
 
     /* If we are in debug mode, print out an error message */
     SDL_LogError(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());
+
+    return -1;
 }
 
 /* This function has a bit more overhead than most error functions
@@ -216,28 +218,22 @@
 }
 
 /* Very common errors go here */
-void
+int
 SDL_Error(SDL_errorcode code)
 {
     switch (code) {
     case SDL_ENOMEM:
-        SDL_SetError("Out of memory");
-        break;
+        return SDL_SetError("Out of memory");
     case SDL_EFREAD:
-        SDL_SetError("Error reading from datastream");
-        break;
+        return SDL_SetError("Error reading from datastream");
     case SDL_EFWRITE:
-        SDL_SetError("Error writing to datastream");
-        break;
+        return SDL_SetError("Error writing to datastream");
     case SDL_EFSEEK:
-        SDL_SetError("Error seeking in datastream");
-        break;
+        return SDL_SetError("Error seeking in datastream");
     case SDL_UNSUPPORTED:
-        SDL_SetError("That operation is not supported");
-        break;
+        return SDL_SetError("That operation is not supported");
     default:
-        SDL_SetError("Unknown SDL error");
-        break;
+        return SDL_SetError("Unknown SDL error");
     }
 }
 
--- a/src/audio/SDL_audiocvt.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/audio/SDL_audiocvt.c	Sun Mar 31 12:48:50 2013 -0400
@@ -970,28 +970,23 @@
 
     /* Sanity check target pointer */
     if (cvt == NULL) {
-        SDL_InvalidParamError("cvt");
-        return -1;
+        return SDL_InvalidParamError("cvt");
     }
     
     /* there are no unsigned types over 16 bits, so catch this up front. */
     if ((SDL_AUDIO_BITSIZE(src_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(src_fmt))) {
-        SDL_SetError("Invalid source format");
-        return -1;
+        return SDL_SetError("Invalid source format");
     }
     if ((SDL_AUDIO_BITSIZE(dst_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(dst_fmt))) {
-        SDL_SetError("Invalid destination format");
-        return -1;
+        return SDL_SetError("Invalid destination format");
     }
 
     /* prevent possible divisions by zero, etc. */
     if ((src_channels == 0) || (dst_channels == 0)) {
-        SDL_SetError("Source or destination channels is zero");
-        return -1;
+        return SDL_SetError("Source or destination channels is zero");
     }
     if ((src_rate == 0) || (dst_rate == 0)) {
-        SDL_SetError("Source or destination rate is zero");
-        return -1;
+        return SDL_SetError("Source or destination rate is zero");
     }
 #ifdef DEBUG_CONVERT
     printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n",
--- a/src/audio/SDL_wave.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/audio/SDL_wave.c	Sun Mar 31 12:48:50 2013 -0400
@@ -134,8 +134,7 @@
         MS_ADPCM_state.wavefmt.channels * sizeof(Sint16);
     *audio_buf = (Uint8 *) SDL_malloc(*audio_len);
     if (*audio_buf == NULL) {
-        SDL_Error(SDL_ENOMEM);
-        return (-1);
+        return SDL_OutOfMemory();
     }
     decoded = *audio_buf;
 
@@ -359,8 +358,7 @@
         IMA_ADPCM_state.wavefmt.channels * sizeof(Sint16);
     *audio_buf = (Uint8 *) SDL_malloc(*audio_len);
     if (*audio_buf == NULL) {
-        SDL_Error(SDL_ENOMEM);
-        return (-1);
+        return SDL_OutOfMemory();
     }
     decoded = *audio_buf;
 
@@ -620,14 +618,12 @@
     chunk->length = SDL_ReadLE32(src);
     chunk->data = (Uint8 *) SDL_malloc(chunk->length);
     if (chunk->data == NULL) {
-        SDL_Error(SDL_ENOMEM);
-        return (-1);
+        return SDL_OutOfMemory();
     }
     if (SDL_RWread(src, chunk->data, chunk->length, 1) != 1) {
-        SDL_Error(SDL_EFREAD);
         SDL_free(chunk->data);
         chunk->data = NULL;
-        return (-1);
+        return SDL_Error(SDL_EFREAD);
     }
     return (chunk->length);
 }
--- a/src/audio/directsound/SDL_directsound.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/audio/directsound/SDL_directsound.c	Sun Mar 31 12:48:50 2013 -0400
@@ -95,7 +95,7 @@
                             (SDL_wcslen(S)+1)*sizeof(WCHAR));
 }
 
-static void
+static int
 SetDSerror(const char *function, int code)
 {
     static const char *error;
@@ -145,8 +145,7 @@
         SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function,
                      error);
     }
-    SDL_SetError("%s", errbuf);
-    return;
+    return SDL_SetError("%s", errbuf);
 }
 
 
@@ -380,16 +379,14 @@
     format.dwBufferBytes = numchunks * chunksize;
     if ((format.dwBufferBytes < DSBSIZE_MIN) ||
         (format.dwBufferBytes > DSBSIZE_MAX)) {
-        SDL_SetError("Sound buffer size must be between %d and %d",
-                     DSBSIZE_MIN / numchunks, DSBSIZE_MAX / numchunks);
-        return (-1);
+        return SDL_SetError("Sound buffer size must be between %d and %d",
+                            DSBSIZE_MIN / numchunks, DSBSIZE_MAX / numchunks);
     }
     format.dwReserved = 0;
     format.lpwfxFormat = wavefmt;
     result = IDirectSound_CreateSoundBuffer(sndObj, &format, sndbuf, NULL);
     if (result != DS_OK) {
-        SetDSerror("DirectSound CreateSoundBuffer", result);
-        return (-1);
+        return SetDSerror("DirectSound CreateSoundBuffer", result);
     }
     IDirectSoundBuffer_SetFormat(*sndbuf, wavefmt);
 
--- a/src/audio/sun/SDL_sunaudio.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/audio/sun/SDL_sunaudio.c	Sun Mar 31 12:48:50 2013 -0400
@@ -332,8 +332,7 @@
         this->hidden->frequency = 8;
         this->hidden->ulaw_buf = (Uint8 *) SDL_malloc(this->hidden->fragsize);
         if (this->hidden->ulaw_buf == NULL) {
-            SDL_OutOfMemory();
-            return (-1);
+            return SDL_OutOfMemory();
         }
         this->spec.channels = 1;
     } else {
@@ -353,8 +352,7 @@
     /* Allocate mixing buffer */
     this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->spec.size);
     if (this->hidden->mixbuf == NULL) {
-        SDL_OutOfMemory();
-        return (-1);
+        return SDL_OutOfMemory();
     }
     SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
 
--- a/src/core/android/SDL_android.cpp	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/core/android/SDL_android.cpp	Sun Mar 31 12:48:50 2013 -0400
@@ -811,8 +811,7 @@
     JNIEnv *mEnv = Android_JNI_GetEnv();
 
     if (!refs.init(mEnv)) {
-        SDL_SetError("Failed to allocate enough JVM local references");
-        return -1;
+        return SDL_SetError("Failed to allocate enough JVM local references");
     }
 
     if (ctx) {
@@ -875,8 +874,7 @@
                 offset = ctx->hidden.androidio.offset + ctx->hidden.androidio.size + offset;
                 break;
             default:
-                SDL_SetError("Unknown value for 'whence'");
-                return -1;
+                return SDL_SetError("Unknown value for 'whence'");
         }
         whence = SEEK_SET;
 
@@ -897,14 +895,12 @@
                 newPosition = ctx->hidden.androidio.size + offset;
                 break;
             default:
-                SDL_SetError("Unknown value for 'whence'");
-                return -1;
+                return SDL_SetError("Unknown value for 'whence'");
         }
 
         /* Validate the new position */
         if (newPosition < 0) {
-            SDL_Error(SDL_EFSEEK);
-            return -1;
+            return SDL_Error(SDL_EFSEEK);
         }
         if (newPosition > ctx->hidden.androidio.size) {
             newPosition = ctx->hidden.androidio.size;
--- a/src/core/windows/SDL_windows.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/core/windows/SDL_windows.c	Sun Mar 31 12:48:50 2013 -0400
@@ -29,7 +29,7 @@
 #include <objbase.h>  /* for CoInitialize/CoUninitialize */
 
 /* Sets an error message based on GetLastError() */
-void
+int
 WIN_SetError(const char *prefix)
 {
     TCHAR buffer[1024];
@@ -39,6 +39,7 @@
     message = WIN_StringToUTF8(buffer);
     SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
     SDL_free(message);
+    return -1;
 }
 
 HRESULT
--- a/src/core/windows/SDL_windows.h	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/core/windows/SDL_windows.h	Sun Mar 31 12:48:50 2013 -0400
@@ -43,8 +43,8 @@
 #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)(S), SDL_strlen(S)+1)
 #endif
 
-/* Sets an error message based on GetLastError() */
-extern void WIN_SetError(const char *prefix);
+/* Sets an error message based on GetLastError(). Always return -1. */
+extern int WIN_SetError(const char *prefix);
 
 /* Wrap up the oddities of CoInitialize() into a common function. */
 extern HRESULT WIN_CoInitialize(void);
--- a/src/events/SDL_events.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/events/SDL_events.c	Sun Mar 31 12:48:50 2013 -0400
@@ -244,8 +244,7 @@
         }
         SDL_UnlockMutex(SDL_EventQ.lock);
     } else {
-        SDL_SetError("Couldn't lock event queue");
-        used = -1;
+        return SDL_SetError("Couldn't lock event queue");
     }
     return (used);
 }
--- a/src/events/SDL_gesture.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/events/SDL_gesture.c	Sun Mar 31 12:48:50 2013 -0400
@@ -158,8 +158,7 @@
             }
         }
     }
-    SDL_SetError("Unknown gestureId");
-    return -1;
+    return SDL_SetError("Unknown gestureId");
 }
 
 //path is an already sampled set of points
@@ -176,8 +175,7 @@
                                           (index + 1) *
                                           sizeof(SDL_DollarTemplate));
     if (!dollarTemplate) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     inTouch->dollarTemplate = dollarTemplate;
 
@@ -419,8 +417,7 @@
                                                                      sizeof(SDL_GestureTouch));
 
     if (!gestureTouch) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     SDL_gestureTouch = gestureTouch;
--- a/src/events/SDL_mouse.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/events/SDL_mouse.c	Sun Mar 31 12:48:50 2013 -0400
@@ -413,8 +413,7 @@
     }
 
     if (!mouse->SetRelativeMouseMode) {
-        SDL_Unsupported();
-        return -1;
+        return SDL_Unsupported();
     }
 
     if (mouse->SetRelativeMouseMode(enabled) < 0) {
--- a/src/events/SDL_touch.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/events/SDL_touch.c	Sun Mar 31 12:48:50 2013 -0400
@@ -141,8 +141,7 @@
     touchDevices = (SDL_Touch **) SDL_realloc(SDL_touchDevices,
                                       (SDL_num_touch + 1) * sizeof(*touchDevices));
     if (!touchDevices) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     SDL_touchDevices = touchDevices;
@@ -150,8 +149,7 @@
 
     SDL_touchDevices[index] = (SDL_Touch *) SDL_malloc(sizeof(*SDL_touchDevices[index]));
     if (!SDL_touchDevices[index]) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     /* we're setting the touch properties */
@@ -176,14 +174,12 @@
         SDL_Finger **new_fingers;
         new_fingers = (SDL_Finger **)SDL_realloc(touch->fingers, (touch->max_fingers+1)*sizeof(*touch->fingers));
         if (!new_fingers) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         touch->fingers = new_fingers;
         touch->fingers[touch->max_fingers] = (SDL_Finger *)SDL_malloc(sizeof(*finger));
         if (!touch->fingers[touch->max_fingers]) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         touch->max_fingers++;
     }
--- a/src/file/SDL_rwops.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/file/SDL_rwops.c	Sun Mar 31 12:48:50 2013 -0400
@@ -87,8 +87,7 @@
     context->hidden.windowsio.buffer.data =
         (char *) SDL_malloc(READAHEAD_BUFFER_SIZE);
     if (!context->hidden.windowsio.buffer.data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     /* Do not open a dialog box if failure */
     old_error_mode =
@@ -124,13 +123,11 @@
     LARGE_INTEGER size;
 
     if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) {
-        SDL_SetError("windows_file_size: invalid context/file not opened");
-        return -1;
+        return SDL_SetError("windows_file_size: invalid context/file not opened");
     }
 
     if (!GetFileSizeEx(context->hidden.windowsio.h, &size)) {
-        WIN_SetError("windows_file_size");
-        return -1;
+        return WIN_SetError("windows_file_size");
     }
 
     return size.QuadPart;
@@ -143,8 +140,7 @@
     LARGE_INTEGER windowsoffset;
 
     if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) {
-        SDL_SetError("windows_file_seek: invalid context/file not opened");
-        return -1;
+        return SDL_SetError("windows_file_seek: invalid context/file not opened");
     }
 
     /* FIXME: We may be able to satisfy the seek within buffered data */
@@ -164,14 +160,12 @@
         windowswhence = FILE_END;
         break;
     default:
-        SDL_SetError("windows_file_seek: Unknown value for 'whence'");
-        return -1;
+        return SDL_SetError("windows_file_seek: Unknown value for 'whence'");
     }
 
     windowsoffset.QuadPart = offset;
     if (!SetFilePointerEx(context->hidden.windowsio.h, windowsoffset, &windowsoffset, windowswhence)) {
-        WIN_SetError("windows_file_seek");
-        return -1;
+        return WIN_SetError("windows_file_seek");
     }
     return windowsoffset.QuadPart;
 }
@@ -325,8 +319,7 @@
         return (ftell(context->hidden.stdio.fp));
     }
 #endif
-    SDL_Error(SDL_EFSEEK);
-    return (-1);
+    return SDL_Error(SDL_EFSEEK);
 }
 
 static size_t SDLCALL
@@ -361,8 +354,7 @@
         if (context->hidden.stdio.autoclose) {
             /* WARNING:  Check the return value here! */
             if (fclose(context->hidden.stdio.fp) != 0) {
-                SDL_Error(SDL_EFWRITE);
-                status = -1;
+                status = SDL_Error(SDL_EFWRITE);
             }
         }
         SDL_FreeRW(context);
@@ -395,8 +387,7 @@
         newpos = context->hidden.mem.stop + offset;
         break;
     default:
-        SDL_SetError("Unknown value for 'whence'");
-        return (-1);
+        return SDL_SetError("Unknown value for 'whence'");
     }
     if (newpos < context->hidden.mem.base) {
         newpos = context->hidden.mem.base;
--- a/src/haptic/SDL_haptic.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/haptic/SDL_haptic.c	Sun Mar 31 12:48:50 2013 -0400
@@ -447,8 +447,7 @@
 
     /* Check to see if effect is supported */
     if (SDL_HapticEffectSupported(haptic, effect) == SDL_FALSE) {
-        SDL_SetError("Haptic: Effect not supported by haptic device.");
-        return -1;
+        return SDL_SetError("Haptic: Effect not supported by haptic device.");
     }
 
     /* See if there's a free slot */
@@ -467,8 +466,7 @@
         }
     }
 
-    SDL_SetError("Haptic: Device has no free space left.");
-    return -1;
+    return SDL_SetError("Haptic: Device has no free space left.");
 }
 
 /*
@@ -497,8 +495,7 @@
 
     /* Can't change type dynamically. */
     if (data->type != haptic->effects[effect].effect.type) {
-        SDL_SetError("Haptic: Updating effect type is illegal.");
-        return -1;
+        return SDL_SetError("Haptic: Updating effect type is illegal.");
     }
 
     /* Updates the effect */
@@ -579,8 +576,7 @@
     }
 
     if ((haptic->supported & SDL_HAPTIC_STATUS) == 0) {
-        SDL_SetError("Haptic: Device does not support status queries.");
-        return -1;
+        return SDL_SetError("Haptic: Device does not support status queries.");
     }
 
     return SDL_SYS_HapticGetEffectStatus(haptic, &haptic->effects[effect]);
@@ -600,13 +596,11 @@
     }
 
     if ((haptic->supported & SDL_HAPTIC_GAIN) == 0) {
-        SDL_SetError("Haptic: Device does not support setting gain.");
-        return -1;
+        return SDL_SetError("Haptic: Device does not support setting gain.");
     }
 
     if ((gain < 0) || (gain > 100)) {
-        SDL_SetError("Haptic: Gain must be between 0 and 100.");
-        return -1;
+        return SDL_SetError("Haptic: Gain must be between 0 and 100.");
     }
 
     /* We use the envvar to get the maximum gain. */
@@ -644,13 +638,11 @@
     }
 
     if ((haptic->supported & SDL_HAPTIC_AUTOCENTER) == 0) {
-        SDL_SetError("Haptic: Device does not support setting autocenter.");
-        return -1;
+        return SDL_SetError("Haptic: Device does not support setting autocenter.");
     }
 
     if ((autocenter < 0) || (autocenter > 100)) {
-        SDL_SetError("Haptic: Autocenter must be between 0 and 100.");
-        return -1;
+        return SDL_SetError("Haptic: Autocenter must be between 0 and 100.");
     }
 
     if (SDL_SYS_HapticSetAutocenter(haptic, autocenter) < 0) {
@@ -671,8 +663,7 @@
     }
 
     if ((haptic->supported & SDL_HAPTIC_PAUSE) == 0) {
-        SDL_SetError("Haptic: Device does not support setting pausing.");
-        return -1;
+        return SDL_SetError("Haptic: Device does not support setting pausing.");
     }
 
     return SDL_SYS_HapticPause(haptic);
@@ -773,8 +764,7 @@
     }
 
     if (haptic->rumble_id < 0) {
-        SDL_SetError("Haptic: Rumble effect not initialized on haptic device");
-        return -1;
+        return SDL_SetError("Haptic: Rumble effect not initialized on haptic device");
     }
 
     /* Clamp strength. */
@@ -805,8 +795,7 @@
     }
 
     if (haptic->rumble_id < 0) {
-        SDL_SetError("Haptic: Rumble effect not initialized on haptic device");
-        return -1;
+        return SDL_SetError("Haptic: Rumble effect not initialized on haptic device");
     }
 
     return SDL_HapticStopEffect(haptic, haptic->rumble_id);
--- a/src/haptic/darwin/SDL_syshaptic.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/haptic/darwin/SDL_syshaptic.c	Sun Mar 31 12:48:50 2013 -0400
@@ -160,15 +160,13 @@
     /* Get HID devices. */
     match = IOServiceMatching(kIOHIDDeviceKey);
     if (match == NULL) {
-        SDL_SetError("Haptic: Failed to get IOServiceMatching.");
-        return -1;
+        return SDL_SetError("Haptic: Failed to get IOServiceMatching.");
     }
 
     /* Now search I/O Registry for matching devices. */
     result = IOServiceGetMatchingServices(kIOMasterPortDefault, match, &iter);
     if (result != kIOReturnSuccess) {
-        SDL_SetError("Haptic: Couldn't create a HID object iterator.");
-        return -1;
+        return SDL_SetError("Haptic: Couldn't create a HID object iterator.");
     }
     /* IOServiceGetMatchingServices consumes dictionary. */
 
@@ -257,8 +255,7 @@
     ret = IORegistryEntryCreateCFProperties(dev, &hidProperties,
                                             kCFAllocatorDefault, kNilOptions);
     if ((ret != KERN_SUCCESS) || !hidProperties) {
-        SDL_SetError("Haptic: Unable to create CFProperties.");
-        return -1;
+        return SDL_SetError("Haptic: Unable to create CFProperties.");
     }
 
     /* Mac OS X currently is not mirroring all USB properties to HID page so need to look at USB device page also
@@ -289,17 +286,15 @@
             if (refCF) {
                 if (!CFStringGetCString(refCF, name, 256,
                                         CFStringGetSystemEncoding())) {
-                    SDL_SetError
+                    return SDL_SetError
                         ("Haptic: CFStringGetCString error retrieving pDevice->product.");
-                    return -1;
                 }
             }
 
             CFRelease(usbProperties);
         } else {
-            SDL_SetError
+            return SDL_SetError
                 ("Haptic: IORegistryEntryCreateCFProperties failed to create usbProperties.");
-            return -1;
         }
 
         /* Release stuff. */
@@ -310,8 +305,7 @@
             SDL_SetError("Haptic: IOObjectRelease error with parent1.");
         }
     } else {
-        SDL_SetError("Haptic: Error getting registry entries.");
-        return -1;
+        return SDL_SetError("Haptic: Error getting registry entries.");
     }
 
     return 0;
@@ -336,8 +330,7 @@
 
     ret = FFDeviceGetForceFeedbackCapabilities(device, &features);
     if (ret != FF_OK) {
-        SDL_SetError("Haptic: Unable to get device's supported features.");
-        return -1;
+        return SDL_SetError("Haptic: Unable to get device's supported features.");
     }
 
     supported = 0;
@@ -366,9 +359,8 @@
     if (ret == FF_OK)
         supported |= SDL_HAPTIC_GAIN;
     else if (ret != FFERR_UNSUPPORTED) {
-        SDL_SetError("Haptic: Unable to get if device supports gain: %s.",
-                     FFStrError(ret));
-        return -1;
+        return SDL_SetError("Haptic: Unable to get if device supports gain: %s.",
+                            FFStrError(ret));
     }
 
     /* Checks if supports autocenter. */
@@ -377,10 +369,9 @@
     if (ret == FF_OK)
         supported |= SDL_HAPTIC_AUTOCENTER;
     else if (ret != FFERR_UNSUPPORTED) {
-        SDL_SetError
+        return SDL_SetError
             ("Haptic: Unable to get if device supports autocenter: %s.",
              FFStrError(ret));
-        return -1;
     }
 
     /* Check for axes, we have an artificial limit on axes */
@@ -625,8 +616,7 @@
     /* Has axes. */
     rglDir = SDL_malloc(sizeof(LONG) * naxes);
     if (rglDir == NULL) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     SDL_memset(rglDir, 0, sizeof(LONG) * naxes);
     effect->rglDirection = rglDir;
@@ -654,8 +644,7 @@
         return 0;
 
     default:
-        SDL_SetError("Haptic: Unknown direction type.");
-        return -1;
+        return SDL_SetError("Haptic: Unknown direction type.");
     }
 }
 
@@ -695,8 +684,7 @@
     /* Envelope. */
     envelope = SDL_malloc(sizeof(FFENVELOPE));
     if (envelope == NULL) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     SDL_memset(envelope, 0, sizeof(FFENVELOPE));
     dest->lpEnvelope = envelope;
@@ -707,8 +695,7 @@
     if (dest->cAxes > 0) {
         axes = SDL_malloc(sizeof(DWORD) * dest->cAxes);
         if (axes == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         axes[0] = haptic->hwdata->axes[0];      /* Always at least one axis. */
         if (dest->cAxes > 1) {
@@ -727,8 +714,7 @@
         hap_constant = &src->constant;
         constant = SDL_malloc(sizeof(FFCONSTANTFORCE));
         if (constant == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_memset(constant, 0, sizeof(FFCONSTANTFORCE));
 
@@ -771,8 +757,7 @@
         hap_periodic = &src->periodic;
         periodic = SDL_malloc(sizeof(FFPERIODIC));
         if (periodic == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_memset(periodic, 0, sizeof(FFPERIODIC));
 
@@ -817,8 +802,7 @@
         hap_condition = &src->condition;
         condition = SDL_malloc(sizeof(FFCONDITION) * dest->cAxes);
         if (condition == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_memset(condition, 0, sizeof(FFCONDITION));
 
@@ -860,8 +844,7 @@
         hap_ramp = &src->ramp;
         ramp = SDL_malloc(sizeof(FFRAMPFORCE));
         if (ramp == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_memset(ramp, 0, sizeof(FFRAMPFORCE));
 
@@ -899,8 +882,7 @@
         hap_custom = &src->custom;
         custom = SDL_malloc(sizeof(FFCUSTOMFORCE));
         if (custom == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_memset(custom, 0, sizeof(FFCUSTOMFORCE));
 
@@ -944,8 +926,7 @@
 
 
     default:
-        SDL_SetError("Haptic: Unknown effect type.");
-        return -1;
+        return SDL_SetError("Haptic: Unknown effect type.");
     }
 
     return 0;
@@ -1150,9 +1131,8 @@
     /* Run the effect. */
     ret = FFEffectStart(effect->hweffect->ref, iter, 0);
     if (ret != FF_OK) {
-        SDL_SetError("Haptic: Unable to run the effect: %s.",
-                     FFStrError(ret));
-        return -1;
+        return SDL_SetError("Haptic: Unable to run the effect: %s.",
+                            FFStrError(ret));
     }
 
     return 0;
@@ -1169,9 +1149,8 @@
 
     ret = FFEffectStop(effect->hweffect->ref);
     if (ret != FF_OK) {
-        SDL_SetError("Haptic: Unable to stop the effect: %s.",
-                     FFStrError(ret));
-        return -1;
+        return SDL_SetError("Haptic: Unable to stop the effect: %s.",
+                            FFStrError(ret));
     }
 
     return 0;
@@ -1236,8 +1215,7 @@
         FFDeviceSetForceFeedbackProperty(haptic->hwdata->device,
                                          FFPROP_FFGAIN, &val);
     if (ret != FF_OK) {
-        SDL_SetError("Haptic: Error setting gain: %s.", FFStrError(ret));
-        return -1;
+        return SDL_SetError("Haptic: Error setting gain: %s.", FFStrError(ret));
     }
 
     return 0;
@@ -1262,9 +1240,8 @@
     ret = FFDeviceSetForceFeedbackProperty(haptic->hwdata->device,
                                            FFPROP_AUTOCENTER, &val);
     if (ret != FF_OK) {
-        SDL_SetError("Haptic: Error setting autocenter: %s.",
-                     FFStrError(ret));
-        return -1;
+        return SDL_SetError("Haptic: Error setting autocenter: %s.",
+                            FFStrError(ret));
     }
 
     return 0;
@@ -1282,8 +1259,7 @@
     ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
                                            FFSFFC_PAUSE);
     if (ret != FF_OK) {
-        SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret));
-        return -1;
+        return SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret));
     }
 
     return 0;
@@ -1301,8 +1277,7 @@
     ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
                                            FFSFFC_CONTINUE);
     if (ret != FF_OK) {
-        SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret));
-        return -1;
+        return SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret));
     }
 
     return 0;
@@ -1320,8 +1295,7 @@
     ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
                                            FFSFFC_STOPALL);
     if (ret != FF_OK) {
-        SDL_SetError("Haptic: Error stopping device: %s.", FFStrError(ret));
-        return -1;
+        return SDL_SetError("Haptic: Error stopping device: %s.", FFStrError(ret));
     }
 
     return 0;
--- a/src/haptic/linux/SDL_syshaptic.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/haptic/linux/SDL_syshaptic.c	Sun Mar 31 12:48:50 2013 -0400
@@ -92,9 +92,8 @@
     /* Ask device for what it has. */
     ret = 0;
     if (ioctl(fd, EVIOCGBIT(EV_FF, sizeof(features)), features) < 0) {
-        SDL_SetError("Haptic: Unable to get device's features: %s",
-                     strerror(errno));
-        return -1;
+        return SDL_SetError("Haptic: Unable to get device's features: %s",
+                            strerror(errno));
     }
 
     /* Convert supported features to SDL_HAPTIC platform-neutral features. */
@@ -309,9 +308,8 @@
     /* Open the character device */
     fd = open(SDL_hapticlist[haptic->index].fname, O_RDWR, 0);
     if (fd < 0) {
-        SDL_SetError("Haptic: Unable to open %s: %s",
-                     SDL_hapticlist[haptic->index], strerror(errno));
-        return -1;
+        return SDL_SetError("Haptic: Unable to open %s: %s",
+                            SDL_hapticlist[haptic->index], strerror(errno));
     }
 
     /* Try to create the haptic. */
@@ -340,9 +338,8 @@
         /* Open the device. */
         fd = open(SDL_hapticlist[i].fname, O_RDWR, 0);
         if (fd < 0) {
-            SDL_SetError("Haptic: Unable to open %s: %s",
-                         SDL_hapticlist[i], strerror(errno));
-            return -1;
+            return SDL_SetError("Haptic: Unable to open %s: %s",
+                                SDL_hapticlist[i], strerror(errno));
         }
 
         /* Is it a mouse? */
@@ -405,15 +402,13 @@
         }
     }
     if (i >= MAX_HAPTICS) {
-        SDL_SetError("Haptic: Joystick doesn't have Haptic capabilities");
-        return -1;
+        return SDL_SetError("Haptic: Joystick doesn't have Haptic capabilities");
     }
 
     fd = open(joystick->hwdata->fname, O_RDWR, 0);
     if (fd < 0) {
-        SDL_SetError("Haptic: Unable to open %s: %s",
-                     joystick->hwdata->fname, strerror(errno));
-        return -1;
+        return SDL_SetError("Haptic: Unable to open %s: %s",
+                            joystick->hwdata->fname, strerror(errno));
     }
     ret = SDL_SYS_HapticOpenFromFD(haptic, fd); /* Already closes on error. */
     if (ret < 0) {
@@ -544,8 +539,7 @@
         return (Uint16) tmp;
 
     default:
-        SDL_SetError("Haptic: Unsupported direction type.");
-        return (Uint16) - 1;
+        return (Uint16) SDL_SetError("Haptic: Unsupported direction type.");
     }
 
     return 0;
@@ -733,8 +727,7 @@
 
 
     default:
-        SDL_SetError("Haptic: Unknown effect type.");
-        return -1;
+        return SDL_SetError("Haptic: Unknown effect type.");
     }
 
     return 0;
@@ -754,8 +747,7 @@
     effect->hweffect = (struct haptic_hweffect *)
         SDL_malloc(sizeof(struct haptic_hweffect));
     if (effect->hweffect == NULL) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     /* Prepare the ff_effect */
@@ -802,9 +794,8 @@
 
     /* See if it can be uploaded. */
     if (ioctl(haptic->hwdata->fd, EVIOCSFF, &linux_effect) < 0) {
-        SDL_SetError("Haptic: Error updating the effect: %s",
-                     strerror(errno));
-        return -1;
+        return SDL_SetError("Haptic: Error updating the effect: %s",
+                            strerror(errno));
     }
 
     /* Copy the new effect into memory. */
@@ -831,8 +822,7 @@
     run.value = (iterations > INT_MAX) ? INT_MAX : iterations;
 
     if (write(haptic->hwdata->fd, (const void *) &run, sizeof(run)) < 0) {
-        SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno));
-        return -1;
+        return SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno));
     }
 
     return 0;
@@ -852,9 +842,8 @@
     stop.value = 0;
 
     if (write(haptic->hwdata->fd, (const void *) &stop, sizeof(stop)) < 0) {
-        SDL_SetError("Haptic: Unable to stop the effect: %s",
-                     strerror(errno));
-        return -1;
+        return SDL_SetError("Haptic: Unable to stop the effect: %s",
+                            strerror(errno));
     }
 
     return 0;
@@ -891,8 +880,7 @@
     ie.code = effect->hweffect->effect.id;
 
     if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
-        SDL_SetError("Haptic: Error getting device status.");
-        return -1;
+        return SDL_SetError("Haptic: Error getting device status.");
     }
 
     return 0;
@@ -915,8 +903,7 @@
     ie.value = (0xFFFFUL * gain) / 100;
 
     if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
-        SDL_SetError("Haptic: Error setting gain: %s", strerror(errno));
-        return -1;
+        return SDL_SetError("Haptic: Error setting gain: %s", strerror(errno));
     }
 
     return 0;
@@ -936,8 +923,7 @@
     ie.value = (0xFFFFUL * autocenter) / 100;
 
     if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
-        SDL_SetError("Haptic: Error setting autocenter: %s", strerror(errno));
-        return -1;
+        return SDL_SetError("Haptic: Error setting autocenter: %s", strerror(errno));
     }
 
     return 0;
@@ -977,9 +963,8 @@
         if (haptic->effects[i].hweffect != NULL) {
             ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
             if (ret < 0) {
-                SDL_SetError
+                return SDL_SetError
                     ("Haptic: Error while trying to stop all playing effects.");
-                return -1;
             }
         }
     }
--- a/src/haptic/windows/SDL_syshaptic.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/haptic/windows/SDL_syshaptic.c	Sun Mar 31 12:48:50 2013 -0400
@@ -87,7 +87,7 @@
 /*
  * Prototypes.
  */
-static void DI_SetError(const char *str, HRESULT err);
+static int DI_SetError(const char *str, HRESULT err);
 static int DI_GUIDIsSame(const GUID * a, const GUID * b);
 static int SDL_SYS_HapticOpenFromInstance(SDL_Haptic * haptic,
                                           DIDEVICEINSTANCE instance);
@@ -110,14 +110,14 @@
 /* 
  * Like SDL_SetError but for DX error codes.
  */
-static void
+static int
 DI_SetError(const char *str, HRESULT err)
 {
     /*
        SDL_SetError("Haptic: %s - %s: %s", str,
        DXGetErrorString8A(err), DXGetErrorDescription8A(err));
      */
-    SDL_SetError("Haptic error %s", str);
+    return SDL_SetError("Haptic error %s", str);
 }
 
 
@@ -142,8 +142,7 @@
     HINSTANCE instance;
 
     if (dinput != NULL) {       /* Already open. */
-        SDL_SetError("Haptic: SubSystem already open.");
-        return -1;
+        return SDL_SetError("Haptic: SubSystem already open.");
     }
 
     /* Clear all the memory. */
@@ -153,8 +152,7 @@
 
     ret = WIN_CoInitialize();
     if (FAILED(ret)) {
-        DI_SetError("Coinitialize", ret);
-        return -1;
+        return DI_SetError("Coinitialize", ret);
     }
 
     coinitialized = SDL_TRUE;
@@ -163,23 +161,20 @@
                            &IID_IDirectInput8, (LPVOID) & dinput);
     if (FAILED(ret)) {
         SDL_SYS_HapticQuit();
-        DI_SetError("CoCreateInstance", ret);
-        return -1;
+        return DI_SetError("CoCreateInstance", ret);
     }
 
     /* Because we used CoCreateInstance, we need to Initialize it, first. */
     instance = GetModuleHandle(NULL);
     if (instance == NULL) {
         SDL_SYS_HapticQuit();
-        SDL_SetError("GetModuleHandle() failed with error code %d.",
-                     GetLastError());
-        return -1;
+        return SDL_SetError("GetModuleHandle() failed with error code %d.",
+                            GetLastError());
     }
     ret = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION);
     if (FAILED(ret)) {
         SDL_SYS_HapticQuit();
-        DI_SetError("Initializing DirectInput device", ret);
-        return -1;
+        return DI_SetError("Initializing DirectInput device", ret);
     }
 
     /* Look for haptic devices. */
@@ -191,8 +186,7 @@
                                    DIEDFL_ATTACHEDONLY);
     if (FAILED(ret)) {
         SDL_SYS_HapticQuit();
-        DI_SetError("Enumerating DirectInput devices", ret);
-        return -1;
+        return DI_SetError("Enumerating DirectInput devices", ret);
     }
 
     if (!env || SDL_atoi(env)) {
@@ -411,8 +405,7 @@
     haptic->effects = (struct haptic_effect *)
         SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
     if (haptic->effects == NULL) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     /* Clear the memory */
     SDL_memset(haptic->effects, 0,
@@ -422,8 +415,7 @@
     if (haptic->hwdata == NULL) {
         SDL_free(haptic->effects);
         haptic->effects = NULL;
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata));
 
@@ -690,8 +682,7 @@
     haptic->hwdata = (struct haptic_hwdata *)
         SDL_malloc(sizeof(*haptic->hwdata));
     if (haptic->hwdata == NULL) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata));
 
@@ -809,8 +800,7 @@
     /* Has axes. */
     rglDir = SDL_malloc(sizeof(LONG) * naxes);
     if (rglDir == NULL) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     SDL_memset(rglDir, 0, sizeof(LONG) * naxes);
     effect->rglDirection = rglDir;
@@ -838,8 +828,7 @@
         return 0;
 
     default:
-        SDL_SetError("Haptic: Unknown direction type.");
-        return -1;
+        return SDL_SetError("Haptic: Unknown direction type.");
     }
 }
 
@@ -875,8 +864,7 @@
     /* Envelope. */
     envelope = SDL_malloc(sizeof(DIENVELOPE));
     if (envelope == NULL) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     SDL_memset(envelope, 0, sizeof(DIENVELOPE));
     dest->lpEnvelope = envelope;
@@ -887,8 +875,7 @@
     if (dest->cAxes > 0) {
         axes = SDL_malloc(sizeof(DWORD) * dest->cAxes);
         if (axes == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         axes[0] = haptic->hwdata->axes[0];      /* Always at least one axis. */
         if (dest->cAxes > 1) {
@@ -907,8 +894,7 @@
         hap_constant = &src->constant;
         constant = SDL_malloc(sizeof(DICONSTANTFORCE));
         if (constant == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_memset(constant, 0, sizeof(DICONSTANTFORCE));
 
@@ -951,8 +937,7 @@
         hap_periodic = &src->periodic;
         periodic = SDL_malloc(sizeof(DIPERIODIC));
         if (periodic == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_memset(periodic, 0, sizeof(DIPERIODIC));
 
@@ -997,8 +982,7 @@
         hap_condition = &src->condition;
         condition = SDL_malloc(sizeof(DICONDITION) * dest->cAxes);
         if (condition == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_memset(condition, 0, sizeof(DICONDITION));
 
@@ -1040,8 +1024,7 @@
         hap_ramp = &src->ramp;
         ramp = SDL_malloc(sizeof(DIRAMPFORCE));
         if (ramp == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_memset(ramp, 0, sizeof(DIRAMPFORCE));
 
@@ -1079,8 +1062,7 @@
         hap_custom = &src->custom;
         custom = SDL_malloc(sizeof(DICUSTOMFORCE));
         if (custom == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_memset(custom, 0, sizeof(DICUSTOMFORCE));
 
@@ -1124,8 +1106,7 @@
 
 
     default:
-        SDL_SetError("Haptic: Unknown effect type.");
-        return -1;
+        return SDL_SetError("Haptic: Unknown effect type.");
     }
 
     return 0;
@@ -1358,8 +1339,7 @@
     /* Run the effect. */
     ret = IDirectInputEffect_Start(effect->hweffect->ref, iter, 0);
     if (FAILED(ret)) {
-        DI_SetError("Running the effect", ret);
-        return -1;
+        return DI_SetError("Running the effect", ret);
     }
 
     return 0;
@@ -1381,8 +1361,7 @@
 
     ret = IDirectInputEffect_Stop(effect->hweffect->ref);
     if (FAILED(ret)) {
-        DI_SetError("Unable to stop effect", ret);
-        return -1;
+        return DI_SetError("Unable to stop effect", ret);
     }
 
     return 0;
@@ -1424,8 +1403,7 @@
 
     ret = IDirectInputEffect_GetEffectStatus(effect->hweffect->ref, &status);
     if (FAILED(ret)) {
-        DI_SetError("Getting effect status", ret);
-        return -1;
+        return DI_SetError("Getting effect status", ret);
     }
 
     if (status == 0)
@@ -1454,8 +1432,7 @@
     ret = IDirectInputDevice8_SetProperty(haptic->hwdata->device,
                                           DIPROP_FFGAIN, &dipdw.diph);
     if (FAILED(ret)) {
-        DI_SetError("Setting gain", ret);
-        return -1;
+        return DI_SetError("Setting gain", ret);
     }
 
     return 0;
@@ -1483,8 +1460,7 @@
     ret = IDirectInputDevice8_SetProperty(haptic->hwdata->device,
                                           DIPROP_AUTOCENTER, &dipdw.diph);
     if (FAILED(ret)) {
-        DI_SetError("Setting autocenter", ret);
-        return -1;
+        return DI_SetError("Setting autocenter", ret);
     }
 
     return 0;
@@ -1503,8 +1479,7 @@
     ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device,
                                                        DISFFC_PAUSE);
     if (FAILED(ret)) {
-        DI_SetError("Pausing the device", ret);
-        return -1;
+        return DI_SetError("Pausing the device", ret);
     }
 
     return 0;
@@ -1523,8 +1498,7 @@
     ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device,
                                                        DISFFC_CONTINUE);
     if (FAILED(ret)) {
-        DI_SetError("Pausing the device", ret);
-        return -1;
+        return DI_SetError("Pausing the device", ret);
     }
 
     return 0;
@@ -1548,8 +1522,7 @@
     ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device,
                                                        DISFFC_STOPALL);
     if (FAILED(ret)) {
-        DI_SetError("Stopping the device", ret);
-        return -1;
+        return DI_SetError("Stopping the device", ret);
     }
 
     return 0;
--- a/src/joystick/SDL_gamecontroller.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/SDL_gamecontroller.c	Sun Mar 31 12:48:50 2013 -0400
@@ -722,10 +722,9 @@
 	} else {
 		pControllerMapping = SDL_malloc( sizeof(*pControllerMapping) );
 		if (!pControllerMapping) {
-			SDL_OutOfMemory();
 			SDL_free( pchName );
 			SDL_free( pchMapping );
-			return -1;
+			return SDL_OutOfMemory();
 		}
 #ifdef SDL_JOYSTICK_DINPUT
 		if ( is_xinput_mapping )
--- a/src/joystick/SDL_joystick.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/SDL_joystick.c	Sun Mar 31 12:48:50 2013 -0400
@@ -303,8 +303,7 @@
         joystick->balls[ball].dx = 0;
         joystick->balls[ball].dy = 0;
     } else {
-        SDL_SetError("Joystick only has %d balls", joystick->nballs);
-        retval = -1;
+        return SDL_SetError("Joystick only has %d balls", joystick->nballs);
     }
     return (retval);
 }
--- a/src/joystick/android/SDL_androidjoystick.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/android/SDL_androidjoystick.c	Sun Mar 31 12:48:50 2013 -0400
@@ -77,31 +77,26 @@
 {
     int i = 0;
     if (Android_JNI_JoystickInit() < 0)
-        return (-1);
+        return -1;
     SYS_numjoysticks = Android_JNI_GetNumJoysticks();
     SYS_Joysticks = (SDL_Joystick **)SDL_malloc(SYS_numjoysticks*sizeof(SDL_Joystick *));
-    if (SYS_Joysticks == NULL)
-    {
-        SDL_OutOfMemory();
-        return (-1);
+    if (SYS_Joysticks == NULL) {
+        return SDL_OutOfMemory();
     }
     SYS_JoystickNames = (char **)SDL_malloc(SYS_numjoysticks*sizeof(char *));
-    if (SYS_JoystickNames == NULL)
-    {
+    if (SYS_JoystickNames == NULL) {
         SDL_free(SYS_Joysticks);
         SYS_Joysticks = NULL;
-        SDL_OutOfMemory();
-        return (-1);
+        return SDL_OutOfMemory();
     }
     SDL_memset(SYS_JoystickNames, 0, (SYS_numjoysticks*sizeof(char *)));
     SDL_memset(SYS_Joysticks, 0, (SYS_numjoysticks*sizeof(SDL_Joystick *)));
 
-    for (i = 0; i < SYS_numjoysticks; i++)
-    {
+    for (i = 0; i < SYS_numjoysticks; i++) {
         SYS_JoystickNames[i] = Android_JNI_GetJoystickName(i);
     }
 
-    return (SYS_numjoysticks);
+    return SYS_numjoysticks;
 }
 
 int SDL_SYS_NumJoysticks()
--- a/src/joystick/beos/SDL_bejoystick.cc	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/beos/SDL_bejoystick.cc	Sun Mar 31 12:48:50 2013 -0400
@@ -125,8 +125,7 @@
         joystick->hwdata = (struct joystick_hwdata *)
             SDL_malloc(sizeof(*joystick->hwdata));
         if (joystick->hwdata == NULL) {
-            SDL_OutOfMemory();
-            return (-1);
+            return SDL_OutOfMemory();
         }
         SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
         stick = new BJoystick;
@@ -134,9 +133,8 @@
 
         /* Open the requested joystick for use */
         if (stick->Open(SDL_joyport[device_index]) == B_ERROR) {
-            SDL_SetError("Unable to open joystick");
             SDL_SYS_JoystickClose(joystick);
-            return (-1);
+            return SDL_SetError("Unable to open joystick");
         }
 
         /* Set the joystick to calibrated mode */
@@ -152,9 +150,8 @@
         joystick->hwdata->new_hats = (uint8 *)
             SDL_malloc(joystick->nhats * sizeof(uint8));
         if (!joystick->hwdata->new_hats || !joystick->hwdata->new_axes) {
-            SDL_OutOfMemory();
             SDL_SYS_JoystickClose(joystick);
-            return (-1);
+            return SDL_OutOfMemory();
         }
 
         /* We're done! */
--- a/src/joystick/bsd/SDL_sysjoystick.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/bsd/SDL_sysjoystick.c	Sun Mar 31 12:48:50 2013 -0400
@@ -297,17 +297,15 @@
 
     fd = open(path, O_RDONLY);
     if (fd == -1) {
-        SDL_SetError("%s: %s", path, strerror(errno));
-        return (-1);
+        return SDL_SetError("%s: %s", path, strerror(errno));
     }
 
     joy->instance_id = device_index;
     hw = (struct joystick_hwdata *)
         SDL_malloc(sizeof(struct joystick_hwdata));
     if (hw == NULL) {
-        SDL_OutOfMemory();
         close(fd);
-        return (-1);
+        return SDL_OutOfMemory();
     }
     joy->hwdata = hw;
     hw->fd = fd;
@@ -634,8 +632,7 @@
 #endif
 
     if (len < 0) {
-        SDL_SetError("Negative HID report size");
-        return (-1);
+        return SDL_SetError("Negative HID report size");
     }
     r->size = len;
 
@@ -647,15 +644,14 @@
                             r->size);
 #endif
         if (r->buf == NULL) {
-            SDL_OutOfMemory();
-            return (-1);
+            return SDL_OutOfMemory();
         }
     } else {
         r->buf = NULL;
     }
 
     r->status = SREPORT_CLEAN;
-    return (0);
+    return 0;
 }
 
 static void
--- a/src/joystick/darwin/SDL_sysjoystick.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/darwin/SDL_sysjoystick.c	Sun Mar 31 12:48:50 2013 -0400
@@ -169,7 +169,7 @@
                                                      &(pDevice->interface));
             if (S_OK != plugInResult)
                 HIDReportErrorNum
-                    ("CouldnŐt query HID class device interface from plugInInterface",
+                    ("Couldn't query HID class device interface from plugInInterface",
                      plugInResult);
             (*ppPlugInInterface)->Release(ppPlugInInterface);
         } else
@@ -724,14 +724,12 @@
 	io_iterator_t portIterator = 0;
 
     if (gpDeviceList) {
-        SDL_SetError("Joystick: Device list already inited.");
-        return -1;
+        return SDL_SetError("Joystick: Device list already inited.");
     }
 
     result = IOMasterPort(bootstrap_port, &masterPort);
     if (kIOReturnSuccess != result) {
-        SDL_SetError("Joystick: IOMasterPort error with bootstrap_port.");
-        return -1;
+        return SDL_SetError("Joystick: IOMasterPort error with bootstrap_port.");
     }
 
     /* Set up a matching dictionary to search I/O Registry by class name for all HID class devices. */
@@ -750,9 +748,8 @@
            CFDictionarySetValue (hidMatchDictionary, CFSTR (kIOHIDPrimaryUsagePageKey), refUsagePage);
          */
     } else {
-        SDL_SetError
+        return SDL_SetError
             ("Joystick: Failed to get HID CFMutableDictionaryRef via IOServiceMatching.");
-        return -1;
     }
 
     /*/ Now search I/O Registry for matching devices. */
@@ -761,8 +758,7 @@
                                      &hidObjectIterator);
     /* Check for errors */
     if (kIOReturnSuccess != result) {
-        SDL_SetError("Joystick: Couldn't create a HID object iterator.");
-        return -1;
+        return SDL_SetError("Joystick: Couldn't create a HID object iterator.");
     }
     if (!hidObjectIterator) {   /* there are no joysticks */
         gpDeviceList = NULL;
--- a/src/joystick/dummy/SDL_sysjoystick.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/dummy/SDL_sysjoystick.c	Sun Mar 31 12:48:50 2013 -0400
@@ -73,8 +73,7 @@
 int
 SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
 {
-    SDL_SetError("Logic error: No joysticks available");
-    return (-1);
+    return SDL_SetError("Logic error: No joysticks available");
 }
 
 /* Function to determine is this joystick is attached to the system right now */
--- a/src/joystick/iphoneos/SDL_sysjoystick.m	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/iphoneos/SDL_sysjoystick.m	Sun Mar 31 12:48:50 2013 -0400
@@ -122,15 +122,12 @@
 		[[SDLUIAccelerationDelegate sharedDelegate] shutdown];
 	}
 	SDL_SetError("No joystick open with that index");
-
-    return;
 }
 
 /* Function to perform any system-specific joystick related cleanup */
 void
 SDL_SYS_JoystickQuit(void)
 {
-    return;
 }
 
 SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
--- a/src/joystick/linux/SDL_sysjoystick.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/linux/SDL_sysjoystick.c	Sun Mar 31 12:48:50 2013 -0400
@@ -387,8 +387,7 @@
     SDL_assert(udev == NULL);
     udev = UDEV_udev_new();
     if (udev == NULL) {
-        SDL_SetError("udev_new() failed");
-        return -1;
+        return SDL_SetError("udev_new() failed");
     }
 
     udev_mon = UDEV_udev_monitor_new_from_netlink(udev, "udev");
@@ -400,8 +399,7 @@
 
     enumerate = UDEV_udev_enumerate_new(udev);
     if (enumerate == NULL) {
-        SDL_SetError("udev_enumerate_new() failed");
-        return -1;
+        return SDL_SetError("udev_enumerate_new() failed");
     }
 
     UDEV_udev_enumerate_add_match_subsystem(enumerate, "input");
@@ -725,15 +723,13 @@
     int fd = -1;
 
     if (item == NULL) {
-        SDL_SetError("No such device");
-        return -1;
+        return SDL_SetError("No such device");
     }
 
     fname = item->path;
     fd = open(fname, O_RDONLY, 0);
     if (fd < 0) {
-        SDL_SetError("Unable to open %s", fname);
-        return -1;
+        return SDL_SetError("Unable to open %s", fname);
     }
 
     joystick->instance_id = item->device_instance;
@@ -741,8 +737,7 @@
         SDL_malloc(sizeof(*joystick->hwdata));
     if (joystick->hwdata == NULL) {
         close(fd);
-        SDL_OutOfMemory();
-        return (-1);
+        return SDL_OutOfMemory();
     }
     SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
     joystick->hwdata->item = item;
@@ -753,8 +748,7 @@
         SDL_free(joystick->hwdata);
         joystick->hwdata = NULL;
         close(fd);
-        SDL_OutOfMemory();
-        return (-1);
+        return SDL_OutOfMemory();
     }
 
     SDL_assert(item->hwdata == NULL);
--- a/src/joystick/psp/SDL_sysjoystick.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/psp/SDL_sysjoystick.c	Sun Mar 31 12:48:50 2013 -0400
@@ -113,13 +113,11 @@
 
 	/* Start thread to read data */
 	if((pad_sem =  SDL_CreateSemaphore(1)) == NULL) {
-		SDL_SetError("Can't create input semaphore\n");
-		return -1;
+		return SDL_SetError("Can't create input semaphore");
 	}
 	running = 1;
 	if((thread = SDL_CreateThread(JoystickUpdate, "JoySitckThread",NULL)) == NULL) {
-		SDL_SetError("Can't create input thread\n");
-		return -1;
+		return SDL_SetError("Can't create input thread");
 	}
 
 	/* Create an accurate map from analog inputs (0 to 255) 
--- a/src/joystick/windows/SDL_dxjoystick.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/windows/SDL_dxjoystick.c	Sun Mar 31 12:48:50 2013 -0400
@@ -159,7 +159,7 @@
 static JoyStick_DeviceData *SYS_Joystick;    /* array to hold joystick ID values */
 
 /* local prototypes */
-static void SetDIerror(const char *function, HRESULT code);
+static int SetDIerror(const char *function, HRESULT code);
 static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE *
                                            pdidInstance, VOID * pContext);
 static BOOL CALLBACK EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev,
@@ -352,14 +352,14 @@
 
 
 /* Convert a DirectInput return code to a text message */
-static void
+static int
 SetDIerror(const char *function, HRESULT code)
 {
     /*
-    SDL_SetError("%s() [%s]: %s", function,
+    return SDL_SetError("%s() [%s]: %s", function,
                  DXGetErrorString9A(code), DXGetErrorDescription9A(code));
      */
-    SDL_SetError("%s() DirectX error %d", function, code);
+    return SDL_SetError("%s() DirectX error %d", function, code);
 }
 
 
@@ -565,17 +565,13 @@
 
 	if (!RegisterClassEx (&wincl))
 	{		
-		SDL_SetError("Failed to create register class for joystick autodetect.",
-		GetLastError());
-		return -1;
+		return SDL_SetError("Failed to create register class for joystick autodetect.", GetLastError());
 	}
 
 	messageWindow = (HWND)CreateWindowEx( 0,  L"Message", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL );
 	if ( !messageWindow )
 	{
-		SDL_SetError("Failed to create message window for joystick autodetect.",
-			GetLastError());
-		return -1;
+		return SDL_SetError("Failed to create message window for joystick autodetect.", GetLastError());
 	}
 
 	SDL_memset(&dbh, 0x0, sizeof(dbh));
@@ -587,9 +583,7 @@
 	hNotify = RegisterDeviceNotification( messageWindow, &dbh, DEVICE_NOTIFY_WINDOW_HANDLE );
 	if ( !hNotify )
 	{
-		SDL_SetError("Failed to create notify device for joystick autodetect.",
-			GetLastError());
-		return -1;
+		return SDL_SetError("Failed to create notify device for joystick autodetect.", GetLastError());
 	}
 
 	SDL_LockMutex( s_mutexJoyStickEnum );
@@ -674,8 +668,7 @@
 
     result = WIN_CoInitialize();
     if (FAILED(result)) {
-        SetDIerror("CoInitialize", result);
-        return (-1);
+        return SetDIerror("CoInitialize", result);
     }
 
     coinitialized = SDL_TRUE;
@@ -685,24 +678,20 @@
 
     if (FAILED(result)) {
         SDL_SYS_JoystickQuit();
-        SetDIerror("CoCreateInstance", result);
-        return (-1);
+        return SetDIerror("CoCreateInstance", result);
     }
 
     /* Because we used CoCreateInstance, we need to Initialize it, first. */
     instance = GetModuleHandle(NULL);
     if (instance == NULL) {
         SDL_SYS_JoystickQuit();
-        SDL_SetError("GetModuleHandle() failed with error code %d.",
-                     GetLastError());
-        return (-1);
+        return SDL_SetError("GetModuleHandle() failed with error code %d.", GetLastError());
     }
     result = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION);
 
     if (FAILED(result)) {
         SDL_SYS_JoystickQuit();
-        SetDIerror("IDirectInput::Initialize", result);
-        return (-1);
+        return SetDIerror("IDirectInput::Initialize", result);
     }
 
     s_mutexJoyStickEnum = SDL_CreateMutex();
@@ -967,8 +956,7 @@
     joystick->hwdata =
         (struct joystick_hwdata *) SDL_malloc(sizeof(struct joystick_hwdata));
     if (joystick->hwdata == NULL) {
-        SDL_OutOfMemory();
-        return (-1);
+        return SDL_OutOfMemory();
     }
     SDL_memset(joystick->hwdata, 0, sizeof(struct joystick_hwdata));
     joystick->hwdata->buffered = 1;
@@ -1040,8 +1028,7 @@
 			IDirectInput8_CreateDevice(dinput,
 									  &(joystickdevice->dxdevice.guidInstance), &device, NULL);
 		if (FAILED(result)) {
-			SetDIerror("IDirectInput::CreateDevice", result);
-			return (-1);
+			return SetDIerror("IDirectInput::CreateDevice", result);
 		}
 
 		/* Now get the IDirectInputDevice8 interface, instead. */
@@ -1053,8 +1040,7 @@
 		IDirectInputDevice8_Release(device);
 
 		if (FAILED(result)) {
-			SetDIerror("IDirectInputDevice8::QueryInterface", result);
-			return (-1);
+			return SetDIerror("IDirectInputDevice8::QueryInterface", result);
 		}
 
 		/* Aquire shared access. Exclusive access is required for forces,
@@ -1065,8 +1051,7 @@
 													DISCL_NONEXCLUSIVE |
 													DISCL_BACKGROUND);
 		if (FAILED(result)) {
-			SetDIerror("IDirectInputDevice8::SetCooperativeLevel", result);
-			return (-1);
+			return SetDIerror("IDirectInputDevice8::SetCooperativeLevel", result);
 		}
 
 		/* Use the extended data structure: DIJOYSTATE2. */
@@ -1074,8 +1059,7 @@
 			IDirectInputDevice8_SetDataFormat(joystick->hwdata->InputDevice,
 											  &c_dfDIJoystick2);
 		if (FAILED(result)) {
-			SetDIerror("IDirectInputDevice8::SetDataFormat", result);
-			return (-1);
+			return SetDIerror("IDirectInputDevice8::SetDataFormat", result);
 		}
 
 		/* Get device capabilities */
@@ -1084,8 +1068,7 @@
 												&joystick->hwdata->Capabilities);
 
 		if (FAILED(result)) {
-			SetDIerror("IDirectInputDevice8::GetCapabilities", result);
-			return (-1);
+			return SetDIerror("IDirectInputDevice8::GetCapabilities", result);
 		}
 
 		/* Force capable? */
@@ -1094,8 +1077,7 @@
 			result = IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice);
 
 			if (FAILED(result)) {
-				SetDIerror("IDirectInputDevice8::Acquire", result);
-				return (-1);
+				return SetDIerror("IDirectInputDevice8::Acquire", result);
 			}
 
 			/* reset all accuators. */
@@ -1106,17 +1088,14 @@
 
 			/* Not necessarily supported, ignore if not supported.
 			if (FAILED(result)) {
-				SetDIerror("IDirectInputDevice8::SendForceFeedbackCommand",
-						   result);
-				return (-1);
+				return SetDIerror("IDirectInputDevice8::SendForceFeedbackCommand", result);
 			}
 			*/
 
 			result = IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
 
 			if (FAILED(result)) {
-				SetDIerror("IDirectInputDevice8::Unacquire", result);
-				return (-1);
+				return SetDIerror("IDirectInputDevice8::Unacquire", result);
 			}
 
 			/* Turn on auto-centering for a ForceFeedback device (until told
@@ -1131,8 +1110,7 @@
 
 			/* Not necessarily supported, ignore if not supported.
 			if (FAILED(result)) {
-				SetDIerror("IDirectInputDevice8::SetProperty", result);
-				return (-1);
+				return SetDIerror("IDirectInputDevice8::SetProperty", result);
 			}
 			*/
 		}
@@ -1160,8 +1138,7 @@
 			 * to use less reliable polling. */
 			joystick->hwdata->buffered = 0;
 		} else if (FAILED(result)) {
-			SetDIerror("IDirectInputDevice8::SetProperty", result);
-			return (-1);
+			return SetDIerror("IDirectInputDevice8::SetProperty", result);
 		}
 	}
     return (0);
--- a/src/joystick/windows/SDL_mmjoystick.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/joystick/windows/SDL_mmjoystick.c	Sun Mar 31 12:48:50 2013 -0400
@@ -244,8 +244,7 @@
     joystick->hwdata =
         (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata));
     if (joystick->hwdata == NULL) {
-        SDL_OutOfMemory();
-        return (-1);
+        return SDL_OutOfMemory();
     }
     SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
 
--- a/src/main/beos/SDL_BeApp.cc	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/main/beos/SDL_BeApp.cc	Sun Mar 31 12:48:50 2013 -0400
@@ -64,8 +64,7 @@
     if (SDL_BeAppActive <= 0) {
         SDL_AppThread = SDL_CreateThread(StartBeApp, "SDLApplication", NULL);
         if (SDL_AppThread == NULL) {
-            SDL_SetError("Couldn't create BApplication thread");
-            return (-1);
+            return SDL_SetError("Couldn't create BApplication thread");
         }
 
         /* Change working to directory to that of executable */
--- a/src/render/SDL_render.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/SDL_render.c	Sun Mar 31 12:48:50 2013 -0400
@@ -82,9 +82,8 @@
 SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info)
 {
     if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
-        SDL_SetError("index must be in the range of 0 - %d",
-                     SDL_GetNumRenderDrivers() - 1);
-        return -1;
+        return SDL_SetError("index must be in the range of 0 - %d",
+                            SDL_GetNumRenderDrivers() - 1);
     }
     *info = render_drivers[index]->info;
     return 0;
@@ -695,8 +694,7 @@
         temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3);
         temp_pixels = SDL_malloc(rect->h * temp_pitch);
         if (!temp_pixels) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
                             rect->w, rect->h, temp_pixels, temp_pitch);
@@ -732,8 +730,7 @@
         temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3);
         temp_pixels = SDL_malloc(rect->h * temp_pitch);
         if (!temp_pixels) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_ConvertPixels(rect->w, rect->h,
                           texture->format, pixels, pitch,
@@ -800,8 +797,7 @@
     CHECK_TEXTURE_MAGIC(texture, -1);
 
     if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
-        SDL_SetError("SDL_LockTexture(): texture must be streaming");
-        return -1;
+        return SDL_SetError("SDL_LockTexture(): texture must be streaming");
     }
 
     if (!rect) {
@@ -897,8 +893,7 @@
 SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
 {
     if (!SDL_RenderTargetSupported(renderer)) {
-        SDL_Unsupported();
-        return -1;
+        return SDL_Unsupported();
     }
     if (texture == renderer->target) {
         /* Nothing to do! */
@@ -909,12 +904,10 @@
     if (texture) {
         CHECK_TEXTURE_MAGIC(texture, -1);
         if (renderer != texture->renderer) {
-            SDL_SetError("Texture was not created with this renderer");
-            return -1;
+            return SDL_SetError("Texture was not created with this renderer");
         }
         if (texture->access != SDL_TEXTUREACCESS_TARGET) {
-            SDL_SetError("Texture not created with SDL_TEXTUREACCESS_TARGET");
-            return -1;
+            return SDL_SetError("Texture not created with SDL_TEXTUREACCESS_TARGET");
         }
         if (texture->native) {
             /* Always render to the native texture */
@@ -979,8 +972,7 @@
         SDL_GetWindowSize(renderer->window, &w, &h);
     } else {
         /* FIXME */
-        SDL_SetError("Internal error: No way to get output resolution");
-        return -1;
+        return SDL_SetError("Internal error: No way to get output resolution");
     }
 
     want_aspect = (float)renderer->logical_w / renderer->logical_h;
@@ -1198,8 +1190,7 @@
 
     frects = SDL_stack_alloc(SDL_FRect, count);
     if (!frects) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     for (i = 0; i < count; ++i) {
         frects[i].x = points[i].x * renderer->scale.x;
@@ -1226,8 +1217,7 @@
     CHECK_RENDERER_MAGIC(renderer, -1);
 
     if (!points) {
-        SDL_SetError("SDL_RenderDrawPoints(): Passed NULL points");
-        return -1;
+        return SDL_SetError("SDL_RenderDrawPoints(): Passed NULL points");
     }
     if (count < 1) {
         return 0;
@@ -1243,8 +1233,7 @@
 
     fpoints = SDL_stack_alloc(SDL_FPoint, count);
     if (!fpoints) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     for (i = 0; i < count; ++i) {
         fpoints[i].x = points[i].x * renderer->scale.x;
@@ -1282,8 +1271,7 @@
 
     frects = SDL_stack_alloc(SDL_FRect, count-1);
     if (!frects) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     status = 0;
@@ -1338,8 +1326,7 @@
     CHECK_RENDERER_MAGIC(renderer, -1);
 
     if (!points) {
-        SDL_SetError("SDL_RenderDrawLines(): Passed NULL points");
-        return -1;
+        return SDL_SetError("SDL_RenderDrawLines(): Passed NULL points");
     }
     if (count < 2) {
         return 0;
@@ -1355,8 +1342,7 @@
 
     fpoints = SDL_stack_alloc(SDL_FPoint, count);
     if (!fpoints) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     for (i = 0; i < count; ++i) {
         fpoints[i].x = points[i].x * renderer->scale.x;
@@ -1408,8 +1394,7 @@
     CHECK_RENDERER_MAGIC(renderer, -1);
 
     if (!rects) {
-        SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects");
-        return -1;
+        return SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects");
     }
     if (count < 1) {
         return 0;
@@ -1455,8 +1440,7 @@
     CHECK_RENDERER_MAGIC(renderer, -1);
 
     if (!rects) {
-        SDL_SetError("SDL_RenderFillRects(): Passed NULL rects");
-        return -1;
+        return SDL_SetError("SDL_RenderFillRects(): Passed NULL rects");
     }
     if (count < 1) {
         return 0;
@@ -1468,8 +1452,7 @@
 
     frects = SDL_stack_alloc(SDL_FRect, count);
     if (!frects) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     for (i = 0; i < count; ++i) {
         frects[i].x = rects[i].x * renderer->scale.x;
@@ -1497,8 +1480,7 @@
     CHECK_TEXTURE_MAGIC(texture, -1);
 
     if (renderer != texture->renderer) {
-        SDL_SetError("Texture was not created with this renderer");
-        return -1;
+        return SDL_SetError("Texture was not created with this renderer");
     }
 
     real_srcrect.x = 0;
@@ -1566,12 +1548,10 @@
     CHECK_TEXTURE_MAGIC(texture, -1);
 
     if (renderer != texture->renderer) {
-        SDL_SetError("Texture was not created with this renderer");
-        return -1;
+        return SDL_SetError("Texture was not created with this renderer");
     }
     if (!renderer->RenderCopyEx) {
-        SDL_SetError("Renderer does not support RenderCopyEx");
-        return -1;
+        return SDL_SetError("Renderer does not support RenderCopyEx");
     }
     
     real_srcrect.x = 0;
@@ -1623,8 +1603,7 @@
     CHECK_RENDERER_MAGIC(renderer, -1);
 
     if (!renderer->RenderReadPixels) {
-        SDL_Unsupported();
-        return -1;
+        return SDL_Unsupported();
     }
 
     if (!format) {
@@ -1729,8 +1708,7 @@
         return renderer->GL_BindTexture(renderer, texture, texw, texh);
     }
 
-    SDL_Unsupported();
-    return -1;
+    return SDL_Unsupported();
 }
 
 int SDL_GL_UnbindTexture(SDL_Texture *texture)
@@ -1743,8 +1721,7 @@
         return renderer->GL_UnbindTexture(renderer, texture);
     }
 
-    SDL_Unsupported();
-    return -1;
+    return SDL_Unsupported();
 }
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/render/SDL_yuv_sw.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/SDL_yuv_sw.c	Sun Mar 31 12:48:50 2013 -0400
@@ -896,8 +896,7 @@
 
     if (!SDL_PixelFormatEnumToMasks
         (target_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask) || bpp < 15) {
-        SDL_SetError("Unsupported YUV destination format");
-        return -1;
+        return SDL_SetError("Unsupported YUV destination format");
     }
 
     swdata->target_format = target_format;
@@ -1057,8 +1056,8 @@
     swdata->colortab = (int *) SDL_malloc(4 * 256 * sizeof(int));
     swdata->rgb_2_pix = (Uint32 *) SDL_malloc(3 * 768 * sizeof(Uint32));
     if (!swdata->pixels || !swdata->colortab || !swdata->rgb_2_pix) {
+        SDL_SW_DestroyYUVTexture(swdata);
         SDL_OutOfMemory();
-        SDL_SW_DestroyYUVTexture(swdata);
         return NULL;
     }
 
@@ -1197,9 +1196,8 @@
         if (rect
             && (rect->x != 0 || rect->y != 0 || rect->w != swdata->w
                 || rect->h != swdata->h)) {
-            SDL_SetError
+            return SDL_SetError
                 ("YV12 and IYUV textures only support full surface locks");
-            return -1;
         }
         break;
     }
@@ -1309,8 +1307,7 @@
         Cb = lum + 3;
         break;
     default:
-        SDL_SetError("Unsupported YUV format in copy");
-        return (-1);
+        return SDL_SetError("Unsupported YUV format in copy");
     }
     mod = (pitch / SDL_BYTESPERPIXEL(target_format));
 
--- a/src/render/direct3d/SDL_render_d3d.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/direct3d/SDL_render_d3d.c	Sun Mar 31 12:48:50 2013 -0400
@@ -246,7 +246,7 @@
     float u, v;
 } Vertex;
 
-static void
+static int
 D3D_SetError(const char *prefix, HRESULT result)
 {
     const char *error;
@@ -322,7 +322,7 @@
         error = "UNKNOWN";
         break;
     }
-    SDL_SetError("%s: %s", prefix, error);
+    return SDL_SetError("%s: %s", prefix, error);
 }
 
 static D3DFORMAT
@@ -373,8 +373,7 @@
             /* Don't worry about it, we'll reset later... */
             return 0;
         } else {
-            D3D_SetError("Reset()", result);
-            return -1;
+            return D3D_SetError("Reset()", result);
         }
     }
     IDirect3DDevice9_SetVertexShader(data->device, NULL);
@@ -422,8 +421,7 @@
             result = IDirect3DDevice9_BeginScene(data->device);
         }
         if (FAILED(result)) {
-            D3D_SetError("BeginScene()", result);
-            return -1;
+            return D3D_SetError("BeginScene()", result);
         }
         data->beginScene = SDL_FALSE;
     }
@@ -704,8 +702,7 @@
 
     data = (D3D_TextureData *) SDL_calloc(1, sizeof(*data));
     if (!data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     data->scaleMode = GetScaleQuality();
 
@@ -732,8 +729,7 @@
                                        PixelFormatToD3DFMT(texture->format),
                                        pool, &data->texture, NULL);
     if (FAILED(result)) {
-        D3D_SetError("CreateTexture()", result);
-        return -1;
+        return D3D_SetError("CreateTexture()", result);
     }
 
     return 0;
@@ -767,8 +763,7 @@
     }
 
     if (FAILED(result)) {
-        D3D_SetError("LockRect()", result);
-        return -1;
+        return D3D_SetError("LockRect()", result);
     }
 
     src = pixels;
@@ -804,8 +799,7 @@
 
     result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
     if (FAILED(result)) {
-        D3D_SetError("LockRect()", result);
-        return -1;
+        return D3D_SetError("LockRect()", result);
     }
     *pixels = locked.pBits;
     *pitch = locked.Pitch;
@@ -881,13 +875,11 @@
     texturedata = (D3D_TextureData *) texture->driverdata;
     result = IDirect3DTexture9_GetSurfaceLevel(texturedata->texture, 0, &data->currentRenderTarget);
     if(FAILED(result)) {
-        D3D_SetError("GetSurfaceLevel()", result);
-        return -1;
+        return D3D_SetError("GetSurfaceLevel()", result);
     }
     result = IDirect3DDevice9_SetRenderTarget(data->device, 0, data->currentRenderTarget);
     if(FAILED(result)) {
-        D3D_SetError("SetRenderTarget()", result);
-        return -1;
+        return D3D_SetError("SetRenderTarget()", result);
     }
 
     return 0;
@@ -936,8 +928,7 @@
     }
 
     if (FAILED(result)) {
-        D3D_SetError("Clear()", result);
-        return -1;
+        return D3D_SetError("Clear()", result);
     }
     return 0;
 }
@@ -997,8 +988,7 @@
         IDirect3DDevice9_SetTexture(data->device, 0,
                                     (IDirect3DBaseTexture9 *) 0);
     if (FAILED(result)) {
-        D3D_SetError("SetTexture()", result);
-        return -1;
+        return D3D_SetError("SetTexture()", result);
     }
 
     color = D3DCOLOR_ARGB(renderer->a, renderer->r, renderer->g, renderer->b);
@@ -1017,8 +1007,7 @@
                                          vertices, sizeof(*vertices));
     SDL_stack_free(vertices);
     if (FAILED(result)) {
-        D3D_SetError("DrawPrimitiveUP()", result);
-        return -1;
+        return D3D_SetError("DrawPrimitiveUP()", result);
     }
     return 0;
 }
@@ -1043,8 +1032,7 @@
         IDirect3DDevice9_SetTexture(data->device, 0,
                                     (IDirect3DBaseTexture9 *) 0);
     if (FAILED(result)) {
-        D3D_SetError("SetTexture()", result);
-        return -1;
+        return D3D_SetError("SetTexture()", result);
     }
 
     color = D3DCOLOR_ARGB(renderer->a, renderer->r, renderer->g, renderer->b);
@@ -1073,8 +1061,7 @@
 
     SDL_stack_free(vertices);
     if (FAILED(result)) {
-        D3D_SetError("DrawPrimitiveUP()", result);
-        return -1;
+        return D3D_SetError("DrawPrimitiveUP()", result);
     }
     return 0;
 }
@@ -1100,8 +1087,7 @@
         IDirect3DDevice9_SetTexture(data->device, 0,
                                     (IDirect3DBaseTexture9 *) 0);
     if (FAILED(result)) {
-        D3D_SetError("SetTexture()", result);
-        return -1;
+        return D3D_SetError("SetTexture()", result);
     }
 
     color = D3DCOLOR_ARGB(renderer->a, renderer->r, renderer->g, renderer->b);
@@ -1146,8 +1132,7 @@
             IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN,
                                              2, vertices, sizeof(*vertices));
         if (FAILED(result)) {
-            D3D_SetError("DrawPrimitiveUP()", result);
-            return -1;
+            return D3D_SetError("DrawPrimitiveUP()", result);
         }
     }
     return 0;
@@ -1224,28 +1209,24 @@
         IDirect3DDevice9_SetTexture(data->device, 0, (IDirect3DBaseTexture9 *)
                                     texturedata->texture);
     if (FAILED(result)) {
-        D3D_SetError("SetTexture()", result);
-        return -1;
+        return D3D_SetError("SetTexture()", result);
     }
     if (shader) {
         result = IDirect3DDevice9_SetPixelShader(data->device, shader);
         if (FAILED(result)) {
-            D3D_SetError("SetShader()", result);
-            return -1;
+            return D3D_SetError("SetShader()", result);
         }
     }
     result =
         IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
                                          vertices, sizeof(*vertices));
     if (FAILED(result)) {
-        D3D_SetError("DrawPrimitiveUP()", result);
-        return -1;
+        return D3D_SetError("DrawPrimitiveUP()", result);
     }
     if (shader) {
         result = IDirect3DDevice9_SetPixelShader(data->device, NULL);
         if (FAILED(result)) {
-            D3D_SetError("SetShader()", result);
-            return -1;
+            return D3D_SetError("SetShader()", result);
         }
     }
     return 0;
@@ -1348,28 +1329,24 @@
         IDirect3DDevice9_SetTexture(data->device, 0, (IDirect3DBaseTexture9 *)
                                     texturedata->texture);
     if (FAILED(result)) {
-        D3D_SetError("SetTexture()", result);
-        return -1;
+        return D3D_SetError("SetTexture()", result);
     }
     if (shader) {
         result = IDirect3DDevice9_SetPixelShader(data->device, shader);
         if (FAILED(result)) {
-            D3D_SetError("SetShader()", result);
-            return -1;
+            return D3D_SetError("SetShader()", result);
         }
     }
     result =
         IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
                                          vertices, sizeof(*vertices));
     if (FAILED(result)) {
-        D3D_SetError("DrawPrimitiveUP()", result);
-        return -1;
+        return D3D_SetError("DrawPrimitiveUP()", result);
     }
     if (shader) {
         result = IDirect3DDevice9_SetPixelShader(data->device, NULL);
         if (FAILED(result)) {
-            D3D_SetError("SetShader()", result);
-            return -1;
+            return D3D_SetError("SetShader()", result);
         }
     }
     ID3DXMatrixStack_Pop(data->matrixStack);
@@ -1394,30 +1371,26 @@
 
     result = IDirect3DDevice9_GetBackBuffer(data->device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backBuffer);
     if (FAILED(result)) {
-        D3D_SetError("GetBackBuffer()", result);
-        return -1;
+        return D3D_SetError("GetBackBuffer()", result);
     }
 
     result = IDirect3DSurface9_GetDesc(backBuffer, &desc);
     if (FAILED(result)) {
-        D3D_SetError("GetDesc()", result);
         IDirect3DSurface9_Release(backBuffer);
-        return -1;
+        return D3D_SetError("GetDesc()", result);
     }
 
     result = IDirect3DDevice9_CreateOffscreenPlainSurface(data->device, desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &surface, NULL);
     if (FAILED(result)) {
-        D3D_SetError("CreateOffscreenPlainSurface()", result);
         IDirect3DSurface9_Release(backBuffer);
-        return -1;
+        return D3D_SetError("CreateOffscreenPlainSurface()", result);
     }
 
     result = IDirect3DDevice9_GetRenderTargetData(data->device, backBuffer, surface);
     if (FAILED(result)) {
-        D3D_SetError("GetRenderTargetData()", result);
         IDirect3DSurface9_Release(surface);
         IDirect3DSurface9_Release(backBuffer);
-        return -1;
+        return D3D_SetError("GetRenderTargetData()", result);
     }
 
     d3drect.left = rect->x;
@@ -1427,10 +1400,9 @@
 
     result = IDirect3DSurface9_LockRect(surface, &locked, &d3drect, D3DLOCK_READONLY);
     if (FAILED(result)) {
-        D3D_SetError("LockRect()", result);
         IDirect3DSurface9_Release(surface);
         IDirect3DSurface9_Release(backBuffer);
-        return -1;
+        return D3D_SetError("LockRect()", result);
     }
 
     SDL_ConvertPixels(rect->w, rect->h,
--- a/src/render/opengl/SDL_render_gl.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/opengl/SDL_render_gl.c	Sun Mar 31 12:48:50 2013 -0400
@@ -208,8 +208,7 @@
     do { \
         data->func = SDL_GL_GetProcAddress(#func); \
         if ( ! data->func ) { \
-            SDL_SetError("Couldn't load GL function %s: %s\n", #func, SDL_GetError()); \
-            return -1; \
+            return SDL_SetError("Couldn't load GL function %s: %s\n", #func, SDL_GetError()); \
         } \
     } while ( 0 );
 #endif /* __SDL_NOGETPROCADDR__ */
@@ -500,15 +499,13 @@
 
     if (!convert_format(renderdata, texture->format, &internalFormat,
                         &format, &type)) {
-        SDL_SetError("Texture format %s not supported by OpenGL",
-                     SDL_GetPixelFormatName(texture->format));
-        return -1;
+        return SDL_SetError("Texture format %s not supported by OpenGL",
+                            SDL_GetPixelFormatName(texture->format));
     }
 
     data = (GL_TextureData *) SDL_calloc(1, sizeof(*data));
     if (!data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
@@ -522,9 +519,8 @@
         }
         data->pixels = SDL_calloc(1, size);
         if (!data->pixels) {
-            SDL_OutOfMemory();
             SDL_free(data);
-            return -1;
+            return SDL_OutOfMemory();
         }
     }
 
@@ -746,8 +742,7 @@
     /* Check FBO status */
     status = data->glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
     if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
-        SDL_SetError("glFramebufferTexture2DEXT() failed");
-        return -1;
+        return SDL_SetError("glFramebufferTexture2DEXT() failed");
     }
     return 0;
 }
@@ -1157,8 +1152,7 @@
     temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format);
     temp_pixels = SDL_malloc(rect->h * temp_pitch);
     if (!temp_pixels) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     convert_format(data, temp_format, &internalFormat, &format, &type);
--- a/src/render/opengles/SDL_render_gles.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/opengles/SDL_render_gles.c	Sun Mar 31 12:48:50 2013 -0400
@@ -135,7 +135,7 @@
     GLES_FBOList *fbo;
 } GLES_TextureData;
 
-static void
+static int
 GLES_SetError(const char *prefix, GLenum result)
 {
     const char *error;
@@ -166,7 +166,7 @@
         error = "UNKNOWN";
         break;
     }
-    SDL_SetError("%s: %s", prefix, error);
+    return SDL_SetError("%s: %s", prefix, error);
 }
 
 static int GLES_LoadFunctions(GLES_RenderData * data)
@@ -186,8 +186,7 @@
     do { \
         data->func = SDL_GL_GetProcAddress(#func); \
         if ( ! data->func ) { \
-            SDL_SetError("Couldn't load GLES function %s: %s\n", #func, SDL_GetError()); \
-            return -1; \
+            return SDL_SetError("Couldn't load GLES function %s: %s\n", #func, SDL_GetError()); \
         } \
     } while ( 0 );  
 #endif /* _SDL_NOGETPROCADDR_ */
@@ -442,23 +441,20 @@
         type = GL_UNSIGNED_BYTE;
         break;
     default:
-        SDL_SetError("Texture format not supported");
-        return -1;
+        return SDL_SetError("Texture format not supported");
     }
 
     data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data));
     if (!data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
         data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
         data->pixels = SDL_calloc(1, texture->h * data->pitch);
         if (!data->pixels) {
-            SDL_OutOfMemory();
             SDL_free(data);
-            return -1;
+            return SDL_OutOfMemory();
         }
     }
 
@@ -495,8 +491,7 @@
 
     result = renderdata->glGetError();
     if (result != GL_NO_ERROR) {
-        GLES_SetError("glTexImage2D()", result);
-        return -1;
+        return GLES_SetError("glTexImage2D()", result);
     }
     return 0;
 }
@@ -521,17 +516,13 @@
     /* Reformat the texture data into a tightly packed array */
     srcPitch = rect->w * SDL_BYTESPERPIXEL(texture->format);
     src = (Uint8 *)pixels;
-    if (pitch != srcPitch)
-    {
+    if (pitch != srcPitch) {
         blob = (Uint8 *)SDL_malloc(srcPitch * rect->h);
-        if (!blob)
-        {
-            SDL_OutOfMemory();
-            return -1;
+        if (!blob) {
+            return SDL_OutOfMemory();
         }
         src = blob;
-        for (y = 0; y < rect->h; ++y)
-        {
+        for (y = 0; y < rect->h; ++y) {
             SDL_memcpy(src, pixels, srcPitch);
             src += srcPitch;
             pixels = (Uint8 *)pixels + pitch;
@@ -559,8 +550,7 @@
 
     if (renderdata->glGetError() != GL_NO_ERROR)
     {
-        SDL_SetError("Failed to update texture");
-        return -1;
+        return SDL_SetError("Failed to update texture");
     }
     return 0;
 }
@@ -613,8 +603,7 @@
     /* Check FBO status */
     status = data->glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES);
     if (status != GL_FRAMEBUFFER_COMPLETE_OES) {
-        SDL_SetError("glFramebufferTexture2DOES() failed");
-        return -1;
+        return SDL_SetError("glFramebufferTexture2DOES() failed");
     }
     return 0;
 }
@@ -1006,8 +995,7 @@
     temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format);
     temp_pixels = SDL_malloc(rect->h * temp_pitch);
     if (!temp_pixels) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     SDL_GetWindowSize(window, &w, &h);
--- a/src/render/opengles2/SDL_render_gles2.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/opengles2/SDL_render_gles2.c	Sun Mar 31 12:48:50 2013 -0400
@@ -189,8 +189,7 @@
     do { \
         data->func = SDL_GL_GetProcAddress(#func); \
         if ( ! data->func ) { \
-            SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \
-            return -1; \
+            return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \
         } \
     } while ( 0 );
 #endif /* _SDL_NOGETPROCADDR_ */
@@ -372,16 +371,13 @@
         type = GL_UNSIGNED_BYTE;
         break;
     default:
-        SDL_SetError("Texture format not supported");
-        return -1;
+        return SDL_SetError("Texture format not supported");
     }
 
     /* Allocate a texture struct */
     tdata = (GLES2_TextureData *)SDL_calloc(1, sizeof(GLES2_TextureData));
-    if (!tdata)
-    {
-        SDL_OutOfMemory();
-        return -1;
+    if (!tdata) {
+        return SDL_OutOfMemory();
     }
     tdata->texture = 0;
     tdata->texture_type = GL_TEXTURE_2D;
@@ -390,15 +386,12 @@
     scaleMode = GetScaleQuality();
 
     /* Allocate a blob for image data */
-    if (texture->access == SDL_TEXTUREACCESS_STREAMING)
-    {
+    if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
         tdata->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
         tdata->pixel_data = SDL_calloc(1, tdata->pitch * texture->h);
-        if (!tdata->pixel_data)
-        {
-            SDL_OutOfMemory();
+        if (!tdata->pixel_data) {
             SDL_free(tdata);
-            return -1;
+            return SDL_OutOfMemory();
         }
     }
 
@@ -414,10 +407,9 @@
     rdata->glTexImage2D(tdata->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL);
     if (rdata->glGetError() != GL_NO_ERROR)
     {
-        SDL_SetError("Texture creation failed");
         rdata->glDeleteTextures(1, &tdata->texture);
         SDL_free(tdata);
-        return -1;
+        return SDL_SetError("Texture creation failed");
     }
     texture->driverdata = tdata;
 
@@ -497,13 +489,10 @@
     /* Reformat the texture data into a tightly packed array */
     srcPitch = rect->w * SDL_BYTESPERPIXEL(texture->format);
     src = (Uint8 *)pixels;
-    if (pitch != srcPitch)
-    {
+    if (pitch != srcPitch) {
         blob = (Uint8 *)SDL_malloc(srcPitch * rect->h);
-        if (!blob)
-        {
-            SDL_OutOfMemory();
-            return -1;
+        if (!blob) {
+            return SDL_OutOfMemory();
         }
         src = blob;
         for (y = 0; y < rect->h; ++y)
@@ -533,10 +522,8 @@
         SDL_free(blob);
     }
 
-    if (rdata->glGetError() != GL_NO_ERROR)
-    {
-        SDL_SetError("Failed to update texture");
-        return -1;
+    if (rdata->glGetError() != GL_NO_ERROR) {
+        return SDL_SetError("Failed to update texture");
     }
     return 0;
 }
@@ -558,8 +545,7 @@
         /* Check FBO status */
         status = data->glCheckFramebufferStatus(GL_FRAMEBUFFER);
         if (status != GL_FRAMEBUFFER_COMPLETE) {
-            SDL_SetError("glFramebufferTexture2D() failed");
-            return -1;
+            return SDL_SetError("glFramebufferTexture2D() failed");
         }
     }
     return 0;
@@ -636,9 +622,9 @@
     rdata->glGetProgramiv(entry->id, GL_LINK_STATUS, &linkSuccessful);
     if (rdata->glGetError() != GL_NO_ERROR || !linkSuccessful)
     {
-        SDL_SetError("Failed to link shader program");
         rdata->glDeleteProgram(entry->id);
         SDL_free(entry);
+        SDL_SetError("Failed to link shader program");
         return NULL;
     }
 
@@ -930,10 +916,8 @@
     locProjection = rdata->current_program->uniform_locations[GLES2_UNIFORM_PROJECTION];
     rdata->glGetError();
     rdata->glUniformMatrix4fv(locProjection, 1, GL_FALSE, (GLfloat *)projection);
-    if (rdata->glGetError() != GL_NO_ERROR)
-    {
-        SDL_SetError("Failed to set orthographic projection");
-        return -1;
+    if (rdata->glGetError() != GL_NO_ERROR) {
+        return SDL_SetError("Failed to set orthographic projection");
     }
     return 0;
 }
@@ -1066,8 +1050,7 @@
 
     /* Emit the specified vertices as points */
     vertices = SDL_stack_alloc(GLfloat, count * 2);
-    for (idx = 0; idx < count; ++idx)
-    {
+    for (idx = 0; idx < count; ++idx) {
         GLfloat x = points[idx].x + 0.5f;
         GLfloat y = points[idx].y + 0.5f;
 
@@ -1078,10 +1061,8 @@
     rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
     rdata->glDrawArrays(GL_POINTS, 0, count);
     SDL_stack_free(vertices);
-    if (rdata->glGetError() != GL_NO_ERROR)
-    {
-        SDL_SetError("Failed to render lines");
-        return -1;
+    if (rdata->glGetError() != GL_NO_ERROR) {
+        return SDL_SetError("Failed to render lines");
     }
     return 0;
 }
@@ -1099,8 +1080,7 @@
 
     /* Emit a line strip including the specified vertices */
     vertices = SDL_stack_alloc(GLfloat, count * 2);
-    for (idx = 0; idx < count; ++idx)
-    {
+    for (idx = 0; idx < count; ++idx) {
         GLfloat x = points[idx].x + 0.5f;
         GLfloat y = points[idx].y + 0.5f;
 
@@ -1117,10 +1097,8 @@
         rdata->glDrawArrays(GL_POINTS, count-1, 1);
     }
     SDL_stack_free(vertices);
-    if (rdata->glGetError() != GL_NO_ERROR)
-    {
-        SDL_SetError("Failed to render lines");
-        return -1;
+    if (rdata->glGetError() != GL_NO_ERROR) {
+        return SDL_SetError("Failed to render lines");
     }
     return 0;
 }
@@ -1157,10 +1135,8 @@
         rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
         rdata->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
     }
-    if (rdata->glGetError() != GL_NO_ERROR)
-    {
-        SDL_SetError("Failed to render lines");
-        return -1;
+    if (rdata->glGetError() != GL_NO_ERROR) {
+        return SDL_SetError("Failed to render lines");
     }
     return 0;
 }
@@ -1315,10 +1291,8 @@
     texCoords[7] = (srcrect->y + srcrect->h) / (GLfloat)texture->h;
     rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, texCoords);
     rdata->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-    if (rdata->glGetError() != GL_NO_ERROR)
-    {
-        SDL_SetError("Failed to render texture");
-        return -1;
+    if (rdata->glGetError() != GL_NO_ERROR) {
+        return SDL_SetError("Failed to render texture");
     }
     return 0;
 }
@@ -1499,10 +1473,8 @@
     rdata->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
     rdata->glDisableVertexAttribArray(GLES2_ATTRIBUTE_CENTER);
     rdata->glDisableVertexAttribArray(GLES2_ATTRIBUTE_ANGLE);
-    if (rdata->glGetError() != GL_NO_ERROR)
-    {
-        SDL_SetError("Failed to render texture");
-        return -1;
+    if (rdata->glGetError() != GL_NO_ERROR) {
+        return SDL_SetError("Failed to render texture");
     }
     return 0;
 }
@@ -1525,8 +1497,7 @@
     temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format);
     temp_pixels = SDL_malloc(rect->h * temp_pitch);
     if (!temp_pixels) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     SDL_GetWindowSize(window, &w, &h);
--- a/src/render/psp/SDL_render_psp.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/psp/SDL_render_psp.c	Sun Mar 31 12:48:50 2013 -0400
@@ -493,9 +493,8 @@
 	
 	if(!psp_texture->data)
 	{
-		SDL_OutOfMemory();
 		SDL_free(psp_texture);
-		return -1;
+		return SDL_OutOfMemory();
 	}
     texture->driverdata = psp_texture;
     
--- a/src/render/software/SDL_blendfillrect.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/software/SDL_blendfillrect.c	Sun Mar 31 12:48:50 2013 -0400
@@ -159,8 +159,7 @@
         }
         return 0;
     default:
-        SDL_Unsupported();
-        return -1;
+        return SDL_Unsupported();
     }
 }
 
@@ -189,8 +188,7 @@
         }
         return 0;
     default:
-        SDL_Unsupported();
-        return -1;
+        return SDL_Unsupported();
     }
 }
 
@@ -201,14 +199,12 @@
     SDL_Rect clipped;
 
     if (!dst) {
-        SDL_SetError("Passed NULL destination surface");
-        return -1;
+        return SDL_SetError("Passed NULL destination surface");
     }
 
     /* This function doesn't work on surfaces < 8 bpp */
     if (dst->format->BitsPerPixel < 8) {
-        SDL_SetError("SDL_BlendFillRect(): Unsupported surface format");
-        return -1;
+        return SDL_SetError("SDL_BlendFillRect(): Unsupported surface format");
     }
 
     /* If 'rect' == NULL, then fill the whole surface */
@@ -274,14 +270,12 @@
     int status = 0;
 
     if (!dst) {
-        SDL_SetError("Passed NULL destination surface");
-        return -1;
+        return SDL_SetError("Passed NULL destination surface");
     }
 
     /* This function doesn't work on surfaces < 8 bpp */
     if (dst->format->BitsPerPixel < 8) {
-        SDL_SetError("SDL_BlendFillRects(): Unsupported surface format");
-        return -1;
+        return SDL_SetError("SDL_BlendFillRects(): Unsupported surface format");
     }
 
     if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
--- a/src/render/software/SDL_blendline.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/software/SDL_blendline.c	Sun Mar 31 12:48:50 2013 -0400
@@ -711,14 +711,12 @@
     BlendLineFunc func;
 
     if (!dst) {
-        SDL_SetError("SDL_BlendLine(): Passed NULL destination surface");
-        return -1;
+        return SDL_SetError("SDL_BlendLine(): Passed NULL destination surface");
     }
 
     func = SDL_CalculateBlendLineFunc(dst->format);
     if (!func) {
-        SDL_SetError("SDL_BlendLine(): Unsupported surface format");
-        return -1;
+        return SDL_SetError("SDL_BlendLine(): Unsupported surface format");
     }
 
     /* Perform clipping */
@@ -742,14 +740,12 @@
     BlendLineFunc func;
 
     if (!dst) {
-        SDL_SetError("SDL_BlendLines(): Passed NULL destination surface");
-        return -1;
+        return SDL_SetError("SDL_BlendLines(): Passed NULL destination surface");
     }
 
     func = SDL_CalculateBlendLineFunc(dst->format);
     if (!func) {
-        SDL_SetError("SDL_BlendLines(): Unsupported surface format");
-        return -1;
+        return SDL_SetError("SDL_BlendLines(): Unsupported surface format");
     }
 
     for (i = 1; i < count; ++i) {
--- a/src/render/software/SDL_blendpoint.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/software/SDL_blendpoint.c	Sun Mar 31 12:48:50 2013 -0400
@@ -159,8 +159,7 @@
         }
         return 0;
     default:
-        SDL_Unsupported();
-        return -1;
+        return SDL_Unsupported();
     }
 }
 
@@ -189,8 +188,7 @@
         }
         return 0;
     default:
-        SDL_Unsupported();
-        return -1;
+        return SDL_Unsupported();
     }
 }
 
@@ -199,14 +197,12 @@
                Uint8 g, Uint8 b, Uint8 a)
 {
     if (!dst) {
-        SDL_SetError("Passed NULL destination surface");
-        return -1;
+        return SDL_SetError("Passed NULL destination surface");
     }
 
     /* This function doesn't work on surfaces < 8 bpp */
     if (dst->format->BitsPerPixel < 8) {
-        SDL_SetError("SDL_BlendPoint(): Unsupported surface format");
-        return -1;
+        return SDL_SetError("SDL_BlendPoint(): Unsupported surface format");
     }
 
     /* Perform clipping */
@@ -272,14 +268,12 @@
     int status = 0;
 
     if (!dst) {
-        SDL_SetError("Passed NULL destination surface");
-        return -1;
+        return SDL_SetError("Passed NULL destination surface");
     }
 
     /* This function doesn't work on surfaces < 8 bpp */
     if (dst->format->BitsPerPixel < 8) {
-        SDL_SetError("SDL_BlendPoints(): Unsupported surface format");
-        return (-1);
+        return SDL_SetError("SDL_BlendPoints(): Unsupported surface format");
     }
 
     if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
--- a/src/render/software/SDL_drawline.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/software/SDL_drawline.c	Sun Mar 31 12:48:50 2013 -0400
@@ -145,14 +145,12 @@
     DrawLineFunc func;
 
     if (!dst) {
-        SDL_SetError("SDL_DrawLine(): Passed NULL destination surface");
-        return -1;
+        return SDL_SetError("SDL_DrawLine(): Passed NULL destination surface");
     }
 
     func = SDL_CalculateDrawLineFunc(dst->format);
     if (!func) {
-        SDL_SetError("SDL_DrawLine(): Unsupported surface format");
-        return -1;
+        return SDL_SetError("SDL_DrawLine(): Unsupported surface format");
     }
 
     /* Perform clipping */
@@ -176,14 +174,12 @@
     DrawLineFunc func;
 
     if (!dst) {
-        SDL_SetError("SDL_DrawLines(): Passed NULL destination surface");
-        return -1;
+        return SDL_SetError("SDL_DrawLines(): Passed NULL destination surface");
     }
 
     func = SDL_CalculateDrawLineFunc(dst->format);
     if (!func) {
-        SDL_SetError("SDL_DrawLines(): Unsupported surface format");
-        return -1;
+        return SDL_SetError("SDL_DrawLines(): Unsupported surface format");
     }
 
     for (i = 1; i < count; ++i) {
--- a/src/render/software/SDL_drawpoint.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/software/SDL_drawpoint.c	Sun Mar 31 12:48:50 2013 -0400
@@ -30,14 +30,12 @@
 SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color)
 {
     if (!dst) {
-        SDL_SetError("Passed NULL destination surface");
-        return -1;
+        return SDL_SetError("Passed NULL destination surface");
     }
 
     /* This function doesn't work on surfaces < 8 bpp */
     if (dst->format->BitsPerPixel < 8) {
-        SDL_SetError("SDL_DrawPoint(): Unsupported surface format");
-        return -1;
+        return SDL_SetError("SDL_DrawPoint(): Unsupported surface format");
     }
 
     /* Perform clipping */
@@ -55,8 +53,7 @@
         DRAW_FASTSETPIXELXY2(x, y);
         break;
     case 3:
-        SDL_Unsupported();
-        return -1;
+        return SDL_Unsupported();
     case 4:
         DRAW_FASTSETPIXELXY4(x, y);
         break;
@@ -74,14 +71,12 @@
     int x, y;
 
     if (!dst) {
-        SDL_SetError("Passed NULL destination surface");
-        return -1;
+        return SDL_SetError("Passed NULL destination surface");
     }
 
     /* This function doesn't work on surfaces < 8 bpp */
     if (dst->format->BitsPerPixel < 8) {
-        SDL_SetError("SDL_DrawPoints(): Unsupported surface format");
-        return -1;
+        return SDL_SetError("SDL_DrawPoints(): Unsupported surface format");
     }
 
     minx = dst->clip_rect.x;
@@ -105,8 +100,7 @@
             DRAW_FASTSETPIXELXY2(x, y);
             break;
         case 3:
-            SDL_Unsupported();
-            return -1;
+            return SDL_Unsupported();
         case 4:
             DRAW_FASTSETPIXELXY4(x, y);
             break;
--- a/src/render/software/SDL_render_sw.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/render/software/SDL_render_sw.c	Sun Mar 31 12:48:50 2013 -0400
@@ -200,8 +200,7 @@
 
     if (!SDL_PixelFormatEnumToMasks
         (texture->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
-        SDL_SetError("Unknown texture format");
-        return -1;
+        return SDL_SetError("Unknown texture format");
     }
 
     texture->driverdata =
@@ -357,8 +356,7 @@
 
     final_points = SDL_stack_alloc(SDL_Point, count);
     if (!final_points) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     if (renderer->viewport.x || renderer->viewport.y) {
         int x = renderer->viewport.x;
@@ -407,8 +405,7 @@
 
     final_points = SDL_stack_alloc(SDL_Point, count);
     if (!final_points) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     if (renderer->viewport.x || renderer->viewport.y) {
         int x = renderer->viewport.x;
@@ -456,8 +453,7 @@
 
     final_rects = SDL_stack_alloc(SDL_Rect, count);
     if (!final_rects) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     if (renderer->viewport.x || renderer->viewport.y) {
         int x = renderer->viewport.x;
@@ -647,8 +643,7 @@
 
     if (rect->x < 0 || rect->x+rect->w > surface->w ||
         rect->y < 0 || rect->y+rect->h > surface->h) {
-        SDL_SetError("Tried to read outside of surface bounds");
-        return -1;
+        return SDL_SetError("Tried to read outside of surface bounds");
     }
 
     src_format = surface->format->format;
--- a/src/test/SDL_test_fuzzer.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/test/SDL_test_fuzzer.c	Sun Mar 31 12:48:50 2013 -0400
@@ -251,7 +251,7 @@
 
 	if (index == 0) {
 		/* There are no valid boundaries */
-		SDL_Error(SDL_UNSUPPORTED);
+		SDL_Unsupported();
 		return 0;
 	}
 
@@ -379,7 +379,7 @@
 
 	if (index == 0) {
 		/* There are no valid boundaries */
-		SDL_Error(SDL_UNSUPPORTED);
+		SDL_Unsupported();
 		return minValue;
 	}
 
--- a/src/thread/beos/SDL_syssem.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/beos/SDL_syssem.c	Sun Mar 31 12:48:50 2013 -0400
@@ -73,8 +73,7 @@
     int retval;
 
     if (!sem) {
-        SDL_SetError("Passed a NULL semaphore");
-        return -1;
+        return SDL_SetError("Passed a NULL semaphore");
     }
 
   tryagain:
@@ -97,8 +96,7 @@
         retval = SDL_MUTEX_TIMEDOUT;
         break;
     default:
-        SDL_SetError("acquire_sem() failed");
-        retval = -1;
+        retval = SDL_SetError("acquire_sem() failed");
         break;
     }
 
@@ -139,13 +137,11 @@
 SDL_SemPost(SDL_sem * sem)
 {
     if (!sem) {
-        SDL_SetError("Passed a NULL semaphore");
-        return -1;
+        return SDL_SetError("Passed a NULL semaphore");
     }
 
     if (release_sem(sem->id) != B_NO_ERROR) {
-        SDL_SetError("release_sem() failed");
-        return -1;
+        return SDL_SetError("release_sem() failed");
     }
     return 0;
 }
--- a/src/thread/beos/SDL_systhread.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/beos/SDL_systhread.c	Sun Mar 31 12:48:50 2013 -0400
@@ -77,8 +77,7 @@
     thread->handle = spawn_thread(RunThread, name, B_NORMAL_PRIORITY, args);
     if ((thread->handle == B_NO_MORE_THREADS) ||
         (thread->handle == B_NO_MEMORY)) {
-        SDL_SetError("Not enough resources to create thread");
-        return (-1);
+        return SDL_SetError("Not enough resources to create thread");
     }
     resume_thread(thread->handle);
     return (0);
--- a/src/thread/generic/SDL_syscond.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/generic/SDL_syscond.c	Sun Mar 31 12:48:50 2013 -0400
@@ -82,8 +82,7 @@
 SDL_CondSignal(SDL_cond * cond)
 {
     if (!cond) {
-        SDL_SetError("Passed a NULL condition variable");
-        return -1;
+        return SDL_SetError("Passed a NULL condition variable");
     }
 
     /* If there are waiting threads not already signalled, then
@@ -107,8 +106,7 @@
 SDL_CondBroadcast(SDL_cond * cond)
 {
     if (!cond) {
-        SDL_SetError("Passed a NULL condition variable");
-        return -1;
+        return SDL_SetError("Passed a NULL condition variable");
     }
 
     /* If there are waiting threads not already signalled, then
@@ -164,8 +162,7 @@
     int retval;
 
     if (!cond) {
-        SDL_SetError("Passed a NULL condition variable");
-        return -1;
+        return SDL_SetError("Passed a NULL condition variable");
     }
 
     /* Obtain the protection mutex, and increment the number of waiters.
--- a/src/thread/generic/SDL_sysmutex.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/generic/SDL_sysmutex.c	Sun Mar 31 12:48:50 2013 -0400
@@ -78,8 +78,7 @@
     SDL_threadID this_thread;
 
     if (mutex == NULL) {
-        SDL_SetError("Passed a NULL mutex");
-        return -1;
+        return SDL_SetError("Passed a NULL mutex");
     }
 
     this_thread = SDL_ThreadID();
@@ -110,8 +109,7 @@
     SDL_threadID this_thread;
 
     if (mutex == NULL) {
-        SDL_SetError("Passed a NULL mutex");
-        return -1;
+        return SDL_SetError("Passed a NULL mutex");
     }
 
     this_thread = SDL_ThreadID();
@@ -141,14 +139,12 @@
     return 0;
 #else
     if (mutex == NULL) {
-        SDL_SetError("Passed a NULL mutex");
-        return -1;
+        return SDL_SetError("Passed a NULL mutex");
     }
 
     /* If we don't own the mutex, we can't unlock it */
     if (SDL_ThreadID() != mutex->owner) {
-        SDL_SetError("mutex not owned by this thread");
-        return -1;
+        return SDL_SetError("mutex not owned by this thread");
     }
 
     if (mutex->recursive) {
--- a/src/thread/generic/SDL_syssem.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/generic/SDL_syssem.c	Sun Mar 31 12:48:50 2013 -0400
@@ -39,28 +39,24 @@
 void
 SDL_DestroySemaphore(SDL_sem * sem)
 {
-    return;
 }
 
 int
 SDL_SemTryWait(SDL_sem * sem)
 {
-    SDL_SetError("SDL not configured with thread support");
-    return -1;
+    return SDL_SetError("SDL not configured with thread support");
 }
 
 int
 SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
 {
-    SDL_SetError("SDL not configured with thread support");
-    return -1;
+    return SDL_SetError("SDL not configured with thread support");
 }
 
 int
 SDL_SemWait(SDL_sem * sem)
 {
-    SDL_SetError("SDL not configured with thread support");
-    return -1;
+    return SDL_SetError("SDL not configured with thread support");
 }
 
 Uint32
@@ -72,8 +68,7 @@
 int
 SDL_SemPost(SDL_sem * sem)
 {
-    SDL_SetError("SDL not configured with thread support");
-    return -1;
+    return SDL_SetError("SDL not configured with thread support");
 }
 
 #else
@@ -137,8 +132,7 @@
     int retval;
 
     if (!sem) {
-        SDL_SetError("Passed a NULL semaphore");
-        return -1;
+        return SDL_SetError("Passed a NULL semaphore");
     }
 
     retval = SDL_MUTEX_TIMEDOUT;
@@ -158,8 +152,7 @@
     int retval;
 
     if (!sem) {
-        SDL_SetError("Passed a NULL semaphore");
-        return -1;
+        return SDL_SetError("Passed a NULL semaphore");
     }
 
     /* A timeout of 0 is an easy case */
@@ -207,8 +200,7 @@
 SDL_SemPost(SDL_sem * sem)
 {
     if (!sem) {
-        SDL_SetError("Passed a NULL semaphore");
-        return -1;
+        return SDL_SetError("Passed a NULL semaphore");
     }
 
     SDL_LockMutex(sem->count_lock);
--- a/src/thread/generic/SDL_systhread.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/generic/SDL_systhread.c	Sun Mar 31 12:48:50 2013 -0400
@@ -28,8 +28,7 @@
 int
 SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
 {
-    SDL_SetError("Threads are not supported on this platform");
-    return (-1);
+    return SDL_SetError("Threads are not supported on this platform");
 }
 
 void
--- a/src/thread/psp/SDL_syscond.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/psp/SDL_syscond.c	Sun Mar 31 12:48:50 2013 -0400
@@ -82,8 +82,7 @@
 SDL_CondSignal(SDL_cond * cond)
 {
     if (!cond) {
-        SDL_SetError("Passed a NULL condition variable");
-        return -1;
+        return SDL_SetError("Passed a NULL condition variable");
     }
 
     /* If there are waiting threads not already signalled, then
@@ -107,8 +106,7 @@
 SDL_CondBroadcast(SDL_cond * cond)
 {
     if (!cond) {
-        SDL_SetError("Passed a NULL condition variable");
-        return -1;
+        return SDL_SetError("Passed a NULL condition variable");
     }
 
     /* If there are waiting threads not already signalled, then
@@ -164,8 +162,7 @@
     int retval;
 
     if (!cond) {
-        SDL_SetError("Passed a NULL condition variable");
-        return -1;
+        return SDL_SetError("Passed a NULL condition variable");
     }
 
     /* Obtain the protection mutex, and increment the number of waiters.
--- a/src/thread/psp/SDL_sysmutex.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/psp/SDL_sysmutex.c	Sun Mar 31 12:48:50 2013 -0400
@@ -78,8 +78,7 @@
     SDL_threadID this_thread;
 
     if (mutex == NULL) {
-        SDL_SetError("Passed a NULL mutex");
-        return -1;
+        return SDL_SetError("Passed a NULL mutex");
     }
 
     this_thread = SDL_ThreadID();
@@ -107,14 +106,12 @@
     return 0;
 #else
     if (mutex == NULL) {
-        SDL_SetError("Passed a NULL mutex");
-        return -1;
+        return SDL_SetError("Passed a NULL mutex");
     }
 
     /* If we don't own the mutex, we can't unlock it */
     if (SDL_ThreadID() != mutex->owner) {
-        SDL_SetError("mutex not owned by this thread");
-        return -1;
+        return SDL_SetError("mutex not owned by this thread");
     }
 
     if (mutex->recursive) {
--- a/src/thread/psp/SDL_syssem.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/psp/SDL_syssem.c	Sun Mar 31 12:48:50 2013 -0400
@@ -105,8 +105,7 @@
                case SCE_KERNEL_ERROR_WAIT_TIMEOUT:
                        return SDL_MUTEX_TIMEDOUT;
                default:
-                       SDL_SetError("WaitForSingleObject() failed");
-                       return -1;
+                       return SDL_SetError("WaitForSingleObject() failed");
 	}
 }
 
@@ -142,14 +141,12 @@
 	int res;
 
 	if (sem == NULL) {
-		SDL_SetError("Passed a NULL sem");
-		return -1;
+		return SDL_SetError("Passed a NULL sem");
 	}
 
 	res = sceKernelSignalSema(sem->semid, 1);
 	if (res < 0) {
-		SDL_SetError("sceKernelSignalSema() failed");
-		return -1;
+		return SDL_SetError("sceKernelSignalSema() failed");
 	}
 
 	return 0;
--- a/src/thread/psp/SDL_systhread.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/psp/SDL_systhread.c	Sun Mar 31 12:48:50 2013 -0400
@@ -54,8 +54,7 @@
 					       priority, 0x8000, 
 					       PSP_THREAD_ATTR_VFPU, NULL);
 	if (thread->handle < 0) {
-		SDL_SetError("sceKernelCreateThread() failed");
-		return -1;
+		return SDL_SetError("sceKernelCreateThread() failed");
 	}
 
 	sceKernelStartThread(thread->handle, 4, &args);
--- a/src/thread/pthread/SDL_syscond.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/pthread/SDL_syscond.c	Sun Mar 31 12:48:50 2013 -0400
@@ -67,14 +67,12 @@
     int retval;
 
     if (!cond) {
-        SDL_SetError("Passed a NULL condition variable");
-        return -1;
+        return SDL_SetError("Passed a NULL condition variable");
     }
 
     retval = 0;
     if (pthread_cond_signal(&cond->cond) != 0) {
-        SDL_SetError("pthread_cond_signal() failed");
-        retval = -1;
+        return SDL_SetError("pthread_cond_signal() failed");
     }
     return retval;
 }
@@ -86,14 +84,12 @@
     int retval;
 
     if (!cond) {
-        SDL_SetError("Passed a NULL condition variable");
-        return -1;
+        return SDL_SetError("Passed a NULL condition variable");
     }
 
     retval = 0;
     if (pthread_cond_broadcast(&cond->cond) != 0) {
-        SDL_SetError("pthread_cond_broadcast() failed");
-        retval = -1;
+        return SDL_SetError("pthread_cond_broadcast() failed");
     }
     return retval;
 }
@@ -106,8 +102,7 @@
     struct timespec abstime;
 
     if (!cond) {
-        SDL_SetError("Passed a NULL condition variable");
-        return -1;
+        return SDL_SetError("Passed a NULL condition variable");
     }
 
     gettimeofday(&delta, NULL);
@@ -131,9 +126,7 @@
     case 0:
         break;
     default:
-        SDL_SetError("pthread_cond_timedwait() failed");
-        retval = -1;
-        break;
+        retval = SDL_SetError("pthread_cond_timedwait() failed");
     }
     return retval;
 }
@@ -144,19 +137,12 @@
 int
 SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
 {
-    int retval;
-
     if (!cond) {
-        SDL_SetError("Passed a NULL condition variable");
-        return -1;
+        return SDL_SetError("Passed a NULL condition variable");
+    } else if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) {
+        return SDL_SetError("pthread_cond_wait() failed");
     }
-
-    retval = 0;
-    if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) {
-        SDL_SetError("pthread_cond_wait() failed");
-        retval = -1;
-    }
-    return retval;
+    return 0;
 }
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/pthread/SDL_sysmutex.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/pthread/SDL_sysmutex.c	Sun Mar 31 12:48:50 2013 -0400
@@ -81,17 +81,14 @@
 int
 SDL_LockMutex(SDL_mutex * mutex)
 {
-    int retval;
 #if FAKE_RECURSIVE_MUTEX
     pthread_t this_thread;
 #endif
 
     if (mutex == NULL) {
-        SDL_SetError("Passed a NULL mutex");
-        return -1;
+        return SDL_SetError("Passed a NULL mutex");
     }
 
-    retval = 0;
 #if FAKE_RECURSIVE_MUTEX
     this_thread = pthread_self();
     if (mutex->owner == this_thread) {
@@ -105,17 +102,15 @@
             mutex->owner = this_thread;
             mutex->recursive = 0;
         } else {
-            SDL_SetError("pthread_mutex_lock() failed");
-            retval = -1;
+            return SDL_SetError("pthread_mutex_lock() failed");
         }
     }
 #else
     if (pthread_mutex_lock(&mutex->id) < 0) {
-        SDL_SetError("pthread_mutex_lock() failed");
-        retval = -1;
+        return SDL_SetError("pthread_mutex_lock() failed");
     }
 #endif
-    return retval;
+    return 0;
 }
 
 int
@@ -127,8 +122,7 @@
 #endif
 
     if (mutex == NULL) {
-        SDL_SetError("Passed a NULL mutex");
-        return -1;
+        return SDL_SetError("Passed a NULL mutex");
     }
 
     retval = 0;
@@ -147,8 +141,7 @@
         } else if (errno == EBUSY) {
             retval = SDL_MUTEX_TIMEDOUT;
         } else {
-            SDL_SetError("pthread_mutex_trylock() failed");
-            retval = -1;
+            retval = SDL_SetError("pthread_mutex_trylock() failed");
         }
     }
 #else
@@ -156,8 +149,7 @@
         if (errno == EBUSY) {
             retval = SDL_MUTEX_TIMEDOUT;
         } else {
-            SDL_SetError("pthread_mutex_trylock() failed");
-            retval = -1;
+            retval = SDL_SetError("pthread_mutex_trylock() failed");
         }
     }
 #endif
@@ -167,14 +159,10 @@
 int
 SDL_UnlockMutex(SDL_mutex * mutex)
 {
-    int retval;
-
     if (mutex == NULL) {
-        SDL_SetError("Passed a NULL mutex");
-        return -1;
+        return SDL_SetError("Passed a NULL mutex");
     }
 
-    retval = 0;
 #if FAKE_RECURSIVE_MUTEX
     /* We can only unlock the mutex if we own it */
     if (pthread_self() == mutex->owner) {
@@ -190,18 +178,16 @@
             pthread_mutex_unlock(&mutex->id);
         }
     } else {
-        SDL_SetError("mutex not owned by this thread");
-        retval = -1;
+        return SDL_SetError("mutex not owned by this thread");
     }
 
 #else
     if (pthread_mutex_unlock(&mutex->id) < 0) {
-        SDL_SetError("pthread_mutex_unlock() failed");
-        retval = -1;
+        return SDL_SetError("pthread_mutex_unlock() failed");
     }
 #endif /* FAKE_RECURSIVE_MUTEX */
 
-    return retval;
+    return 0;
 }
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/thread/pthread/SDL_syssem.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/pthread/SDL_syssem.c	Sun Mar 31 12:48:50 2013 -0400
@@ -72,8 +72,7 @@
     int retval;
 
     if (!sem) {
-        SDL_SetError("Passed a NULL semaphore");
-        return -1;
+        return SDL_SetError("Passed a NULL semaphore");
     }
     retval = SDL_MUTEX_TIMEDOUT;
     if (sem_trywait(&sem->sem) == 0) {
@@ -88,13 +87,12 @@
     int retval;
 
     if (!sem) {
-        SDL_SetError("Passed a NULL semaphore");
-        return -1;
+        return SDL_SetError("Passed a NULL semaphore");
     }
 
     retval = sem_wait(&sem->sem);
     if (retval < 0) {
-        SDL_SetError("sem_wait() failed");
+        retval = SDL_SetError("sem_wait() failed");
     }
     return retval;
 }
@@ -111,8 +109,7 @@
 #endif
 
     if (!sem) {
-        SDL_SetError("Passed a NULL semaphore");
-        return -1;
+        return SDL_SetError("Passed a NULL semaphore");
     }
 
     /* Try the easy cases first */
@@ -188,8 +185,7 @@
     int retval;
 
     if (!sem) {
-        SDL_SetError("Passed a NULL semaphore");
-        return -1;
+        return SDL_SetError("Passed a NULL semaphore");
     }
 
     retval = sem_post(&sem->sem);
--- a/src/thread/pthread/SDL_systhread.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/pthread/SDL_systhread.c	Sun Mar 31 12:48:50 2013 -0400
@@ -97,18 +97,16 @@
 
     /* Set the thread attributes */
     if (pthread_attr_init(&type) != 0) {
-        SDL_SetError("Couldn't initialize pthread attributes");
-        return (-1);
+        return SDL_SetError("Couldn't initialize pthread attributes");
     }
     pthread_attr_setdetachstate(&type, PTHREAD_CREATE_JOINABLE);
 
     /* Create the thread and go! */
     if (pthread_create(&thread->handle, &type, RunThread, args) != 0) {
-        SDL_SetError("Not enough resources to create thread");
-        return (-1);
+        return SDL_SetError("Not enough resources to create thread");
     }
 
-    return (0);
+    return 0;
 }
 
 void
@@ -173,8 +171,7 @@
         /* Note that this fails if you're trying to set high priority
            and you don't have root permission. BUT DON'T RUN AS ROOT!
          */
-        SDL_SetError("setpriority() failed");
-        return -1;
+        return SDL_SetError("setpriority() failed");
     }
     return 0;
 #else
@@ -183,8 +180,7 @@
     pthread_t thread = pthread_self();
 
     if (pthread_getschedparam(thread, &policy, &sched) < 0) {
-        SDL_SetError("pthread_getschedparam() failed");
-        return -1;
+        return SDL_SetError("pthread_getschedparam() failed");
     }
     if (priority == SDL_THREAD_PRIORITY_LOW) {
         sched.sched_priority = sched_get_priority_min(policy);
@@ -196,8 +192,7 @@
         sched.sched_priority = (min_priority + (max_priority - min_priority) / 2);
     }
     if (pthread_setschedparam(thread, policy, &sched) < 0) {
-        SDL_SetError("pthread_setschedparam() failed");
-        return -1;
+        return SDL_SetError("pthread_setschedparam() failed");
     }
     return 0;
 #endif /* linux */
--- a/src/thread/windows/SDL_sysmutex.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/windows/SDL_sysmutex.c	Sun Mar 31 12:48:50 2013 -0400
@@ -67,8 +67,7 @@
 SDL_LockMutex(SDL_mutex * mutex)
 {
     if (mutex == NULL) {
-        SDL_SetError("Passed a NULL mutex");
-        return -1;
+        return SDL_SetError("Passed a NULL mutex");
     }
 
     EnterCriticalSection(&mutex->cs);
@@ -81,8 +80,7 @@
 {
     int retval = 0;
     if (mutex == NULL) {
-        SDL_SetError("Passed a NULL mutex");
-        return -1;
+        return SDL_SetError("Passed a NULL mutex");
     }
 
     if (TryEnterCriticalSection(&mutex->cs) == 0) {
@@ -96,8 +94,7 @@
 SDL_UnlockMutex(SDL_mutex * mutex)
 {
     if (mutex == NULL) {
-        SDL_SetError("Passed a NULL mutex");
-        return -1;
+        return SDL_SetError("Passed a NULL mutex");
     }
 
     LeaveCriticalSection(&mutex->cs);
--- a/src/thread/windows/SDL_syssem.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/windows/SDL_syssem.c	Sun Mar 31 12:48:50 2013 -0400
@@ -78,8 +78,7 @@
     DWORD dwMilliseconds;
 
     if (!sem) {
-        SDL_SetError("Passed a NULL sem");
-        return -1;
+        return SDL_SetError("Passed a NULL sem");
     }
 
     if (timeout == SDL_MUTEX_MAXWAIT) {
@@ -96,8 +95,7 @@
         retval = SDL_MUTEX_TIMEDOUT;
         break;
     default:
-        SDL_SetError("WaitForSingleObject() failed");
-        retval = -1;
+        retval = SDL_SetError("WaitForSingleObject() failed");
         break;
     }
     return retval;
@@ -130,8 +128,7 @@
 SDL_SemPost(SDL_sem * sem)
 {
     if (!sem) {
-        SDL_SetError("Passed a NULL sem");
-        return -1;
+        return SDL_SetError("Passed a NULL sem");
     }
     /* Increase the counter in the first place, because
      * after a successful release the semaphore may
@@ -141,8 +138,7 @@
     InterlockedIncrement(&sem->count);
     if (ReleaseSemaphore(sem->id, 1, NULL) == FALSE) {
         InterlockedDecrement(&sem->count);      /* restore */
-        SDL_SetError("ReleaseSemaphore() failed");
-        return -1;
+        return SDL_SetError("ReleaseSemaphore() failed");
     }
     return 0;
 }
--- a/src/thread/windows/SDL_systhread.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/thread/windows/SDL_systhread.c	Sun Mar 31 12:48:50 2013 -0400
@@ -116,8 +116,7 @@
     pThreadStartParms pThreadParms =
         (pThreadStartParms) SDL_malloc(sizeof(tThreadStartParms));
     if (!pThreadParms) {
-        SDL_OutOfMemory();
-        return (-1);
+        return SDL_OutOfMemory();
     }
     // Save the function which we will have to call to clear the RTL of calling app!
     pThreadParms->pfnCurrentEndThread = pfnEndThread;
@@ -135,10 +134,9 @@
                                       pThreadParms, 0, &threadid);
     }
     if (thread->handle == NULL) {
-        SDL_SetError("Not enough resources to create thread");
-        return (-1);
+        return SDL_SetError("Not enough resources to create thread");
     }
-    return (0);
+    return 0;
 }
 
 #ifdef _MSC_VER
@@ -198,8 +196,7 @@
         value = THREAD_PRIORITY_NORMAL;
     }
     if (!SetThreadPriority(GetCurrentThread(), value)) {
-        WIN_SetError("SetThreadPriority()");
-        return -1;
+        return WIN_SetError("SetThreadPriority()");
     }
     return 0;
 }
--- a/src/video/SDL_RLEaccel.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/SDL_RLEaccel.c	Sun Mar 31 12:48:50 2013 -0400
@@ -1087,8 +1087,7 @@
     maxsize += sizeof(RLEDestFormat);
     rlebuf = (Uint8 *) SDL_malloc(maxsize);
     if (!rlebuf) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     {
         /* save the destination format so we can undo the encoding later */
@@ -1299,8 +1298,7 @@
 
     rlebuf = (Uint8 *) SDL_malloc(maxsize);
     if (rlebuf == NULL) {
-        SDL_OutOfMemory();
-        return (-1);
+        return SDL_OutOfMemory();
     }
 
     /* Set up the conversion */
--- a/src/video/SDL_blit.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/SDL_blit.c	Sun Mar 31 12:48:50 2013 -0400
@@ -270,11 +270,10 @@
     /* Make sure we have a blit function */
     if (blit == NULL) {
         SDL_InvalidateMap(map);
-        SDL_SetError("Blit combination not supported");
-        return (-1);
+        return SDL_SetError("Blit combination not supported");
     }
 
-    return (0);
+    return 0;
 }
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_fillrect.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/SDL_fillrect.c	Sun Mar 31 12:48:50 2013 -0400
@@ -315,14 +315,12 @@
     Uint8 *pixels;
 
     if (!dst) {
-        SDL_SetError("Passed NULL destination surface");
-        return -1;
+        return SDL_SetError("Passed NULL destination surface");
     }
 
     /* This function doesn't work on surfaces < 8 bpp */
     if (dst->format->BitsPerPixel < 8) {
-        SDL_SetError("SDL_FillRect(): Unsupported surface format");
-        return -1;
+        return SDL_SetError("SDL_FillRect(): Unsupported surface format");
     }
 
     /* If 'rect' == NULL, then fill the whole surface */
@@ -338,8 +336,7 @@
 
     /* Perform software fill */
     if (!dst->pixels) {
-        SDL_SetError("SDL_FillRect(): You must lock the surface");
-        return (-1);
+        return SDL_SetError("SDL_FillRect(): You must lock the surface");
     }
 
     pixels = (Uint8 *) dst->pixels + rect->y * dst->pitch +
@@ -423,8 +420,7 @@
     int status = 0;
 
     if (!rects) {
-        SDL_SetError("SDL_FillRects() passed NULL rects");
-        return -1;
+        return SDL_SetError("SDL_FillRects() passed NULL rects");
     }
 
     for (i = 0; i < count; ++i) {
--- a/src/video/SDL_pixels.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/SDL_pixels.c	Sun Mar 31 12:48:50 2013 -0400
@@ -638,13 +638,11 @@
 SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette)
 {
     if (!format) {
-        SDL_SetError("SDL_SetPixelFormatPalette() passed NULL format");
-        return -1;
+        return SDL_SetError("SDL_SetPixelFormatPalette() passed NULL format");
     }
 
     if (palette && palette->ncolors != (1 << format->BitsPerPixel)) {
-        SDL_SetError("SDL_SetPixelFormatPalette() passed a palette that doesn't match the format");
-        return -1;
+        return SDL_SetError("SDL_SetPixelFormatPalette() passed a palette that doesn't match the format");
     }
 
     if (format->palette == palette) {
--- a/src/video/SDL_stretch.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/SDL_stretch.c	Sun Mar 31 12:48:50 2013 -0400
@@ -102,14 +102,12 @@
         store = STORE_WORD;
         break;
     default:
-        SDL_SetError("ASM stretch of %d bytes isn't supported\n", bpp);
-        return (-1);
+        return SDL_SetError("ASM stretch of %d bytes isn't supported\n", bpp);
     }
 #ifdef HAVE_MPROTECT
     /* Make the code writeable */
     if (mprotect(copy_row, sizeof(copy_row), PROT_READ | PROT_WRITE) < 0) {
-        SDL_SetError("Couldn't make copy buffer writeable");
-        return (-1);
+        return SDL_SetError("Couldn't make copy buffer writeable");
     }
 #endif
     pos = 0x10000;
@@ -141,8 +139,7 @@
 #ifdef HAVE_MPROTECT
     /* Make the code executable but not writeable */
     if (mprotect(copy_row, sizeof(copy_row), PROT_READ | PROT_EXEC) < 0) {
-        SDL_SetError("Couldn't make copy buffer executable");
-        return (-1);
+        return SDL_SetError("Couldn't make copy buffer executable");
     }
 #endif
     last.status = 0;
@@ -224,8 +221,7 @@
     const int bpp = dst->format->BytesPerPixel;
 
     if (src->format->BitsPerPixel != dst->format->BitsPerPixel) {
-        SDL_SetError("Only works with same format surfaces");
-        return (-1);
+        return SDL_SetError("Only works with same format surfaces");
     }
 
     /* Verify the blit rectangles */
@@ -233,8 +229,7 @@
         if ((srcrect->x < 0) || (srcrect->y < 0) ||
             ((srcrect->x + srcrect->w) > src->w) ||
             ((srcrect->y + srcrect->h) > src->h)) {
-            SDL_SetError("Invalid source blit rectangle");
-            return (-1);
+            return SDL_SetError("Invalid source blit rectangle");
         }
     } else {
         full_src.x = 0;
@@ -247,8 +242,7 @@
         if ((dstrect->x < 0) || (dstrect->y < 0) ||
             ((dstrect->x + dstrect->w) > dst->w) ||
             ((dstrect->y + dstrect->h) > dst->h)) {
-            SDL_SetError("Invalid destination blit rectangle");
-            return (-1);
+            return SDL_SetError("Invalid destination blit rectangle");
         }
     } else {
         full_dst.x = 0;
@@ -262,8 +256,7 @@
     dst_locked = 0;
     if (SDL_MUSTLOCK(dst)) {
         if (SDL_LockSurface(dst) < 0) {
-            SDL_SetError("Unable to lock destination surface");
-            return (-1);
+            return SDL_SetError("Unable to lock destination surface");
         }
         dst_locked = 1;
     }
@@ -274,8 +267,7 @@
             if (dst_locked) {
                 SDL_UnlockSurface(dst);
             }
-            SDL_SetError("Unable to lock source surface");
-            return (-1);
+            return SDL_SetError("Unable to lock source surface");
         }
         src_locked = 1;
     }
--- a/src/video/SDL_surface.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/SDL_surface.c	Sun Mar 31 12:48:50 2013 -0400
@@ -143,8 +143,7 @@
 SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette)
 {
     if (!surface) {
-        SDL_SetError("SDL_SetSurfacePalette() passed a NULL surface");
-        return -1;
+        return SDL_SetError("SDL_SetSurfacePalette() passed a NULL surface");
     }
     return SDL_SetPixelFormatPalette(surface->format, palette);
 }
@@ -402,8 +401,7 @@
         surface->map->info.flags |= SDL_COPY_MOD;
         break;
     default:
-        SDL_Unsupported();
-        status = -1;
+        status = SDL_Unsupported();
         break;
     }
 
@@ -518,12 +516,10 @@
 
     /* Make sure the surfaces aren't locked */
     if (!src || !dst) {
-        SDL_SetError("SDL_UpperBlit: passed a NULL surface");
-        return (-1);
+        return SDL_SetError("SDL_UpperBlit: passed a NULL surface");
     }
     if (src->locked || dst->locked) {
-        SDL_SetError("Surfaces must not be locked during blit");
-        return (-1);
+        return SDL_SetError("Surfaces must not be locked during blit");
     }
 
     /* If the destination rectangle is NULL, use the entire dest surface */
@@ -610,12 +606,10 @@
 
     /* Make sure the surfaces aren't locked */
     if (!src || !dst) {
-        SDL_SetError("SDL_UpperBlitScaled: passed a NULL surface");
-        return (-1);
+        return SDL_SetError("SDL_UpperBlitScaled: passed a NULL surface");
     }
     if (src->locked || dst->locked) {
-        SDL_SetError("Surfaces must not be locked during blit");
-        return (-1);
+        return SDL_SetError("Surfaces must not be locked during blit");
     }
 
     /* If the destination rectangle is NULL, use the entire dest surface */
@@ -972,12 +966,10 @@
 
     /* Check to make sure we are bliting somewhere, so we don't crash */
     if (!dst) {
-        SDL_InvalidParamError("dst");
-        return -1;
+        return SDL_InvalidParamError("dst");
     }
     if (!dst_pitch) {
-        SDL_InvalidParamError("dst_pitch");
-        return -1;
+        return SDL_InvalidParamError("dst_pitch");
     }
 
     /* Fast path for same format copy */
@@ -994,8 +986,7 @@
                 bpp = 2;
                 break;
             default:
-                SDL_SetError("Unknown FOURCC pixel format");
-                return -1;
+                return SDL_SetError("Unknown FOURCC pixel format");
             }
         } else {
             bpp = SDL_BYTESPERPIXEL(src_format);
--- a/src/video/SDL_video.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/SDL_video.c	Sun Mar 31 12:48:50 2013 -0400
@@ -242,16 +242,14 @@
             }
         }
         if (!renderer) {
-            SDL_SetError("No hardware accelerated renderers available");
-            return -1;
+            return SDL_SetError("No hardware accelerated renderers available");
         }
 
         /* Create the data after we successfully create the renderer (bug #1116) */
         data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data));
         if (!data) {
             SDL_DestroyRenderer(renderer);
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, data);
 
@@ -294,8 +292,7 @@
     data->pitch = (((window->w * data->bytes_per_pixel) + 3) & ~3);
     data->pixels = SDL_malloc(window->h * data->pitch);
     if (!data->pixels) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     *pixels = data->pixels;
@@ -316,8 +313,7 @@
 
     data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA);
     if (!data || !data->texture) {
-        SDL_SetError("No window texture data");
-        return -1;
+        return SDL_SetError("No window texture data");
     }
 
     /* Update a single rect that contains subrects for best DMA performance */
@@ -384,10 +380,10 @@
     return 0;
 }
 
-static void
+static int
 SDL_UninitializedVideo()
 {
-    SDL_SetError("Video subsystem has not been initialized");
+    return SDL_SetError("Video subsystem has not been initialized");
 }
 
 int
@@ -454,11 +450,9 @@
     }
     if (video == NULL) {
         if (driver_name) {
-            SDL_SetError("%s not available", driver_name);
-        } else {
-            SDL_SetError("No available video device");
+            return SDL_SetError("%s not available", driver_name);
         }
-        return -1;
+        return SDL_SetError("No available video device");
     }
     _this = video;
     _this->name = bootstrap[i]->name;
@@ -510,9 +504,8 @@
 
     /* Make sure some displays were added */
     if (_this->num_displays == 0) {
-        SDL_SetError("The video driver did not add any displays");
         SDL_VideoQuit();
-        return (-1);
+        return SDL_SetError("The video driver did not add any displays");
     }
 
     /* Add the renderer framebuffer emulation if desired */
@@ -721,9 +714,8 @@
 
     display = &_this->displays[displayIndex];
     if (index < 0 || index >= SDL_GetNumDisplayModesForDisplay(display)) {
-        SDL_SetError("index must be in the range of 0 - %d",
-                     SDL_GetNumDisplayModesForDisplay(display) - 1);
-        return -1;
+        return SDL_SetError("index must be in the range of 0 - %d",
+                            SDL_GetNumDisplayModesForDisplay(display) - 1);
     }
     if (mode) {
         *mode = display->display_modes[index];
@@ -904,9 +896,8 @@
 
         /* Get a good video mode, the closest one possible */
         if (!SDL_GetClosestDisplayModeForDisplay(display, &display_mode, &display_mode)) {
-            SDL_SetError("No video mode large enough for %dx%d",
-                         display_mode.w, display_mode.h);
-            return -1;
+            return SDL_SetError("No video mode large enough for %dx%d",
+                                display_mode.w, display_mode.h);
         }
     } else {
         display_mode = display->desktop_mode;
@@ -920,8 +911,7 @@
 
     /* Actually change the display mode */
     if (!_this->SetDisplayMode) {
-        SDL_SetError("Video driver doesn't support changing display mode");
-        return -1;
+        return SDL_SetError("Video driver doesn't support changing display mode");
     }
     if (_this->SetDisplayMode(_this, display, &display_mode) < 0) {
         return -1;
@@ -1021,8 +1011,7 @@
 	SDL_VideoDisplay *display;
 
     if (!mode) {
-      SDL_InvalidParamError("mode");
-      return -1;
+      return SDL_InvalidParamError("mode");
     }
     
     CHECK_WINDOW_MAGIC(window, -1);
@@ -1045,8 +1034,7 @@
 	else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window),
                                              &fullscreen_mode,
                                              &fullscreen_mode)) {
-        SDL_SetError("Couldn't find display mode match");
-        return -1;
+        return SDL_SetError("Couldn't find display mode match");
     }
 
     if (mode) {
@@ -1299,8 +1287,7 @@
     char *title = window->title;
 
     if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
-        SDL_SetError("No OpenGL support in video driver");
-        return -1;
+        return SDL_SetError("No OpenGL support in video driver");
     }
 
     if (window->flags & SDL_WINDOW_FOREIGN) {
@@ -1847,8 +1834,7 @@
     CHECK_WINDOW_MAGIC(window, -1);
 
     if (!window->surface_valid) {
-        SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");
-        return -1;
+        return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");
     }
 
     return _this->UpdateWindowFramebuffer(_this, window, rects, numrects);
@@ -1886,8 +1872,7 @@
     CHECK_WINDOW_MAGIC(window, -1);
 
     if (!_this->SetWindowGammaRamp) {
-        SDL_Unsupported();
-        return -1;
+        return SDL_Unsupported();
     }
 
     if (!window->gamma) {
@@ -1924,8 +1909,7 @@
 
         window->gamma = (Uint16 *)SDL_malloc(256*6*sizeof(Uint16));
         if (!window->gamma) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         window->saved_gamma = window->gamma + 3*256;
 
@@ -2266,19 +2250,16 @@
     int retval;
 
     if (!_this) {
-        SDL_UninitializedVideo();
-        return -1;
+        return SDL_UninitializedVideo();
     }
     if (_this->gl_config.driver_loaded) {
         if (path && SDL_strcmp(path, _this->gl_config.driver_path) != 0) {
-            SDL_SetError("OpenGL library already loaded");
-            return -1;
+            return SDL_SetError("OpenGL library already loaded");
         }
         retval = 0;
     } else {
         if (!_this->GL_LoadLibrary) {
-            SDL_SetError("No dynamic GL support in video driver");
-            return -1;
+            return  SDL_SetError("No dynamic GL support in video driver");
         }
         retval = _this->GL_LoadLibrary(_this, path);
     }
@@ -2388,8 +2369,7 @@
     int retval;
 
     if (!_this) {
-        SDL_UninitializedVideo();
-        return -1;
+        return SDL_UninitializedVideo();
     }
     retval = 0;
     switch (attr) {
@@ -2458,8 +2438,7 @@
 		      SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG |
 		      SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG |
 		      SDL_GL_CONTEXT_RESET_ISOLATION_FLAG) ) {
-	    SDL_SetError("Unknown OpenGL context flag %d", value);
-	    retval = -1;
+	    retval = SDL_SetError("Unknown OpenGL context flag %d", value);
 	    break;
 	}
         _this->gl_config.flags = value;
@@ -2469,8 +2448,7 @@
 	    value != SDL_GL_CONTEXT_PROFILE_CORE &&
 	    value != SDL_GL_CONTEXT_PROFILE_COMPATIBILITY &&
 	    value != SDL_GL_CONTEXT_PROFILE_ES ) {
-	    SDL_SetError("Unknown OpenGL context profile %d", value);
-	    retval = -1;
+	    retval = SDL_SetError("Unknown OpenGL context profile %d", value);
 	    break;
 	}
         _this->gl_config.profile_mask = value;
@@ -2479,14 +2457,12 @@
         _this->gl_config.share_with_current_context = value;
 	break;
     default:
-        SDL_SetError("Unknown OpenGL attribute");
-        retval = -1;
+        retval = SDL_SetError("Unknown OpenGL attribute");
         break;
     }
     return retval;
 #else
-    SDL_Unsupported();
-    return -1;
+    return SDL_Unsupported();
 #endif /* SDL_VIDEO_OPENGL */
 }
 
@@ -2645,36 +2621,22 @@
             return 0;
         }
     default:
-        SDL_SetError("Unknown OpenGL attribute");
-        return -1;
+        return SDL_SetError("Unknown OpenGL attribute");
     }
 
     glGetIntegervFunc(attrib, (GLint *) value);
     error = glGetErrorFunc();
     if (error != GL_NO_ERROR) {
-        switch (error) {
-        case GL_INVALID_ENUM:
-            {
-                SDL_SetError("OpenGL error: GL_INVALID_ENUM");
-            }
-            break;
-        case GL_INVALID_VALUE:
-            {
-                SDL_SetError("OpenGL error: GL_INVALID_VALUE");
-            }
-            break;
-        default:
-            {
-                SDL_SetError("OpenGL error: %08X", error);
-            }
-            break;
+        if (error == GL_INVALID_ENUM) {
+            return SDL_SetError("OpenGL error: GL_INVALID_ENUM");
+        } else if (error == GL_INVALID_VALUE) {
+            return SDL_SetError("OpenGL error: GL_INVALID_VALUE");
         }
-        return -1;
+        return SDL_SetError("OpenGL error: %08X", error);
     }
     return 0;
 #else
-    SDL_Unsupported();
-    return -1;
+    return SDL_Unsupported();
 #endif /* SDL_VIDEO_OPENGL */
 }
 
@@ -2706,8 +2668,7 @@
     CHECK_WINDOW_MAGIC(window, -1);
 
     if (!(window->flags & SDL_WINDOW_OPENGL)) {
-        SDL_SetError("The specified window isn't an OpenGL window");
-        return -1;
+        return SDL_SetError("The specified window isn't an OpenGL window");
     }
     if (!ctx) {
         window = NULL;
@@ -2730,16 +2691,13 @@
 SDL_GL_SetSwapInterval(int interval)
 {
     if (!_this) {
-        SDL_UninitializedVideo();
-        return -1;
+        return SDL_UninitializedVideo();
     } else if (_this->current_glctx == NULL) {
-        SDL_SetError("No OpenGL context has been made current");
-        return -1;
+        return SDL_SetError("No OpenGL context has been made current");
     } else if (_this->GL_SetSwapInterval) {
         return _this->GL_SetSwapInterval(_this, interval);
     } else {
-        SDL_SetError("Setting the swap interval is not supported");
-        return -1;
+        return SDL_SetError("Setting the swap interval is not supported");
     }
 }
 
@@ -3025,8 +2983,7 @@
 	SDL_ShowCursor( show_cursor_prev );
 	SDL_SetRelativeMouseMode( relative_mode );
 
-	if(retval == -1)
-	{
+	if(retval == -1) {
 		SDL_SetError("No message system available");
 	}
     return retval;
--- a/src/video/android/SDL_androidgl.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/android/SDL_androidgl.c	Sun Mar 31 12:48:50 2013 -0400
@@ -42,8 +42,7 @@
     if (!Android_GLHandle) {
         Android_GLHandle = dlopen("libGLESv1_CM.so",RTLD_GLOBAL);
         if (!Android_GLHandle) {
-            SDL_SetError("Could not initialize GL ES library\n");
-            return -1;
+            return SDL_SetError("Could not initialize GL ES library\n");
         }
     }
     return 0;
--- a/src/video/android/SDL_androidwindow.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/android/SDL_androidwindow.c	Sun Mar 31 12:48:50 2013 -0400
@@ -31,8 +31,7 @@
 Android_CreateWindow(_THIS, SDL_Window * window)
 {
     if (Android_Window) {
-        SDL_SetError("Android only supports one window");
-        return -1;
+        return SDL_SetError("Android only supports one window");
     }
     Android_Window = window;
     Android_PauseSem = SDL_CreateSemaphore(0);
--- a/src/video/bwindow/SDL_bframebuffer.cc	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/bwindow/SDL_bframebuffer.cc	Sun Mar 31 12:48:50 2013 -0400
@@ -76,8 +76,7 @@
 			true);	/* Contiguous memory required */
 			
 	if(bitmap->InitCheck() != B_OK) {
-		SDL_SetError("Could not initialize back buffer!\n");
-		return -1;
+		return SDL_SetError("Could not initialize back buffer!\n");
 	}
 
 
--- a/src/video/bwindow/SDL_bmodes.cc	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/bwindow/SDL_bmodes.cc	Sun Mar 31 12:48:50 2013 -0400
@@ -310,8 +310,7 @@
 	}
 
 	if(bscreen.SetMode(bmode) != B_OK) {
-		SDL_SetError("Bad video mode\n");
-		return -1;
+		return SDL_SetError("Bad video mode\n");
 	}
 	
 	free(bmode_list);
--- a/src/video/cocoa/SDL_cocoamodes.m	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/cocoa/SDL_cocoamodes.m	Sun Mar 31 12:48:50 2013 -0400
@@ -84,7 +84,7 @@
 #endif
 }
 
-static void
+static int
 CG_SetError(const char *prefix, CGDisplayErr result)
 {
     const char *error;
@@ -124,7 +124,7 @@
         error = "Unknown Error";
         break;
     }
-    SDL_SetError("%s: %s", prefix, error);
+    return SDL_SetError("%s: %s", prefix, error);
 }
 
 static SDL_bool
--- a/src/video/cocoa/SDL_cocoamouse.m	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/cocoa/SDL_cocoamouse.m	Sun Mar 31 12:48:50 2013 -0400
@@ -190,8 +190,7 @@
         result = CGAssociateMouseAndMouseCursorPosition(YES);
     }
     if (result != kCGErrorSuccess) {
-        SDL_SetError("CGAssociateMouseAndMouseCursorPosition() failed");
-        return -1;
+        return SDL_SetError("CGAssociateMouseAndMouseCursorPosition() failed");
     }
     return 0;
 }
--- a/src/video/cocoa/SDL_cocoaopengl.m	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/cocoa/SDL_cocoaopengl.m	Sun Mar 31 12:48:50 2013 -0400
@@ -274,8 +274,7 @@
         [nscontext setValues:&value forParameter:NSOpenGLCPSwapInterval];
         status = 0;
     } else {
-        SDL_SetError("No current OpenGL context");
-        status = -1;
+        status = SDL_SetError("No current OpenGL context");
     }
 
     [pool release];
--- a/src/video/cocoa/SDL_cocoawindow.m	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/cocoa/SDL_cocoawindow.m	Sun Mar 31 12:48:50 2013 -0400
@@ -501,8 +501,7 @@
     /* Allocate the window data */
     data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
     if (!data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     data->window = window;
     data->nswindow = nswindow;
@@ -954,8 +953,7 @@
 
     if (CGSetDisplayTransferByTable(display_id, tableSize,
                                     redTable, greenTable, blueTable) != CGDisplayNoErr) {
-        SDL_SetError("CGSetDisplayTransferByTable()");
-        return -1;
+        return SDL_SetError("CGSetDisplayTransferByTable()");
     }
     return 0;
 }
@@ -973,8 +971,7 @@
 
     if (CGGetDisplayTransferByTable(display_id, tableSize,
                                     redTable, greenTable, blueTable, &tableCopied) != CGDisplayNoErr) {
-        SDL_SetError("CGGetDisplayTransferByTable()");
-        return -1;
+        return SDL_SetError("CGGetDisplayTransferByTable()");
     }
 
     for (i = 0; i < tableCopied; i++) {
--- a/src/video/directfb/SDL_DirectFB_opengl.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/directfb/SDL_DirectFB_opengl.c	Sun Mar 31 12:48:50 2013 -0400
@@ -72,8 +72,7 @@
                                                sizeof(struct
                                                       SDL_GLDriverData));
     if (!_this->gl_data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     _this->gl_data->initialized = 0;
 
@@ -115,8 +114,7 @@
     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 @@
 int
 DirectFB_GL_SetSwapInterval(_THIS, int interval)
 {
-    SDL_Unsupported();
-    return -1;
+    return SDL_Unsupported();
 }
 
 int
--- a/src/video/directfb/SDL_DirectFB_render.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/directfb/SDL_DirectFB_render.c	Sun Mar 31 12:48:50 2013 -0400
@@ -657,8 +657,7 @@
                          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 @@
         }
         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 @@
     case SDL_BLENDMODE_MOD:
         return 0;
     default:
-        SDL_Unsupported();
         texture->blendMode = SDL_BLENDMODE_NONE;
-        return -1;
+        return SDL_Unsupported();
     }
 }
 
@@ -735,9 +732,8 @@
     case SDL_BLENDMODE_MOD:
         return 0;
     default:
-        SDL_Unsupported();
         renderer->blendMode = SDL_BLENDMODE_NONE;
-        return -1;
+        return SDL_Unsupported();
     }
 }
 
@@ -762,10 +758,9 @@
             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;
--- a/src/video/directfb/SDL_DirectFB_window.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/directfb/SDL_DirectFB_window.c	Sun Mar 31 12:48:50 2013 -0400
@@ -176,8 +176,7 @@
 int
 DirectFB_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
 {
-    SDL_Unsupported();
-    return -1;
+    return SDL_Unsupported();
 }
 
 void
@@ -188,8 +187,9 @@
     if (windata->is_managed) {
         windata->wm_needs_redraw = 1;
         DirectFB_WM_RedrawLayout(_this, window);
-    } else
+    } else {
         SDL_Unsupported();
+    }
 }
 
 void
--- a/src/video/dummy/SDL_nullframebuffer.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/dummy/SDL_nullframebuffer.c	Sun Mar 31 12:48:50 2013 -0400
@@ -65,8 +65,7 @@
 
     surface = (SDL_Surface *) SDL_GetWindowData(window, DUMMY_SURFACE);
     if (!surface) {
-        SDL_SetError("Couldn't find dummy surface for window");
-        return -1;
+        return SDL_SetError("Couldn't find dummy surface for window");
     }
 
     /* Send the data to the display */
--- a/src/video/pandora/SDL_pandora.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/pandora/SDL_pandora.c	Sun Mar 31 12:48:50 2013 -0400
@@ -211,8 +211,7 @@
     /* Allocate window internal data */
     wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
     if (wdata == NULL) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     /* Setup driver data for this window */
@@ -230,14 +229,12 @@
         if (phdata->egl_display == EGL_NO_DISPLAY) {
             phdata->egl_display = eglGetDisplay((NativeDisplayType) 0);
             if (phdata->egl_display == EGL_NO_DISPLAY) {
-                SDL_SetError("PND: Can't get connection to OpenGL ES");
-                return -1;
+                return SDL_SetError("PND: Can't get connection to OpenGL ES");
             }
 
             initstatus = eglInitialize(phdata->egl_display, NULL, NULL);
             if (initstatus != EGL_TRUE) {
-                SDL_SetError("PND: Can't init OpenGL ES library");
-                return -1;
+                return SDL_SetError("PND: Can't init OpenGL ES library");
             }
         }
 
@@ -356,8 +353,7 @@
     _this->gl_config.dll_handle = SDL_LoadObject(path);
     if (!_this->gl_config.dll_handle) {
         /* Failed to load new GL ES library */
-        SDL_SetError("PND: Failed to locate OpenGL ES library");
-        return -1;
+        return SDL_SetError("PND: Failed to locate OpenGL ES library");
     }
 
     /* Store OpenGL ES library path and name */
@@ -726,8 +722,7 @@
     EGLBoolean status;
 
     if (phdata->egl_initialized != SDL_TRUE) {
-        SDL_SetError("PND: GF initialization failed, no OpenGL ES support");
-        return -1;
+        return SDL_SetError("PND: GF initialization failed, no OpenGL ES support");
     }
 
     if ((window == NULL) && (context == NULL)) {
@@ -736,33 +731,28 @@
                            EGL_NO_SURFACE, EGL_NO_CONTEXT);
         if (status != EGL_TRUE) {
             /* Failed to set current GL ES context */
-            SDL_SetError("PND: Can't set OpenGL ES context");
-            return -1;
+            return SDL_SetError("PND: Can't set OpenGL ES context");
         }
     } else {
         wdata = (SDL_WindowData *) window->driverdata;
         if (wdata->gles_surface == EGL_NO_SURFACE) {
-            SDL_SetError
+            return SDL_SetError
                 ("PND: OpenGL ES surface is not initialized for this window");
-            return -1;
         }
         if (wdata->gles_context == EGL_NO_CONTEXT) {
-            SDL_SetError
+            return SDL_SetError
                 ("PND: OpenGL ES context is not initialized for this window");
-            return -1;
         }
         if (wdata->gles_context != context) {
-            SDL_SetError
+            return SDL_SetError
                 ("PND: OpenGL ES context is not belong to this window");
-            return -1;
         }
         status =
             eglMakeCurrent(phdata->egl_display, wdata->gles_surface,
                            wdata->gles_surface, wdata->gles_context);
         if (status != EGL_TRUE) {
             /* Failed to set current GL ES context */
-            SDL_SetError("PND: Can't set OpenGL ES context");
-            return -1;
+            return SDL_SetError("PND: Can't set OpenGL ES context");
         }
     }
     return 0;
@@ -775,8 +765,7 @@
     EGLBoolean status;
 
     if (phdata->egl_initialized != SDL_TRUE) {
-        SDL_SetError("PND: EGL initialization failed, no OpenGL ES support");
-        return -1;
+        return SDL_SetError("PND: EGL initialization failed, no OpenGL ES support");
     }
 
     /* Check if OpenGL ES connection has been initialized */
@@ -791,8 +780,7 @@
     }
 
     /* Failed to set swap interval */
-    SDL_SetError("PND: Cannot set swap interval");
-    return -1;
+    return SDL_SetError("PND: Cannot set swap interval");
 }
 
 int
--- a/src/video/psp/SDL_pspgl.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/psp/SDL_pspgl.c	Sun Mar 31 12:48:50 2013 -0400
@@ -146,8 +146,7 @@
 		if (!eglMakeCurrent(_this->gl_data->display, _this->gl_data->surface,
 	                      _this->gl_data->surface, _this->gl_data->context))
 		{
-			SDL_SetError("Unable to make EGL context current");
-			return -1;
+			return SDL_SetError("Unable to make EGL context current");
 		}
     return 0;
 }
@@ -163,8 +162,7 @@
         return 0;
     }
     /* Failed to set swap interval */
-    SDL_SetError("Unable to set the EGL swap interval");
-    return -1;
+    return SDL_SetError("Unable to set the EGL swap interval");
 }
 
 int
--- a/src/video/psp/SDL_pspvideo.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/psp/SDL_pspvideo.c	Sun Mar 31 12:48:50 2013 -0400
@@ -223,8 +223,7 @@
     /* Allocate window internal data */
     wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
     if (wdata == NULL) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     /* Setup driver data for this window */
--- a/src/video/uikit/SDL_uikitmodes.m	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/uikit/SDL_uikitmodes.m	Sun Mar 31 12:48:50 2013 -0400
@@ -39,8 +39,7 @@
         /* Allocate the display mode data */
         data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
         if (!data) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         
         data->uiscreenmode = uiscreenmode;
@@ -160,9 +159,8 @@
     /* Allocate the display data */
     SDL_DisplayData *data = (SDL_DisplayData *) SDL_malloc(sizeof(*data));
     if (!data) {
-        SDL_OutOfMemory();
         UIKit_FreeDisplayModeData(&display.desktop_mode);
-        return -1;
+        return SDL_OutOfMemory();
     }
 	
     [uiscreen retain];
--- a/src/video/uikit/SDL_uikitopengles.m	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/uikit/SDL_uikitopengles.m	Sun Mar 31 12:48:50 2013 -0400
@@ -72,8 +72,7 @@
         and because the SDK forbids loading an external SO
     */
     if (path != NULL) {
-        SDL_SetError("iPhone GL Load Library just here for compatibility");
-        return -1;
+        return SDL_SetError("iPhone GL Load Library just here for compatibility");
     }
     return 0;
 }
--- a/src/video/uikit/SDL_uikitvideo.m	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/uikit/SDL_uikitvideo.m	Sun Mar 31 12:48:50 2013 -0400
@@ -63,10 +63,10 @@
     /* Initialize all variables that we clean on shutdown */
     device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
     if (!device) {
-        SDL_OutOfMemory();
         if (device) {
             SDL_free(device);
         }
+        SDL_OutOfMemory();
         return (0);
     }
 
--- a/src/video/uikit/SDL_uikitwindow.m	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/uikit/SDL_uikitwindow.m	Sun Mar 31 12:48:50 2013 -0400
@@ -54,8 +54,7 @@
     /* Allocate the window data */
     data = (SDL_WindowData *)SDL_malloc(sizeof(*data));
     if (!data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     data->uiwindow = uiwindow;
     data->viewcontroller = nil;
@@ -133,8 +132,7 @@
 
     /* We currently only handle a single window per display on iOS */
     if (window->next != NULL) {
-        SDL_SetError("Only one window allowed per display.");
-        return -1;
+        return SDL_SetError("Only one window allowed per display.");
     }
 
     // If monitor has a resolution of 0x0 (hasn't been explicitly set by the
@@ -315,8 +313,7 @@
     SDL_WindowData *data = window ? (SDL_WindowData *)window->driverdata : NULL;
 
     if (!data || !data->view) {
-        SDL_SetError("Invalid window or view not set");
-        return -1;
+        return SDL_SetError("Invalid window or view not set");
     }
 
     [data->view setAnimationCallback:interval callback:callback callbackParam:callbackParam];
--- a/src/video/windows/SDL_windowsclipboard.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/windows/SDL_windowsclipboard.c	Sun Mar 31 12:48:50 2013 -0400
@@ -89,8 +89,7 @@
 
             EmptyClipboard();
             if (!SetClipboardData(TEXT_FORMAT, hMem)) {
-                WIN_SetError("Couldn't set clipboard data");
-                result = -1;
+                result = WIN_SetError("Couldn't set clipboard data");
             }
             data->clipboard_count = GetClipboardSequenceNumber();
         }
@@ -98,8 +97,7 @@
 
         CloseClipboard();
     } else {
-        WIN_SetError("Couldn't open clipboard");
-        result = -1;
+        result = WIN_SetError("Couldn't open clipboard");
     }
     return result;
 }
--- a/src/video/windows/SDL_windowsevents.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/windows/SDL_windowsevents.c	Sun Mar 31 12:48:50 2013 -0400
@@ -809,12 +809,11 @@
     class.cbWndExtra = 0;
     class.cbClsExtra = 0;
     if (!RegisterClass(&class)) {
-        SDL_SetError("Couldn't register application class");
-        return (-1);
+        return SDL_SetError("Couldn't register application class");
     }
 
     app_registered = 1;
-    return (0);
+    return 0;
 }
 
 /* Unregisters the windowclass registered in SDL_RegisterApp above. */
--- a/src/video/windows/SDL_windowsframebuffer.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/windows/SDL_windowsframebuffer.c	Sun Mar 31 12:48:50 2013 -0400
@@ -85,8 +85,7 @@
     SDL_stack_free(info);
 
     if (!data->hbm) {
-        WIN_SetError("Unable to create DIB");
-        return -1;
+        return WIN_SetError("Unable to create DIB");
     }
     SelectObject(data->mdc, data->hbm);
 
--- a/src/video/windows/SDL_windowsmodes.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/windows/SDL_windowsmodes.c	Sun Mar 31 12:48:50 2013 -0400
@@ -214,8 +214,7 @@
         }
     }
     if (_this->num_displays == 0) {
-        SDL_SetError("No displays available");
-        return -1;
+        return SDL_SetError("No displays available");
     }
     return 0;
 }
@@ -282,8 +281,7 @@
             reason = "DISP_CHANGE_FAILED";
             break;
         }
-        SDL_SetError("ChangeDisplaySettingsEx() failed: %s", reason);
-        return -1;
+        return SDL_SetError("ChangeDisplaySettingsEx() failed: %s", reason);
     }
     EnumDisplaySettings(displaydata->DeviceName, ENUM_CURRENT_SETTINGS, &data->DeviceMode);
     return 0;
--- a/src/video/windows/SDL_windowsmouse.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/windows/SDL_windowsmouse.c	Sun Mar 31 12:48:50 2013 -0400
@@ -196,8 +196,7 @@
 		/* Only return an error when registering. If we unregister and fail, then
 		it's probably that we unregistered twice. That's OK. */
 		if(enabled) {
-			SDL_Unsupported();
-			return -1;
+			return SDL_Unsupported();
 		}
 	}
 
--- a/src/video/windows/SDL_windowsopengl.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/windows/SDL_windowsopengl.c	Sun Mar 31 12:48:50 2013 -0400
@@ -91,8 +91,7 @@
         char message[1024];
         SDL_snprintf(message, SDL_arraysize(message), "LoadLibrary(\"%s\")",
                      path);
-        WIN_SetError(message);
-        return -1;
+        return WIN_SetError(message);
     }
     SDL_strlcpy(_this->gl_config.driver_path, path,
                 SDL_arraysize(_this->gl_config.driver_path));
@@ -103,8 +102,7 @@
                                                sizeof(struct
                                                       SDL_GLDriverData));
     if (!_this->gl_data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     /* Load function pointers */
@@ -124,9 +122,8 @@
         !_this->gl_data->wglCreateContext ||
         !_this->gl_data->wglDeleteContext ||
         !_this->gl_data->wglMakeCurrent) {
-        SDL_SetError("Could not retrieve OpenGL functions");
         SDL_UnloadObject(handle);
-        return -1;
+        return SDL_SetError("Could not retrieve OpenGL functions");
     }
 
     return 0;
@@ -512,12 +509,10 @@
         pixel_format = WIN_GL_ChoosePixelFormat(hdc, &pfd);
     }
     if (!pixel_format) {
-        SDL_SetError("No matching GL pixel format available");
-        return -1;
+        return SDL_SetError("No matching GL pixel format available");
     }
     if (!SetPixelFormat(hdc, pixel_format, &pfd)) {
-        WIN_SetError("SetPixelFormat()");
-        return (-1);
+        return WIN_SetError("SetPixelFormat()");
     }
     return 0;
 }
@@ -611,11 +606,9 @@
 WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
 {
     HDC hdc;
-    int status;
 
     if (!_this->gl_data) {
-        SDL_SetError("OpenGL not initialized");
-        return -1;
+        return SDL_SetError("OpenGL not initialized");
     }
 
     if (window) {
@@ -624,30 +617,24 @@
         hdc = NULL;
     }
     if (!_this->gl_data->wglMakeCurrent(hdc, (HGLRC) context)) {
-        WIN_SetError("wglMakeCurrent()");
-        status = -1;
-    } else {
-        status = 0;
+        return WIN_SetError("wglMakeCurrent()");
     }
-    return status;
+    return 0;
 }
 
 int
 WIN_GL_SetSwapInterval(_THIS, int interval)
 {
-    int retval = -1;
     if ((interval < 0) && (!_this->gl_data->HAS_WGL_EXT_swap_control_tear)) {
-        SDL_SetError("Negative swap interval unsupported in this GL");
+        return SDL_SetError("Negative swap interval unsupported in this GL");
     } else if (_this->gl_data->wglSwapIntervalEXT) {
-        if (_this->gl_data->wglSwapIntervalEXT(interval) == TRUE) {
-            retval = 0;
-        } else {
-            WIN_SetError("wglSwapIntervalEXT()");
+        if (_this->gl_data->wglSwapIntervalEXT(interval) != TRUE) {
+            return WIN_SetError("wglSwapIntervalEXT()");
         }
     } else {
-        SDL_Unsupported();
+        return SDL_Unsupported();
     }
-    return retval;
+    return 0;
 }
 
 int
--- a/src/video/windows/SDL_windowsvideo.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/windows/SDL_windowsvideo.c	Sun Mar 31 12:48:50 2013 -0400
@@ -75,10 +75,10 @@
         data = NULL;
     }
     if (!data) {
-        SDL_OutOfMemory();
         if (device) {
             SDL_free(device);
         }
+        SDL_OutOfMemory();
         return NULL;
     }
     device->driverdata = data;
--- a/src/video/windows/SDL_windowswindow.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/windows/SDL_windowswindow.c	Sun Mar 31 12:48:50 2013 -0400
@@ -82,8 +82,7 @@
     /* Allocate the window data */
     data = (SDL_WindowData *) SDL_malloc(sizeof(*data));
     if (!data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     data->window = window;
     data->hwnd = hwnd;
@@ -98,8 +97,7 @@
     if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
         ReleaseDC(hwnd, data->hdc);
         SDL_free(data);
-        WIN_SetError("SetProp() failed");
-        return -1;
+        return WIN_SetError("SetProp() failed");
     }
 
     /* Set up the window proc function */
@@ -221,8 +219,7 @@
         CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL,
                      SDL_Instance, NULL);
     if (!hwnd) {
-        WIN_SetError("Couldn't create window");
-        return -1;
+        return WIN_SetError("Couldn't create window");
     }
 
     WIN_PumpEvents(_this);
@@ -635,8 +632,7 @@
     /* Register the class. */
     SDL_HelperWindowClass = RegisterClass(&wce);
     if (SDL_HelperWindowClass == 0) {
-        WIN_SetError("Unable to create Helper Window Class");
-        return -1;
+        return WIN_SetError("Unable to create Helper Window Class");
     }
 
     /* Create the window. */
@@ -648,8 +644,7 @@
                                       hInstance, NULL);
     if (SDL_HelperWindow == NULL) {
         UnregisterClass(SDL_HelperWindowClassName, hInstance);
-        WIN_SetError("Unable to create Helper Window");
-        return -1;
+        return WIN_SetError("Unable to create Helper Window");
     }
 
     return 0;
--- a/src/video/x11/SDL_x11clipboard.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/x11/SDL_x11clipboard.c	Sun Mar 31 12:48:50 2013 -0400
@@ -59,8 +59,7 @@
     /* Get the SDL window that will own the selection */
     window = GetWindow(_this);
     if (window == None) {
-        SDL_SetError("Couldn't find a window to own the selection");
-        return -1;
+        return SDL_SetError("Couldn't find a window to own the selection");
     }
 
     /* Save the selection on the root window */
--- a/src/video/x11/SDL_x11framebuffer.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/x11/SDL_x11framebuffer.c	Sun Mar 31 12:48:50 2013 -0400
@@ -68,20 +68,17 @@
     gcv.graphics_exposures = False;
     data->gc = XCreateGC(display, data->xwindow, GCGraphicsExposures, &gcv);
     if (!data->gc) {
-        SDL_SetError("Couldn't create graphics context");
-        return -1;
+        return SDL_SetError("Couldn't create graphics context");
     }
 
     /* Find out the pixel format and depth */
     if (X11_GetVisualInfoFromVisual(display, data->visual, &vinfo) < 0) {
-        SDL_SetError("Couldn't get window visual information");
-        return -1;
+        return SDL_SetError("Couldn't get window visual information");
     }
 
     *format = X11_GetPixelFormatFromVisualInfo(display, &vinfo);
     if (*format == SDL_PIXELFORMAT_UNKNOWN) {
-        SDL_SetError("Unknown window pixel format");
-        return -1;
+        return SDL_SetError("Unknown window pixel format");
     }
 
     /* Calculate pitch */
@@ -132,8 +129,7 @@
 
     *pixels = SDL_malloc(window->h*(*pitch));
     if (*pixels == NULL) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     data->ximage = XCreateImage(display, data->visual,
@@ -141,8 +137,7 @@
                       window->w, window->h, 32, 0);
     if (!data->ximage) {
         SDL_free(*pixels);
-        SDL_SetError("Couldn't create XImage");
-        return -1;
+        return SDL_SetError("Couldn't create XImage");
     }
     return 0;
 }
--- a/src/video/x11/SDL_x11messagebox.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/x11/SDL_x11messagebox.c	Sun Mar 31 12:48:50 2013 -0400
@@ -168,8 +168,7 @@
     const SDL_MessageBoxColor *colorhints;
 
     if ( numbuttons > MAX_BUTTONS ) {
-        SDL_SetError("Too many buttons (%d max allowed)", MAX_BUTTONS);
-        return -1;
+        return SDL_SetError("Too many buttons (%d max allowed)", MAX_BUTTONS);
     }
 
     data->dialog_width = MIN_DIALOG_WIDTH;
@@ -181,8 +180,7 @@
 
     data->display = XOpenDisplay( NULL );
     if ( !data->display ) {
-        SDL_SetError("Couldn't open X11 display");
-        return -1;
+        return SDL_SetError("Couldn't open X11 display");
     }
 
     if (SDL_X11_HAVE_UTF8) {
@@ -194,14 +192,12 @@
             XFreeStringList(missing);
         }
         if ( data->font_set == NULL ) {
-            SDL_SetError("Couldn't load font %s", g_MessageBoxFont);
-            return -1;
+            return SDL_SetError("Couldn't load font %s", g_MessageBoxFont);
         }
     } else {
         data->font_struct = XLoadQueryFont( data->display, g_MessageBoxFontLatin1 );
         if ( data->font_struct == NULL ) {
-            SDL_SetError("Couldn't load font %s", g_MessageBoxFontLatin1);
-            return -1;
+            return SDL_SetError("Couldn't load font %s", g_MessageBoxFontLatin1);
         }
     }
 
@@ -388,8 +384,7 @@
                        0, CopyFromParent, InputOutput, CopyFromParent,
                        CWEventMask, &wnd_attr );
     if ( data->window == None ) {
-        SDL_SetError("Couldn't create X window");
-        return -1;
+        return SDL_SetError("Couldn't create X window");
     }
 
     if ( windowdata ) {
@@ -520,8 +515,7 @@
 
     ctx = XCreateGC( data->display, data->window, gcflags, &ctx_vals );
     if ( ctx == None ) {
-        SDL_SetError("Couldn't create graphics context");
-        return -1;
+        return SDL_SetError("Couldn't create graphics context");
     }
 
     data->button_press_index = -1;  /* Reset what button is currently depressed. */
@@ -660,8 +654,7 @@
     if (origlocale != NULL) {
         origlocale = SDL_strdup(origlocale);
         if (origlocale == NULL) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         setlocale(LC_ALL, "");
     }
@@ -739,8 +732,7 @@
         SDL_assert(rc == pid);  /* not sure what to do if this fails. */
 
         if ((rc == -1) || (!WIFEXITED(status)) || (WEXITSTATUS(status) != 0)) {
-            SDL_SetError("msgbox child process failed");
-            return -1;
+            return SDL_SetError("msgbox child process failed");
         }
 
         if (read(fds[0], &status, sizeof (int)) != sizeof (int))
--- a/src/video/x11/SDL_x11modes.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/x11/SDL_x11modes.c	Sun Mar 31 12:48:50 2013 -0400
@@ -656,8 +656,7 @@
 #endif
 
     if (_this->num_displays == 0) {
-        SDL_SetError("No available displays");
-        return -1;
+        return SDL_SetError("No available displays");
     }
     return 0;
 }
@@ -798,23 +797,20 @@
 
         res = XRRGetScreenResources (display, RootWindow(display, data->screen));
         if (!res) {
-            SDL_SetError("Couldn't get XRandR screen resources");
-            return -1;
+            return SDL_SetError("Couldn't get XRandR screen resources");
         }
 
         output_info = XRRGetOutputInfo(display, res, data->xrandr_output);
         if (!output_info || output_info->connection == RR_Disconnected) {
-            SDL_SetError("Couldn't get XRandR output info");
             XRRFreeScreenResources(res);
-            return -1;
+            return SDL_SetError("Couldn't get XRandR output info");
         }
 
         crtc = XRRGetCrtcInfo(display, res, output_info->crtc);
         if (!crtc) {
-            SDL_SetError("Couldn't get XRandR crtc info");
             XRRFreeOutputInfo(output_info);
             XRRFreeScreenResources(res);
-            return -1;
+            return SDL_SetError("Couldn't get XRandR crtc info");
         }
 
         status = XRRSetCrtcConfig (display, res, output_info->crtc, CurrentTime,
@@ -826,8 +822,7 @@
         XRRFreeScreenResources(res);
 
         if (status != Success) {
-            SDL_SetError("XRRSetCrtcConfig failed");
-            return -1;
+            return SDL_SetError("XRRSetCrtcConfig failed");
         }
     }
 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
--- a/src/video/x11/SDL_x11opengl.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/x11/SDL_x11opengl.c	Sun Mar 31 12:48:50 2013 -0400
@@ -136,8 +136,7 @@
     void *handle;
 
     if (_this->gl_data) {
-        SDL_SetError("OpenGL context already created");
-        return -1;
+        return SDL_SetError("OpenGL context already created");
     }
 
     /* If SDL_GL_CONTEXT_EGL has been changed to 1, switch over to X11_GLES functions  */
@@ -154,8 +153,7 @@
         _this->GL_DeleteContext = X11_GLES_DeleteContext;
         return X11_GLES_LoadLibrary(_this, path);
 #else
-        SDL_SetError("SDL not configured with OpenGL ES/EGL support");
-        return -1;
+        return SDL_SetError("SDL not configured with OpenGL ES/EGL support");
 #endif
     }
 
@@ -183,8 +181,7 @@
                                                sizeof(struct
                                                       SDL_GLDriverData));
     if (!_this->gl_data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     /* Load function pointers */
@@ -216,8 +213,7 @@
         !_this->gl_data->glXDestroyContext ||
         !_this->gl_data->glXMakeCurrent ||
         !_this->gl_data->glXSwapBuffers) {
-        SDL_SetError("Could not retrieve OpenGL functions");
-        return -1;
+        return SDL_SetError("Could not retrieve OpenGL functions");
     }
 
     /* Initialize extensions */
@@ -656,20 +652,16 @@
     Window drawable =
         (context ? ((SDL_WindowData *) window->driverdata)->xwindow : None);
     GLXContext glx_context = (GLXContext) context;
-    int status;
 
     if (!_this->gl_data) {
-        SDL_SetError("OpenGL not initialized");
-        return -1;
+        return SDL_SetError("OpenGL not initialized");
     }
 
-    status = 0;
     if (!_this->gl_data->glXMakeCurrent(display, drawable, glx_context)) {
-        SDL_SetError("Unable to make GL context current");
-        status = -1;
+        return SDL_SetError("Unable to make GL context current");
     }
 
-    return (status);
+    return 0;
 }
 
 /* 
--- a/src/video/x11/SDL_x11opengles.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/x11/SDL_x11opengles.c	Sun Mar 31 12:48:50 2013 -0400
@@ -35,8 +35,7 @@
 	*((void**)&_this->gles_data->NAME) = dlsym(handle, #NAME); \
 	if (!_this->gles_data->NAME) \
 	{ \
-		SDL_SetError("Could not retrieve EGL function " #NAME); \
-		return -1; \
+		return SDL_SetError("Could not retrieve EGL function " #NAME); \
 	}
 
 /* GLES implementation of SDL OpenGL support */
@@ -95,8 +94,7 @@
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
 
     if (_this->gles_data) {
-        SDL_SetError("OpenGL ES context already created");
-        return -1;
+        return SDL_SetError("OpenGL ES context already created");
     }
 
     /* If SDL_GL_CONTEXT_EGL has been changed to 0, switch over to X11_GL functions  */
@@ -113,8 +111,7 @@
         _this->GL_DeleteContext = X11_GL_DeleteContext;
         return X11_GL_LoadLibrary(_this, path);
 #else
-        SDL_SetError("SDL not configured with OpenGL/GLX support");
-        return -1;
+        return SDL_SetError("SDL not configured with OpenGL/GLX support");
 #endif
     }
 
@@ -136,8 +133,7 @@
     }
 
     if (handle == NULL) {
-        SDL_SetError("Could not load OpenGL ES/EGL library");
-        return -1;
+        return SDL_SetError("Could not load OpenGL ES/EGL library");
     }
 
     /* Unload the old driver and reset the pointers */
@@ -145,8 +141,7 @@
 
     _this->gles_data = (struct SDL_PrivateGLESData *) SDL_calloc(1, sizeof(SDL_PrivateGLESData));
     if (!_this->gles_data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     /* Load new function pointers */
@@ -168,15 +163,13 @@
         _this->gles_data->eglGetDisplay((NativeDisplayType) data->display);
 
     if (!_this->gles_data->egl_display) {
-        SDL_SetError("Could not get EGL display");
-        return -1;
+        return SDL_SetError("Could not get EGL display");
     }
 
     if (_this->gles_data->
         eglInitialize(_this->gles_data->egl_display, NULL,
                       NULL) != EGL_TRUE) {
-        SDL_SetError("Could not initialize EGL");
-        return -1;
+        return SDL_SetError("Could not initialize EGL");
     }
 
     _this->gles_data->egl_dll_handle = handle;
@@ -198,8 +191,7 @@
     }
 
     if (handle == NULL) {
-        SDL_SetError("Could not initialize OpenGL ES library");
-        return -1;
+        return SDL_SetError("Could not initialize OpenGL ES library");
     }
 
     _this->gl_config.dll_handle = handle;
@@ -353,40 +345,34 @@
 int
 X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
 {
-    int retval;
-
 /*
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
     Display *display = data->videodata->display;
 */
 
     if (!_this->gles_data) {
-        SDL_SetError("OpenGL not initialized");
-        return -1;
+        return SDL_SetError("OpenGL not initialized");
     }
 
-    retval = 1;
     if (!_this->gles_data->eglMakeCurrent(_this->gles_data->egl_display,
                                           _this->gles_data->egl_surface,
                                           _this->gles_data->egl_surface,
                                           _this->gles_data->egl_context)) {
-        SDL_SetError("Unable to make EGL context current");
-        retval = -1;
+        return SDL_SetError("Unable to make EGL context current");
     }
 
 /*
     XSync(display, False);
 */
 
-    return (retval);
+    return 1;
 }
 
 int
 X11_GLES_SetSwapInterval(_THIS, int interval)
 {
     if (_this->gles_data) {
-        SDL_SetError("OpenGL ES context not active");
-        return -1;
+        return SDL_SetError("OpenGL ES context not active");
     }
 
     EGLBoolean status;
@@ -396,16 +382,14 @@
         return 0; 
     }
 
-    SDL_SetError("Unable to set the EGL swap interval");
-    return -1;
+    return SDL_SetError("Unable to set the EGL swap interval");
 }
 
 int
 X11_GLES_GetSwapInterval(_THIS)
 {
     if (_this->gles_data) {
-        SDL_SetError("OpenGL ES context not active");
-        return -1;
+        return SDL_SetError("OpenGL ES context not active");
     }
 
     return _this->gles_data->egl_swapinterval;
--- a/src/video/x11/SDL_x11shape.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/x11/SDL_x11shape.c	Sun Mar 31 12:48:50 2013 -0400
@@ -72,8 +72,7 @@
             free(data->bitmap);
         data->bitmap = malloc(data->bitmapsize);
         if(data->bitmap == NULL) {
-            SDL_SetError("Could not allocate memory for shaped-window bitmap.");
-            return -1;
+            return SDL_SetError("Could not allocate memory for shaped-window bitmap.");
         }
     }
     memset(data->bitmap,0,data->bitmapsize);
--- a/src/video/x11/SDL_x11video.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/x11/SDL_x11video.c	Sun Mar 31 12:48:50 2013 -0400
@@ -305,8 +305,8 @@
     }
     data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
     if (!data) {
+        SDL_free(device);
         SDL_OutOfMemory();
-        SDL_free(device);
         return NULL;
     }
     device->driverdata = data;
--- a/src/video/x11/SDL_x11window.c	Fri Mar 29 21:29:57 2013 -0400
+++ b/src/video/x11/SDL_x11window.c	Sun Mar 31 12:48:50 2013 -0400
@@ -214,8 +214,7 @@
     /* Allocate the window data */
     data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
     if (!data) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
     data->window = window;
     data->xwindow = w;
@@ -242,9 +241,8 @@
                                             (numwindows +
                                              1) * sizeof(*windowlist));
         if (!windowlist) {
-            SDL_OutOfMemory();
             SDL_free(data);
-            return -1;
+            return SDL_OutOfMemory();
         }
         windowlist[numwindows] = data;
         videodata->numwindows++;
@@ -392,15 +390,13 @@
 
         /* If we can't create a colormap, then we must die */
         if (!xattr.colormap) {
-            SDL_SetError("Could not create writable colormap");
-            return -1;
+            return SDL_SetError("Could not create writable colormap");
         }
 
         /* OK, we got a colormap, now fill it in as best as we can */
         colorcells = SDL_malloc(visual->map_entries * sizeof(XColor));
         if (!colorcells) {
-            SDL_OutOfMemory();
-            return -1;
+            return SDL_OutOfMemory();
         }
         ncolors = visual->map_entries;
         rmax = 0xffff;
@@ -465,8 +461,7 @@
                       (CWOverrideRedirect | CWBackPixel | CWBorderPixel |
                        CWColormap), &xattr);
     if (!w) {
-        SDL_SetError("Couldn't create window");
-        return -1;
+        return SDL_SetError("Couldn't create window");
     }
 #if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
     if ((window->flags & SDL_WINDOW_OPENGL) && (_this->gl_config.use_egl == 1)) {
@@ -483,9 +478,8 @@
                                                  (NativeWindowType) w, NULL);
 
         if (_this->gles_data->egl_surface == EGL_NO_SURFACE) {
-            SDL_SetError("Could not create GLES window surface");
             XDestroyWindow(display, w);
-            return -1;
+            return SDL_SetError("Could not create GLES window surface");
         }
     }
 #endif
@@ -1209,15 +1203,13 @@
     int i;
 
     if (visual->class != DirectColor) {
-        SDL_SetError("Window doesn't have DirectColor visual");
-        return -1;
+        return SDL_SetError("Window doesn't have DirectColor visual");
     }
 
     ncolors = visual->map_entries;
     colorcells = SDL_malloc(ncolors * sizeof(XColor));
     if (!colorcells) {
-        SDL_OutOfMemory();
-        return -1;
+        return SDL_OutOfMemory();
     }
 
     rshift = 0;