summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2005-01-20 17:32:06 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2005-01-20 17:32:06 (GMT)
commitdad89387a392c20d9cc0fc181792e479e7c908b7 (patch)
treea4f83c60c2abb8b5edc3e781b8a81b8ccda82e20 /src
parentfda3252166a55b0f6714796ae0d20187b8f0e3e2 (diff)
downloadhdf5-dad89387a392c20d9cc0fc181792e479e7c908b7.zip
hdf5-dad89387a392c20d9cc0fc181792e479e7c908b7.tar.gz
hdf5-dad89387a392c20d9cc0fc181792e479e7c908b7.tar.bz2
[svn-r9840] Purpose: Bug fix and new test
Description: The functions for user-define floating-point type, like H5Tset_fields, H5Tset_offset, H5Tset_precision, H5Tset_size, have some minor bugs. For error checking, the library didn't include offset value somehow. Solution: Corrected those bugs. Platforms tested: h5committest and fuss Misc. update:
Diffstat (limited to 'src')
-rw-r--r--src/H5T.c6
-rw-r--r--src/H5Tprecis.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 1d25984..ed9a1e6 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -3614,9 +3614,9 @@ H5T_set_size(H5T_t *dt, size_t size)
* The sign, mantissa, and exponent fields should be adjusted
* first when decreasing the size of a floating point type.
*/
- if (dt->shared->u.atomic.u.f.sign >= prec ||
- dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec ||
- dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec) {
+ if (dt->shared->u.atomic.u.f.sign >= prec+offset ||
+ dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec+offset ||
+ dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first");
}
break;
diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c
index b7a37d3..e151980 100644
--- a/src/H5Tprecis.c
+++ b/src/H5Tprecis.c
@@ -251,9 +251,9 @@ H5T_set_precision(const H5T_t *dt, size_t prec)
printf("mpos: %d ", dt->shared->u.atomic.u.f.mpos);
printf("msize: %d ", dt->shared->u.atomic.u.f.msize);
printf("prec: %d\n", prec); */
- if (dt->shared->u.atomic.u.f.sign >= prec ||
- dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec ||
- dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec)
+ if (dt->shared->u.atomic.u.f.sign >= prec+offset ||
+ dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec+offset ||
+ dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first")
break;
default: