diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-05-05 17:18:50 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-05-05 17:18:50 (GMT) |
commit | ca7fc8e96a70b06b08e1db21040056ae17a51906 (patch) | |
tree | 3d665b7a3119174158fc91a05fd8055f6ca7074b /src/H5Tfloat.c | |
parent | b24e2d4dd861b67a61fcf56be5975bcd4d37203b (diff) | |
download | hdf5-ca7fc8e96a70b06b08e1db21040056ae17a51906.zip hdf5-ca7fc8e96a70b06b08e1db21040056ae17a51906.tar.gz hdf5-ca7fc8e96a70b06b08e1db21040056ae17a51906.tar.bz2 |
[svn-r18708] Description:
Bring r18638:18704 from trunk to revise_chunks branch.
Tested on:
Mac OS X/32 10.6.3 (amazon) w/debug & production
(h5committest not required on this branch)
Diffstat (limited to 'src/H5Tfloat.c')
-rw-r--r-- | src/H5Tfloat.c | 195 |
1 files changed, 86 insertions, 109 deletions
diff --git a/src/H5Tfloat.c b/src/H5Tfloat.c index 73ccf30..88d13fd 100644 --- a/src/H5Tfloat.c +++ b/src/H5Tfloat.c @@ -70,40 +70,41 @@ H5T_init_float_interface(void) * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived datatypes. *------------------------------------------------------------------------- */ herr_t -H5Tget_fields(hid_t type_id, size_t *spos/*out*/, - size_t *epos/*out*/, size_t *esize/*out*/, - size_t *mpos/*out*/, size_t *msize/*out*/) +H5Tget_fields(hid_t type_id, size_t *spos/*out*/, size_t *epos/*out*/, +size_t *esize/*out*/, size_t *mpos/*out*/, size_t *msize/*out*/) { - H5T_t *dt = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *dt; /* Datatype */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tget_fields, FAIL) H5TRACE6("e", "ixxxxx", type_id, spos, epos, esize, mpos, msize); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - while (dt->shared->parent) + while(dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ - if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class") + if(H5T_FLOAT != dt->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class") /* Get values */ - if (spos) *spos = dt->shared->u.atomic.u.f.sign; - if (epos) *epos = dt->shared->u.atomic.u.f.epos; - if (esize) *esize = dt->shared->u.atomic.u.f.esize; - if (mpos) *mpos = dt->shared->u.atomic.u.f.mpos; - if (msize) *msize = dt->shared->u.atomic.u.f.msize; + if(spos) + *spos = dt->shared->u.atomic.u.f.sign; + if(epos) + *epos = dt->shared->u.atomic.u.f.epos; + if(esize) + *esize = dt->shared->u.atomic.u.f.esize; + if(mpos) + *mpos = dt->shared->u.atomic.u.f.mpos; + if(msize) + *msize = dt->shared->u.atomic.u.f.msize; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tget_fields() */ /*------------------------------------------------------------------------- @@ -122,45 +123,40 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ herr_t H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize, - size_t mpos, size_t msize) + size_t mpos, size_t msize) { - H5T_t *dt = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *dt; /* Datatype */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tset_fields, FAIL) H5TRACE6("e", "izzzzz", type_id, spos, epos, esize, mpos, msize); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") - while (dt->shared->parent) + if(H5T_STATE_TRANSIENT != dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + while(dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ - if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class") - if (epos + esize > dt->shared->u.atomic.prec) + if(H5T_FLOAT != dt->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class") + if(epos + esize > dt->shared->u.atomic.prec) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent bit field size/location is invalid") - if (mpos + msize > dt->shared->u.atomic.prec) + if(mpos + msize > dt->shared->u.atomic.prec) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mantissa bit field size/location is invalid") - if (spos >= dt->shared->u.atomic.prec) + if(spos >= dt->shared->u.atomic.prec) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign location is not valid") /* Check for overlap */ - if (spos >= epos && spos < epos + esize) + if(spos >= epos && spos < epos + esize) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign bit appears within exponent field") - if (spos >= mpos && spos < mpos + msize) + if(spos >= mpos && spos < mpos + msize) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign bit appears within mantissa field") - if ((mpos < epos && mpos + msize > epos) || - (epos < mpos && epos + esize > mpos)) + if((mpos < epos && mpos + msize > epos) || (epos < mpos && epos + esize > mpos)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent and mantissa fields overlap") /* Commit */ @@ -172,7 +168,7 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize, done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tset_fields() */ /*------------------------------------------------------------------------- @@ -187,34 +183,31 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived datatypes. *------------------------------------------------------------------------- */ size_t H5Tget_ebias(hid_t type_id) { - H5T_t *dt = NULL; - size_t ret_value; + H5T_t *dt; /* Datatype */ + size_t ret_value; /* Return value */ FUNC_ENTER_API(H5Tget_ebias, 0) H5TRACE1("z", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") - while (dt->shared->parent) + while(dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ - if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for datatype class") + if(H5T_FLOAT != dt->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, 0, "operation not defined for datatype class") /* bias */ - H5_ASSIGN_OVERFLOW(ret_value,dt->shared->u.atomic.u.f.ebias,uint64_t,size_t); + H5_ASSIGN_OVERFLOW(ret_value, dt->shared->u.atomic.u.f.ebias, uint64_t, size_t); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tget_ebias() */ /*------------------------------------------------------------------------- @@ -236,28 +229,28 @@ done: herr_t H5Tset_ebias(hid_t type_id, size_t ebias) { - H5T_t *dt = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *dt; /* Datatype */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tset_ebias, FAIL) H5TRACE2("e", "iz", type_id, ebias); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") - while (dt->shared->parent) + if(H5T_STATE_TRANSIENT != dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + while(dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ - if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class") + if(H5T_FLOAT != dt->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class") /* Commit */ dt->shared->u.atomic.u.f.ebias = ebias; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tset_ebias() */ /*------------------------------------------------------------------------- @@ -273,35 +266,31 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived datatypes. - * *------------------------------------------------------------------------- */ H5T_norm_t H5Tget_norm(hid_t type_id) { - H5T_t *dt = NULL; - H5T_norm_t ret_value; + H5T_t *dt; /* Datatype */ + H5T_norm_t ret_value; /* Return value */ FUNC_ENTER_API(H5Tget_norm, H5T_NORM_ERROR) H5TRACE1("Tn", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NORM_ERROR, "not a datatype") - while (dt->shared->parent) + while(dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ - if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_NORM_ERROR, "operation not defined for datatype class") + if(H5T_FLOAT != dt->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_NORM_ERROR, "operation not defined for datatype class") /* norm */ ret_value = dt->shared->u.atomic.u.f.norm; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tget_norm() */ /*------------------------------------------------------------------------- @@ -315,39 +304,35 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ herr_t H5Tset_norm(hid_t type_id, H5T_norm_t norm) { - H5T_t *dt = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *dt; /* Datatype */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tset_norm, FAIL) H5TRACE2("e", "iTn", type_id, norm); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") - if (norm < H5T_NORM_IMPLIED || norm > H5T_NORM_NONE) + if(H5T_STATE_TRANSIENT != dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + if(norm < H5T_NORM_IMPLIED || norm > H5T_NORM_NONE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal normalization") - while (dt->shared->parent) + while(dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ - if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class") + if(H5T_FLOAT != dt->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class") /* Commit */ dt->shared->u.atomic.u.f.norm = norm; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tset_norm() */ /*------------------------------------------------------------------------- @@ -365,35 +350,31 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ H5T_pad_t H5Tget_inpad(hid_t type_id) { - H5T_t *dt = NULL; - H5T_pad_t ret_value; + H5T_t *dt; /* Datatype */ + H5T_pad_t ret_value; /* Return value */ FUNC_ENTER_API(H5Tget_inpad, H5T_PAD_ERROR) H5TRACE1("Tp", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_PAD_ERROR, "not a datatype") - while (dt->shared->parent) + while(dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ - if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_PAD_ERROR, "operation not defined for datatype class") + if(H5T_FLOAT != dt->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_PAD_ERROR, "operation not defined for datatype class") /* pad */ ret_value = dt->shared->u.atomic.u.f.pad; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tget_inpad() */ /*------------------------------------------------------------------------- @@ -409,37 +390,33 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ herr_t H5Tset_inpad(hid_t type_id, H5T_pad_t pad) { - H5T_t *dt = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *dt; /* Datatype */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tset_inpad, FAIL) H5TRACE2("e", "iTp", type_id, pad); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") - if (pad < H5T_PAD_ZERO || pad >= H5T_NPAD) + if(H5T_STATE_TRANSIENT != dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + if(pad < H5T_PAD_ZERO || pad >= H5T_NPAD) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal internal pad type") - while (dt->shared->parent) + while(dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ - if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class") + if(H5T_FLOAT != dt->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class") /* Commit */ dt->shared->u.atomic.u.f.pad = pad; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tset_inpad() */ |