error.c (991B)
1 /* 2 * error.c 3 * libansilove 1.3.1 4 * https://www.ansilove.org 5 * 6 * Copyright (c) 2011-2022 Stefan Vogt, Brian Cassidy, and Frederic Cambus 7 * All rights reserved. 8 * 9 * libansilove is licensed under the BSD 2-Clause license. 10 * See LICENSE file for details. 11 * 12 * SPDX-License-Identifier: BSD-2-Clause 13 */ 14 15 #include <stddef.h> 16 #include "ansilove.h" 17 18 char * 19 ansilove_error(struct ansilove_ctx *ctx) 20 { 21 if (ctx == NULL) 22 return NULL; 23 24 switch (ctx->error) { 25 case ANSILOVE_INVALID_PARAM: 26 return "Invalid parameter."; 27 break; 28 case ANSILOVE_FORMAT_ERROR: 29 return "File format error."; 30 break; 31 case ANSILOVE_MEMORY_ERROR: 32 return "Memory allocation error."; 33 break; 34 case ANSILOVE_RANGE_ERROR: 35 return "Value out of allowed range."; 36 break; 37 case ANSILOVE_FILE_READ_ERROR: 38 return "Error reading file."; 39 break; 40 case ANSILOVE_FILE_WRITE_ERROR: 41 return "Error writing file."; 42 break; 43 case ANSILOVE_GD_ERROR: 44 return "GD library error."; 45 break; 46 default: 47 return NULL; 48 } 49 }