contrib/python-zstandard/zstd/common/error_private.h
changeset 37495 b1fb341d8a61
parent 30434 2e484bdea8c4
equal deleted inserted replaced
37494:1ce7a55b09d1 37495:b1fb341d8a61
     1 /**
     1 /*
     2  * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
     2  * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
     3  * All rights reserved.
     3  * All rights reserved.
     4  *
     4  *
     5  * This source code is licensed under the BSD-style license found in the
     5  * This source code is licensed under both the BSD-style license (found in the
     6  * LICENSE file in the root directory of this source tree. An additional grant
     6  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
     7  * of patent rights can be found in the PATENTS file in the same directory.
     7  * in the COPYING file in the root directory of this source tree).
       
     8  * You may select, at your option, one of the above-listed licenses.
     8  */
     9  */
     9 
    10 
    10 /* Note : this module is expected to remain private, do not expose it */
    11 /* Note : this module is expected to remain private, do not expose it */
    11 
    12 
    12 #ifndef ERROR_H_MODULE
    13 #ifndef ERROR_H_MODULE
    46 
    47 
    47 
    48 
    48 /*-****************************************
    49 /*-****************************************
    49 *  Error codes handling
    50 *  Error codes handling
    50 ******************************************/
    51 ******************************************/
    51 #ifdef ERROR
    52 #undef ERROR   /* reported already defined on VS 2015 (Rich Geldreich) */
    52 #  undef ERROR   /* reported already defined on VS 2015 (Rich Geldreich) */
    53 #define ERROR(name) ZSTD_ERROR(name)
    53 #endif
    54 #define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
    54 #define ERROR(name) ((size_t)-PREFIX(name))
       
    55 
    55 
    56 ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
    56 ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
    57 
    57 
    58 ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; return (ERR_enum) (0-code); }
    58 ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; return (ERR_enum) (0-code); }
    59 
    59