From 13d6ec228471b5068eb3c555cdda4f07f8742fac Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 21 Dec 2003 21:34:01 +0000 Subject: [PATCH] simplify --- stepmania/src/RageException.cpp | 20 +++++++------------- stepmania/src/RageException.h | 3 +-- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/stepmania/src/RageException.cpp b/stepmania/src/RageException.cpp index 1897958865..21514047a1 100644 --- a/stepmania/src/RageException.cpp +++ b/stepmania/src/RageException.cpp @@ -19,17 +19,9 @@ #include "windows.h" #endif -RageException::RageException( const char *fmt, ...) +RageException::RageException( const CString &str ): + m_sError(str) { - va_list va; - va_start(va, fmt); - m_sError = vssprintf( fmt, va ); - va_end(va); -} - -RageException::RageException( const char *fmt, va_list va) -{ - m_sError = vssprintf( fmt, va ); } const char* RageException::what() const throw () @@ -67,19 +59,21 @@ void RageException::Throw(const char *fmt, ...) DebugBreak(); #endif - throw RageException("%s", error.c_str()); + throw RageException( error ); } void RageException::ThrowNonfatal(const char *fmt, ...) { va_list va; va_start(va, fmt); + CString error = vssprintf( fmt, va ); + va_end(va); if(LOG) { - LOG->Trace("Nonfatal exception thrown: %s", vssprintf( fmt, va ).c_str()); + LOG->Trace("Nonfatal exception thrown: %s", error.c_str()); LOG->Flush(); } - throw RageException(fmt, va); + throw RageException( error ); } diff --git a/stepmania/src/RageException.h b/stepmania/src/RageException.h index b206bd8596..7d44166ce9 100644 --- a/stepmania/src/RageException.h +++ b/stepmania/src/RageException.h @@ -17,8 +17,7 @@ class RageException : public exception { public: - RageException( const char *fmt, ...); - RageException( const char *fmt, va_list va); + RageException( const CString &str ); virtual const char *what() const throw(); virtual ~RageException() throw() { }