xz: Replace a few uint32_t with "unsigned" to reduce the number of casts

These hold only tiny values.
This commit is contained in:
Lasse Collin 2024-05-12 21:22:43 +03:00
parent b5e6c1113b
commit ff9e8b3d06
3 changed files with 10 additions and 11 deletions

View File

@ -132,7 +132,7 @@ parse_block_list(const char *str_const)
"filter chain number '%c:'"),
str[0]);
const uint32_t filter_num = (uint32_t)(str[0] - '0');
const unsigned filter_num = (unsigned)(str[0] - '0');
opt_block_list[i].filters_index = filter_num;
block_list_chain_mask |= 1U << filter_num;
str += 2;

View File

@ -406,7 +406,7 @@ coder_set_compression_settings(void)
// from the filter chain. Currently the threaded encoder doesn't
// support LZMA_SYNC_FLUSH so single-threaded mode must be used.
if (opt_mode == MODE_COMPRESS && opt_flush_timeout != 0) {
for (uint32_t i = 0; i < ARRAY_SIZE(chains); ++i) {
for (unsigned i = 0; i < ARRAY_SIZE(chains); ++i) {
if (!(chains_used_mask & (1U << i)))
continue;
@ -421,7 +421,7 @@ coder_set_compression_settings(void)
message_fatal(_("Filter chain %u is "
"incompatible with "
"--flush-timeout"),
(unsigned)i);
i);
}
}
}
@ -461,7 +461,7 @@ coder_set_compression_settings(void)
// If opt_block_size is not set, find the maximum
// recommended Block size based on the filter chains
if (block_size == 0) {
for (uint32_t i = 0; i < ARRAY_SIZE(chains);
for (unsigned i = 0; i < ARRAY_SIZE(chains);
i++) {
if (!(chains_used_mask & (1U << i)))
continue;
@ -476,8 +476,7 @@ coder_set_compression_settings(void)
if (size == UINT64_MAX)
message_fatal(_("Unsupported "
"options in filter "
"chain %u"),
(unsigned)i);
"chain %u"), i);
if (size > block_size)
block_size = size;
@ -732,7 +731,7 @@ coder_set_compression_settings(void)
// Tell the user that we decreased the dictionary size for
// each filter that was adjusted.
for (uint32_t i = 0; i < ARRAY_SIZE(memusage_reduction); i++) {
for (unsigned i = 0; i < ARRAY_SIZE(memusage_reduction); i++) {
memusage_reduction_data *r = &memusage_reduction[i];
// If the filters were never set, then the memory usage
@ -762,7 +761,7 @@ coder_set_compression_settings(void)
"exceed the memory usage limit of %s MiB"),
filter_lzma->id == LZMA_FILTER_LZMA2
? '2' : '1',
(unsigned)i,
i,
uint64_to_str(r->orig_dict_size >> 20, 0),
uint64_to_str(opt->dict_size >> 20, 1),
uint64_to_str(round_up_to_mib(
@ -1115,7 +1114,7 @@ split_block(uint64_t *block_remaining,
// Update the filters if needed.
if (opt_block_list[*list_pos - 1].filters_index
!= opt_block_list[*list_pos].filters_index) {
const uint32_t chain_idx = opt_block_list
const unsigned chain_idx = opt_block_list
[*list_pos].filters_index;
const lzma_filter *next = chains[chain_idx];
const lzma_ret ret = lzma_filters_update(
@ -1133,7 +1132,7 @@ split_block(uint64_t *block_remaining,
message_fatal(
_("Error changing to "
"filter chain %u: %s"),
(unsigned)chain_idx,
chain_idx,
message_strm(ret));
}
}

View File

@ -38,7 +38,7 @@ typedef struct {
/// Index into the filters[] representing the filter chain to use
/// for this Block.
uint32_t filters_index;
unsigned filters_index;
} block_list_entry;