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