mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 14:30:57 +00:00
435a566751
* sumatrapdf - vendor import * everything compiles (libjpeg, poppler, fitz, sumatrapdf) * does NOT link (remove the comment tags in the parent directory.rbuild file (rosapps dir) to build it) svn path=/trunk/; revision=29295
39 lines
819 B
C
39 lines
819 B
C
/*
|
|
* Extend libjpegs error handler to use setjmp/longjmp
|
|
*/
|
|
|
|
#include <jpeglib.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
struct myerrmgr
|
|
{
|
|
struct jpeg_error_mgr super;
|
|
jmp_buf jb;
|
|
char msg[JMSG_LENGTH_MAX];
|
|
};
|
|
|
|
static void myerrexit(j_common_ptr cinfo)
|
|
{
|
|
struct myerrmgr *err = (struct myerrmgr *)cinfo->err;
|
|
char msgbuf[JMSG_LENGTH_MAX];
|
|
err->super.format_message(cinfo, msgbuf);
|
|
strlcpy(err->msg, msgbuf, sizeof err->msg);
|
|
longjmp(err->jb, 1);
|
|
}
|
|
|
|
static void myoutmess(j_common_ptr cinfo)
|
|
{
|
|
struct myerrmgr *err = (struct myerrmgr *)cinfo->err;
|
|
char msgbuf[JMSG_LENGTH_MAX];
|
|
err->super.format_message(cinfo, msgbuf);
|
|
fprintf(stderr, "ioerror: dct: %s", msgbuf);
|
|
}
|
|
|
|
static void myiniterr(struct myerrmgr *err)
|
|
{
|
|
jpeg_std_error(&err->super);
|
|
err->super.error_exit = myerrexit;
|
|
err->super.output_message = myoutmess;
|
|
}
|
|
|