summaryrefslogtreecommitdiffstats
path: root/src/H5Tvlen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Tvlen.c')
-rw-r--r--src/H5Tvlen.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 4ee3d0d..26346d6 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -18,10 +18,7 @@
* datatypes in the H5T interface.
*/
-#define H5T_PACKAGE /*suppress error about including H5Tpkg */
-
-/* Interface initialization */
-#define H5_INTERFACE_INIT_FUNC H5T_init_vlen_interface
+#include "H5Tmodule.h" /* This source code file is part of the H5T module */
#include "H5private.h" /* Generic Functions */
@@ -64,27 +61,6 @@ static H5T_vlen_alloc_info_t H5T_vlen_def_vl_alloc_info ={
H5D_VLEN_FREE_INFO
};
-
-/*--------------------------------------------------------------------------
-NAME
- H5T_init_vlen_interface -- Initialize interface-specific information
-USAGE
- herr_t H5T_init_vlen_interface()
-
-RETURNS
- Non-negative on success/Negative on failure
-DESCRIPTION
- Initializes any interface-specific data or routines. (Just calls
- H5T_init_iterface currently).
-
---------------------------------------------------------------------------*/
-static herr_t
-H5T_init_vlen_interface(void)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- FUNC_LEAVE_NOAPI(H5T_init())
-} /* H5T_init_vlen_interface() */
/*-------------------------------------------------------------------------
@@ -113,7 +89,7 @@ H5Tvlen_create(hid_t base_id)
H5TRACE1("i", "i", base_id);
/* Check args */
- 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 up VL datatype */
@@ -147,8 +123,8 @@ done:
H5T_t *
H5T__vlen_create(const H5T_t *base)
{
- H5T_t *dt = NULL; /*new VL datatype */
- H5T_t *ret_value; /*return value */
+ H5T_t *dt = NULL; /* New VL datatype */
+ H5T_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -288,6 +264,8 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
*/
break;
+ case H5T_LOC_MAXLOC:
+ /* MAXLOC is invalid */
default:
HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype location")
} /* end switch */ /*lint !e788 All appropriate cases are covered */
@@ -716,11 +694,11 @@ H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, co
/* Use the user's memory allocation routine if one is defined */
if(vl_alloc_info->alloc_func!=NULL) {
- if(NULL==(t=(vl_alloc_info->alloc_func)((seq_len+1)*base_size,vl_alloc_info->alloc_info)))
+ if(NULL==(t = (char *)(vl_alloc_info->alloc_func)((seq_len+1)*base_size,vl_alloc_info->alloc_info)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data")
} /* end if */
else { /* Default to system malloc */
- if(NULL==(t=H5MM_malloc((seq_len+1)*base_size)))
+ if(NULL==(t = (char *)H5MM_malloc((seq_len+1)*base_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data")
} /* end else */
@@ -779,7 +757,7 @@ static ssize_t
H5T_vlen_disk_getlen(const void *_vl)
{
const uint8_t *vl=(const uint8_t *)_vl; /* Pointer to the disk VL information */
- size_t seq_len; /* Sequence length */
+ size_t seq_len = 0; /* Sequence length */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1119,8 +1097,24 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
} /* end else */
break;
+ /* Don't do anything for simple types */
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ break;
+
+ /* Should never have these values */
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
default:
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype class")
break;
+
} /* end switch */ /*lint !e788 All appropriate cases are covered */
done:
@@ -1167,7 +1161,7 @@ H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim, const
HDassert(H5I_DATATYPE == H5I_get_type(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")
/* Pull the free function and free info pointer out of the op_data and call the recurse datatype free function */