diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-05-10 22:49:02 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-05-10 23:20:50 +0200 |
commit | 9f38dddfccbbfc731e3430bf1865d999256a2e31 (patch) | |
tree | 85700191ce1e7e438fd525b04b1e17cbdae57410 | |
parent | d03960525e7e90cb3511ea1719f188d4e008fa91 (diff) |
host: fix various compiler warnings
-rw-r--r-- | host/simtrace2-remsim.c | 10 | ||||
-rw-r--r-- | host/simtrace2_usb.c | 3 | ||||
-rw-r--r-- | host/usb2udp.c | 6 |
3 files changed, 10 insertions, 9 deletions
diff --git a/host/simtrace2-remsim.c b/host/simtrace2-remsim.c index 1f4f5d0..f7cc666 100644 --- a/host/simtrace2-remsim.c +++ b/host/simtrace2-remsim.c @@ -139,7 +139,7 @@ int st_transp_tx_msg(struct st_transport *transp, struct msgb *msg) printf("<- %s\n", msgb_hexdump(msg)); if (transp->udp_fd < 0) { - unsigned int xfer_len; + int xfer_len; rc = libusb_bulk_transfer(transp->usb_devh, transp->usb_ep.out, 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, 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)); sh->msg_class = msg_class; sh->msg_type = msg_type; sh->slot_nr = slot_nr; sh->msg_len = msgb_length(msg); + + return sh; } /* 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, 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; @@ -682,7 +685,6 @@ close_exit: sleep(1); } while (keep_running); -release_exit: if (transp->udp_fd < 0) libusb_exit(NULL); do_exit: diff --git a/host/simtrace2_usb.c b/host/simtrace2_usb.c index e4c5818..ad4b73b 100644 --- a/host/simtrace2_usb.c +++ b/host/simtrace2_usb.c @@ -52,7 +52,8 @@ static int find_devices(void) perror("Cannot open device"); 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); if (rc < 0) { printf("\n"); diff --git a/host/usb2udp.c b/host/usb2udp.c index 5e48b22..7a1e4a3 100644 --- a/host/usb2udp.c +++ b/host/usb2udp.c @@ -142,10 +142,10 @@ static void libusb_fd_added_cb(int fd, short events, void *user_data) /* call-back when libusb removes a FD */ static void libusb_fd_removed_cb(int fd, void *user_data) { - struct osmo_fd *ofd; printf("%s(%u)\n", __func__, fd); #if 0 + struct osmo_fd *ofd; /* FIXME: This needs new export in libosmocore! */ 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) { 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, (struct sockaddr *)&g_sa_remote, &addrlen); @@ -204,7 +204,6 @@ int main(int argc, char **argv) { int rc; int c, ret = 1; - char *remote_host = NULL; int local_udp_port = 52342; unsigned int if_num = 0; @@ -282,7 +281,6 @@ close_exit: if (g_devh) libusb_close(g_devh); -release_exit: libusb_exit(NULL); return ret; } |