diff options
| author | 2013-09-17 11:56:34 +0200 | |
|---|---|---|
| committer | 2013-09-17 11:56:34 +0200 | |
| commit | 9b525ba69fff75f3a1cbc755b8da285d1f7286cf (patch) | |
| tree | 83c5cb28ed260dcc926cdb5561240aef33d8f394 | |
| parent | f4758e8b15cd30fe3f7f18de42e2ea20bc5696f0 (diff) | |
| download | usbmuxd-9b525ba69fff75f3a1cbc755b8da285d1f7286cf.tar.gz usbmuxd-9b525ba69fff75f3a1cbc755b8da285d1f7286cf.tar.bz2 | |
silence several compiler warnings
| -rw-r--r-- | src/client.c | 4 | ||||
| -rw-r--r-- | src/device.c | 2 | ||||
| -rw-r--r-- | src/log.c | 2 | ||||
| -rw-r--r-- | src/log.h | 2 | ||||
| -rw-r--r-- | src/main.c | 10 | ||||
| -rw-r--r-- | src/usb-linux.c | 6 |
6 files changed, 16 insertions, 10 deletions
diff --git a/src/client.c b/src/client.c index ac1045a..d4a4a10 100644 --- a/src/client.c +++ b/src/client.c | |||
| @@ -318,7 +318,7 @@ static int start_listen(struct mux_client *client) | |||
| 318 | count = device_get_list(devs); | 318 | count = device_get_list(devs); |
| 319 | 319 | ||
| 320 | // going to need a larger buffer for many devices | 320 | // going to need a larger buffer for many devices |
| 321 | int needed_buffer = count * (sizeof(struct usbmuxd_device_record) + sizeof(struct usbmuxd_header)) + REPLY_BUF_SIZE; | 321 | uint32_t needed_buffer = count * (sizeof(struct usbmuxd_device_record) + sizeof(struct usbmuxd_header)) + REPLY_BUF_SIZE; |
| 322 | if(client->ob_capacity < needed_buffer) { | 322 | if(client->ob_capacity < needed_buffer) { |
| 323 | usbmuxd_log(LL_DEBUG, "Enlarging client %d reply buffer %d -> %d to make space for device notifications", client->fd, client->ob_capacity, needed_buffer); | 323 | usbmuxd_log(LL_DEBUG, "Enlarging client %d reply buffer %d -> %d to make space for device notifications", client->fd, client->ob_capacity, needed_buffer); |
| 324 | client->ob_buf = realloc(client->ob_buf, needed_buffer); | 324 | client->ob_buf = realloc(client->ob_buf, needed_buffer); |
| @@ -464,7 +464,7 @@ static int client_command(struct mux_client *client, struct usbmuxd_header *hdr) | |||
| 464 | 464 | ||
| 465 | static void process_send(struct mux_client *client) | 465 | static void process_send(struct mux_client *client) |
| 466 | { | 466 | { |
| 467 | int res; | 467 | uint32_t res; |
| 468 | if(!client->ob_size) { | 468 | if(!client->ob_size) { |
| 469 | usbmuxd_log(LL_WARNING, "Client %d OUT process but nothing to send?", client->fd); | 469 | usbmuxd_log(LL_WARNING, "Client %d OUT process but nothing to send?", client->fd); |
| 470 | client->events &= ~POLLOUT; | 470 | client->events &= ~POLLOUT; |
diff --git a/src/device.c b/src/device.c index 8c786a7..91712be 100644 --- a/src/device.c +++ b/src/device.c | |||
| @@ -114,7 +114,7 @@ struct mux_device | |||
| 114 | 114 | ||
| 115 | static struct collection device_list; | 115 | static struct collection device_list; |
| 116 | 116 | ||
| 117 | uint64_t mstime64(void) | 117 | static uint64_t mstime64(void) |
| 118 | { | 118 | { |
| 119 | struct timeval tv; | 119 | struct timeval tv; |
| 120 | gettimeofday(&tv, NULL); | 120 | gettimeofday(&tv, NULL); |
| @@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
| 33 | 33 | ||
| 34 | #include "log.h" | 34 | #include "log.h" |
| 35 | 35 | ||
| 36 | int log_level = LL_WARNING; | 36 | unsigned int log_level = LL_WARNING; |
| 37 | 37 | ||
| 38 | int log_syslog = 0; | 38 | int log_syslog = 0; |
| 39 | 39 | ||
| @@ -33,7 +33,7 @@ enum loglevel { | |||
| 33 | LL_FLOOD, | 33 | LL_FLOOD, |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | extern int log_level; | 36 | extern unsigned int log_level; |
| 37 | 37 | ||
| 38 | void log_enable_syslog(); | 38 | void log_enable_syslog(); |
| 39 | void log_disable_syslog(); | 39 | void log_disable_syslog(); |
| @@ -64,7 +64,7 @@ static int daemon_pipe; | |||
| 64 | 64 | ||
| 65 | static int report_to_parent = 0; | 65 | static int report_to_parent = 0; |
| 66 | 66 | ||
| 67 | int create_socket(void) { | 67 | static int create_socket(void) { |
| 68 | struct sockaddr_un bind_addr; | 68 | struct sockaddr_un bind_addr; |
| 69 | int listenfd; | 69 | int listenfd; |
| 70 | 70 | ||
| @@ -98,7 +98,7 @@ int create_socket(void) { | |||
| 98 | return listenfd; | 98 | return listenfd; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | void handle_signal(int sig) | 101 | static void handle_signal(int sig) |
| 102 | { | 102 | { |
| 103 | if (sig != SIGUSR1 && sig != SIGUSR2) { | 103 | if (sig != SIGUSR1 && sig != SIGUSR2) { |
| 104 | usbmuxd_log(LL_NOTICE,"Caught signal %d, exiting", sig); | 104 | usbmuxd_log(LL_NOTICE,"Caught signal %d, exiting", sig); |
| @@ -124,7 +124,7 @@ void handle_signal(int sig) | |||
| 124 | } | 124 | } |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | void set_signal_handlers(void) | 127 | static void set_signal_handlers(void) |
| 128 | { | 128 | { |
| 129 | struct sigaction sa; | 129 | struct sigaction sa; |
| 130 | sigset_t set; | 130 | sigset_t set; |
| @@ -162,7 +162,7 @@ static int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout | |||
| 162 | } | 162 | } |
| 163 | #endif | 163 | #endif |
| 164 | 164 | ||
| 165 | int main_loop(int listenfd) | 165 | static int main_loop(int listenfd) |
| 166 | { | 166 | { |
| 167 | int to, cnt, i, dto; | 167 | int to, cnt, i, dto; |
| 168 | struct fdlist pollfds; | 168 | struct fdlist pollfds; |
| @@ -519,7 +519,7 @@ int main(int argc, char *argv[]) | |||
| 519 | goto terminate; | 519 | goto terminate; |
| 520 | } | 520 | } |
| 521 | sprintf(pids, "%d", getpid()); | 521 | sprintf(pids, "%d", getpid()); |
| 522 | if ((res = write(lfd, pids, strlen(pids))) != strlen(pids)) { | 522 | if ((size_t)(res = write(lfd, pids, strlen(pids))) != strlen(pids)) { |
| 523 | usbmuxd_log(LL_FATAL, "Could not write pidfile!"); | 523 | usbmuxd_log(LL_FATAL, "Could not write pidfile!"); |
| 524 | if(res >= 0) | 524 | if(res >= 0) |
| 525 | res = -2; | 525 | res = -2; |
diff --git a/src/usb-linux.c b/src/usb-linux.c index 334d967..f937de0 100644 --- a/src/usb-linux.c +++ b/src/usb-linux.c | |||
| @@ -121,6 +121,9 @@ static void tx_callback(struct libusb_transfer *xfer) | |||
| 121 | usbmuxd_log(LL_ERROR, "TX transfer overflow for device %d-%d", dev->bus, dev->address); | 121 | usbmuxd_log(LL_ERROR, "TX transfer overflow for device %d-%d", dev->bus, dev->address); |
| 122 | break; | 122 | break; |
| 123 | // and nothing happens (this never gets called) if the device is freed after a disconnect! (bad) | 123 | // and nothing happens (this never gets called) if the device is freed after a disconnect! (bad) |
| 124 | default: | ||
| 125 | // this should never be reached. | ||
| 126 | break; | ||
| 124 | } | 127 | } |
| 125 | // we can't usb_disconnect here due to a deadlock, so instead mark it as dead and reap it after processing events | 128 | // we can't usb_disconnect here due to a deadlock, so instead mark it as dead and reap it after processing events |
| 126 | // we'll do device_remove there too | 129 | // we'll do device_remove there too |
| @@ -190,6 +193,9 @@ static void rx_callback(struct libusb_transfer *xfer) | |||
| 190 | usbmuxd_log(LL_ERROR, "RX transfer overflow for device %d-%d", dev->bus, dev->address); | 193 | usbmuxd_log(LL_ERROR, "RX transfer overflow for device %d-%d", dev->bus, dev->address); |
| 191 | break; | 194 | break; |
| 192 | // and nothing happens (this never gets called) if the device is freed after a disconnect! (bad) | 195 | // and nothing happens (this never gets called) if the device is freed after a disconnect! (bad) |
| 196 | default: | ||
| 197 | // this should never be reached. | ||
| 198 | break; | ||
| 193 | } | 199 | } |
| 194 | free(xfer->buffer); | 200 | free(xfer->buffer); |
| 195 | dev->rx_xfer = NULL; | 201 | dev->rx_xfer = NULL; |
