From 11843f12be99ab5fad7c5db080177e66f71d2c73 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 9 Apr 2004 21:52:50 +0000 Subject: [PATCH] add mySDL_GetError --- stepmania/src/SDL_utils.cpp | 12 ++++++++++++ stepmania/src/SDL_utils.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/stepmania/src/SDL_utils.cpp b/stepmania/src/SDL_utils.cpp index f2515dc3b9..fc5e1a608c 100644 --- a/stepmania/src/SDL_utils.cpp +++ b/stepmania/src/SDL_utils.cpp @@ -1269,3 +1269,15 @@ SDL_Surface *mySDL_MakeDummySurface( int height, int width ) return ret_image; } + +/* SDL sometimes fails to set an error, in which case we get the null string. We + * sometimes use that as a sentinel return value. This function returns "(none)" + * if no error is set. */ +CString mySDL_GetError() +{ + CString error = SDL_GetError(); + if( error == "" ) + return "(none)"; /* SDL sometimes fails to set an error */ + return error; +} + diff --git a/stepmania/src/SDL_utils.h b/stepmania/src/SDL_utils.h index 804d6a64ee..75df3adc42 100644 --- a/stepmania/src/SDL_utils.h +++ b/stepmania/src/SDL_utils.h @@ -88,5 +88,7 @@ SDL_RWops *OpenRWops( const CString &sPath, bool Write=false ); SDL_RWops *OpenRWops( CString &sBuf ); SDL_Surface *mySDL_MakeDummySurface( int height, int width ); +CString mySDL_GetError(); + #endif