comparison contrib/python-zstandard/zstd/common/error_private.h @ 37495:b1fb341d8a61

zstandard: vendor python-zstandard 0.9.0 This was just released. It features a number of goodies. More info at https://gregoryszorc.com/blog/2018/04/09/release-of-python-zstandard-0.9/. The clang-format ignore list was updated to reflect the new source of files. The project contains a vendored copy of zstandard 1.3.4. The old version was 1.1.3. One of the changes between those versions is that zstandard is now dual licensed BSD + GPLv2 and the patent rights grant has been removed. Good riddance. The API should be backwards compatible. So no changes in core should be needed. However, there were a number of changes in the library that we'll want to adapt to. Those will be addressed in subsequent commits. Differential Revision: https://phab.mercurial-scm.org/D3198
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 09 Apr 2018 10:13:29 -0700
parents 2e484bdea8c4
children
comparison
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