]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/zstd/lib/common/zstd_errors.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304460, and update
[FreeBSD/FreeBSD.git] / contrib / zstd / lib / common / zstd_errors.h
1 /**
2  * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  */
9
10 #ifndef ZSTD_ERRORS_H_398273423
11 #define ZSTD_ERRORS_H_398273423
12
13 #if defined (__cplusplus)
14 extern "C" {
15 #endif
16
17 /*===== dependency =====*/
18 #include <stddef.h>   /* size_t */
19
20
21 /* =====   ZSTDERRORLIB_API : control library symbols visibility   ===== */
22 #if defined(__GNUC__) && (__GNUC__ >= 4)
23 #  define ZSTDERRORLIB_VISIBILITY __attribute__ ((visibility ("default")))
24 #else
25 #  define ZSTDERRORLIB_VISIBILITY
26 #endif
27 #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1)
28 #  define ZSTDERRORLIB_API __declspec(dllexport) ZSTDERRORLIB_VISIBILITY
29 #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.*/
31 #else
32 #  define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBILITY
33 #endif
34
35 /*-****************************************
36 *  error codes list
37 ******************************************/
38 typedef enum {
39   ZSTD_error_no_error,
40   ZSTD_error_GENERIC,
41   ZSTD_error_prefix_unknown,
42   ZSTD_error_version_unsupported,
43   ZSTD_error_parameter_unknown,
44   ZSTD_error_frameParameter_unsupported,
45   ZSTD_error_frameParameter_unsupportedBy32bits,
46   ZSTD_error_frameParameter_windowTooLarge,
47   ZSTD_error_compressionParameter_unsupported,
48   ZSTD_error_init_missing,
49   ZSTD_error_memory_allocation,
50   ZSTD_error_stage_wrong,
51   ZSTD_error_dstSize_tooSmall,
52   ZSTD_error_srcSize_wrong,
53   ZSTD_error_corruption_detected,
54   ZSTD_error_checksum_wrong,
55   ZSTD_error_tableLog_tooLarge,
56   ZSTD_error_maxSymbolValue_tooLarge,
57   ZSTD_error_maxSymbolValue_tooSmall,
58   ZSTD_error_dictionary_corrupted,
59   ZSTD_error_dictionary_wrong,
60   ZSTD_error_dictionaryCreation_failed,
61   ZSTD_error_maxCode
62 } ZSTD_ErrorCode;
63
64 /*! ZSTD_getErrorCode() :
65     convert a `size_t` function result into a `ZSTD_ErrorCode` enum type,
66     which can be used to compare directly with enum list published into "error_public.h" */
67 ZSTDERRORLIB_API ZSTD_ErrorCode ZSTD_getErrorCode(size_t functionResult);
68 ZSTDERRORLIB_API const char* ZSTD_getErrorString(ZSTD_ErrorCode code);
69
70
71 #if defined (__cplusplus)
72 }
73 #endif
74
75 #endif /* ZSTD_ERRORS_H_398273423 */