mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-27 16:39:08 +00:00
libarchive: make single bit bitfields unsigned to avoid clang 16 warning
Clang 16 introduced a warning about single bit bitfields in structs, which is triggered by various declarations in libarchive: contrib/libarchive/libarchive/archive_write_set_format_7zip.c:1541:13: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] file->dir = 1; ^ ~ contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:5127:15: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] isoent->dir = 1; ^ ~ contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:5213:14: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] isoent->dir = 1; ^ ~ contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:5214:18: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] isoent->virtual = 1; ^ ~ contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7149:18: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] isoent->virtual = 1; ^ ~ contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7435:32: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] iso9660->zisofs.detect_magic = 1; ^ ~ contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7495:25: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] iso9660->zisofs.making = 1; ^ ~ contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7496:26: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] iso9660->zisofs.allzero = 1; ^ ~ contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7702:28: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] iso9660->zisofs.allzero = 1; ^ ~ contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7871:25: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] zisofs->header_passed = 1; ^ ~ contrib/libarchive/libarchive/archive_write_set_format_iso9660.c:7894:24: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] zisofs->initialized = 1; ^ ~ Signed one-bit bitfields can only have values -1 and 0, but the intent here is to use the fields as booleans, so make them unsigned. This has also been sent upstream. MFC after: 3 days
This commit is contained in:
parent
1a3ccb8f15
commit
67ecab6f50
@ -165,7 +165,7 @@ struct file {
|
||||
mode_t mode;
|
||||
uint32_t crc32;
|
||||
|
||||
signed int dir:1;
|
||||
unsigned int dir:1;
|
||||
};
|
||||
|
||||
struct _7zip {
|
||||
|
@ -289,12 +289,12 @@ struct isoent {
|
||||
struct extr_rec *current;
|
||||
} extr_rec_list;
|
||||
|
||||
signed int virtual:1;
|
||||
unsigned int virtual:1;
|
||||
/* If set to one, this file type is a directory.
|
||||
* A convenience flag to be used as
|
||||
* "archive_entry_filetype(isoent->file->entry) == AE_IFDIR".
|
||||
*/
|
||||
signed int dir:1;
|
||||
unsigned int dir:1;
|
||||
};
|
||||
|
||||
struct hardlink {
|
||||
@ -755,9 +755,9 @@ struct iso9660 {
|
||||
|
||||
/* Used for making zisofs. */
|
||||
struct {
|
||||
signed int detect_magic:1;
|
||||
signed int making:1;
|
||||
signed int allzero:1;
|
||||
unsigned int detect_magic:1;
|
||||
unsigned int making:1;
|
||||
unsigned int allzero:1;
|
||||
unsigned char magic_buffer[64];
|
||||
int magic_cnt;
|
||||
|
||||
@ -7802,8 +7802,8 @@ struct zisofs_extract {
|
||||
uint64_t pz_uncompressed_size;
|
||||
size_t uncompressed_buffer_size;
|
||||
|
||||
signed int initialized:1;
|
||||
signed int header_passed:1;
|
||||
unsigned int initialized:1;
|
||||
unsigned int header_passed:1;
|
||||
|
||||
uint32_t pz_offset;
|
||||
unsigned char *block_pointers;
|
||||
|
@ -212,8 +212,8 @@ struct file {
|
||||
struct heap_data data;
|
||||
struct archive_string script;
|
||||
|
||||
signed int virtual:1;
|
||||
signed int dir:1;
|
||||
unsigned int virtual:1;
|
||||
unsigned int dir:1;
|
||||
};
|
||||
|
||||
struct hardlink {
|
||||
|
Loading…
Reference in New Issue
Block a user