SDL2/non-Windows: Before showing "simple message box", replace tabs with spaces.

Because the one implemented on top of X shows a special mark for tabs instead of
whitespace.
Also, in wm_msgbox(), use vsnprintf.

git-svn-id: https://svn.eduke32.com/eduke32@4120 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-10-27 21:12:25 +00:00
parent 25edec9c0a
commit 94e3856b76

View file

@ -154,7 +154,7 @@ int32_t wm_msgbox(char *name, char *fmt, ...)
UNREFERENCED_PARAMETER(name);
va_start(va,fmt);
vsprintf(buf,fmt,va);
vsnprintf(buf,sizeof(buf),fmt,va);
va_end(va);
#if defined(__APPLE__)
@ -162,6 +162,16 @@ int32_t wm_msgbox(char *name, char *fmt, ...)
#elif defined HAVE_GTK2
if (gtkbuild_msgbox(name, buf) >= 0) return 1;
#elif SDL_MAJOR_VERSION==2
# if !defined _WIN32
// Replace all tab chars with spaces because the hand-rolled SDL message
// box diplays the former as N/L instead of whitespace.
{
int32_t i;
for (i=0; i<(int32_t)sizeof(buf); i++)
if (buf[i] == '\t')
buf[i] = ' ';
}
# endif
return SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, name, buf, NULL);
#endif
puts(buf);