static const char *
lzma_error_str(lzma_ret error)
{
- // LCOV_EXCL_START
switch (error) {
case LZMA_OK:
return "Operation completed successfully";
default:
return "Unknown LZMA error";
}
- // LCOV_EXCL_STOP
}
#endif // HAVE_LZMA.
case LZMA_DATA_ERROR:
case LZMA_PROG_ERROR:
default:
- // LCOV_EXCL_START
log_warn(LD_GENERAL, "LZMA %s didn't finish: %s.",
state->compress ? "compression" : "decompression",
lzma_error_str(retval));
return TOR_COMPRESS_ERROR;
- // LCOV_EXCL_STOP
}
#else // HAVE_LZMA.
(void)state;
if (result->u.compress_stream == NULL) {
// LCOV_EXCL_START
- log_warn(LD_GENERAL, "Error while creating Zstandard stream");
+ log_warn(LD_GENERAL, "Error while creating Zstandard compression "
+ "stream");
goto err;
// LCOV_EXCL_STOP
}
if (result->u.decompress_stream == NULL) {
// LCOV_EXCL_START
- log_warn(LD_GENERAL, "Error while creating Zstandard stream");
+ log_warn(LD_GENERAL, "Error while creating Zstandard decompression "
+ "stream");
goto err;
// LCOV_EXCL_STOP
}
}
if (ZSTD_isError(retval)) {
- // LCOV_EXCL_START
log_warn(LD_GENERAL, "Zstandard %s didn't finish: %s.",
state->compress ? "compression" : "decompression",
ZSTD_getErrorName(retval));
return TOR_COMPRESS_ERROR;
- // LCOV_EXCL_STOP
}
if (state->compress && !state->have_called_end) {
*out_len = output.size - output.pos;
if (ZSTD_isError(retval)) {
- // LCOV_EXCL_START
log_warn(LD_GENERAL, "Zstandard compression unable to flush: %s.",
ZSTD_getErrorName(retval));
return TOR_COMPRESS_ERROR;
- // LCOV_EXCL_STOP
}
// ZSTD_flushStream returns 0 if the frame is done, or >0 if it
*out_len = output.size - output.pos;
if (ZSTD_isError(retval)) {
- // LCOV_EXCL_START
log_warn(LD_GENERAL, "Zstandard compression unable to write "
"epilogue: %s.",
ZSTD_getErrorName(retval));
return TOR_COMPRESS_ERROR;
- // LCOV_EXCL_STOP
}
// endStream returns the number of bytes that is needed to write the