]> git.proxmox.com Git - mirror_corosync.git/commitdiff
Fix some compiler warnings
authorAngus Salkeld <asalkeld@redhat.com>
Wed, 13 Jul 2011 06:12:47 +0000 (16:12 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Tue, 9 Aug 2011 00:37:16 +0000 (10:37 +1000)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
configure.ac
cts/agents/common_test_agent.c
exec/crypto.c
exec/main.c
exec/objdb.c
lib/cfg.c
lib/confdb.c
services/confdb.c
services/cpg.c

index 033d2513cdf54fa2de23546f3ef522d3f5f6a166..d5aa87e932b1d5fa52b5bef6f712dd839ed3f504 100644 (file)
@@ -173,9 +173,9 @@ LIB_MSG_RESULT(m4_shift(m4_shift($@)))dnl
 
 ## helper for CC stuff
 cc_supports_flag() {
-       local CFLAGS="$@"
+       local CPPFLAGS="$CPPFLAGS $@"
        AC_MSG_CHECKING([whether $CC supports "$@"])
-       AC_COMPILE_IFELSE([int main(){return 0;}] ,
+       AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
                          [RC=0; AC_MSG_RESULT([yes])],
                          [RC=1; AC_MSG_RESULT([no])])
        return $RC
index 03bd677ffb93783c42166e80b89c8b0bf67579b0..f268aca6857a53e2c7d2ba574e1e820b6765d6f7 100644 (file)
@@ -206,7 +206,7 @@ static int create_server_sockect (int server_port)
        struct addrinfo hints, *ai, *p;
        char server_port_str[16];
        char addr_str[INET_ADDRSTRLEN];
-       void *ptr;
+       void *ptr = NULL;
 
        /* get a socket and bind it
         */
index 901797a19168ec6ae71107bcbf063347de8bb374..14fb8074f5244fa236b1366dcfb764bfafbe8d17 100644 (file)
@@ -1140,12 +1140,10 @@ int sha1_done(hash_state * md, unsigned char *hash)
 int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned long keylen)
 {
     unsigned char buf[128];
-    unsigned long hashsize;
     unsigned long i;
     int err;
 
     hmac->hash = hash;
-    hashsize   = hash_descriptor[hash]->hashsize;
 
     /* valid key length? */
        assert (keylen > 0);
index 62ca494f0806cbd12bab2ab0c33ddeb66e3ab81e..bcc0da35976251558e08d51003e5f4ca07f12728 100644 (file)
@@ -833,16 +833,13 @@ static void deliver_fn (
        int32_t service;
        int32_t fn_id;
        uint32_t id;
-       uint32_t size;
        uint32_t key_incr_dummy;
 
        header = msg;
        if (endian_conversion_required) {
                id = swab32 (header->id);
-               size = swab32 (header->size);
        } else {
                id = header->id;
-               size = header->size;
        }
 
        /*
index 99e20ec7a57ee8778cb33358c6543cdf50e95907..999db61f6960b0b98fedb46d747f19c85d0f1288 100644 (file)
@@ -112,7 +112,7 @@ static int objdb_init (void)
 {
        hdb_handle_t handle;
        struct object_instance *instance;
-       unsigned int res;
+       int res;
 
        res = hdb_handle_create (&object_instance_database,
                sizeof (struct object_instance), &handle);
@@ -192,11 +192,12 @@ static void object_created_notification(
        struct object_instance * obj_pt;
        struct object_tracker * tracker_pt;
        hdb_handle_t obj_handle = object_handle;
-       unsigned int res;
 
        do {
-               res = hdb_handle_get (&object_instance_database,
-                       obj_handle, (void *)&obj_pt);
+               if (hdb_handle_get (&object_instance_database,
+                       obj_handle, (void *)&obj_pt) != 0) {
+                       return;
+               }
 
                for (list = obj_pt->track_head.next;
                        list != &obj_pt->track_head; list = list->next) {
@@ -226,11 +227,12 @@ static void object_pre_deletion_notification(hdb_handle_t object_handle,
        struct object_instance * obj_pt;
        struct object_tracker * tracker_pt;
        hdb_handle_t obj_handle = object_handle;
-       unsigned int res;
 
        do {
-               res = hdb_handle_get (&object_instance_database,
-                       obj_handle, (void *)&obj_pt);
+               if (hdb_handle_get (&object_instance_database,
+                       obj_handle, (void *)&obj_pt) != 0) {
+                       return;
+               }
 
                for (list = obj_pt->track_head.next;
                        list != &obj_pt->track_head; list = list->next) {
@@ -265,11 +267,12 @@ static void object_key_changed_notification(hdb_handle_t object_handle,
        struct object_instance * owner_pt = NULL;
        struct object_tracker * tracker_pt;
        hdb_handle_t obj_handle = object_handle;
-       unsigned int res;
 
        do {
-               res = hdb_handle_get (&object_instance_database,
-                       obj_handle, (void *)&obj_pt);
+               if (hdb_handle_get (&object_instance_database,
+                       obj_handle, (void *)&obj_pt) != 0) {
+                       return;
+               }
 
                if (owner_pt == NULL)
                        owner_pt = obj_pt;
@@ -302,10 +305,11 @@ static void object_reload_notification(int startstop, int flush)
        struct object_instance * obj_pt;
        struct object_tracker * tracker_pt;
        struct object_tracker * tmptracker_pt;
-       unsigned int res;
 
-       res = hdb_handle_get (&object_instance_database,
-               OBJECT_PARENT_HANDLE, (void *)&obj_pt);
+       if (hdb_handle_get (&object_instance_database,
+               OBJECT_PARENT_HANDLE, (void *)&obj_pt) != 0) {
+               return;
+       }
 
        /*
         * Make a copy of the list
@@ -350,7 +354,7 @@ static int object_create (
 {
        struct object_instance *object_instance;
        struct object_instance *parent_instance;
-       unsigned int res;
+       int res;
        int found = 0;
        int i;
 
@@ -473,7 +477,7 @@ static int object_key_create_typed(
 {
        struct object_instance *instance;
        struct object_key *object_key;
-       unsigned int res;
+       int res;
        struct list_head *list;
        int found = 0;
        int i;
@@ -698,7 +702,7 @@ static int object_destroy (
        hdb_handle_t object_handle)
 {
        struct object_instance *instance;
-       unsigned int res;
+       int res;
 
        res = hdb_handle_get (&object_instance_database,
                object_handle, (void *)&instance);
@@ -728,7 +732,7 @@ static int object_valid_set (
        size_t object_valid_list_entries)
 {
        struct object_instance *instance;
-       unsigned int res;
+       int res;
 
        res = hdb_handle_get (&object_instance_database,
                object_handle, (void *)&instance);
@@ -753,7 +757,7 @@ static int object_key_valid_set (
        size_t object_key_valid_list_entries)
 {
        struct object_instance *instance;
-       unsigned int res;
+       int res;
 
        res = hdb_handle_get (&object_instance_database,
                object_handle, (void *)&instance);
@@ -781,7 +785,7 @@ static int object_find_create (
        size_t object_len,
        hdb_handle_t *object_find_handle)
 {
-       unsigned int res;
+       int res;
        struct object_instance *iter_obj_inst;
        struct object_instance *object_instance;
        struct object_find_instance *object_find_instance;
@@ -873,10 +877,10 @@ static int object_find_next (
        hdb_handle_t object_find_handle,
        hdb_handle_t *object_handle)
 {
-       unsigned int res;
+       int res;
        struct object_find_instance *object_find_instance;
        struct object_instance *object_instance = NULL;
-       unsigned int found = 0;
+       int found = 0;
         size_t pos;
 
        res = hdb_handle_get (&object_find_instance_database,
@@ -915,6 +919,8 @@ static int object_find_next (
        if (found) {
                *object_handle = object_instance->object_handle;
                res = 0;
+       } else {
+               res = -1;
        }
        return (res);
 
@@ -926,7 +932,7 @@ static int object_find_destroy (
        hdb_handle_t object_find_handle)
 {
        struct object_find_instance *object_find_instance;
-       unsigned int res;
+       int res;
 
        res = hdb_handle_get (&object_find_instance_database,
                object_find_handle, (void *)&object_find_instance);
@@ -952,7 +958,7 @@ static int object_key_get_typed (
        size_t *value_len,
        objdb_value_types_t * type)
 {
-       unsigned int res = 0;
+       int res = 0;
        struct object_instance *instance;
        struct object_key *object_key = NULL;
        struct list_head *list;
@@ -1027,7 +1033,7 @@ static int object_key_increment (
        size_t key_len,
        unsigned int *value)
 {
-       unsigned int res = 0;
+       int res = 0;
        struct object_instance *instance;
        struct object_key *object_key = NULL;
        struct list_head *list;
@@ -1110,7 +1116,7 @@ static int object_key_decrement (
        size_t key_len,
        unsigned int *value)
 {
-       unsigned int res = 0;
+       int res = 0;
        struct object_instance *instance;
        struct object_key *object_key = NULL;
        struct list_head *list;
@@ -1193,7 +1199,7 @@ static int object_key_delete (
        const void *key_name,
        size_t key_len)
 {
-       unsigned int res;
+       int res;
        int ret = 0;
        struct object_instance *instance;
        struct object_key *object_key = NULL;
@@ -1245,7 +1251,7 @@ static int object_key_replace (
        const void *new_value,
        size_t new_value_len)
 {
-       unsigned int res;
+       int res;
        int ret = 0;
        struct object_instance *instance;
        struct object_key *object_key = NULL;
@@ -1452,7 +1458,7 @@ static int _dump_object(struct object_instance *instance, FILE *file, int depth)
 
 static int object_key_iter_reset(hdb_handle_t object_handle)
 {
-       unsigned int res;
+       int res;
        struct object_instance *instance;
 
        res = hdb_handle_get (&object_instance_database,
@@ -1475,7 +1481,7 @@ static int object_key_iter_typed (hdb_handle_t parent_object_handle,
        size_t *value_len,
        objdb_value_types_t *type)
 {
-       unsigned int res;
+       int res;
        struct object_instance *instance;
        struct object_key *find_key = NULL;
        struct list_head *list;
@@ -1538,7 +1544,7 @@ static int object_key_iter_from(hdb_handle_t parent_object_handle,
        size_t *value_len)
 {
        unsigned int pos = 0;
-       unsigned int res;
+       int res;
        struct object_instance *instance;
        struct object_key *find_key = NULL;
        struct list_head *list;
@@ -1587,7 +1593,7 @@ static int object_parent_get(hdb_handle_t object_handle,
        hdb_handle_t *parent_handle)
 {
        struct object_instance *instance;
-       unsigned int res;
+       int res;
 
        res = hdb_handle_get (&object_instance_database,
                object_handle, (void *)&instance);
@@ -1610,7 +1616,7 @@ static int object_name_get(hdb_handle_t object_handle,
        size_t *object_name_len)
 {
        struct object_instance *instance;
-       unsigned int res;
+       int res;
 
        res = hdb_handle_get (&object_instance_database,
                object_handle, (void *)&instance);
@@ -1636,7 +1642,7 @@ static int object_track_start(hdb_handle_t object_handle,
        void * priv_data_pt)
 {
        struct object_instance *instance;
-       unsigned int res;
+       int res;
        struct object_tracker * tracker_pt;
 
        res = hdb_handle_get (&object_instance_database,
@@ -1676,7 +1682,7 @@ static void object_track_stop(object_key_change_notify_fn_t key_change_notify_fn
        struct object_tracker * obj_tracker_pt = NULL;
        struct list_head *list, *tmp_list;
        struct list_head *obj_list, *tmp_obj_list;
-       unsigned int res;
+       int res;
 
        /* go through the global list and find all the trackers to stop */
        for (list = objdb_trackers_head.next, tmp_list = list->next;
@@ -1718,7 +1724,7 @@ static int object_dump(hdb_handle_t object_handle,
        FILE *file)
 {
        struct object_instance *instance;
-       unsigned int res;
+       int res;
 
        res = hdb_handle_get (&object_instance_database,
                object_handle, (void *)&instance);
index 3a662d45e795ab421c25ed1f4f1b9430f7f29aa9..5cd35c3f838150484dfea9cdfbf837ea838cfd9f 100644 (file)
--- a/lib/cfg.c
+++ b/lib/cfg.c
@@ -648,7 +648,6 @@ cs_error_t corosync_cfg_get_node_addrs (
        int addrlen = 0;
        int i;
        struct iovec iov;
-       void *return_address;
        const char *addr_buf;
        char response_buf[IPC_RESPONSE_SIZE];
 
index 51a8c34057e5a3372f9f58be6f54e16e08f7cb5c..831b5cc94693e0af2def4357672007b92d243034 100644 (file)
@@ -1809,3 +1809,6 @@ error_exit:
        return (error);
 }
 
+/**
+ * @}
+ */
index f70f2efdedb3497b2641d332734f0a6b157e26d5..65a48abb26bc9ee66f013a8990f9758202986246 100644 (file)
 #include <poll.h>
 #include <assert.h>
 
-#include <corosync/corotypes.h>
+#include <qb/qbloop.h>
 #include <qb/qbipc_common.h>
+
+#include <corosync/corotypes.h>
 #include <corosync/corodefs.h>
 #include <corosync/cfg.h>
 #include <corosync/list.h>
@@ -89,6 +91,8 @@ static int fd_set_nonblocking(int fd);
 
 static int objdb_notify_dispatch(int fd, int revents, void *data);
 
+
+
 static int confdb_lib_init_fn (void *conn);
 static int confdb_lib_exit_fn (void *conn);
 
index e7573c5ba8e7a1bc2224f2afb206d129aca269a8..633d4b376fa589767f62134c81e306231ed230b1 100644 (file)
@@ -1721,11 +1721,9 @@ static void message_handler_req_lib_cpg_zc_execute (
        struct req_lib_cpg_mcast *req_lib_cpg_mcast;
        int result;
        cs_error_t error = CS_ERR_NOT_EXIST;
-       struct coroipcs_zc_header *zc_hdr;
 
        log_printf(LOGSYS_LEVEL_DEBUG, "got ZC mcast request on %p\n", conn);
 
-       zc_hdr = (struct coroipcs_zc_header *)((char *)serveraddr2void(hdr->server_address));
        header = (struct qb_ipc_request_header *)(((char *)serveraddr2void(hdr->server_address) + sizeof (struct coroipcs_zc_header)));
        req_lib_cpg_mcast = (struct req_lib_cpg_mcast *)header;