1 /* common defs for jpeg read/write
2  */
3 
4 /*
5 
6     Copyright (C) 1991-2005 The National Gallery
7 
8     This library is free software; you can redistribute it and/or
9     modify it under the terms of the GNU Lesser General Public
10     License as published by the Free Software Foundation; either
11     version 2.1 of the License, or (at your option) any later version.
12 
13     This library is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16     Lesser General Public License for more details.
17 
18     You should have received a copy of the GNU Lesser General Public
19     License along with this library; if not, write to the Free Software
20     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21     02110-1301  USA
22 
23  */
24 
25 /*
26 
27     These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
28 
29  */
30 
31 #ifndef VIPS_JPEG_H
32 #define VIPS_JPEG_H
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /*__cplusplus*/
37 
38 /* jpeglib includes jconfig.h, which can define HAVE_STDLIB_H ... which we
39  * also define. Make sure it's turned off.
40  */
41 #ifdef HAVE_STDLIB_H
42 #undef HAVE_STDLIB_H
43 #endif /*HAVE_STDLIB_H*/
44 
45 /* jpeglib defines its own boolean type as an enum which then clashes with
46  * everyone elses. Rename it as jboolean.
47  */
48 #define boolean jboolean
49 
50 /* Any TRUE/FALSE macros which have crept in will cause terrible confusion as
51  * well.
52  */
53 #ifdef TRUE
54 #undef TRUE
55 #endif /*TRUE*/
56 
57 #ifdef FALSE
58 #undef FALSE
59 #endif /*FALSE*/
60 
61 #include <jpeglib.h>
62 #include <jerror.h>
63 
64 /* Define a new error handler for when we bomb out.
65  */
66 typedef struct {
67 	/* Public fields.
68 	 */
69 	struct jpeg_error_mgr pub;
70 
71 	/* Private stuff for us.
72 	 */
73 	jmp_buf jmp;		/* longjmp() here to get back to VIPS */
74 	FILE *fp;		/* fclose() if non-NULL */
75 } ErrorManager;
76 
77 void vips__new_output_message( j_common_ptr cinfo );
78 void vips__new_error_exit( j_common_ptr cinfo );
79 
80 #ifdef __cplusplus
81 }
82 #endif /*__cplusplus*/
83 
84 #endif /*VIPS_JPEG_H*/
85