diff --git a/source/lib/res/ogl_tex.cpp b/source/lib/res/ogl_tex.cpp index cbe6026f35..a1e3aa9133 100755 --- a/source/lib/res/ogl_tex.cpp +++ b/source/lib/res/ogl_tex.cpp @@ -296,7 +296,7 @@ static int tex_validate(const uint line, const Tex* t) msg = "width or height is 0 - texture probably not loaded successfully"; // greater than max supported tex dimension? // no-op if oglInit not yet called - if(w > (GLsizei)max_tex_size || h > (GLsizei)max_tex_size) + if(w > (GLsizei)ogl_max_tex_size || h > (GLsizei)ogl_max_tex_size) msg = "texture dimensions exceed OpenGL implementation limit"; // both NV_texture_rectangle and subtexture require work for the client // (changing tex coords) => we'll just disallow non-power of 2 textures. diff --git a/source/lib/sysdep/debug.h b/source/lib/sysdep/debug.h index 2758834dff..08ab75e9dc 100755 --- a/source/lib/sysdep/debug.h +++ b/source/lib/sysdep/debug.h @@ -30,45 +30,48 @@ extern void debug_check_heap(void); +// user choices in the assert/unhandled exception dialog. +enum ErrorReaction +{ + // ignore, continue as if nothing happened. + ER_CONTINUE = 1, + // note: don't start at 0 because that is interpreted as a + // DialogBoxParam failure. + + // ignore and do not report again. only works with assert2. + ER_SUPPRESS, + // note: non-persistent; only applicable during this program run. + + // trigger breakpoint, i.e. enter debugger. + ER_BREAK, + + // exit the program immediately. + ER_EXIT, + // note: never returned; carried out immediately to disburden callers. +}; + + ////////////////////////////////////////////////////////////////////////////// // // assert // -enum FailedAssertUserChoice -{ - // ignore, continue as if nothing happened. - ASSERT_CONTINUE, - - // ignore and do not report again for this assert. - ASSERT_SUPPRESS, - // note: non-persistent; only applicable during this program run. - - // trigger breakpoint, i.e. enter debugger. - ASSERT_BREAK, - - // exit the program immediately. - ASSERT_EXIT - // note: carried out by debug_assert_failed; - // testing for it in assert2 would bloat code. -}; - // notify the user that an assertion failed; displays a // stack trace with local variables. -// returns one of FailedAssertUserChoice or exits the program. -extern int debug_assert_failed(const char* source_file, int line, const char* assert_expr); +// returns one of UserErrorReaction. +extern ErrorReaction debug_assert_failed(const char* source_file, int line, const char* assert_expr); // recommended use: assert2(expr && "descriptive string") #define assert2(expr)\ STMT(\ - static int suppress__ = 0;\ - if(!suppress__ && !(expr))\ + static unsigned char suppress__ = 0x55;\ + if(suppress__ == 0x55 && !(expr))\ switch(debug_assert_failed(__FILE__, __LINE__, #expr))\ {\ - case ASSERT_SUPPRESS:\ - suppress__ = 1;\ + case ER_SUPPRESS:\ + suppress__ = 0xaa;\ break;\ - case ASSERT_BREAK:\ + case ER_BREAK:\ debug_break();\ break;\ }\ diff --git a/source/lib/sysdep/unix/udbg.cpp b/source/lib/sysdep/unix/udbg.cpp index 572ba46323..ca47d759b7 100755 --- a/source/lib/sysdep/unix/udbg.cpp +++ b/source/lib/sysdep/unix/udbg.cpp @@ -105,8 +105,7 @@ static void launch_debugger() // notify the user that an assertion failed. -// returns one of FailedAssertUserChoice or exits the program. -int debug_assert_failed(const char *file, int line, const char *expr) +ErrorReaction debug_assert_failed(const char* file, int line, const char* expr) { printf("%s:%d: Assertion `%s' failed.\n", file, line, expr); do @@ -126,11 +125,11 @@ int debug_assert_failed(const char *file, int line, const char *expr) // fall through case 'b': - return ASSERT_BREAK; + return ER_BREAK; case 'c': - return ASSERT_CONTINUE; + return ER_CONTINUE; case 's': - return ASSERT_SUPPRESS; + return ER_SUPPRESS; case 'a': abort(); default: diff --git a/source/lib/sysdep/win/assert_dlg.h b/source/lib/sysdep/win/error_dialog.h similarity index 96% rename from source/lib/sysdep/win/assert_dlg.h rename to source/lib/sysdep/win/error_dialog.h index f57d105c75..9012bb0947 100755 --- a/source/lib/sysdep/win/assert_dlg.h +++ b/source/lib/sysdep/win/error_dialog.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by assert_dlg.rc +// Used by error_dialog.rc // #define IDD_DIALOG1 101 #define IDC_EDIT1 1001 diff --git a/source/lib/sysdep/win/assert_dlg.rc b/source/lib/sysdep/win/error_dialog.rc similarity index 97% rename from source/lib/sysdep/win/assert_dlg.rc rename to source/lib/sysdep/win/error_dialog.rc index 46d70654ba..b48a09a5ad 100755 --- a/source/lib/sysdep/win/assert_dlg.rc +++ b/source/lib/sysdep/win/error_dialog.rc @@ -1,6 +1,6 @@ // Microsoft Visual C++ generated resource script. // -#include "assert_dlg.h" +#include "error_dialog.h" #include ///////////////////////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 1 TEXTINCLUDE BEGIN - "assert_dlg.h\0" + "error_dialog.h\0" END 2 TEXTINCLUDE