summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release_docs/RELEASE.txt4
-rw-r--r--src/H5Tnative.c10
-rw-r--r--test/ntypes.c23
-rw-r--r--tools/h5dump/h5dump.c27
-rw-r--r--tools/h5ls/h5ls.c8
-rw-r--r--tools/h5repack/h5repack_copy.c28
-rw-r--r--tools/h5repack/h5repack_refs.c28
-rw-r--r--tools/lib/h5diff_attr.c26
-rw-r--r--tools/lib/h5diff_dset.c45
-rw-r--r--tools/lib/h5tools.c11
-rw-r--r--tools/lib/talign.c7
11 files changed, 173 insertions, 44 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 9476690..cfa6f5f 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -186,6 +186,10 @@ Bug Fixes since HDF5-1.6.0 release
Library
-------
+ - Back up supporting bitfield and time types in H5Tget_native_type.
+ Leave it to future support. The function simply returns error
+ message of "not support" for bitfield and time types.
+ SLU - 2004/10/5
- Fixed address check in Core VFL driver to avoid spurious address/size
overflows for odd valued addresses and/or sizes. QAK - 2004/09/27
- Fixed parallel bug in which some processes attempted collective
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index 3785310..1ece922 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -212,13 +212,13 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
}
break;
- /* These types need to be supported properly still... */
+ /* These 2 types will be supported in the future. Simply return "not supported"
+ * message for now.*/
case H5T_TIME:
- case H5T_BITFIELD:
- if((ret_value=H5T_copy(dtype, H5T_COPY_TRANSIENT))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "time type is not supported yet")
- break;
+ case H5T_BITFIELD:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "bit field type is not supported yet")
case H5T_OPAQUE:
if((ret_value=H5T_copy(dtype, H5T_COPY_TRANSIENT))==NULL)
diff --git a/test/ntypes.c b/test/ntypes.c
index 4fe6842..2cb07e3 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -2312,26 +2312,17 @@ test_bitfield_dtype(hid_t file)
if((dtype=H5Dget_type(dataset))<0) TEST_ERROR;
- if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0)
- TEST_ERROR;
-
- if(!H5Tequal(native_type, type)) TEST_ERROR;
-
- if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf)<0)
+ H5E_BEGIN_TRY {
+ native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT);
+ } H5E_END_TRY;
+ if(native_type>0) {
+ H5_FAILED();
+ puts(" Bit field isn't supported. Should have failed.");
TEST_ERROR;
-
- for(i=0; i<sizeof(rbuf); i++) {
- if (rbuf[i] != wbuf[i]) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %u\n", (unsigned)i);
- goto error;
- }
}
-
+
if (H5Tclose(type)<0) TEST_ERROR;
if (H5Tclose(dtype)<0) TEST_ERROR;
- if (H5Tclose(native_type)<0) TEST_ERROR;
if (H5Dclose(dataset)<0) TEST_ERROR;
PASSED();
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index e370478..eabbd61 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -1948,8 +1948,15 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex)
if(space_type == H5S_NULL || space_type == H5S_NO_CLASS || space_type == H5S_COMPLEX) {
status = SUCCEED;
} else {
+ 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);
+
ndims = H5Sget_simple_extent_dims(space, size, NULL);
for (i = 0; i < ndims; i++)
@@ -2061,10 +2068,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);
@@ -4835,7 +4849,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 24cd953..6066812 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1400,7 +1400,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) {
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 110069b..5908809 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -259,6 +259,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
@@ -321,8 +322,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;
@@ -608,6 +618,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;
@@ -646,8 +657,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 1a09b02..4662341 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..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));