Commit 20212c5f authored by brinn's avatar brinn
Browse files

Migrate JHDF5 to HDF5 1.10.

A big 'thank you' goes to Gerd Heber from the HDF Group for doing a lot of the porting work to 1.10.
parent eb715b2c
......@@ -5,3 +5,4 @@
/.project
/.settings
/test-output
/source/c/build
......@@ -46,7 +46,6 @@ task nativeJarLinuxIntel(type: Jar) {
archiveName 'hdf5-linux-intel.jar'
from ("libs") {
include 'native/jhdf5/amd64-Linux/**/*'
include 'native/jhdf5/i386-Linux/**/*'
include 'native/jhdf5/arm-Linux/**/*'
}
......@@ -58,7 +57,6 @@ task nativeJarLinuxIntel(type: Jar) {
task nativeJarMacIntel(type: Jar) {
archiveName 'hdf5-macosx-intel.jar'
from ("libs") {
include 'native/jhdf5/i386-Mac OS X/**/*'
include 'native/jhdf5/x86_64-Mac OS X/**/*'
}
......@@ -71,7 +69,6 @@ task nativeJarWindowsIntel(type: Jar) {
archiveName 'hdf5-windows-intel.jar'
from ("libs") {
include 'native/jhdf5/amd64-Windows/**/*'
include 'native/jhdf5/x86-Windows/**/*'
}
from('targets/dist') {
......@@ -150,8 +147,10 @@ task myJavadoc(type: Javadoc) {
options.memberLevel = JavadocMemberLevel.PUBLIC
options.overview = "overview.html"
include "ch/systemsx/cisd/hdf5/**"
include "ncsa/hdf/hdf5lib/exceptions/**"
include "ch/ethz/sis/hdf5/**"
include "hdf/hdf5lib/exceptions/**"
exclude "ch/systemsx/cisd/hdf5/hdf5lib/**"
exclude "ch/ethz/sis/hdf5/hdf5lib/**"
exclude "ch/systemsx/cisd/hdf5/cleanup/**"
exclude "ch/systemsx/cisd/hdf5/BitSetConversionUtils.java"
exclude "ch/systemsx/cisd/hdf5/MatrixUtils.java"
......@@ -202,7 +201,7 @@ task distributionZip(type: Zip, dependsOn: [jar, toolsJar, allJar, nativeJarLinu
}
from (zipTree(batteriesIncluded.archivePath)) {
into "${project.group}-jhdf5/lib/native"
into "${project.group}-jhdf5/lib"
include 'native/**'
}
......
......@@ -226,7 +226,7 @@ test {
systemProperty "ant.project.name", project.name
maxHeapSize = "6144m"
jvmArgs '-XX:MaxPermSize=1024m', '-Duser.timezone=Europe/Zurich'
jvmArgs '-Duser.timezone=Europe/Zurich'
testLogging.showStandardStreams = true
ignoreFailures = true
......
Copyright Notice and Statement for NCSA Hierarchical Data Format (HDF)
Java Software Library and Utilities
NCSA Hierarchical Data Format (HDF) Software Library and Utilities
Copyright 1988-2004, the Board of Trustees of the University of Illinois.
Copyright 2007-2009, Center for Information Sciences and Databases, ETH Zurich, Switzerland.
All rights reserved.
Contributors to the library: National Center for Supercomputing
Applications (NCSA) at the University of Illinois, Lawrence
Livermore Nationall Laboratory (LLNL), Sandia National Laboratories (SNL),
Los Alamos National Laboratory (LANL). Fortner Software, Unidata
Program Center (netCDF), The Independent JPEG Group (JPEG),
Jean-loup Gailly and Mark Adler (gzip), and Digital Equipment
Corporation (DEC). Macintosh support contributed by Gregory L. Guerin.
The package 'glguerin':
Copyright 1998, 1999 by Gregory L. Guerin.
Redistribute or reuse only as described below.
These files are from the MacBinary Toolkit for Java:
<http://www.amug.org/~glguerin/sw/#macbinary>
and are redistributed by NCSA with permission of the author.
This work was supported in part by a Cooperative Agreement with
NASA under NASA grant NAG 5-2040 and NAG NCC5-599.
Redistribution and use in source and binary forms, with or without
modification, are permitted for any purpose (including commercial purposes)
provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or materials provided with the distribution.
3. In addition, redistributions of modified forms of the source or binary
code must carry prominent notices stating that the original code was
changed and the date of the change.
4. All publications or advertising materials mentioning features or use of
this software must acknowledge that it was developed by the National
Center for Supercomputing Applications at the University of Illinois, and
credit the Contributors.
5. Neither the name of the University nor the names of the Contributors may
be used to endorse or promote products derived from this software without
specific prior written permission from the University or the Contributors.
6. THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND THE CONTRIBUTORS "AS IS"
WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. In no event
shall the University or the Contributors be liable for any damages
suffered by the users arising out of the use of this software, even if
advised of the possibility of such damage.
--------------------------------------------------------------------------
Portions of HDF5 were developed with support from the University of
California, Lawrence Livermore National Laboratory (UC LLNL).
The following statement applies to those portions of the product
and must be retained in any redistribution of source code, binaries,
documentation, and/or accompanying materials:
This work was partially produced at the University of California,
Lawrence Livermore National Laboratory (UC LLNL) under contract no.
W-7405-ENG-48 (Contract 48) between the U.S. Department of Energy
(DOE) and The Regents of the University of California (University)
for the operation of UC LLNL.
DISCLAIMER:
This work was prepared as an account of work sponsored by an agency
of the United States Government. Neither the United States
Government nor the University of California nor any of their
employees, makes any warranty, express or implied, or assumes any
liability or responsibility for the accuracy, completeness, or
usefulness of any information, apparatus, product, or process
disclosed, or represents that its use would not infringe privately-
owned rights. Reference herein to any specific commercial products,
process, or service by trade name, trademark, manufacturer, or
otherwise, does not necessarily constitute or imply its endorsement,
recommendation, or favoring by the United States Government or the
University of California. The views and opinions of authors
expressed herein do not necessarily state or reflect those of the
United States Government or the University of California, and shall
not be used for advertising or product endorsement purposes.
--------------------------------------------------------------------------
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 @@
*-------------------------------------------------------------------