gif_err.c 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*****************************************************************************
  2. gif_err.c - handle error reporting for the GIF library.
  3. ****************************************************************************/
  4. #include <stdio.h>
  5. #include "gif_lib.h"
  6. #include "gif_lib_private.h"
  7. /*****************************************************************************
  8. Return a string description of the last GIF error
  9. *****************************************************************************/
  10. const char *
  11. GifErrorString(int ErrorCode)
  12. {
  13. const char *Err;
  14. switch (ErrorCode) {
  15. case E_GIF_ERR_OPEN_FAILED:
  16. Err = "Failed to open given file";
  17. break;
  18. case E_GIF_ERR_WRITE_FAILED:
  19. Err = "Failed to write to given file";
  20. break;
  21. case E_GIF_ERR_HAS_SCRN_DSCR:
  22. Err = "Screen descriptor has already been set";
  23. break;
  24. case E_GIF_ERR_HAS_IMAG_DSCR:
  25. Err = "Image descriptor is still active";
  26. break;
  27. case E_GIF_ERR_NO_COLOR_MAP:
  28. Err = "Neither global nor local color map";
  29. break;
  30. case E_GIF_ERR_DATA_TOO_BIG:
  31. Err = "Number of pixels bigger than width * height";
  32. break;
  33. case E_GIF_ERR_NOT_ENOUGH_MEM:
  34. Err = "Failed to allocate required memory";
  35. break;
  36. case E_GIF_ERR_DISK_IS_FULL:
  37. Err = "Write failed (disk full?)";
  38. break;
  39. case E_GIF_ERR_CLOSE_FAILED:
  40. Err = "Failed to close given file";
  41. break;
  42. case E_GIF_ERR_NOT_WRITEABLE:
  43. Err = "Given file was not opened for write";
  44. break;
  45. case D_GIF_ERR_OPEN_FAILED:
  46. Err = "Failed to open given file";
  47. break;
  48. case D_GIF_ERR_READ_FAILED:
  49. Err = "Failed to read from given file";
  50. break;
  51. case D_GIF_ERR_NOT_GIF_FILE:
  52. Err = "Data is not in GIF format";
  53. break;
  54. case D_GIF_ERR_NO_SCRN_DSCR:
  55. Err = "No screen descriptor detected";
  56. break;
  57. case D_GIF_ERR_NO_IMAG_DSCR:
  58. Err = "No Image Descriptor detected";
  59. break;
  60. case D_GIF_ERR_NO_COLOR_MAP:
  61. Err = "Neither global nor local color map";
  62. break;
  63. case D_GIF_ERR_WRONG_RECORD:
  64. Err = "Wrong record type detected";
  65. break;
  66. case D_GIF_ERR_DATA_TOO_BIG:
  67. Err = "Number of pixels bigger than width * height";
  68. break;
  69. case D_GIF_ERR_NOT_ENOUGH_MEM:
  70. Err = "Failed to allocate required memory";
  71. break;
  72. case D_GIF_ERR_CLOSE_FAILED:
  73. Err = "Failed to close given file";
  74. break;
  75. case D_GIF_ERR_NOT_READABLE:
  76. Err = "Given file was not opened for read";
  77. break;
  78. case D_GIF_ERR_IMAGE_DEFECT:
  79. Err = "Image is defective, decoding aborted";
  80. break;
  81. case D_GIF_ERR_EOF_TOO_SOON:
  82. Err = "Image EOF detected before image complete";
  83. break;
  84. default:
  85. Err = NULL;
  86. break;
  87. }
  88. return Err;
  89. }
  90. /* end */