1*01826a49SYabin Cui /* 2*01826a49SYabin Cui * Copyright (c) Meta Platforms, Inc. and affiliates. 3*01826a49SYabin Cui * All rights reserved. 4*01826a49SYabin Cui * 5*01826a49SYabin Cui * This source code is licensed under both the BSD-style license (found in the 6*01826a49SYabin Cui * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7*01826a49SYabin Cui * in the COPYING file in the root directory of this source tree). 8*01826a49SYabin Cui * You may select, at your option, one of the above-listed licenses. 9*01826a49SYabin Cui */ 10*01826a49SYabin Cui 11*01826a49SYabin Cui 12*01826a49SYabin Cui 13*01826a49SYabin Cui /*-************************************* 14*01826a49SYabin Cui * Dependencies 15*01826a49SYabin Cui ***************************************/ 16*01826a49SYabin Cui #define ZSTD_DEPS_NEED_MALLOC 17*01826a49SYabin Cui #include "error_private.h" 18*01826a49SYabin Cui #include "zstd_internal.h" 19*01826a49SYabin Cui 20*01826a49SYabin Cui 21*01826a49SYabin Cui /*-**************************************** 22*01826a49SYabin Cui * Version 23*01826a49SYabin Cui ******************************************/ ZSTD_versionNumber(void)24*01826a49SYabin Cuiunsigned ZSTD_versionNumber(void) { return ZSTD_VERSION_NUMBER; } 25*01826a49SYabin Cui ZSTD_versionString(void)26*01826a49SYabin Cuiconst char* ZSTD_versionString(void) { return ZSTD_VERSION_STRING; } 27*01826a49SYabin Cui 28*01826a49SYabin Cui 29*01826a49SYabin Cui /*-**************************************** 30*01826a49SYabin Cui * ZSTD Error Management 31*01826a49SYabin Cui ******************************************/ 32*01826a49SYabin Cui #undef ZSTD_isError /* defined within zstd_internal.h */ 33*01826a49SYabin Cui /*! ZSTD_isError() : 34*01826a49SYabin Cui * tells if a return value is an error code 35*01826a49SYabin Cui * symbol is required for external callers */ ZSTD_isError(size_t code)36*01826a49SYabin Cuiunsigned ZSTD_isError(size_t code) { return ERR_isError(code); } 37*01826a49SYabin Cui 38*01826a49SYabin Cui /*! ZSTD_getErrorName() : 39*01826a49SYabin Cui * provides error code string from function result (useful for debugging) */ ZSTD_getErrorName(size_t code)40*01826a49SYabin Cuiconst char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); } 41*01826a49SYabin Cui 42*01826a49SYabin Cui /*! ZSTD_getError() : 43*01826a49SYabin Cui * convert a `size_t` function result into a proper ZSTD_errorCode enum */ ZSTD_getErrorCode(size_t code)44*01826a49SYabin CuiZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); } 45*01826a49SYabin Cui 46*01826a49SYabin Cui /*! ZSTD_getErrorString() : 47*01826a49SYabin Cui * provides error code string from enum */ ZSTD_getErrorString(ZSTD_ErrorCode code)48*01826a49SYabin Cuiconst char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); } 49