X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmainerror.h;h=766f1e662db3ec967454cfc6991075e3459112a0;hb=502b6f3b6fd04f6b01c6d70dcb81aa304dd0db1c;hp=e68a24b2f288f7a7a8b3f79813ba2bad52d235b0;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/mainerror.h b/cinelerra-5.1/cinelerra/mainerror.h index e68a24b2..766f1e66 100644 --- a/cinelerra-5.1/cinelerra/mainerror.h +++ b/cinelerra-5.1/cinelerra/mainerror.h @@ -2,21 +2,21 @@ /* * CINELERRA * Copyright (C) 2008 Adam Williams - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * */ #ifndef MAINERROR_H @@ -33,17 +33,6 @@ // Once created, it accumulates errors in a listbox until it's closed. -// Macro to enable the simplest possible error output -//#define eprintf(format, ...) {char error_string[1024]; sprintf(sprintf(error_string, "%s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__); MainError::show_error(error_string); } -// We have to use longer version if we want to gettext error messages - -#define eprintf(...) do { \ - char err_msg[1024], *ep = err_msg; \ - ep += sprintf(ep, "%s:\n", __PRETTY_FUNCTION__); \ - sprintf(ep, __VA_ARGS__); (volatile void)MainError::show_error(err_msg); \ -} while(0) - - class MainErrorGUI : public BC_Window { public: @@ -98,6 +87,20 @@ private: }; +// format text to error dialog listbox +static inline void eprint1(const char *func, const char *fmt, ...) +{ + char err_msg[1024], *cp = err_msg, *ep = cp + sizeof(err_msg)-1; + va_list va; + va_start(va, fmt); + cp += snprintf(cp, ep-cp, "%s:\n", func); + cp += vsnprintf(cp, ep-cp, fmt, va); + *cp = 0; + va_end(va); + MainError::show_error(err_msg); \ +} + +#define eprintf(s...) eprint1(__PRETTY_FUNCTION__, s) #endif