| 1 | /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ |
| 2 | /* |
| 3 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * This source code is licensed under both the BSD-style license (found in the |
| 7 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found |
| 8 | * in the COPYING file in the root directory of this source tree). |
| 9 | * You may select, at your option, one of the above-listed licenses. |
| 10 | */ |
| 11 | |
| 12 | #ifndef ZSTD_ERRORS_H_398273423 |
| 13 | #define ZSTD_ERRORS_H_398273423 |
| 14 | |
| 15 | |
| 16 | /* ===== ZSTDERRORLIB_API : control library symbols visibility ===== */ |
| 17 | #define ZSTDERRORLIB_VISIBLE |
| 18 | |
| 19 | #ifndef ZSTDERRORLIB_HIDDEN |
| 20 | # if (__GNUC__ >= 4) && !defined(__MINGW32__) |
| 21 | # define ZSTDERRORLIB_HIDDEN __attribute__ ((visibility ("hidden"))) |
| 22 | # else |
| 23 | # define ZSTDERRORLIB_HIDDEN |
| 24 | # endif |
| 25 | #endif |
| 26 | |
| 27 | #define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBLE |
| 28 | |
| 29 | /*-********************************************* |
| 30 | * Error codes list |
| 31 | *-********************************************* |
| 32 | * Error codes _values_ are pinned down since v1.3.1 only. |
| 33 | * Therefore, don't rely on values if you may link to any version < v1.3.1. |
| 34 | * |
| 35 | * Only values < 100 are considered stable. |
| 36 | * |
| 37 | * note 1 : this API shall be used with static linking only. |
| 38 | * dynamic linking is not yet officially supported. |
| 39 | * note 2 : Prefer relying on the enum than on its value whenever possible |
| 40 | * This is the only supported way to use the error list < v1.3.1 |
| 41 | * note 3 : ZSTD_isError() is always correct, whatever the library version. |
| 42 | **********************************************/ |
| 43 | typedef enum { |
| 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 | = 24, |
| 53 | ZSTD_error_dictionary_corrupted = 30, |
| 54 | ZSTD_error_dictionary_wrong = 32, |
| 55 | ZSTD_error_dictionaryCreation_failed = 34, |
| 56 | ZSTD_error_parameter_unsupported = 40, |
| 57 | ZSTD_error_parameter_combination_unsupported = 41, |
| 58 | ZSTD_error_parameter_outOfBound = 42, |
| 59 | ZSTD_error_tableLog_tooLarge = 44, |
| 60 | ZSTD_error_maxSymbolValue_tooLarge = 46, |
| 61 | ZSTD_error_maxSymbolValue_tooSmall = 48, |
| 62 | ZSTD_error_cannotProduce_uncompressedBlock = 49, |
| 63 | ZSTD_error_stabilityCondition_notRespected = 50, |
| 64 | ZSTD_error_stage_wrong = 60, |
| 65 | ZSTD_error_init_missing = 62, |
| 66 | ZSTD_error_memory_allocation = 64, |
| 67 | ZSTD_error_workSpace_tooSmall= 66, |
| 68 | ZSTD_error_dstSize_tooSmall = 70, |
| 69 | ZSTD_error_srcSize_wrong = 72, |
| 70 | ZSTD_error_dstBuffer_null = 74, |
| 71 | ZSTD_error_noForwardProgress_destFull = 80, |
| 72 | ZSTD_error_noForwardProgress_inputEmpty = 82, |
| 73 | /* following error codes are __NOT STABLE__, they can be removed or changed in future versions */ |
| 74 | ZSTD_error_frameIndex_tooLarge = 100, |
| 75 | ZSTD_error_seekableIO = 102, |
| 76 | ZSTD_error_dstBuffer_wrong = 104, |
| 77 | ZSTD_error_srcBuffer_wrong = 105, |
| 78 | ZSTD_error_sequenceProducer_failed = 106, |
| 79 | ZSTD_error_externalSequences_invalid = 107, |
| 80 | ZSTD_error_maxCode = 120 /* never EVER use this value directly, it can change in future versions! Use ZSTD_isError() instead */ |
| 81 | } ZSTD_ErrorCode; |
| 82 | |
| 83 | ZSTDERRORLIB_API const char* ZSTD_getErrorString(ZSTD_ErrorCode code); /*< Same as ZSTD_getErrorName, but using a `ZSTD_ErrorCode` enum argument */ |
| 84 | |
| 85 | |
| 86 | |
| 87 | #endif /* ZSTD_ERRORS_H_398273423 */ |
| 88 | |