1 /* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle in the LICENSE file that accompanied this code. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 /***************************************************************************** 26 27 gif_err.c - handle error reporting for the GIF library. 28 29 ****************************************************************************/ 30 31 #include <stdio.h> 32 33 #include "gif_lib.h" 34 #include "gif_lib_private.h" 35 36 /***************************************************************************** 37 Return a string description of the last GIF error 38 *****************************************************************************/ 39 const char * 40 GifErrorString(int ErrorCode) 41 { 42 const char *Err; 43 44 switch (ErrorCode) { 45 case E_GIF_ERR_OPEN_FAILED: 46 Err = "Failed to open given file"; 47 break; 48 case E_GIF_ERR_WRITE_FAILED: 49 Err = "Failed to write to given file"; 50 break; 51 case E_GIF_ERR_HAS_SCRN_DSCR: 52 Err = "Screen descriptor has already been set"; 53 break; 54 case E_GIF_ERR_HAS_IMAG_DSCR: 55 Err = "Image descriptor is still active"; 56 break; 57 case E_GIF_ERR_NO_COLOR_MAP: 58 Err = "Neither global nor local color map"; 59 break; 60 case E_GIF_ERR_DATA_TOO_BIG: 61 Err = "Number of pixels bigger than width * height"; 62 break; 63 case E_GIF_ERR_NOT_ENOUGH_MEM: 64 Err = "Failed to allocate required memory"; 65 break; 66 case E_GIF_ERR_DISK_IS_FULL: 67 Err = "Write failed (disk full?)"; 68 break; 69 case E_GIF_ERR_CLOSE_FAILED: 70 Err = "Failed to close given file"; 71 break; 72 case E_GIF_ERR_NOT_WRITEABLE: 73 Err = "Given file was not opened for write"; 74 break; 75 case D_GIF_ERR_OPEN_FAILED: 76 Err = "Failed to open given file"; 77 break; 78 case D_GIF_ERR_READ_FAILED: 79 Err = "Failed to read from given file"; 80 break; 81 case D_GIF_ERR_NOT_GIF_FILE: 82 Err = "Data is not in GIF format"; 83 break; 84 case D_GIF_ERR_NO_SCRN_DSCR: 85 Err = "No screen descriptor detected"; 86 break; 87 case D_GIF_ERR_NO_IMAG_DSCR: 88 Err = "No Image Descriptor detected"; 89 break; 90 case D_GIF_ERR_NO_COLOR_MAP: 91 Err = "Neither global nor local color map"; 92 break; 93 case D_GIF_ERR_WRONG_RECORD: 94 Err = "Wrong record type detected"; 95 break; 96 case D_GIF_ERR_DATA_TOO_BIG: 97 Err = "Number of pixels bigger than width * height"; 98 break; 99 case D_GIF_ERR_NOT_ENOUGH_MEM: 100 Err = "Failed to allocate required memory"; 101 break; 102 case D_GIF_ERR_CLOSE_FAILED: 103 Err = "Failed to close given file"; 104 break; 105 case D_GIF_ERR_NOT_READABLE: 106 Err = "Given file was not opened for read"; 107 break; 108 case D_GIF_ERR_IMAGE_DEFECT: 109 Err = "Image is defective, decoding aborted"; 110 break; 111 case D_GIF_ERR_EOF_TOO_SOON: 112 Err = "Image EOF detected before image complete"; 113 break; 114 default: 115 Err = NULL; 116 break; 117 } 118 return Err; 119 } 120 121 /* end */