diff --git a/src/common/Exception.cpp b/src/common/Exception.cpp index 6ef8b2819..8d0a9ed6e 100644 --- a/src/common/Exception.cpp +++ b/src/common/Exception.cpp @@ -30,6 +30,11 @@ namespace love va_end(args); } + Exception::Exception(int unparsed, const char * str) + { + strncpy(buffer, str, BUFFER_SIZE); + } + const char * Exception::what() const throw() { return (const char *)buffer; diff --git a/src/common/Exception.h b/src/common/Exception.h index 15a233f7e..337ec9d36 100644 --- a/src/common/Exception.h +++ b/src/common/Exception.h @@ -24,6 +24,7 @@ #include #include // vararg #include // vsnprintf +#include // strncpy namespace love { @@ -54,6 +55,7 @@ namespace love * @param fmt The format string (see printf). **/ Exception(const char * fmt, ...); + Exception(int unparsed, const char * str); /** * Returns a string containing reason for the exception. diff --git a/src/modules/graphics/opengl/Font.cpp b/src/modules/graphics/opengl/Font.cpp index 28b104401..10046413e 100644 --- a/src/modules/graphics/opengl/Font.cpp +++ b/src/modules/graphics/opengl/Font.cpp @@ -174,20 +174,10 @@ namespace opengl dx += glyph->spacing; } } - catch (utf8::invalid_code_point e) + catch (utf8::exception & e) { glPopMatrix(); - throw love::Exception(e.what()); - } - catch (utf8::invalid_utf8 e) - { - glPopMatrix(); - throw love::Exception(e.what()); - } - catch (utf8::exception e) - { - glPopMatrix(); - throw love::Exception(e.what()); + throw love::Exception(1, e.what()); } glPopMatrix(); } @@ -220,19 +210,9 @@ namespace opengl temp += static_cast(g->spacing * mSpacing); } } - catch (utf8::invalid_code_point e) + catch (utf8::exception & e) { - glPopMatrix(); - throw love::Exception(e.what()); - } - catch (utf8::invalid_utf8 e) - { - glPopMatrix(); - throw love::Exception(e.what()); - } - catch (utf8::exception e) - { - throw love::Exception(e.what()); + throw love::Exception(1, e.what()); } return temp; diff --git a/src/modules/physics/box2d/Source/Common/b2Settings.h b/src/modules/physics/box2d/Source/Common/b2Settings.h index 2ba53255e..545b6f64b 100644 --- a/src/modules/physics/box2d/Source/Common/b2Settings.h +++ b/src/modules/physics/box2d/Source/Common/b2Settings.h @@ -25,7 +25,7 @@ #define B2_NOT_USED(x) x //#define b2Assert(A) assert(A) -#define b2Assert(A) {if(!(A)) throw love::Exception(#A);} +#define b2Assert(A) {if(!(A)) throw love::Exception(1, #A);} // need to include NDS jtypes.h instead of