summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-09-17 11:56:34 +0200
committerGravatar Nikias Bassen2013-09-17 11:56:34 +0200
commit9b525ba69fff75f3a1cbc755b8da285d1f7286cf (patch)
tree83c5cb28ed260dcc926cdb5561240aef33d8f394
parentf4758e8b15cd30fe3f7f18de42e2ea20bc5696f0 (diff)
downloadusbmuxd-9b525ba69fff75f3a1cbc755b8da285d1f7286cf.tar.gz
usbmuxd-9b525ba69fff75f3a1cbc755b8da285d1f7286cf.tar.bz2
silence several compiler warnings
-rw-r--r--src/client.c4
-rw-r--r--src/device.c2
-rw-r--r--src/log.c2
-rw-r--r--src/log.h2
-rw-r--r--src/main.c10
-rw-r--r--src/usb-linux.c6
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)
count = device_get_list(devs);
// going to need a larger buffer for many devices
- int needed_buffer = count * (sizeof(struct usbmuxd_device_record) + sizeof(struct usbmuxd_header)) + REPLY_BUF_SIZE;
+ uint32_t needed_buffer = count * (sizeof(struct usbmuxd_device_record) + sizeof(struct usbmuxd_header)) + REPLY_BUF_SIZE;
if(client->ob_capacity < needed_buffer) {
usbmuxd_log(LL_DEBUG, "Enlarging client %d reply buffer %d -> %d to make space for device notifications", client->fd, client->ob_capacity, needed_buffer);
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)
static void process_send(struct mux_client *client)
{
- int res;
+ uint32_t res;
if(!client->ob_size) {
usbmuxd_log(LL_WARNING, "Client %d OUT process but nothing to send?", client->fd);
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
static struct collection device_list;
-uint64_t mstime64(void)
+static uint64_t mstime64(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
diff --git a/src/log.c b/src/log.c
index 1973257..2d22e94 100644
--- a/src/log.c
+++ b/src/log.c
@@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "log.h"
-int log_level = LL_WARNING;
+unsigned int log_level = LL_WARNING;
int log_syslog = 0;
diff --git a/src/log.h b/src/log.h
index eeefa41..1fb77ee 100644
--- a/src/log.h
+++ b/src/log.h
@@ -33,7 +33,7 @@ enum loglevel {
LL_FLOOD,
};
-extern int log_level;
+extern unsigned int log_level;
void log_enable_syslog();
void log_disable_syslog();
diff --git a/src/main.c b/src/main.c
index de5e5cc..32c6a2b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -64,7 +64,7 @@ static int daemon_pipe;
static int report_to_parent = 0;
-int create_socket(void) {
+static int create_socket(void) {
struct sockaddr_un bind_addr;
int listenfd;
@@ -98,7 +98,7 @@ int create_socket(void) {
return listenfd;
}
-void handle_signal(int sig)
+static void handle_signal(int sig)
{
if (sig != SIGUSR1 && sig != SIGUSR2) {
usbmuxd_log(LL_NOTICE,"Caught signal %d, exiting", sig);
@@ -124,7 +124,7 @@ void handle_signal(int sig)
}
}
-void set_signal_handlers(void)
+static void set_signal_handlers(void)
{
struct sigaction sa;
sigset_t set;
@@ -162,7 +162,7 @@ static int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout
}
#endif
-int main_loop(int listenfd)
+static int main_loop(int listenfd)
{
int to, cnt, i, dto;
struct fdlist pollfds;
@@ -519,7 +519,7 @@ int main(int argc, char *argv[])
goto terminate;
}
sprintf(pids, "%d", getpid());
- if ((res = write(lfd, pids, strlen(pids))) != strlen(pids)) {
+ if ((size_t)(res = write(lfd, pids, strlen(pids))) != strlen(pids)) {
usbmuxd_log(LL_FATAL, "Could not write pidfile!");
if(res >= 0)
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)
usbmuxd_log(LL_ERROR, "TX transfer overflow for device %d-%d", dev->bus, dev->address);
break;
// and nothing happens (this never gets called) if the device is freed after a disconnect! (bad)
+ default:
+ // this should never be reached.
+ break;
}
// we can't usb_disconnect here due to a deadlock, so instead mark it as dead and reap it after processing events
// we'll do device_remove there too
@@ -190,6 +193,9 @@ static void rx_callback(struct libusb_transfer *xfer)
usbmuxd_log(LL_ERROR, "RX transfer overflow for device %d-%d", dev->bus, dev->address);
break;
// and nothing happens (this never gets called) if the device is freed after a disconnect! (bad)
+ default:
+ // this should never be reached.
+ break;
}
free(xfer->buffer);
dev->rx_xfer = NULL;