mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
Take advantage of return_if_error() macro in
lzma_info_metadata_set() in info.c.
This commit is contained in:
parent
863028cb7a
commit
67321de963
1 changed files with 8 additions and 16 deletions
|
@ -406,28 +406,20 @@ lzma_info_metadata_set(lzma_info *info, lzma_allocator *allocator,
|
||||||
const lzma_vli size = metadata->header_metadata_size
|
const lzma_vli size = metadata->header_metadata_size
|
||||||
!= LZMA_VLI_VALUE_UNKNOWN
|
!= LZMA_VLI_VALUE_UNKNOWN
|
||||||
? metadata->header_metadata_size : 0;
|
? metadata->header_metadata_size : 0;
|
||||||
const lzma_ret ret = lzma_info_size_set(
|
return_if_error(lzma_info_size_set(
|
||||||
info, LZMA_INFO_HEADER_METADATA, size);
|
info, LZMA_INFO_HEADER_METADATA, size));
|
||||||
if (ret != LZMA_OK)
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total Size
|
// Total Size
|
||||||
if (metadata->total_size != LZMA_VLI_VALUE_UNKNOWN) {
|
if (metadata->total_size != LZMA_VLI_VALUE_UNKNOWN)
|
||||||
const lzma_ret ret = lzma_info_size_set(info,
|
return_if_error(lzma_info_size_set(info,
|
||||||
LZMA_INFO_TOTAL, metadata->total_size);
|
LZMA_INFO_TOTAL, metadata->total_size));
|
||||||
if (ret != LZMA_OK)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Uncompressed Size
|
// Uncompressed Size
|
||||||
if (metadata->uncompressed_size != LZMA_VLI_VALUE_UNKNOWN) {
|
if (metadata->uncompressed_size != LZMA_VLI_VALUE_UNKNOWN)
|
||||||
const lzma_ret ret = lzma_info_size_set(info,
|
return_if_error(lzma_info_size_set(info,
|
||||||
LZMA_INFO_UNCOMPRESSED,
|
LZMA_INFO_UNCOMPRESSED,
|
||||||
metadata->uncompressed_size);
|
metadata->uncompressed_size));
|
||||||
if (ret != LZMA_OK)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return LZMA_OK;
|
return LZMA_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue