diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-10-06 16:11:28 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-10-06 16:11:28 (GMT) |
commit | 759096a9fea4f644d43ee97bb10a738eda543811 (patch) | |
tree | 139d4ca75dbc97ea0daac7e319e03495d67761d0 /tools/h5repack | |
parent | 0a2afa77ae43bb3cec4c6d45ca03fa8be0026ba9 (diff) | |
download | hdf5-759096a9fea4f644d43ee97bb10a738eda543811.zip hdf5-759096a9fea4f644d43ee97bb10a738eda543811.tar.gz hdf5-759096a9fea4f644d43ee97bb10a738eda543811.tar.bz2 |
[svn-r9372] Purpose:
Refactor code
Description:
Refactor common code for determining the native type for using in the
tools into separate routine.
Also, reduce diffs between the two branches and bring back some fixes from
the development branch to the release branch.
Platforms tested:
FreeBSD 4.10 (sleipnir)
too minor to require h5committest
Diffstat (limited to 'tools/h5repack')
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 34 | ||||
-rw-r--r-- | tools/h5repack/h5repack_refs.c | 28 |
2 files changed, 15 insertions, 47 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 8ec99b6..b9e69bb 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -30,7 +30,7 @@ * *------------------------------------------------------------------------- */ -static void print_obj(hid_t dcpl, char *name) +static void print_obj(hid_t dcpl_id, char *name) { char str[255]; #if defined (PRINT_DEBUG ) @@ -47,13 +47,13 @@ static void print_obj(hid_t dcpl, char *name) strcpy(str,"\0"); /* get information about input filters */ - if ((nfilters = H5Pget_nfilters(dcpl))<0) + if ((nfilters = H5Pget_nfilters(dcpl_id))<0) return; for ( i=0; i<nfilters; i++) { cd_nelmts = NELMTS(cd_values); - filtn = H5Pget_filter(dcpl, + filtn = H5Pget_filter(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, @@ -245,7 +245,6 @@ int do_copy_objects(hid_t fidin, #endif /* LATER */ int i, j; int wrote=0; - H5T_class_t type_class; /* datatype class */ /*------------------------------------------------------------------------- * copy the suppplied object list @@ -309,16 +308,9 @@ int do_copy_objects(hid_t fidin, for (j=0; j<rank; j++) nelmts*=dims[j]; - if((type_class = H5Tget_class(ftype_id))<0) - goto error; - if(type_class==H5T_BITFIELD) { - if((mtype_id=H5Tcopy(ftype_id))<0) - goto error; - } else { - if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0) - goto error; - } - + if ((mtype_id=h5tools_get_native_type(ftype_id))<0) + goto error; + if ((msize=H5Tget_size(mtype_id))==0) goto error; @@ -604,7 +596,6 @@ int copy_attr(hid_t loc_in, char name[255]; int n, j; unsigned u; - H5T_class_t type_class; if ((n = H5Aget_num_attrs(loc_in))<0) goto error; @@ -644,16 +635,9 @@ int copy_attr(hid_t loc_in, for (j=0; j<rank; j++) nelmts*=dims[j]; - if((type_class = H5Tget_class(ftype_id))<0) - goto error; - if(type_class==H5T_BITFIELD) { - if((mtype_id=H5Tcopy(ftype_id))<0) - goto error; - } else { - if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0) - goto error; - } - + if ((mtype_id=h5tools_get_native_type(ftype_id))<0) + goto error; + if ((msize=H5Tget_size(mtype_id))==0) goto error; diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 54c539d..dedad6b 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -67,7 +67,6 @@ int do_copy_refobjs(hid_t fidin, hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ int next; /* external files */ int i, j; - H5T_class_t type_class; /* datatype class */ /*------------------------------------------------------------------------- * browse @@ -124,16 +123,9 @@ int do_copy_refobjs(hid_t fidin, for (j=0; j<rank; j++) nelmts*=dims[j]; - if((type_class = H5Tget_class(ftype_id))<0) - goto error; - if(type_class==H5T_BITFIELD) { - if((mtype_id=H5Tcopy(ftype_id))<0) - goto error; - } else { - if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0) - goto error; - } - + if ((mtype_id=h5tools_get_native_type(ftype_id))<0) + goto error; + if ((msize=H5Tget_size(mtype_id))==0) goto error; @@ -486,7 +478,6 @@ static int copy_refs_attr(hid_t loc_in, char name[255]; int n, j; unsigned u; - H5T_class_t type_class; /* datatype class */ if ((n = H5Aget_num_attrs(loc_in))<0) goto error; @@ -526,16 +517,9 @@ static int copy_refs_attr(hid_t loc_in, nelmts=1; for (j=0; j<rank; j++) nelmts*=dims[j]; - - if((type_class = H5Tget_class(ftype_id))<0) - goto error; - if(type_class==H5T_BITFIELD) { - if((mtype_id=H5Tcopy(ftype_id))<0) - goto error; - } else { - if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0) - goto error; - } + + if ((mtype_id=h5tools_get_native_type(ftype_id))<0) + goto error; if ((msize=H5Tget_size(mtype_id))==0) goto error; |