Fix some more -Wextra warnings

This commit is contained in:
Marek Marczykowski-Górecki 2014-02-16 10:43:01 +01:00
parent 03c9cb1388
commit 12a9049cfe
3 changed files with 11 additions and 12 deletions

View File

@ -7,7 +7,7 @@
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
unsigned long prev_used_mem; long prev_used_mem;
int used_mem_change_threshold; int used_mem_change_threshold;
int delay; int delay;
int usr1_received; int usr1_received;
@ -27,7 +27,7 @@ const char *parse(const char *buf)
while (nitems != (1<<6)-1 || !*ptr) { while (nitems != (1<<6)-1 || !*ptr) {
ret = sscanf(ptr, "%*s %d kB\n%n", &val, &len); 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; ptr += len;
continue; 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; usr1_received = 1;
} }

View File

@ -64,7 +64,7 @@ typedef void (notify_progress_t)(int, int);
void register_notify_progress(notify_progress_t *func); void register_notify_progress(notify_progress_t *func);
int copy_file(int outfd, int infd, long long size, unsigned long *crc32); int copy_file(int outfd, int infd, long long size, unsigned long *crc32);
const char *copy_file_status_to_str(int status); 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); void set_verbose(int value);
int write_all(int fd, const void *buf, int size); int write_all(int fd, const void *buf, int size);
int read_all(int fd, void *buf, int size); int read_all(int fd, void *buf, int size);

View File

@ -13,12 +13,14 @@
#include "crc32.h" #include "crc32.h"
char untrusted_namebuf[MAX_PATH_LENGTH]; char untrusted_namebuf[MAX_PATH_LENGTH];
long long bytes_limit = 0; unsigned long long bytes_limit = 0;
long long files_limit = 0; unsigned long long files_limit = 0;
long long total_bytes = 0; unsigned long long total_bytes = 0;
long long total_files = 0; unsigned long long total_files = 0;
int verbose = 0; int verbose = 0;
void send_status_and_crc(int code, const char *last_filename);
void do_exit(int code, const char *last_filename) void do_exit(int code, const char *last_filename)
{ {
close(0); close(0);
@ -26,11 +28,8 @@ void do_exit(int code, const char *last_filename)
exit(code); 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; bytes_limit = new_bytes_limit;
files_limit = new_files_limit; files_limit = new_files_limit;
} }