summaryrefslogtreecommitdiffstats
path: root/src/H5Tarray.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-09-10 19:53:38 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-09-10 19:53:38 (GMT)
commitd517c77bc0fe9c9dbfd013d720e1533289decd9f (patch)
tree97f369888eccbb8455ebbc2fd6de9f6834f6b433 /src/H5Tarray.c
parentfc7993a9f068319ed35f13fd153feeb5da3d86a7 (diff)
downloadhdf5-d517c77bc0fe9c9dbfd013d720e1533289decd9f.zip
hdf5-d517c77bc0fe9c9dbfd013d720e1533289decd9f.tar.gz
hdf5-d517c77bc0fe9c9dbfd013d720e1533289decd9f.tar.bz2
[svn-r15610] Description:
Bring r15609 back from trunk: Omnibus compiler warning cleanup & some formatting happiness. Tested on: Mac OS X/32 10.5.4 (amazon) Too minor to require h5committest
Diffstat (limited to 'src/H5Tarray.c')
-rw-r--r--src/H5Tarray.c102
1 files changed, 80 insertions, 22 deletions
diff --git a/src/H5Tarray.c b/src/H5Tarray.c
index 1367272..f7cddb9 100644
--- a/src/H5Tarray.c
+++ b/src/H5Tarray.c
@@ -18,17 +18,65 @@
* the H5T interface.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5T_init_array_interface
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Tpkg.h" /* Datatypes */
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Public Variables */
+/*********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*--------------------------------------------------------------------------
NAME
@@ -46,16 +94,16 @@ DESCRIPTION
static herr_t
H5T_init_array_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_array_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_array_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_array_interface() */
/*-------------------------------------------------------------------------
* Function: H5Tarray_create2
*
- * Purpose: Create a new array data type based on the specified BASE_TYPE.
+ * Purpose: Create a new array datatype based on the specified BASE_TYPE.
* The type is an array with NDIMS dimensionality and the size of the
* array is DIMS. The total member size should be relatively small.
* Array datatypes are currently limited to H5S_MAX_RANK number of
@@ -63,7 +111,7 @@ H5T_init_array_interface(void)
* 0. (i.e. 0 > ndims <= H5S_MAX_RANK) All dimensions sizes must be greater
* than 0 also.
*
- * Return: Success: ID of new array data type
+ * Return: Success: ID of new array datatype
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -74,8 +122,8 @@ H5T_init_array_interface(void)
hid_t
H5Tarray_create2(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */])
{
- H5T_t *base; /* base data type */
- H5T_t *dt; /* new array data type */
+ H5T_t *base; /* base datatype */
+ H5T_t *dt = NULL; /* new array datatype */
unsigned u; /* local index variable */
hid_t ret_value; /* return value */
@@ -90,11 +138,11 @@ H5Tarray_create2(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */])
for(u = 0; u < ndims; u++)
if(!(dim[u] > 0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero-sized dimension specified")
- if(NULL == (base = H5I_object_verify(base_id, H5I_DATATYPE)))
+ if(NULL == (base = (H5T_t *)H5I_object_verify(base_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
- /* Create the actual array datatype */
- if((dt = H5T_array_create(base, ndims, dim)) == NULL)
+ /* Create the array datatype */
+ if(NULL == (dt = H5T_array_create(base, ndims, dim)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to create datatype")
/* Atomize the type */
@@ -102,6 +150,11 @@ H5Tarray_create2(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */])
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype")
done:
+ if(ret_value < 0) {
+ if(dt && H5T_close(dt) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't release datatype")
+ } /* end if */
+
FUNC_LEAVE_API(ret_value)
} /* end H5Tarray_create2() */
@@ -183,14 +236,14 @@ done:
int
H5Tget_array_ndims(hid_t type_id)
{
- H5T_t *dt; /* pointer to array data type */
+ H5T_t *dt; /* pointer to array datatype */
int ret_value; /* return value */
FUNC_ENTER_API(H5Tget_array_ndims, FAIL)
H5TRACE1("Is", "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, FAIL, "not a datatype object")
if(dt->shared->type != H5T_ARRAY)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype")
@@ -253,7 +306,7 @@ H5Tget_array_dims2(hid_t type_id, hsize_t dims[])
H5TRACE2("Is", "i*h", type_id, dims);
/* 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 object")
if(dt->shared->type != H5T_ARRAY)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype")
@@ -308,7 +361,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Tarray_create1
*
- * Purpose: Create a new array data type based on the specified BASE_TYPE.
+ * Purpose: Create a new array datatype based on the specified BASE_TYPE.
* The type is an array with NDIMS dimensionality and the size of the
* array is DIMS. The total member size should be relatively small.
* Array datatypes are currently limited to H5S_MAX_RANK number of
@@ -316,7 +369,7 @@ done:
* 0. (i.e. 0 > ndims <= H5S_MAX_RANK) All dimensions sizes must be greater
* than 0 also.
*
- * Return: Success: ID of new array data type
+ * Return: Success: ID of new array datatype
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -328,8 +381,8 @@ hid_t
H5Tarray_create1(hid_t base_id, int ndims, const hsize_t dim[/* ndims */],
const int UNUSED perm[/* ndims */])
{
- H5T_t *base; /* base data type */
- H5T_t *dt; /* new array data type */
+ H5T_t *base; /* base datatype */
+ H5T_t *dt = NULL; /* new array datatype */
unsigned u; /* local index variable */
hid_t ret_value; /* return value */
@@ -344,11 +397,11 @@ H5Tarray_create1(hid_t base_id, int ndims, const hsize_t dim[/* ndims */],
for(u = 0; u < (unsigned)ndims; u++)
if(!(dim[u] > 0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero-sized dimension specified")
- if(NULL == (base = H5I_object_verify(base_id, H5I_DATATYPE)))
+ if(NULL == (base = (H5T_t *)H5I_object_verify(base_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
- /* Create the actual array datatype */
- if((dt = H5T_array_create(base, (unsigned)ndims, dim)) == NULL)
+ /* Create the array datatype */
+ if(NULL == (dt = H5T_array_create(base, (unsigned)ndims, dim)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to create datatype")
/* Atomize the type */
@@ -356,6 +409,11 @@ H5Tarray_create1(hid_t base_id, int ndims, const hsize_t dim[/* ndims */],
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype")
done:
+ if(ret_value < 0) {
+ if(dt && H5T_close(dt) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't release datatype")
+ } /* end if */
+
FUNC_LEAVE_API(ret_value)
} /* end H5Tarray_create1() */
@@ -376,14 +434,14 @@ done:
int
H5Tget_array_dims1(hid_t type_id, hsize_t dims[], int UNUSED perm[])
{
- H5T_t *dt; /* pointer to array data type */
+ H5T_t *dt; /* Array datatype to query */
int ret_value; /* return value */
FUNC_ENTER_API(H5Tget_array_dims1, FAIL)
H5TRACE3("Is", "i*h*Is", type_id, dims, perm);
/* 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 object")
if(dt->shared->type != H5T_ARRAY)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype")
@@ -391,9 +449,9 @@ H5Tget_array_dims1(hid_t type_id, hsize_t dims[], int UNUSED perm[])
/* Retrieve the sizes of the dimensions */
if((ret_value = H5T_get_array_dims(dt, dims)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get dimension sizes")
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tget_array_dims1() */
-
#endif /* H5_NO_DEPRECATED_SYMBOLS */