Skip to content

Commit 02cdffa

Browse files
committed
char: Fix clang bitfield warnings
1 parent eb5dba4 commit 02cdffa

5 files changed

Lines changed: 38 additions & 38 deletions

File tree

src/char/char_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ typedef struct {
5858
char_port_t *port;
5959
FILE *file_in;
6060
FILE *file_out;
61-
int loop_in : 1;
61+
unsigned int loop_in : 1;
6262
} char_file_t;
6363

6464
static size_t

src/char/char_loopback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ typedef struct {
100100
int type;
101101
uint8_t data_tx;
102102
uint8_t data_rx;
103-
int data_read : 1;
103+
unsigned int data_read : 1;
104104
uint32_t control;
105105
uint32_t status;
106106
} char_loopback_t;

src/char/char_pipe.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,22 @@ typedef struct {
6161
char_port_t *port;
6262
int mode;
6363
uint32_t last_connect_attempt;
64-
int reconnect : 1;
65-
int server : 1;
64+
unsigned int reconnect : 1;
65+
unsigned int server : 1;
6666
#ifdef _WIN32
67-
int connected : 1;
68-
int block_connect : 1;
69-
char path[257]; /* "The entire pipe name string can be up to 256 characters long." */
70-
HANDLE fd;
67+
unsigned int connected : 1;
68+
unsigned int block_connect : 1;
69+
char path[257]; /* "The entire pipe name string can be up to 256 characters long." */
70+
HANDLE fd;
7171
#else
72-
int block_connect_in : 1;
73-
int block_connect_out : 1;
74-
int direction : 1;
75-
size_t path_len;
76-
char *path_in;
77-
char *path_out;
78-
int fd_in;
79-
int fd_out;
72+
unsigned int block_connect_in : 1;
73+
unsigned int block_connect_out : 1;
74+
unsigned int direction : 1;
75+
size_t path_len;
76+
char *path_in;
77+
char *path_out;
78+
int fd_in;
79+
int fd_out;
8080
#endif
8181
} char_pipe_t;
8282

@@ -143,7 +143,7 @@ char_pipe_connect(char_pipe_t *dev, int startup)
143143
char msg[1024];
144144
#ifdef _WIN32
145145
/* Connect or create pipe. */
146-
char fmt[512];
146+
char fmt[512];
147147
DWORD create_err = 0;
148148
if (dev->mode != CHAR_PIPE_MODE_CLIENT) {
149149
dev->fd = CreateNamedPipeA(dev->path, PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 65536, 65536, NMPWAIT_USE_DEFAULT_WAIT, NULL);
@@ -237,8 +237,8 @@ char_pipe_connect(char_pipe_t *dev, int startup)
237237
if (CHAR_FD_VALID(*target))
238238
continue;
239239

240-
const char *path = ((i ^ !!dev->direction) == 0) ? dev->path_out : dev->path_in;
241-
int create_err = 0;
240+
const char *path = ((i ^ dev->direction) == 0) ? dev->path_out : dev->path_in;
241+
int create_err = 0;
242242
if (CHAR_FD_VALID(out_test_fd)) {
243243
/* Reuse file descriptor from earlier test. */
244244
*target = out_test_fd;

src/char/char_serial.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ typedef struct {
7171
#ifndef _WIN32
7272
const
7373
#endif
74-
char *path;
75-
int reconnect : 1;
76-
int block_connect : 1;
77-
uint32_t last_connect_attempt;
74+
char *path;
75+
unsigned int reconnect : 1;
76+
unsigned int block_connect : 1;
77+
unsigned int prev_config_valid : 1;
78+
uint32_t last_connect_attempt;
7879
#ifdef _WIN32
7980
HANDLE fd;
8081
DCB prev_config;
@@ -89,7 +90,6 @@ typedef struct {
8990
struct termios config;
9091
# endif
9192
#endif
92-
int prev_config_valid : 1;
9393
} char_serial_t;
9494

9595
#ifdef _WIN32

src/char/char_stdio.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,22 @@ typedef struct {
7777

7878
FILE *prev_log;
7979
#ifdef _WIN32
80-
HANDLE fd_in;
81-
HANDLE fd_out;
82-
int prev_in_mode_valid : 1;
83-
int prev_out_mode_valid : 1;
84-
DWORD prev_in_mode;
85-
DWORD prev_out_mode;
86-
char *prev_title;
87-
ATOMIC_INT buf_in_valid;
88-
uint8_t buf_in;
89-
thread_t *thread_in;
90-
event_t *event_in;
80+
HANDLE fd_in;
81+
HANDLE fd_out;
82+
unsigned int prev_in_mode_valid : 1;
83+
unsigned int prev_out_mode_valid : 1;
84+
DWORD prev_in_mode;
85+
DWORD prev_out_mode;
86+
char *prev_title;
87+
ATOMIC_INT buf_in_valid;
88+
uint8_t buf_in;
89+
thread_t *thread_in;
90+
event_t *event_in;
9191
#else
9292
int fd_in;
9393
int fd_out;
94-
int prev_config_valid : 1;
95-
int prev_flags_valid : 1;
94+
unsigned int prev_config_valid : 1;
95+
unsigned int prev_flags_valid : 1;
9696
struct termios prev_config;
9797
int prev_flags;
9898
#endif
@@ -368,7 +368,7 @@ char_stdio_init(const device_t *info)
368368
"clear;" /* suppress background task indicator (zsh prints it to stdout) */
369369
"cat>\"$PTY\";" /* pipe from stdin to pty */
370370
"exec kill $!"; /* stop script once the write connection is broken */
371-
char env[3][2048];
371+
char env[3][2048];
372372
snprintf(env[0], sizeof(env[0]), "PTY=%s", pty);
373373
snprintf(env[1], sizeof(env[1]), "VMNAME=%s", vm_name);
374374
snprintf(env[2], sizeof(env[2]), "PORT=%s", dev->port->name);

0 commit comments

Comments
 (0)