summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-08 19:59:36 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-08 19:59:36 (GMT)
commit16683943c6edb42f9129cc5d6c8f340c74014dad (patch)
treed1ed13b0b7677e56d4253b4fe5e0640f851e27ca /tools
parentd3ee3988b68292524b3a893b9db55c074f4b9e87 (diff)
downloadhdf5-16683943c6edb42f9129cc5d6c8f340c74014dad.zip
hdf5-16683943c6edb42f9129cc5d6c8f340c74014dad.tar.gz
hdf5-16683943c6edb42f9129cc5d6c8f340c74014dad.tar.bz2
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2 Add simple regression test for H5Dopen1 Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/h5dump.c49
-rw-r--r--tools/h5repack/Makefile.am4
-rw-r--r--tools/h5repack/h5repack_copy.c68
-rw-r--r--tools/h5repack/h5repack_list.c72
-rw-r--r--tools/h5repack/h5repack_refs.c14
-rw-r--r--tools/h5repack/h5repack_verify.c125
-rw-r--r--tools/h5stat/h5stat.c2
-rw-r--r--tools/lib/h5diff_attr.c6
-rw-r--r--tools/lib/h5diff_dset.c42
-rw-r--r--tools/lib/h5tools_utils.c4
-rw-r--r--tools/lib/talign.c6
11 files changed, 179 insertions, 213 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index d9a1506..8ca611b 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -1433,7 +1433,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
break;
case H5O_TYPE_DATASET:
- if((obj = H5Dopen(group, name)) >= 0) {
+ if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) {
if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */
@@ -1843,8 +1843,7 @@ dump_group(hid_t gid, const char *name)
d_status = EXIT_FAILURE;
}
- if(H5Pclose(gcpl_id) < 0)
- {
+ if(H5Pclose(gcpl_id) < 0) {
error_msg(progname, "error in closing group creation property list ID\n");
d_status = EXIT_FAILURE;
}
@@ -1856,20 +1855,18 @@ dump_group(hid_t gid, const char *name)
begin_obj(dump_header_format->groupbegin, name, dump_header_format->groupblockbegin);
indent += COL;
- if (display_oid)
+ if(display_oid)
dump_oid(gid);
dump_comment(gid);
- if (!HDstrcmp(name, "/") && unamedtype)
- {
+ if(!HDstrcmp(name, "/") && unamedtype) {
unsigned u; /* Local index variable */
/* dump unamed type in root group */
- for (u = 0; u < type_table->nobjs; u++)
- if (!type_table->objs[u].recorded)
- {
- dset = H5Dopen(gid, type_table->objs[u].objname);
+ for(u = 0; u < type_table->nobjs; u++)
+ if(!type_table->objs[u].recorded) {
+ dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
@@ -1880,26 +1877,22 @@ dump_group(hid_t gid, const char *name)
H5Oget_info(gid, ".", &oinfo, H5P_DEFAULT);
- if(oinfo.rc > 1)
- {
+ if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */
found_obj = search_obj(group_table, oinfo.addr);
- if (found_obj == NULL)
- {
+ if (found_obj == NULL) {
indentation(indent);
error_msg(progname, "internal error (file %s:line %d)\n",
__FILE__, __LINE__);
d_status = EXIT_FAILURE;
}
- else if (found_obj->displayed)
- {
+ else if (found_obj->displayed) {
indentation(indent);
printf("%s \"%s\"\n", HARDLINK, found_obj->objname);
}
- else
- {
+ else {
found_obj->displayed = TRUE;
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
@@ -3153,7 +3146,7 @@ handle_datasets(hid_t fid, char *dset, void *data)
hid_t dsetid;
struct subset_t *sset = (struct subset_t *)data;
- if ((dsetid = H5Dopen(fid, dset)) < 0) {
+ if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) {
begin_obj(dump_header_format->datasetbegin, dset,
dump_header_format->datasetblockbegin);
indentation(COL);
@@ -3162,20 +3155,20 @@ handle_datasets(hid_t fid, char *dset, void *data)
dump_header_format->datasetblockend);
d_status = EXIT_FAILURE;
return;
- }
+ } /* end if */
- if (sset) {
- if (!sset->start || !sset->stride || !sset->count || !sset->block) {
+ if(sset) {
+ if(!sset->start || !sset->stride || !sset->count || !sset->block) {
/* they didn't specify a ``stride'' or ``block''. default to 1 in all
* dimensions */
hid_t sid = H5Dget_space(dsetid);
unsigned int ndims = H5Sget_simple_extent_ndims(sid);
- if (!sset->start)
+ if(!sset->start)
/* default to (0, 0, ...) for the start coord */
sset->start = calloc(ndims, sizeof(hsize_t));
- if (!sset->stride) {
+ if(!sset->stride) {
unsigned int i;
sset->stride = calloc(ndims, sizeof(hsize_t));
@@ -3419,7 +3412,7 @@ handle_datatypes(hid_t fid, char *type, void UNUSED * data)
idx++;
} /* end while */
- if(idx == type_table->nobjs) {
+ if(idx == type_table->nobjs) {
/* unknown type */
begin_obj(dump_header_format->datatypebegin, type,
dump_header_format->datatypeblockbegin);
@@ -3429,7 +3422,7 @@ handle_datatypes(hid_t fid, char *type, void UNUSED * data)
dump_header_format->datatypeblockend);
d_status = EXIT_FAILURE;
} else {
- hid_t dsetid = H5Dopen(fid, type_table->objs[idx].objname);
+ hid_t dsetid = H5Dopen2(fid, type_table->objs[idx].objname, H5P_DEFAULT);
type_id = H5Dget_type(dsetid);
dump_named_datatype(type_id, type);
H5Tclose(type_id);
@@ -5371,7 +5364,7 @@ xml_dump_group(hid_t gid, const char *name)
/* Very special case: dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++) {
if(!type_table->objs[u].recorded) {
- dset = H5Dopen(gid, type_table->objs[u].objname);
+ dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
@@ -5425,7 +5418,7 @@ xml_dump_group(hid_t gid, const char *name)
/* Very special case: dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++) {
if(!type_table->objs[u].recorded) {
- dset = H5Dopen(gid, type_table->objs[u].objname);
+ dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
diff --git a/tools/h5repack/Makefile.am b/tools/h5repack/Makefile.am
index a0fcdcc..e053e83 100644
--- a/tools/h5repack/Makefile.am
+++ b/tools/h5repack/Makefile.am
@@ -40,8 +40,8 @@ bin_PROGRAMS=h5repack
LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
# Source files
-COMMON_SOURCES=h5repack.c h5repack_copy.c h5repack_refs.c h5repack_filters.c \
- h5repack_list.c h5repack_opttable.c h5repack_parse.c \
+COMMON_SOURCES=h5repack.c h5repack_copy.c h5repack_filters.c \
+ h5repack_list.c h5repack_opttable.c h5repack_parse.c h5repack_refs.c \
h5repack_verify.c
h5repack_SOURCES=$(COMMON_SOURCES) h5repack_main.c
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 4a84ea6..fcb0854 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -417,16 +417,16 @@ int do_copy_objects(hid_t fidin,
* copy attrs
*-------------------------------------------------------------------------
*/
- if (copy_attr(grp_in,grp_out,options) < 0)
+ if(copy_attr(grp_in,grp_out,options) < 0)
goto error;
- if (gcpl_id>0) {
- if (H5Pclose(gcpl_id) < 0)
+ if(gcpl_id > 0) {
+ if(H5Pclose(gcpl_id) < 0)
goto error;
}
- if (H5Gclose(grp_out) < 0)
+ if(H5Gclose(grp_out) < 0)
goto error;
- if (H5Gclose(grp_in) < 0)
+ if(H5Gclose(grp_in) < 0)
goto error;
break;
@@ -440,15 +440,15 @@ int do_copy_objects(hid_t fidin,
has_filter = 0;
/* early detection of references */
- if ((dset_in=H5Dopen(fidin,travt->objs[i].name)) < 0)
+ if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
- if ((ftype_id=H5Dget_type (dset_in)) < 0)
+ if((ftype_id = H5Dget_type(dset_in)) < 0)
goto error;
- if (H5T_REFERENCE==H5Tget_class(ftype_id))
- is_ref=1;
- if (H5Tclose(ftype_id) < 0)
+ if(H5T_REFERENCE == H5Tget_class(ftype_id))
+ is_ref = 1;
+ if(H5Tclose(ftype_id) < 0)
goto error;
- if (H5Dclose(dset_in) < 0)
+ if(H5Dclose(dset_in) < 0)
goto error;
@@ -458,39 +458,35 @@ int do_copy_objects(hid_t fidin,
* otherwise we do a copy using H5Ocopy
*-------------------------------------------------------------------------
*/
- if (options->op_tbl->nelems
- ||
- options->all_filter==1 || options->all_layout==1
- || is_ref
- )
- {
+ if(options->op_tbl->nelems || options->all_filter == 1
+ || options->all_layout == 1 || is_ref) {
int j;
- if ((dset_in=H5Dopen(fidin,travt->objs[i].name)) < 0)
+ if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
- if ((f_space_id=H5Dget_space(dset_in)) < 0)
+ if((f_space_id = H5Dget_space(dset_in)) < 0)
goto error;
- if ((ftype_id=H5Dget_type (dset_in)) < 0)
+ if((ftype_id = H5Dget_type(dset_in)) < 0)
goto error;
- if ((dcpl_id=H5Dget_create_plist(dset_in)) < 0)
+ if((dcpl_id = H5Dget_create_plist(dset_in)) < 0)
goto error;
- if ((dcpl_out = H5Pcopy (dcpl_id)) < 0)
+ if((dcpl_out = H5Pcopy(dcpl_id)) < 0)
goto error;
- if ( (rank=H5Sget_simple_extent_ndims(f_space_id)) < 0)
+ if((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0)
goto error;
HDmemset(dims, 0, sizeof dims);
- if ( H5Sget_simple_extent_dims(f_space_id,dims,NULL) < 0)
+ if(H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0)
goto error;
- nelmts=1;
- for (j=0; j<rank; j++)
- nelmts*=dims[j];
+ nelmts = 1;
+ for(j = 0; j < rank; j++)
+ nelmts *= dims[j];
- if (options->use_native==1)
+ if(options->use_native == 1)
wtype_id = h5tools_get_native_type(ftype_id);
else
wtype_id = H5Tcopy(ftype_id);
- if ((msize=H5Tget_size(wtype_id))==0)
+ if((msize = H5Tget_size(wtype_id)) == 0)
goto error;
/*-------------------------------------------------------------------------
@@ -743,7 +739,7 @@ int do_copy_objects(hid_t fidin,
*-------------------------------------------------------------------------
*/
- if (H5Ocopy(fidin, /* Source file or group identifier */
+ if(H5Ocopy(fidin, /* Source file or group identifier */
travt->objs[i].name, /* Name of the source object to be copied */
fidout, /* Destination file or group identifier */
travt->objs[i].name, /* Name of the destination object */
@@ -752,7 +748,7 @@ int do_copy_objects(hid_t fidin,
goto error;
/* close property */
- if (H5Pclose(pid) < 0)
+ if(H5Pclose(pid) < 0)
goto error;
@@ -760,15 +756,15 @@ int do_copy_objects(hid_t fidin,
* copy attrs manually
*-------------------------------------------------------------------------
*/
- if ((dset_in=H5Dopen(fidin,travt->objs[i].name)) < 0)
+ if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
- if ((dset_out=H5Dopen(fidout,travt->objs[i].name)) < 0)
+ if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
- if (copy_attr(dset_in,dset_out,options) < 0)
+ if(copy_attr(dset_in, dset_out, options) < 0)
goto error;
- if (H5Dclose(dset_in) < 0)
+ if(H5Dclose(dset_in) < 0)
goto error;
- if (H5Dclose(dset_out) < 0)
+ if(H5Dclose(dset_out) < 0)
goto error;
} /* end do we have request for filter/chunking */
diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c
index 4bbfd59..4e1e072 100644
--- a/tools/h5repack/h5repack_list.c
+++ b/tools/h5repack/h5repack_list.c
@@ -43,17 +43,17 @@ int check_objects(const char* fname,
{
hid_t fid;
unsigned int i;
- trav_table_t *travt=NULL;
+ trav_table_t *travt = NULL;
/* nothing to do */
- if (options->op_tbl->nelems==0)
+ if(options->op_tbl->nelems == 0)
return 0;
/*-------------------------------------------------------------------------
* open the file
*-------------------------------------------------------------------------
*/
- if ((fid=h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0))<0){
+ if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0){
printf("<%s>: %s\n", fname, H5FOPENERROR );
return -1;
}
@@ -67,7 +67,7 @@ int check_objects(const char* fname,
trav_table_init(&travt);
/* get the list of objects in the file */
- if (h5trav_gettable(fid,travt)<0)
+ if(h5trav_gettable(fid, travt) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -75,80 +75,66 @@ int check_objects(const char* fname,
*-------------------------------------------------------------------------
*/
- if (options->verbose)
- {
- printf("Opening file <%s>. Searching for objects to modify...\n",fname);
- }
+ if(options->verbose)
+ printf("Opening file <%s>. Searching for objects to modify...\n", fname);
- for ( i = 0; i < options->op_tbl->nelems; i++)
- {
+ for(i = 0; i < options->op_tbl->nelems; i++) {
char* name=options->op_tbl->objs[i].path;
- if (options->verbose)
+ if(options->verbose)
printf(" <%s>",name);
/* the input object names are present in the file and are valid */
- if (h5trav_getindext(name,travt)<0)
- {
+ if(h5trav_getindext(name, travt) < 0) {
error_msg(progname, "%s Could not find <%s> in file <%s>. Exiting...\n",
(options->verbose?"\n":""),name,fname);
goto out;
}
- if (options->verbose)
+ if(options->verbose)
printf("...Found\n");
-
-
+
/* check for extra filter conditions */
- switch (options->op_tbl->objs[i].filter->filtn)
- {
-
+ switch(options->op_tbl->objs[i].filter->filtn) {
/* chunk size must be smaller than pixels per block */
- case H5Z_FILTER_SZIP:
+ case H5Z_FILTER_SZIP:
{
int j;
- int csize=1;
- int ppb=options->op_tbl->objs[i].filter->cd_values[0];
+ int csize = 1;
+ int ppb = options->op_tbl->objs[i].filter->cd_values[0];
hsize_t dims[H5S_MAX_RANK];
int rank;
hid_t did;
hid_t sid;
- if (options->op_tbl->objs[i].chunk.rank>0)
- {
- rank=options->op_tbl->objs[i].chunk.rank;
- for (j=0; j<rank; j++)
- csize*=(int)options->op_tbl->objs[i].chunk.chunk_lengths[j];
+ if(options->op_tbl->objs[i].chunk.rank > 0) {
+ rank = options->op_tbl->objs[i].chunk.rank;
+ for(j = 0; j < rank; j++)
+ csize *= (int)options->op_tbl->objs[i].chunk.chunk_lengths[j];
}
- else
- {
- if ((did=H5Dopen(fid,name))<0)
+ else {
+ if((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
goto out;
- if ((sid=H5Dget_space(did))<0)
+ if((sid = H5Dget_space(did)) < 0)
goto out;
- if ( (rank=H5Sget_simple_extent_ndims(sid))<0)
+ if((rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
HDmemset(dims, 0, sizeof dims);
- if ( H5Sget_simple_extent_dims(sid,dims,NULL)<0)
+ if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto out;
- for (j=0; j<rank; j++)
- csize*=(int)dims[j];
- if (H5Sclose(sid)<0)
+ for(j = 0; j < rank; j++)
+ csize *= (int)dims[j];
+ if(H5Sclose(sid) < 0)
goto out;
- if (H5Dclose(did)<0)
+ if(H5Dclose(did) < 0)
goto out;
}
- if (csize < ppb )
- {
+ if (csize < ppb ) {
printf(" <warning: SZIP settins, chunk size is smaller than pixels per block>\n");
goto out;
}
-
-
}
break;
-
}
-
} /* i */
/*-------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index 1f078c3..a1e9fb5 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -112,17 +112,17 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
case H5TRAV_TYPE_DATASET:
- if((dset_in = H5Dopen(fidin,travt->objs[i].name)) < 0)
+ if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
if((space_id = H5Dget_space(dset_in)) < 0)
goto error;
- if((ftype_id = H5Dget_type (dset_in)) < 0)
+ if((ftype_id = H5Dget_type(dset_in)) < 0)
goto error;
if((dcpl_id = H5Dget_create_plist(dset_in)) < 0)
goto error;
if((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
goto error;
- if(H5Sget_simple_extent_dims(space_id,dims,NULL) < 0)
+ if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0)
goto error;
nelmts = 1;
for(k = 0; k < rank; k++)
@@ -299,7 +299,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
else {
- if((dset_out = H5Dopen(fidout,travt->objs[i].name)) < 0)
+ if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
} /* end else */
@@ -388,9 +388,9 @@ error:
*
* Purpose: duplicate all referenced HDF5 located in attributes
* relative to LOC_IN, which is obtained either from
- * loc_id = H5Gopen2( fid, name, H5P_DEFAULT);
- * loc_id = H5Dopen( fid, name);
- * loc_id = H5Topen2( fid, name, H5P_DEFAULT);
+ * loc_id = H5Gopen2(fid, name, H5P_DEFAULT);
+ * loc_id = H5Dopen2(fid, name, H5P_DEFAULT);
+ * loc_id = H5Topen2(fid, name, H5P_DEFAULT);
*
* Return: 0, ok, -1 no
*
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index 04b856f..e87d318 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -52,7 +52,7 @@ has_filter(hid_t dcpl_id, H5Z_filter_t filtnin)
return 1;
/* get information about filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
return -1;
/* if we do not have filters and the requested filter is NONE, return 1 */
@@ -122,7 +122,7 @@ int has_layout(hid_t dcpl_id,
return 1;
/* check if we have filters in the input object */
- if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
return -1;
/* a non chunked layout was requested on a filtered object; avoid the test */
@@ -130,7 +130,7 @@ int has_layout(hid_t dcpl_id,
return 1;
/* get layout */
- if ((layout = H5Pget_layout(dcpl_id))<0)
+ if ((layout = H5Pget_layout(dcpl_id)) < 0)
return -1;
if (obj->layout != layout)
@@ -138,7 +138,7 @@ int has_layout(hid_t dcpl_id,
if (layout==H5D_CHUNKED)
{
- if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/))<0)
+ if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/)) < 0)
return -1;
if (obj->chunk.rank != rank)
return 0;
@@ -170,60 +170,58 @@ int h5repack_verify(const char *fname,
pack_opt_t *options)
{
hid_t fid; /* file ID */
- hid_t dset_id=-1; /* dataset ID */
- hid_t dcpl_id=-1; /* dataset creation property list ID */
- hid_t space_id=-1; /* space ID */
- int ret=1;
+ hid_t dset_id = -1; /* dataset ID */
+ hid_t dcpl_id = -1; /* dataset creation property list ID */
+ hid_t space_id = -1; /* space ID */
+ int ret = 1;
unsigned int i;
int j;
- trav_table_t *travt=NULL;
+ trav_table_t *travt = NULL;
/* open the file */
- if ((fid=H5Fopen(fname,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
+ if((fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
return -1;
- for ( i=0; i<options->op_tbl->nelems; i++)
- {
- char* name=options->op_tbl->objs[i].path;
+ for(i = 0; i < options->op_tbl->nelems; i++) {
+ char* name = options->op_tbl->objs[i].path;
pack_info_t *obj = &options->op_tbl->objs[i];
/*-------------------------------------------------------------------------
* open
*-------------------------------------------------------------------------
*/
- if ((dset_id=H5Dopen(fid,name))<0)
+ if((dset_id = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
goto error;
- if ((space_id=H5Dget_space(dset_id))<0)
+ if((space_id = H5Dget_space(dset_id)) < 0)
goto error;
- if ((dcpl_id=H5Dget_create_plist(dset_id))<0)
+ if((dcpl_id = H5Dget_create_plist(dset_id)) < 0)
goto error;
/*-------------------------------------------------------------------------
* filter check
*-------------------------------------------------------------------------
*/
- for ( j=0; j<obj->nfilters; j++)
- {
- if (has_filter(dcpl_id,obj->filter[j].filtn)==0)
- ret=0;
+ for(j = 0; j < obj->nfilters; j++) {
+ if(has_filter(dcpl_id, obj->filter[j].filtn) == 0)
+ ret = 0;
}
/*-------------------------------------------------------------------------
* layout check
*-------------------------------------------------------------------------
*/
- if ((obj->layout!=-1) && (has_layout(dcpl_id,obj)==0))
- ret=0;
+ if((obj->layout != -1) && (has_layout(dcpl_id, obj) == 0))
+ ret = 0;
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
- if (H5Pclose(dcpl_id)<0)
+ if(H5Pclose(dcpl_id) < 0)
goto error;
- if (H5Sclose(space_id)<0)
+ if (H5Sclose(space_id) < 0)
goto error;
- if (H5Dclose(dset_id)<0)
+ if (H5Dclose(dset_id) < 0)
goto error;
}
@@ -234,53 +232,50 @@ int h5repack_verify(const char *fname,
*-------------------------------------------------------------------------
*/
- if (options->all_filter==1 || options->all_layout==1)
- {
+ if(options->all_filter == 1 || options->all_layout == 1) {
/* init table */
trav_table_init(&travt);
/* get the list of objects in the file */
- if (h5trav_gettable(fid,travt)<0)
+ if(h5trav_gettable(fid, travt) < 0)
goto error;
- for ( i=0; i<travt->nobjs; i++)
- {
- char* name=travt->objs[i].name;
+ for(i = 0; i < travt->nobjs; i++) {
+ char *name = travt->objs[i].name;
- if ( travt->objs[i].type == H5TRAV_TYPE_DATASET) {
+ if(travt->objs[i].type == H5TRAV_TYPE_DATASET) {
/*-------------------------------------------------------------------------
* open
*-------------------------------------------------------------------------
*/
- if ((dset_id=H5Dopen(fid,name))<0)
+ if((dset_id = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
goto error;
- if ((space_id=H5Dget_space(dset_id))<0)
+ if((space_id = H5Dget_space(dset_id)) < 0)
goto error;
- if ((dcpl_id=H5Dget_create_plist(dset_id))<0)
+ if((dcpl_id = H5Dget_create_plist(dset_id)) < 0)
goto error;
/*-------------------------------------------------------------------------
* filter check
*-------------------------------------------------------------------------
*/
- if (options->all_filter==1 ){
- if (has_filter(dcpl_id,options->filter_g.filtn)==0)
- ret=0;
- }
+ if(options->all_filter == 1)
+ if(has_filter(dcpl_id, options->filter_g.filtn) == 0)
+ ret = 0;
/*-------------------------------------------------------------------------
* layout check
*-------------------------------------------------------------------------
*/
- if (options->all_layout==1){
+ if(options->all_layout == 1) {
pack_info_t pack;
init_packobject(&pack);
- pack.layout=options->layout_g;
- pack.chunk=options->chunk_g;
- if (has_layout(dcpl_id,&pack)==0)
- ret=0;
+ pack.layout = options->layout_g;
+ pack.chunk = options->chunk_g;
+ if(has_layout(dcpl_id, &pack) == 0)
+ ret = 0;
}
@@ -288,11 +283,11 @@ int h5repack_verify(const char *fname,
* close
*-------------------------------------------------------------------------
*/
- if (H5Pclose(dcpl_id)<0)
+ if (H5Pclose(dcpl_id) < 0)
goto error;
- if (H5Sclose(space_id)<0)
+ if (H5Sclose(space_id) < 0)
goto error;
- if (H5Dclose(dset_id)<0)
+ if (H5Dclose(dset_id) < 0)
goto error;
} /* if */
@@ -307,7 +302,7 @@ int h5repack_verify(const char *fname,
*-------------------------------------------------------------------------
*/
- if (H5Fclose(fid)<0)
+ if (H5Fclose(fid) < 0)
return -1;
return ret;
@@ -363,12 +358,12 @@ int h5repack_cmpdcpl(const char *fname1,
H5E_BEGIN_TRY {
/* Open the files */
- if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
+ if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
{
error_msg(progname, "<%s>: %s\n", fname1, H5FOPENERROR );
return -1;
}
- if ((fid2=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
+ if ((fid2=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
{
error_msg(progname, "<%s>: %s\n", fname2, H5FOPENERROR );
H5Fclose(fid1);
@@ -383,9 +378,9 @@ int h5repack_cmpdcpl(const char *fname1,
*/
trav_table_init(&travt1);
trav_table_init(&travt2);
- if (h5trav_gettable(fid1,travt1)<0)
+ if(h5trav_gettable(fid1, travt1) < 0)
goto error;
- if (h5trav_gettable(fid2,travt2)<0)
+ if(h5trav_gettable(fid2, travt2) < 0)
goto error;
@@ -394,27 +389,25 @@ int h5repack_cmpdcpl(const char *fname1,
*-------------------------------------------------------------------------
*/
- for ( i=0; i < travt1->nobjs; i++)
- {
- if ( travt1->objs[i].type == H5TRAV_TYPE_DATASET) {
- if ((dset1=H5Dopen(fid1,travt1->objs[i].name))<0)
+ for(i = 0; i < travt1->nobjs; i++) {
+ if(travt1->objs[i].type == H5TRAV_TYPE_DATASET) {
+ if((dset1 = H5Dopen2(fid1, travt1->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
- if ((dset2=H5Dopen(fid2,travt1->objs[i].name))<0)
+ if((dset2 = H5Dopen2(fid2, travt1->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
- if ((dcpl1=H5Dget_create_plist(dset1))<0)
+ if((dcpl1 = H5Dget_create_plist(dset1)) < 0)
goto error;
- if ((dcpl2=H5Dget_create_plist(dset2))<0)
+ if((dcpl2 = H5Dget_create_plist(dset2)) < 0)
goto error;
/*-------------------------------------------------------------------------
* compare the property lists
*-------------------------------------------------------------------------
*/
- if ((ret=H5Pequal(dcpl1,dcpl2))<0)
+ if((ret = H5Pequal(dcpl1, dcpl2)) < 0)
goto error;
- if (ret==0)
- {
+ if(ret == 0) {
error_msg(progname, "property lists for <%s> are different\n",travt1->objs[i].name);
goto error;
}
@@ -423,13 +416,13 @@ int h5repack_cmpdcpl(const char *fname1,
* close
*-------------------------------------------------------------------------
*/
- if (H5Pclose(dcpl1)<0)
+ if(H5Pclose(dcpl1) < 0)
goto error;
- if (H5Pclose(dcpl2)<0)
+ if(H5Pclose(dcpl2) < 0)
goto error;
- if (H5Dclose(dset1)<0)
+ if(H5Dclose(dset1) < 0)
goto error;
- if (H5Dclose(dset2)<0)
+ if(H5Dclose(dset2) < 0)
goto error;
} /*if*/
} /*i*/
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index 0f5f0a5..ed6c6c4 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -575,7 +575,7 @@ dataset_stats(hid_t group, const char *name, const H5O_info_t *oi, iter_t *iter)
iter->dset_ohdr_info.total_size += oi->hdr.space.total;
iter->dset_ohdr_info.free_size += oi->hdr.space.free;
- did = H5Dopen(group, name);
+ did = H5Dopen2(group, name, H5P_DEFAULT);
assert(did > 0);
/* Update dataset metadata info */
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index e94c723..dfea49f 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -22,9 +22,9 @@
*
* Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are
* obtained either from
- * loc_id = H5Gopen2( fid, name, H5P_DEFAULT);
- * loc_id = H5Dopen( fid, name);
- * loc_id = H5Topen2( fid, name, H5P_DEFAULT);
+ * loc_id = H5Gopen2(fid, name, H5P_DEFAULT);
+ * loc_id = H5Dopen2(fid, name);
+ * loc_id = H5Topen2(fid, name, H5P_DEFAULT);
*
* Return: number of differences found
*
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index d3a7078..ea833db 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -65,11 +65,11 @@ hsize_t diff_dataset( hid_t file1_id,
const char *obj2_name,
diff_opt_t *options)
{
- hid_t did1=-1;
- hid_t did2=-1;
- hid_t dcpl1=-1;
- hid_t dcpl2=-1;
- hsize_t nfound=0;
+ hid_t did1 = -1;
+ hid_t did2 = -1;
+ hid_t dcpl1 = -1;
+ hid_t dcpl2 = -1;
+ hsize_t nfound = 0;
/*-------------------------------------------------------------------------
* open the handles
@@ -78,23 +78,21 @@ hsize_t diff_dataset( hid_t file1_id,
/* disable error reporting */
H5E_BEGIN_TRY {
/* Open the datasets */
- if ( (did1 = H5Dopen(file1_id,obj1_name)) < 0 )
- {
- printf("Cannot open dataset <%s>\n", obj1_name );
+ if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) {
+ printf("Cannot open dataset <%s>\n", obj1_name);
goto error;
}
- if ( (did2 = H5Dopen(file2_id,obj2_name)) < 0 )
- {
- printf("Cannot open dataset <%s>\n", obj2_name );
+ if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) {
+ printf("Cannot open dataset <%s>\n", obj2_name);
goto error;
}
/* enable error reporting */
} H5E_END_TRY;
- if ((dcpl1=H5Dget_create_plist(did1))<0)
+ if((dcpl1 = H5Dget_create_plist(did1)) < 0)
goto error;
- if ((dcpl2=H5Dget_create_plist(did2))<0)
+ if((dcpl2 = H5Dget_create_plist(did2)) < 0)
goto error;
/*-------------------------------------------------------------------------
@@ -315,10 +313,10 @@ hsize_t diff_datasetid( hid_t did1,
* memory type and sizes
*-------------------------------------------------------------------------
*/
- if ((m_tid1=h5tools_get_native_type(f_tid1))<0)
+ if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0)
goto error;
- if ((m_tid2=h5tools_get_native_type(f_tid2))<0)
+ if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0)
goto error;
m_size1 = H5Tget_size( m_tid1 );
@@ -378,7 +376,7 @@ hsize_t diff_datasetid( hid_t did1,
{
H5Tclose(m_tid1);
- if ((m_tid1=h5tools_get_native_type(f_tid2))<0)
+ if ((m_tid1=h5tools_get_native_type(f_tid2)) < 0)
goto error;
m_size1 = H5Tget_size( m_tid1 );
@@ -387,7 +385,7 @@ hsize_t diff_datasetid( hid_t did1,
{
H5Tclose(m_tid2);
- if ((m_tid2=h5tools_get_native_type(f_tid1))<0)
+ if ((m_tid2=h5tools_get_native_type(f_tid1)) < 0)
goto error;
m_size2 = H5Tget_size( m_tid2 );
@@ -495,11 +493,11 @@ hsize_t diff_datasetid( hid_t did1,
hs_size[i] = MIN(dims1[i] - hs_offset[i], sm_size[i]);
hs_nelmts *= hs_size[i];
}
- if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL)<0)
+ if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
goto error;
- if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL)<0)
+ if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
goto error;
- if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL)<0)
+ if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
goto error;
}
else
@@ -692,10 +690,10 @@ int diff_can_type( hid_t f_tid1, /* file data type */
*-------------------------------------------------------------------------
*/
- if ((tclass1=H5Tget_class(f_tid1))<0)
+ if ((tclass1=H5Tget_class(f_tid1)) < 0)
return -1;
- if ((tclass2=H5Tget_class(f_tid2))<0)
+ if ((tclass2=H5Tget_class(f_tid2)) < 0)
return -1;
if ( tclass1 != tclass2 )
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 4aabe09..de2043e 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -520,14 +520,14 @@ find_objs_cb(hid_t group, const char *name, const H5L_info_t UNUSED *linfo, void
tmp = build_obj_path_name(info->prefix, name);
add_obj(info->dset_table, oinfo.addr, tmp, TRUE);
- if((dset = H5Dopen (group, name)) >= 0) {
+ if((dset = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) {
hid_t type;
type = H5Dget_type(dset);
if(H5Tcommitted(type) > 0) {
H5Oget_info(type, ".", &oinfo, H5P_DEFAULT);
- if (search_obj(info->type_table, oinfo.addr) == NULL) {
+ if(search_obj(info->type_table, oinfo.addr) == NULL) {
char *type_name = HDstrdup(tmp);
add_obj(info->type_table, oinfo.addr, type_name, FALSE);
diff --git a/tools/lib/talign.c b/tools/lib/talign.c
index b0dbbe9..9c16d9a 100644
--- a/tools/lib/talign.c
+++ b/tools/lib/talign.c
@@ -127,17 +127,17 @@ int main(void)
/* Now open the set, and read it back in */
data = malloc(H5Tget_size(fix));
- if (!data) {
+ if(!data) {
perror("malloc() failed");
abort();
}
- set = H5Dopen(fil, setname);
+ set = H5Dopen2(fil, setname, H5P_DEFAULT);
H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data);
fptr = (float *)(data + H5Tget_member_offset(fix, 1));
- if (fok[0] != fptr[0] || fok[1] != fptr[1]
+ if(fok[0] != fptr[0] || fok[1] != fptr[1]
|| fnok[0] != fptr[2] || fnok[1] != fptr[3]) {
result = 1;
printf("%14s (%2d) %6s = %s\n",