| 1 | /**************************************************************************** |
| 2 | * |
| 3 | * fterrors.c |
| 4 | * |
| 5 | * FreeType API for error code handling. |
| 6 | * |
| 7 | * Copyright (C) 2018-2019 by |
| 8 | * Armin Hasitzka, David Turner, Robert Wilhelm, and Werner Lemberg. |
| 9 | * |
| 10 | * This file is part of the FreeType project, and may only be used, |
| 11 | * modified, and distributed under the terms of the FreeType project |
| 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute |
| 13 | * this file you indicate that you have read the license and |
| 14 | * understand and accept it fully. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | |
| 19 | #include <ft2build.h> |
| 20 | #include FT_ERRORS_H |
| 21 | |
| 22 | |
| 23 | /* documentation is in fterrors.h */ |
| 24 | |
| 25 | FT_EXPORT_DEF( const char* ) |
| 26 | FT_Error_String( FT_Error error_code ) |
| 27 | { |
| 28 | if ( error_code < 0 || |
| 29 | error_code >= FT_ERR_CAT( FT_ERR_PREFIX, Max ) ) |
| 30 | return NULL; |
| 31 | |
| 32 | #if defined( FT_CONFIG_OPTION_ERROR_STRINGS ) || \ |
| 33 | defined( FT_DEBUG_LEVEL_ERROR ) |
| 34 | |
| 35 | #undef FTERRORS_H_ |
| 36 | #define FT_ERROR_START_LIST switch ( FT_ERROR_BASE( error_code ) ) { |
| 37 | #define FT_ERRORDEF( e, v, s ) case v: return s; |
| 38 | #define FT_ERROR_END_LIST } |
| 39 | |
| 40 | #include FT_ERRORS_H |
| 41 | |
| 42 | #endif /* defined( FT_CONFIG_OPTION_ERROR_STRINGS ) || ... */ |
| 43 | |
| 44 | return NULL; |
| 45 | } |
| 46 | |