static bool
wim_compression_type_valid(enum wimlib_compression_type ctype)
{
- return ctype >= 0 && ctype < ARRAY_LEN(wim_ctype_info) &&
- wim_ctype_info[ctype].name != NULL;
+ return (unsigned)ctype < ARRAY_LEN(wim_ctype_info) &&
+ wim_ctype_info[(unsigned)ctype].name != NULL;
}
/* Is the specified chunk size valid for the compression type? */
if (!(chunk_size == 0 || is_power_of_2(chunk_size)))
return false;
- return chunk_size >= wim_ctype_info[ctype].min_chunk_size &&
- chunk_size <= wim_ctype_info[ctype].max_chunk_size;
+ return chunk_size >= wim_ctype_info[(unsigned)ctype].min_chunk_size &&
+ chunk_size <= wim_ctype_info[(unsigned)ctype].max_chunk_size;
}
/* Return the default chunk size to use for the specified compression type in
static u32
wim_default_nonsolid_chunk_size(enum wimlib_compression_type ctype)
{
- return wim_ctype_info[ctype].default_nonsolid_chunk_size;
+ return wim_ctype_info[(unsigned)ctype].default_nonsolid_chunk_size;
}
/* Return the default chunk size to use for the specified compression type in
static u32
wim_default_solid_chunk_size(enum wimlib_compression_type ctype)
{
- return wim_ctype_info[ctype].default_solid_chunk_size;
+ return wim_ctype_info[(unsigned)ctype].default_solid_chunk_size;
}
/* Return the default compression type to use in solid resources. */
if (!wim_compression_type_valid(ctype))
return T("Invalid");
- return wim_ctype_info[ctype].name;
+ return wim_ctype_info[(unsigned)ctype].name;
}
WIMLIBAPI void