summaryrefslogtreecommitdiffstats
path: root/src/H5SMbtree2.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2006-12-01 15:51:42 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2006-12-01 15:51:42 (GMT)
commit772730f4d744a0c8428f9c447b7b6073410a2880 (patch)
treef9fb0a1a5613e3c8705c7ea5e0b991cc2acfb82d /src/H5SMbtree2.c
parent7855afc4b2a1fd4c266f96aa7a8dc21964e3bda3 (diff)
downloadhdf5-772730f4d744a0c8428f9c447b7b6073410a2880.zip
hdf5-772730f4d744a0c8428f9c447b7b6073410a2880.tar.gz
hdf5-772730f4d744a0c8428f9c447b7b6073410a2880.tar.bz2
[svn-r13004] Much improved shared object header message test, along with some bug fixes
to make the test pass. These changes involve changes to the file format of SOHMs, but that's okay because nobody should have been using SOHMs yet anyway. Tested on Windows, kagiso, copper, and heping
Diffstat (limited to 'src/H5SMbtree2.c')
-rwxr-xr-xsrc/H5SMbtree2.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c
index 666ead7..28401d9 100755
--- a/src/H5SMbtree2.c
+++ b/src/H5SMbtree2.c
@@ -89,11 +89,12 @@ 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)
{
- herr_t hash_diff;
+ 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 = (herr_t) (rec1->hash - rec2->hash);
+ hash_diff = rec1->hash;
+ hash_diff -= rec2->hash;
/* If the hash values match, make sure the messages are really the same */
if(0 == hash_diff) {
@@ -122,8 +123,13 @@ H5SM_message_compare(const H5SM_mesg_key_t *rec1, const H5SM_sohm_t *rec2)
ret_value = HDmemcmp(rec1->encoding, buf2, rec1->encoding_size);
}
}
- else
- ret_value = hash_diff;
+ else {
+ /* Compress 64-bit hash_diff to fit in an herr_t */
+ if(hash_diff > 0)
+ ret_value = 1;
+ else
+ ret_value = -1;
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_message_compare */
@@ -319,9 +325,9 @@ H5SM_incr_ref(void *record, void *op_data, hbool_t *changed)
* remove the record from the B-tree even if the refcount
* reaches zero.
*
- * The new refcount is returned through op_data. If this is
- * zero, the calling function should remove this record from
- * the B-tree.
+ * The new message is returned through op_data. If its
+ * reference count is zero, the calling function should
+ * remove this record from the B-tree.
*
* Return: Non-negative on success
* Negative on failure
@@ -345,7 +351,7 @@ H5SM_decr_ref(void *record, void *op_data, hbool_t *changed)
*changed = TRUE;
if(op_data)
- *(hsize_t *)op_data = message->ref_count;
+ *(H5SM_sohm_t *)op_data = *message;
FUNC_LEAVE_NOAPI(SUCCEED)
}