Coverage Report

Created: 2023-03-26 07:33

/src/giflib-code/gif_err.c
Line
Count
Source (jump to first uncovered line)
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
0
{
20
0
    const char *Err;
21
22
0
    switch (ErrorCode) {
23
0
      case E_GIF_ERR_OPEN_FAILED:
24
0
        Err = "Failed to open given file";
25
0
        break;
26
0
      case E_GIF_ERR_WRITE_FAILED:
27
0
        Err = "Failed to write to given file";
28
0
        break;
29
0
      case E_GIF_ERR_HAS_SCRN_DSCR:
30
0
        Err = "Screen descriptor has already been set";
31
0
        break;
32
0
      case E_GIF_ERR_HAS_IMAG_DSCR:
33
0
        Err = "Image descriptor is still active";
34
0
        break;
35
0
      case E_GIF_ERR_NO_COLOR_MAP:
36
0
        Err = "Neither global nor local color map";
37
0
        break;
38
0
      case E_GIF_ERR_DATA_TOO_BIG:
39
0
        Err = "Number of pixels bigger than width * height";
40
0
        break;
41
0
      case E_GIF_ERR_NOT_ENOUGH_MEM:
42
0
        Err = "Failed to allocate required memory";
43
0
        break;
44
0
      case E_GIF_ERR_DISK_IS_FULL:
45
0
        Err = "Write failed (disk full?)";
46
0
        break;
47
0
      case E_GIF_ERR_CLOSE_FAILED:
48
0
        Err = "Failed to close given file";
49
0
        break;
50
0
      case E_GIF_ERR_NOT_WRITEABLE:
51
0
        Err = "Given file was not opened for write";
52
0
        break;
53
0
      case D_GIF_ERR_OPEN_FAILED:
54
0
        Err = "Failed to open given file";
55
0
        break;
56
0
      case D_GIF_ERR_READ_FAILED:
57
0
        Err = "Failed to read from given file";
58
0
        break;
59
0
      case D_GIF_ERR_NOT_GIF_FILE:
60
0
        Err = "Data is not in GIF format";
61
0
        break;
62
0
      case D_GIF_ERR_NO_SCRN_DSCR:
63
0
        Err = "No screen descriptor detected";
64
0
        break;
65
0
      case D_GIF_ERR_NO_IMAG_DSCR:
66
0
        Err = "No Image Descriptor detected";
67
0
        break;
68
0
      case D_GIF_ERR_NO_COLOR_MAP:
69
0
        Err = "Neither global nor local color map";
70
0
        break;
71
0
      case D_GIF_ERR_WRONG_RECORD:
72
0
        Err = "Wrong record type detected";
73
0
        break;
74
0
      case D_GIF_ERR_DATA_TOO_BIG:
75
0
        Err = "Number of pixels bigger than width * height";
76
0
        break;
77
0
      case D_GIF_ERR_NOT_ENOUGH_MEM:
78
0
        Err = "Failed to allocate required memory";
79
0
        break;
80
0
      case D_GIF_ERR_CLOSE_FAILED:
81
0
        Err = "Failed to close given file";
82
0
        break;
83
0
      case D_GIF_ERR_NOT_READABLE:
84
0
        Err = "Given file was not opened for read";
85
0
        break;
86
0
      case D_GIF_ERR_IMAGE_DEFECT:
87
0
        Err = "Image is defective, decoding aborted";
88
0
        break;
89
0
      case D_GIF_ERR_EOF_TOO_SOON:
90
0
        Err = "Image EOF detected before image complete";
91
0
        break;
92
0
      default:
93
0
        Err = NULL;
94
0
        break;
95
0
    }
96
0
    return Err;
97
0
}
98
99
/* end */