1 /***********************************************************************************************************************************
2 ZST Common
3 ***********************************************************************************************************************************/
4 #include "build.auto.h"
5 
6 #ifdef HAVE_LIBZST
7 
8 #include <zstd.h>
9 
10 // Check the version -- this is done in configure but it makes sense to be sure
11 #if ZSTD_VERSION_MAJOR < 1
12     #error "ZSTD_VERSION_MAJOR must be >= 1"
13 #endif
14 
15 #include "common/compress/zst/common.h"
16 #include "common/debug.h"
17 
18 /**********************************************************************************************************************************/
19 size_t
zstError(size_t error)20 zstError(size_t error)
21 {
22     FUNCTION_TEST_BEGIN();
23         FUNCTION_TEST_PARAM(SIZE, error);
24     FUNCTION_TEST_END();
25 
26     if (ZSTD_isError(error))
27         THROW_FMT(FormatError, "zst error: [%zd] %s", (ssize_t)error, ZSTD_getErrorName(error));
28 
29     FUNCTION_TEST_RETURN(error);
30 }
31 
32 #endif // HAVE_LIBZST
33