From 58eb9c4aa043151cf9ec77b46afb162988cc1d42 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Mon, 7 Jun 1999 15:20:32 -0500 Subject: [svn-r1311] Changes since 19990607 ---------------------- ./tools/h5ls.c ./tools/h5tools.c Added support for printing bitfields and opaque data. ./test/dsets.c Added bitfield and opaque datasets to the output file so h5ls has something interesting to print. ./test/trefer.c Resync'd ./src/H5Tconv.c Fixed bitfield conversion which resulted in possible garbage in high-order bits of destination when the destination type is larger than the source type. Thanks for spotting it, Quincey. --- src/H5Tconv.c | 4 ++- test/dsets.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/trefer.c | 2 +- tools/h5ls.c | 39 ++++++++++++++++++++++- tools/h5tools.c | 15 +++++++-- 5 files changed, 153 insertions(+), 5 deletions(-) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 5a84ad1..3d6bcca 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -628,7 +628,7 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * Copy the significant part of the value. If the source is larger * than the destination then invoke the overflow function or copy - * as many bits as possible. + * as many bits as possible. Zero extra bits in the destination. */ if (src->u.atomic.prec>dst->u.atomic.prec) { if (!H5T_overflow_g || @@ -640,6 +640,8 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T_bit_copy(d, dst->u.atomic.offset, s, src->u.atomic.offset, src->u.atomic.prec); + H5T_bit_set(d, dst->u.atomic.offset+src->u.atomic.prec, + dst->u.atomic.prec-src->u.atomic.prec, FALSE); } /* diff --git a/test/dsets.c b/test/dsets.c index a9cf40e..c8bcbc2 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -702,6 +702,103 @@ test_multiopen (hid_t file) /*------------------------------------------------------------------------- + * Function: test_types + * + * Purpose: Make some datasets with various types so we can test h5ls. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Robb Matzke + * Monday, June 7, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_types(hid_t file) +{ + hid_t grp=-1, type=-1, space=-1, dset=-1; + size_t i; + hsize_t nelmts; + unsigned char buf[32]; + + TESTING("various datatypes"); + if ((grp=H5Gcreate(file, "typetests", 0))<0) goto error; + + /* bitfield_1 */ + nelmts = sizeof(buf); + if ((type=H5Tcopy(H5T_STD_B8LE))<0 || + (space=H5Screate_simple(1, &nelmts, NULL))<0 || + (dset=H5Dcreate(grp, "bitfield_1", type, space, H5P_DEFAULT))<0) + goto error; + for (i=0; i