blob: 4f2c7a3e5f774224418a70307b67b57d5a9d2e16 [file] [log] [blame]
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +00001/*
2 * cderror.h
3 *
Thomas G. Lane5ead57a1998-03-27 00:00:00 +00004 * Copyright (C) 1994-1997, Thomas G. Lane.
Leon Scroggins III3993b372018-07-16 10:43:45 -04005 * Modified 2009-2017 by Guido Vollbeding.
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +00006 * This file is part of the Independent JPEG Group's software.
Alex Naidis6eb7d372016-10-16 23:10:08 +02007 * For conditions of distribution and use, see the accompanying README.ijg
8 * file.
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +00009 *
10 * This file defines the error and message codes for the cjpeg/djpeg
11 * applications. These strings are not needed as part of the JPEG library
12 * proper.
13 * Edit this file to add new codes, or to translate the message strings to
14 * some other language.
15 */
16
Thomas G. Lane9ba2f5e1994-12-07 00:00:00 +000017/*
18 * To define the enum list of message codes, include this file without
19 * defining macro JMESSAGE. To create a message string table, include it
20 * again with a suitable JMESSAGE definition (see jerror.c for an example).
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000021 */
Thomas G. Lane9ba2f5e1994-12-07 00:00:00 +000022#ifndef JMESSAGE
23#ifndef CDERROR_H
24#define CDERROR_H
25/* First time through, define the enum list */
26#define JMAKE_ENUM_LIST
27#else
28/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
Leon Scroggins III3993b372018-07-16 10:43:45 -040029#define JMESSAGE(code, string)
Thomas G. Lane9ba2f5e1994-12-07 00:00:00 +000030#endif /* CDERROR_H */
31#endif /* JMESSAGE */
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000032
Thomas G. Lane9ba2f5e1994-12-07 00:00:00 +000033#ifdef JMAKE_ENUM_LIST
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000034
35typedef enum {
36
Leon Scroggins III3993b372018-07-16 10:43:45 -040037#define JMESSAGE(code, string) code,
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000038
Thomas G. Lane9ba2f5e1994-12-07 00:00:00 +000039#endif /* JMAKE_ENUM_LIST */
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000040
Leon Scroggins III3993b372018-07-16 10:43:45 -040041JMESSAGE(JMSG_FIRSTADDONCODE = 1000, NULL) /* Must be first entry! */
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000042
43#ifdef BMP_SUPPORTED
44JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
45JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported")
46JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length")
47JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1")
48JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
49JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
Guido Vollbeding989630f2010-01-10 00:00:00 +000050JMESSAGE(JERR_BMP_EMPTY, "Empty BMP image")
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000051JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
Leon Scroggins III3993b372018-07-16 10:43:45 -040052JMESSAGE(JERR_BMP_OUTOFRANGE, "Numeric value out of range in BMP file")
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000053JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
54JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
55JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image")
56JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image")
57#endif /* BMP_SUPPORTED */
58
59#ifdef GIF_SUPPORTED
60JMESSAGE(JERR_GIF_BUG, "GIF output got confused")
61JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d")
62JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB")
63JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file")
64JMESSAGE(JERR_GIF_NOT, "Not a GIF file")
65JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image")
66JMESSAGE(JTRC_GIF_BADVERSION,
DRCe5eaf372014-05-09 18:00:32 +000067 "Warning: unexpected GIF version number '%c%c%c'")
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000068JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x")
69JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input")
70JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file")
71JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring")
72JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image")
73JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits")
74#endif /* GIF_SUPPORTED */
75
76#ifdef PPM_SUPPORTED
77JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
78JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
Thomas G. Lane5ead57a1998-03-27 00:00:00 +000079JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
Leon Scroggins III3993b372018-07-16 10:43:45 -040080JMESSAGE(JERR_PPM_OUTOFRANGE, "Numeric value out of range in PPM file")
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000081JMESSAGE(JTRC_PGM, "%ux%u PGM image")
82JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
83JMESSAGE(JTRC_PPM, "%ux%u PPM image")
84JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image")
85#endif /* PPM_SUPPORTED */
86
87#ifdef RLE_SUPPORTED
88JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library")
89JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB")
90JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE")
91JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file")
92JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header")
93JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header")
94JMESSAGE(JERR_RLE_NOT, "Not an RLE file")
95JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE")
96JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup")
97JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file")
98JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d")
99JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file")
100JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d")
101JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d")
102#endif /* RLE_SUPPORTED */
103
104#ifdef TARGA_SUPPORTED
105JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format")
106JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
107JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB")
108JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
109JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image")
110JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image")
111#else
112JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
113#endif /* TARGA_SUPPORTED */
114
115JMESSAGE(JERR_BAD_CMAP_FILE,
DRCe5eaf372014-05-09 18:00:32 +0000116 "Color map file is invalid or of unsupported format")
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000117JMESSAGE(JERR_TOO_MANY_COLORS,
DRCe5eaf372014-05-09 18:00:32 +0000118 "Output file format cannot handle %d colormap entries")
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000119JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed")
120#ifdef TARGA_SUPPORTED
121JMESSAGE(JERR_UNKNOWN_FORMAT,
DRCe5eaf372014-05-09 18:00:32 +0000122 "Unrecognized input file format --- perhaps you need -targa")
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000123#else
124JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format")
125#endif
126JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format")
127
Thomas G. Lane9ba2f5e1994-12-07 00:00:00 +0000128#ifdef JMAKE_ENUM_LIST
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000129
130 JMSG_LASTADDONCODE
131} ADDON_MESSAGE_CODE;
132
Thomas G. Lane9ba2f5e1994-12-07 00:00:00 +0000133#undef JMAKE_ENUM_LIST
134#endif /* JMAKE_ENUM_LIST */
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000135
Thomas G. Lane9ba2f5e1994-12-07 00:00:00 +0000136/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000137#undef JMESSAGE