cderror.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * cderror.h
  3. *
  4. * Copyright (C) 1994-1997, Thomas G. Lane.
  5. * Modified 2009-2017 by Guido Vollbeding.
  6. * This file is part of the Independent JPEG Group's software.
  7. * For conditions of distribution and use, see the accompanying README.ijg
  8. * file.
  9. *
  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. /*
  17. * To define the enum list of message codes, include this file without
  18. * defining macro JMESSAGE. To create a message string table, include it
  19. * again with a suitable JMESSAGE definition (see jerror.c for an example).
  20. */
  21. #ifndef JMESSAGE
  22. #ifndef CDERROR_H
  23. #define CDERROR_H
  24. /* First time through, define the enum list */
  25. #define JMAKE_ENUM_LIST
  26. #else
  27. /* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
  28. #define JMESSAGE(code, string)
  29. #endif /* CDERROR_H */
  30. #endif /* JMESSAGE */
  31. #ifdef JMAKE_ENUM_LIST
  32. typedef enum {
  33. #define JMESSAGE(code, string) code,
  34. #endif /* JMAKE_ENUM_LIST */
  35. JMESSAGE(JMSG_FIRSTADDONCODE = 1000, NULL) /* Must be first entry! */
  36. #ifdef BMP_SUPPORTED
  37. JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
  38. JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported")
  39. JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length")
  40. JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1")
  41. JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
  42. JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
  43. JMESSAGE(JERR_BMP_EMPTY, "Empty BMP image")
  44. JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
  45. JMESSAGE(JERR_BMP_OUTOFRANGE, "Numeric value out of range in BMP file")
  46. JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
  47. JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
  48. JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image")
  49. JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image")
  50. #endif /* BMP_SUPPORTED */
  51. #ifdef GIF_SUPPORTED
  52. JMESSAGE(JERR_GIF_BUG, "GIF output got confused")
  53. JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d")
  54. JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB")
  55. JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file")
  56. JMESSAGE(JERR_GIF_NOT, "Not a GIF file")
  57. JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image")
  58. JMESSAGE(JTRC_GIF_BADVERSION,
  59. "Warning: unexpected GIF version number '%c%c%c'")
  60. JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x")
  61. JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input")
  62. JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file")
  63. JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring")
  64. JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image")
  65. JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits")
  66. #endif /* GIF_SUPPORTED */
  67. #ifdef PPM_SUPPORTED
  68. JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
  69. JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
  70. JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
  71. JMESSAGE(JERR_PPM_OUTOFRANGE, "Numeric value out of range in PPM file")
  72. JMESSAGE(JTRC_PGM, "%ux%u PGM image")
  73. JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
  74. JMESSAGE(JTRC_PPM, "%ux%u PPM image")
  75. JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image")
  76. #endif /* PPM_SUPPORTED */
  77. #ifdef RLE_SUPPORTED
  78. JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library")
  79. JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB")
  80. JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE")
  81. JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file")
  82. JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header")
  83. JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header")
  84. JMESSAGE(JERR_RLE_NOT, "Not an RLE file")
  85. JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE")
  86. JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup")
  87. JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file")
  88. JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d")
  89. JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file")
  90. JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d")
  91. JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d")
  92. #endif /* RLE_SUPPORTED */
  93. #ifdef TARGA_SUPPORTED
  94. JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format")
  95. JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
  96. JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB")
  97. JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
  98. JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image")
  99. JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image")
  100. #else
  101. JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
  102. #endif /* TARGA_SUPPORTED */
  103. JMESSAGE(JERR_BAD_CMAP_FILE,
  104. "Color map file is invalid or of unsupported format")
  105. JMESSAGE(JERR_TOO_MANY_COLORS,
  106. "Output file format cannot handle %d colormap entries")
  107. JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed")
  108. #ifdef TARGA_SUPPORTED
  109. JMESSAGE(JERR_UNKNOWN_FORMAT,
  110. "Unrecognized input file format --- perhaps you need -targa")
  111. #else
  112. JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format")
  113. #endif
  114. JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format")
  115. #ifdef JMAKE_ENUM_LIST
  116. JMSG_LASTADDONCODE
  117. } ADDON_MESSAGE_CODE;
  118. #undef JMAKE_ENUM_LIST
  119. #endif /* JMAKE_ENUM_LIST */
  120. /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
  121. #undef JMESSAGE