From 07d218b717d42d99a4c48fa8d14e29ed7e998d43 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 18 Oct 2000 11:22:45 -0500 Subject: [svn-r2693] Purpose: Bug fix (bug #446) Description: H5Tget_offset return type was size_t and the error return value was 0, but 0 is also a valid successful return value. Solution: Changed the return type to int and the error return value to -1 Platforms tested: FreeBSD 4.1.1 (hawkwind) --- src/H5T.c | 14 +++++++------- src/H5Tpublic.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/H5T.c b/src/H5T.c index 94cca1e..d823c9e 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -2212,9 +2212,9 @@ H5Tset_precision(hid_t type_id, size_t prec) * 2: [0x11] [ pad] [ pad] [0x22] * 3: [0x22] [ pad] [ pad] [0x11] * - * Return: Success: The offset + * Return: Success: The offset (non-negative) * - * Failure: 0 + * Failure: Negative * * Programmer: Robb Matzke * Wednesday, January 7, 1998 @@ -2225,19 +2225,19 @@ H5Tset_precision(hid_t type_id, size_t prec) * *------------------------------------------------------------------------- */ -size_t +int H5Tget_offset(hid_t type_id) { H5T_t *dt = NULL; - size_t offset; + int offset; - FUNC_ENTER(H5Tget_offset, 0); + FUNC_ENTER(H5Tget_offset, -1); H5TRACE1("z","i",type_id); /* Check args */ if (H5I_DATATYPE != H5I_get_type(type_id) || NULL == (dt = H5I_object(type_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an atomic data type"); + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); } if (dt->parent) dt = dt->parent; /*defer to parent*/ if (H5T_COMPOUND==dt->type || H5T_OPAQUE==dt->type) { @@ -2247,7 +2247,7 @@ H5Tget_offset(hid_t type_id) /* Offset */ assert(H5T_is_atomic(dt)); - offset = dt->u.atomic.offset; + offset = (int)dt->u.atomic.offset; FUNC_LEAVE(offset); } diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 6e65dd7..5d218a9 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -483,7 +483,7 @@ __DLL__ H5T_class_t H5Tget_class(hid_t type_id); __DLL__ size_t H5Tget_size(hid_t type_id); __DLL__ H5T_order_t H5Tget_order(hid_t type_id); __DLL__ size_t H5Tget_precision(hid_t type_id); -__DLL__ size_t H5Tget_offset(hid_t type_id); +__DLL__ int H5Tget_offset(hid_t type_id); __DLL__ herr_t H5Tget_pad(hid_t type_id, H5T_pad_t *lsb/*out*/, H5T_pad_t *msb/*out*/); __DLL__ H5T_sign_t H5Tget_sign(hid_t type_id); -- cgit v0.12