src/SDL_error.c
changeset 7037 3fedf1f25b94
parent 6885 700f1b25f77f
child 7191 75360622e65f
     1.1 --- a/src/SDL_error.c	Fri Mar 29 21:29:57 2013 -0400
     1.2 +++ b/src/SDL_error.c	Sun Mar 31 12:48:50 2013 -0400
     1.3 @@ -49,14 +49,14 @@
     1.4  
     1.5  /* Public functions */
     1.6  
     1.7 -void
     1.8 +int
     1.9  SDL_SetError(const char *fmt, ...)
    1.10  {
    1.11      va_list ap;
    1.12      SDL_error *error;
    1.13  
    1.14      /* Ignore call if invalid format pointer was passed */
    1.15 -    if (fmt == NULL) return;
    1.16 +    if (fmt == NULL) return -1;
    1.17      
    1.18      /* Copy in the key, mark error as valid */
    1.19      error = SDL_GetErrBuf();
    1.20 @@ -112,6 +112,8 @@
    1.21  
    1.22      /* If we are in debug mode, print out an error message */
    1.23      SDL_LogError(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());
    1.24 +
    1.25 +    return -1;
    1.26  }
    1.27  
    1.28  /* This function has a bit more overhead than most error functions
    1.29 @@ -216,28 +218,22 @@
    1.30  }
    1.31  
    1.32  /* Very common errors go here */
    1.33 -void
    1.34 +int
    1.35  SDL_Error(SDL_errorcode code)
    1.36  {
    1.37      switch (code) {
    1.38      case SDL_ENOMEM:
    1.39 -        SDL_SetError("Out of memory");
    1.40 -        break;
    1.41 +        return SDL_SetError("Out of memory");
    1.42      case SDL_EFREAD:
    1.43 -        SDL_SetError("Error reading from datastream");
    1.44 -        break;
    1.45 +        return SDL_SetError("Error reading from datastream");
    1.46      case SDL_EFWRITE:
    1.47 -        SDL_SetError("Error writing to datastream");
    1.48 -        break;
    1.49 +        return SDL_SetError("Error writing to datastream");
    1.50      case SDL_EFSEEK:
    1.51 -        SDL_SetError("Error seeking in datastream");
    1.52 -        break;
    1.53 +        return SDL_SetError("Error seeking in datastream");
    1.54      case SDL_UNSUPPORTED:
    1.55 -        SDL_SetError("That operation is not supported");
    1.56 -        break;
    1.57 +        return SDL_SetError("That operation is not supported");
    1.58      default:
    1.59 -        SDL_SetError("Unknown SDL error");
    1.60 -        break;
    1.61 +        return SDL_SetError("Unknown SDL error");
    1.62      }
    1.63  }
    1.64