gdErrorMethod declaration was wrong, we need to pass rest of the arguments in va_list

master
Ondřej Surý 2013-04-23 10:40:52 +02:00
parent bfbbf3c9f2
commit e5dcee5ddf
4 changed files with 5 additions and 10 deletions

View File

@ -69,11 +69,8 @@ static const unsigned char gd_toascii[256] = {
extern const int gdCosT[];
extern const int gdSinT[];
void gd_stderr_error(int priority, const char *format, ...)
void gd_stderr_error(int priority, const char *format, va_list args)
{
va_list args;
va_start(args, format);
switch (priority) {
case GD_ERROR:
fputs("GD Error: ", stderr);
@ -91,9 +88,7 @@ void gd_stderr_error(int priority, const char *format, ...)
fputs("GD Debug: ", stderr);
break;
}
va_start(args, format);
fprintf(stderr, format, args);
va_end(args);
vfprintf(stderr, format, args);
fflush(stderr);
}

View File

@ -346,7 +346,7 @@ gdFont;
/* Text functions take these. */
typedef gdFont *gdFontPtr;
typedef void(*gdErrorMethod)(int, const char *, ...);
typedef void(*gdErrorMethod)(int, const char *, va_list);
BGD_DECLARE(void) gdSetErrorMethod(gdErrorMethod);
BGD_DECLARE(void) gdClearErrorMethod(void);

View File

@ -9,7 +9,7 @@
#include "gdtest.h"
#include "test_config.h"
void gdSilence(int priority, const char *format, ...)
void gdSilence(int priority, const char *format, va_list args)
{
return;
}

View File

@ -39,6 +39,6 @@ int _gdTestErrorMsg(const char* file, unsigned int line, const char* string, ...
#define gdTestErrorMsg(format, ...) _gdTestErrorMsg(__FILE__, __LINE__, format, ## __VA_ARGS__)
void gdSilence(int priority, const char *format, ...);
void gdSilence(int priority, const char *format, va_list args);
#endif /* GD_TEST_H */