summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5diff_array.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-09-14 01:52:38 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-09-14 01:52:38 (GMT)
commit94153c6c3d776ac172f5151155acee6b64131526 (patch)
tree456c655e4a1cb0931956b5a961d4f8e805c40578 /tools/lib/h5diff_array.c
parentbe12aa63a0a210da111b0d31dde44c2c665c7165 (diff)
downloadhdf5-94153c6c3d776ac172f5151155acee6b64131526.zip
hdf5-94153c6c3d776ac172f5151155acee6b64131526.tar.gz
hdf5-94153c6c3d776ac172f5151155acee6b64131526.tar.bz2
[svn-r14148] Description:
Add H5Rget_obj_type() to the API versioning and switch internal routines to use H5Rget_obj_type2() Misc. other code cleanups, etc. Tested on: FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty) Linux/32 2.6 (kagiso) Linux/64 2.6 (smirom) AIX/32 5.3 (copper) Solaris/32 2.10 (linew) Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'tools/lib/h5diff_array.c')
-rw-r--r--tools/lib/h5diff_array.c94
1 files changed, 32 insertions, 62 deletions
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;
}
/*-------------------------------------------------------------------------