diff options
Diffstat (limited to 'tools/lib')
-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 |
4 files changed, 78 insertions, 11 deletions
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 6aedaf5..3278bdb 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -66,6 +66,7 @@ int diff_attr(hid_t loc1_id, int ret=0; hsize_t nfound; int cmp=1; + H5T_class_t type_class; /* Datatype class */ if ((n1 = H5Aget_num_attrs(loc1_id))<0) goto error; @@ -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 d25e9bb..d3a2d7a 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1137,8 +1137,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)); |