Clean up compilation warnings

This commit is contained in:
Jeremy Lakeman 2015-10-19 13:01:44 +10:30
parent 3049252c8a
commit 0c275e67ef
8 changed files with 26 additions and 39 deletions

View File

@ -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=\"\" \

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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<NM_CACHE_SLOTS) {

View File

@ -1095,25 +1095,6 @@ static const struct config_network_interface *find_interface_config(const char *
return NULL;
}
static int interface_unregister(const char *name,
struct socket_address *addr
)
{
// Find the matching non-dummy interface rule.
const struct config_network_interface *ifconfig = find_interface_config(name, SOCK_DGRAM);
if (!ifconfig)
return 0;
if (addr->addr.sa_family==AF_INET)
addr->inet.sin_port = htons(ifconfig->port);
struct overlay_interface *interface = overlay_interface_find_name_addr(name, addr);
if (interface)
overlay_interface_close(interface);
return 0;
}
/* Register the real interface, or update the existing interface registration. */
int
overlay_interface_register(const char *name,
@ -1154,6 +1135,25 @@ overlay_interface_register(const char *name,
#ifdef HAVE_LINUX_NETLINK_H
static int interface_unregister(const char *name,
struct socket_address *addr
)
{
// Find the matching non-dummy interface rule.
const struct config_network_interface *ifconfig = find_interface_config(name, SOCK_DGRAM);
if (!ifconfig)
return 0;
if (addr->addr.sa_family==AF_INET)
addr->inet.sin_port = htons(ifconfig->port);
struct overlay_interface *interface = overlay_interface_find_name_addr(name, addr);
if (interface)
overlay_interface_close(interface);
return 0;
}
DEFINE_ALARM(netlink_poll);
void netlink_poll(struct sched_ent *alarm)
{

View File

@ -117,7 +117,8 @@ static int app_rhizome_add_file(const struct cli_parsed *parsed, struct cli_cont
if (cli_arg(parsed, "author_sid", &authorSidHex, cli_optional_sid, "") == -1)
return -1;
cli_arg(parsed, "manifestpath", &manifestpath, NULL, "");
cli_arg(parsed, "--bundle", &bundleIdHex, cli_bid, "") == 0 || cli_arg(parsed, "bundleid", &bundleIdHex, cli_optional_bid, "");
if (cli_arg(parsed, "--bundle", &bundleIdHex, cli_bid, "") != 0)
cli_arg(parsed, "bundleid", &bundleIdHex, cli_optional_bid, "");
if (cli_arg(parsed, "bsk", &bsktext, cli_optional_bundle_secret_key, NULL) == -1)
return -1;