From 35e368f71a8f576caafda3c2263bfaf6301af889 Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Mon, 19 Oct 2015 13:01:44 +1030 Subject: [PATCH] Clean up compilation warnings --- Android.mk | 2 +- Makefile.in | 2 +- fdqueue.h | 1 - http_server.c | 13 ------------- httpd.c | 2 +- keyring.c | 4 ++-- rhizome_cli.c | 3 ++- 7 files changed, 7 insertions(+), 20 deletions(-) diff --git a/Android.mk b/Android.mk index 97f1d542..6555affb 100644 --- a/Android.mk +++ b/Android.mk @@ -16,7 +16,7 @@ SQLITE3_INC := $(LOCAL_PATH)/sqlite-amalgamation-3070900 SERVALD_LOCAL_CFLAGS = \ -g \ - -Wall -Wno-unused-value -Werror \ + -Wall -Wno-unused-variable -Wno-unused-value -Werror \ -DSERVALD_VERSION="\"Android\"" -DSERVALD_COPYRIGHT="\"Android\"" \ -DINSTANCE_PATH="\"/data/data/org.servalproject/var/serval-node\"" \ -DSHELL -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" \ diff --git a/Makefile.in b/Makefile.in index 6a3705bb..bbb05d36 100644 --- a/Makefile.in +++ b/Makefile.in @@ -59,7 +59,7 @@ CFLAGS= -Isqlite-amalgamation-3070900 @CPPFLAGS@ @CFLAGS@ -Inacl/include CFLAGS+=-DSYSCONFDIR="\"$(sysconfdir)\"" -DLOCALSTATEDIR="\"$(localstatedir)\"" CFLAGS+=-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_DATETIME_FUNCS -DSQLITE_OMIT_COMPILEOPTION_DIAGS -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_VIRTUALTABLE -DSQLITE_OMIT_AUTHORIZATION CFLAGS+=-fPIC -CFLAGS+=-Wall -Wno-unused-value -Werror +CFLAGS+=-Wall -Werror # Solaris magic CFLAGS+=-DSHA2_USE_INTTYPES_H -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1 # OSX magic to compensate for the Solaris magic diff --git a/fdqueue.h b/fdqueue.h index 36237165..23b8af65 100644 --- a/fdqueue.h +++ b/fdqueue.h @@ -166,7 +166,6 @@ unsigned fd_depth(); #define OUT() fd_func_exit(__HERE__, &_this_call) #define RETURN(X) do { OUT(); return (X); } while (0) -#define RETURNNULL(X) do { X; OUT(); return (NULL); } while (0) #define RETURNVOID do { OUT(); return; } while (0) DECLARE_ALARM(fd_periodicstats); diff --git a/http_server.c b/http_server.c index 38281748..93ba7729 100644 --- a/http_server.c +++ b/http_server.c @@ -375,14 +375,6 @@ static inline int _skip_any(struct http_request *r) return 1; } -static inline int _skip_if(struct http_request *r, int (*predicate)(int)) -{ - if (_run_out(r) || !predicate(*r->cursor)) - return 0; - ++r->cursor; - return 1; -} - static inline int _skip_while(struct http_request *r, int (*predicate)(int)) { while (!_run_out(r) && predicate(*r->cursor)) @@ -600,11 +592,6 @@ static inline int _parse_uint32(struct http_request *r, uint32_t *uint32p) return !_run_out(r) && isdigit(*r->cursor) && str_to_uint32(r->cursor, 10, uint32p, (const char **)&r->cursor); } -static inline int _parse_uint16(struct http_request *r, uint16_t *uint16p) -{ - return !_run_out(r) && isdigit(*r->cursor) && str_to_uint16(r->cursor, 10, uint16p, (const char **)&r->cursor); -} - static unsigned _parse_ranges(struct http_request *r, struct http_range *range, unsigned nrange) { unsigned i = 0; diff --git a/httpd.c b/httpd.c index 84523c17..7882297d 100644 --- a/httpd.c +++ b/httpd.c @@ -236,7 +236,7 @@ void httpd_server_poll(struct sched_ent *alarm) { if (alarm->poll.revents & (POLLIN | POLLOUT)) { struct sockaddr addr; - unsigned int addr_len = sizeof addr; + socklen_t addr_len = sizeof addr; int sock; if ((sock = accept(httpd_server_socket, &addr, &addr_len)) == -1) { if (errno && errno != EAGAIN) diff --git a/keyring.c b/keyring.c index 4e8198d6..64653a29 100644 --- a/keyring.c +++ b/keyring.c @@ -1547,7 +1547,7 @@ struct keypair *keyring_find_sas_private(keyring_file *k, keyring_identity *iden keypair *kp = keyring_identity_keytype(identity, KEYTYPE_CRYPTOSIGN); if (kp==NULL) - RETURNNULL(WHYNULL("Identity lacks SAS")); + RETURN(WHYNULL("Identity lacks SAS")); if (!kp->verified){ if (!rhizome_verify_bundle_privatekey(kp->private_key,kp->public_key)){ @@ -1991,7 +1991,7 @@ unsigned char *keyring_get_nm_bytes(const sid_t *known_sidp, const sid_t *unknow keyring_iterator it; keyring_iterator_start(keyring, &it); if (!keyring_find_sid(&it, known_sidp)) - RETURNNULL(WHYNULL("known key is not in fact known.")); + RETURN(WHYNULL("known key is not in fact known.")); /* work out where to store it */ if (nm_slots_used