2 * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
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) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
10 #ifndef ZSTD_ERRORS_H_398273423
11 #define ZSTD_ERRORS_H_398273423
13 #if defined (__cplusplus)
17 /*===== dependency =====*/
18 #include <stddef.h> /* size_t */
21 /* ===== ZSTDERRORLIB_API : control library symbols visibility ===== */
22 #ifndef ZSTDERRORLIB_VISIBILITY
23 # if defined(__GNUC__) && (__GNUC__ >= 4)
24 # define ZSTDERRORLIB_VISIBILITY __attribute__ ((visibility ("default")))
26 # define ZSTDERRORLIB_VISIBILITY
29 #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1)
30 # define ZSTDERRORLIB_API __declspec(dllexport) ZSTDERRORLIB_VISIBILITY
31 #elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)
32 # 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.*/
34 # define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBILITY
37 /*-****************************************
39 * note : this API is still considered unstable
40 * and shall not be used with a dynamic library.
41 * only static linking is allowed
42 ******************************************/
44 ZSTD_error_no_error = 0,
45 ZSTD_error_GENERIC = 1,
46 ZSTD_error_prefix_unknown = 10,
47 ZSTD_error_version_unsupported = 12,
48 ZSTD_error_frameParameter_unsupported = 14,
49 ZSTD_error_frameParameter_windowTooLarge = 16,
50 ZSTD_error_corruption_detected = 20,
51 ZSTD_error_checksum_wrong = 22,
52 ZSTD_error_dictionary_corrupted = 30,
53 ZSTD_error_dictionary_wrong = 32,
54 ZSTD_error_dictionaryCreation_failed = 34,
55 ZSTD_error_parameter_unsupported = 40,
56 ZSTD_error_parameter_outOfBound = 42,
57 ZSTD_error_tableLog_tooLarge = 44,
58 ZSTD_error_maxSymbolValue_tooLarge = 46,
59 ZSTD_error_maxSymbolValue_tooSmall = 48,
60 ZSTD_error_stage_wrong = 60,
61 ZSTD_error_init_missing = 62,
62 ZSTD_error_memory_allocation = 64,
63 ZSTD_error_dstSize_tooSmall = 70,
64 ZSTD_error_srcSize_wrong = 72,
65 ZSTD_error_frameIndex_tooLarge = 100,
66 ZSTD_error_seekableIO = 102,
67 ZSTD_error_maxCode = 120 /* never EVER use this value directly, it may change in future versions! Use ZSTD_isError() instead */
70 /*! ZSTD_getErrorCode() :
71 convert a `size_t` function result into a `ZSTD_ErrorCode` enum type,
72 which can be used to compare with enum list published above */
73 ZSTDERRORLIB_API ZSTD_ErrorCode ZSTD_getErrorCode(size_t functionResult);
74 ZSTDERRORLIB_API const char* ZSTD_getErrorString(ZSTD_ErrorCode code); /**< Same as ZSTD_getErrorName, but using a `ZSTD_ErrorCode` enum argument */
77 #if defined (__cplusplus)
81 #endif /* ZSTD_ERRORS_H_398273423 */