jpayne@69
|
1 /*
|
jpayne@69
|
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
|
jpayne@69
|
3 * All rights reserved.
|
jpayne@69
|
4 *
|
jpayne@69
|
5 * This source code is licensed under both the BSD-style license (found in the
|
jpayne@69
|
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
jpayne@69
|
7 * in the COPYING file in the root directory of this source tree).
|
jpayne@69
|
8 * You may select, at your option, one of the above-listed licenses.
|
jpayne@69
|
9 */
|
jpayne@69
|
10
|
jpayne@69
|
11 #ifndef ZSTD_ERRORS_H_398273423
|
jpayne@69
|
12 #define ZSTD_ERRORS_H_398273423
|
jpayne@69
|
13
|
jpayne@69
|
14 #if defined (__cplusplus)
|
jpayne@69
|
15 extern "C" {
|
jpayne@69
|
16 #endif
|
jpayne@69
|
17
|
jpayne@69
|
18 /*===== dependency =====*/
|
jpayne@69
|
19 #include <stddef.h> /* size_t */
|
jpayne@69
|
20
|
jpayne@69
|
21
|
jpayne@69
|
22 /* ===== ZSTDERRORLIB_API : control library symbols visibility ===== */
|
jpayne@69
|
23 #ifndef ZSTDERRORLIB_VISIBLE
|
jpayne@69
|
24 /* Backwards compatibility with old macro name */
|
jpayne@69
|
25 # ifdef ZSTDERRORLIB_VISIBILITY
|
jpayne@69
|
26 # define ZSTDERRORLIB_VISIBLE ZSTDERRORLIB_VISIBILITY
|
jpayne@69
|
27 # elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__)
|
jpayne@69
|
28 # define ZSTDERRORLIB_VISIBLE __attribute__ ((visibility ("default")))
|
jpayne@69
|
29 # else
|
jpayne@69
|
30 # define ZSTDERRORLIB_VISIBLE
|
jpayne@69
|
31 # endif
|
jpayne@69
|
32 #endif
|
jpayne@69
|
33
|
jpayne@69
|
34 #ifndef ZSTDERRORLIB_HIDDEN
|
jpayne@69
|
35 # if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__)
|
jpayne@69
|
36 # define ZSTDERRORLIB_HIDDEN __attribute__ ((visibility ("hidden")))
|
jpayne@69
|
37 # else
|
jpayne@69
|
38 # define ZSTDERRORLIB_HIDDEN
|
jpayne@69
|
39 # endif
|
jpayne@69
|
40 #endif
|
jpayne@69
|
41
|
jpayne@69
|
42 #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1)
|
jpayne@69
|
43 # define ZSTDERRORLIB_API __declspec(dllexport) ZSTDERRORLIB_VISIBLE
|
jpayne@69
|
44 #elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)
|
jpayne@69
|
45 # define ZSTDERRORLIB_API __declspec(dllimport) ZSTDERRORLIB_VISIBLE /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
|
jpayne@69
|
46 #else
|
jpayne@69
|
47 # define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBLE
|
jpayne@69
|
48 #endif
|
jpayne@69
|
49
|
jpayne@69
|
50 /*-*********************************************
|
jpayne@69
|
51 * Error codes list
|
jpayne@69
|
52 *-*********************************************
|
jpayne@69
|
53 * Error codes _values_ are pinned down since v1.3.1 only.
|
jpayne@69
|
54 * Therefore, don't rely on values if you may link to any version < v1.3.1.
|
jpayne@69
|
55 *
|
jpayne@69
|
56 * Only values < 100 are considered stable.
|
jpayne@69
|
57 *
|
jpayne@69
|
58 * note 1 : this API shall be used with static linking only.
|
jpayne@69
|
59 * dynamic linking is not yet officially supported.
|
jpayne@69
|
60 * note 2 : Prefer relying on the enum than on its value whenever possible
|
jpayne@69
|
61 * This is the only supported way to use the error list < v1.3.1
|
jpayne@69
|
62 * note 3 : ZSTD_isError() is always correct, whatever the library version.
|
jpayne@69
|
63 **********************************************/
|
jpayne@69
|
64 typedef enum {
|
jpayne@69
|
65 ZSTD_error_no_error = 0,
|
jpayne@69
|
66 ZSTD_error_GENERIC = 1,
|
jpayne@69
|
67 ZSTD_error_prefix_unknown = 10,
|
jpayne@69
|
68 ZSTD_error_version_unsupported = 12,
|
jpayne@69
|
69 ZSTD_error_frameParameter_unsupported = 14,
|
jpayne@69
|
70 ZSTD_error_frameParameter_windowTooLarge = 16,
|
jpayne@69
|
71 ZSTD_error_corruption_detected = 20,
|
jpayne@69
|
72 ZSTD_error_checksum_wrong = 22,
|
jpayne@69
|
73 ZSTD_error_literals_headerWrong = 24,
|
jpayne@69
|
74 ZSTD_error_dictionary_corrupted = 30,
|
jpayne@69
|
75 ZSTD_error_dictionary_wrong = 32,
|
jpayne@69
|
76 ZSTD_error_dictionaryCreation_failed = 34,
|
jpayne@69
|
77 ZSTD_error_parameter_unsupported = 40,
|
jpayne@69
|
78 ZSTD_error_parameter_combination_unsupported = 41,
|
jpayne@69
|
79 ZSTD_error_parameter_outOfBound = 42,
|
jpayne@69
|
80 ZSTD_error_tableLog_tooLarge = 44,
|
jpayne@69
|
81 ZSTD_error_maxSymbolValue_tooLarge = 46,
|
jpayne@69
|
82 ZSTD_error_maxSymbolValue_tooSmall = 48,
|
jpayne@69
|
83 ZSTD_error_stabilityCondition_notRespected = 50,
|
jpayne@69
|
84 ZSTD_error_stage_wrong = 60,
|
jpayne@69
|
85 ZSTD_error_init_missing = 62,
|
jpayne@69
|
86 ZSTD_error_memory_allocation = 64,
|
jpayne@69
|
87 ZSTD_error_workSpace_tooSmall= 66,
|
jpayne@69
|
88 ZSTD_error_dstSize_tooSmall = 70,
|
jpayne@69
|
89 ZSTD_error_srcSize_wrong = 72,
|
jpayne@69
|
90 ZSTD_error_dstBuffer_null = 74,
|
jpayne@69
|
91 ZSTD_error_noForwardProgress_destFull = 80,
|
jpayne@69
|
92 ZSTD_error_noForwardProgress_inputEmpty = 82,
|
jpayne@69
|
93 /* following error codes are __NOT STABLE__, they can be removed or changed in future versions */
|
jpayne@69
|
94 ZSTD_error_frameIndex_tooLarge = 100,
|
jpayne@69
|
95 ZSTD_error_seekableIO = 102,
|
jpayne@69
|
96 ZSTD_error_dstBuffer_wrong = 104,
|
jpayne@69
|
97 ZSTD_error_srcBuffer_wrong = 105,
|
jpayne@69
|
98 ZSTD_error_sequenceProducer_failed = 106,
|
jpayne@69
|
99 ZSTD_error_externalSequences_invalid = 107,
|
jpayne@69
|
100 ZSTD_error_maxCode = 120 /* never EVER use this value directly, it can change in future versions! Use ZSTD_isError() instead */
|
jpayne@69
|
101 } ZSTD_ErrorCode;
|
jpayne@69
|
102
|
jpayne@69
|
103 /*! ZSTD_getErrorCode() :
|
jpayne@69
|
104 convert a `size_t` function result into a `ZSTD_ErrorCode` enum type,
|
jpayne@69
|
105 which can be used to compare with enum list published above */
|
jpayne@69
|
106 ZSTDERRORLIB_API ZSTD_ErrorCode ZSTD_getErrorCode(size_t functionResult);
|
jpayne@69
|
107 ZSTDERRORLIB_API const char* ZSTD_getErrorString(ZSTD_ErrorCode code); /**< Same as ZSTD_getErrorName, but using a `ZSTD_ErrorCode` enum argument */
|
jpayne@69
|
108
|
jpayne@69
|
109
|
jpayne@69
|
110 #if defined (__cplusplus)
|
jpayne@69
|
111 }
|
jpayne@69
|
112 #endif
|
jpayne@69
|
113
|
jpayne@69
|
114 #endif /* ZSTD_ERRORS_H_398273423 */
|