Fix some compiler warnings

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
This commit is contained in:
Angus Salkeld 2011-07-13 16:12:47 +10:00
parent af29d5bde3
commit a716f13bf9
9 changed files with 52 additions and 47 deletions

View 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

View 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
*/

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

View 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;
}
/*

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

View File

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

View File

@ -1809,3 +1809,6 @@ error_exit:
return (error);
}
/**
* @}
*/

View File

@ -43,8 +43,10 @@
#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);

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