Commit 9f0da96d authored by Jeff Muizelaar's avatar Jeff Muizelaar

2005-06-01 Jeff Muizelaar <jeff@infidigm.net>

	* poppler/Error.cc:
	* poppler/Error.h: Make error handling function setable through
	setErrorFunction.

	Based on a patch by Albert Astals Cid.
parent f688aa11
2005-06-01 Jeff Muizelaar <jeff@infidigm.net>
* poppler/Error.cc:
* poppler/Error.h: Make error handling function setable through
setErrorFunction.
Based on a patch by Albert Astals Cid.
2005-05-29 Kristian Høgsberg <krh@redhat.com>
* glib/*: Add more meta data properties to poppler document.
......
......@@ -18,21 +18,32 @@
#include "GlobalParams.h"
#include "Error.h"
void CDECL error(int pos, char *msg, ...) {
va_list args;
// NB: this can be called before the globalParams object is created
if (globalParams && globalParams->getErrQuiet()) {
return;
}
static void CDECL defaultErrorFunction(int pos, char *msg, va_list args)
{
if (pos >= 0) {
fprintf(stderr, "Error (%d): ", pos);
} else {
fprintf(stderr, "Error: ");
}
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
fprintf(stderr, "\n");
fflush(stderr);
}
static void CDECL (*errorFunction)(int , char *, va_list args) = defaultErrorFunction;
void setErrorFunction(void CDECL (* f)(int , char *, va_list args))
{
errorFunction = f;
}
void CDECL error(int pos, char *msg, ...) {
va_list args;
// NB: this can be called before the globalParams object is created
if (globalParams && globalParams->getErrQuiet()) {
return;
}
va_start(args, msg);
(*errorFunction)(pos, msg, args);
va_end(args);
}
......@@ -18,4 +18,6 @@
extern void CDECL error(int pos, char *msg, ...);
void setErrorFunction(void (* f)(int , char *, va_list args));
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment