Make SDL_SetError and friends unconditionally return -1.

This lets us change things like this...

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

...into this...

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


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

View File

@@ -811,8 +811,7 @@ static int Android_JNI_FileClose(SDL_RWops* ctx, bool release)
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 @@ extern "C" Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence
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 @@ extern "C" Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence
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;