host: fix various compiler warnings

This commit is contained in:
Harald Welte
2017-05-10 22:49:02 +02:00
parent d03960525e
commit 9f38dddfcc
3 changed files with 10 additions and 9 deletions

View File

@@ -139,7 +139,7 @@ int st_transp_tx_msg(struct st_transport *transp, struct msgb *msg)
printf("<- %s\n", msgb_hexdump(msg)); printf("<- %s\n", msgb_hexdump(msg));
if (transp->udp_fd < 0) { if (transp->udp_fd < 0) {
unsigned int xfer_len; int xfer_len;
rc = libusb_bulk_transfer(transp->usb_devh, transp->usb_ep.out, rc = libusb_bulk_transfer(transp->usb_devh, transp->usb_ep.out,
msgb_data(msg), msgb_length(msg), msgb_data(msg), msgb_length(msg),
@@ -155,13 +155,16 @@ int st_transp_tx_msg(struct st_transport *transp, struct msgb *msg)
static struct simtrace_msg_hdr *st_push_hdr(struct msgb *msg, uint8_t msg_class, uint8_t msg_type, static struct simtrace_msg_hdr *st_push_hdr(struct msgb *msg, uint8_t msg_class, uint8_t msg_type,
uint8_t slot_nr) uint8_t slot_nr)
{ {
struct simtrace_msg_hdr *sh = msgb_push(msg, sizeof(*sh)); struct simtrace_msg_hdr *sh;
sh = (struct simtrace_msg_hdr *) msgb_push(msg, sizeof(*sh));
memset(sh, 0, sizeof(*sh)); memset(sh, 0, sizeof(*sh));
sh->msg_class = msg_class; sh->msg_class = msg_class;
sh->msg_type = msg_type; sh->msg_type = msg_type;
sh->slot_nr = slot_nr; sh->slot_nr = slot_nr;
sh->msg_len = msgb_length(msg); sh->msg_len = msgb_length(msg);
return sh;
} }
/* transmit a given message to a specified slot. Expects all headers /* transmit a given message to a specified slot. Expects all headers
@@ -169,7 +172,7 @@ static struct simtrace_msg_hdr *st_push_hdr(struct msgb *msg, uint8_t msg_class,
int st_slot_tx_msg(struct st_slot *slot, struct msgb *msg, int st_slot_tx_msg(struct st_slot *slot, struct msgb *msg,
uint8_t msg_class, uint8_t msg_type) uint8_t msg_class, uint8_t msg_type)
{ {
struct simtrace_msg_hdr *sh = msg->data; struct simtrace_msg_hdr *sh = (struct simtrace_msg_hdr *) msg->data;
sh->slot_nr = slot->slot_nr; sh->slot_nr = slot->slot_nr;
@@ -682,7 +685,6 @@ close_exit:
sleep(1); sleep(1);
} while (keep_running); } while (keep_running);
release_exit:
if (transp->udp_fd < 0) if (transp->udp_fd < 0)
libusb_exit(NULL); libusb_exit(NULL);
do_exit: do_exit:

View File

@@ -52,7 +52,8 @@ static int find_devices(void)
perror("Cannot open device"); perror("Cannot open device");
continue; continue;
} }
rc = libusb_get_string_descriptor_ascii(dev_handle, m->string_idx, strbuf, sizeof(strbuf)); rc = libusb_get_string_descriptor_ascii(dev_handle, m->string_idx,
(unsigned char *)strbuf, sizeof(strbuf));
libusb_close(dev_handle); libusb_close(dev_handle);
if (rc < 0) { if (rc < 0) {
printf("\n"); printf("\n");

View File

@@ -142,10 +142,10 @@ static void libusb_fd_added_cb(int fd, short events, void *user_data)
/* call-back when libusb removes a FD */ /* call-back when libusb removes a FD */
static void libusb_fd_removed_cb(int fd, void *user_data) static void libusb_fd_removed_cb(int fd, void *user_data)
{ {
struct osmo_fd *ofd;
printf("%s(%u)\n", __func__, fd); printf("%s(%u)\n", __func__, fd);
#if 0 #if 0
struct osmo_fd *ofd;
/* FIXME: This needs new export in libosmocore! */ /* FIXME: This needs new export in libosmocore! */
ofd = osmo_fd_get_by_fd(fd); ofd = osmo_fd_get_by_fd(fd);
@@ -160,7 +160,7 @@ static void libusb_fd_removed_cb(int fd, void *user_data)
static int ofd_udp_cb(struct osmo_fd *ofd, unsigned int what) static int ofd_udp_cb(struct osmo_fd *ofd, unsigned int what)
{ {
int rc; int rc;
int addrlen = sizeof(g_sa_remote); socklen_t addrlen = sizeof(g_sa_remote);
rc = recvfrom(ofd->fd, g_buf_out.buf, sizeof(g_buf_out.buf), 0, rc = recvfrom(ofd->fd, g_buf_out.buf, sizeof(g_buf_out.buf), 0,
(struct sockaddr *)&g_sa_remote, &addrlen); (struct sockaddr *)&g_sa_remote, &addrlen);
@@ -204,7 +204,6 @@ int main(int argc, char **argv)
{ {
int rc; int rc;
int c, ret = 1; int c, ret = 1;
char *remote_host = NULL;
int local_udp_port = 52342; int local_udp_port = 52342;
unsigned int if_num = 0; unsigned int if_num = 0;
@@ -282,7 +281,6 @@ close_exit:
if (g_devh) if (g_devh)
libusb_close(g_devh); libusb_close(g_devh);
release_exit:
libusb_exit(NULL); libusb_exit(NULL);
return ret; return ret;
} }