ZStandard: Add additional check of error code

This commit is contained in:
Mariusz Zaborski 2022-02-02 13:34:14 -05:00
parent 7cb3f4a04d
commit d0ce037fa2

View File

@ -115,12 +115,14 @@ absl::Status CompressStream(ZstdApi& api, std::ifstream& in_file,
SAPI_ASSIGN_OR_RETURN(iserr, api.ZSTD_CCtx_setParameter( SAPI_ASSIGN_OR_RETURN(iserr, api.ZSTD_CCtx_setParameter(
&rcctx, ZSTD_c_compressionLevel, level)); &rcctx, ZSTD_c_compressionLevel, level));
if (!iserr) { SAPI_ASSIGN_OR_RETURN(iserr, api.ZSTD_isError(iserr))
if (iserr) {
return absl::UnavailableError("Unable to set parameter"); return absl::UnavailableError("Unable to set parameter");
} }
SAPI_ASSIGN_OR_RETURN( SAPI_ASSIGN_OR_RETURN(
iserr, api.ZSTD_CCtx_setParameter(&rcctx, ZSTD_c_checksumFlag, 1)); iserr, api.ZSTD_CCtx_setParameter(&rcctx, ZSTD_c_checksumFlag, 1));
if (!iserr) { SAPI_ASSIGN_OR_RETURN(iserr, api.ZSTD_isError(iserr))
if (iserr) {
return absl::UnavailableError("Unable to set parameter"); return absl::UnavailableError("Unable to set parameter");
} }