cderror.h 4.6 KB

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