1*65d1f550SNick Terrell // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause 2e0c1b49fSNick Terrell /* 3*65d1f550SNick Terrell * Copyright (c) Meta Platforms, Inc. and affiliates. 4e0c1b49fSNick Terrell * All rights reserved. 5e0c1b49fSNick Terrell * 6e0c1b49fSNick Terrell * This source code is licensed under both the BSD-style license (found in the 7e0c1b49fSNick Terrell * LICENSE file in the root directory of this source tree) and the GPLv2 (found 8e0c1b49fSNick Terrell * in the COPYING file in the root directory of this source tree). 9e0c1b49fSNick Terrell * You may select, at your option, one of the above-listed licenses. 10e0c1b49fSNick Terrell */ 11e0c1b49fSNick Terrell 12e0c1b49fSNick Terrell /* The purpose of this file is to have a single list of error strings embedded in binary */ 13e0c1b49fSNick Terrell 14e0c1b49fSNick Terrell #include "error_private.h" 15e0c1b49fSNick Terrell ERR_getErrorString(ERR_enum code)16e0c1b49fSNick Terrellconst char* ERR_getErrorString(ERR_enum code) 17e0c1b49fSNick Terrell { 18e0c1b49fSNick Terrell #ifdef ZSTD_STRIP_ERROR_STRINGS 19e0c1b49fSNick Terrell (void)code; 20e0c1b49fSNick Terrell return "Error strings stripped"; 21e0c1b49fSNick Terrell #else 22e0c1b49fSNick Terrell static const char* const notErrorCode = "Unspecified error code"; 23e0c1b49fSNick Terrell switch( code ) 24e0c1b49fSNick Terrell { 25e0c1b49fSNick Terrell case PREFIX(no_error): return "No error detected"; 26e0c1b49fSNick Terrell case PREFIX(GENERIC): return "Error (generic)"; 27e0c1b49fSNick Terrell case PREFIX(prefix_unknown): return "Unknown frame descriptor"; 28e0c1b49fSNick Terrell case PREFIX(version_unsupported): return "Version not supported"; 29e0c1b49fSNick Terrell case PREFIX(frameParameter_unsupported): return "Unsupported frame parameter"; 30e0c1b49fSNick Terrell case PREFIX(frameParameter_windowTooLarge): return "Frame requires too much memory for decoding"; 31*65d1f550SNick Terrell case PREFIX(corruption_detected): return "Data corruption detected"; 32e0c1b49fSNick Terrell case PREFIX(checksum_wrong): return "Restored data doesn't match checksum"; 33*65d1f550SNick Terrell case PREFIX(literals_headerWrong): return "Header of Literals' block doesn't respect format specification"; 34e0c1b49fSNick Terrell case PREFIX(parameter_unsupported): return "Unsupported parameter"; 35*65d1f550SNick Terrell case PREFIX(parameter_combination_unsupported): return "Unsupported combination of parameters"; 36e0c1b49fSNick Terrell case PREFIX(parameter_outOfBound): return "Parameter is out of bound"; 37e0c1b49fSNick Terrell case PREFIX(init_missing): return "Context should be init first"; 38e0c1b49fSNick Terrell case PREFIX(memory_allocation): return "Allocation error : not enough memory"; 39e0c1b49fSNick Terrell case PREFIX(workSpace_tooSmall): return "workSpace buffer is not large enough"; 40e0c1b49fSNick Terrell case PREFIX(stage_wrong): return "Operation not authorized at current processing stage"; 41e0c1b49fSNick Terrell case PREFIX(tableLog_tooLarge): return "tableLog requires too much memory : unsupported"; 42e0c1b49fSNick Terrell case PREFIX(maxSymbolValue_tooLarge): return "Unsupported max Symbol Value : too large"; 43e0c1b49fSNick Terrell case PREFIX(maxSymbolValue_tooSmall): return "Specified maxSymbolValue is too small"; 44*65d1f550SNick Terrell case PREFIX(cannotProduce_uncompressedBlock): return "This mode cannot generate an uncompressed block"; 45*65d1f550SNick Terrell case PREFIX(stabilityCondition_notRespected): return "pledged buffer stability condition is not respected"; 46e0c1b49fSNick Terrell case PREFIX(dictionary_corrupted): return "Dictionary is corrupted"; 47e0c1b49fSNick Terrell case PREFIX(dictionary_wrong): return "Dictionary mismatch"; 48e0c1b49fSNick Terrell case PREFIX(dictionaryCreation_failed): return "Cannot create Dictionary from provided samples"; 49e0c1b49fSNick Terrell case PREFIX(dstSize_tooSmall): return "Destination buffer is too small"; 50e0c1b49fSNick Terrell case PREFIX(srcSize_wrong): return "Src size is incorrect"; 51e0c1b49fSNick Terrell case PREFIX(dstBuffer_null): return "Operation on NULL destination buffer"; 52*65d1f550SNick Terrell case PREFIX(noForwardProgress_destFull): return "Operation made no progress over multiple calls, due to output buffer being full"; 53*65d1f550SNick Terrell case PREFIX(noForwardProgress_inputEmpty): return "Operation made no progress over multiple calls, due to input being empty"; 54e0c1b49fSNick Terrell /* following error codes are not stable and may be removed or changed in a future version */ 55e0c1b49fSNick Terrell case PREFIX(frameIndex_tooLarge): return "Frame index is too large"; 56e0c1b49fSNick Terrell case PREFIX(seekableIO): return "An I/O error occurred when reading/seeking"; 57e0c1b49fSNick Terrell case PREFIX(dstBuffer_wrong): return "Destination buffer is wrong"; 58e0c1b49fSNick Terrell case PREFIX(srcBuffer_wrong): return "Source buffer is wrong"; 59*65d1f550SNick Terrell case PREFIX(sequenceProducer_failed): return "Block-level external sequence producer returned an error code"; 60*65d1f550SNick Terrell case PREFIX(externalSequences_invalid): return "External sequences are not valid"; 61e0c1b49fSNick Terrell case PREFIX(maxCode): 62e0c1b49fSNick Terrell default: return notErrorCode; 63e0c1b49fSNick Terrell } 64e0c1b49fSNick Terrell #endif 65e0c1b49fSNick Terrell } 66