summaryrefslogtreecommitdiffstats
path: root/src/H5Tprecis.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Tprecis.c')
-rw-r--r--src/H5Tprecis.c50
1 files changed, 19 insertions, 31 deletions
diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c
index 59bac8b..635fb63 100644
--- a/src/H5Tprecis.c
+++ b/src/H5Tprecis.c
@@ -25,7 +25,7 @@
#include "H5Tpkg.h" /* Datatypes */
/* Static local functions */
-static herr_t H5T_set_precision(const H5T_t *dt, size_t prec);
+static herr_t H5T__set_precision(const H5T_t *dt, size_t prec);
@@ -45,10 +45,6 @@ static herr_t H5T_set_precision(const H5T_t *dt, size_t prec);
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works for derived datatypes.
- *
*-------------------------------------------------------------------------
*/
size_t
@@ -101,7 +97,7 @@ H5T_get_precision(const H5T_t *dt)
while(dt->shared->parent)
dt = dt->shared->parent;
if(!H5T_IS_ATOMIC(dt->shared))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified datatype")
/* Precision */
ret_value = dt->shared->u.atomic.prec;
@@ -134,10 +130,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Moved real work to a private function.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -164,7 +156,7 @@ H5Tset_precision(hid_t type_id, size_t prec)
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype")
/* Do the work */
- if (H5T_set_precision(dt, prec)<0)
+ if (H5T__set_precision(dt, prec)<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision")
done:
@@ -173,7 +165,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T_set_precision
+ * Function: H5T__set_precision
*
* Purpose: Sets the precision of a datatype. The precision is
* the number of significant bits which, unless padding is
@@ -195,19 +187,15 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works for derived datatypes.
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_set_precision(const H5T_t *dt, size_t prec)
+H5T__set_precision(const H5T_t *dt, size_t prec)
{
size_t offset, size;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(dt);
@@ -218,8 +206,8 @@ H5T_set_precision(const H5T_t *dt, size_t prec)
HDassert(!(H5T_ENUM==dt->shared->type && 0==dt->shared->u.enumer.nmembs));
if (dt->shared->parent) {
- if (H5T_set_precision(dt->shared->parent, prec)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision for base type")
+ if (H5T__set_precision(dt->shared->parent, prec)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision for base type")
/* Adjust size of datatype appropriately */
if(dt->shared->type==H5T_ARRAY)
@@ -228,18 +216,18 @@ H5T_set_precision(const H5T_t *dt, size_t prec)
dt->shared->size = dt->shared->parent->shared->size;
} else {
if (H5T_IS_ATOMIC(dt->shared)) {
- /* Adjust the offset and size */
- offset = dt->shared->u.atomic.offset;
- size = dt->shared->size;
- if (prec > 8*size)
+ /* Adjust the offset and size */
+ offset = dt->shared->u.atomic.offset;
+ size = dt->shared->size;
+ if (prec > 8*size)
offset = 0;
- else if (offset+prec > 8 * size)
+ else if (offset+prec > 8 * size)
offset = 8 * size - prec;
- if (prec > 8*size)
+ if (prec > 8*size)
size = (prec+7) / 8;
- /* Check that things are still kosher */
- switch (dt->shared->type) {
+ /* Check that things are still kosher */
+ switch (dt->shared->type) {
case H5T_INTEGER:
case H5T_TIME:
case H5T_BITFIELD:
@@ -271,11 +259,11 @@ H5T_set_precision(const H5T_t *dt, size_t prec)
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class")
} /* end switch */
- /* Commit */
- dt->shared->size = size;
+ /* Commit */
+ dt->shared->size = size;
dt->shared->u.atomic.offset = offset;
dt->shared->u.atomic.prec = prec;
- } /* end if */
+ } /* end if */
else
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified datatype")
} /* end else */