libansilove

Library for converting ANSI, ASCII, and other formats to PNG
Log | Files | Refs | README | LICENSE

error.c (870B)


      1 /*
      2  * error.c
      3  * libansilove 1.2.4
      4  * https://www.ansilove.org
      5  *
      6  * Copyright (c) 2011-2020 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 
     13 #include <stddef.h>
     14 #include "ansilove.h"
     15 
     16 char *
     17 ansilove_error(struct ansilove_ctx *ctx)
     18 {
     19 	if (ctx == NULL)
     20 		return NULL;
     21 
     22 	switch (ctx->error) {
     23 	case ANSILOVE_INVALID_PARAM:
     24 		return "Invalid parameter.";
     25 		break;
     26 	case ANSILOVE_FORMAT_ERROR:
     27 		return "File format error.";
     28 		break;
     29 	case ANSILOVE_MEMORY_ERROR:
     30 		return "Memory allocation error.";
     31 		break;
     32 	case ANSILOVE_FILE_READ_ERROR:
     33 		return "Error reading file.";
     34 		break;
     35 	case ANSILOVE_FILE_WRITE_ERROR:
     36 		return "Error writing file.";
     37 		break;
     38 	case ANSILOVE_GD_ERROR:
     39 		return "GD library error.";
     40 		break;
     41 	default:
     42 		return NULL;
     43 	}
     44 }