From 87db6fed4f3a94216e529999bda52296ed13e7ec Mon Sep 17 00:00:00 2001 From: James Laird Date: Fri, 1 Dec 2006 20:32:31 -0500 Subject: [svn-r13010] Cleaned up warnings in H5SM* files. Cleaned up all warnings on kagiso. Tested on kagiso and copper. --- src/H5SM.c | 8 ++++---- src/H5SMbtree2.c | 34 ++++++++++++++++++---------------- src/H5SMpkg.h | 8 ++++---- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/H5SM.c b/src/H5SM.c index dd5b1d2..52ed9d9 100755 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -106,7 +106,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, hid_t dxpl_id) unsigned index_type_flags[H5SM_MAX_NUM_INDEXES]; unsigned minsizes[H5SM_MAX_NUM_INDEXES]; unsigned type_flags_used; - ssize_t x; + unsigned x; hsize_t table_size; herr_t ret_value=SUCCEED; @@ -553,7 +553,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, unsigned type_id, void *mesg) HGOTO_DONE(FALSE); /* If the message isn't big enough, don't bother sharing it */ - if((mesg_size = H5O_mesg_size(type_id, f, mesg, 0)) <0) + if(0 == (mesg_size = H5O_mesg_size(type_id, f, mesg, 0))) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unable to get OH message size") if(mesg_size < table->indexes[index_num].min_mesg_size) HGOTO_DONE(FALSE); @@ -644,7 +644,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header, key.encoding = encoding_buf; key.encoding_size = buf_size; key.fheap = fheap; - key.mesg_heap_id = -1; /* Message doesn't yet have a heap ID */ + key.mesg_heap_id = 0; /* JAMES: Message doesn't yet have a heap ID */ /* Assume the message is already in the index and try to increment its * reference count. If this fails, the message isn't in the index after @@ -731,7 +731,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header, list_size = H5SM_LIST_SIZE(f, header->list_to_btree); if(H5MF_xfree(f, H5FD_MEM_SOHM, dxpl_id, header->index_addr, list_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "unable to free shared message list") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to free shared message list") header->index_addr = tree_addr; header->index_type = H5SM_BTREE; diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index 28401d9..c495f56 100755 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -87,14 +87,16 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */ *------------------------------------------------------------------------- */ herr_t -H5SM_message_compare(const H5SM_mesg_key_t *rec1, const H5SM_sohm_t *rec2) +H5SM_message_compare(const void *rec1, const void *rec2) { + const H5SM_mesg_key_t *key = (const H5SM_mesg_key_t *) rec1; + const H5SM_sohm_t *mesg = (const H5SM_sohm_t *) rec2; int64_t hash_diff; /* Has to be able to hold two 32-bit values */ herr_t ret_value=0; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_message_compare) - hash_diff = rec1->hash; - hash_diff -= rec2->hash; + hash_diff = key->hash; + hash_diff -= mesg->hash; /* If the hash values match, make sure the messages are really the same */ if(0 == hash_diff) { @@ -102,9 +104,9 @@ H5SM_message_compare(const H5SM_mesg_key_t *rec1, const H5SM_sohm_t *rec2) * or the encoded buffers */ /* JAMES: not a great test. Use a flag instead? */ - if(rec1->encoding_size == 0) + if(key->encoding_size == 0) { - ret_value = (herr_t) (rec1->mesg_heap_id - rec2->fheap_id); + ret_value = (herr_t) (key->mesg_heap_id - mesg->fheap_id); } else { @@ -116,11 +118,11 @@ H5SM_message_compare(const H5SM_mesg_key_t *rec1, const H5SM_sohm_t *rec2) */ HDmemset(buf2, 0, H5O_MESG_MAX_SIZE); - ret = H5HF_read(rec1->fheap, H5AC_dxpl_id, &(rec2->fheap_id), &buf2); + ret = H5HF_read(key->fheap, H5AC_dxpl_id, &(mesg->fheap_id), &buf2); HDassert(ret >= 0); /* JAMES: I think I want to use in-heap callback here. */ - ret_value = HDmemcmp(rec1->encoding, buf2, rec1->encoding_size); + ret_value = HDmemcmp(key->encoding, buf2, key->encoding_size); } } else { @@ -206,9 +208,9 @@ H5SM_message_retrieve(void *udata, const void *native) *------------------------------------------------------------------------- */ herr_t -H5SM_message_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord) +H5SM_message_encode(const H5F_t UNUSED *f, uint8_t *raw, const void *_nrecord) { - H5SM_sohm_t *message = (H5SM_sohm_t *)_nrecord; + const H5SM_sohm_t *message = (const H5SM_sohm_t *)_nrecord; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_message_encode) @@ -236,7 +238,7 @@ H5SM_message_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord) */ /* JAMES: can we combine this with H5SMcache functions? */ herr_t -H5SM_message_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord) +H5SM_message_decode(const H5F_t UNUSED *f, const uint8_t *raw, void *_nrecord) { H5SM_sohm_t *message = (H5SM_sohm_t *)_nrecord; @@ -266,8 +268,8 @@ H5SM_message_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord) *------------------------------------------------------------------------- */ static herr_t -H5SM_message_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, - int indent, int fwidth, const void *record, const void *_udata) +H5SM_message_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, + int indent, int fwidth, const void *record, const void UNUSED *_udata) { const H5SM_sohm_t *sohm = (const H5SM_sohm_t *)record; @@ -375,10 +377,10 @@ H5SM_decr_ref(void *record, void *op_data, hbool_t *changed) *------------------------------------------------------------------------- */ herr_t -H5SM_convert_to_list_op(void * record, void *op_data) +H5SM_convert_to_list_op(const void * record, void *op_data) { - H5SM_sohm_t *message = (H5SM_sohm_t *) record; - H5SM_list_t *list = (H5SM_list_t *) op_data; + const H5SM_sohm_t *message = (const H5SM_sohm_t *) record; + const H5SM_list_t *list = (const H5SM_list_t *) op_data; hsize_t x; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_convert_to_list_op) @@ -399,4 +401,4 @@ H5SM_convert_to_list_op(void * record, void *op_data) ++list->header->num_messages; FUNC_LEAVE_NOAPI(SUCCEED) -} \ No newline at end of file +} diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h index c62e748..0aea386 100755 --- a/src/H5SMpkg.h +++ b/src/H5SMpkg.h @@ -110,7 +110,7 @@ typedef enum { typedef struct { uint32_t hash; /* The hash value for this message */ const void *encoding; /* The message encoded */ - hsize_t encoding_size; /* Size of the encoding */ + size_t encoding_size; /* Size of the encoding */ H5HF_t *fheap; /* The heap for this message type, open. */ H5SM_fheap_id_t mesg_heap_id; /* The heap_id for this message */ } H5SM_mesg_key_t; @@ -173,14 +173,14 @@ H5_DLL herr_t H5SM_message_decode(const H5F_t *f, const uint8_t *raw, /* H5SM_message_compare is in H5SMbtree2.c, but is also used by list code * in H5SM.c. */ -H5_DLL herr_t H5SM_message_compare(const H5SM_mesg_key_t *rec1, - const H5SM_sohm_t *rec2); +H5_DLL herr_t H5SM_message_compare(const void *rec1, + const void *rec2); /* H5B2_modify_t callbacks to adjust record's refcount. */ H5_DLL herr_t H5SM_incr_ref(void *record, void *op_data, hbool_t *changed); H5_DLL herr_t H5SM_decr_ref(void *record, void *op_data, hbool_t *changed); /* H5B2_remove_t callback to add messages to a list index */ -H5_DLL herr_t H5SM_convert_to_list_op(void * record, void *op_data); +H5_DLL herr_t H5SM_convert_to_list_op(const void * record, void *op_data); #endif /*_H5SMpkg_H*/ -- cgit v0.12