2017-08-27 18:05:17 +08:00
|
|
|
/*
|
2023-05-22 20:32:14 +08:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2017-06-09 09:43:56 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2017-08-27 18:05:17 +08:00
|
|
|
* This source code is licensed under both the BSD-style license (found in the
|
|
|
|
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
|
|
* in the COPYING file in the root directory of this source tree).
|
2017-10-27 04:41:47 +08:00
|
|
|
* You may select, at your option, one of the above-listed licenses.
|
2017-06-09 09:43:56 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-*************************************
|
|
|
|
* Dependencies
|
|
|
|
***************************************/
|
2021-01-08 18:21:43 +08:00
|
|
|
#define ZSTD_DEPS_NEED_MALLOC
|
2017-06-09 09:43:56 +08:00
|
|
|
#include "error_private.h"
|
2017-10-27 04:41:47 +08:00
|
|
|
#include "zstd_internal.h"
|
2017-06-09 09:43:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*-****************************************
|
|
|
|
* Version
|
|
|
|
******************************************/
|
2017-07-23 05:46:05 +08:00
|
|
|
unsigned ZSTD_versionNumber(void) { return ZSTD_VERSION_NUMBER; }
|
|
|
|
|
|
|
|
const char* ZSTD_versionString(void) { return ZSTD_VERSION_STRING; }
|
2017-06-09 09:43:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*-****************************************
|
|
|
|
* ZSTD Error Management
|
|
|
|
******************************************/
|
2019-01-04 08:30:03 +08:00
|
|
|
#undef ZSTD_isError /* defined within zstd_internal.h */
|
2017-06-09 09:43:56 +08:00
|
|
|
/*! ZSTD_isError() :
|
2019-01-04 08:30:03 +08:00
|
|
|
* tells if a return value is an error code
|
|
|
|
* symbol is required for external callers */
|
2017-06-09 09:43:56 +08:00
|
|
|
unsigned ZSTD_isError(size_t code) { return ERR_isError(code); }
|
|
|
|
|
|
|
|
/*! ZSTD_getErrorName() :
|
2018-01-13 20:50:59 +08:00
|
|
|
* provides error code string from function result (useful for debugging) */
|
2017-06-09 09:43:56 +08:00
|
|
|
const char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); }
|
|
|
|
|
|
|
|
/*! ZSTD_getError() :
|
2018-01-13 20:50:59 +08:00
|
|
|
* convert a `size_t` function result into a proper ZSTD_errorCode enum */
|
2017-06-09 09:43:56 +08:00
|
|
|
ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); }
|
|
|
|
|
|
|
|
/*! ZSTD_getErrorString() :
|
2018-01-13 20:50:59 +08:00
|
|
|
* provides error code string from enum */
|
2017-06-09 09:43:56 +08:00
|
|
|
const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); }
|