From 12a9049cfee519014ebc0c019b3357cef74f7e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 16 Feb 2014 10:43:01 +0100 Subject: [PATCH] Fix some more -Wextra warnings --- qmemman/meminfo-writer.c | 6 +++--- qrexec-lib/libqubes-rpc-filecopy.h | 2 +- qrexec-lib/unpack.c | 15 +++++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/qmemman/meminfo-writer.c b/qmemman/meminfo-writer.c index c70fd43..8569273 100644 --- a/qmemman/meminfo-writer.c +++ b/qmemman/meminfo-writer.c @@ -7,7 +7,7 @@ #include #include -unsigned long prev_used_mem; +long prev_used_mem; int used_mem_change_threshold; int delay; int usr1_received; @@ -27,7 +27,7 @@ const char *parse(const char *buf) while (nitems != (1<<6)-1 || !*ptr) { ret = sscanf(ptr, "%*s %d kB\n%n", &val, &len); - if (ret < 1 || len < sizeof (unsigned long long)) { + if (ret < 1 || len < (int)sizeof (unsigned long long)) { ptr += len; continue; } @@ -95,7 +95,7 @@ void send_to_qmemman(struct xs_handle *xs, const char *data) } } -void usr1_handler(int sig) { +void usr1_handler(int sig __attribute__((__unused__))) { usr1_received = 1; } diff --git a/qrexec-lib/libqubes-rpc-filecopy.h b/qrexec-lib/libqubes-rpc-filecopy.h index d735f86..d566345 100644 --- a/qrexec-lib/libqubes-rpc-filecopy.h +++ b/qrexec-lib/libqubes-rpc-filecopy.h @@ -64,7 +64,7 @@ typedef void (notify_progress_t)(int, int); void register_notify_progress(notify_progress_t *func); int copy_file(int outfd, int infd, long long size, unsigned long *crc32); const char *copy_file_status_to_str(int status); -void set_size_limit(long long new_bytes_limit, long long new_files_limit); +void set_size_limit(unsigned long long new_bytes_limit, unsigned long long new_files_limit); void set_verbose(int value); int write_all(int fd, const void *buf, int size); int read_all(int fd, void *buf, int size); diff --git a/qrexec-lib/unpack.c b/qrexec-lib/unpack.c index ca52c9c..d7787d1 100644 --- a/qrexec-lib/unpack.c +++ b/qrexec-lib/unpack.c @@ -13,12 +13,14 @@ #include "crc32.h" char untrusted_namebuf[MAX_PATH_LENGTH]; -long long bytes_limit = 0; -long long files_limit = 0; -long long total_bytes = 0; -long long total_files = 0; +unsigned long long bytes_limit = 0; +unsigned long long files_limit = 0; +unsigned long long total_bytes = 0; +unsigned long long total_files = 0; int verbose = 0; +void send_status_and_crc(int code, const char *last_filename); + void do_exit(int code, const char *last_filename) { close(0); @@ -26,11 +28,8 @@ void do_exit(int code, const char *last_filename) exit(code); } -void set_size_limit(long long new_bytes_limit, long long new_files_limit) +void set_size_limit(unsigned long long new_bytes_limit, unsigned long long new_files_limit) { - if (new_bytes_limit < 0 || new_files_limit < 0) { - do_exit(EINVAL, ""); - } bytes_limit = new_bytes_limit; files_limit = new_files_limit; }