diff options
Diffstat (limited to 'gif_err.c')
-rw-r--r-- | gif_err.c | 77 |
1 files changed, 27 insertions, 50 deletions
@@ -1,64 +1,43 @@ /***************************************************************************** - * "Gif-Lib" - Yet another gif library. - * - * Written by: Gershon Elber IBM PC Ver 0.1, Jun. 1989 - ***************************************************************************** - * Handle error reporting for the GIF library. - ***************************************************************************** - * History: - * 17 Jun 89 - Version 1.0 by Gershon Elber. - ****************************************************************************/ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +gif_err.c - handle error reporting for the GIF library. -#include <stdio.h> -#include "gif_lib.h" - -int _GifError = 0; - -/***************************************************************************** - * Return the last GIF error (0 if none) and reset the error. - ****************************************************************************/ -int -GifLastError(void) { - int i = _GifError; +****************************************************************************/ - _GifError = 0; +#include <stdio.h> - return i; -} -#ifndef _GBA_NO_FILEIO +#include "gif_lib.h" +#include "gif_lib_private.h" /***************************************************************************** - * Print the last GIF error to stderr. - ****************************************************************************/ -void -PrintGifError(void) { + Return a string description of the last GIF error +*****************************************************************************/ +char * +GifErrorString(int ErrorCode) +{ char *Err; - switch (_GifError) { + switch (ErrorCode) { case E_GIF_ERR_OPEN_FAILED: Err = "Failed to open given file"; break; case E_GIF_ERR_WRITE_FAILED: - Err = "Failed to Write to given file"; + Err = "Failed to write to given file"; break; case E_GIF_ERR_HAS_SCRN_DSCR: - Err = "Screen Descriptor already been set"; + Err = "Screen descriptor has already been set"; break; case E_GIF_ERR_HAS_IMAG_DSCR: - Err = "Image Descriptor is still active"; + Err = "Image descriptor is still active"; break; case E_GIF_ERR_NO_COLOR_MAP: - Err = "Neither Global Nor Local color map"; + Err = "Neither global nor local color map"; break; case E_GIF_ERR_DATA_TOO_BIG: - Err = "#Pixels bigger than Width * Height"; + Err = "Number of pixels bigger than width * height"; break; case E_GIF_ERR_NOT_ENOUGH_MEM: - Err = "Fail to allocate required memory"; + Err = "Failed to allocate required memory"; break; case E_GIF_ERR_DISK_IS_FULL: Err = "Write failed (disk full?)"; @@ -73,28 +52,28 @@ PrintGifError(void) { Err = "Failed to open given file"; break; case D_GIF_ERR_READ_FAILED: - Err = "Failed to Read from given file"; + Err = "Failed to read from given file"; break; case D_GIF_ERR_NOT_GIF_FILE: - Err = "Given file is NOT GIF file"; + Err = "Data is not in GIF format"; break; case D_GIF_ERR_NO_SCRN_DSCR: - Err = "No Screen Descriptor detected"; + Err = "No screen descriptor detected"; break; case D_GIF_ERR_NO_IMAG_DSCR: Err = "No Image Descriptor detected"; break; case D_GIF_ERR_NO_COLOR_MAP: - Err = "Neither Global Nor Local color map"; + Err = "Neither global nor local color map"; break; case D_GIF_ERR_WRONG_RECORD: Err = "Wrong record type detected"; break; case D_GIF_ERR_DATA_TOO_BIG: - Err = "#Pixels bigger than Width * Height"; + Err = "Number of pixels bigger than width * height"; break; case D_GIF_ERR_NOT_ENOUGH_MEM: - Err = "Fail to allocate required memory"; + Err = "Failed to allocate required memory"; break; case D_GIF_ERR_CLOSE_FAILED: Err = "Failed to close given file"; @@ -106,15 +85,13 @@ PrintGifError(void) { Err = "Image is defective, decoding aborted"; break; case D_GIF_ERR_EOF_TOO_SOON: - Err = "Image EOF detected, before image complete"; + Err = "Image EOF detected before image complete"; break; default: Err = NULL; break; } - if (Err != NULL) - fprintf(stderr, "\nGIF-LIB error: %s.\n", Err); - else - fprintf(stderr, "\nGIF-LIB undefined error %d.\n", _GifError); + return Err; } -#endif /* _GBA_NO_FILEIO */ + +/* end */ |