| Yann Collet | 32fb407 | 2017-08-18 16:52:05 -0700 | [diff] [blame] | 1 | /* |
| W. Felix Handte | 5d693cc | 2022-12-20 12:49:47 -0500 | [diff] [blame] | 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| Yann Collet | 4ded9e5 | 2016-08-30 10:04:33 -0700 | [diff] [blame] | 3 | * All rights reserved. |
| 4 | * |
| Yann Collet | 32fb407 | 2017-08-18 16:52:05 -0700 | [diff] [blame] | 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). |
| Yann Collet | 3128e03 | 2017-09-08 00:09:23 -0700 | [diff] [blame] | 8 | * You may select, at your option, one of the above-listed licenses. |
| Yann Collet | 4ded9e5 | 2016-08-30 10:04:33 -0700 | [diff] [blame] | 9 | */ |
| Yann Collet | 977f1f3 | 2016-01-21 15:38:47 +0100 | [diff] [blame] | 10 | |
| Yann Collet | a17fd73 | 2016-10-11 16:41:09 -0700 | [diff] [blame] | 11 | #ifndef ZSTD_ERRORS_H_398273423 |
| 12 | #define ZSTD_ERRORS_H_398273423 |
| Yann Collet | 977f1f3 | 2016-01-21 15:38:47 +0100 | [diff] [blame] | 13 | |
| 14 | #if defined (__cplusplus) |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| Nick Terrell | 8de46ab | 2016-12-16 13:27:30 -0800 | [diff] [blame] | 18 | /* ===== ZSTDERRORLIB_API : control library symbols visibility ===== */ |
| Nick Terrell | 358a237 | 2022-12-15 15:46:34 -0800 | [diff] [blame] | 19 | #ifndef ZSTDERRORLIB_VISIBLE |
| 20 | /* Backwards compatibility with old macro name */ |
| 21 | # ifdef ZSTDERRORLIB_VISIBILITY |
| 22 | # define ZSTDERRORLIB_VISIBLE ZSTDERRORLIB_VISIBILITY |
| 23 | # elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__) |
| 24 | # define ZSTDERRORLIB_VISIBLE __attribute__ ((visibility ("default"))) |
| Nick Terrell | a128040 | 2017-05-19 18:01:59 -0700 | [diff] [blame] | 25 | # else |
| Nick Terrell | 358a237 | 2022-12-15 15:46:34 -0800 | [diff] [blame] | 26 | # define ZSTDERRORLIB_VISIBLE |
| Nick Terrell | a128040 | 2017-05-19 18:01:59 -0700 | [diff] [blame] | 27 | # endif |
| Nick Terrell | 8de46ab | 2016-12-16 13:27:30 -0800 | [diff] [blame] | 28 | #endif |
| Nick Terrell | 358a237 | 2022-12-15 15:46:34 -0800 | [diff] [blame] | 29 | |
| 30 | #ifndef ZSTDERRORLIB_HIDDEN |
| 31 | # if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__) |
| 32 | # define ZSTDERRORLIB_HIDDEN __attribute__ ((visibility ("hidden"))) |
| 33 | # else |
| 34 | # define ZSTDERRORLIB_HIDDEN |
| 35 | # endif |
| 36 | #endif |
| 37 | |
| Nick Terrell | 8de46ab | 2016-12-16 13:27:30 -0800 | [diff] [blame] | 38 | #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) |
| Nick Terrell | 358a237 | 2022-12-15 15:46:34 -0800 | [diff] [blame] | 39 | # define ZSTDERRORLIB_API __declspec(dllexport) ZSTDERRORLIB_VISIBLE |
| Nick Terrell | 8de46ab | 2016-12-16 13:27:30 -0800 | [diff] [blame] | 40 | #elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) |
| Nick Terrell | 358a237 | 2022-12-15 15:46:34 -0800 | [diff] [blame] | 41 | # 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.*/ |
| Nick Terrell | 8de46ab | 2016-12-16 13:27:30 -0800 | [diff] [blame] | 42 | #else |
| Nick Terrell | 358a237 | 2022-12-15 15:46:34 -0800 | [diff] [blame] | 43 | # define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBLE |
| Nick Terrell | 8de46ab | 2016-12-16 13:27:30 -0800 | [diff] [blame] | 44 | #endif |
| 45 | |
| Yann Collet | 70163bf | 2018-02-20 12:54:49 -0800 | [diff] [blame] | 46 | /*-********************************************* |
| 47 | * Error codes list |
| 48 | *-********************************************* |
| 49 | * Error codes _values_ are pinned down since v1.3.1 only. |
| 50 | * Therefore, don't rely on values if you may link to any version < v1.3.1. |
| 51 | * |
| 52 | * Only values < 100 are considered stable. |
| 53 | * |
| 54 | * note 1 : this API shall be used with static linking only. |
| 55 | * dynamic linking is not yet officially supported. |
| 56 | * note 2 : Prefer relying on the enum than on its value whenever possible |
| 57 | * This is the only supported way to use the error list < v1.3.1 |
| 58 | * note 3 : ZSTD_isError() is always correct, whatever the library version. |
| 59 | **********************************************/ |
| Yann Collet | 72bff50 | 2016-02-03 12:06:24 +0100 | [diff] [blame] | 60 | typedef enum { |
| Yann Collet | 2bd6440 | 2017-07-13 17:12:16 -0700 | [diff] [blame] | 61 | ZSTD_error_no_error = 0, |
| 62 | ZSTD_error_GENERIC = 1, |
| 63 | ZSTD_error_prefix_unknown = 10, |
| 64 | ZSTD_error_version_unsupported = 12, |
| 65 | ZSTD_error_frameParameter_unsupported = 14, |
| 66 | ZSTD_error_frameParameter_windowTooLarge = 16, |
| 67 | ZSTD_error_corruption_detected = 20, |
| 68 | ZSTD_error_checksum_wrong = 22, |
| Yann Collet | 6a9c525 | 2022-12-22 11:30:15 -0800 | [diff] [blame] | 69 | ZSTD_error_literals_headerWrong = 24, |
| Yann Collet | 2bd6440 | 2017-07-13 17:12:16 -0700 | [diff] [blame] | 70 | ZSTD_error_dictionary_corrupted = 30, |
| 71 | ZSTD_error_dictionary_wrong = 32, |
| 72 | ZSTD_error_dictionaryCreation_failed = 34, |
| 73 | ZSTD_error_parameter_unsupported = 40, |
| Elliot Gorokhovsky | 2a40262 | 2022-12-28 16:45:14 -0500 | [diff] [blame] | 74 | ZSTD_error_parameter_combination_unsupported = 41, |
| Yann Collet | 2bd6440 | 2017-07-13 17:12:16 -0700 | [diff] [blame] | 75 | ZSTD_error_parameter_outOfBound = 42, |
| 76 | ZSTD_error_tableLog_tooLarge = 44, |
| 77 | ZSTD_error_maxSymbolValue_tooLarge = 46, |
| 78 | ZSTD_error_maxSymbolValue_tooSmall = 48, |
| Yann Collet | b339eff | 2024-12-19 09:45:28 -0800 | [diff] [blame] | 79 | ZSTD_error_cannotProduce_uncompressedBlock = 49, |
| Yann Collet | b99ece9 | 2022-01-26 10:43:50 -0800 | [diff] [blame] | 80 | ZSTD_error_stabilityCondition_notRespected = 50, |
| Yann Collet | 2bd6440 | 2017-07-13 17:12:16 -0700 | [diff] [blame] | 81 | ZSTD_error_stage_wrong = 60, |
| 82 | ZSTD_error_init_missing = 62, |
| 83 | ZSTD_error_memory_allocation = 64, |
| Yann Collet | 8974165 | 2018-02-26 15:11:50 -0800 | [diff] [blame] | 84 | ZSTD_error_workSpace_tooSmall= 66, |
| Yann Collet | 2bd6440 | 2017-07-13 17:12:16 -0700 | [diff] [blame] | 85 | ZSTD_error_dstSize_tooSmall = 70, |
| 86 | ZSTD_error_srcSize_wrong = 72, |
| Yann Collet | acd75a1 | 2018-10-29 15:03:57 -0700 | [diff] [blame] | 87 | ZSTD_error_dstBuffer_null = 74, |
| Yann Collet | db18a62 | 2023-01-25 13:07:53 -0800 | [diff] [blame] | 88 | ZSTD_error_noForwardProgress_destFull = 80, |
| 89 | ZSTD_error_noForwardProgress_inputEmpty = 82, |
| Yann Collet | 70163bf | 2018-02-20 12:54:49 -0800 | [diff] [blame] | 90 | /* following error codes are __NOT STABLE__, they can be removed or changed in future versions */ |
| Yann Collet | 2bd6440 | 2017-07-13 17:12:16 -0700 | [diff] [blame] | 91 | ZSTD_error_frameIndex_tooLarge = 100, |
| 92 | ZSTD_error_seekableIO = 102, |
| Nick Terrell | a4ff217 | 2020-04-27 17:42:03 -0700 | [diff] [blame] | 93 | ZSTD_error_dstBuffer_wrong = 104, |
| Nick Terrell | c74be3f | 2020-10-12 13:45:33 -0700 | [diff] [blame] | 94 | ZSTD_error_srcBuffer_wrong = 105, |
| Elliot Gorokhovsky | ff42ed1 | 2023-02-09 17:01:17 -0500 | [diff] [blame] | 95 | ZSTD_error_sequenceProducer_failed = 106, |
| Danielle Rozenblit | 815d1d4 | 2023-01-23 09:58:34 -0800 | [diff] [blame] | 96 | ZSTD_error_externalSequences_invalid = 107, |
| Yann Collet | 9416195 | 2017-09-27 10:35:56 -0700 | [diff] [blame] | 97 | ZSTD_error_maxCode = 120 /* never EVER use this value directly, it can change in future versions! Use ZSTD_isError() instead */ |
| Yann Collet | 982ffc7 | 2016-02-05 02:33:10 +0100 | [diff] [blame] | 98 | } ZSTD_ErrorCode; |
| Yann Collet | 977f1f3 | 2016-01-21 15:38:47 +0100 | [diff] [blame] | 99 | |
| Yann Collet | 3b0cff3 | 2017-07-13 18:58:30 -0700 | [diff] [blame] | 100 | ZSTDERRORLIB_API const char* ZSTD_getErrorString(ZSTD_ErrorCode code); /**< Same as ZSTD_getErrorName, but using a `ZSTD_ErrorCode` enum argument */ |
| Yann Collet | 977f1f3 | 2016-01-21 15:38:47 +0100 | [diff] [blame] | 101 | |
| 102 | |
| 103 | #if defined (__cplusplus) |
| 104 | } |
| 105 | #endif |
| 106 | |
| Yann Collet | a17fd73 | 2016-10-11 16:41:09 -0700 | [diff] [blame] | 107 | #endif /* ZSTD_ERRORS_H_398273423 */ |