Zstandart(zstd) - checking return

152 views Asked by At

Can you please explain how the "ZSTD_isError" function works?

I check the return code from ZSTD_isError to be zero:

ZSTD_cParameter cParam;

ZSTD_bounds ZSTD_bounds_ =  ZSTD_cParam_getBounds(cParam);


status_error = ZSTD_isError(ZSTD_bounds_.error);  //ZSTD_isError RETURN 1.

if (status_error != 0)
{
    Std::cout << ZSTD_getErrorName(status_error)<< std::endl; //BUT - "No error detected"

    return 1;
}

I don't understand, the ZSTD_isError function returns 1, but after calling the ZSTD_getErrorName() function - it returns that "No error detected".

Explain, please.

1

There are 1 answers

3
Jarod42 On BEST ANSWER

Usage is:

if (ZSTD_isError(ZSTD_bounds_.error))
{
    std::cout << ZSTD_getErrorName(ZSTD_bounds_.error) << std::endl;
    return 1;
}