summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST2
-rw-r--r--c++/src/H5DataSet.cpp2
-rw-r--r--c++/src/H5DataSet.h2
-rw-r--r--c++/src/H5DataType.cpp2
-rw-r--r--c++/src/H5DataType.h2
-rw-r--r--c++/src/H5File.cpp2
-rw-r--r--c++/src/H5File.h2
-rw-r--r--c++/src/H5Group.cpp2
-rw-r--r--c++/src/H5Group.h2
-rw-r--r--c++/src/H5IdComponent.cpp4
-rw-r--r--c++/src/H5IdComponent.h2
-rw-r--r--c++/test/trefer.cpp8
-rw-r--r--examples/h5_reference.c14
-rw-r--r--fortran/src/H5Rf.c16
-rw-r--r--src/H5R.c106
-rw-r--r--src/H5Rdeprec.c161
-rw-r--r--src/H5Rpkg.h63
-rw-r--r--src/H5Rpublic.h31
-rw-r--r--src/H5Sprivate.h1
-rw-r--r--src/H5trace.c3
-rw-r--r--src/H5vers.txt1
-rw-r--r--src/H5version.h15
-rwxr-xr-xsrc/Makefile.am3
-rw-r--r--src/Makefile.in5
-rw-r--r--test/ntypes.c73
-rwxr-xr-xtest/objcopy.c24
-rw-r--r--test/trefer.c370
-rw-r--r--tools/lib/h5diff_array.c94
28 files changed, 651 insertions, 361 deletions
diff --git a/MANIFEST b/MANIFEST
index e519f9e..2cdfe68 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -643,6 +643,8 @@
./src/H5Pstrcpl.c
./src/H5Ptest.c
./src/H5R.c
+./src/H5Rdeprec.c
+./src/H5Rpkg.h
./src/H5Rprivate.h
./src/H5Rpublic.h
./src/H5RC.c
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 276bcdb..4d3050c 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -503,6 +503,7 @@ void* DataSet::Reference(const H5std_string& name) const
return(Reference(name.c_str()));
}
+#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: DataSet::getObjType
///\brief Retrieves the type of object that an object reference points to.
@@ -527,6 +528,7 @@ H5G_obj_t DataSet::getObjType(void *ref, H5R_type_t ref_type) const
throw DataSetIException("DataSet::getObjType", E.getDetailMsg());
}
}
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: DataSet::getRegion
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index 24e52ab..7323f52 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -73,8 +73,10 @@ class H5_DLLCPP DataSet : public AbstractDs {
// Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL );
+#ifndef H5_NO_DEPRECATED_SYMBOLS
// Retrieves the type of object that an object reference points to.
H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 8ba91aa..1ac922e 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -664,6 +664,7 @@ void* DataType::Reference(const H5std_string& name) const
return(Reference(name.c_str()));
}
+#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: DataType::getObjType
///\brief Retrieves the type of object that an object reference points to.
@@ -686,6 +687,7 @@ H5G_obj_t DataType::getObjType(void *ref, H5R_type_t ref_type) const
throw DataTypeIException(inMemFunc("getObjType"), E.getDetailMsg());
}
}
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: DataType::getRegion
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 425ad25..588a57a 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -107,8 +107,10 @@ class H5_DLLCPP DataType : public H5Object {
void* Reference(const char* name) const; // will be obsolete
void* Reference(const H5std_string& name) const; // will be obsolete
+#ifndef H5_NO_DEPRECATED_SYMBOLS
// Retrieves the type of object that an object reference points to.
H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 66cacb5..aa11e31 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -548,6 +548,7 @@ void* H5File::Reference(const H5std_string& name) const
return(Reference(name.c_str()));
}
+#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: H5File::getObjType
///\brief Retrieves the type of object that an object reference points to.
@@ -572,6 +573,7 @@ H5G_obj_t H5File::getObjType(void *ref, H5R_type_t ref_type) const
throw FileIException("H5File::getObjType", E.getDetailMsg());
}
}
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: H5File::getRegion
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 30e148a..b239efe 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -67,8 +67,10 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
// and datatypes) in the same file.
void getObjIDs(unsigned types, int max_objs, hid_t *oid_list) const;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
// Retrieves the type of object that an object reference points to.
H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index ae4675f..f3c058a 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -140,6 +140,7 @@ void* Group::Reference(const H5std_string& name) const
return(Reference(name.c_str()));
}
+#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: Group::getObjType
///\brief Retrieves the type of object that an object reference points to.
@@ -164,6 +165,7 @@ H5G_obj_t Group::getObjType(void *ref, H5R_type_t ref_type) const
throw GroupIException("Group::getObjType", E.getDetailMsg());
}
}
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: Group::getRegion
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index d7e7dec..5df85bb 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -26,8 +26,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
// Close this group.
virtual void close();
+#ifndef H5_NO_DEPRECATED_SYMBOLS
// Retrieves the type of object that an object reference points to.
H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 249c66c..bb015fb 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -436,6 +436,7 @@ void IdComponent::dereference(IdComponent& obj, void* ref)
}
}
+#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: IdComponent::p_get_obj_type (protected)
// Purpose Retrieves the type of object that an object reference points to.
@@ -452,7 +453,7 @@ void IdComponent::dereference(IdComponent& obj, void* ref)
//--------------------------------------------------------------------------
H5G_obj_t IdComponent::p_get_obj_type(void *ref, H5R_type_t ref_type) const
{
- H5G_obj_t obj_type = H5Rget_obj_type(id, ref_type, ref);
+ H5G_obj_t obj_type = H5Rget_obj_type1(id, ref_type, ref);
if (obj_type == H5G_UNKNOWN)
{
@@ -460,6 +461,7 @@ H5G_obj_t IdComponent::p_get_obj_type(void *ref, H5R_type_t ref_type) const
}
return(obj_type);
}
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: IdComponent::p_get_region (protected)
diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h
index 503217b..facdefd 100644
--- a/c++/src/H5IdComponent.h
+++ b/c++/src/H5IdComponent.h
@@ -98,8 +98,10 @@ class H5_DLLCPP IdComponent {
void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
void* p_reference(const char* name, hid_t space_id, H5R_type_t ref_type) const; // will be removed
+#ifndef H5_NO_DEPRECATED_SYMBOLS
// Retrieves the type of object that an object reference points to.
H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Retrieves a dataspace with the region pointed to selected.
hid_t p_get_region(void *ref, H5R_type_t ref_type) const;
diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp
index 71498ce..9650a0e 100644
--- a/c++/test/trefer.cpp
+++ b/c++/test/trefer.cpp
@@ -157,23 +157,31 @@ static void test_reference_obj()
// Create reference to dataset
file1->reference(&wbuf[0], "/Group1/Dataset1");
+#ifndef H5_NO_DEPRECATED_SYMBOLS
H5G_obj_t obj_type = dataset.getObjType(&wbuf[0], H5R_OBJECT);
verify_val(obj_type, H5G_DATASET, "DataSet::getObjType", __LINE__, __FILE__);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Create reference to dataset
file1->reference(&wbuf[1], "/Group1/Dataset2");
+#ifndef H5_NO_DEPRECATED_SYMBOLS
obj_type = dataset.getObjType(&wbuf[1], H5R_OBJECT);
verify_val(obj_type, H5G_DATASET, "DataSet::getObjType", __LINE__, __FILE__);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Create reference to group
file1->reference(&wbuf[2], "/Group1");
+#ifndef H5_NO_DEPRECATED_SYMBOLS
obj_type = dataset.getObjType(&wbuf[2], H5R_OBJECT);
verify_val(obj_type, H5G_GROUP, "DataSet::getObjType", __LINE__, __FILE__);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Create reference to named datatype
file1->reference(&wbuf[3], "/Group1/Datatype1");
+#ifndef H5_NO_DEPRECATED_SYMBOLS
obj_type = dataset.getObjType(&wbuf[3], H5R_OBJECT);
verify_val(obj_type, H5G_TYPE, "DataSet::getObjType", __LINE__, __FILE__);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Write selection to disk
dataset.write(wbuf, PredType::STD_REF_OBJ);
diff --git a/examples/h5_reference.c b/examples/h5_reference.c
index 5cd6cb1..002d753 100644
--- a/examples/h5_reference.c
+++ b/examples/h5_reference.c
@@ -35,6 +35,7 @@ main(void) {
hid_t gid_a; /* and dataspaces identifiers */
hid_t did_b, sid_b, tid_b;
hid_t did_r, tid_r, sid_r;
+ H5O_type_t obj_type;
herr_t status;
hobj_ref_t *wbuf; /* buffer to write to disk */
@@ -118,13 +119,14 @@ main(void) {
/*
* Find the type of referenced objects.
*/
- status = H5Rget_obj_type(did_r, H5R_OBJECT, &rbuf[0]);
- if ( status == H5G_GROUP )
- printf("First dereferenced object is a group. \n");
+ status = H5Rget_obj_type2(did_r, H5R_OBJECT, &rbuf[0], &obj_type);
+ if ( obj_type == H5O_TYPE_GROUP )
+ printf("First dereferenced object is a group. \n");
+
+ status = H5Rget_obj_type2(did_r, H5R_OBJECT, &rbuf[1], &obj_type);
+ if ( obj_type == H5O_TYPE_DATASET )
+ printf("Second dereferenced object is a dataset. \n");
- status = H5Rget_obj_type(did_r, H5R_OBJECT, &rbuf[1]);
- if ( status == H5G_DATASET )
- printf("Second dereferenced object is a dataset. \n");
/*
* Get datatype of the dataset "B"
*/
diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c
index f917a88..4430e1a 100644
--- a/fortran/src/H5Rf.c
+++ b/fortran/src/H5Rf.c
@@ -220,20 +220,22 @@ nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id)
int_f
nh5rget_object_type_obj_c (hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type)
{
- int ret_value = -1;
- hid_t c_dset_id;
- int c_obj_type;
+ H5O_type_t c_obj_type;
hobj_ref_t ref_c;
+ int_f ret_value = -1;
- ref_c=*ref;
+ ref_c = *ref;
/*
* Call H5Rget_object_type function.
*/
- c_dset_id = *dset_id;
- c_obj_type = H5Rget_obj_type(c_dset_id, H5R_OBJECT, &ref_c);
- if(c_obj_type < 0) return ret_value;
+ if(H5Rget_obj_type2((hid_t)*dset_id, H5R_OBJECT, &ref_c, &c_obj_type) < 0)
+ return ret_value;
+
*obj_type = (int_f)c_obj_type;
+
ret_value = 0;
+
return ret_value;
}
+
diff --git a/src/H5R.c b/src/H5R.c
index d609cf4..2fe44fd 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -13,6 +13,8 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define H5R_PACKAGE /*suppress error about including H5Rpkg */
+
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5R_init_interface
@@ -20,12 +22,11 @@
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
#include "H5Gprivate.h" /* Groups */
#include "H5HGprivate.h" /* Global Heaps */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Rprivate.h" /* References */
+#include "H5Rpkg.h" /* References */
#include "H5Sprivate.h" /* Dataspaces */
/* Local macro definitions */
@@ -38,11 +39,36 @@ static herr_t H5R_create(void *ref, H5G_loc_t *loc, const char *name,
H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id);
static hid_t H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref);
static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref);
-static H5G_obj_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref);
static ssize_t H5R_get_name(H5F_t *file, hid_t dxpl_id, hid_t id,
H5R_type_t ref_type, const void *_ref, char *name, size_t size);
+/*-------------------------------------------------------------------------
+ * Function: H5R_init
+ *
+ * Purpose: Initialize the interface from some other package.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, September 13, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R_init(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5R_init, FAIL)
+ /* FUNC_ENTER() does all the work */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R_init() */
+
+
/*--------------------------------------------------------------------------
NAME
H5R_init_interface -- Initialize interface-specific information
@@ -235,9 +261,6 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5
break;
}
- case H5R_INTERNAL:
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "Internal references are not yet supported")
-
case H5R_BADTYPE:
case H5R_MAXTYPE:
default:
@@ -383,9 +406,6 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re
} /* end case */
break;
- case H5R_INTERNAL:
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "Internal references are not yet supported")
-
case H5R_BADTYPE:
case H5R_MAXTYPE:
default:
@@ -644,7 +664,7 @@ done:
PURPOSE
Retrieves the type of object that an object reference points to
USAGE
- H5G_obj_t H5R_get_obj_type(file, ref_type, ref)
+ H5O_type_t H5R_get_obj_type(file, ref_type, ref)
H5F_t *file; IN: File the object being dereferenced is within
H5R_type_t ref_type; IN: Type of reference to query
void *ref; IN: Reference to query.
@@ -660,13 +680,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static H5G_obj_t
-H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref)
+herr_t
+H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
+ const void *_ref, H5O_type_t *obj_type)
{
H5O_loc_t oloc; /* Object location */
- H5O_type_t obj_type; /* Type of object */
- const uint8_t *p; /* Pointer to OID to store */
- H5G_obj_t ret_value; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5R_get_obj_type)
@@ -685,8 +704,9 @@ H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_r
case H5R_DATASET_REGION:
{
- H5HG_t hobjid; /* Heap object ID */
- uint8_t *buf; /* Buffer to store serialized selection in */
+ H5HG_t hobjid; /* Heap object ID */
+ const uint8_t *p; /* Pointer to reference to decode */
+ uint8_t *buf; /* Buffer to store serialized selection in */
/* Get the heap ID for the dataset region */
p = (const uint8_t *)_ref;
@@ -695,7 +715,7 @@ H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_r
/* Get the dataset region from the heap (allocate inside routine) */
if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL)
- HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, H5G_UNKNOWN, "Unable to read dataset region information")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
/* Get the object oid for the dataset */
p = buf;
@@ -706,26 +726,21 @@ H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_r
} /* end case */
break;
- case H5R_INTERNAL:
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, H5G_UNKNOWN, "Internal references are not yet supported")
-
case H5R_BADTYPE:
case H5R_MAXTYPE:
default:
HDassert("unknown reference type" && 0);
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, H5G_UNKNOWN, "internal error (unknown reference type)")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
} /* end switch */
/* Check to make certain that this object hasn't been deleted since the reference was created */
if(H5O_link(&oloc, 0, dxpl_id) <= 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, H5G_UNKNOWN, "dereferencing deleted object")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
/* Get the object type */
- if(H5O_obj_type(&oloc, &obj_type, dxpl_id) < 0)
+ if(H5O_obj_type(&oloc, obj_type, dxpl_id) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get object type")
- ret_value = H5G_map_obj_type(obj_type);
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R_get_obj_type() */
@@ -733,51 +748,51 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5Rget_obj_type
+ H5Rget_obj_type2
PURPOSE
Retrieves the type of object that an object reference points to
USAGE
- int H5Rget_obj_type(id, ref_type, ref)
+ herr_t H5Rget_obj_type2(id, ref_type, ref, obj_type)
hid_t id; IN: Dataset reference object is in or location ID of
object that the dataset is located within.
H5R_type_t ref_type; IN: Type of reference to query
void *ref; IN: Reference to query.
+ H5O_type_t *obj_type; OUT: Type of object reference points to
RETURNS
- Success: An object type defined in H5Gpublic.h
- Failure: H5G_UNKNOWN
+ Non-negative on success/Negative on failure
DESCRIPTION
- Given a reference to some object, this function returns the type of object
- pointed to.
+ Given a reference to some object, this function retrieves the type of
+ object pointed to.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-H5G_obj_t
-H5Rget_obj_type(hid_t id, H5R_type_t ref_type, const void *ref)
+herr_t
+H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref,
+ H5O_type_t *obj_type)
{
- H5G_loc_t loc; /* Object location */
- H5G_obj_t ret_value;
+ H5G_loc_t loc; /* Object location */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Rget_obj_type, H5G_UNKNOWN)
- H5TRACE3("Go", "iRt*x", id, ref_type, ref);
+ FUNC_ENTER_API(H5Rget_obj_type2, FAIL)
/* Check args */
if(H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
if(ref == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
/* Get the object information */
- if((ret_value = H5R_get_obj_type(loc.oloc->file, H5AC_ind_dxpl_id, ref_type, ref)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type")
+ if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_dxpl_id, ref_type, ref, obj_type) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object type")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Rget_obj_type() */
+} /* end H5Rget_obj_type2() */
/*--------------------------------------------------------------------------
@@ -856,9 +871,6 @@ H5R_get_name(H5F_t *f, hid_t dxpl_id, hid_t id, H5R_type_t ref_type,
} /* end case */
break;
- case H5R_INTERNAL:
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "Internal references are not yet supported")
-
case H5R_BADTYPE:
case H5R_MAXTYPE:
default:
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
new file mode 100644
index 0000000..36f0d40
--- /dev/null
+++ b/src/H5Rdeprec.c
@@ -0,0 +1,161 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Rdeprec.c
+ * September 13 2007
+ * Quincey Koziol <koziol@hdfgroup.org>
+ *
+ * Purpose: Deprecated functions from the H5R interface. These
+ * functions are here for compatibility purposes and may be
+ * removed in the future. Applications should switch to the
+ * newer APIs.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5R_PACKAGE /*suppress error about including H5Rpkg */
+
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5R_init_deprec_interface
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Rpkg.h" /* References */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*--------------------------------------------------------------------------
+NAME
+ H5R_init_deprec_interface -- Initialize interface-specific information
+USAGE
+ herr_t H5R_init_deprec_interface()
+RETURNS
+ Non-negative on success/Negative on failure
+DESCRIPTION
+ Initializes any interface-specific data or routines. (Just calls
+ H5R_init() currently).
+
+--------------------------------------------------------------------------*/
+static herr_t
+H5R_init_deprec_interface(void)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5R_init_deprec_interface)
+
+ FUNC_LEAVE_NOAPI(H5R_init())
+} /* H5R_init_deprec_interface() */
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Rget_obj_type1
+ PURPOSE
+ Retrieves the type of object that an object reference points to
+ USAGE
+ H5G_obj_t H5Rget_obj_type1(id, ref_type, ref)
+ hid_t id; IN: Dataset reference object is in or location ID of
+ object that the dataset is located within.
+ H5R_type_t ref_type; IN: Type of reference to query
+ void *ref; IN: Reference to query.
+
+ RETURNS
+ Success: An object type defined in H5Gpublic.h
+ Failure: H5G_UNKNOWN
+ DESCRIPTION
+ Given a reference to some object, this function returns the type of object
+ pointed to.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+H5G_obj_t
+H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
+{
+ H5G_loc_t loc; /* Object location */
+ H5O_type_t obj_type; /* Object type */
+ H5G_obj_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5Rget_obj_type1, H5G_UNKNOWN)
+ H5TRACE3("Go", "iRt*x", id, ref_type, ref);
+
+ /* Check args */
+ if(H5G_loc(id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location")
+ if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type")
+ if(ref == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer")
+
+ /* Get the object information */
+ if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_dxpl_id, ref_type, ref, &obj_type) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type")
+
+ /* Set return value */
+ ret_value = H5G_map_obj_type(obj_type);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rget_obj_type1() */
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h
new file mode 100644
index 0000000..82382fb
--- /dev/null
+++ b/src/H5Rpkg.h
@@ -0,0 +1,63 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Thursday, September 13, 2007
+ *
+ * Purpose: This file contains declarations which are visible
+ * only within the H5R package. Source files outside the
+ * H5R package should include H5Rprivate.h instead.
+ */
+#ifndef H5R_PACKAGE
+#error "Do not include this file outside the H5R package!"
+#endif
+
+#ifndef _H5Rpkg_H
+#define _H5Rpkg_H
+
+/* Get package's private header */
+#include "H5Rprivate.h"
+
+/* Other private headers needed by this file */
+#include "H5Fprivate.h" /* File access */
+
+/**************************/
+/* Package Private Macros */
+/**************************/
+
+
+/****************************/
+/* Package Private Typedefs */
+/****************************/
+
+
+/*****************************/
+/* Package Private Variables */
+/*****************************/
+
+
+/******************************/
+/* Package Private Prototypes */
+/******************************/
+
+/* General functions */
+H5_DLL herr_t H5R_init(void);
+H5_DLL herr_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
+ const void *_ref, H5O_type_t *obj_type);
+
+
+#endif /* _H5Rpkg_H */
+
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index 7515f62..975104e 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -31,19 +31,9 @@ typedef enum {
H5R_BADTYPE = (-1), /*invalid Reference Type */
H5R_OBJECT, /*Object reference */
H5R_DATASET_REGION, /*Dataset Region Reference */
- H5R_INTERNAL, /*Internal Reference */
H5R_MAXTYPE /*highest type (Invalid as true type) */
} H5R_type_t;
-#ifdef LATER
-/* Generic reference structure for user's code */
-typedef struct {
- unsigned long oid[2]; /* OID of object referenced */
- unsigned long region[2]; /* heap ID of region in object */
- unsigned long file[2]; /* heap ID of external filename */
-} href_t;
-#endif /* LATER */
-
/* Note! Be careful with the sizes of the references because they should really
* depend on the run-time values in the file. Unfortunately, the arrays need
* to be defined at compile-time, so we have to go with the worst case sizes for
@@ -72,12 +62,31 @@ H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name,
H5R_type_t ref_type, hid_t space_id);
H5_DLL hid_t H5Rdereference(hid_t dataset, H5R_type_t ref_type, const void *ref);
H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
-H5_DLL H5G_obj_t H5Rget_obj_type(hid_t id, H5R_type_t ref_type, const void *_ref);
+H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *_ref,
+ H5O_type_t *obj_type);
H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref,
char *name/*out*/, size_t size);
+/* Symbols defined for compatibility with previous versions of the HDF5 API.
+ *
+ * Use of these symbols is deprecated.
+ */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/* Macros */
+
+
+/* Typedefs */
+
+
+/* Function prototypes */
+H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *_ref);
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
#ifdef __cplusplus
}
#endif
#endif /* _H5Rpublic_H */
+
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 3eca730..69624c3 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -303,3 +303,4 @@ H5S_mpio_space_span_type( const H5S_t *space, size_t elmt_size,
#endif /* H5_HAVE_PARALLEL */
#endif /* _H5Sprivate_H */
+
diff --git a/src/H5trace.c b/src/H5trace.c
index 7c2587d..1c3b89d 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -1306,9 +1306,6 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5R_DATASET_REGION:
fprintf(out, "H5R_DATASET_REGION");
break;
- case H5R_INTERNAL:
- fprintf(out, "H5R_INTERNAL");
- break;
case H5R_MAXTYPE:
fprintf(out, "H5R_MAXTYPE");
break;
diff --git a/src/H5vers.txt b/src/H5vers.txt
index 6267fbb..ba2eac0 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -53,6 +53,7 @@ FUNCTION: H5Eset_auto; ; v10, v18
FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18
FUNCTION: H5Gcreate; ; v10, v18
FUNCTION: H5Gopen; ; v10, v18
+FUNCTION: H5Rget_obj_type; ; v16, v18
# API typedefs
# (although not required, it's easier to compare this file with the headers
diff --git a/src/H5version.h b/src/H5version.h
index e239a75..8ea79be 100644
--- a/src/H5version.h
+++ b/src/H5version.h
@@ -70,6 +70,10 @@
#define H5Gopen_vers 1
#endif /* !defined(H5Gopen_vers) */
+#if !defined(H5Rget_obj_type_vers)
+#define H5Rget_obj_type_vers 1
+#endif /* !defined(H5Rget_obj_type_vers) */
+
/************/
/* Typedefs */
/************/
@@ -183,6 +187,17 @@
#error "H5Gopen_vers set to invalid value"
#endif /* H5Gopen_vers */
+#if !defined(H5Rget_obj_type_vers) || H5Rget_obj_type_vers == 2
+#ifndef H5Rget_obj_type_vers
+#define H5Rget_obj_type_vers 2
+#endif /* H5Rget_obj_type_vers */
+#define H5Rget_obj_type H5Rget_obj_type2
+#elif H5Rget_obj_type_vers == 1
+#define H5Rget_obj_type H5Rget_obj_type1
+#else /* H5Rget_obj_type_vers */
+#error "H5Rget_obj_type_vers set to invalid value"
+#endif /* H5Rget_obj_type_vers */
+
/************/
/* Typedefs */
/************/
diff --git a/src/Makefile.am b/src/Makefile.am
index a07892f..cbb4178 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -75,7 +75,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5P.c H5Pacpl.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
H5Pgcpl.c \
H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \
- H5R.c H5RC.c \
+ H5R.c H5Rdeprec.c \
+ H5RC.c \
H5RS.c \
H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \
H5Sselect.c H5Stest.c H5SL.c H5SM.c H5SMbtree2.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 4561db1..b7f83e9 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -107,7 +107,7 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5Oshared.lo H5Ostab.lo H5Oshmesg.lo H5Otest.lo H5Ounknown.lo \
H5P.lo H5Pacpl.lo H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo \
H5Pfmpl.lo H5Pgcpl.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo \
- H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo H5R.lo H5RC.lo H5RS.lo \
+ H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo H5R.lo H5Rdeprec.lo H5RC.lo H5RS.lo \
H5S.lo H5Sall.lo H5Sdbg.lo H5Shyper.lo H5Smpio.lo H5Snone.lo \
H5Spoint.lo H5Sselect.lo H5Stest.lo H5SL.lo H5SM.lo \
H5SMbtree2.lo H5SMcache.lo H5SMtest.lo H5ST.lo H5T.lo \
@@ -431,7 +431,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5P.c H5Pacpl.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
H5Pgcpl.c \
H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \
- H5R.c H5RC.c \
+ H5R.c H5Rdeprec.c H5RC.c \
H5RS.c \
H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \
H5Sselect.c H5Stest.c H5SL.c H5SM.c H5SMbtree2.c \
@@ -725,6 +725,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pstrcpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ptest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5R.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Rdeprec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5RC.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5RS.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5S.Plo@am__quote@
diff --git a/test/ntypes.c b/test/ntypes.c
index a842ddb..a7713cb 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -1897,6 +1897,8 @@ test_refer_dtype(hid_t file)
if (envval == NULL)
envval = "nomatch";
if (HDstrcmp(envval, "multi")) {
+ H5O_type_t obj_type; /* Object type */
+
/* Allocate write & read buffers */
wbuf=HDmalloc(MAX(sizeof(unsigned),sizeof(hobj_ref_t)));
rbuf=HDmalloc(MAX(sizeof(unsigned),sizeof(hobj_ref_t)));
@@ -1939,9 +1941,11 @@ test_refer_dtype(hid_t file)
TEST_ERROR;
/* Create reference to named datatype */
- if(H5Rcreate(wbuf,file,"/Group1/Datatype1",H5R_OBJECT,-1)<0)
+ if(H5Rcreate(wbuf, file, "/Group1/Datatype1", H5R_OBJECT, -1) < 0)
+ TEST_ERROR;
+ if(H5Rget_obj_type2(dataset, H5R_OBJECT, wbuf, &obj_type) < 0)
TEST_ERROR;
- if(H5Rget_obj_type(dataset,H5R_OBJECT,wbuf)!=H5G_TYPE)
+ if(obj_type != H5O_TYPE_NAMED_DATATYPE)
TEST_ERROR;
/* Write selection to disk */
@@ -2050,6 +2054,7 @@ test_refer_dtype2(hid_t file)
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
*drbuf; /* Buffer for reading numeric data from disk */
uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Object type */
int i; /* counting variables */
/* Output message about test being performed */
@@ -2080,61 +2085,63 @@ test_refer_dtype2(hid_t file)
/* Create dataspace for the reference dataset */
- if((sid1=H5Screate_simple(SPACE1_RANK, dims1, NULL))<0)
+ if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0)
TEST_ERROR;
/* Create a reference dataset */
- if((dset1=H5Dcreate(file,"Dataset1",H5T_STD_REF_DSETREG,sid1,H5P_DEFAULT))<0)
+ if((dset1 = H5Dcreate(file, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create references */
/* Select 6x6 hyperslab for first reference */
- start[0]=2; start[1]=2;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=6; block[1]=6;
+ start[0] = 2; start[1] = 2;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 1; count[1] = 1;
+ block[0] = 6; block[1] = 6;
- if(H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block)<0)
+ if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR;
if((int)H5Sget_select_npoints(sid2) != 36)
TEST_ERROR;
/* Store first dataset region */
- if(H5Rcreate(&wbuf,file,"/Dataset2",H5R_DATASET_REGION,sid2)<0)
+ if(H5Rcreate(&wbuf, file, "/Dataset2", H5R_DATASET_REGION, sid2) < 0)
+ TEST_ERROR;
+ if(H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf, &obj_type) < 0)
TEST_ERROR;
- if(H5Rget_obj_type(dset1,H5R_DATASET_REGION,&wbuf) != H5G_DATASET)
+ if(obj_type != H5O_TYPE_DATASET)
TEST_ERROR;
/* Write selection to disk */
- if(H5Dwrite(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wbuf)<0)
+ if(H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
TEST_ERROR;
/* Close disk dataspace */
- if(H5Sclose(sid1)<0)
+ if(H5Sclose(sid1) < 0)
TEST_ERROR;
/* Close Dataset */
- if(H5Dclose(dset1)<0)
+ if(H5Dclose(dset1) < 0)
TEST_ERROR;
/* Close uint8 dataset dataspace */
- if(H5Sclose(sid2)<0)
+ if(H5Sclose(sid2) < 0)
TEST_ERROR;
/* Open the dataset */
- if((dset1=H5Dopen(file,"/Dataset1"))<0)
+ if((dset1 = H5Dopen(file, "/Dataset1")) < 0)
TEST_ERROR;
/* Get datatype for dataset */
- if((dtype = H5Dget_type(dset1))<0)
+ if((dtype = H5Dget_type(dset1)) < 0)
TEST_ERROR;
/* Construct native type */
- if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0)
+ if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Check if the data type is equal */
@@ -2142,34 +2149,36 @@ test_refer_dtype2(hid_t file)
TEST_ERROR;
/* Read selection from disk */
- if(H5Dread(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rbuf)<0)
+ if(H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
TEST_ERROR;
/* Try to open objects */
- if((dset2=H5Rdereference(dset1,H5R_DATASET_REGION,&rbuf))<0)
+ if((dset2 = H5Rdereference(dset1, H5R_DATASET_REGION, &rbuf)) < 0)
TEST_ERROR;
- /* Check what H5Rget_obj_type function returns */
- if(H5Rget_obj_type(dset1, H5R_DATASET_REGION,&rbuf) != H5G_DATASET)
+ /* Check what H5Rget_obj_type2 function returns */
+ if(H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf, &obj_type) < 0)
+ TEST_ERROR;
+ if(obj_type != H5O_TYPE_DATASET)
TEST_ERROR;
/* Check information in referenced dataset */
- if((sid1 = H5Dget_space(dset2))<0)
+ if((sid1 = H5Dget_space(dset2)) < 0)
TEST_ERROR;
- if((int)H5Sget_simple_extent_npoints(sid1)!=100)
+ if((int)H5Sget_simple_extent_npoints(sid1) != 100)
TEST_ERROR;
/* Read from disk */
- if(H5Dread(dset2,H5T_STD_U8LE,H5S_ALL,H5S_ALL,H5P_DEFAULT,drbuf)<0)
+ if(H5Dread(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf) < 0)
TEST_ERROR;
- for(tu8=(uint8_t *)drbuf,i=0; i<SPACE2_DIM1*SPACE2_DIM2; i++,tu8++)
- if(*tu8 != (uint8_t)(i*3))
+ for(tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
+ if(*tu8 != (uint8_t)(i * 3))
TEST_ERROR;
/* Get the hyperslab selection */
- if((sid2=H5Rget_region(dset1,H5R_DATASET_REGION,&rbuf))<0)
+ if((sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf)) < 0)
TEST_ERROR;
/* Verify correct hyperslab selected */
@@ -2179,19 +2188,19 @@ test_refer_dtype2(hid_t file)
TEST_ERROR;
/* Close region space */
- if(H5Sclose(sid2)<0)
+ if(H5Sclose(sid2) < 0)
TEST_ERROR;
/* Close first space */
- if(H5Sclose(sid1)<0)
+ if(H5Sclose(sid1) < 0)
TEST_ERROR;
/* Close dereferenced Dataset */
- if(H5Dclose(dset2)<0)
+ if(H5Dclose(dset2) < 0)
TEST_ERROR;
/* Close Dataset */
- if(H5Dclose(dset1)<0)
+ if(H5Dclose(dset1) < 0)
TEST_ERROR;
/* Free memory buffers */
diff --git a/test/objcopy.c b/test/objcopy.c
index c916f8f..d6740a4 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -876,11 +876,11 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
ref_buf2 = buf2;
for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
hid_t obj1_id, obj2_id; /* IDs for objects referenced */
- H5G_obj_t obj1_type, obj2_type; /* Types of objects referenced */
+ H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */
/* Check for types of objects handled */
- if((obj1_type = H5Rget_obj_type(parent1, H5R_OBJECT, ref_buf1)) < 0) TEST_ERROR
- if((obj2_type = H5Rget_obj_type(parent2, H5R_OBJECT, ref_buf2)) < 0) TEST_ERROR
+ if(H5Rget_obj_type2(parent1, H5R_OBJECT, ref_buf1, &obj1_type) < 0) TEST_ERROR
+ if(H5Rget_obj_type2(parent2, H5R_OBJECT, ref_buf2, &obj2_type) < 0) TEST_ERROR
if(obj1_type != obj2_type) TEST_ERROR
/* Open referenced objects */
@@ -903,15 +903,15 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
/* Check for types of objects handled */
switch(obj1_type)
{
- case H5G_DATASET:
+ case H5O_TYPE_DATASET:
if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
break;
- case H5G_GROUP:
+ case H5O_TYPE_GROUP:
if(compare_groups(obj1_id, obj2_id, pid, -1, 0) != TRUE) TEST_ERROR
break;
- case H5G_TYPE:
+ case H5O_TYPE_NAMED_DATATYPE:
if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
break;
@@ -933,11 +933,11 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
hid_t obj1_id, obj2_id; /* IDs for objects referenced */
hid_t obj1_sid, obj2_sid; /* Dataspace IDs for objects referenced */
- H5G_obj_t obj1_type, obj2_type; /* Types of objects referenced */
+ H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */
/* Check for types of objects handled */
- if((obj1_type = H5Rget_obj_type(parent1, H5R_DATASET_REGION, ref_buf1)) < 0) TEST_ERROR
- if((obj2_type = H5Rget_obj_type(parent2, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR
+ if(H5Rget_obj_type2(parent1, H5R_DATASET_REGION, ref_buf1, &obj1_type) < 0) TEST_ERROR
+ if(H5Rget_obj_type2(parent2, H5R_DATASET_REGION, ref_buf2, &obj2_type) < 0) TEST_ERROR
if(obj1_type != obj2_type) TEST_ERROR
/* Open referenced objects */
@@ -960,15 +960,15 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
/* Check for types of objects handled */
switch(obj1_type)
{
- case H5G_DATASET:
+ case H5O_TYPE_DATASET:
if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
break;
- case H5G_GROUP:
+ case H5O_TYPE_GROUP:
if(compare_groups(obj1_id, obj2_id, pid, -1, 0) != TRUE) TEST_ERROR
break;
- case H5G_TYPE:
+ case H5O_TYPE_NAMED_DATATYPE:
if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
break;
diff --git a/test/trefer.c b/test/trefer.c
index aff967a..974af4b 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -82,20 +82,21 @@ test_reference_obj(void)
hobj_ref_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf; /* temp. buffer read from disk */
- hobj_ref_t nvrbuf[3]={0,100,1000000000}; /* buffer with non-valid refs */
+ hobj_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */
unsigned *tu32; /* Temporary pointer to uint32 data */
int i, j; /* counting variables */
const char *write_comment="Foo!"; /* Comments for group */
char read_comment[10];
+ H5O_type_t obj_type; /* Object type */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Object Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf=malloc(MAX(sizeof(unsigned),sizeof(hobj_ref_t))*SPACE1_DIM1);
- rbuf=malloc(MAX(sizeof(unsigned),sizeof(hobj_ref_t))*SPACE1_DIM1);
- tbuf=malloc(MAX(sizeof(unsigned),sizeof(hobj_ref_t))*SPACE1_DIM1);
+ wbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ rbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ tbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -110,18 +111,18 @@ test_reference_obj(void)
CHECK(group, FAIL, "H5Gcreate2");
/* Set group's comment */
- ret=H5Oset_comment(group, ".", write_comment, H5P_DEFAULT);
+ ret = H5Oset_comment(group, ".", write_comment, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oset_comment");
/* Create a dataset (inside Group1) */
- dataset=H5Dcreate(group,"Dataset1",H5T_NATIVE_UINT,sid1,H5P_DEFAULT);
+ dataset = H5Dcreate(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
- for(tu32=(unsigned *)wbuf,i=0; i<SPACE1_DIM1; i++)
+ for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
*tu32++=i*3;
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UINT,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -129,7 +130,7 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Dclose");
/* Create another dataset (inside Group1) */
- dataset=H5Dcreate(group,"Dataset2",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT);
+ dataset = H5Dcreate(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
/* Close Dataset */
@@ -137,21 +138,21 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Dclose");
/* Create a datatype to refer to */
- tid1 = H5Tcreate (H5T_COMPOUND, sizeof(s1_t));
+ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
CHECK(tid1, FAIL, "H5Tcreate");
/* Insert fields */
- ret=H5Tinsert (tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret=H5Tinsert (tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret=H5Tinsert (tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
- ret=H5Tcommit (group, "Datatype1", tid1);
+ ret = H5Tcommit(group, "Datatype1", tid1);
CHECK(ret, FAIL, "H5Tcommit");
/* Close datatype */
@@ -163,35 +164,39 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Gclose");
/* Create a dataset */
- dataset=H5Dcreate(fid1,"Dataset3",H5T_STD_REF_OBJ,sid1,H5P_DEFAULT);
+ dataset = H5Dcreate(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Dcreate");
/* Create reference to dataset */
- ret = H5Rcreate(&wbuf[0],fid1,"/Group1/Dataset1",H5R_OBJECT,-1);
+ ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, -1);
CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type(dataset,H5R_OBJECT,&wbuf[0]);
- VERIFY(ret, H5G_DATASET, "H5Rget_obj_type");
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
/* Create reference to dataset */
- ret = H5Rcreate(&wbuf[1],fid1,"/Group1/Dataset2",H5R_OBJECT,-1);
+ ret = H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, -1);
CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type(dataset,H5R_OBJECT,&wbuf[1]);
- VERIFY(ret, H5G_DATASET, "H5Rget_obj_type");
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[1], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
/* Create reference to group */
- ret = H5Rcreate(&wbuf[2],fid1,"/Group1",H5R_OBJECT,-1);
+ ret = H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, -1);
CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type(dataset,H5R_OBJECT,&wbuf[2]);
- VERIFY(ret, H5G_GROUP, "H5Rget_obj_type");
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[2], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type2");
/* Create reference to named datatype */
- ret = H5Rcreate(&wbuf[3],fid1,"/Group1/Datatype1",H5R_OBJECT,-1);
+ ret = H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, -1);
CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type(dataset,H5R_OBJECT,&wbuf[3]);
- VERIFY(ret, H5G_TYPE, "H5Rget_obj_type");
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[3], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_STD_REF_OBJ,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close disk dataspace */
@@ -211,29 +216,29 @@ test_reference_obj(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
- dataset=H5Dopen(fid1,"/Dataset3");
+ dataset = H5Dopen(fid1, "/Dataset3");
CHECK(ret, FAIL, "H5Dcreate");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_STD_REF_OBJ,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Open dataset object */
- dset2 = H5Rdereference(dataset,H5R_OBJECT,&rbuf[0]);
+ dset2 = H5Rdereference(dataset, H5R_OBJECT, &rbuf[0]);
CHECK(dset2, FAIL, "H5Rdereference");
/* Check information in referenced dataset */
sid1 = H5Dget_space(dset2);
CHECK(sid1, FAIL, "H5Dget_space");
- ret=(int)H5Sget_simple_extent_npoints(sid1);
+ ret = (int)H5Sget_simple_extent_npoints(sid1);
VERIFY(ret, 4, "H5Sget_simple_extent_npoints");
/* Read from disk */
- ret=H5Dread(dset2,H5T_NATIVE_UINT,H5S_ALL,H5S_ALL,H5P_DEFAULT,tbuf);
+ ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tbuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu32=(unsigned *)tbuf,i=0; i<SPACE1_DIM1; i++,tu32++)
+ for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
VERIFY(*tu32, (uint32_t)(i*3), "Data");
/* Close dereferenced Dataset */
@@ -241,7 +246,7 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Dclose");
/* Open group object */
- group = H5Rdereference(dataset,H5R_OBJECT,&rbuf[2]);
+ group = H5Rdereference(dataset, H5R_OBJECT, &rbuf[2]);
CHECK(group, FAIL, "H5Rdereference");
/* Get group's comment */
@@ -257,14 +262,14 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Gclose");
/* Open datatype object */
- tid1 = H5Rdereference(dataset,H5R_OBJECT,&rbuf[3]);
+ tid1 = H5Rdereference(dataset, H5R_OBJECT, &rbuf[3]);
CHECK(tid1, FAIL, "H5Rdereference");
/* Verify correct datatype */
{
H5T_class_t tclass;
- tclass= H5Tget_class(tid1);
+ tclass = H5Tget_class(tid1);
VERIFY(tclass, H5T_COMPOUND, "H5Tget_class");
ret= H5Tget_nmembers(tid1);
@@ -272,10 +277,12 @@ test_reference_obj(void)
}
/* Attempting to retrieve type of object using non-valid refs */
- for (j=0; j<3; j++){
- ret = H5Rget_obj_type(dataset,H5R_OBJECT,&nvrbuf[j]);
- VERIFY(ret, H5G_UNKNOWN, "H5Rget_obj_type");
- }
+ for(j = 0; j < 3; j++) {
+ H5E_BEGIN_TRY {
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &nvrbuf[j], &obj_type);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Rget_obj_type2");
+ } /* end for */
/* Close datatype */
ret = H5Tclose(tid1);
@@ -321,10 +328,11 @@ test_reference_region(void)
hsize_t high[SPACE2_RANK]; /* Selection bounds */
hdset_reg_ref_t *wbuf, /* buffer to write to disk */
*rbuf; /* buffer read from disk */
- hdset_reg_ref_t nvrbuf[3]={0,100,1000000000}; /* buffer with non-valid refs */
+ hdset_reg_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
*drbuf; /* Buffer for reading numeric data from disk */
uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Type of object */
int i, j; /* counting variables */
herr_t ret; /* Generic return value */
@@ -335,7 +343,7 @@ test_reference_region(void)
wbuf = HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
rbuf = HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
dwbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- drbuf = HDcalloc(sizeof(uint8_t),(size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ drbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
/* Create file */
fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -346,14 +354,14 @@ test_reference_region(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create a dataset */
- dset2=H5Dcreate(fid1,"Dataset2",H5T_STD_U8LE,sid2,H5P_DEFAULT);
+ dset2 = H5Dcreate(fid1, "Dataset2", H5T_STD_U8LE, sid2, H5P_DEFAULT);
CHECK(dset2, FAIL, "H5Dcreate");
- for(tu8=dwbuf,i=0; i<SPACE2_DIM1*SPACE2_DIM2; i++)
- *tu8++=i*3;
+ for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
+ *tu8++ = i * 3;
/* Write selection to disk */
- ret=H5Dwrite(dset2,H5T_STD_U8LE,H5S_ALL,H5S_ALL,H5P_DEFAULT,dwbuf);
+ ret = H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -365,39 +373,40 @@ test_reference_region(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dset1=H5Dcreate(fid1,"Dataset1",H5T_STD_REF_DSETREG,sid1,H5P_DEFAULT);
+ dset1 = H5Dcreate(fid1, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Dcreate");
/* Create references */
/* Select 6x6 hyperslab for first reference */
- start[0]=2; start[1]=2;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=6; block[1]=6;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2; start[1] = 2;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 1; count[1] = 1;
+ block[0] = 6; block[1] = 6;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
ret = (int)H5Sget_select_npoints(sid2);
VERIFY(ret, 36, "H5Sget_select_npoints");
/* Store first dataset region */
- ret = H5Rcreate(&wbuf[0],fid1,"/Dataset2",H5R_DATASET_REGION,sid2);
+ ret = H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type(dset1,H5R_DATASET_REGION,&wbuf[0]);
- VERIFY(ret, H5G_DATASET, "H5Rget_obj_type");
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
/* Select sequence of ten points for second reference */
- coord1[0][0]=6; coord1[0][1]=9;
- coord1[1][0]=2; coord1[1][1]=2;
- coord1[2][0]=8; coord1[2][1]=4;
- coord1[3][0]=1; coord1[3][1]=6;
- coord1[4][0]=2; coord1[4][1]=8;
- coord1[5][0]=3; coord1[5][1]=2;
- coord1[6][0]=0; coord1[6][1]=4;
- coord1[7][0]=9; coord1[7][1]=0;
- coord1[8][0]=7; coord1[8][1]=1;
- coord1[9][0]=3; coord1[9][1]=3;
+ coord1[0][0] = 6; coord1[0][1] = 9;
+ coord1[1][0] = 2; coord1[1][1] = 2;
+ coord1[2][0] = 8; coord1[2][1] = 4;
+ coord1[3][0] = 1; coord1[3][1] = 6;
+ coord1[4][0] = 2; coord1[4][1] = 8;
+ coord1[5][0] = 3; coord1[5][1] = 2;
+ coord1[6][0] = 0; coord1[6][1] = 4;
+ coord1[7][0] = 9; coord1[7][1] = 0;
+ coord1[8][0] = 7; coord1[8][1] = 1;
+ coord1[9][0] = 3; coord1[9][1] = 3;
ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
@@ -405,11 +414,11 @@ test_reference_region(void)
VERIFY(ret, 10, "H5Sget_select_npoints");
/* Store second dataset region */
- ret = H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid2);
+ ret = H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
CHECK(ret, FAIL, "H5Rcreate");
/* Write selection to disk */
- ret=H5Dwrite(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close disk dataspace */
@@ -433,37 +442,38 @@ test_reference_region(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
- dset1=H5Dopen(fid1,"/Dataset1");
+ dset1 = H5Dopen(fid1,"/Dataset1");
CHECK(dset1, FAIL, "H5Dopen");
/* Read selection from disk */
- ret=H5Dread(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Try to open objects */
- dset2 = H5Rdereference(dset1,H5R_DATASET_REGION,&rbuf[0]);
+ dset2 = H5Rdereference(dset1, H5R_DATASET_REGION, &rbuf[0]);
CHECK(dset2, FAIL, "H5Rdereference");
- /* Check what H5Rget_obj_type function returns */
- ret = H5Rget_obj_type(dset1, H5R_DATASET_REGION,&rbuf[0]);
- VERIFY(ret, H5G_DATASET, "H5Rget_obj_type");
+ /* Check what H5Rget_obj_type2 function returns */
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
/* Check information in referenced dataset */
sid1 = H5Dget_space(dset2);
CHECK(sid1, FAIL, "H5Dget_space");
- ret=(int)H5Sget_simple_extent_npoints(sid1);
+ ret = (int)H5Sget_simple_extent_npoints(sid1);
VERIFY(ret, 100, "H5Sget_simple_extent_npoints");
/* Read from disk */
- ret=H5Dread(dset2,H5T_STD_U8LE,H5S_ALL,H5S_ALL,H5P_DEFAULT,drbuf);
+ ret = H5Dread(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu8=(uint8_t *)drbuf,i=0; i<SPACE2_DIM1*SPACE2_DIM2; i++,tu8++)
- VERIFY(*tu8, (uint8_t)(i*3), "Data");
+ for(tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
+ VERIFY(*tu8, (uint8_t)(i * 3), "Data");
/* Get the hyperslab selection */
- sid2=H5Rget_region(dset1,H5R_DATASET_REGION,&rbuf[0]);
+ sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[0]);
CHECK(sid2, FAIL, "H5Rget_region");
/* Verify correct hyperslab selected */
@@ -471,15 +481,15 @@ test_reference_region(void)
VERIFY(ret, 36, "H5Sget_select_npoints");
ret = (int)H5Sget_select_hyper_nblocks(sid2);
VERIFY(ret, 1, "H5Sget_select_hyper_nblocks");
- coords=HDmalloc(ret*SPACE2_RANK*sizeof(hsize_t)*2); /* allocate space for the hyperslab blocks */
- ret = H5Sget_select_hyper_blocklist(sid2,(hsize_t)0,(hsize_t)ret,coords);
+ coords = HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+ ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
VERIFY(coords[0], 2, "Hyperslab Coordinates");
VERIFY(coords[1], 2, "Hyperslab Coordinates");
VERIFY(coords[2], 7, "Hyperslab Coordinates");
VERIFY(coords[3], 7, "Hyperslab Coordinates");
HDfree(coords);
- ret = H5Sget_select_bounds(sid2,low,high);
+ ret = H5Sget_select_bounds(sid2, low, high);
CHECK(ret, FAIL, "H5Sget_select_bounds");
VERIFY(low[0], 2, "Selection Bounds");
VERIFY(low[1], 2, "Selection Bounds");
@@ -491,7 +501,7 @@ test_reference_region(void)
CHECK(ret, FAIL, "H5Sclose");
/* Get the element selection */
- sid2=H5Rget_region(dset1,H5R_DATASET_REGION,&rbuf[1]);
+ sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[1]);
CHECK(sid2, FAIL, "H5Rget_region");
/* Verify correct elements selected */
@@ -499,8 +509,8 @@ test_reference_region(void)
VERIFY(ret, 10, "H5Sget_select_npoints");
ret = (int)H5Sget_select_elem_npoints(sid2);
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords=HDmalloc(ret*SPACE2_RANK*sizeof(hsize_t)); /* allocate space for the element points */
- ret = H5Sget_select_elem_pointlist(sid2,(hsize_t)0,(hsize_t)ret,coords);
+ coords = HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+ ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
VERIFY(coords[1], coord1[0][1], "Element Coordinates");
@@ -523,7 +533,7 @@ test_reference_region(void)
VERIFY(coords[18], coord1[9][0], "Element Coordinates");
VERIFY(coords[19], coord1[9][1], "Element Coordinates");
HDfree(coords);
- ret = H5Sget_select_bounds(sid2,low,high);
+ ret = H5Sget_select_bounds(sid2, low, high);
CHECK(ret, FAIL, "H5Sget_select_bounds");
VERIFY(low[0], 0, "Selection Bounds");
VERIFY(low[1], 0, "Selection Bounds");
@@ -543,10 +553,12 @@ test_reference_region(void)
CHECK(ret, FAIL, "H5Dclose");
/* Attempting to retrieve type of object using non-valid refs */
- for (j=0; j<3; j++){
- ret = H5Rget_obj_type(dset1,H5R_DATASET_REGION,&nvrbuf[j]);
- VERIFY(ret, H5G_UNKNOWN, "H5Rget_obj_type");
- }
+ for(j = 0; j < 3; j++) {
+ H5E_BEGIN_TRY {
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &nvrbuf[j], &obj_type);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Rget_obj_type2");
+ } /* end for */
/* Close Dataset */
ret = H5Dclose(dset1);
@@ -592,6 +604,7 @@ test_reference_region_1D(void)
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
*drbuf; /* Buffer for reading numeric data from disk */
uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Object type */
int i; /* counting variables */
herr_t ret; /* Generic return value */
@@ -613,14 +626,14 @@ test_reference_region_1D(void)
CHECK(sid3, FAIL, "H5Screate_simple");
/* Create a dataset */
- dset3=H5Dcreate(fid1,"Dataset2",H5T_STD_U8LE,sid3,H5P_DEFAULT);
+ dset3 = H5Dcreate(fid1, "Dataset2", H5T_STD_U8LE, sid3, H5P_DEFAULT);
CHECK(dset3, FAIL, "H5Dcreate");
- for(tu8=dwbuf,i=0; i<SPACE3_DIM1; i++)
- *tu8++=i*3;
+ for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
+ *tu8++ = i * 3;
/* Write selection to disk */
- ret=H5Dwrite(dset3,H5T_STD_U8LE,H5S_ALL,H5S_ALL,H5P_DEFAULT,dwbuf);
+ ret = H5Dwrite(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -632,39 +645,40 @@ test_reference_region_1D(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dset1=H5Dcreate(fid1,"Dataset1",H5T_STD_REF_DSETREG,sid1,H5P_DEFAULT);
+ dset1 = H5Dcreate(fid1, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Dcreate");
/* Create references */
/* Select 15 2x1 hyperslabs for first reference */
- start[0]=2;
- stride[0]=5;
- count[0]=15;
- block[0]=2;
- ret = H5Sselect_hyperslab(sid3,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2;
+ stride[0] = 5;
+ count[0] = 15;
+ block[0] = 2;
+ ret = H5Sselect_hyperslab(sid3, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
ret = (int)H5Sget_select_npoints(sid3);
VERIFY(ret, 30, "H5Sget_select_npoints");
/* Store first dataset region */
- ret = H5Rcreate(&wbuf[0],fid1,"/Dataset2",H5R_DATASET_REGION,sid3);
+ ret = H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid3);
CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type(dset1,H5R_DATASET_REGION,&wbuf[0]);
- VERIFY(ret, H5G_DATASET, "H5Rget_obj_type");
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
/* Select sequence of ten points for second reference */
- coord1[0][0]=16;
- coord1[1][0]=22;
- coord1[2][0]=38;
- coord1[3][0]=41;
- coord1[4][0]=52;
- coord1[5][0]=63;
- coord1[6][0]=70;
- coord1[7][0]=89;
- coord1[8][0]=97;
- coord1[9][0]=03;
+ coord1[0][0] = 16;
+ coord1[1][0] = 22;
+ coord1[2][0] = 38;
+ coord1[3][0] = 41;
+ coord1[4][0] = 52;
+ coord1[5][0] = 63;
+ coord1[6][0] = 70;
+ coord1[7][0] = 89;
+ coord1[8][0] = 97;
+ coord1[9][0] = 03;
ret = H5Sselect_elements(sid3, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
@@ -672,11 +686,11 @@ test_reference_region_1D(void)
VERIFY(ret, 10, "H5Sget_select_npoints");
/* Store second dataset region */
- ret = H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid3);
+ ret = H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid3);
CHECK(ret, FAIL, "H5Rcreate");
/* Write selection to disk */
- ret=H5Dwrite(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close disk dataspace */
@@ -700,37 +714,38 @@ test_reference_region_1D(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
- dset1=H5Dopen(fid1,"/Dataset1");
+ dset1 = H5Dopen(fid1, "/Dataset1");
CHECK(dset1, FAIL, "H5Dopen");
/* Read selection from disk */
- ret=H5Dread(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Try to open objects */
- dset3 = H5Rdereference(dset1,H5R_DATASET_REGION,&rbuf[0]);
+ dset3 = H5Rdereference(dset1, H5R_DATASET_REGION, &rbuf[0]);
CHECK(dset3, FAIL, "H5Rdereference");
- /* Check what H5Rget_obj_type function returns */
- ret = H5Rget_obj_type(dset1, H5R_DATASET_REGION,&rbuf[0]);
- VERIFY(ret, H5G_DATASET, "H5Rget_obj_type");
+ /* Check what H5Rget_obj_type2 function returns */
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
/* Check information in referenced dataset */
sid1 = H5Dget_space(dset3);
CHECK(sid1, FAIL, "H5Dget_space");
- ret=(int)H5Sget_simple_extent_npoints(sid1);
+ ret = (int)H5Sget_simple_extent_npoints(sid1);
VERIFY(ret, 100, "H5Sget_simple_extent_npoints");
/* Read from disk */
- ret=H5Dread(dset3,H5T_STD_U8LE,H5S_ALL,H5S_ALL,H5P_DEFAULT,drbuf);
+ ret = H5Dread(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu8=(uint8_t *)drbuf,i=0; i<SPACE3_DIM1; i++,tu8++)
- VERIFY(*tu8, (uint8_t)(i*3), "Data");
+ for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
+ VERIFY(*tu8, (uint8_t)(i * 3), "Data");
/* Get the hyperslab selection */
- sid3=H5Rget_region(dset1,H5R_DATASET_REGION,&rbuf[0]);
+ sid3 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[0]);
CHECK(sid3, FAIL, "H5Rget_region");
/* Verify correct hyperslab selected */
@@ -738,41 +753,41 @@ test_reference_region_1D(void)
VERIFY(ret, 30, "H5Sget_select_npoints");
ret = (int)H5Sget_select_hyper_nblocks(sid3);
VERIFY(ret, 15, "H5Sget_select_hyper_nblocks");
- coords=HDmalloc(ret*SPACE3_RANK*sizeof(hsize_t)*2); /* allocate space for the hyperslab blocks */
- ret = H5Sget_select_hyper_blocklist(sid3,(hsize_t)0,(hsize_t)ret,coords);
+ coords = HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+ ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
- VERIFY(coords[0], 2, "Hyperslab Coordinates");
- VERIFY(coords[1], 3, "Hyperslab Coordinates");
- VERIFY(coords[2], 7, "Hyperslab Coordinates");
- VERIFY(coords[3], 8, "Hyperslab Coordinates");
- VERIFY(coords[4],12, "Hyperslab Coordinates");
- VERIFY(coords[5],13, "Hyperslab Coordinates");
- VERIFY(coords[6],17, "Hyperslab Coordinates");
- VERIFY(coords[7],18, "Hyperslab Coordinates");
- VERIFY(coords[8],22, "Hyperslab Coordinates");
- VERIFY(coords[9],23, "Hyperslab Coordinates");
- VERIFY(coords[10],27, "Hyperslab Coordinates");
- VERIFY(coords[11],28, "Hyperslab Coordinates");
- VERIFY(coords[12],32, "Hyperslab Coordinates");
- VERIFY(coords[13],33, "Hyperslab Coordinates");
- VERIFY(coords[14],37, "Hyperslab Coordinates");
- VERIFY(coords[15],38, "Hyperslab Coordinates");
- VERIFY(coords[16],42, "Hyperslab Coordinates");
- VERIFY(coords[17],43, "Hyperslab Coordinates");
- VERIFY(coords[18],47, "Hyperslab Coordinates");
- VERIFY(coords[19],48, "Hyperslab Coordinates");
- VERIFY(coords[20],52, "Hyperslab Coordinates");
- VERIFY(coords[21],53, "Hyperslab Coordinates");
- VERIFY(coords[22],57, "Hyperslab Coordinates");
- VERIFY(coords[23],58, "Hyperslab Coordinates");
- VERIFY(coords[24],62, "Hyperslab Coordinates");
- VERIFY(coords[25],63, "Hyperslab Coordinates");
- VERIFY(coords[26],67, "Hyperslab Coordinates");
- VERIFY(coords[27],68, "Hyperslab Coordinates");
- VERIFY(coords[28],72, "Hyperslab Coordinates");
- VERIFY(coords[29],73, "Hyperslab Coordinates");
+ VERIFY(coords[0], 2, "Hyperslab Coordinates");
+ VERIFY(coords[1], 3, "Hyperslab Coordinates");
+ VERIFY(coords[2], 7, "Hyperslab Coordinates");
+ VERIFY(coords[3], 8, "Hyperslab Coordinates");
+ VERIFY(coords[4], 12, "Hyperslab Coordinates");
+ VERIFY(coords[5], 13, "Hyperslab Coordinates");
+ VERIFY(coords[6], 17, "Hyperslab Coordinates");
+ VERIFY(coords[7], 18, "Hyperslab Coordinates");
+ VERIFY(coords[8], 22, "Hyperslab Coordinates");
+ VERIFY(coords[9], 23, "Hyperslab Coordinates");
+ VERIFY(coords[10], 27, "Hyperslab Coordinates");
+ VERIFY(coords[11], 28, "Hyperslab Coordinates");
+ VERIFY(coords[12], 32, "Hyperslab Coordinates");
+ VERIFY(coords[13], 33, "Hyperslab Coordinates");
+ VERIFY(coords[14], 37, "Hyperslab Coordinates");
+ VERIFY(coords[15], 38, "Hyperslab Coordinates");
+ VERIFY(coords[16], 42, "Hyperslab Coordinates");
+ VERIFY(coords[17], 43, "Hyperslab Coordinates");
+ VERIFY(coords[18], 47, "Hyperslab Coordinates");
+ VERIFY(coords[19], 48, "Hyperslab Coordinates");
+ VERIFY(coords[20], 52, "Hyperslab Coordinates");
+ VERIFY(coords[21], 53, "Hyperslab Coordinates");
+ VERIFY(coords[22], 57, "Hyperslab Coordinates");
+ VERIFY(coords[23], 58, "Hyperslab Coordinates");
+ VERIFY(coords[24], 62, "Hyperslab Coordinates");
+ VERIFY(coords[25], 63, "Hyperslab Coordinates");
+ VERIFY(coords[26], 67, "Hyperslab Coordinates");
+ VERIFY(coords[27], 68, "Hyperslab Coordinates");
+ VERIFY(coords[28], 72, "Hyperslab Coordinates");
+ VERIFY(coords[29], 73, "Hyperslab Coordinates");
HDfree(coords);
- ret = H5Sget_select_bounds(sid3,low,high);
+ ret = H5Sget_select_bounds(sid3, low, high);
CHECK(ret, FAIL, "H5Sget_select_bounds");
VERIFY(low[0], 2, "Selection Bounds");
VERIFY(high[0], 73, "Selection Bounds");
@@ -782,7 +797,7 @@ test_reference_region_1D(void)
CHECK(ret, FAIL, "H5Sclose");
/* Get the element selection */
- sid3=H5Rget_region(dset1,H5R_DATASET_REGION,&rbuf[1]);
+ sid3 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[1]);
CHECK(sid3, FAIL, "H5Rget_region");
/* Verify correct elements selected */
@@ -790,8 +805,8 @@ test_reference_region_1D(void)
VERIFY(ret, 10, "H5Sget_select_npoints");
ret = (int)H5Sget_select_elem_npoints(sid3);
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords=HDmalloc(ret*SPACE3_RANK*sizeof(hsize_t)); /* allocate space for the element points */
- ret = H5Sget_select_elem_pointlist(sid3,(hsize_t)0,(hsize_t)ret,coords);
+ coords = HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+ ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
VERIFY(coords[1], coord1[1][0], "Element Coordinates");
@@ -804,7 +819,7 @@ test_reference_region_1D(void)
VERIFY(coords[8], coord1[8][0], "Element Coordinates");
VERIFY(coords[9], coord1[9][0], "Element Coordinates");
HDfree(coords);
- ret = H5Sget_select_bounds(sid3,low,high);
+ ret = H5Sget_select_bounds(sid3, low, high);
CHECK(ret, FAIL, "H5Sget_select_bounds");
VERIFY(low[0], 3, "Selection Bounds");
VERIFY(high[0], 97, "Selection Bounds");
@@ -850,6 +865,7 @@ test_reference_obj_deleted(void)
dset2; /* Dereferenced dataset ID */
hid_t sid1; /* Dataspace ID */
hobj_ref_t oref; /* Object Reference to test */
+ H5O_type_t obj_type; /* Object type */
herr_t ret; /* Generic return value */
/* Create file */
@@ -861,7 +877,7 @@ test_reference_obj_deleted(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset to reference (deleted later) */
- dataset=H5Dcreate(fid1,"Dataset1",H5T_NATIVE_INT,sid1,H5P_DEFAULT);
+ dataset = H5Dcreate(fid1, "Dataset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
/* Close Dataset */
@@ -869,17 +885,18 @@ test_reference_obj_deleted(void)
CHECK(ret, FAIL, "H5Dclose");
/* Create a dataset */
- dataset=H5Dcreate(fid1,"Dataset2",H5T_STD_REF_OBJ,sid1,H5P_DEFAULT);
+ dataset = H5Dcreate(fid1, "Dataset2", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
/* Create reference to dataset */
- ret = H5Rcreate(&oref,fid1,"/Dataset1",H5R_OBJECT,-1);
+ ret = H5Rcreate(&oref, fid1, "/Dataset1", H5R_OBJECT, -1);
CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type(dataset,H5R_OBJECT,&oref);
- VERIFY(ret, H5G_DATASET, "H5Rget_obj_type");
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &oref, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_STD_REF_OBJ,H5S_ALL,H5S_ALL,H5P_DEFAULT,&oref);
+ ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &oref);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -903,21 +920,21 @@ test_reference_obj_deleted(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
- dataset=H5Dopen(fid1,"/Dataset2");
- CHECK(ret, FAIL, "H5Dcreate");
+ dataset = H5Dopen(fid1, "/Dataset2");
+ CHECK(ret, FAIL, "H5Dopen");
/* Read selection from disk */
- memset(&oref,0,sizeof(hobj_ref_t));
- ret=H5Dread(dataset,H5T_STD_REF_OBJ,H5S_ALL,H5S_ALL,H5P_DEFAULT,&oref);
+ HDmemset(&oref, 0, sizeof(hobj_ref_t));
+ ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &oref);
CHECK(ret, FAIL, "H5Dread");
/* Open deleted dataset object */
- dset2 = H5Rdereference(dataset,H5R_OBJECT,&oref);
+ dset2 = H5Rdereference(dataset, H5R_OBJECT, &oref);
VERIFY(dset2, FAIL, "H5Rdereference");
/* Open nonsense reference */
- memset(&oref,0,sizeof(hobj_ref_t));
- dset2 = H5Rdereference(dataset,H5R_OBJECT,&oref);
+ HDmemset(&oref, 0, sizeof(hobj_ref_t));
+ dset2 = H5Rdereference(dataset, H5R_OBJECT, &oref);
VERIFY(dset2, FAIL, "H5Rdereference");
/* Close Dataset */
@@ -927,7 +944,6 @@ test_reference_obj_deleted(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
} /* test_reference_obj_deleted() */
/****************************************************************
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index f83a36d..f6dbd2b 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -117,7 +117,6 @@ static int not_comparable;
* local prototypes
*-------------------------------------------------------------------------
*/
-static void close_obj(H5G_obj_t obj_type, hid_t obj_id);
static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id,hid_t region1_id, hid_t region2_id, diff_opt_t *options);
static hbool_t all_zero(const void *_mem, size_t size);
static int ull2float(unsigned long_long ull_value, float *f_value);
@@ -435,8 +434,6 @@ hsize_t diff_datum(void *_mem1,
size_t size=0;
int iszero1;
int iszero2;
- H5G_obj_t obj1_type;
- H5G_obj_t obj2_type;
hid_t obj1_id;
hid_t obj2_id;
hsize_t nfound=0; /* differences found */
@@ -746,8 +743,8 @@ hsize_t diff_datum(void *_mem1,
nfound = diff_region(obj1_id,obj2_id,region1_id,region2_id,options);
- close_obj(H5G_DATASET,obj1_id);
- close_obj(H5G_DATASET,obj2_id);
+ H5Oclose(obj1_id);
+ H5Oclose(obj2_id);
H5Sclose(region1_id);
H5Sclose(region2_id);
@@ -761,51 +758,50 @@ hsize_t diff_datum(void *_mem1,
*/
else if (H5Tequal(m_type, H5T_STD_REF_OBJ))
{
-
- if ((obj1_type = H5Rget_obj_type(container1_id, H5R_OBJECT, _mem1))<0)
- ret= -1;
- if ((obj2_type = H5Rget_obj_type(container2_id, H5R_OBJECT, _mem2))<0)
- ret= -1;
- if (ret==-1) {
- options->err_stat=1;
+ H5O_type_t obj1_type;
+ H5O_type_t obj2_type;
+
+ if(H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0)
+ ret = -1;
+ if(H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0)
+ ret = -1;
+ if(ret == -1) {
+ options->err_stat = 1;
return 0;
- }
+ } /* end if */
/* check object type */
- if (obj1_type!=obj2_type)
+ if(obj1_type != obj2_type)
{
parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2);
- options->not_cmp=1;
+ options->not_cmp = 1;
return 0;
}
- if ((obj1_id = H5Rdereference(container1_id, H5R_OBJECT, _mem1))<0)
- ret= -1;
- if ((obj2_id = H5Rdereference(container2_id, H5R_OBJECT, _mem2))<0)
- ret= -1;
- if (ret==-1) {
- options->err_stat=1;
+ if((obj1_id = H5Rdereference(container1_id, H5R_OBJECT, _mem1)) < 0)
+ ret = -1;
+ if((obj2_id = H5Rdereference(container2_id, H5R_OBJECT, _mem2)) < 0)
+ ret = -1;
+ if(ret == -1) {
+ options->err_stat = 1;
return 0;
- }
+ } /* end if */
/* compare */
- switch (obj1_type) {
- case H5G_DATASET:
- nfound=diff_datasetid(obj1_id,
+ if(obj1_type == H5O_TYPE_DATASET)
+ nfound = diff_datasetid(obj1_id,
obj2_id,
NULL,
NULL,
options);
- break;
- default:
+ else {
parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>",
obj1, obj2);
- options->not_cmp=1;
- break;
+ options->not_cmp = 1;
}
- close_obj(obj1_type,obj1_id);
- close_obj(obj2_type,obj2_id);
+ H5Oclose(obj1_id);
+ H5Oclose(obj2_id);
}/*object reference*/
@@ -2075,39 +2071,13 @@ hsize_t diff_datum(void *_mem1,
static hbool_t all_zero(const void *_mem, size_t size)
{
- const unsigned char *mem = (const unsigned char *)_mem;
+ const unsigned char *mem = (const unsigned char *)_mem;
- while (size-- > 0)
- if (mem[size])
- return FALSE;
+ while(size-- > 0)
+ if(mem[size])
+ return FALSE;
- return TRUE;
-}
-
-/*-------------------------------------------------------------------------
- * Function: close_obj
- *
- * Purpose: Auxialiary function to close an object
- *
- *-------------------------------------------------------------------------
- */
-
-static void close_obj(H5G_obj_t obj_type, hid_t obj_id)
-{
- switch (obj_type) {
- case H5G_GROUP:
- H5Gclose(obj_id);
- break;
- case H5G_DATASET:
- H5Dclose(obj_id);
- break;
- case H5G_TYPE:
- H5Tclose(obj_id);
- break;
- default:
- assert(0);
- break;
- }
+ return TRUE;
}
/*-------------------------------------------------------------------------