diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-04 14:40:21 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-04 14:40:21 (GMT) |
commit | 85637509083b9a0cc9b90f86865613a21a8d3968 (patch) | |
tree | 2a50b1edd73855f2c5657264fab61a917b867f72 | |
parent | 303d35202ab14f20dd393893bca92bb078813ed7 (diff) | |
download | hdf5-85637509083b9a0cc9b90f86865613a21a8d3968.zip hdf5-85637509083b9a0cc9b90f86865613a21a8d3968.tar.gz hdf5-85637509083b9a0cc9b90f86865613a21a8d3968.tar.bz2 |
[svn-r7444] Purpose:
Code cleanup
Description:
More de-linting
Platforms tested:
FreeBSD 4.9 (sleipnir)
Too small to need h5committest
-rw-r--r-- | src/H5Tnative.c | 178 | ||||
-rw-r--r-- | src/H5Toffset.c | 46 | ||||
-rwxr-xr-x | src/hdf5.lnt | 2 |
3 files changed, 117 insertions, 109 deletions
diff --git a/src/H5Tnative.c b/src/H5Tnative.c index a5005d4..cf6a953 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -23,12 +23,12 @@ /* (Put before include files to avoid problems with inline functions) */ #define PABLO_MASK H5Tnative_mask -#include "H5private.h" /*generic functions */ -#include "H5Eprivate.h" /*error handling */ -#include "H5Iprivate.h" /*ID functions */ -#include "H5Pprivate.h" /*property list */ -#include "H5MMprivate.h" /*memory management */ -#include "H5Tpkg.h" /*data-type functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Tpkg.h" /* Datatypes */ /* Interface initialization */ static int interface_initialize_g = 0; @@ -62,9 +62,9 @@ DESCRIPTION static herr_t H5T_init_native_interface(void) { - FUNC_ENTER_NOINIT(H5T_init_native_interface); + FUNC_ENTER_NOINIT(H5T_init_native_interface) - FUNC_LEAVE_NOAPI(H5T_init()); + FUNC_LEAVE_NOAPI(H5T_init()) } /* H5T_init_native_interface() */ @@ -108,31 +108,32 @@ H5Tget_native_type(hid_t type_id, H5T_direction_t direction) size_t comp_size=0; /* Compound datatype's size */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Tget_native_type, FAIL); + FUNC_ENTER_API(H5Tget_native_type, FAIL) H5TRACE2("i","iTd",type_id,direction); /* check argument */ if(NULL==(dt=H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if(direction!=H5T_DIR_DEFAULT && direction!=H5T_DIR_ASCEND && direction!=H5T_DIR_DESCEND) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not valid direction value"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not valid direction value") if((new_dt = H5T_get_native_type(dt, direction, NULL, NULL, &comp_size))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot retrieve native type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot retrieve native type") if((ret_value=H5I_register(H5I_DATATYPE, new_dt)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type") done: /* Error cleanup */ if(ret_value<0) { if(new_dt) - H5T_close(new_dt); + if(H5T_close(new_dt)<0) + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release datatype") } /* end if */ - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -165,15 +166,15 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig int i; /* Local index variable */ H5T_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5T_get_native_type, NULL); + FUNC_ENTER_NOAPI(H5T_get_native_type, NULL) assert(dtype); if((h5_class = H5T_get_class(dtype))<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid class"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid class") if((size = H5T_get_size(dtype))==0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid size"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid size") switch(h5_class) { case H5T_INTEGER: @@ -181,31 +182,31 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig H5T_sign_t sign; /* Signedness of integer type */ if((sign = H5T_get_sign(dtype))==H5T_SGN_ERROR) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid signess"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid signess") if((ret_value = H5T_get_native_integer(size, sign, direction, struct_align, offset, comp_size))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve integer type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve integer type") } break; case H5T_FLOAT: if((ret_value = H5T_get_native_float(size, direction, struct_align, offset, comp_size))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") break; case H5T_STRING: if((ret_value=H5T_copy(dtype, H5T_COPY_TRANSIENT))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") if(H5T_IS_VL_STRING(dtype)) { /* Update size, offset and compound alignment for parent. */ if(H5T_cmp_offset(comp_size, offset, sizeof(char *), 1, H5T_POINTER_COMP_ALIGN_g, struct_align)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") } else { /* Update size, offset and compound alignment for parent. */ if(H5T_cmp_offset(comp_size, offset, sizeof(char), size, H5T_NATIVE_SCHAR_COMP_ALIGN_g, struct_align)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") } break; @@ -215,7 +216,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig case H5T_BITFIELD: case H5T_OPAQUE: if((ret_value=H5T_copy(dtype, H5T_COPY_TRANSIENT))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") break; @@ -226,11 +227,11 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig int not_equal; if((ret_value=H5T_copy(dtype, H5T_COPY_TRANSIENT))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") /* Decide if the data type is object or dataset region reference. */ if(NULL==(dt=H5I_object(H5T_STD_REF_OBJ_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") not_equal = H5T_cmp(ret_value, dt); /* Update size, offset and compound alignment for parent. */ @@ -243,7 +244,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig } if(H5T_cmp_offset(comp_size, offset, ref_size, 1, align, struct_align)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") } break; @@ -257,28 +258,29 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig char **comp_mname; /* List of member names in compound type */ if((nmemb = H5T_get_nmembers(dtype))<=0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "compound data type doesn't have any member"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "compound data type doesn't have any member") - if((memb_list = (H5T_t**)H5MM_malloc(nmemb*sizeof(H5T_t*)))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); - if((memb_offset = (size_t*)H5MM_calloc(nmemb*sizeof(size_t)))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); - if((comp_mname = (char**)H5MM_malloc(nmemb*sizeof(char*)))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); + H5_CHECK_OVERFLOW(nmemb,int,size_t); + if((memb_list = (H5T_t**)H5MM_malloc((size_t)nmemb*sizeof(H5T_t*)))==NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") + if((memb_offset = (size_t*)H5MM_calloc((size_t)nmemb*sizeof(size_t)))==NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") + if((comp_mname = (char**)H5MM_malloc((size_t)nmemb*sizeof(char*)))==NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") /* Construct child compound type and retrieve a list of their IDs, offsets, total size, and alignment for compound type. */ for(i=0; i<nmemb; i++) { if((memb_type = H5T_get_member_type(dtype, i))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed") if((comp_mname[i] = H5T_get_member_name(dtype, i))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed") if((memb_list[i] = H5T_get_native_type(memb_type, direction, &children_st_align, &(memb_offset[i]), &children_size))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member identifier retrieval failed"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member identifier retrieval failed") if(H5T_close(memb_type)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype") } /* The alignment for whole compound type */ @@ -287,12 +289,12 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig /* Construct new compound type based on native type */ if((new_type=H5T_create(H5T_COMPOUND, children_size))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot create a compound type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot create a compound type") /* Insert members for the new compound type */ for(i=0; i<nmemb; i++) { if(H5T_insert(new_type, comp_mname[i], memb_offset[i], memb_list[i])<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member to compound datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member to compound datatype") } /* Update size, offset and compound alignment for parent. */ @@ -305,7 +307,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig /* Close member data type */ for(i=0; i<nmemb; i++) { if(H5T_close(memb_list[i])<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype") /* Free member names in list */ H5MM_xfree(comp_mname[i]); @@ -330,40 +332,40 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig /* Retrieve base type for enumarate type */ if((super_type=H5T_get_super(dtype))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get base type for enumarate type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get base type for enumarate type") if((nat_super_type = H5T_get_native_type(super_type, direction, struct_align, offset, comp_size))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "base native type retrieval failed"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "base native type retrieval failed") if((super_type_id=H5I_register(H5I_DATATYPE, super_type))<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype") if((nat_super_type_id=H5I_register(H5I_DATATYPE, nat_super_type))<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype") /* Allocate room for the enum values */ if((tmp_memb_value = H5MM_calloc(H5T_get_size(super_type)))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") if((memb_value = H5MM_calloc(H5T_get_size(nat_super_type)))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") /* Construct new enum type based on native type */ if((new_type=H5T_enum_create(nat_super_type))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create enum type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create enum type") /* Retrieve member info and insert members into new enum type */ if((nmemb = H5T_get_nmembers(dtype))<=0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "enumarate data type doesn't have any member"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "enumarate data type doesn't have any member") for(i=0; i<nmemb; i++) { if((memb_name=H5T_get_member_name(dtype, i))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member name"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member name") if(H5T_get_member_value(dtype, i, tmp_memb_value)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") HDmemcpy(memb_value, tmp_memb_value, H5T_get_size(super_type)); if(H5Tconvert(super_type_id, nat_super_type_id, (hsize_t)1, memb_value, NULL, H5P_DEFAULT)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") if(H5T_enum_insert(new_type, memb_name, memb_value)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member") H5MM_xfree(memb_name); } H5MM_xfree(memb_value); @@ -371,10 +373,10 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig /* Close base type */ if(H5Tclose(nat_super_type_id)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype") /* Close super type */ if(H5Tclose(super_type_id)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype") ret_value = new_type; } @@ -391,36 +393,37 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig /* Retrieve dimension information for array data type */ if((array_rank=H5T_get_array_ndims(dtype))<=0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension rank"); - if((dims = (hsize_t*)H5MM_malloc(array_rank*sizeof(hsize_t)))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension rank") + H5_CHECK_OVERFLOW(array_rank,int,size_t); + if((dims = (hsize_t*)H5MM_malloc((size_t)array_rank*sizeof(hsize_t)))==NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") if(H5T_get_array_dims(dtype, dims, NULL)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension size"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension size") /* Retrieve base type for array type */ if((super_type=H5T_get_super(dtype))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for enumarate type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for enumarate type") if((nat_super_type = H5T_get_native_type(super_type, direction, &super_align, &super_offset, &super_size))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed") /* Close super type */ if(H5T_close(super_type)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype") /* Create a new array type based on native type */ if((new_type=H5T_array_create(nat_super_type, array_rank, dims, NULL))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create array type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create array type") /* Close base type */ if(H5T_close(nat_super_type)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype") for(i=0; i<array_rank; i++) nelems *= dims[i]; H5_CHECK_OVERFLOW(nelems,hsize_t,size_t); if(H5T_cmp_offset(comp_size, offset, super_size, (size_t)nelems, super_align, struct_align)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") H5MM_xfree(dims); ret_value = new_type; @@ -435,47 +438,48 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig /* Retrieve base type for array type */ if((super_type=H5T_get_super(dtype))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for enumarate type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for enumarate type") /* Don't need alignment, offset information if this VL isn't a field of compound type. If it * is, go to a few steps below to compute the information directly. */ if((nat_super_type = H5T_get_native_type(super_type, direction, NULL, NULL, &super_size))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed") /* Close super type */ if(H5T_close(super_type)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype") /* Create a new array type based on native type */ if((new_type=H5T_vlen_create(nat_super_type))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create VL type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create VL type") /* Close base type */ if(H5T_close(nat_super_type)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype") /* Update size, offset and compound alignment for parent compound type directly. */ vl_align = H5T_HVL_COMP_ALIGN_g; vl_size = sizeof(hvl_t); if(H5T_cmp_offset(comp_size, offset, vl_size, 1, vl_align, struct_align)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") ret_value = new_type; } break; default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "data type doesn't match any native type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "data type doesn't match any native type") } done: /* Error cleanup */ if(ret_value==NULL) { if(new_type) - H5T_close(new_type); + if(H5T_close(new_type)<0) + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, NULL, "unable to release datatype") } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -513,7 +517,7 @@ H5T_get_native_integer(size_t size, H5T_sign_t sign, H5T_direction_t direction, } match=H5T_NATIVE_INT_MATCH_UNKNOWN; H5T_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5T_get_native_integer, NULL); + FUNC_ENTER_NOAPI(H5T_get_native_integer, NULL) assert(size>0); @@ -637,16 +641,16 @@ H5T_get_native_integer(size_t size, H5T_sign_t sign, H5T_direction_t direction, /* Create new native type */ assert(tid>=0); if(NULL==(dt=H5I_object(tid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") if((ret_value=H5T_copy(dt, H5T_COPY_TRANSIENT))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") /* compute size and offset of compound type member. */ if(H5T_cmp_offset(comp_size, offset, native_size, 1, align, struct_align)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -681,7 +685,7 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig } match=H5T_NATIVE_FLOAT_MATCH_UNKNOWN; H5T_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5T_get_native_integer, NULL); + FUNC_ENTER_NOAPI(H5T_get_native_integer, NULL) assert(size>0); @@ -752,16 +756,16 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig /* Create new native type */ assert(tid>=0); if(NULL==(dt=H5I_object(tid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") if((ret_value=H5T_copy(dt, H5T_COPY_TRANSIENT))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") /* compute offset of compound type member. */ if(H5T_cmp_offset(comp_size, offset, native_size, 1, align, struct_align)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -789,7 +793,7 @@ H5T_cmp_offset(size_t *comp_size, size_t *offset, size_t elem_size, { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(H5T_cmp_offset, FAIL); + FUNC_ENTER_NOAPI(H5T_cmp_offset, FAIL) if(offset && comp_size) { if(align>1 && *comp_size%align) { @@ -807,6 +811,6 @@ H5T_cmp_offset(size_t *comp_size, size_t *offset, size_t elem_size, *struct_align = align; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } diff --git a/src/H5Toffset.c b/src/H5Toffset.c index 36a806d..f4151a3 100644 --- a/src/H5Toffset.c +++ b/src/H5Toffset.c @@ -19,13 +19,15 @@ #define H5T_PACKAGE /*suppress error about including H5Tpkg */ -#include "H5private.h" /*generic functions */ -#include "H5Eprivate.h" /*error handling */ -#include "H5Iprivate.h" /*ID functions */ -#include "H5Tpkg.h" /*data-type functions */ - +/* Pablo information */ +/* (Put before include files to avoid problems with inline functions) */ #define PABLO_MASK H5Toffset_mask +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Tpkg.h" /* Datatypes */ + /* Interface initialization */ static int interface_initialize_g = 0; #define INTERFACE_INIT H5T_init_offset_interface @@ -51,9 +53,9 @@ DESCRIPTION static herr_t H5T_init_offset_interface(void) { - FUNC_ENTER_NOINIT(H5T_init_offset_interface); + FUNC_ENTER_NOINIT(H5T_init_offset_interface) - FUNC_LEAVE_NOAPI(H5T_init()); + FUNC_LEAVE_NOAPI(H5T_init()) } /* H5T_init_offset_interface() */ @@ -97,22 +99,22 @@ H5Tget_offset(hid_t type_id) H5T_t *dt = NULL; int ret_value; - FUNC_ENTER_API(H5Tget_offset, -1); + FUNC_ENTER_API(H5Tget_offset, -1) H5TRACE1("Is","i",type_id); /* Check args */ if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type") while (dt->parent) dt = dt->parent; /*defer to parent*/ if (!H5T_IS_ATOMIC(dt)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") /* Offset */ ret_value = (int)dt->u.atomic.offset; done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -161,27 +163,27 @@ H5Tset_offset(hid_t type_id, size_t offset) H5T_t *dt = NULL; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Tset_offset, FAIL); + FUNC_ENTER_API(H5Tset_offset, FAIL) H5TRACE2("e","iz",type_id,offset); /* Check args */ if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type") if (H5T_STATE_TRANSIENT!=dt->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only"); + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") if (H5T_STRING == dt->type && offset != 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset must be zero for this type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset must be zero for this type") if (H5T_ENUM==dt->type && dt->u.enumer.nmembs>0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") if (H5T_COMPOUND==dt->type || H5T_REFERENCE==dt->type || H5T_OPAQUE==dt->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for this datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for this datatype") /* Do the real work */ if (H5T_set_offset(dt, offset)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -229,7 +231,7 @@ H5T_set_offset(H5T_t *dt, size_t offset) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_set_offset, FAIL); + FUNC_ENTER_NOAPI(H5T_set_offset, FAIL) /* Check args */ assert(dt); @@ -241,7 +243,7 @@ H5T_set_offset(H5T_t *dt, size_t offset) if (dt->parent) { if (H5T_set_offset(dt->parent, offset)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset for base type"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset for base type") /* Adjust size of datatype appropriately */ if(dt->type==H5T_ARRAY) @@ -255,6 +257,6 @@ H5T_set_offset(H5T_t *dt, size_t offset) } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } diff --git a/src/hdf5.lnt b/src/hdf5.lnt index d5ae28b..364c011 100755 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -91,6 +91,8 @@ H5FL.c H5FO.c + H5Tnative.c + H5Toffset.c H5Topaque.c H5Torder.c H5Tpad.c |