diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2004-10-05 15:13:14 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2004-10-05 15:13:14 (GMT) |
commit | 1f8687691d6620473440d745ea6cbe9e16b3d3c1 (patch) | |
tree | bcf783cf560fbfa1e7e3a7ca3b0778abb34e9ac1 /tools | |
parent | 9595bba3a45563ddff3a732cd460fecf0c04530a (diff) | |
download | hdf5-1f8687691d6620473440d745ea6cbe9e16b3d3c1.zip hdf5-1f8687691d6620473440d745ea6cbe9e16b3d3c1.tar.gz hdf5-1f8687691d6620473440d745ea6cbe9e16b3d3c1.tar.bz2 |
[svn-r9365]
Purpose: change feature
Description: Back up supporting bitfield and time datatypes in H5Tget_native_type. Leave it for future support. Simply returns "not supported" error message for now.
Platforms tested: h5committest
Misc. update: RELEASE.txt
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5dump/h5dump.c | 27 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 8 | ||||
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 28 | ||||
-rw-r--r-- | tools/h5repack/h5repack_refs.c | 28 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 26 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 45 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 11 | ||||
-rw-r--r-- | tools/lib/talign.c | 7 |
8 files changed, 157 insertions, 23 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 7f41006..237cbaf 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -1912,8 +1912,15 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex) H5Tclose(f_type); } else { /* need to call h5tools_dump_mem for the attribute data */ + H5T_class_t type_class; + type = H5Aget_type(obj_id); - p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT); + type_class = H5Tget_class(type); + if(type_class==H5T_BITFIELD) + p_type=H5Tcopy(type); + else + p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT); + space = H5Aget_space(obj_id); ndims = H5Sget_simple_extent_dims(space, size, NULL); @@ -2024,10 +2031,17 @@ static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id) int nelmts=1; h5dump_t *outputformat = &dataformat; hid_t n_type; + H5T_class_t type_class; memset(&ctx, 0, sizeof(ctx)); ctx.indent_level=2; - n_type = H5Tget_native_type(type_id,H5T_DIR_DEFAULT); + + type_class = H5Tget_class(type_id); + if(type_class==H5T_BITFIELD) + n_type=H5Tcopy(type_id); + else + n_type = H5Tget_native_type(type_id,H5T_DIR_DEFAULT); + size = H5Tget_size(n_type); buf = malloc(size); @@ -4476,7 +4490,14 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU status = xml_print_strs(obj_id, ATTRIBUTE_DATA); } else { /* all other data */ - p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT); + H5T_class_t type_class; + + type_class = H5Tget_class(type); + if(type_class==H5T_BITFIELD) + p_type=H5Tcopy(type); + else + p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT); + H5Tclose(type); space = H5Aget_space(obj_id); diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 8076efd..ca0140d 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1386,7 +1386,13 @@ list_attr (hid_t obj, const char *attr_name, void UNUSED *op_data) if (hexdump_g) { p_type = H5Tcopy(type); } else { - p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT); + H5T_class_t type_class; + + type_class = H5Tget_class(type); + if(type_class==H5T_BITFIELD) + p_type=H5Tcopy(type); + else + p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT); } if (p_type>=0) { temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 5937eb8..8ec99b6 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -245,6 +245,7 @@ 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 @@ -307,8 +308,17 @@ int do_copy_objects(hid_t fidin, nelmts=1; for (j=0; j<rank; j++) nelmts*=dims[j]; - if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0) - goto error; + + 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 ((msize=H5Tget_size(mtype_id))==0) goto error; @@ -594,6 +604,7 @@ 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; @@ -632,8 +643,17 @@ int copy_attr(hid_t loc_in, nelmts=1; for (j=0; j<rank; j++) nelmts*=dims[j]; - if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0) - goto error; + + 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 ((msize=H5Tget_size(mtype_id))==0) goto error; diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 0dc5535..54c539d 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -67,6 +67,7 @@ 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 @@ -122,8 +123,17 @@ int do_copy_refobjs(hid_t fidin, nelmts=1; for (j=0; j<rank; j++) nelmts*=dims[j]; - if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0) - goto error; + + 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 ((msize=H5Tget_size(mtype_id))==0) goto error; @@ -476,6 +486,7 @@ 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; @@ -515,8 +526,17 @@ static int copy_refs_attr(hid_t loc_in, nelmts=1; for (j=0; j<rank; j++) nelmts*=dims[j]; - if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0) - goto error; + + 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 ((msize=H5Tget_size(mtype_id))==0) goto error; diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 6aedaf5..efc1b11 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -60,6 +60,7 @@ int diff_attr(hid_t loc1_id, int rank2; /* rank of dataset */ hsize_t dims1[H5S_MAX_RANK];/* dimensions of dataset */ hsize_t dims2[H5S_MAX_RANK];/* dimensions of dataset */ + H5T_class_t type_class; /* Datatype class */ char name1[255]; char name2[255]; int n1, n2, i, j; @@ -160,10 +161,27 @@ int diff_attr(hid_t loc1_id, nelmts1=1; for (j=0; j<rank1; j++) nelmts1*=dims1[j]; - if ((mtype1_id=H5Tget_native_type(ftype1_id,H5T_DIR_DEFAULT))<0) - goto error; - if ((mtype2_id=H5Tget_native_type(ftype2_id,H5T_DIR_DEFAULT))<0) - goto error; + + if((type_class = H5Tget_class(ftype1_id))<0) + goto error; + if(type_class==H5T_BITFIELD) { + if((mtype1_id=H5Tcopy(ftype1_id))<0) + goto error; + } else { + if ((mtype1_id=H5Tget_native_type(ftype1_id,H5T_DIR_DEFAULT))<0) + goto error; + } + + if((type_class = H5Tget_class(ftype2_id))<0) + goto error; + if(type_class==H5T_BITFIELD) { + if((mtype2_id=H5Tcopy(ftype2_id))<0) + goto error; + } else { + if ((mtype2_id=H5Tget_native_type(ftype2_id,H5T_DIR_DEFAULT))<0) + goto error; + } + if ((msize1=H5Tget_size(mtype1_id))==0) goto error; if ((msize2=H5Tget_size(mtype2_id))==0) diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 69acfbd..767587d 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -155,6 +155,7 @@ hsize_t diff_datasetid( hid_t dset1_id, hsize_t storage_size1; hsize_t storage_size2; hsize_t nfound=0; /* number of differences found */ + H5T_class_t type_class; /* data type class */ int cmp=1; /* do diff or not */ int i; @@ -266,9 +267,25 @@ hsize_t diff_datasetid( hid_t dset1_id, * memory type and sizes *------------------------------------------------------------------------- */ + if((type_class = H5Tget_class(f_type1))<0) + goto error; + if(type_class==H5T_BITFIELD) { + if((m_type1=H5Tcopy(f_type1))<0) + goto error; + } else { + if ((m_type1=H5Tget_native_type(f_type1,H5T_DIR_DEFAULT))<0) + goto error; + } - m_type1 = H5Tget_native_type( f_type1 , H5T_DIR_DEFAULT); - m_type2 = H5Tget_native_type( f_type2 , H5T_DIR_DEFAULT); + if((type_class = H5Tget_class(f_type2))<0) + goto error; + if(type_class==H5T_BITFIELD) { + if((m_type2=H5Tcopy(f_type2))<0) + goto error; + } else { + if ((m_type2=H5Tget_native_type(f_type2,H5T_DIR_DEFAULT))<0) + goto error; + } m_size1 = H5Tget_size( m_type1 ); m_size2 = H5Tget_size( m_type2 ); @@ -304,13 +321,33 @@ hsize_t diff_datasetid( hid_t dset1_id, if ( m_size1 < m_size2 ) { H5Tclose(m_type1); - m_type1 = H5Tget_native_type( f_type2 , H5T_DIR_DEFAULT); + + if((type_class = H5Tget_class(f_type2))<0) + goto error; + if(type_class==H5T_BITFIELD) { + if((m_type1=H5Tcopy(f_type2))<0) + goto error; + } else { + if ((m_type1=H5Tget_native_type(f_type2,H5T_DIR_DEFAULT))<0) + goto error; + } + m_size1 = H5Tget_size( m_type1 ); } else { H5Tclose(m_type2); - m_type2 = H5Tget_native_type( f_type1 , H5T_DIR_DEFAULT); + + if((type_class = H5Tget_class(f_type1))<0) + goto error; + if(type_class==H5T_BITFIELD) { + if((m_type2=H5Tcopy(f_type1))<0) + goto error; + } else { + if ((m_type2=H5Tget_native_type(f_type1,H5T_DIR_DEFAULT))<0) + goto error; + } + m_size2 = H5Tget_size( m_type2 ); } #if defined (H5DIFF_DEBUG) diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 9f1b7e9..27d7577 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1087,8 +1087,15 @@ h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type, if (info->raw) p_type = H5Tcopy(f_type); - else - p_type = H5Tget_native_type(f_type,H5T_DIR_DEFAULT); + else { + H5T_class_t type_class; + + type_class = H5Tget_class(f_type); + if(type_class==H5T_BITFIELD) + p_type=H5Tcopy(f_type); + else + p_type = H5Tget_native_type(f_type,H5T_DIR_DEFAULT); + } H5Tclose(f_type); diff --git a/tools/lib/talign.c b/tools/lib/talign.c index e24cabf..082e37e 100644 --- a/tools/lib/talign.c +++ b/tools/lib/talign.c @@ -29,6 +29,7 @@ int main(void) hsize_t dim[2]; hsize_t cdim[4]; + H5T_class_t type_class; char string5[5]; float fok[2] = {1234., 2341.}; @@ -72,7 +73,11 @@ int main(void) H5Tinsert(cmp, "Not Ok", sizeof(fok) + sizeof(string5), array_dt); H5Tclose(array_dt); - fix = H5Tget_native_type(cmp,H5T_DIR_DEFAULT); + type_class = H5Tget_class(cmp); + if(type_class==H5T_BITFIELD) + fix=H5Tcopy(cmp); + else + fix=H5Tget_native_type(cmp, H5T_DIR_DEFAULT); cmp1 = H5Tcreate(H5T_COMPOUND, sizeof(fok)); |