[med-svn] [libsis-jhdf5-java] 03/07: New upstream version 14.12.6
Andreas Tille
tille at debian.org
Mon Nov 14 13:42:06 UTC 2016
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository libsis-jhdf5-java.
commit d272b34ad05a271d69049e12f16702d4e118e2b3
Author: Andreas Tille <tille at debian.org>
Date: Mon Nov 14 14:26:36 2016 +0100
New upstream version 14.12.6
---
source/c/HDFFV-9670-1.8.16.patch | 917 +++++++++++++++++++++
source/c/compile_hdf5_gcc.sh | 9 +-
source/c/compile_hdf5_linux_amd64.sh | 2 +-
source/c/compile_hdf5_linux_arm.sh | 2 +-
source/c/compile_hdf5_linux_i386.sh | 2 +-
source/c/compile_hdf5_macosx_i386.sh | 2 +-
source/c/compile_hdf5_macosx_x86_64.sh | 2 +-
source/c/compile_hdf5_sunstudio_64.sh | 9 +-
source/c/compile_hdf5_sunstudio_sparc32.sh | 9 +-
source/c/compile_hdf5_sunstudio_x86.sh | 9 +-
source/c/compile_linux_amd64.sh | 4 +
source/c/compile_linux_arm.sh | 4 +
source/c/compile_linux_i386.sh | 4 +
source/c/compile_macosx_i386.sh | 4 +
source/c/compile_macosx_x86_64.sh | 4 +
source/c/compile_solaris_64.sh | 3 +
source/c/compile_solaris_sparc32.sh | 4 +
source/c/compile_solaris_x86.sh | 4 +
source/c/compile_windows_i386.mak | 2 +-
source/c/compile_windows_x64.mak | 2 +-
source/c/create_win_zip.sh | 9 +-
source/c/gcc-4+-optimizations-config.patch | 17 +
source/c/gcc-4.678-optimizations-config.patch | 33 -
source/c/jhdf5/h5dImpJHDF5.c | 2 +-
source/c/jhdf5/strcpyJHDF5.c | 2 +-
source/c/version.sh | 3 +-
.../java/ch/systemsx/cisd/hdf5/HDF5BaseReader.java | 11 +
source/java/ch/systemsx/cisd/hdf5/HDF5Reader.java | 3 +
source/java/ch/systemsx/cisd/hdf5/HDF5Writer.java | 3 +
source/java/ch/systemsx/cisd/hdf5/hdf5lib/H5.java | 55 +-
.../systemsx/cisd/hdf5/hdf5lib/HDF5Constants.java | 71 +-
.../cisd/hdf5/io/HDF5DataSetRandomAccessFile.java | 18 +-
.../ch/systemsx/cisd/hdf5/HDF5RoundtripTest.java | 85 ++
.../hdf5/io/HDF5DataSetRandomAccessFileTest.java | 26 +
34 files changed, 1212 insertions(+), 124 deletions(-)
diff --git a/source/c/HDFFV-9670-1.8.16.patch b/source/c/HDFFV-9670-1.8.16.patch
new file mode 100644
index 0000000..1541303
--- /dev/null
+++ b/source/c/HDFFV-9670-1.8.16.patch
@@ -0,0 +1,917 @@
+Index: hdf5_1_8/src/H5B2.c
+===================================================================
+--- hdf5_1_8/src/H5B2.c (revision 29155)
++++ hdf5_1_8/src/H5B2.c (revision 29156)
+@@ -450,8 +450,10 @@
+ * find candidates or avoid further searching.
+ */
+ if(hdr->min_native_rec != NULL) {
+- if((cmp = (hdr->cls->compare)(udata, hdr->min_native_rec)) < 0)
+- HGOTO_DONE(FALSE) /* Less than the least record--not found */
++ if((hdr->cls->compare)(udata, hdr->min_native_rec, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++ if(cmp < 0)
++ HGOTO_DONE(FALSE) /* Less than the least record--not found */
+ else if(cmp == 0) { /* Record is found */
+ if(op && (op)(hdr->min_native_rec, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
+@@ -459,8 +461,10 @@
+ } /* end if */
+ } /* end if */
+ if(hdr->max_native_rec != NULL) {
+- if((cmp = (hdr->cls->compare)(udata, hdr->max_native_rec)) > 0)
+- HGOTO_DONE(FALSE) /* Greater than the greatest record--not found */
++ if((hdr->cls->compare)(udata, hdr->max_native_rec, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++ if(cmp > 0)
++ HGOTO_DONE(FALSE) /* Less than the least record--not found */
+ else if(cmp == 0) { /* Record is found */
+ if(op && (op)(hdr->max_native_rec, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
+@@ -483,7 +487,13 @@
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
+
+ /* Locate node pointer for child */
+- cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
++ if(H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
++ udata, &idx, &cmp) < 0) {
++ /* Unlock current node before failing */
++ H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET);
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++ }
++
+ if(cmp > 0)
+ idx++;
+
+@@ -546,7 +556,12 @@
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
+
+ /* Locate record */
+- cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
++ if(H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native,
++ udata, &idx, &cmp) < 0) {
++ /* unlock current node before failing */
++ H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET);
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++ }
+
+ if(cmp != 0) {
+ /* Unlock leaf node */
+@@ -1074,7 +1089,13 @@
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
+
+ /* Locate node pointer for child */
+- cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
++ if(H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
++ udata, &idx, &cmp) < 0) {
++ /* Unlock current node */
++ H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET);
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++ }
++
+ if(cmp > 0)
+ idx++;
+
+@@ -1146,7 +1167,11 @@
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
+
+ /* Locate record */
+- cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
++ if(H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native,
++ udata, &idx, &cmp) < 0) {
++ H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET);
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++ }
+
+ if(cmp != 0) {
+ /* Unlock leaf node */
+Index: hdf5_1_8/src/H5B2int.c
+===================================================================
+--- hdf5_1_8/src/H5B2int.c (revision 29155)
++++ hdf5_1_8/src/H5B2int.c (revision 29156)
+@@ -132,20 +132,24 @@
+ *
+ *-------------------------------------------------------------------------
+ */
+-int
++herr_t
+ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off,
+- const uint8_t *native, const void *udata, unsigned *idx)
++ const uint8_t *native, const void *udata, unsigned *idx, int *cmp)
+ {
+ unsigned lo = 0, hi; /* Low & high index values */
+ unsigned my_idx = 0; /* Final index value */
+- int cmp = -1; /* Key comparison value */
++ herr_t ret_value = SUCCEED;
+
+- FUNC_ENTER_NOAPI_NOINIT_NOERR
++ FUNC_ENTER_NOAPI_NOINIT
+
++ *cmp = -1;
++
+ hi = nrec;
+- while(lo < hi && cmp) {
++ while(lo < hi && *cmp) {
+ my_idx = (lo + hi) / 2;
+- if((cmp = (type->compare)(udata, native + rec_off[my_idx])) < 0)
++ if((type->compare)(udata, native + rec_off[my_idx], cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++ if(*cmp < 0)
+ hi = my_idx;
+ else
+ lo = my_idx + 1;
+@@ -153,7 +157,8 @@
+
+ *idx = my_idx;
+
+- FUNC_LEAVE_NOAPI(cmp)
++done:
++ FUNC_LEAVE_NOAPI(ret_value)
+ } /* end H5B2_locate_record */
+
+
+@@ -1555,7 +1560,9 @@
+ idx = 0;
+ else {
+ /* Find correct location to insert this record */
+- if((cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx)) == 0)
++ if(H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++ if(cmp == 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
+ if(cmp > 0)
+ idx++;
+@@ -1649,7 +1656,10 @@
+ size_t split_nrec; /* Number of records to split node at */
+
+ /* Locate node pointer for child */
+- if((cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0)
++ if(H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
++ udata, &idx, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++ if(cmp == 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
+ if(cmp > 0)
+ idx++;
+@@ -1704,8 +1714,11 @@
+ } /* end else */
+
+ /* Locate node pointer for child (after split/redistribute) */
+-/* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */
+- if((cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0)
++ /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */
++ if(H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
++ udata, &idx, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++ if(cmp == 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
+ if(cmp > 0)
+ idx++;
+@@ -2116,6 +2129,7 @@
+ haddr_t leaf_addr = HADDR_UNDEF; /* Leaf address on disk */
+ unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
+ unsigned idx; /* Location of record which matches key */
++ int cmp; /* Comparison value of records */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+@@ -2135,7 +2149,9 @@
+ HDassert(leaf->nrec == curr_node_ptr->node_nrec);
+
+ /* Find correct location to remove this record */
+- if(H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx) != 0)
++ if(H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++ if(cmp != 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree")
+
+ /* Check for invalidating the min/max record for the tree */
+@@ -2283,7 +2299,9 @@
+ if(swap_loc)
+ idx = 0;
+ else {
+- cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
++ if(H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
++ udata, &idx, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ if(cmp >= 0)
+ idx++;
+ } /* end else */
+@@ -2345,7 +2363,8 @@
+ idx = 0;
+ else {
+ /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */
+- cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
++ if(H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ if(cmp >= 0)
+ idx++;
+ } /* end else */
+@@ -2833,7 +2852,8 @@
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
+
+ /* Locate node pointer for child */
+- cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
++ if(H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ if(cmp > 0)
+ idx++;
+ else
+@@ -2920,7 +2940,9 @@
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
+
+ /* Locate node pointer for child */
+- cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
++ if(H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
++ udata, &idx, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ if(cmp > 0)
+ idx++;
+
+Index: hdf5_1_8/src/H5HFbtree2.c
+===================================================================
+--- hdf5_1_8/src/H5HFbtree2.c (revision 29155)
++++ hdf5_1_8/src/H5HFbtree2.c (revision 29156)
+@@ -73,7 +73,7 @@
+ static void *H5HF_huge_bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr);
+
+ static herr_t H5HF_huge_bt2_indir_store(void *native, const void *udata);
+-static herr_t H5HF_huge_bt2_indir_compare(const void *rec1, const void *rec2);
++static herr_t H5HF_huge_bt2_indir_compare(const void *rec1, const void *rec2, int *result);
+ static herr_t H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *native,
+ void *ctx);
+ static herr_t H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *native,
+@@ -82,7 +82,7 @@
+ int indent, int fwidth, const void *record, const void *_udata);
+
+ static herr_t H5HF_huge_bt2_filt_indir_store(void *native, const void *udata);
+-static herr_t H5HF_huge_bt2_filt_indir_compare(const void *rec1, const void *rec2);
++static herr_t H5HF_huge_bt2_filt_indir_compare(const void *rec1, const void *rec2, int *result);
+ static herr_t H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *native,
+ void *ctx);
+ static herr_t H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *native,
+@@ -91,7 +91,7 @@
+ int indent, int fwidth, const void *record, const void *_udata);
+
+ static herr_t H5HF_huge_bt2_dir_store(void *native, const void *udata);
+-static herr_t H5HF_huge_bt2_dir_compare(const void *rec1, const void *rec2);
++static herr_t H5HF_huge_bt2_dir_compare(const void *rec1, const void *rec2, int *result);
+ static herr_t H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *native,
+ void *ctx);
+ static herr_t H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *native,
+@@ -100,7 +100,7 @@
+ int indent, int fwidth, const void *record, const void *_udata);
+
+ static herr_t H5HF_huge_bt2_filt_dir_store(void *native, const void *udata);
+-static herr_t H5HF_huge_bt2_filt_dir_compare(const void *rec1, const void *rec2);
++static herr_t H5HF_huge_bt2_filt_dir_compare(const void *rec1, const void *rec2, int *result);
+ static herr_t H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *native,
+ void *ctx);
+ static herr_t H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *native,
+@@ -408,20 +408,14 @@
+ *-------------------------------------------------------------------------
+ */
+ static herr_t
+-H5HF_huge_bt2_indir_compare(const void *_rec1, const void *_rec2)
++H5HF_huge_bt2_indir_compare(const void *_rec1, const void *_rec2, int *result)
+ {
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+-#ifdef QAK
+-{
+-const H5HF_huge_bt2_indir_rec_t *rec1 = (const H5HF_huge_bt2_indir_rec_t *)_rec1;
+-const H5HF_huge_bt2_indir_rec_t *rec2 = (const H5HF_huge_bt2_indir_rec_t *)_rec2;
++ *result = (int)(((const H5HF_huge_bt2_indir_rec_t *)_rec1)->id -
++ ((const H5HF_huge_bt2_indir_rec_t *)_rec2)->id);
+
+-HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_compare", rec1->addr, rec1->len, rec1->id);
+-HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_compare", rec2->addr, rec2->len, rec2->id);
+-}
+-#endif /* QAK */
+- FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_indir_rec_t *)_rec2)->id))
++ FUNC_LEAVE_NOAPI(SUCCEED)
+ } /* H5HF_huge_bt2_indir_compare() */
+
+
+@@ -626,20 +620,14 @@
+ *-------------------------------------------------------------------------
+ */
+ static herr_t
+-H5HF_huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2)
++H5HF_huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2, int *result)
+ {
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+-#ifdef QAK
+-{
+-const H5HF_huge_bt2_filt_indir_rec_t *rec1 = (const H5HF_huge_bt2_filt_indir_rec_t *)_rec1;
+-const H5HF_huge_bt2_filt_indir_rec_t *rec2 = (const H5HF_huge_bt2_filt_indir_rec_t *)_rec2;
++ *result = (int)(((const H5HF_huge_bt2_filt_indir_rec_t *)_rec1)->id -
++ ((const H5HF_huge_bt2_filt_indir_rec_t *)_rec2)->id);
+
+-HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_indir_compare", rec1->addr, rec1->len, rec1->filter_mask, rec1->obj_size, rec1->id);
+-HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_indir_compare", rec2->addr, rec2->len, rec2->filter_mask, rec2->obj_size, rec2->id);
+-}
+-#endif /* QAK */
+- FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_filt_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_filt_indir_rec_t *)_rec2)->id))
++ FUNC_LEAVE_NOAPI(SUCCEED)
+ } /* H5HF_huge_bt2_filt_indir_compare() */
+
+
+@@ -815,11 +803,10 @@
+ *-------------------------------------------------------------------------
+ */
+ static herr_t
+-H5HF_huge_bt2_dir_compare(const void *_rec1, const void *_rec2)
++H5HF_huge_bt2_dir_compare(const void *_rec1, const void *_rec2, int *result)
+ {
+ const H5HF_huge_bt2_dir_rec_t *rec1 = (const H5HF_huge_bt2_dir_rec_t *)_rec1;
+ const H5HF_huge_bt2_dir_rec_t *rec2 = (const H5HF_huge_bt2_dir_rec_t *)_rec2;
+- herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+@@ -828,17 +815,17 @@
+ HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec2->addr, rec2->len);
+ #endif /* QAK */
+ if(rec1->addr < rec2->addr)
+- ret_value = -1;
++ *result = -1;
+ else if(rec1->addr > rec2->addr)
+- ret_value = 1;
++ *result = 1;
+ else if(rec1->len < rec2->len)
+- ret_value = -1;
++ *result = -1;
+ else if(rec1->len > rec2->len)
+- ret_value = 1;
++ *result = 1;
+ else
+- ret_value = 0;
++ *result = 0;
+
+- FUNC_LEAVE_NOAPI(ret_value)
++ FUNC_LEAVE_NOAPI(SUCCEED)
+ } /* H5HF_huge_bt2_dir_compare() */
+
+
+@@ -1040,11 +1027,10 @@
+ *-------------------------------------------------------------------------
+ */
+ static herr_t
+-H5HF_huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2)
++H5HF_huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2, int *result)
+ {
+ const H5HF_huge_bt2_filt_dir_rec_t *rec1 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec1;
+ const H5HF_huge_bt2_filt_dir_rec_t *rec2 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec2;
+- herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+@@ -1053,17 +1039,17 @@
+ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_compare", rec2->addr, rec2->len, rec2->filter_mask, rec2->obj_size);
+ #endif /* QAK */
+ if(rec1->addr < rec2->addr)
+- ret_value = -1;
++ *result = -1;
+ else if(rec1->addr > rec2->addr)
+- ret_value = 1;
++ *result = 1;
+ else if(rec1->len < rec2->len)
+- ret_value = -1;
++ *result = -1;
+ else if(rec1->len > rec2->len)
+- ret_value = 1;
++ *result = 1;
+ else
+- ret_value = 0;
++ *result = 0;
+
+- FUNC_LEAVE_NOAPI(ret_value)
++ FUNC_LEAVE_NOAPI(SUCCEED)
+ } /* H5HF_huge_bt2_filt_dir_compare() */
+
+
+Index: hdf5_1_8/src/H5Abtree2.c
+===================================================================
+--- hdf5_1_8/src/H5Abtree2.c (revision 29155)
++++ hdf5_1_8/src/H5Abtree2.c (revision 29156)
+@@ -80,7 +80,7 @@
+
+ /* v2 B-tree driver callbacks for 'creation order' index */
+ static herr_t H5A_dense_btree2_corder_store(void *native, const void *udata);
+-static herr_t H5A_dense_btree2_corder_compare(const void *rec1, const void *rec2);
++static herr_t H5A_dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result);
+ static herr_t H5A_dense_btree2_corder_encode(uint8_t *raw, const void *native,
+ void *ctx);
+ static herr_t H5A_dense_btree2_corder_decode(const uint8_t *raw, void *native,
+@@ -90,7 +90,7 @@
+
+ /* v2 B-tree driver callbacks for 'name' index */
+ static herr_t H5A_dense_btree2_name_store(void *native, const void *udata);
+-static herr_t H5A_dense_btree2_name_compare(const void *rec1, const void *rec2);
++static herr_t H5A_dense_btree2_name_compare(const void *rec1, const void *rec2, int *result);
+ static herr_t H5A_dense_btree2_name_encode(uint8_t *raw, const void *native,
+ void *ctx);
+ static herr_t H5A_dense_btree2_name_decode(const uint8_t *raw, void *native,
+@@ -249,13 +249,13 @@
+ *-------------------------------------------------------------------------
+ */
+ static herr_t
+-H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
++H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int *result)
+ {
+ const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata;
+ const H5A_dense_bt2_name_rec_t *bt2_rec = (const H5A_dense_bt2_name_rec_t *)_bt2_rec;
+- herr_t ret_value; /* Return value */
++ herr_t ret_value = SUCCEED; /* Return value */
+
+- FUNC_ENTER_NOAPI_NOINIT_NOERR
++ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity check */
+ HDassert(bt2_udata);
+@@ -263,13 +263,12 @@
+
+ /* Check hash value */
+ if(bt2_udata->name_hash < bt2_rec->hash)
+- ret_value = (-1);
++ *result = (-1);
+ else if(bt2_udata->name_hash > bt2_rec->hash)
+- ret_value = 1;
++ *result = 1;
+ else {
+ H5A_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */
+ H5HF_t *fheap; /* Fractal heap handle to use for finding object */
+- herr_t status; /* Status from fractal heap 'op' routine */
+
+ /* Sanity check */
+ HDassert(bt2_udata->name_hash == bt2_rec->hash);
+@@ -294,13 +293,14 @@
+ HDassert(fheap);
+
+ /* Check if the user's attribute and the B-tree's attribute have the same name */
+- status = H5HF_op(fheap, bt2_udata->dxpl_id, &bt2_rec->id, H5A_dense_fh_name_cmp, &fh_udata);
+- HDassert(status >= 0);
++ if(H5HF_op(fheap, bt2_udata->dxpl_id, &bt2_rec->id, H5A_dense_fh_name_cmp, &fh_udata) < 0)
++ HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+
+ /* Callback will set comparison value */
+- ret_value = fh_udata.cmp;
++ *result = fh_udata.cmp;
+ } /* end else */
+
++done:
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5A_dense_btree2_name_compare() */
+
+@@ -441,11 +441,10 @@
+ *-------------------------------------------------------------------------
+ */
+ static herr_t
+-H5A_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec)
++H5A_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result)
+ {
+ const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata;
+ const H5A_dense_bt2_corder_rec_t *bt2_rec = (const H5A_dense_bt2_corder_rec_t *)_bt2_rec;
+- herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+@@ -455,13 +454,13 @@
+
+ /* Check creation order value */
+ if(bt2_udata->corder < bt2_rec->corder)
+- ret_value = -1;
++ *result = -1;
+ else if(bt2_udata->corder > bt2_rec->corder)
+- ret_value = 1;
++ *result = 1;
+ else
+- ret_value = 0;
++ *result = 0;
+
+- FUNC_LEAVE_NOAPI(ret_value)
++ FUNC_LEAVE_NOAPI(SUCCEED)
+ } /* H5A_dense_btree2_corder_compare() */
+
+
+Index: hdf5_1_8/src/H5Gbtree2.c
+===================================================================
+--- hdf5_1_8/src/H5Gbtree2.c (revision 29155)
++++ hdf5_1_8/src/H5Gbtree2.c (revision 29156)
+@@ -78,7 +78,7 @@
+
+ /* v2 B-tree driver callbacks for 'creation order' index */
+ static herr_t H5G_dense_btree2_corder_store(void *native, const void *udata);
+-static herr_t H5G_dense_btree2_corder_compare(const void *rec1, const void *rec2);
++static herr_t H5G_dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result);
+ static herr_t H5G_dense_btree2_corder_encode(uint8_t *raw, const void *native,
+ void *ctx);
+ static herr_t H5G_dense_btree2_corder_decode(const uint8_t *raw, void *native,
+@@ -88,7 +88,7 @@
+
+ /* v2 B-tree driver callbacks for 'name' index */
+ static herr_t H5G_dense_btree2_name_store(void *native, const void *udata);
+-static herr_t H5G_dense_btree2_name_compare(const void *rec1, const void *rec2);
++static herr_t H5G_dense_btree2_name_compare(const void *rec1, const void *rec2, int *result);
+ static herr_t H5G_dense_btree2_name_encode(uint8_t *raw, const void *native,
+ void *ctx);
+ static herr_t H5G_dense_btree2_name_decode(const uint8_t *raw, void *native,
+@@ -234,36 +234,25 @@
+ *-------------------------------------------------------------------------
+ */
+ static herr_t
+-H5G_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
++H5G_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int *result)
+ {
+ const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata;
+ const H5G_dense_bt2_name_rec_t *bt2_rec = (const H5G_dense_bt2_name_rec_t *)_bt2_rec;
+- herr_t ret_value; /* Return value */
++ herr_t ret_value = SUCCEED; /* Return value */
+
+- FUNC_ENTER_NOAPI_NOINIT_NOERR
++ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity check */
+ HDassert(bt2_udata);
+ HDassert(bt2_rec);
+
+-#ifdef QAK
+-{
+-unsigned u;
+-
+-HDfprintf(stderr, "%s: bt2_udata = {'%s', %x}\n", "H5G_dense_btree2_name_compare", bt2_udata->name, (unsigned)bt2_udata->name_hash);
+-HDfprintf(stderr, "%s: bt2_rec = {%x, ", "H5G_dense_btree2_name_compare", (unsigned)bt2_rec->hash);
+-for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
+- HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n"));
+-}
+-#endif /* QAK */
+ /* Check hash value */
+ if(bt2_udata->name_hash < bt2_rec->hash)
+- ret_value = (-1);
++ *result = (-1);
+ else if(bt2_udata->name_hash > bt2_rec->hash)
+- ret_value = 1;
++ *result = 1;
+ else {
+ H5G_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */
+- herr_t status; /* Status from fractal heap 'op' routine */
+
+ /* Sanity check */
+ HDassert(bt2_udata->name_hash == bt2_rec->hash);
+@@ -280,14 +269,15 @@
+ fh_udata.cmp = 0;
+
+ /* Check if the user's link and the B-tree's link have the same name */
+- status = H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, bt2_rec->id,
+- H5G_dense_fh_name_cmp, &fh_udata);
+- HDassert(status >= 0);
++ if(H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, bt2_rec->id,
++ H5G_dense_fh_name_cmp, &fh_udata) < 0)
++ HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+
+ /* Callback will set comparison value */
+- ret_value = fh_udata.cmp;
++ *result = fh_udata.cmp;
+ } /* end else */
+
++done:
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5G_dense_btree2_name_compare() */
+
+@@ -424,11 +414,10 @@
+ *-------------------------------------------------------------------------
+ */
+ static herr_t
+-H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec)
++H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result)
+ {
+ const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata;
+ const H5G_dense_bt2_corder_rec_t *bt2_rec = (const H5G_dense_bt2_corder_rec_t *)_bt2_rec;
+- herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+@@ -448,13 +437,13 @@
+ #endif /* QAK */
+ /* Check creation order value */
+ if(bt2_udata->corder < bt2_rec->corder)
+- ret_value = -1;
++ *result = -1;
+ else if(bt2_udata->corder > bt2_rec->corder)
+- ret_value = 1;
++ *result = 1;
+ else
+- ret_value = 0;
++ *result = 0;
+
+- FUNC_LEAVE_NOAPI(ret_value)
++ FUNC_LEAVE_NOAPI(SUCCEED)
+ } /* H5G_dense_btree2_corder_compare() */
+
+
+Index: hdf5_1_8/src/H5SM.c
+===================================================================
+--- hdf5_1_8/src/H5SM.c (revision 29155)
++++ hdf5_1_8/src/H5SM.c (revision 29156)
+@@ -59,7 +59,8 @@
+ static herr_t H5SM_delete_index(H5F_t *f, H5SM_index_header_t *header,
+ hid_t dxpl_id, hbool_t delete_heap);
+ static haddr_t H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id);
+-static size_t H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *empty_pos);
++static herr_t H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key,
++ size_t *empty_pos, size_t *list_pos);
+ static herr_t H5SM_convert_list_to_btree(H5F_t * f, H5SM_index_header_t * header,
+ H5SM_list_t **_list, H5HF_t *fheap, H5O_t *open_oh, hid_t dxpl_id);
+ static herr_t H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_id);
+@@ -1284,7 +1285,9 @@
+ * Also record the first empty list position we find in case we need it
+ * later.
+ */
+- list_pos = H5SM_find_in_list(list, &key, &empty_pos);
++ if(H5SM_find_in_list(list, &key, &empty_pos, &list_pos) < 0)
++ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
++
+ if(defer) {
+ if(list_pos != UFAIL)
+ found = TRUE;
+@@ -1433,10 +1436,15 @@
+ /* Insert the new message into the SOHM index */
+ if(header->index_type == H5SM_LIST) {
+ /* Index is a list. Find an empty spot if we haven't already */
+- if(empty_pos == UFAIL)
+- if((H5SM_find_in_list(list, NULL, &empty_pos) == UFAIL) || empty_pos == UFAIL)
++ if(empty_pos == UFAIL) {
++ size_t pos;
++
++ if(H5SM_find_in_list(list, NULL, &empty_pos, &pos) < 0)
++ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
++
++ if(pos == UFAIL || empty_pos == UFAIL)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list")
+-
++ }
+ /* Insert message into list */
+ HDassert(list->messages[empty_pos].location == H5SM_NO_LOC);
+ HDassert(key.message.location != H5SM_NO_LOC);
+@@ -1599,13 +1607,13 @@
+ *
+ *-------------------------------------------------------------------------
+ */
+-static size_t
+-H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *empty_pos)
++static herr_t
++H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *empty_pos, size_t *pos)
+ {
+- size_t x;
+- size_t ret_value;
++ size_t x;
++ herr_t ret_value = SUCCEED; /* Return value */
+
+- FUNC_ENTER_NOAPI_NOINIT_NOERR
++ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(list);
+ /* Both key and empty_pos can be NULL, but not both! */
+@@ -1619,9 +1627,17 @@
+ * Also record the first empty position we find.
+ */
+ for(x = 0; x < list->header->list_max; x++) {
+- if((list->messages[x].location != H5SM_NO_LOC) &&
+- (0 == H5SM_message_compare(key, &(list->messages[x]))))
+- HGOTO_DONE(x)
++ if(list->messages[x].location != H5SM_NO_LOC) {
++ int cmp;
++
++ if(H5SM_message_compare(key, &(list->messages[x]), &cmp) < 0)
++ HGOTO_ERROR(H5E_SOHM, H5E_CANTCOMPARE, FAIL, "can't compare message records")
++
++ if(0 == cmp) {
++ *pos = x;
++ HGOTO_DONE(SUCCEED)
++ }
++ }
+ else if(empty_pos && list->messages[x].location == H5SM_NO_LOC) {
+ /* Note position */
+ *empty_pos = x;
+@@ -1632,7 +1648,7 @@
+ } /* end for */
+
+ /* If we reached this point, we didn't find the message */
+- ret_value = UFAIL;
++ *pos = UFAIL;
+
+ done:
+ FUNC_LEAVE_NOAPI(ret_value)
+@@ -1803,7 +1819,9 @@
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
+
+ /* Find the message in the list */
+- if((list_pos = H5SM_find_in_list(list, &key, NULL)) == UFAIL)
++ if(H5SM_find_in_list(list, &key, NULL, &list_pos) < 0)
++ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list")
++ if(list_pos == UFAIL)
+ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
+
+ if(list->messages[list_pos].location == H5SM_IN_HEAP)
+@@ -2176,7 +2194,9 @@
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
+
+ /* Find the message in the list */
+- if((list_pos = H5SM_find_in_list(list, &key, NULL)) == UFAIL)
++ if(H5SM_find_in_list(list, &key, NULL, &list_pos) < 0)
++ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list")
++ if(list_pos == UFAIL)
+ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
+
+ /* Copy the message */
+Index: hdf5_1_8/src/H5SMpkg.h
+===================================================================
+--- hdf5_1_8/src/H5SMpkg.h (revision 29155)
++++ hdf5_1_8/src/H5SMpkg.h (revision 29156)
+@@ -268,7 +268,7 @@
+ H5_DLL ssize_t H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id);
+
+ /* Encode and decode routines, used for B-tree and cache encoding/decoding */
+-H5_DLL herr_t H5SM_message_compare(const void *rec1, const void *rec2);
++H5_DLL herr_t H5SM_message_compare(const void *rec1, const void *rec2, int *result);
+ H5_DLL herr_t H5SM_message_encode(uint8_t *raw, const void *native, void *ctx);
+ H5_DLL herr_t H5SM_message_decode(const uint8_t *raw, void *native, void *ctx);
+
+Index: hdf5_1_8/src/H5B2private.h
+===================================================================
+--- hdf5_1_8/src/H5B2private.h (revision 29155)
++++ hdf5_1_8/src/H5B2private.h (revision 29156)
+@@ -89,7 +89,7 @@
+ void *(*crt_context)(void *udata); /* Create context for other client callbacks */
+ herr_t (*dst_context)(void *ctx); /* Destroy client callback context */
+ herr_t (*store)(void *nrecord, const void *udata); /* Store application record in native record table */
+- herr_t (*compare)(const void *rec1, const void *rec2); /* Compare two native records */
++ herr_t (*compare)(const void *rec1, const void *rec2, int *result); /* Compare two native records */
+ herr_t (*encode)(uint8_t *raw, const void *record, void *ctx); /* Encode record from native form to disk storage form */
+ herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */
+ herr_t (*debug)(FILE *stream, const H5F_t *f, hid_t dxpl_id, /* Print a record for debugging */
+Index: hdf5_1_8/src/H5B2test.c
+===================================================================
+--- hdf5_1_8/src/H5B2test.c (revision 29155)
++++ hdf5_1_8/src/H5B2test.c (revision 29156)
+@@ -64,7 +64,7 @@
+ static void *H5B2_test_crt_context(void *udata);
+ static herr_t H5B2_test_dst_context(void *ctx);
+ static herr_t H5B2_test_store(void *nrecord, const void *udata);
+-static herr_t H5B2_test_compare(const void *rec1, const void *rec2);
++static herr_t H5B2_test_compare(const void *rec1, const void *rec2, int *result);
+ static herr_t H5B2_test_encode(uint8_t *raw, const void *nrecord, void *ctx);
+ static herr_t H5B2_test_decode(const uint8_t *raw, void *nrecord, void *ctx);
+ static herr_t H5B2_test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
+@@ -215,11 +215,13 @@
+ *-------------------------------------------------------------------------
+ */
+ static herr_t
+-H5B2_test_compare(const void *rec1, const void *rec2)
++H5B2_test_compare(const void *rec1, const void *rec2, int *result)
+ {
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+- FUNC_LEAVE_NOAPI((herr_t)(*(const hssize_t *)rec1 - *(const hssize_t *)rec2))
++ *result = (int)(*(const hssize_t *)rec1 - *(const hssize_t *)rec2);
++
++ FUNC_LEAVE_NOAPI(SUCCEED)
+ } /* H5B2_test_compare() */
+
+
+@@ -434,7 +436,10 @@
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
+
+ /* Locate node pointer for child */
+- cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
++ if(H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
++ udata, &idx, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
++
+ if(cmp > 0)
+ idx++;
+
+@@ -474,7 +479,9 @@
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
+
+ /* Locate record */
+- cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
++ if(H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native,
++ udata, &idx, &cmp) < 0)
++ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+
+ /* Unlock current node */
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+Index: hdf5_1_8/src/H5SMmessage.c
+===================================================================
+--- hdf5_1_8/src/H5SMmessage.c (revision 29155)
++++ hdf5_1_8/src/H5SMmessage.c (revision 29156)
+@@ -190,13 +190,13 @@
+ *-------------------------------------------------------------------------
+ */
+ herr_t
+-H5SM_message_compare(const void *rec1, const void *rec2)
++H5SM_message_compare(const void *rec1, const void *rec2, int *result)
+ {
+ const H5SM_mesg_key_t *key = (const H5SM_mesg_key_t *) rec1;
+ const H5SM_sohm_t *mesg = (const H5SM_sohm_t *) rec2;
+- herr_t ret_value = 0;
++ herr_t ret_value = SUCCEED;
+
+- FUNC_ENTER_NOAPI_NOINIT_NOERR
++ FUNC_ENTER_NOAPI_NOINIT
+
+ /* If the key has an fheap ID, we're looking for a message that's
+ * already in the index; if the fheap ID matches, we've found the message
+@@ -205,28 +205,31 @@
+ * message in the index, we've found the message.
+ */
+ if(mesg->location == H5SM_IN_HEAP && key->message.location == H5SM_IN_HEAP) {
+- if(key->message.u.heap_loc.fheap_id.val == mesg->u.heap_loc.fheap_id.val)
+- HGOTO_DONE(0);
++ if(key->message.u.heap_loc.fheap_id.val == mesg->u.heap_loc.fheap_id.val) {
++ *result = 0;
++ HGOTO_DONE(SUCCEED);
++ }
+ } /* end if */
+ else if(mesg->location == H5SM_IN_OH && key->message.location == H5SM_IN_OH) {
+ if(key->message.u.mesg_loc.oh_addr == mesg->u.mesg_loc.oh_addr &&
+- key->message.u.mesg_loc.index == mesg->u.mesg_loc.index &&
+- key->message.msg_type_id == mesg->msg_type_id)
+- HGOTO_DONE(0);
++ key->message.u.mesg_loc.index == mesg->u.mesg_loc.index &&
++ key->message.msg_type_id == mesg->msg_type_id) {
++ *result = 0;
++ HGOTO_DONE(SUCCEED);
++ }
+ } /* end if */
+
+ /* Compare hash values */
+ if(key->message.hash > mesg->hash)
+- ret_value = 1;
++ *result = 1;
+ else if(key->message.hash < mesg->hash)
+- ret_value = -1;
++ *result = -1;
+ /* If the hash values match, make sure the messages are really the same */
+ else {
+ /* Hash values match; compare the encoded message with the one in
+ * the index.
+ */
+ H5SM_compare_udata_t udata;
+- herr_t status;
+
+ HDassert(key->message.hash == mesg->hash);
+ HDassert(key->encoding_size > 0 && key->encoding);
+@@ -239,8 +242,8 @@
+ */
+ if(mesg->location == H5SM_IN_HEAP) {
+ /* Call heap op routine with comparison callback */
+- status = H5HF_op(key->fheap, key->dxpl_id, &(mesg->u.heap_loc.fheap_id), H5SM_compare_cb, &udata);
+- HDassert(status >= 0);
++ if(H5HF_op(key->fheap, key->dxpl_id, &(mesg->u.heap_loc.fheap_id), H5SM_compare_cb, &udata) < 0)
++ HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ } /* end if */
+ else {
+ H5O_loc_t oloc; /* Object owning the message */
+@@ -251,8 +254,8 @@
+ HDassert(mesg->location == H5SM_IN_OH);
+
+ /* Reset the object location */
+- status = H5O_loc_reset(&oloc);
+- HDassert(status >= 0);
++ if(H5O_loc_reset(&oloc) < 0)
++ HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location")
+
+ /* Set up object location */
+ oloc.file = key->file;
+@@ -264,11 +267,11 @@
+ /* Locate the right message and compare with it */
+ op.op_type = H5O_MESG_OP_LIB;
+ op.u.lib_op = H5SM_compare_iter_op;
+- status = H5O_msg_iterate(&oloc, mesg->msg_type_id, &op, &udata, key->dxpl_id);
+- HDassert(status >= 0);
++ if(H5O_msg_iterate(&oloc, mesg->msg_type_id, &op, &udata, key->dxpl_id) < 0)
++ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links")
+ } /* end else */
+
+- ret_value = udata.ret;
++ *result = udata.ret;
+ } /* end if */
+
+ done:
+Index: hdf5_1_8/src/H5B2pkg.h
+===================================================================
+--- hdf5_1_8/src/H5B2pkg.h (revision 29155)
++++ hdf5_1_8/src/H5B2pkg.h (revision 29156)
+@@ -326,7 +326,7 @@
+
+ /* Routines for locating records */
+ H5_DLL int H5B2_locate_record(const H5B2_class_t *type, unsigned nrec,
+- size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx);
++ size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx, int *result);
+ H5_DLL herr_t H5B2_neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
+ unsigned depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
+ H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data);
diff --git a/source/c/compile_hdf5_gcc.sh b/source/c/compile_hdf5_gcc.sh
index c529b79..5bfed6c 100755
--- a/source/c/compile_hdf5_gcc.sh
+++ b/source/c/compile_hdf5_gcc.sh
@@ -6,17 +6,22 @@ PATCHES="$2"
if [ "$PLATFORM" != "i386" -a "$PLATFORM" != "x86" -a "$PLATFORM" != "amd64" -a "$PLATFORM" != "x86_64" -a "$PLATFORM" != "armv6l" ]; then
echo "Syntax: compile_hdf5.sh <platform>"
- echo "where <platform> is one of i386, x86, amd64, or x86_64"
+ echo "where <platform> is one of i386, x86, amd64, x86_64, or armv6l"
exit 1
fi
tar xvf hdf5-$VERSION.tar
+if [ -n "$POSTFIX" ]; then
+ mv hdf5-$VERSION hdf5-$VERSION-$POSTFIX
+ VERSION="$VERSION-$POSTFIX"
+fi
+
cd hdf5-$VERSION
if [ -n "$PATCHES" ]; then
for p in $PATCHES; do
- patch -p0 < ../$p
+ patch -p1 < ../$p
done
fi
diff --git a/source/c/compile_hdf5_linux_amd64.sh b/source/c/compile_hdf5_linux_amd64.sh
index eb3b92d..0527b4d 100755
--- a/source/c/compile_hdf5_linux_amd64.sh
+++ b/source/c/compile_hdf5_linux_amd64.sh
@@ -1,3 +1,3 @@
#! /bin/bash
-CFLAGS='-fPIC -m64' ./compile_hdf5_gcc.sh amd64 "gcc-4.678-optimizations-config.patch"
+CFLAGS='-fPIC -m64' ./compile_hdf5_gcc.sh amd64 "HDFFV-9670-1.8.16.patch gcc-4+-optimizations-config.patch"
diff --git a/source/c/compile_hdf5_linux_arm.sh b/source/c/compile_hdf5_linux_arm.sh
index a812edd..082aa90 100755
--- a/source/c/compile_hdf5_linux_arm.sh
+++ b/source/c/compile_hdf5_linux_arm.sh
@@ -1,3 +1,3 @@
#! /bin/bash
-./compile_hdf5_gcc.sh armv6l
+./compile_hdf5_gcc.sh armv6l "HDFFV-9670-1.8.16.patch"
diff --git a/source/c/compile_hdf5_linux_i386.sh b/source/c/compile_hdf5_linux_i386.sh
index cf8dfff..a4a334b 100755
--- a/source/c/compile_hdf5_linux_i386.sh
+++ b/source/c/compile_hdf5_linux_i386.sh
@@ -1,3 +1,3 @@
#! /bin/bash
-CFLAGS='-m32' ./compile_hdf5_gcc.sh i386 "gcc-4.678-optimizations-config.patch"
+CFLAGS='-m32' ./compile_hdf5_gcc.sh i386 "HDFFV-9670-1.8.16.patch gcc-4+-optimizations-config.patch"
diff --git a/source/c/compile_hdf5_macosx_i386.sh b/source/c/compile_hdf5_macosx_i386.sh
index 4018056..1f618c3 100755
--- a/source/c/compile_hdf5_macosx_i386.sh
+++ b/source/c/compile_hdf5_macosx_i386.sh
@@ -1,3 +1,3 @@
#! /bin/bash
-CFLAGS='-m32 -mmacosx-version-min=10.6' ./compile_hdf5_gcc.sh i386
+CFLAGS='-m32 -mmacosx-version-min=10.6' ./compile_hdf5_gcc.sh i386 "HDFFV-9670-1.8.16.patch"
diff --git a/source/c/compile_hdf5_macosx_x86_64.sh b/source/c/compile_hdf5_macosx_x86_64.sh
index 1543508..f1ae0b8 100755
--- a/source/c/compile_hdf5_macosx_x86_64.sh
+++ b/source/c/compile_hdf5_macosx_x86_64.sh
@@ -1,3 +1,3 @@
#! /bin/bash
-CFLAGS='-m64 -mmacosx-version-min=10.6' ./compile_hdf5_gcc.sh x86_64
+CFLAGS='-m64 -mmacosx-version-min=10.6' ./compile_hdf5_gcc.sh x86_64 "HDFFV-9670-1.8.16.patch"
diff --git a/source/c/compile_hdf5_sunstudio_64.sh b/source/c/compile_hdf5_sunstudio_64.sh
index 8e9c646..116f802 100755
--- a/source/c/compile_hdf5_sunstudio_64.sh
+++ b/source/c/compile_hdf5_sunstudio_64.sh
@@ -5,10 +5,17 @@ export PATH
source version.sh
-tar xf hdf5-$VERSION.tar
+tar xvf hdf5-$VERSION.tar
+
+if [ -n "$POSTFIX" ]; then
+ mv hdf5-$VERSION hdf5-$VERSION-$POSTFIX
+ VERSION="$VERSION-$POSTFIX"
+fi
cd hdf5-$VERSION
+patch -p1 < ../HDFFV-9670-1.8.16.patch
+
CFLAGS='-fast -m64 -KPIC' ./configure --prefix=/opt/hdf5-$VERSION-64 --enable-shared --enable-debug=none --enable-production
make > make.log 2>&1
diff --git a/source/c/compile_hdf5_sunstudio_sparc32.sh b/source/c/compile_hdf5_sunstudio_sparc32.sh
index b3c32ce..12b2962 100755
--- a/source/c/compile_hdf5_sunstudio_sparc32.sh
+++ b/source/c/compile_hdf5_sunstudio_sparc32.sh
@@ -5,10 +5,17 @@ export PATH
source version.sh
-tar xf hdf5-$VERSION.tar
+tar xvf hdf5-$VERSION.tar
+
+if [ -n "$POSTFIX" ]; then
+ mv hdf5-$VERSION hdf5-$VERSION-$POSTFIX
+ VERSION="$VERSION-$POSTFIX"
+fi
cd hdf5-$VERSION
+patch -p1 < ../HDFFV-9670-1.8.16.patch
+
CPPFLAGS='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE' ./configure --prefix=/opt/hdf5-$VERSION-32 --enable-shared --enable-debug=none --enable-production
make > make.log 2>&1
diff --git a/source/c/compile_hdf5_sunstudio_x86.sh b/source/c/compile_hdf5_sunstudio_x86.sh
index d0f2d15..eecdcad 100755
--- a/source/c/compile_hdf5_sunstudio_x86.sh
+++ b/source/c/compile_hdf5_sunstudio_x86.sh
@@ -5,10 +5,17 @@ export PATH
source version.sh
-tar xf hdf5-$VERSION.tar
+tar xvf hdf5-$VERSION.tar
+
+if [ -n "$POSTFIX" ]; then
+ mv hdf5-$VERSION hdf5-$VERSION-$POSTFIX
+ VERSION="$VERSION-$POSTFIX"
+fi
cd hdf5-$VERSION
+patch -p1 < ../HDFFV-9670-1.8.16.patch
+
CPPFLAGS='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE' CFLAGS='-KPIC' ./configure --prefix=/opt/hdf5-$VERSION-32 --enable-shared --enable-debug=none --enable-production
make > make.log 2>&1
diff --git a/source/c/compile_linux_amd64.sh b/source/c/compile_linux_amd64.sh
index 53295ef..315e6c3 100755
--- a/source/c/compile_linux_amd64.sh
+++ b/source/c/compile_linux_amd64.sh
@@ -2,4 +2,8 @@
source version.sh
+if [ -n "$POSTFIX" ]; then
+ VERSION="$VERSION-$POSTFIX"
+fi
+
gcc -shared -O3 -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -mtune=corei7 -fPIC -Wl,--exclude-libs,ALL jhdf5/*.c hdf-java/*.c -I/opt/hdf5-${VERSION}-amd64/include -I/usr/java/jdk1.6.0/include -I/usr/java/jdk1.6.0/include/linux /opt/hdf5-${VERSION}-amd64/lib/libhdf5.a -o libjhdf5.so -lz
diff --git a/source/c/compile_linux_arm.sh b/source/c/compile_linux_arm.sh
index bbbb611..342609d 100755
--- a/source/c/compile_linux_arm.sh
+++ b/source/c/compile_linux_arm.sh
@@ -2,4 +2,8 @@
source version.sh
+if [ -n "$POSTFIX" ]; then
+ VERSION="$VERSION-$POSTFIX"
+fi
+
gcc -shared -O3 -Wl,--exclude-libs,ALL jhdf5/*.c hdf-java/*.c -I/opt/hdf5-${VERSION}-armv6l/include -I/usr/java/jdk1.7.0/include -I/usr/java/jdk1.7.0/include/linux /opt/hdf5-${VERSION}-armv6l/lib/libhdf5.a -o libjhdf5.so -lz
diff --git a/source/c/compile_linux_i386.sh b/source/c/compile_linux_i386.sh
index da706a5..42b7246 100755
--- a/source/c/compile_linux_i386.sh
+++ b/source/c/compile_linux_i386.sh
@@ -2,4 +2,8 @@
source version.sh
+if [ -n "$POSTFIX" ]; then
+ VERSION="$VERSION-$POSTFIX"
+fi
+
gcc -m32 -shared -O3 -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -mtune=corei7 -Wl,--exclude-libs,ALL jhdf5/*.c hdf-java/*.c -I/opt/hdf5-${VERSION}-i386/include -I/usr/java/jdk1.6.0/include -I/usr/java/jdk1.6.0/include/linux /opt/hdf5-${VERSION}-i386/lib/libhdf5.a -o libjhdf5.so -lz
diff --git a/source/c/compile_macosx_i386.sh b/source/c/compile_macosx_i386.sh
index 6e8f031..0531630 100755
--- a/source/c/compile_macosx_i386.sh
+++ b/source/c/compile_macosx_i386.sh
@@ -2,4 +2,8 @@
source version.sh
+if [ -n "$POSTFIX" ]; then
+ VERSION="$VERSION-$POSTFIX"
+fi
+
gcc -m32 -mmacosx-version-min=10.6 -bundle -O3 jhdf5/*.c hdf-java/*.c -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers -I/opt/hdf5-${VERSION}-i386/include /opt/hdf5-${VERSION}-i386/lib/libhdf5.a -lz -o libjhdf5.jnilib
diff --git a/source/c/compile_macosx_x86_64.sh b/source/c/compile_macosx_x86_64.sh
index ad4092a..a3d6b55 100755
--- a/source/c/compile_macosx_x86_64.sh
+++ b/source/c/compile_macosx_x86_64.sh
@@ -2,4 +2,8 @@
source version.sh
+if [ -n "$POSTFIX" ]; then
+ VERSION="$VERSION-$POSTFIX"
+fi
+
gcc -m64 -mmacosx-version-min=10.6 -dynamiclib -O3 jhdf5/*.c hdf-java/*.c -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers -I/opt/hdf5-${VERSION}-x86_64/include /opt/hdf5-${VERSION}-x86_64/lib/libhdf5.a -lz -o libjhdf5.jnilib
diff --git a/source/c/compile_solaris_64.sh b/source/c/compile_solaris_64.sh
index b12e1b0..a8d1dad 100755
--- a/source/c/compile_solaris_64.sh
+++ b/source/c/compile_solaris_64.sh
@@ -2,4 +2,7 @@
source version.sh
+if [ -n "$POSTFIX" ]; then
+ VERSION="$VERSION-$POSTFIX"
+fi
cc -G -KPIC -fast -m64 jhdf5/*.c hdf-java/*.c -I/opt/hdf5-${VERSION}-64/include -I/usr/java/include -I/usr/java/include/solaris /opt/hdf5-${VERSION}-64/lib/libhdf5.a -lz -o libjhdf5.so
diff --git a/source/c/compile_solaris_sparc32.sh b/source/c/compile_solaris_sparc32.sh
index 191b5cd..c88b464 100755
--- a/source/c/compile_solaris_sparc32.sh
+++ b/source/c/compile_solaris_sparc32.sh
@@ -2,4 +2,8 @@
source version.sh
+if [ -n "$POSTFIX" ]; then
+ VERSION="$VERSION-$POSTFIX"
+fi
+
cc -G -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE jhdf5/*.c hdf-java/*.c -I/opt/hdf5-${VERSION}-32/include -I/usr/java/include -I/usr/java/include/solaris /opt/hdf5-${VERSION}-32/lib/libhdf5.a -lz -o libjhdf5.so
diff --git a/source/c/compile_solaris_x86.sh b/source/c/compile_solaris_x86.sh
index 836bacb..41f8e28 100644
--- a/source/c/compile_solaris_x86.sh
+++ b/source/c/compile_solaris_x86.sh
@@ -2,4 +2,8 @@
source version.sh
+if [ -n "$POSTFIX" ]; then
+ VERSION="$VERSION-$POSTFIX"
+fi
+
cc -G -KPIC -fast -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE jhdf5/*.c hdf-java/*.c -I/opt/hdf5-${VERSION}-32/include -I/usr/java/include -I/usr/java/include/solaris /opt/hdf5-${VERSION}-32/lib/libhdf5.a -lz -o libjhdf5.so
diff --git a/source/c/compile_windows_i386.mak b/source/c/compile_windows_i386.mak
index fb631e4..6c4ea7f 100644
--- a/source/c/compile_windows_i386.mak
+++ b/source/c/compile_windows_i386.mak
@@ -18,7 +18,7 @@ HDFPARENTDIR=C:\JHDF5
HDFJAVADIR=$(HDFPARENTDIR)\jhdf5_src\
# The directory where HDF5 has been compiled
-HDFDIR=$(HDFPARENTDIR)\hdf5\hdf5-1.8.14
+HDFDIR=$(HDFPARENTDIR)\hdf5\hdf5-1.8.16-HDFFV-9670
# The directory where HDF library is located
HDFBUILDDIR=$(HDFDIR)\build
diff --git a/source/c/compile_windows_x64.mak b/source/c/compile_windows_x64.mak
index a7f6f20..f9f8d69 100644
--- a/source/c/compile_windows_x64.mak
+++ b/source/c/compile_windows_x64.mak
@@ -18,7 +18,7 @@ HDFPARENTDIR=C:\JHDF5
HDFJAVADIR=$(HDFPARENTDIR)\jhdf5_src\
# The directory where HDF5 has been compiled
-HDFDIR=$(HDFPARENTDIR)\hdf5\hdf5-1.8.14
+HDFDIR=$(HDFPARENTDIR)\hdf5\hdf5-1.8.16-HDFFV-9670
# The directory where HDF library is located
HDFBUILDDIR=$(HDFDIR)\build
diff --git a/source/c/create_win_zip.sh b/source/c/create_win_zip.sh
index 8fa6949..381c4ad 100755
--- a/source/c/create_win_zip.sh
+++ b/source/c/create_win_zip.sh
@@ -4,10 +4,15 @@ source version.sh
rm -f hdf5-$VERSION-win.zip
rm -fR hdf5-$VERSION
-tar xf hdf5-$VERSION.tar
+tar xvf hdf5-$VERSION.tar
+if [ -n "$POSTFIX" ]; then
+ mv hdf5-$VERSION hdf5-$VERSION-$POSTFIX
+ VERSION="$VERSION-$POSTFIX"
+fi
cd hdf5-$VERSION
-patch -s -p0 < ../hdf5_win_compile.diff
+patch -p1 < ../HDFFV-9670-1.8.16.patch
+patch -p0 < ../hdf5_win_compile.diff
find . -name "*.orig" -exec rm {} \;
cp -f config/cmake/UserMacros/Windows_MT.cmake UserMacros.cmake
diff --git a/source/c/gcc-4+-optimizations-config.patch b/source/c/gcc-4+-optimizations-config.patch
new file mode 100644
index 0000000..3cbd390
--- /dev/null
+++ b/source/c/gcc-4+-optimizations-config.patch
@@ -0,0 +1,17 @@
+--- a/config/gnu-flags 2015-10-24 07:14:05.000000000 +0200
++++ b/config/gnu-flags 2016-02-20 21:37:33.000000000 +0100
+@@ -99,10 +99,12 @@
+ # Production
+ case "$cc_vendor-$cc_version" in
+ gcc-[34].*)
+- PROD_CFLAGS="-O3"
++ # Enable some additional optimization settings
++ PROD_CFLAGS="-O3 -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -fuse-linker-plugin -flto -mtune=corei7"
+ ;;
+ gcc-5.*)
+- PROD_CFLAGS="-O3 -fstdarg-opt"
++ # Enable some additional optimization settings
++ PROD_CFLAGS="-O3 -fstdarg-opt -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -fuse-linker-plugin -flto -mtune=corei7"
+ ;;
+ *)
+ PROD_CFLAGS="-O -finline-functions"
diff --git a/source/c/gcc-4.678-optimizations-config.patch b/source/c/gcc-4.678-optimizations-config.patch
deleted file mode 100644
index 4dc1521..0000000
--- a/source/c/gcc-4.678-optimizations-config.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-diff -ruN hdf5-1.8.13.orig/config/gnu-flags hdf5-1.8.13/config/gnu-flags
---- config/gnu-flags 2014-05-06 04:13:21.000000000 +0200
-+++ config/gnu-flags 2014-06-06 15:36:09.318183153 +0200
-@@ -260,6 +260,9 @@
- # (Strictly speaking this isn't really a "warning" flag, so it's added to
- # the debugging flags)
- #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all"
-+
-+ # Enable some additional optimization settings
-+ PROD_CFLAGS="$PROD_CFLAGS -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -fuse-linker-plugin -flto -mtune=corei7"
- ;;
-
- gcc-4.7*)
-@@ -331,6 +334,9 @@
- # (Strictly speaking this isn't really a "warning" flag, so it's added to
- # the debugging flags)
- #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all"
-+
-+ # Enable some additional optimization settings
-+ PROD_CFLAGS="$PROD_CFLAGS -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -fuse-linker-plugin -flto -mtune=corei7"
- ;;
-
- gcc-4.6*)
-@@ -395,6 +401,9 @@
- # (Strictly speaking this isn't really a "warning" flag, so it's added to
- # the debugging flags)
- #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all"
-+
-+ # Enable some additional optimization settings
-+ PROD_CFLAGS="$PROD_CFLAGS -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -fuse-linker-plugin -flto -mtune=corei7"
- ;;
-
- gcc-4.5*)
diff --git a/source/c/jhdf5/h5dImpJHDF5.c b/source/c/jhdf5/h5dImpJHDF5.c
index 7d887dc..ee9de44 100755
--- a/source/c/jhdf5/h5dImpJHDF5.c
+++ b/source/c/jhdf5/h5dImpJHDF5.c
@@ -998,7 +998,7 @@ JNIEXPORT jint JNICALL Java_ch_systemsx_cisd_hdf5_hdf5lib_H5_H5Dread_1string
}
/* Note: we need one additional character at the end of the buffer for the final '\0'. */
- if ( (c_buf = (char *)calloc(n + 1, str_len)) == NULL) {
+ if ( (c_buf = (char *)calloc(1, n*str_len + 1)) == NULL) {
if (cstr) free (cstr); cstr = NULL;
h5outOfMemory(env, "H5Dread_string: memory allocation failed.");
return -1;
diff --git a/source/c/jhdf5/strcpyJHDF5.c b/source/c/jhdf5/strcpyJHDF5.c
index 4cdd464..81e4533 100644
--- a/source/c/jhdf5/strcpyJHDF5.c
+++ b/source/c/jhdf5/strcpyJHDF5.c
@@ -49,7 +49,7 @@ JNIEXPORT jint JNICALL Java_ch_systemsx_cisd_hdf5_hdf5lib_H5_compoundCpyVLStr
}
numberOfBytes = (*env)->GetStringUTFLength(env, str);
- strPCpy = calloc(1, numberOfBytes);
+ strPCpy = calloc(1, numberOfBytes + 1);
numberOfCharacters = (*env)->GetStringLength(env, str);
(*env)->GetStringUTFRegion(env, str, 0, numberOfCharacters, strPCpy);
diff --git a/source/c/version.sh b/source/c/version.sh
index e1dedeb..8237f50 100755
--- a/source/c/version.sh
+++ b/source/c/version.sh
@@ -1 +1,2 @@
-VERSION=1.8.14
+VERSION=1.8.16
+POSTFIX=HDFFV-9670
diff --git a/source/java/ch/systemsx/cisd/hdf5/HDF5BaseReader.java b/source/java/ch/systemsx/cisd/hdf5/HDF5BaseReader.java
index 3799a13..6906577 100644
--- a/source/java/ch/systemsx/cisd/hdf5/HDF5BaseReader.java
+++ b/source/java/ch/systemsx/cisd/hdf5/HDF5BaseReader.java
@@ -112,6 +112,12 @@ class HDF5BaseReader
final String houseKeepingNameSuffix;
final CharacterEncoding encodingForNewDataSets;
+
+ // We keep this reference in order to not have the reader garbage collected and thus
+ // closing the file when specialized readers are still open and need access to this base
+ // reader.
+ @SuppressWarnings("unused")
+ private HDF5Reader myReader;
HDF5BaseReader(File hdf5File, boolean performNumericConversions, boolean autoDereference,
FileFormat fileFormat, boolean overwrite, String preferredHouseKeepingNameSuffix)
@@ -151,6 +157,11 @@ class HDF5BaseReader
typeVariantDataType = openOrCreateTypeVariantDataType();
}
+ void setMyReader(HDF5Reader myReader)
+ {
+ this.myReader = myReader;
+ }
+
void copyObject(String srcPath, int dstFileId, String dstPath)
{
final boolean dstIsDir = dstPath.endsWith("/");
diff --git a/source/java/ch/systemsx/cisd/hdf5/HDF5Reader.java b/source/java/ch/systemsx/cisd/hdf5/HDF5Reader.java
index 6559333..11911e4 100644
--- a/source/java/ch/systemsx/cisd/hdf5/HDF5Reader.java
+++ b/source/java/ch/systemsx/cisd/hdf5/HDF5Reader.java
@@ -102,6 +102,9 @@ class HDF5Reader implements IHDF5Reader
assert baseReader != null;
this.baseReader = baseReader;
+ // Ensure the finalizer of this HDF5Reader doesn't close the file behind the back of the
+ // specialized readers when they are still in operation.
+ baseReader.setMyReader(this);
this.fileHandler = new HDF5FileLevelReadOnlyHandler(baseReader);
this.objectHandler = new HDF5ObjectReadOnlyInfoProviderHandler(baseReader);
this.byteReader = new HDF5ByteReader(baseReader);
diff --git a/source/java/ch/systemsx/cisd/hdf5/HDF5Writer.java b/source/java/ch/systemsx/cisd/hdf5/HDF5Writer.java
index 574e842..ea2a5a9 100644
--- a/source/java/ch/systemsx/cisd/hdf5/HDF5Writer.java
+++ b/source/java/ch/systemsx/cisd/hdf5/HDF5Writer.java
@@ -102,6 +102,9 @@ final class HDF5Writer extends HDF5Reader implements IHDF5Writer
{
super(baseWriter);
this.baseWriter = baseWriter;
+ // Ensure the finalizer of this HDF5Writer doesn't close the file behind the back of the
+ // specialized writers when they are still in operation.
+ baseWriter.setMyReader(this);
this.fileHandler = new HDF5FileLevelReadWriteHandler(baseWriter);
this.objectHandler = new HDF5ObjectReadWriteInfoProviderHandler(baseWriter);
this.byteWriter = new HDF5ByteWriter(baseWriter);
diff --git a/source/java/ch/systemsx/cisd/hdf5/hdf5lib/H5.java b/source/java/ch/systemsx/cisd/hdf5/hdf5lib/H5.java
index f83effd..0d822a6 100644
--- a/source/java/ch/systemsx/cisd/hdf5/hdf5lib/H5.java
+++ b/source/java/ch/systemsx/cisd/hdf5/hdf5lib/H5.java
@@ -36,43 +36,36 @@ class H5
static
{
- if (NativeLibraryUtilities.loadNativeLibrary("jhdf5") == false)
- {
- throw new UnsupportedOperationException("No suitable HDF5 native library found for this platform.");
- }
-
- // Important! Exit quietly
- try
+ synchronized (ncsa.hdf.hdf5lib.H5.class)
{
- synchronized (ncsa.hdf.hdf5lib.H5.class)
+ if (NativeLibraryUtilities.loadNativeLibrary("jhdf5") == false)
+ {
+ throw new UnsupportedOperationException("No suitable HDF5 native library found for this platform.");
+ }
+
+ // Important! Exit quietly
+ try
{
H5dont_atexit();
+ } catch (final HDF5LibraryException e)
+ {
+ System.exit(1);
}
- } catch (final HDF5LibraryException e)
- {
- System.exit(1);
- }
-
- // Important! Disable error output to C stdout
- synchronized (ncsa.hdf.hdf5lib.H5.class)
- {
+
H5error_off();
- }
-
- // Ensure we have the expected version of the library (with at least the expected release
- // number)
- final int[] libversion = new int[3];
- synchronized (ncsa.hdf.hdf5lib.H5.class)
- {
+
+ // Ensure we have the expected version of the library (with at least the expected release
+ // number)
+ final int[] libversion = new int[3];
H5get_libversion(libversion);
- }
- if (libversion[0] != expectedMajnum || libversion[1] != expectedMinnum
- || libversion[2] < expectedRelnum)
- {
- throw new UnsupportedOperationException("The HDF5 native library is outdated! It is version "
- + libversion[0] + "." + libversion[1] + "." + libversion[2]
- + ", but we require " + expectedMajnum + "." + expectedMinnum + ".x with x >= "
- + expectedRelnum + ".");
+ if (libversion[0] != expectedMajnum || libversion[1] != expectedMinnum
+ || libversion[2] < expectedRelnum)
+ {
+ throw new UnsupportedOperationException("The HDF5 native library is outdated! It is version "
+ + libversion[0] + "." + libversion[1] + "." + libversion[2]
+ + ", but we require " + expectedMajnum + "." + expectedMinnum + ".x with x >= "
+ + expectedRelnum + ".");
+ }
}
}
diff --git a/source/java/ch/systemsx/cisd/hdf5/hdf5lib/HDF5Constants.java b/source/java/ch/systemsx/cisd/hdf5/hdf5lib/HDF5Constants.java
index 9a43c6c..5e82792 100755
--- a/source/java/ch/systemsx/cisd/hdf5/hdf5lib/HDF5Constants.java
+++ b/source/java/ch/systemsx/cisd/hdf5/hdf5lib/HDF5Constants.java
@@ -12,9 +12,9 @@
package ch.systemsx.cisd.hdf5.hdf5lib;
/**
- * /** This class contains C constants and enumerated types of HDF5 library. The values of these constants are obtained
- * from the library by calling J2C(int jconstant), where jconstant is any of the private constants which start their
- * name with "JH5" need to be converted.
+ * This class contains C constants and enumerated types of HDF5 library. The values of these
+ * constants are obtained from the library by calling J2C(int jconstant), where jconstant is any of
+ * the private constants which start their name with "JH5" need to be converted.
* <P>
* <B>Do not edit this file!</b> <b>See also:</b> ncsa.hdf.hdf5lib.HDF5Library
* <p>
@@ -412,51 +412,51 @@ public class HDF5Constants
final private static int JH5P_NO_CLASS = 2930;
final private static int JH5P_ROOT = 6000;
-
+
final private static int JH5P_OBJECT_CREATE = 6010;
-
+
final private static int JH5P_DATASET_ACCESS = 6020;
-
+
final private static int JH5P_DATASET_ACCESS_DEFAULT = 6030;
-
+
final private static int JH5P_FILE_MOUNT = 6040;
-
+
final private static int JH5P_FILE_MOUNT_DEFAULT = 6050;
-
+
final private static int JH5P_GROUP_CREATE = 6060;
-
+
final private static int JH5P_GROUP_CREATE_DEFAULT = 6070;
-
+
final private static int JH5P_GROUP_ACCESS = 6080;
-
+
final private static int JH5P_GROUP_ACCESS_DEFAULT = 6090;
-
+
final private static int JH5P_DATATYPE_CREATE = 6100;
-
+
final private static int JH5P_DATATYPE_CREATE_DEFAULT = 6110;
-
+
final private static int JH5P_DATATYPE_ACCESS = 6120;
-
+
final private static int JH5P_DATATYPE_ACCESS_DEFAULT = 6130;
-
+
final private static int JH5P_STRING_CREATE = 6140;
-
+
final private static int JH5P_ATTRIBUTE_CREATE = 6150;
-
+
final private static int JH5P_ATTRIBUTE_CREATE_DEFAULT = 6160;
-
+
final private static int JH5P_OBJECT_COPY = 6170;
-
+
final private static int JH5P_OBJECT_COPY_DEFAULT = 6180;
-
+
final private static int JH5P_LINK_CREATE = 6190;
-
+
final private static int JH5P_LINK_CREATE_DEFAULT = 6200;
-
+
final private static int JH5P_LINK_ACCESS = 6210;
-
+
final private static int JH5P_LINK_ACCESS_DEFAULT = 6220;
-
+
final private static int JH5R_BADTYPE = 2950;
final private static int JH5R_DATASET_REGION = 2960;
@@ -560,7 +560,7 @@ public class HDF5Constants
final private static int JH5T_CSET_ASCII = 3470;
final private static int JH5T_CSET_ERROR = 3480;
-
+
final private static int JH5T_CSET_UTF8 = 3490;
final private static int JH5T_CSET_RESERVED_10 = 3500;
@@ -964,7 +964,7 @@ public class HDF5Constants
final private static int JH5Z_MAX_NFILTERS = 5470;
final private static int JH5Z_NO_EDC = 5480;
-
+
final private static int JH5Z_SO_INT = 5481;
final private static int JH5Z_SO_FLOAT_DSCALE = 5482;
@@ -1364,7 +1364,7 @@ public class HDF5Constants
final public static int H5P_FILE_CREATE_DEFAULT = javaToC(JH5P_FILE_CREATE_DEFAULT);
final public static int H5P_NO_CLASS = javaToC(JH5P_NO_CLASS);
-
+
final public static int H5P_ROOT = javaToC(JH5P_ROOT);
final public static int H5P_OBJECT_CREATE = javaToC(JH5P_OBJECT_CREATE);
@@ -1512,7 +1512,7 @@ public class HDF5Constants
final public static int H5T_CONV_INIT = javaToC(JH5T_CONV_INIT);
final public static int H5T_CSET_ASCII = javaToC(JH5T_CSET_ASCII);
-
+
final public static int H5T_CSET_UTF8 = javaToC(JH5T_CSET_UTF8);
final public static int H5T_CSET_ERROR = javaToC(JH5T_CSET_ERROR);
@@ -1920,11 +1920,11 @@ public class HDF5Constants
final public static int H5Z_NO_EDC = javaToC(JH5Z_NO_EDC);
final public static int H5Z_SO_INT = javaToC(JH5Z_SO_INT);
-
+
final public static int H5Z_SO_FLOAT_DSCALE = javaToC(JH5Z_SO_FLOAT_DSCALE);
-
+
final public static int H5Z_SO_FLOAT_ESCALE = javaToC(JH5Z_SO_FLOAT_ESCALE);
-
+
final public static int H5Z_FILTER_CONFIG_ENCODE_ENABLED =
javaToC(JH5Z_FILTER_CONFIG_ENCODE_ENABLED);
@@ -1933,9 +1933,6 @@ public class HDF5Constants
private static int javaToC(int javaConstant)
{
- synchronized(ncsa.hdf.hdf5lib.H5.class)
- {
- return H5.J2C(javaConstant);
- }
+ return H5.J2C(javaConstant);
}
}
diff --git a/source/java/ch/systemsx/cisd/hdf5/io/HDF5DataSetRandomAccessFile.java b/source/java/ch/systemsx/cisd/hdf5/io/HDF5DataSetRandomAccessFile.java
index 27c361a..55c8299 100644
--- a/source/java/ch/systemsx/cisd/hdf5/io/HDF5DataSetRandomAccessFile.java
+++ b/source/java/ch/systemsx/cisd/hdf5/io/HDF5DataSetRandomAccessFile.java
@@ -246,14 +246,20 @@ public class HDF5DataSetRandomAccessFile implements IRandomAccessFile, Flushable
{
if (realBlockSize < 0)
{
- try
+ if (eof())
{
- this.realBlockSize =
- reader.opaque().readArrayToBlockWithOffset(dataSetPath, block, blockSize,
- blockOffset, 0);
- } catch (HDF5Exception ex)
+ this.realBlockSize = 0;
+ } else
{
- throw new IOExceptionUnchecked(ex);
+ try
+ {
+ this.realBlockSize =
+ reader.opaque().readArrayToBlockWithOffset(dataSetPath, block, blockSize,
+ blockOffset, 0);
+ } catch (HDF5Exception ex)
+ {
+ throw new IOExceptionUnchecked(ex);
+ }
}
}
}
diff --git a/sourceTest/java/ch/systemsx/cisd/hdf5/HDF5RoundtripTest.java b/sourceTest/java/ch/systemsx/cisd/hdf5/HDF5RoundtripTest.java
index e35904b..27cf3de 100644
--- a/sourceTest/java/ch/systemsx/cisd/hdf5/HDF5RoundtripTest.java
+++ b/sourceTest/java/ch/systemsx/cisd/hdf5/HDF5RoundtripTest.java
@@ -151,6 +151,8 @@ public class HDF5RoundtripTest
test.testOverwriteScalar();
test.testOverwriteScalarKeepDataSet();
test.testDataSets();
+ test.testFixedLengthStringArray();
+ test.testVLStringCrash();
test.testDataTypeInfoOptions();
test.testCompactDataset();
test.testCreateEmptyFixedSizeDataSets();
@@ -1154,6 +1156,89 @@ public class HDF5RoundtripTest
}
@Test
+ public void testFixedLengthStringArray()
+ {
+ final File datasetFile = new File(workingDirectory, "stringArray.h5");
+ datasetFile.delete();
+ assertFalse(datasetFile.exists());
+ datasetFile.deleteOnExit();
+ final IHDF5Writer writer = HDF5FactoryProvider.get().open(datasetFile);
+ final String[] s = new String[100];
+ for (int i = 0; i < s.length; ++i)
+ {
+ s[i] = "a";
+ }
+ writer.string().writeArray("ds", s);
+ writer.close();
+
+ final IHDF5Reader reader = HDF5FactoryProvider.get().openForReading(datasetFile);
+ for (int i = 0; i < 100; ++i)
+ {
+ final String[] s2 = reader.string().readArray("ds");
+ assertEquals(100, s2.length);
+ for (int j = 0; j < s2.length; ++j)
+ {
+ assertEquals("a", s2[j]);
+ }
+ }
+ reader.close();
+ }
+
+ private String repeatStr(String s, int count)
+ {
+ StringBuilder b = new StringBuilder();
+ for (int i = 0; i < count; ++i)
+ {
+ b.append(s);
+ }
+ return b.toString();
+ }
+
+ @Test
+ public void testVLStringCrash()
+ {
+ final File datasetFile = new File(workingDirectory, "testVLStrinCrash.h5");
+ datasetFile.delete();
+ assertFalse(datasetFile.exists());
+ datasetFile.deleteOnExit();
+ IHDF5Writer writer = HDF5Factory.open(datasetFile);
+
+ List<String> memberNames = Arrays.asList("StringA", "StringB");
+ List<String> typeValues = Arrays.asList("", "");
+
+ HDF5CompoundMappingHints hints = new HDF5CompoundMappingHints();
+ hints.setUseVariableLengthStrings(true);
+
+ HDF5CompoundType<List<?>> hdf5CompoundType = writer.compound().getInferredType("RowData", memberNames, typeValues, hints);
+
+ HDF5GenericStorageFeatures storageFeatures = (HDF5GenericStorageFeatures) HDF5GenericStorageFeatures.build()
+ .chunkedStorageLayout()
+ .features();
+
+ writer.compound().createArray("SomeReport", hdf5CompoundType, 0L, 1, storageFeatures);
+
+ int index = 0;
+ Random random = new Random(12);
+
+ for(int i = 0; i < 100; ++i) {
+ int sizeA = random.nextInt(100);
+ int sizeB = random.nextInt(100);
+
+ // System.out.println("i = " + i + ". sizeA = " + sizeA + ", sizeB = " + sizeB + ".");
+
+ List<String> rowData = Arrays.asList(repeatStr("a", sizeA), repeatStr("a", sizeB));
+ @SuppressWarnings("unchecked")
+ List<String>[] dataSet = new List[1];
+ dataSet[0] = rowData;
+
+ writer.compound().writeArrayBlock("SomeReport", hdf5CompoundType, dataSet, index);
+ ++index;
+ }
+ writer.close();
+
+ }
+
+ @Test
public void testDataSets()
{
final File datasetFile = new File(workingDirectory, "datasets.h5");
diff --git a/sourceTest/java/ch/systemsx/cisd/hdf5/io/HDF5DataSetRandomAccessFileTest.java b/sourceTest/java/ch/systemsx/cisd/hdf5/io/HDF5DataSetRandomAccessFileTest.java
index 0415bf2..89692f6 100644
--- a/sourceTest/java/ch/systemsx/cisd/hdf5/io/HDF5DataSetRandomAccessFileTest.java
+++ b/sourceTest/java/ch/systemsx/cisd/hdf5/io/HDF5DataSetRandomAccessFileTest.java
@@ -144,6 +144,32 @@ public class HDF5DataSetRandomAccessFileTest
}
@Test
+ public void testReadEmptyDataSetByByte()
+ {
+ final File dataSetFile = new File(workingDirectory, "testReadEmptyDataSetByByte.h5");
+ final String dataSetName = "ds";
+ dataSetFile.delete();
+ assertFalse(dataSetFile.exists());
+ dataSetFile.deleteOnExit();
+
+ final IHDF5Writer writer =
+ HDF5FactoryProvider.get().configure(dataSetFile).keepDataSetsIfTheyExist().writer();
+ writer.opaque().writeArray(dataSetName, "FILE", new byte[0]);
+ writer.close();
+
+ final HDF5DataSetRandomAccessFile raFile =
+ asRandomAccessFileReadOnly(dataSetFile, dataSetName);
+ assertEquals(-1, raFile.read());
+ raFile.close();
+
+ final HDF5DataSetRandomAccessFile raFile2 =
+ asRandomAccessFileReadOnly(dataSetFile, dataSetName);
+ assertEquals(-1, raFile2.read(new byte[10]));
+ assertEquals(-1, raFile2.read());
+ raFile2.close();
+ }
+
+ @Test
public void testReadChunkedByteByByte()
{
final File dataSetFile = new File(workingDirectory, "testReadChunkedByteByByte.h5");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/libsis-jhdf5-java.git
More information about the debian-med-commit
mailing list