![]() |
|
|||
0001 /* 0002 * Copyright (c) Yann Collet, Facebook, Inc. 0003 * All rights reserved. 0004 * 0005 * This source code is licensed under both the BSD-style license (found in the 0006 * LICENSE file in the root directory of this source tree) and the GPLv2 (found 0007 * in the COPYING file in the root directory of this source tree). 0008 * You may select, at your option, one of the above-listed licenses. 0009 */ 0010 0011 /* Note : this module is expected to remain private, do not expose it */ 0012 0013 #ifndef ERROR_H_MODULE 0014 #define ERROR_H_MODULE 0015 0016 0017 0018 /* **************************************** 0019 * Dependencies 0020 ******************************************/ 0021 #include "zstd_deps.h" /* size_t */ 0022 #include <linux/zstd_errors.h> /* enum list */ 0023 0024 0025 /* **************************************** 0026 * Compiler-specific 0027 ******************************************/ 0028 #define ERR_STATIC static __attribute__((unused)) 0029 0030 0031 /*-**************************************** 0032 * Customization (error_public.h) 0033 ******************************************/ 0034 typedef ZSTD_ErrorCode ERR_enum; 0035 #define PREFIX(name) ZSTD_error_##name 0036 0037 0038 /*-**************************************** 0039 * Error codes handling 0040 ******************************************/ 0041 #undef ERROR /* already defined on Visual Studio */ 0042 #define ERROR(name) ZSTD_ERROR(name) 0043 #define ZSTD_ERROR(name) ((size_t)-PREFIX(name)) 0044 0045 ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); } 0046 0047 ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; return (ERR_enum) (0-code); } 0048 0049 /* check and forward error code */ 0050 #define CHECK_V_F(e, f) size_t const e = f; if (ERR_isError(e)) return e 0051 #define CHECK_F(f) { CHECK_V_F(_var_err__, f); } 0052 0053 0054 /*-**************************************** 0055 * Error Strings 0056 ******************************************/ 0057 0058 const char* ERR_getErrorString(ERR_enum code); /* error_private.c */ 0059 0060 ERR_STATIC const char* ERR_getErrorName(size_t code) 0061 { 0062 return ERR_getErrorString(ERR_getErrorCode(code)); 0063 } 0064 0065 0066 #endif /* ERROR_H_MODULE */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |