comparison contrib/python-zstandard/zstd/common/zstd_errors.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 c32454d69b85
children 675775c33ab6
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 #ifndef ZSTD_ERRORS_H_398273423 11 #ifndef ZSTD_ERRORS_H_398273423
11 #define ZSTD_ERRORS_H_398273423 12 #define ZSTD_ERRORS_H_398273423
12 13
17 /*===== dependency =====*/ 18 /*===== dependency =====*/
18 #include <stddef.h> /* size_t */ 19 #include <stddef.h> /* size_t */
19 20
20 21
21 /* ===== ZSTDERRORLIB_API : control library symbols visibility ===== */ 22 /* ===== ZSTDERRORLIB_API : control library symbols visibility ===== */
22 #if defined(__GNUC__) && (__GNUC__ >= 4) 23 #ifndef ZSTDERRORLIB_VISIBILITY
23 # define ZSTDERRORLIB_VISIBILITY __attribute__ ((visibility ("default"))) 24 # if defined(__GNUC__) && (__GNUC__ >= 4)
24 #else 25 # define ZSTDERRORLIB_VISIBILITY __attribute__ ((visibility ("default")))
25 # define ZSTDERRORLIB_VISIBILITY 26 # else
27 # define ZSTDERRORLIB_VISIBILITY
28 # endif
26 #endif 29 #endif
27 #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) 30 #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1)
28 # define ZSTDERRORLIB_API __declspec(dllexport) ZSTDERRORLIB_VISIBILITY 31 # define ZSTDERRORLIB_API __declspec(dllexport) ZSTDERRORLIB_VISIBILITY
29 #elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) 32 #elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)
30 # define ZSTDERRORLIB_API __declspec(dllimport) ZSTDERRORLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ 33 # define ZSTDERRORLIB_API __declspec(dllimport) ZSTDERRORLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
31 #else 34 #else
32 # define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBILITY 35 # define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBILITY
33 #endif 36 #endif
34 37
35 /*-**************************************** 38 /*-*********************************************
36 * error codes list 39 * Error codes list
37 ******************************************/ 40 *-*********************************************
41 * Error codes _values_ are pinned down since v1.3.1 only.
42 * Therefore, don't rely on values if you may link to any version < v1.3.1.
43 *
44 * Only values < 100 are considered stable.
45 *
46 * note 1 : this API shall be used with static linking only.
47 * dynamic linking is not yet officially supported.
48 * note 2 : Prefer relying on the enum than on its value whenever possible
49 * This is the only supported way to use the error list < v1.3.1
50 * note 3 : ZSTD_isError() is always correct, whatever the library version.
51 **********************************************/
38 typedef enum { 52 typedef enum {
39 ZSTD_error_no_error, 53 ZSTD_error_no_error = 0,
40 ZSTD_error_GENERIC, 54 ZSTD_error_GENERIC = 1,
41 ZSTD_error_prefix_unknown, 55 ZSTD_error_prefix_unknown = 10,
42 ZSTD_error_version_unsupported, 56 ZSTD_error_version_unsupported = 12,
43 ZSTD_error_parameter_unknown, 57 ZSTD_error_frameParameter_unsupported = 14,
44 ZSTD_error_frameParameter_unsupported, 58 ZSTD_error_frameParameter_windowTooLarge = 16,
45 ZSTD_error_frameParameter_unsupportedBy32bits, 59 ZSTD_error_corruption_detected = 20,
46 ZSTD_error_frameParameter_windowTooLarge, 60 ZSTD_error_checksum_wrong = 22,
47 ZSTD_error_compressionParameter_unsupported, 61 ZSTD_error_dictionary_corrupted = 30,
48 ZSTD_error_init_missing, 62 ZSTD_error_dictionary_wrong = 32,
49 ZSTD_error_memory_allocation, 63 ZSTD_error_dictionaryCreation_failed = 34,
50 ZSTD_error_stage_wrong, 64 ZSTD_error_parameter_unsupported = 40,
51 ZSTD_error_dstSize_tooSmall, 65 ZSTD_error_parameter_outOfBound = 42,
52 ZSTD_error_srcSize_wrong, 66 ZSTD_error_tableLog_tooLarge = 44,
53 ZSTD_error_corruption_detected, 67 ZSTD_error_maxSymbolValue_tooLarge = 46,
54 ZSTD_error_checksum_wrong, 68 ZSTD_error_maxSymbolValue_tooSmall = 48,
55 ZSTD_error_tableLog_tooLarge, 69 ZSTD_error_stage_wrong = 60,
56 ZSTD_error_maxSymbolValue_tooLarge, 70 ZSTD_error_init_missing = 62,
57 ZSTD_error_maxSymbolValue_tooSmall, 71 ZSTD_error_memory_allocation = 64,
58 ZSTD_error_dictionary_corrupted, 72 ZSTD_error_workSpace_tooSmall= 66,
59 ZSTD_error_dictionary_wrong, 73 ZSTD_error_dstSize_tooSmall = 70,
60 ZSTD_error_maxCode 74 ZSTD_error_srcSize_wrong = 72,
75 /* following error codes are __NOT STABLE__, they can be removed or changed in future versions */
76 ZSTD_error_frameIndex_tooLarge = 100,
77 ZSTD_error_seekableIO = 102,
78 ZSTD_error_maxCode = 120 /* never EVER use this value directly, it can change in future versions! Use ZSTD_isError() instead */
61 } ZSTD_ErrorCode; 79 } ZSTD_ErrorCode;
62 80
63 /*! ZSTD_getErrorCode() : 81 /*! ZSTD_getErrorCode() :
64 convert a `size_t` function result into a `ZSTD_ErrorCode` enum type, 82 convert a `size_t` function result into a `ZSTD_ErrorCode` enum type,
65 which can be used to compare directly with enum list published into "error_public.h" */ 83 which can be used to compare with enum list published above */
66 ZSTDERRORLIB_API ZSTD_ErrorCode ZSTD_getErrorCode(size_t functionResult); 84 ZSTDERRORLIB_API ZSTD_ErrorCode ZSTD_getErrorCode(size_t functionResult);
67 ZSTDERRORLIB_API const char* ZSTD_getErrorString(ZSTD_ErrorCode code); 85 ZSTDERRORLIB_API const char* ZSTD_getErrorString(ZSTD_ErrorCode code); /**< Same as ZSTD_getErrorName, but using a `ZSTD_ErrorCode` enum argument */
68 86
69 87
70 #if defined (__cplusplus) 88 #if defined (__cplusplus)
71 } 89 }
72 #endif 90 #endif