diff options
-rw-r--r-- | src/H5A.c | 67 | ||||
-rw-r--r-- | src/H5Aint.c | 16 | ||||
-rw-r--r-- | src/H5B2cache.c | 6 | ||||
-rw-r--r-- | src/H5B2int.c | 2 | ||||
-rw-r--r-- | src/H5Bcache.c | 6 | ||||
-rw-r--r-- | src/H5D.c | 82 | ||||
-rw-r--r-- | src/H5Dchunk.c | 41 | ||||
-rw-r--r-- | src/H5Dcompact.c | 9 | ||||
-rw-r--r-- | src/H5Dcontig.c | 32 | ||||
-rw-r--r-- | src/H5Defl.c | 12 | ||||
-rw-r--r-- | src/H5Dfill.c | 12 | ||||
-rw-r--r-- | src/H5Dint.c | 54 | ||||
-rw-r--r-- | src/H5Dio.c | 4 | ||||
-rw-r--r-- | src/H5Doh.c | 4 | ||||
-rw-r--r-- | src/H5Dpkg.h | 12 | ||||
-rw-r--r-- | src/H5E.c | 8 | ||||
-rw-r--r-- | src/H5F.c | 234 | ||||
-rw-r--r-- | src/H5FDspace.c | 16 | ||||
-rw-r--r-- | src/H5FL.c | 4 | ||||
-rw-r--r-- | src/H5FScache.c | 6 | ||||
-rw-r--r-- | src/H5FSsection.c | 2 | ||||
-rw-r--r-- | src/H5Gloc.c | 10 | ||||
-rw-r--r-- | src/H5Gtest.c | 12 | ||||
-rw-r--r-- | src/H5Gtraverse.c | 20 | ||||
-rw-r--r-- | src/H5HP.c | 22 | ||||
-rw-r--r-- | src/H5I.c | 4 | ||||
-rw-r--r-- | src/H5MP.c | 2 | ||||
-rw-r--r-- | src/H5O.c | 24 | ||||
-rw-r--r-- | src/H5Oattr.c | 11 | ||||
-rw-r--r-- | src/H5Ocache.c | 2 | ||||
-rw-r--r-- | src/H5Odtype.c | 21 | ||||
-rw-r--r-- | src/H5Ofill.c | 14 | ||||
-rw-r--r-- | src/H5Olayout.c | 26 | ||||
-rw-r--r-- | src/H5Opkg.h | 2 | ||||
-rw-r--r-- | src/H5Pdcpl.c | 74 | ||||
-rw-r--r-- | src/H5R.c | 22 | ||||
-rw-r--r-- | src/H5RC.c | 18 | ||||
-rw-r--r-- | src/H5RS.c | 14 | ||||
-rw-r--r-- | src/H5SL.c | 107 | ||||
-rw-r--r-- | src/H5SMcache.c | 14 | ||||
-rw-r--r-- | src/H5ST.c | 63 | ||||
-rw-r--r-- | src/H5Snone.c | 6 | ||||
-rw-r--r-- | src/H5Sselect.c | 108 | ||||
-rw-r--r-- | src/H5T.c | 555 | ||||
-rw-r--r-- | src/H5Tarray.c | 102 | ||||
-rw-r--r-- | src/H5Tcommit.c | 104 | ||||
-rw-r--r-- | src/H5Tcompound.c | 242 | ||||
-rw-r--r-- | src/H5Tconv.c | 2107 | ||||
-rw-r--r-- | src/H5Tfields.c | 125 | ||||
-rw-r--r-- | src/H5Tpkg.h | 40 | ||||
-rw-r--r-- | src/H5Tprivate.h | 21 | ||||
-rw-r--r-- | src/H5Tvisit.c | 2 | ||||
-rw-r--r-- | src/H5Tvlen.c | 66 | ||||
-rw-r--r-- | src/H5Zprivate.h | 3 | ||||
-rw-r--r-- | src/H5Ztrans.c | 134 | ||||
-rw-r--r-- | src/H5detect.c | 137 |
56 files changed, 2559 insertions, 2304 deletions
@@ -345,7 +345,7 @@ done: * Purpose: * This is the guts of creating an attribute. * Usage: - * hid_t H5A_create (ent, name, type, space) + * hid_t H5A_create(ent, name, type, space) * const H5G_entry_t *ent; IN: Pointer to symbol table entry for object to attribute * const char *name; IN: Name of attribute * H5T_t *type; IN: Datatype of attribute @@ -363,7 +363,7 @@ hid_t H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id, hid_t dxpl_id) { - H5A_t *attr = NULL; + H5A_t *attr = NULL; /* Attribute created */ hssize_t snelmts; /* elements in attribute */ size_t nelmts; /* elements in attribute */ htri_t tri_ret; /* htri_t return value */ @@ -392,7 +392,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace extent has not been set") /* Build the attribute information */ - if((attr = H5FL_CALLOC(H5A_t)) == NULL) + if(NULL == (attr = H5FL_CALLOC(H5A_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for attribute info") if(NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t))) @@ -415,10 +415,11 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, /* Copy the attribute name */ attr->shared->name = H5MM_xstrdup(name); - /* Copy the attribute's datatype */ - attr->shared->dt = H5T_copy(type, H5T_COPY_ALL); + /* Copy datatype */ + if(NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared datatype info") - /* Mark any datatypes as being on disk now */ + /* Mark datatype as being on disk now */ if(H5T_set_loc(attr->shared->dt, loc->oloc->file, H5T_LOC_DISK) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") @@ -478,7 +479,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, HDassert(attr->shared->dt_size > 0); HDassert(attr->shared->ds_size > 0); - attr->shared->data_size = nelmts * H5T_get_size(attr->shared->dt); + attr->shared->data_size = nelmts * H5T_GET_SIZE(attr->shared->dt); /* Hold the symbol table entry (and file) open */ if(H5O_open(&(attr->shared->oloc)) < 0) @@ -912,9 +913,9 @@ done: herr_t H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) { - H5A_t *attr; /* Attribute object for ID */ - const H5T_t *mem_type = NULL; - herr_t ret_value; + H5A_t *attr; /* Attribute object for ID */ + H5T_t *mem_type; /* Memory datatype */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Awrite, FAIL) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); @@ -981,8 +982,8 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) /* If there's actually data elements for the attribute, make a copy of the data passed in */ if(nelmts > 0) { /* Get the memory and file datatype sizes */ - src_type_size = H5T_get_size(mem_type); - dst_type_size = H5T_get_size(attr->shared->dt); + src_type_size = H5T_GET_SIZE(mem_type); + dst_type_size = H5T_GET_SIZE(attr->shared->dt); /* Convert memory buffer into disk buffer */ /* Set up type conversion function */ @@ -997,8 +998,10 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) /* Get the maximum buffer size needed and allocate it */ buf_size = nelmts * MAX(src_type_size, dst_type_size); - if(NULL == (tconv_buf = H5FL_BLK_MALLOC (attr_buf, buf_size)) || NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") + if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") /* Copy the user's data into the buffer for conversion */ HDmemcpy(tconv_buf, buf, (src_type_size * nelmts)); @@ -1043,9 +1046,9 @@ done: if(dst_id >= 0) (void)H5I_dec_ref(dst_id, FALSE); if(tconv_buf && !tconv_owned) - H5FL_BLK_FREE(attr_buf, tconv_buf); + (void)H5FL_BLK_FREE(attr_buf, tconv_buf); if(bkg_buf) - H5FL_BLK_FREE(attr_buf, bkg_buf); + (void)H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* H5A_write() */ @@ -1070,9 +1073,9 @@ done: herr_t H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) { - H5A_t *attr; /* Attribute object for ID */ - const H5T_t *mem_type = NULL; - herr_t ret_value; + H5A_t *attr; /* Attribute object for ID */ + H5T_t *mem_type; /* Memory datatype */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Aread, FAIL) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); @@ -1137,8 +1140,8 @@ H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) if(nelmts > 0) { /* Get the memory and file datatype sizes */ - src_type_size = H5T_get_size(attr->shared->dt); - dst_type_size = H5T_get_size(mem_type); + src_type_size = H5T_GET_SIZE(attr->shared->dt); + dst_type_size = H5T_GET_SIZE(mem_type); /* Check if the attribute has any data yet, if not, fill with zeroes */ if(attr->obj_opened && !attr->shared->initialized) @@ -1157,8 +1160,10 @@ H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) /* Get the maximum buffer size needed and allocate it */ buf_size = nelmts * MAX(src_type_size, dst_type_size); - if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size)) || NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") + if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") /* Copy the attribute data into the buffer for conversion */ HDmemcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts)); @@ -1187,9 +1192,9 @@ done: if(dst_id >= 0) (void)H5I_dec_ref(dst_id, FALSE); if(tconv_buf) - H5FL_BLK_FREE(attr_buf, tconv_buf); + (void)H5FL_BLK_FREE(attr_buf, tconv_buf); if(bkg_buf) - H5FL_BLK_FREE(attr_buf, bkg_buf); + (void)H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* H5A_read() */ @@ -1262,7 +1267,7 @@ H5Aget_type(hid_t attr_id) { H5A_t *attr; /* Attribute object for ID */ H5T_t *dt = NULL; /* Copy of attribute's datatype */ - hid_t ret_value; + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5Aget_type, FAIL) H5TRACE1("i", "i", attr_id); @@ -1289,11 +1294,13 @@ H5Aget_type(hid_t attr_id) /* Atomize */ if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype atom") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype ID") done: - if(ret_value < 0 && dt) - (void)H5T_close(dt); + if(ret_value < 0) { + if(dt && H5T_close(dt) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release datatype") + } /* end if */ FUNC_LEAVE_API(ret_value) } /* H5Aget_type() */ @@ -2447,7 +2454,7 @@ H5A_close(H5A_t *attr) HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path") attr->shared = NULL; - H5FL_FREE(H5A_t, attr); + (void)H5FL_FREE(H5A_t, attr); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Aint.c b/src/H5Aint.c index 23a4e15..340b4c7 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -384,8 +384,8 @@ H5A_attr_cmp_name_inc(const void *attr1, const void *attr2) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_attr_cmp_name_inc) - FUNC_LEAVE_NOAPI(HDstrcmp((*(const H5A_t **)attr1)->shared->name, - (*(const H5A_t **)attr2)->shared->name)) + FUNC_LEAVE_NOAPI(HDstrcmp((*(const H5A_t * const *)attr1)->shared->name, + (*(const H5A_t * const *)attr2)->shared->name)) } /* end H5A_attr_cmp_name_inc() */ @@ -412,8 +412,8 @@ H5A_attr_cmp_name_dec(const void *attr1, const void *attr2) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_attr_cmp_name_dec) - FUNC_LEAVE_NOAPI(HDstrcmp((*(const H5A_t **)attr2)->shared->name, - (*(const H5A_t **)attr1)->shared->name)) + FUNC_LEAVE_NOAPI(HDstrcmp((*(const H5A_t * const *)attr2)->shared->name, + (*(const H5A_t * const *)attr1)->shared->name)) } /* end H5A_attr_cmp_name_dec() */ @@ -441,9 +441,9 @@ H5A_attr_cmp_corder_inc(const void *attr1, const void *attr2) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_attr_cmp_corder_inc) - if((*(const H5A_t **)attr1)->shared->crt_idx < (*(const H5A_t **)attr2)->shared->crt_idx) + if((*(const H5A_t * const *)attr1)->shared->crt_idx < (*(const H5A_t * const *)attr2)->shared->crt_idx) ret_value = -1; - else if((*(const H5A_t **)attr1)->shared->crt_idx > (*(const H5A_t **)attr2)->shared->crt_idx) + else if((*(const H5A_t * const *)attr1)->shared->crt_idx > (*(const H5A_t * const *)attr2)->shared->crt_idx) ret_value = 1; else ret_value = 0; @@ -476,9 +476,9 @@ H5A_attr_cmp_corder_dec(const void *attr1, const void *attr2) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_attr_cmp_corder_dec) - if((*(const H5A_t **)attr1)->shared->crt_idx < (*(const H5A_t **)attr2)->shared->crt_idx) + if((*(const H5A_t * const *)attr1)->shared->crt_idx < (*(const H5A_t * const *)attr2)->shared->crt_idx) ret_value = 1; - else if((*(const H5A_t **)attr1)->shared->crt_idx > (*(const H5A_t **)attr2)->shared->crt_idx) + else if((*(const H5A_t * const *)attr1)->shared->crt_idx > (*(const H5A_t * const *)attr2)->shared->crt_idx) ret_value = -1; else ret_value = 0; diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 686bea6..f6d95ce 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -392,7 +392,7 @@ H5B2_cache_hdr_dest(H5F_t UNUSED *f, H5B2_t *bt2) H5RC_DEC(bt2->shared); /* Free B-tree header info */ - H5FL_FREE(H5B2_t, bt2); + (void)H5FL_FREE(H5B2_t, bt2); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5B2_cache_hdr_dest() */ @@ -742,7 +742,7 @@ H5B2_cache_internal_dest(H5F_t UNUSED *f, H5B2_internal_t *internal) H5RC_DEC(internal->shared); /* Free B-tree internal node info */ - H5FL_FREE(H5B2_internal_t, internal); + (void)H5FL_FREE(H5B2_internal_t, internal); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5B2_cache_internal_dest() */ @@ -1061,7 +1061,7 @@ H5B2_cache_leaf_dest(H5F_t UNUSED *f, H5B2_leaf_t *leaf) H5RC_DEC(leaf->shared); /* Free B-tree leaf node info */ - H5FL_FREE(H5B2_leaf_t,leaf); + (void)H5FL_FREE(H5B2_leaf_t, leaf); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5B2_cache_leaf_dest() */ diff --git a/src/H5B2int.c b/src/H5B2int.c index c192c65..0a95461 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -296,7 +296,7 @@ H5B2_shared_free(void *_shared) } /* end if */ /* Free the shared B-tree info itself */ - H5FL_FREE(H5B2_shared_t, shared); + (void)H5FL_FREE(H5B2_shared_t, shared); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Bcache.c b/src/H5Bcache.c index e577dc2..e19efb4 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -333,10 +333,10 @@ H5B_dest(H5F_t UNUSED *f, H5B_t *bt) HDassert(bt); HDassert(bt->rc_shared); - H5FL_SEQ_FREE(haddr_t,bt->child); - (void)H5FL_BLK_FREE(native_block,bt->native); + H5FL_SEQ_FREE(haddr_t, bt->child); + (void)H5FL_BLK_FREE(native_block, bt->native); H5RC_DEC(bt->rc_shared); - H5FL_FREE(H5B_t,bt); + (void)H5FL_FREE(H5B_t, bt); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5B_dest() */ @@ -496,43 +496,41 @@ hid_t H5Dget_type(hid_t dset_id) { - H5D_t *dset = NULL; - H5T_t *copied_type = NULL; - hid_t ret_value = FAIL; + H5D_t *dset; /* Dataset */ + H5T_t *dt = NULL; /* Datatype to return */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5Dget_type, FAIL) H5TRACE1("i", "i", dset_id); /* Check args */ - if(NULL==(dset=(H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - /* Copy the datatype and mark it read-only */ - if(NULL==(copied_type=H5T_copy (dset->shared->type, H5T_COPY_REOPEN))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy the datatype") + /* Copy the dataset's datatype */ + if(NULL == (dt = H5T_copy(dset->shared->type, H5T_COPY_REOPEN))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy datatype") /* Mark any datatypes as being in memory now */ - if(H5T_set_loc(copied_type, NULL, H5T_LOC_MEMORY) < 0) + if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") /* Lock copied type */ - if(H5T_lock (copied_type, FALSE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype") + if(H5T_lock(dt, FALSE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to lock transient datatype") /* Create an atom */ - if((ret_value=H5I_register (H5I_DATATYPE, copied_type, TRUE)) < 0) + if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") done: if(ret_value < 0) { - if(copied_type!=NULL) { - if(H5T_close (copied_type) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") - } /* end if */ + if(dt && H5T_close(dt) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") } /* end if */ FUNC_LEAVE_API(ret_value) -} +} /* end H5Dget_type() */ /*------------------------------------------------------------------------- @@ -613,7 +611,7 @@ H5Dget_create_plist(hid_t dset_id) } /* end if */ /* Allocate a background buffer */ - bkg_size = MAX(H5T_get_size(copied_fill.type), H5T_get_size(dset->shared->type)); + bkg_size = MAX(H5T_GET_SIZE(copied_fill.type), H5T_GET_SIZE(dset->shared->type)); if(H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) { H5I_dec_ref(src_id, FALSE); H5I_dec_ref(dst_id, FALSE); @@ -674,22 +672,22 @@ done: hsize_t H5Dget_storage_size(hid_t dset_id) { - H5D_t *dset=NULL; + H5D_t *dset; /* Dataset to query */ hsize_t ret_value; /* Return value */ FUNC_ENTER_API(H5Dget_storage_size, 0) H5TRACE1("h", "i", dset_id); /* Check args */ - if(NULL==(dset=(H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset") /* Set return value */ - ret_value = H5D_get_storage_size(dset,H5AC_ind_dxpl_id); + ret_value = H5D_get_storage_size(dset, H5AC_ind_dxpl_id); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Dget_storage_size() */ /*------------------------------------------------------------------------- @@ -709,14 +707,14 @@ done: haddr_t H5Dget_offset(hid_t dset_id) { - H5D_t *dset=NULL; + H5D_t *dset; /* Dataset to query */ haddr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Dget_offset, HADDR_UNDEF) H5TRACE1("a", "i", dset_id); /* Check args */ - if(NULL==(dset=(H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a dataset") /* Set return value */ @@ -724,7 +722,7 @@ H5Dget_offset(hid_t dset_id) done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Dget_offset() */ /*------------------------------------------------------------------------- @@ -790,22 +788,22 @@ herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, void *operator_data) { - H5S_t *space = NULL; - herr_t ret_value; + H5S_t *space; /* Dataspace for iteration */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Diterate, FAIL) H5TRACE5("e", "*xiix*x", buf, type_id, space_id, op, operator_data); /* Check args */ - if(NULL==op) + if(NULL == op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid operator") - if(buf==NULL) + if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer") if(H5I_DATATYPE != H5I_get_type(type_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype") if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") - if(!(H5S_has_extent(space)) ) + if(!(H5S_has_extent(space))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set") ret_value = H5D_iterate(buf, type_id, space, op, operator_data); @@ -833,8 +831,8 @@ done: herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf) { - H5S_t *space = NULL; - herr_t ret_value; + H5S_t *space; /* Dataspace for iteration */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Dvlen_reclaim, FAIL) H5TRACE4("e", "iii*x", type_id, space_id, plist_id, buf); @@ -891,18 +889,18 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size) { H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0, 0}; - char bogus; /* bogus value to pass to H5Diterate() */ - H5S_t *space = NULL; + char bogus; /* bogus value to pass to H5Diterate() */ + H5S_t *space; /* Dataspace for iteration */ H5P_genclass_t *pclass; /* Property class */ H5P_genplist_t *plist; /* Property list */ - herr_t ret_value=FAIL; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Dvlen_get_buf_size, FAIL) H5TRACE4("e", "iii*h", dataset_id, type_id, space_id, size); /* Check args */ - if(H5I_DATASET!=H5I_get_type(dataset_id) || - H5I_DATATYPE!=H5I_get_type(type_id) || size==NULL) + if(H5I_DATASET != H5I_get_type(dataset_id) || + H5I_DATATYPE != H5I_get_type(type_id) || size == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") @@ -910,10 +908,10 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set") /* Save the dataset ID */ - vlen_bufsize.dataset_id=dataset_id; + vlen_bufsize.dataset_id = dataset_id; /* Get a copy of the dataspace ID */ - if((vlen_bufsize.fspace_id=H5Dget_space(dataset_id)) < 0) + if((vlen_bufsize.fspace_id = H5Dget_space(dataset_id)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy dataspace") /* Create a scalar for the memory dataspace */ @@ -921,9 +919,9 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't create dataspace") /* Grab the temporary buffers required */ - if((vlen_bufsize.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, (size_t)1)) == NULL) + if(NULL == (vlen_bufsize.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, (size_t)1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") - if((vlen_bufsize.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1)) == NULL) + if(NULL == (vlen_bufsize.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") /* Get the pointer to the dataset transfer class */ @@ -931,7 +929,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") /* Change to the custom memory allocation routines for reading VL data */ - if((vlen_bufsize.xfer_pid=H5P_create_id(pclass, FALSE)) < 0) + if((vlen_bufsize.xfer_pid = H5P_create_id(pclass, FALSE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "no dataset xfer plists available") /* Get the property list struct */ @@ -943,7 +941,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set VL data allocation routine") /* Set the initial number of bytes required */ - vlen_bufsize.size=0; + vlen_bufsize.size = 0; /* Call H5D_iterate with args, etc. */ ret_value = H5D_iterate(&bogus, type_id, space, H5D_vlen_get_buf_size, &vlen_bufsize); diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 977957c..b6545f8 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -303,7 +303,7 @@ H5D_chunk_new(H5F_t *f, hid_t dxpl_id, H5D_t *dset, */ if(H5P_get(dc_plist, H5D_CRT_CHUNK_SIZE_NAME, dset->shared->layout.u.chunk.dim) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve chunk size") - dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = H5T_get_size(type); + dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = H5T_GET_SIZE(type); /* Sanity check dimensions */ if(H5S_get_simple_extent_dims(dset->shared->space, NULL, max_dim) < 0) @@ -732,7 +732,7 @@ H5D_free_chunk_info(void *item, void UNUSED *key, void UNUSED *opdata) (void)H5S_close(chunk_info->mspace); /* Free the actual chunk info */ - H5FL_FREE(H5D_chunk_info_t, chunk_info); + (void)H5FL_FREE(H5D_chunk_info_t, chunk_info); FUNC_LEAVE_NOAPI(0) } /* H5D_free_chunk_info() */ @@ -877,13 +877,13 @@ H5D_create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t while(sel_points) { /* Check for intersection of temporary chunk and file selection */ /* (Casting away const OK - QAK) */ - if(H5S_hyper_intersect_block((H5S_t *)fm->file_space,coords,end)==TRUE) { + if(TRUE == H5S_hyper_intersect_block((H5S_t *)fm->file_space, coords, end)) { H5S_t *tmp_fchunk; /* Temporary file dataspace */ H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */ hssize_t schunk_points; /* Number of elements in chunk selection */ /* Create "temporary" chunk for selection operations (copy file space) */ - if((tmp_fchunk = H5S_copy(fm->file_space, TRUE, FALSE)) == NULL) + if(NULL == (tmp_fchunk = H5S_copy(fm->file_space, TRUE, FALSE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") /* Make certain selections are stored in span tree form (not "optimized hyperslab" or "all") */ @@ -1045,7 +1045,7 @@ H5D_create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) /* Just point at the memory dataspace & selection */ /* (Casting away const OK -QAK) */ - chunk_info->mspace=(H5S_t *)fm->mem_space; + chunk_info->mspace = (H5S_t *)fm->mem_space; /* Indicate that the chunk's memory space is shared */ chunk_info->mspace_shared = TRUE; @@ -1165,14 +1165,14 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const /* Create a dataspace for the chunk */ if((fspace = H5S_create_simple(fm->f_ndims,fm->chunk_dim,NULL))==NULL) { - H5FL_FREE(H5D_chunk_info_t,chunk_info); + (void)H5FL_FREE(H5D_chunk_info_t,chunk_info); HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk") } /* end if */ /* De-select the chunk space */ if(H5S_select_none(fspace) < 0) { (void)H5S_close(fspace); - H5FL_FREE(H5D_chunk_info_t,chunk_info); + (void)H5FL_FREE(H5D_chunk_info_t,chunk_info); HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select dataspace") } /* end if */ @@ -1252,11 +1252,11 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Find correct chunk in file & memory skip list */ - if(chunk_index==fm->last_index) { + if(chunk_index == fm->last_index) { /* If the chunk index is the same as the last chunk index we used, * get the cached spaces to operate on. */ - chunk_info=fm->last_chunk_info; + chunk_info = fm->last_chunk_info; } /* end if */ else { /* If the chunk index is not the same as the last chunk index we used, @@ -1267,23 +1267,23 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "can't locate chunk in skip list") /* Check if the chunk already has a memory space */ - if(chunk_info->mspace==NULL) { + if(NULL == chunk_info->mspace) { /* Copy the template memory chunk dataspace */ - if((chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE)) == NULL) + if(NULL == (chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space") } /* end else */ /* Update the "last chunk seen" information */ - fm->last_index=chunk_index; - fm->last_chunk_info=chunk_info; + fm->last_index = chunk_index; + fm->last_chunk_info = chunk_info; } /* end else */ /* Get coordinates of selection iterator for memory */ - if(H5S_SELECT_ITER_COORDS(&fm->mem_iter,coords_in_mem) < 0) + if(H5S_SELECT_ITER_COORDS(&fm->mem_iter, coords_in_mem) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator coordinates") /* Add point to memory selection for chunk */ - if(fm->msel_type==H5S_SEL_POINTS) { + if(fm->msel_type == H5S_SEL_POINTS) { if(H5S_select_elements(chunk_info->mspace, H5S_SELECT_APPEND, (size_t)1, coords_in_mem) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element") } /* end if */ @@ -2216,7 +2216,7 @@ H5D_chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * --rdcc->nused; /* Free */ - H5FL_FREE(H5D_rdcc_ent_t, ent); + (void)H5FL_FREE(H5D_rdcc_ent_t, ent); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3276,7 +3276,7 @@ H5D_chunk_prune_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) done: if(ret_value != H5_ITER_CONT && sl_node) - H5FL_FREE(H5D_chunk_sl_ck_t, sl_node); + (void)H5FL_FREE(H5D_chunk_sl_ck_t, sl_node); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_chunk_prune_cb() */ @@ -3318,7 +3318,7 @@ H5D_chunk_prune_sl_rm_cb(void *item, void UNUSED *key, void *op_data) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, H5_ITER_ERROR, "unable to remove chunk entry from index") done: - H5FL_FREE(H5D_chunk_sl_ck_t, sl_node); + (void)H5FL_FREE(H5D_chunk_sl_ck_t, sl_node); FUNC_LEAVE_NOAPI(ret_value) } /* H5D_chunk_prune_sl_rm_cb() */ @@ -4144,9 +4144,8 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, bkg = udata.bkg; done: - if(sid_buf > 0) - if(H5I_dec_ref(sid_buf, FALSE) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary dataspace ID") + if(sid_buf > 0 && H5I_dec_ref(sid_buf, FALSE) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID") if(tid_src > 0) if(H5I_dec_ref(tid_src, FALSE) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index add58e6..78f4e05 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -373,9 +373,9 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, /* Set up the conversion functions */ if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes") if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst, NULL, NULL, dxpl_id, FALSE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes") /* Determine largest datatype size */ if(0 == (src_dt_size = H5T_get_size(dt_src))) @@ -463,9 +463,8 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, HDmemcpy(layout_dst->u.compact.buf, layout_src->u.compact.buf, layout_src->u.compact.size); done: - if(buf_sid > 0) - if(H5I_dec_ref(buf_sid, FALSE) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary dataspace ID") + if(buf_sid > 0 && H5I_dec_ref(buf_sid, FALSE) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID") if(tid_src > 0) if(H5I_dec_ref(tid_src, FALSE) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index a773ba3..7f17d98 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -350,11 +350,11 @@ H5D_contig_get_addr(const H5D_t *dset) FUNC_ENTER_NOAPI_NOFUNC(H5D_contig_get_addr) /* check args */ - assert(dset); - assert(dset->shared->layout.type==H5D_CONTIGUOUS); + HDassert(dset); + HDassert(dset->shared->layout.type == H5D_CONTIGUOUS); FUNC_LEAVE_NOAPI(dset->shared->layout.u.contig.addr) -} /* end H5D_contig_get_addr */ +} /* end H5D_contig_get_addr() */ /*------------------------------------------------------------------------- @@ -374,7 +374,6 @@ static herr_t H5D_contig_new(H5F_t *f, hid_t UNUSED dxpl_id, H5D_t *dset, const H5P_genplist_t UNUSED *dc_plist) { - const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ hssize_t tmp_size; /* Temporary holder for raw data size */ hsize_t dim[H5O_LAYOUT_NDIMS]; /* Current size of data in elements */ hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ @@ -403,7 +402,7 @@ H5D_contig_new(H5F_t *f, hid_t UNUSED dxpl_id, H5D_t *dset, HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible contiguous non-external dataset") /* Compute the total size of dataset */ - tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * H5T_get_size(type); + tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * H5T_get_size(dset->shared->type); H5_ASSIGN_OVERFLOW(dset->shared->layout.u.contig.size, tmp_size, hssize_t, hsize_t); /* Get the sieve buffer size for this dataset */ @@ -1218,30 +1217,30 @@ H5D_contig_copy(H5F_t *f_src, const H5O_layout_t *layout_src, H5F_t *f_dst, if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy") if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register memory datatype") /* create variable-length datatype at the destinaton file */ if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy") if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype") /* Set up the conversion functions */ if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes") if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst, NULL, NULL, dxpl_id, FALSE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes") /* Determine largest datatype size */ if(0 == (src_dt_size = H5T_get_size(dt_src))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size") if(0 == (mem_dt_size = H5T_get_size(dt_mem))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size") max_dt_size = MAX(src_dt_size, mem_dt_size); if(0 == (dst_dt_size = H5T_get_size(dt_dst))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size") max_dt_size = MAX(max_dt_size, dst_dt_size); /* Set maximum number of whole elements that fit in buffer */ @@ -1382,9 +1381,8 @@ H5D_contig_copy(H5F_t *f_src, const H5O_layout_t *layout_src, H5F_t *f_dst, } /* end while */ done: - if(buf_sid > 0) - if(H5I_dec_ref(buf_sid, FALSE) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary dataspace ID") + if(buf_sid > 0 && H5I_dec_ref(buf_sid, FALSE) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID") if(tid_src > 0) if(H5I_dec_ref(tid_src, FALSE) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") diff --git a/src/H5Defl.c b/src/H5Defl.c index 15bcd60..1fe0f37 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -110,7 +110,7 @@ static herr_t H5D_efl_new(H5F_t *f, hid_t UNUSED dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist) { - const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ + size_t dt_size; /* Size of datatype */ hsize_t dim[H5O_LAYOUT_NDIMS]; /* Current size of data in elements */ hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ hssize_t tmp_size; /* Temporary holder for raw data size */ @@ -141,6 +141,10 @@ H5D_efl_new(H5F_t *f, hid_t UNUSED dxpl_id, H5D_t *dset, if(max_dim[i] > dim[i]) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "only the first dimension can be extendible") + /* Retrieve the size of the dataset's datatype */ + if(0 == (dt_size = H5T_get_size(dset->shared->type))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size") + /* Check for storage overflows */ max_points = H5S_get_npoints_max(dset->shared->space); max_storage = H5O_efl_total_size(&dset->shared->dcpl_cache.efl); @@ -148,13 +152,13 @@ H5D_efl_new(H5F_t *f, hid_t UNUSED dxpl_id, H5D_t *dset, if(H5O_EFL_UNLIMITED != max_storage) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unlimited data space but finite storage") } /* end if */ - else if(max_points * H5T_get_size(type) < max_points) + else if((max_points * dt_size) < max_points) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data space * type size overflowed") - else if(max_points * H5T_get_size(type) > max_storage) + else if((max_points * dt_size) > max_storage) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data space size exceeds external storage size") /* Compute the total size of dataset */ - tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * H5T_get_size(type); + tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * dt_size; H5_ASSIGN_OVERFLOW(dset->shared->layout.u.contig.size, tmp_size, hssize_t, hsize_t); /* Get the sieve buffer size for this dataset */ diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 6bc635e..22b3146 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -123,11 +123,11 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_ /* Check args */ if(buf == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer") - if(NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE))) + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataspace") - if(NULL == (fill_type = H5I_object_verify(fill_type_id, H5I_DATATYPE))) + if(NULL == (fill_type = (H5T_t *)H5I_object_verify(fill_type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") - if(NULL == (buf_type = H5I_object_verify(buf_type_id, H5I_DATATYPE))) + if(NULL == (buf_type = (H5T_t *)H5I_object_verify(buf_type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") /* Fill the selection in the memory buffer */ @@ -320,10 +320,10 @@ H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed") /* Point at element buffer */ - fill_buf = elem_ptr; + fill_buf = (const uint8_t *)elem_ptr; } /* end if */ else - fill_buf = fill; + fill_buf = (const uint8_t *)fill; /* Fill the selection in the memory buffer */ if(H5S_select_fill(fill_buf, dst_type_size, space, buf) < 0) @@ -401,7 +401,7 @@ H5D_fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, if(fb_info->has_vlen_fill_type) { /* Create temporary datatype for conversion operation */ if(NULL == (fb_info->mem_type = H5T_copy(dset_type, H5T_COPY_REOPEN))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy file datatype") if((fb_info->mem_tid = H5I_register(H5I_DATATYPE, fb_info->mem_type, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype") diff --git a/src/H5Dint.c b/src/H5Dint.c index 4723b17..0f3ff58 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -555,7 +555,7 @@ done: if(new_dset != NULL) { if(new_dset->dcpl_id != 0) (void)H5I_dec_ref(new_dset->dcpl_id, FALSE); - H5FL_FREE(H5D_shared_t, new_dset); + (void)H5FL_FREE(H5D_shared_t, new_dset); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1015,10 +1015,10 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* check args */ HDassert(file); - HDassert(H5I_DATATYPE==H5I_get_type(type_id)); + HDassert(H5I_DATATYPE == H5I_get_type(type_id)); HDassert(space); - HDassert(H5I_GENPROP_LST==H5I_get_type(dcpl_id)); - HDassert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); + HDassert(H5I_GENPROP_LST == H5I_get_type(dxpl_id)); /* Get the dataset's datatype */ if(NULL == (type = (const H5T_t *)H5I_object(type_id))) @@ -1030,10 +1030,10 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Check if the datatype is/contains a VL-type */ if(H5T_detect_class(type, H5T_VLEN)) - has_vl_type=TRUE; + has_vl_type = TRUE; /* Check if the dataspace has an extent set (or is NULL) */ - if(!(H5S_has_extent(space)) ) + if(!H5S_has_extent(space)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "dataspace extent has not been set.") /* Initialize the dataset object */ @@ -1156,10 +1156,8 @@ done: if(H5D_chunk_dest(file, dxpl_id, new_dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "unable to destroy chunk cache") } /* end if */ - if(new_dset->shared->space) { - if(H5S_close(new_dset->shared->space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace") - } /* end if */ + if(new_dset->shared->space && H5S_close(new_dset->shared->space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace") if(new_dset->shared->type) { if(H5I_dec_ref(new_dset->shared->type_id, FALSE) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype") @@ -1172,14 +1170,12 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTDELETE, NULL, "unable to delete object header") } /* end if */ } /* end if */ - if(new_dset->shared->dcpl_id != 0) { - if(H5I_dec_ref(new_dset->shared->dcpl_id, FALSE) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") - } /* end if */ - H5FL_FREE(H5D_shared_t, new_dset->shared); + if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id, FALSE) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") + (void)H5FL_FREE(H5D_shared_t, new_dset->shared); } /* end if */ new_dset->oloc.file = NULL; - H5FL_FREE(H5D_t, new_dset); + (void)H5FL_FREE(H5D_t, new_dset); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1271,13 +1267,13 @@ done: /* Free the location--casting away const*/ if(dataset) { if(shared_fo == NULL) /* Need to free shared fo */ - H5FL_FREE(H5D_shared_t, dataset->shared); + (void)H5FL_FREE(H5D_shared_t, dataset->shared); H5O_loc_free(&(dataset->oloc)); H5G_name_free(&(dataset->path)); - H5FL_FREE(H5D_t, dataset); - } + (void)H5FL_FREE(H5D_t, dataset); + } /* end if */ if(shared_fo) shared_fo->fo_count--; } /* end if */ @@ -1324,7 +1320,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id) if(NULL == (dataset->shared->type = (H5T_t *)H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, NULL, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load type info from dataset header") if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load space info from dataset header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") /* Get a datatype ID for the dataset's datatype */ if((dataset->shared->type_id = H5I_register(H5I_DATATYPE, dataset->shared->type, FALSE)) < 0) @@ -1498,14 +1494,10 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id) done: if(ret_value < 0) { - if(H5F_addr_defined(dataset->oloc.addr)) { - if(H5O_close(&(dataset->oloc)) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header") - } /* end if */ - if(dataset->shared->space) { - if(H5S_close(dataset->shared->space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - } /* end if */ + if(H5F_addr_defined(dataset->oloc.addr) && H5O_close(&(dataset->oloc)) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header") + if(dataset->shared->space && H5S_close(dataset->shared->space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") if(dataset->shared->type) { if(dataset->shared->type_id > 0) { if(H5I_dec_ref(dataset->shared->type_id, FALSE) < 0) @@ -1634,7 +1626,7 @@ H5D_close(H5D_t *dataset) */ dataset->oloc.file = NULL; - H5FL_FREE(H5D_shared_t, dataset->shared); + (void)H5FL_FREE(H5D_shared_t, dataset->shared); } /* end if */ else { /* Decrement the ref. count for this object in the top file */ @@ -1652,7 +1644,7 @@ H5D_close(H5D_t *dataset) free_failed = TRUE; /* Free the dataset's memory structure */ - H5FL_FREE(H5D_t, dataset); + (void)H5FL_FREE(H5D_t, dataset); /* Check if anything failed in the middle... */ if(free_failed) @@ -1716,7 +1708,6 @@ H5D_nameof(H5D_t *dataset) * is not copied. * * Return: Success: Ptr to the dataset's datatype, uncopied. - * * Failure: NULL * * Programmer: Robb Matzke @@ -1731,6 +1722,7 @@ H5D_typeof(const H5D_t *dset) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_typeof) HDassert(dset); + HDassert(dset->shared); HDassert(dset->shared->type); FUNC_LEAVE_NOAPI(dset->shared->type) diff --git a/src/H5Dio.c b/src/H5Dio.c index 92d88f4..49fdba9 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -698,7 +698,7 @@ H5D_typeinfo_init(const H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, { const H5T_t *src_type; /* Source datatype */ const H5T_t *dst_type; /* Destination datatype */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_typeinfo_init) @@ -707,7 +707,7 @@ H5D_typeinfo_init(const H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, HDassert(dset); /* Initialize type info safely */ - HDmemset(type_info, 0, sizeof(H5D_type_info_t)); + HDmemset(type_info, 0, sizeof(*type_info)); /* Get the memory & dataset datatypes */ if(NULL == (type_info->mem_type = (const H5T_t *)H5I_object_verify(mem_type_id, H5I_DATATYPE))) diff --git a/src/H5Doh.c b/src/H5Doh.c index 2c3e23f..5268075 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -152,11 +152,11 @@ H5O_dset_free_copy_file_udata(void *_udata) H5T_close(udata->src_dtype); /* Release copy of dataset's filter pipeline, if it was set */ - if (udata->src_pline) + if(udata->src_pline) H5O_msg_free(H5O_PLINE_ID, udata->src_pline); /* Release space for 'copy file' user data */ - H5FL_FREE(H5D_copy_file_ud_t, udata); + (void)H5FL_FREE(H5D_copy_file_ud_t, udata); FUNC_LEAVE_NOAPI_VOID } /* end H5O_dset_free_copy_file_udata() */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 33f628d..fa1a516 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -384,15 +384,15 @@ typedef struct H5D_rdcdc_t { * there will be two IDs and two H5D_t structs, both sharing one H5D_shared_t. */ typedef struct H5D_shared_t { - size_t fo_count; /* reference count */ + size_t fo_count; /* Reference count */ hid_t type_id; /* ID for dataset's datatype */ - H5T_t *type; /* datatype of this dataset */ - H5S_t *space; /* dataspace of this dataset */ + H5T_t *type; /* Datatype for this dataset */ + H5S_t *space; /* Dataspace of this dataset */ hbool_t space_dirty; /* Whether the dataspace info needs to be flushed to the file */ hbool_t layout_dirty; /* Whether the layout info needs to be flushed to the file */ - hid_t dcpl_id; /* dataset creation property id */ + hid_t dcpl_id; /* Dataset creation property id */ H5D_dcpl_cache_t dcpl_cache; /* Cached DCPL values */ - H5O_layout_t layout; /* data layout */ + H5O_layout_t layout; /* Data layout */ hbool_t checked_filters;/* TRUE if dataset passes can_apply check */ /* Buffered/cached information for types of raw data storage*/ @@ -429,7 +429,7 @@ typedef struct { } H5D_obj_create_t; /* Typedef for filling a buffer with a fill value */ -typedef struct { +typedef struct H5D_fill_buf_info_t { hbool_t alloc_vl_during_refill; /* Whether to allocate VL-datatype fill buffer during refill */ H5MM_allocate_t fill_alloc_func; /* Routine to call for allocating fill buffer */ void *fill_alloc_info; /* Extra info for allocation routine */ @@ -510,7 +510,7 @@ H5E_unregister_class(H5E_cls_t *cls) H5MM_xfree((void*)cls->lib_name); if(cls->lib_vers) H5MM_xfree((void*)cls->lib_vers); - H5FL_FREE(H5E_cls_t, cls); + (void)H5FL_FREE(H5E_cls_t, cls); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5E_unregister_class() */ @@ -684,7 +684,7 @@ H5E_close_msg(H5E_msg_t *err) H5MM_xfree((void*)err->msg); /* Don't free err->cls here */ - H5FL_FREE(H5E_msg_t, err); + (void)H5FL_FREE(H5E_msg_t, err); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5E_close_msg() */ @@ -956,7 +956,7 @@ H5E_get_current_stack(void) done: if(ret_value == NULL) if(estack_copy) - H5FL_FREE(H5E_t, estack_copy); + (void)H5FL_FREE(H5E_t, estack_copy); FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_get_current_stack() */ @@ -1123,7 +1123,7 @@ H5E_close_stack(H5E_t *estack) H5E_clear_stack(estack); /* Free the stack structure */ - H5FL_FREE(H5E_t, estack); + (void)H5FL_FREE(H5E_t, estack); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5E_close_stack() */ @@ -205,9 +205,9 @@ H5Fget_create_plist(hid_t file_id) H5TRACE1("i", "i", file_id); /* check args */ - if(NULL == (file = H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - if(NULL == (plist = H5I_object(file->shared->fcpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(file->shared->fcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Create the property list object to return */ @@ -250,7 +250,7 @@ H5Fget_access_plist(hid_t file_id) H5TRACE1("i", "i", file_id); /* Check args */ - if(NULL == (f = H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Retrieve the file's access property list */ @@ -299,11 +299,11 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) HDassert(f); /* Make a copy of the default file access property list */ - if(NULL == (old_plist = H5I_object(H5P_LST_FILE_ACCESS_g))) + if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") - if(NULL == (new_plist = H5I_object(ret_value))) + if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Copy properties of the file access property list */ @@ -371,22 +371,20 @@ done: * Programmer: Raymond Lu * Wednesday, Dec 5, 2001 * - * Modification: - * *------------------------------------------------------------------------- */ int H5Fget_obj_count(hid_t file_id, unsigned types) { - H5F_t *f=NULL; + H5F_t *f = NULL; /* File to query */ int ret_value; /* Return value */ FUNC_ENTER_API(H5Fget_obj_count, FAIL) H5TRACE2("Is", "iIu", file_id, types); - if( file_id != (hid_t)H5F_OBJ_ALL && (NULL==(f=H5I_object_verify(file_id,H5I_FILE))) ) + if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") - if( (types&H5F_OBJ_ALL)==0) + if(0 == (types & H5F_OBJ_ALL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") if((ret_value = H5F_get_obj_count(f, types)) < 0) @@ -394,7 +392,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Fget_obj_count() */ /*------------------------------------------------------------------------- @@ -442,23 +440,23 @@ H5F_get_obj_count(const H5F_t *f, unsigned types) herr_t H5Fget_obj_ids(hid_t file_id, unsigned types, int max_objs, hid_t *oid_list) { - herr_t ret_value; - H5F_t *f=NULL; + H5F_t *f = NULL; /* File to query */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Fget_obj_ids, FAIL) H5TRACE4("e", "iIuIs*i", file_id, types, max_objs, oid_list); - if( file_id != (hid_t)H5F_OBJ_ALL && (NULL==(f=H5I_object_verify(file_id,H5I_FILE))) ) + if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") - if( (types&H5F_OBJ_ALL)==0) + if(0 == (types & H5F_OBJ_ALL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") - assert(oid_list); + HDassert(oid_list); ret_value = H5F_get_obj_ids(f, types, max_objs, oid_list); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Fget_obj_ids() */ /*------------------------------------------------------------------------- @@ -592,8 +590,8 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) FUNC_ENTER_NOAPI_NOINIT(H5F_get_objects_cb) - assert(obj_ptr); - assert(olist); + HDassert(obj_ptr); + HDassert(olist); /* Count file IDs */ if(olist->obj_type == H5I_FILE) { @@ -615,42 +613,47 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) if(olist->max_index>=0 && (int)olist->list_index>=olist->max_index) HGOTO_DONE(TRUE) /* Indicate that the iterator should stop */ } - } else { /* either count opened object IDs or put the IDs on the list */ + } /* end if */ + else { /* either count opened object IDs or put the IDs on the list */ H5O_loc_t *oloc; /* Group entry info for object */ switch(olist->obj_type) { case H5I_ATTR: - oloc = H5A_oloc((H5A_t*)obj_ptr); + oloc = H5A_oloc((H5A_t *)obj_ptr); break; + case H5I_GROUP: - oloc = H5G_oloc((H5G_t*)obj_ptr); + oloc = H5G_oloc((H5G_t *)obj_ptr); break; + case H5I_DATASET: - oloc = H5D_oloc((H5D_t*)obj_ptr); + oloc = H5D_oloc((H5D_t *)obj_ptr); break; + case H5I_DATATYPE: if(H5T_is_named((H5T_t*)obj_ptr)==TRUE) oloc = H5T_oloc((H5T_t*)obj_ptr); else oloc = NULL; break; + default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object") - } + } /* end switch */ if((olist->file_info.local && - ( (!olist->file_info.ptr.file && olist->obj_type==H5I_DATATYPE && H5T_is_immutable((H5T_t*)obj_ptr)==FALSE) - || (!olist->file_info.ptr.file && olist->obj_type!=H5I_DATATYPE) - || (oloc && oloc->file == olist->file_info.ptr.file) )) + ( (!olist->file_info.ptr.file && olist->obj_type == H5I_DATATYPE && H5T_is_immutable((H5T_t *)obj_ptr) == FALSE) + || (!olist->file_info.ptr.file && olist->obj_type != H5I_DATATYPE) + || (oloc && oloc->file == olist->file_info.ptr.file))) || (!olist->file_info.local && - ((!olist->file_info.ptr.shared && olist->obj_type==H5I_DATATYPE && H5T_is_immutable((H5T_t*)obj_ptr)==FALSE) - || (!olist->file_info.ptr.shared && olist->obj_type!=H5I_DATATYPE) - || (oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared) ))) { + ((!olist->file_info.ptr.shared && olist->obj_type == H5I_DATATYPE && H5T_is_immutable((H5T_t *)obj_ptr) == FALSE) + || (!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) + || (oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) { /* Add the object's ID to the ID list, if appropriate */ if(olist->obj_id_list) { olist->obj_id_list[olist->list_index] = obj_id; olist->list_index++; - } + } /* end if */ /* Increment the number of open objects */ if(olist->obj_id_count) @@ -659,12 +662,12 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) /* Check if we've filled up the array */ if(olist->max_index>=0 && (int)olist->list_index>=olist->max_index) HGOTO_DONE(TRUE) /* Indicate that the iterator should stop */ - } - } + } /* end if */ + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5F_get_objects_cb() */ /*------------------------------------------------------------------------- @@ -687,22 +690,25 @@ done: herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle) { - H5F_t *file=NULL; - herr_t ret_value; + H5F_t *file; /* File to query */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Fget_vfd_handle, FAIL) H5TRACE3("e", "ii**x", file_id, fapl, file_handle); /* Check args */ - assert(file_handle); - if(NULL==(file=H5I_object_verify(file_id, H5I_FILE))) + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer") + + /* Get the file */ + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") - ret_value=H5F_get_vfd_handle(file, fapl, file_handle); + ret_value = H5F_get_vfd_handle(file, fapl, file_handle); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Fget_vfd_handle() */ /*------------------------------------------------------------------------- @@ -861,7 +867,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) * new file handle. We do this early because some values might need * to change as the file is being opened. */ - if(NULL == (plist = H5I_object(fcpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not property list") f->shared->fcpl_id = H5P_copy_plist(plist, FALSE); @@ -879,7 +885,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) HDassert(f->shared->sohm_nindexes < 255); /* Get the FAPL values to cache */ - if(NULL == (plist = H5I_object(fapl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial metadata cache resize config") @@ -922,7 +928,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) if(super_vers != HDF5_SUPERBLOCK_VERSION_DEF) { H5P_genplist_t *c_plist; /* Property list */ - if(NULL == (c_plist = H5I_object(f->shared->fcpl_id))) + if(NULL == (c_plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not property list") if(H5P_set(c_plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, "unable to set superblock version") @@ -957,8 +963,8 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) done: if(!ret_value && f) { if(!shared) - H5FL_FREE(H5F_file_t, f->shared); - H5FL_FREE(H5F_t, f); + (void)H5FL_FREE(H5F_file_t, f->shared); + (void)H5FL_FREE(H5F_t, f); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1040,7 +1046,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) if(H5FO_dest(f) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") - f->shared->cwfs = H5MM_xfree(f->shared->cwfs); + f->shared->cwfs = (struct H5HG_heap_t **)H5MM_xfree(f->shared->cwfs); if(H5G_node_close(f) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") @@ -1059,11 +1065,11 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file") /* Free mount table */ - f->shared->mtab.child = H5MM_xfree(f->shared->mtab.child); + f->shared->mtab.child = (H5F_mount_t *)H5MM_xfree(f->shared->mtab.child); f->shared->mtab.nalloc = 0; /* Destroy shared file struct */ - f->shared = H5FL_FREE(H5F_file_t,f->shared); + f->shared = (H5F_file_t *)H5FL_FREE(H5F_file_t, f->shared); } else if(f->shared->nrefs > 0) { /* @@ -1074,12 +1080,12 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) } /* Free the non-shared part of the file */ - f->name = H5MM_xfree(f->name); - f->extpath = H5MM_xfree(f->extpath); + f->name = (char *)H5MM_xfree(f->name); + f->extpath = (char *)H5MM_xfree(f->extpath); if(H5FO_top_dest(f) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file") f->shared = NULL; - H5FL_FREE(H5F_t, f); + (void)H5FL_FREE(H5F_t, f); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_dest() */ @@ -1281,7 +1287,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d file->name = H5MM_xstrdup(name); /* Get the file access property list, for future queries */ - if(NULL == (a_plist = H5I_object(fapl_id))) + if(NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") /* This step is for h5repart tool only. If user wants to change file driver from @@ -1601,45 +1607,57 @@ done: herr_t H5Fflush(hid_t object_id, H5F_scope_t scope) { - H5F_t *f = NULL; - H5G_t *grp = NULL; - H5T_t *type = NULL; - H5D_t *dset = NULL; - H5A_t *attr = NULL; - H5O_loc_t *oloc = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5F_t *f = NULL; /* File to flush */ + H5O_loc_t *oloc = NULL; /* Object location for ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fflush, FAIL) H5TRACE2("e", "iFs", object_id, scope); switch(H5I_get_type(object_id)) { case H5I_FILE: - if(NULL == (f = H5I_object(object_id))) + if(NULL == (f = (H5F_t *)H5I_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") break; case H5I_GROUP: - if(NULL == (grp = H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier") - oloc = H5G_oloc(grp); + { + H5G_t *grp; + + if(NULL == (grp = (H5G_t *)H5I_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier") + oloc = H5G_oloc(grp); + } break; case H5I_DATATYPE: - if(NULL == (type = H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid type identifier") - oloc = H5T_oloc(type); + { + H5T_t *type; + + if(NULL == (type = (H5T_t *)H5I_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid type identifier") + oloc = H5T_oloc(type); + } break; case H5I_DATASET: - if(NULL == (dset = H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") - oloc = H5D_oloc(dset); + { + H5D_t *dset; + + if(NULL == (dset = (H5D_t *)H5I_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + oloc = H5D_oloc(dset); + } break; case H5I_ATTR: - if(NULL == (attr = H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") - oloc = H5A_oloc(attr); + { + H5A_t *attr; + + if(NULL == (attr = (H5A_t *)H5I_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") + oloc = H5A_oloc(attr); + } break; default: @@ -2051,7 +2069,7 @@ H5Freopen(hid_t file_id) H5TRACE1("i", "i", file_id); /* Check arguments */ - if(NULL == (old_file = H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (old_file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Get a new "top level" file struct, sharing the same "low level" file struct */ @@ -2103,7 +2121,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) FUNC_ENTER_API(H5Fget_intent, FAIL) H5TRACE2("e", "i*Iu", file_id, intent_flags); - if(NULL == (file = H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* If no intent flags were passed in, exit quietly */ @@ -3193,7 +3211,7 @@ H5Fget_freespace(hid_t file_id) H5TRACE1("Hs", "i", file_id); /* Check args */ - if(NULL == (file = H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Go get the actual amount of free space in the file */ @@ -3226,19 +3244,19 @@ done: herr_t H5Fget_filesize(hid_t file_id, hsize_t *size) { - H5F_t *file=NULL; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File object for file ID */ haddr_t eof; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_filesize, FAIL) H5TRACE2("e", "i*h", file_id, size); /* Check args */ - if(NULL==(file=H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Go get the actual file size */ - if((eof = H5FDget_eof(file->shared->lf))==HADDR_UNDEF) + if((eof = H5FDget_eof(file->shared->lf)) == HADDR_UNDEF) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") *size = (hsize_t)eof; @@ -3276,24 +3294,18 @@ herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { - H5F_t *file=NULL; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File object for file ID */ herr_t result; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_mdc_config, FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); /* Check args */ - if ( NULL == (file = H5I_object_verify(file_id, H5I_FILE)) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - } - - if ( ( NULL == config_ptr ) || - ( config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") - } + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + if((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") /* Go get the resize configuration */ result = H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr); @@ -3335,18 +3347,16 @@ herr_t H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { - H5F_t *file=NULL; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File object for file ID */ herr_t result; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fset_mdc_config, FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); /* Check args */ - if ( NULL == (file = H5I_object_verify(file_id, H5I_FILE)) ) { - + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - } /* set the resize configuration */ result = H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr); @@ -3389,23 +3399,19 @@ herr_t H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) { - H5F_t *file=NULL; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File object for file ID */ herr_t result; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_mdc_hit_rate, FAIL) H5TRACE2("e", "i*d", file_id, hit_rate_ptr); /* Check args */ - if ( NULL == (file = H5I_object_verify(file_id, H5I_FILE)) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - } - - if ( NULL == hit_rate_ptr ) { + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") - } + if(NULL == hit_rate_ptr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") /* Go get the current hit rate */ result = H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr); @@ -3452,20 +3458,18 @@ H5Fget_mdc_size(hid_t file_id, size_t *cur_size_ptr, int *cur_num_entries_ptr) { - H5F_t *file=NULL; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ - herr_t result; + H5F_t *file; /* File object for file ID */ int32_t cur_num_entries; + herr_t result; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_mdc_size, FAIL) H5TRACE5("e", "i*z*z*z*Is", file_id, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr); /* Check args */ - if ( NULL == (file = H5I_object_verify(file_id, H5I_FILE)) ) { - + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - } /* Go get the size data */ result = H5AC_get_cache_size(file->shared->cache, @@ -3525,7 +3529,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) H5TRACE1("e", "i", file_id); /* Check args */ - if(NULL == (file = H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Reset the hit rate statistic */ @@ -3571,7 +3575,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) * the top file in a mount hierarchy) */ if(H5I_get_type(obj_id) == H5I_FILE ) { - if(NULL == (f = H5I_object(obj_id))) + if(NULL == (f = (H5F_t *)H5I_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") } /* end if */ else { @@ -3631,7 +3635,7 @@ H5Fget_info(hid_t obj_id, H5F_info_t *finfo) * the top file in a mount hierarchy) */ if(H5I_get_type(obj_id) == H5I_FILE ) { - if(NULL == (f = H5I_object(obj_id))) + if(NULL == (f = (H5F_t *)H5I_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") } /* end if */ else { diff --git a/src/H5FDspace.c b/src/H5FDspace.c index 9540c8c..2a260f8 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -167,7 +167,7 @@ H5FD_free_freelist(H5FD_t *file) nbytes += cur->size; #endif /* H5FD_ALLOC_DEBUG */ next = cur->next; - H5FL_FREE(H5FD_free_t, cur); + (void)H5FL_FREE(H5FD_free_t, cur); } /* end for */ file->fl[i] = NULL; @@ -353,7 +353,7 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); else file->fl[mapped_type] = cur->next; - H5FL_FREE(H5FD_free_t, cur); + (void)H5FL_FREE(H5FD_free_t, cur); if(size == file->maxsize) file->maxsize = 0; /*unknown*/ @@ -416,7 +416,7 @@ HDfprintf(stderr, "%s: Exact size match (aligned)\n", FUNC); else file->fl[mapped_type] = cur->next; - H5FL_FREE(H5FD_free_t, cur); + (void)H5FL_FREE(H5FD_free_t, cur); if(size == file->maxsize) file->maxsize = 0; /*unknown*/ @@ -497,7 +497,7 @@ HDfprintf(stderr, "%s: Splitting %Hu byte sized block\n", FUNC, best->size); best->next = tmp; } else { /* no tail piece */ - H5FL_FREE(H5FD_free_t,tmp); + (void)H5FL_FREE(H5FD_free_t,tmp); } best->size = head; @@ -1222,7 +1222,7 @@ HDfprintf(stderr, "%s: mapped_type = %u\n", FUNC, (unsigned)mapped_type); prev = last_prev; /* Free the memory for the merged block */ - H5FL_FREE(H5FD_free_t, last); + (void)H5FL_FREE(H5FD_free_t, last); } /* end if */ /* Adjust the address and size of the block found */ @@ -1256,7 +1256,7 @@ HDfprintf(stderr, "%s: mapped_type = %u\n", FUNC, (unsigned)mapped_type); prev = last_prev; /* Free the memory for the merged block */ - H5FL_FREE(H5FD_free_t, last); + (void)H5FL_FREE(H5FD_free_t, last); } /* end if */ /* Adjust the size of the block found */ @@ -1331,7 +1331,7 @@ HDfprintf(stderr, "%s: Reducing file size to = %a\n", FUNC, last->addr); file->fl[mapped_type] = last->next; if(file->maxsize == last->size) file->maxsize = 0; /*unknown*/ - H5FL_FREE(H5FD_free_t, last); + (void)H5FL_FREE(H5FD_free_t, last); } /* end if */ } /* end if */ } else if(file->cls->free) { @@ -1614,7 +1614,7 @@ HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu, extra_requested = %Hu\n prev->next = curr->next; /* Free the memory for the used block */ - H5FL_FREE(H5FD_free_t, curr); + (void)H5FL_FREE(H5FD_free_t, curr); } /* end if */ else { curr->addr += extra_requested; @@ -1227,7 +1227,7 @@ H5FL_blk_gc_list(H5FL_blk_head_t *head) } /* end while */ /* Free the free list node */ - H5FL_FREE(H5FL_blk_node_t, head->head); + (void)H5FL_FREE(H5FL_blk_node_t, head->head); /* Advance to the next free list */ head->head = (H5FL_blk_node_t *)temp; @@ -2133,7 +2133,7 @@ H5FL_fac_term(H5FL_fac_head_t *factory) H5FL_blk_unlink(&(factory->queue)); /* Free factory info */ - H5FL_FREE(H5FL_fac_head_t,factory); + (void)H5FL_FREE(H5FL_fac_head_t, factory); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FScache.c b/src/H5FScache.c index acf4eaf..600fb3c 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -439,7 +439,7 @@ H5FS_cache_hdr_dest(H5F_t UNUSED *f, H5FS_t *fspace) fspace->sect_cls = (H5FS_section_class_t *)H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls); /* Free free space info */ - H5FL_FREE(H5FS_t, fspace); + (void)H5FL_FREE(H5FS_t, fspace); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1014,7 +1014,7 @@ H5FS_sinfo_free_node_cb(void *item, void UNUSED *key, void *op_data) H5SL_destroy(fspace_node->sect_list, H5FS_sinfo_free_sect_cb, op_data); /* Release free space list node */ - H5FL_FREE(H5FS_node_t, fspace_node); + (void)H5FL_FREE(H5FS_node_t, fspace_node); FUNC_LEAVE_NOAPI(0) } /* H5FS_sinfo_free_node_cb() */ @@ -1072,7 +1072,7 @@ H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header") /* Release free space section info */ - H5FL_FREE(H5FS_sinfo_t, sinfo); + (void)H5FL_FREE(H5FS_sinfo_t, sinfo); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 45d6e74..f36757e 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -464,7 +464,7 @@ HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bi HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "can't destroy size tracking node's skip list") /* Release free space list node */ - H5FL_FREE(H5FS_node_t, fspace_node); + (void)H5FL_FREE(H5FS_node_t, fspace_node); /* Decrement total number of section sizes managed */ sinfo->tot_size_count--; diff --git a/src/H5Gloc.c b/src/H5Gloc.c index fc02539..908c9a3 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -161,7 +161,7 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) H5F_t *f; /* Get the file struct */ - if(NULL == (f = H5I_object(loc_id))) + if(NULL == (f = (H5F_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file ID") /* Construct a group location for root group of the file */ @@ -183,7 +183,7 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) { H5G_t *group; - if(NULL == (group = H5I_object(loc_id))) + if(NULL == (group = (H5G_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group ID") if(NULL == (loc->oloc = H5G_oloc(group))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of group") @@ -196,7 +196,7 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) { H5T_t *dt; - if(NULL == (dt = H5I_object(loc_id))) + if(NULL == (dt = (H5T_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid type ID") if(NULL == (loc->oloc = H5T_oloc(dt))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of datatype") @@ -212,7 +212,7 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) { H5D_t *dset; - if(NULL == (dset = H5I_object(loc_id))) + if(NULL == (dset = (H5D_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data ID") if(NULL == (loc->oloc = H5D_oloc(dset))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of dataset") @@ -225,7 +225,7 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) { H5A_t *attr; - if(NULL == (attr = H5I_object(loc_id))) + if(NULL == (attr = (H5A_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid attribute ID") if(NULL == (loc->oloc = H5A_oloc(attr))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of attribute") diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 2921bf0..be9ab14 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -102,7 +102,7 @@ H5G_is_empty_test(hid_t gid) FUNC_ENTER_NOAPI(H5G_is_empty_test, FAIL) /* Get group structure */ - if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* "New format" checks */ @@ -213,7 +213,7 @@ H5G_has_links_test(hid_t gid, unsigned *nmsgs) FUNC_ENTER_NOAPI(H5G_has_links_test, FAIL) /* Get group structure */ - if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Check if the group has any link messages */ @@ -271,7 +271,7 @@ H5G_has_stab_test(hid_t gid) FUNC_ENTER_NOAPI(H5G_has_stab_test, FAIL) /* Get group structure */ - if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Check if the group has a symbol table message */ @@ -321,7 +321,7 @@ H5G_is_new_dense_test(hid_t gid) FUNC_ENTER_NOAPI(H5G_is_new_dense_test, FAIL) /* Get group structure */ - if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Check if the group has a symbol table message */ @@ -389,7 +389,7 @@ H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) FUNC_ENTER_NOAPI(H5G_new_dense_info_test, FAIL) /* Get group structure */ - if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Get the link info */ @@ -449,7 +449,7 @@ H5G_lheap_size_test(hid_t gid, size_t *lheap_size) FUNC_ENTER_NOAPI(H5G_lheap_size_test, FAIL) /* Get group structure */ - if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Make certain the group has a symbol table message */ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 8409c0f..ab46839 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -89,7 +89,7 @@ H5G_traverse_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_traverse_term_interface) /* Free the global component buffer */ - H5G_comp_g = H5MM_xfree(H5G_comp_g); + H5G_comp_g = (char *)H5MM_xfree(H5G_comp_g); H5G_comp_alloc_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) @@ -200,12 +200,12 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, /* Check for generic default property list and use link access default if so */ if(_lapl_id == H5P_DEFAULT) { HDassert(H5P_LINK_ACCESS_DEFAULT != -1); - if(NULL == (lapl = H5I_object(H5P_LINK_ACCESS_DEFAULT))) + if(NULL == (lapl = (H5P_genplist_t *)H5I_object(H5P_LINK_ACCESS_DEFAULT))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "unable to get default property list") } /* end if */ else { /* Get the underlying property list passed in */ - if(NULL == (lapl = H5I_object(_lapl_id))) + if(NULL == (lapl = (H5P_genplist_t *)H5I_object(_lapl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "unable to get property list from ID") } /* end else */ @@ -214,7 +214,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unable to copy property list") /* Get the underlying property list copy */ - if(NULL == (lapl = H5I_object(lapl_id))) + if(NULL == (lapl = (H5P_genplist_t *)H5I_object(lapl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "unable to get property list from ID") /* Record number of soft links left to traverse in the property list. */ @@ -228,22 +228,22 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, /* Get the oloc from the ID the user callback returned */ switch(H5I_get_type(cb_return)) { case H5I_GROUP: - if((new_oloc = H5G_oloc(H5I_object(cb_return))) == NULL) + if((new_oloc = H5G_oloc((H5G_t *)H5I_object(cb_return))) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from group ID") break; case H5I_DATASET: - if((new_oloc = H5D_oloc(H5I_object(cb_return))) ==NULL) + if((new_oloc = H5D_oloc((H5D_t *)H5I_object(cb_return))) ==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from dataset ID") break; case H5I_DATATYPE: - if((new_oloc = H5T_oloc(H5I_object(cb_return))) ==NULL) + if((new_oloc = H5T_oloc((H5T_t *)H5I_object(cb_return))) ==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from datatype ID") break; case H5I_FILE: - if((temp_file = H5I_object(cb_return)) == NULL) + if((temp_file = (H5F_t *)H5I_object(cb_return)) == NULL) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "couldn't get file from ID") if((new_oloc = H5G_oloc(temp_file->shared->root_grp)) ==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get root group location from file ID") @@ -624,7 +624,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, size_t new_alloc; /* New component buffer size */ new_alloc = MAX3(1024, (2 * H5G_comp_alloc_g), (HDstrlen(name) + 1)); - if(NULL == (new_comp = H5MM_realloc(H5G_comp_g, new_alloc))) + if(NULL == (new_comp = (char *)H5MM_realloc(H5G_comp_g, new_alloc))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "unable to allocate component buffer") H5G_comp_g = new_comp; H5G_comp_alloc_g = new_alloc; @@ -862,7 +862,7 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver if(lapl_id == H5P_DEFAULT) nlinks = H5L_NUM_LINKS; else { - if(NULL == (lapl = H5I_object(lapl_id))) + if(NULL == (lapl = (H5P_genplist_t *)H5I_object(lapl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") if(H5P_get(lapl, H5L_ACS_NLINKS_NAME, &nlinks) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of links") @@ -382,7 +382,7 @@ done: if(new_heap!=NULL) { if(new_heap->heap!=NULL) H5FL_SEQ_FREE(H5HP_ent_t,new_heap->heap); - H5FL_FREE(H5HP_t,new_heap); + (void)H5FL_FREE(H5HP_t,new_heap); } /* end if */ } /* end if */ @@ -896,25 +896,25 @@ done: herr_t H5HP_close(H5HP_t *heap) { - FUNC_ENTER_NOAPI_NOFUNC(H5HP_close); + FUNC_ENTER_NOAPI_NOFUNC(H5HP_close) /* Check args */ - assert(heap); + HDassert(heap); /* Check internal consistency */ /* (Pre-condition) */ - assert(heap->nobjs<heap->nalloc); - assert(heap->heap); - assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) || - (heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN)); - assert(heap->heap[0].obj==NULL); + HDassert(heap->nobjs < heap->nalloc); + HDassert(heap->heap); + HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) || + (heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN)); + HDassert(NULL == heap->heap[0].obj); /* Free internal structures for heap */ - H5FL_SEQ_FREE(H5HP_ent_t,heap->heap); + H5FL_SEQ_FREE(H5HP_ent_t, heap->heap); /* Free actual heap object */ - H5FL_FREE(H5HP_t,heap); + (void)H5FL_FREE(H5HP_t, heap); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HP_close() */ @@ -90,7 +90,7 @@ typedef struct H5I_id_info_t { hid_t id; /* ID for this info */ unsigned count; /* ref. count for this atom */ - unsigned app_count; + unsigned app_count; /* ref. count of application visible atoms */ void *obj_ptr; /* pointer associated with the atom */ struct H5I_id_info_t *next; /* link to next atom (in case of hash-clash)*/ } H5I_id_info_t; @@ -1385,7 +1385,7 @@ H5I_dec_ref(hid_t id, hbool_t app_ref) --(id_ptr->count); if (app_ref) --(id_ptr->app_count); - HDassert((id_ptr->count >= id_ptr->app_count) && (id_ptr->app_count >= 0)); + HDassert(id_ptr->count >= id_ptr->app_count); ret_value = app_ref ? id_ptr->app_count : id_ptr->count; } @@ -461,7 +461,7 @@ H5MP_close (H5MP_pool_t *mp) HGOTO_ERROR (H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy page factory") /* Free the memory pool itself */ - H5FL_FREE(H5MP_pool_t, mp); + (void)H5FL_FREE(H5MP_pool_t, mp); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1069,7 +1069,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id, size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint)); /* Get the property list */ - if(NULL == (oc_plist = H5I_object(ocpl_id))) + if(NULL == (oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list") /* Get any object header status flags set by properties */ @@ -1422,7 +1422,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) /* get header */ oh_acc = adjust ? H5AC_WRITE : H5AC_READ; - if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, oh_acc))) + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, oh_acc))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Check for adjusting link count */ @@ -1543,7 +1543,7 @@ H5O_protect(H5O_loc_t *loc, hid_t dxpl_id) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "no write intent on file") /* Lock the object header into the cache */ - if(NULL == (ret_value = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) + if(NULL == (ret_value = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header") /* Mark object header as un-evictable */ @@ -1716,7 +1716,7 @@ H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file") /* Get the object header */ - if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Create/Update the modification time message */ @@ -1825,7 +1825,7 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) HDassert(H5F_addr_defined(addr)); /* Get the object header information */ - if(NULL == (oh = H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_WRITE))) + if(NULL == (oh = (H5O_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Delete object */ @@ -1910,7 +1910,7 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id) FUNC_ENTER_NOAPI(H5O_obj_type, FAIL) /* Load the object header */ - if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Retrieve the type of the object */ @@ -1988,7 +1988,7 @@ H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id) FUNC_ENTER_NOAPI_NOINIT(H5O_obj_class) /* Load the object header */ - if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header") /* Test whether entry qualifies as a particular type of object */ @@ -2274,7 +2274,7 @@ H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *o HDassert(oinfo); /* Get the object header */ - if(NULL == (oh = H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, + if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, (H5F_get_intent(oloc->file) & H5F_ACC_RDWR) ? H5AC_WRITE : H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") @@ -2426,7 +2426,7 @@ H5O_get_create_plist(const H5O_loc_t *oloc, hid_t dxpl_id, H5P_genplist_t *oc_pl HDassert(oc_plist); /* Get the object header */ - if(NULL == (oh = H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Set property values, if they were used for the object */ @@ -2481,7 +2481,7 @@ H5O_get_nlinks(const H5O_loc_t *oloc, hid_t dxpl_id, hsize_t *nlinks) HDassert(nlinks); /* Get the object header */ - if(NULL == (oh = H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Retrieve the # of link messages seen when the object header was loaded */ @@ -2600,7 +2600,7 @@ H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type HDassert(otype); /* Get the object header */ - if(NULL == (oh = H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Set the object's reference count */ @@ -2635,7 +2635,7 @@ H5O_free_visit_visited(void *item, void UNUSED *key, void UNUSED *operator_data/ { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_free_visit_visited) - H5FL_FREE(H5_obj_t, item); + (void)H5FL_FREE(H5_obj_t, item); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_free_visit_visited() */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 0d62d9e..b77c241 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -185,7 +185,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, p += name_len; /* advance the memory pointer */ /* Decode the attribute's datatype */ - if((attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL) + if(NULL == (attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p))) HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype") if(attr->shared->version < H5O_ATTR_VERSION_2) p += H5O_ALIGN_OLD(attr->shared->dt_size); @@ -206,7 +206,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, HDmemcpy(&(attr->shared->ds->extent), extent, sizeof(H5S_extent_t)); /* Release temporary extent information */ - H5FL_FREE(H5S_extent_t, extent); + (void)H5FL_FREE(H5S_extent_t, extent); /* Default to entire dataspace being selected */ if(H5S_select_all(attr->shared->ds, FALSE) < 0) @@ -467,7 +467,7 @@ H5O_attr_size(const H5F_t UNUSED *f, const void *_mesg) *------------------------------------------------------------------------- */ herr_t -H5O_attr_reset(void *_mesg) +H5O_attr_reset(void UNUSED *_mesg) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_reset) @@ -686,8 +686,8 @@ H5O_attr_copy_file(H5F_t UNUSED *file_src, const H5O_msg_class_t UNUSED *mesg_ty /* Copy attribute's datatype */ /* (Start destination datatype as transient, even if source is named) */ - attr_dst->shared->dt = H5T_copy(attr_src->shared->dt, H5T_COPY_ALL); - HDassert(attr_dst->shared->dt); + if(NULL == (attr_dst->shared->dt = H5T_copy(attr_src->shared->dt, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "cannot copy datatype") /* Set the location of the destination datatype */ if(H5T_set_loc(attr_dst->shared->dt, file_dst, H5T_LOC_DISK) < 0) @@ -931,7 +931,6 @@ H5O_attr_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, HDassert(attr_dst); HDassert(file_dst); - /* Only need to fix reference attribute with real data being copied to * another file. */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 96aebeb..889aecc 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -875,7 +875,7 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh) } /* end if */ /* destroy object header */ - H5FL_FREE(H5O_t, oh); + (void)H5FL_FREE(H5O_t, oh); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_dest() */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 9c669e0..5431bee 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -1092,7 +1092,7 @@ H5O_dtype_copy(const void *_src, void *_dst) /* Was result already allocated? */ if(_dst) { *((H5T_t *) _dst) = *dst; - H5FL_FREE(H5T_t, dst); + (void)H5FL_FREE(H5T_t, dst); dst = (H5T_t *) _dst; } /* end if */ @@ -1119,9 +1119,6 @@ done: This function returns the size of the raw simple datatype message on success. (Not counting the message type or size fields, only the data portion of the message). It doesn't take into account alignment. - NOTES - All datatype messages have a common 8 byte header, plus a variable- - sized "properties" field. --------------------------------------------------------------------------*/ static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg) @@ -1289,8 +1286,8 @@ H5O_dtype_free(void *mesg) HDassert(mesg); - H5FL_FREE(H5T_shared_t, ((H5T_t *) mesg)->shared); - H5FL_FREE(H5T_t,mesg); + (void)H5FL_FREE(H5T_shared_t, ((H5T_t *) mesg)->shared); + (void)H5FL_FREE(H5T_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_dtype_free() */ @@ -1311,8 +1308,8 @@ H5O_dtype_free(void *mesg) static herr_t H5O_dtype_set_share(void *_mesg/*in,out*/, const H5O_shared_t *sh) { - H5T_t *dt = (H5T_t *)_mesg; - herr_t ret_value = SUCCEED; + H5T_t *dt = (H5T_t *)_mesg; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT(H5O_dtype_set_share) @@ -1411,9 +1408,9 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t UNUSED *deleted, const H5O_copy_t UNUSED *cpy_info, void *_udata) { - const H5T_t *dt_src = (const H5T_t *)mesg_src; /* Source datatype */ + const H5T_t *dt_src = (const H5T_t *)mesg_src; /* Source datatype */ H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_dtype_pre_copy_file) @@ -1461,8 +1458,8 @@ H5O_dtype_copy_file(H5F_t UNUSED *file_src, const H5O_msg_class_t *mesg_type, void *native_src, H5F_t *file_dst, hbool_t UNUSED *recompute_size, H5O_copy_t UNUSED *cpy_info, void UNUSED *udata, hid_t UNUSED dxpl_id) { - H5T_t *dst_mesg = NULL; /* Destination datatype */ - void *ret_value = NULL; /* Return value */ + H5T_t *dst_mesg; /* Destination datatype */ + void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_dtype_copy_file) diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 613a6fd..43ec1a4 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -275,7 +275,7 @@ done: if(!ret_value && fill) { if(fill->buf) H5MM_xfree(fill->buf); - H5FL_FREE(H5O_fill_t, fill); + (void)H5FL_FREE(H5O_fill_t, fill); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -335,7 +335,7 @@ done: if(!ret_value && fill) { if(fill->buf) H5MM_xfree(fill->buf); - H5FL_FREE(H5O_fill_t, fill); + (void)H5FL_FREE(H5O_fill_t, fill); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -507,7 +507,7 @@ H5O_fill_copy(const void *_src, void *_dst) /* Copy data type of fill value */ if(src->type) { if(NULL == (dst->type = H5T_copy(src->type, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy fill value data type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "can't copy datatype") } /* end if */ else dst->type = NULL; @@ -556,7 +556,7 @@ H5O_fill_copy(const void *_src, void *_dst) H5I_dec_ref(src_id, FALSE); H5I_dec_ref(dst_id, FALSE); if(bkg_buf) - H5FL_BLK_FREE(type_conv, bkg_buf); + (void)H5FL_BLK_FREE(type_conv, bkg_buf); HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "datatype conversion failed") } /* end if */ @@ -564,7 +564,7 @@ H5O_fill_copy(const void *_src, void *_dst) H5I_dec_ref(src_id, FALSE); H5I_dec_ref(dst_id, FALSE); if(bkg_buf) - H5FL_BLK_FREE(type_conv, bkg_buf); + (void)H5FL_BLK_FREE(type_conv, bkg_buf); } /* end if */ } /* end if */ } /* end if */ @@ -581,7 +581,7 @@ done: if(dst->type) H5T_close(dst->type); if(!_dst) - H5FL_FREE(H5O_fill_t, dst); + (void)H5FL_FREE(H5O_fill_t, dst); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -783,7 +783,7 @@ H5O_fill_free(void *fill) HDassert(fill); - H5FL_FREE(H5O_fill_t, fill); + (void)H5FL_FREE(H5O_fill_t, fill); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_fill_free() */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 792c1f0..f6d9534 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -254,7 +254,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, done: if(ret_value == NULL) if(mesg) - H5FL_FREE(H5O_layout_t, mesg); + (void)H5FL_FREE(H5O_layout_t, mesg); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_layout_decode() */ @@ -552,22 +552,22 @@ H5O_layout_reset (void *_mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_layout_free (void *_mesg) +H5O_layout_free(void *_mesg) { H5O_layout_t *mesg = (H5O_layout_t *) _mesg; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_layout_free); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_layout_free) - assert (mesg); + HDassert(mesg); /* Free the compact storage buffer */ - if(mesg->type==H5D_COMPACT) - mesg->u.compact.buf=H5MM_xfree(mesg->u.compact.buf); + if(mesg->type == H5D_COMPACT) + mesg->u.compact.buf = H5MM_xfree(mesg->u.compact.buf); - H5FL_FREE(H5O_layout_t,mesg); + (void)H5FL_FREE(H5O_layout_t, mesg); - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5O_layout_free() */ /*------------------------------------------------------------------------- @@ -721,7 +721,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, done: if(!ret_value) if(layout_dst) - H5FL_FREE(H5O_layout_t, layout_dst); + (void)H5FL_FREE(H5O_layout_t, layout_dst); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_layout_copy_file() */ @@ -742,8 +742,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * stream, - int indent, int fwidth) +H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, + FILE * stream, int indent, int fwidth) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; unsigned u; @@ -791,5 +791,5 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED); -} +} /* end H5O_layout_debug() */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 16248ca..48c7284 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -302,7 +302,7 @@ struct H5O_t { }; /* Callback information for copying dataset */ -typedef struct { +typedef struct H5D_copy_file_ud_t { struct H5S_extent_t *src_space_extent; /* Copy of dataspace extent for dataset */ H5T_t *src_dtype; /* Copy of datatype for dataset */ H5O_pline_t *src_pline; /* Copy of filter pipeline for dataet */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index c3e9bd6..930a109 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -222,9 +222,9 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) FUNC_ENTER_NOAPI_NOINIT(H5P_dcrt_copy) /* Verify property list IDs */ - if(NULL == (dst_plist = H5I_object(dst_plist_id))) + if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_plist_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") - if(NULL == (src_plist = H5I_object(src_plist_id))) + if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_plist_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") /* Get the fill value, external file list, and data pipeline properties @@ -302,7 +302,7 @@ H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data) FUNC_ENTER_NOAPI_NOINIT(H5P_dcrt_close) /* Check arguments */ - if(NULL == (plist = H5I_object(dcpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") /* Get the fill value, external file list, and data pipeline properties @@ -645,7 +645,7 @@ herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_layout, FAIL) H5TRACE2("e", "iDl", plist_id, layout); @@ -655,7 +655,7 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "raw data layout method is not valid") /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set value */ @@ -692,13 +692,13 @@ H5D_layout_t H5Pget_layout(hid_t plist_id) { H5P_genplist_t *plist; /* Property list pointer */ - H5D_layout_t ret_value=H5D_LAYOUT_ERROR; + H5D_layout_t ret_value = H5D_LAYOUT_ERROR; FUNC_ENTER_API(H5Pget_layout, H5D_LAYOUT_ERROR) H5TRACE1("Dl", "i", plist_id); /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_LAYOUT_ERROR, "can't find object for ID") /* Get value */ @@ -821,7 +821,7 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/) H5TRACE3("Is", "iIsx", plist_id, max_ndims, dim); /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) @@ -889,7 +889,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) hsize_t total, tmp; H5O_efl_t efl; H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Pset_external, FAIL) H5TRACE4("e", "i*soh", plist_id, name, offset, size); @@ -903,7 +903,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "zero size") /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) @@ -921,15 +921,15 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) /* Add to the list */ - if (efl.nused >= efl.nalloc) { + if(efl.nused >= efl.nalloc) { size_t na = efl.nalloc + H5O_EFL_ALLOC; - H5O_efl_entry_t *x = H5MM_realloc (efl.slot, na*sizeof(H5O_efl_entry_t)); + H5O_efl_entry_t *x = (H5O_efl_entry_t *)H5MM_realloc(efl.slot, na * sizeof(H5O_efl_entry_t)); - if (!x) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + if(!x) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") efl.nalloc = na; efl.slot = x; - } + } /* end if */ idx = efl.nused; efl.slot[idx].name_offset = 0; /*not entered into heap yet*/ efl.slot[idx].name = H5MM_xstrdup (name); @@ -977,7 +977,7 @@ H5Pget_external_count(hid_t plist_id) H5TRACE1("Is", "i", plist_id); /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get value */ @@ -985,11 +985,11 @@ H5Pget_external_count(hid_t plist_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") /* Set return value */ - ret_value=(int)efl.nused; + ret_value = (int)efl.nused; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_external_count() */ /*------------------------------------------------------------------------- @@ -1029,33 +1029,33 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out* { H5O_efl_t efl; H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(H5Pget_external, FAIL) H5TRACE6("e", "iIuzxxx", plist_id, idx, name_size, name, offset, size); /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get value */ if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") - if (idx>=efl.nused) - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range") + if(idx >= efl.nused) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range") /* Return values */ - if (name_size>0 && name) - HDstrncpy (name, efl.slot[idx].name, name_size); - if (offset) + if(name_size>0 && name) + HDstrncpy(name, efl.slot[idx].name, name_size); + if(offset) *offset = efl.slot[idx].offset; - if (size) + if(size) *size = efl.slot[idx].size; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_external() */ /*------------------------------------------------------------------------- @@ -1177,7 +1177,7 @@ H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied") /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Modify the filter parameters of the I/O pipeline */ @@ -1252,7 +1252,7 @@ H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied") /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the pipeline property to append to */ @@ -1862,7 +1862,7 @@ H5Pset_shuffle(hid_t plist_id) HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") /* Get the plist structure */ - if(NULL == (plist = H5I_object(plist_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Add the filter */ @@ -1908,7 +1908,7 @@ H5Pset_nbit(hid_t plist_id) HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") /* Get the plist structure */ - if(NULL == (plist = H5I_object(plist_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Add the nbit filter */ @@ -1974,7 +1974,7 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "invalid scale type") /* Get the plist structure */ - if(NULL == (plist = H5I_object(plist_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set parameters for the filter @@ -2093,12 +2093,12 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) H5T_path_t *tpath; /* Conversion information */ /* Retrieve pointer to datatype */ - if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Set the fill value */ if(NULL == (fill.type = H5T_copy(type, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy datatype") fill.size = H5T_get_size(type); if(NULL == (fill.buf = H5MM_malloc((size_t)fill.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for fill value") @@ -2119,13 +2119,13 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) /* Convert the fill value */ if(H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) { if(bkg_buf) - H5FL_BLK_FREE(type_conv, bkg_buf); + (void)H5FL_BLK_FREE(type_conv, bkg_buf); HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") } /* end if */ /* Release the background buffer */ if(bkg_buf) - H5FL_BLK_FREE(type_conv, bkg_buf); + (void)H5FL_BLK_FREE(type_conv, bkg_buf); } /* end if */ } /* end if */ else @@ -2262,7 +2262,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/) H5TRACE3("e", "iix", plist_id, type_id, value); /* Check arguments */ - if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(!value) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,"no fill value output buffer") @@ -236,7 +236,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 /* Allocate the space to store the serialized information */ H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t); - if(NULL == (buf = H5MM_malloc((size_t)buf_size))) + if(NULL == (buf = (uint8_t *)H5MM_malloc((size_t)buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Serialize information for dataset OID into heap buffer */ @@ -265,7 +265,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 case H5R_BADTYPE: case H5R_MAXTYPE: default: - assert("unknown reference type" && 0); + HDassert("unknown reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") } /* end switch */ @@ -308,7 +308,7 @@ herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id) { H5G_loc_t loc; /* File location */ - H5S_t *space = NULL; /* Pointer to dataspace containing region */ + H5S_t *space; /* Pointer to dataspace containing region */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Rcreate, FAIL) @@ -325,7 +325,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") if(ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported") - if(space_id != (-1) && (NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE)))) + if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Create reference */ @@ -395,7 +395,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re INT32DECODE(p, hobjid.idx); /* Get the dataset region from the heap (allocate inside routine) */ - if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) + if(NULL == (buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") /* Get the object oid for the dataset */ @@ -433,7 +433,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re { H5G_t *group; /* Pointer to group to open */ - if((group = H5G_open(&loc, dxpl_id)) == NULL) + if(NULL == (group = H5G_open(&loc, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found") /* Create an atom for the group */ @@ -448,7 +448,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re { H5T_t *type; /* Pointer to datatype to open */ - if((type = H5T_open(&loc, dxpl_id)) == NULL) + if(NULL == (type = H5T_open(&loc, dxpl_id))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found") /* Create an atom for the datatype */ @@ -464,7 +464,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re H5D_t *dset; /* Pointer to dataset to open */ /* Open the dataset */ - if((dset = H5D_open(&loc, dxpl_id)) == NULL) + if(NULL == (dset = H5D_open(&loc, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found") /* Create an atom for the dataset */ @@ -581,7 +581,7 @@ H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref) INT32DECODE(p, hobjid.idx); /* Get the dataset region from the heap (allocate inside routine) */ - if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) + if((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, NULL, "Unable to read dataset region information") /* Get the object oid for the dataset */ @@ -715,7 +715,7 @@ H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, INT32DECODE(p, hobjid.idx); /* Get the dataset region from the heap (allocate inside routine) */ - if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) + if((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") /* Get the object oid for the dataset */ @@ -862,7 +862,7 @@ H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_ty INT32DECODE(p, hobjid.idx); /* Get the dataset region from the heap (allocate inside routine) */ - if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) + if((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") /* Get the object oid for the dataset */ @@ -99,29 +99,29 @@ done: herr_t H5RC_decr(H5RC_t *rc) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5RC_decr,FAIL); + FUNC_ENTER_NOAPI(H5RC_decr, FAIL) /* Sanity check */ HDassert(rc); HDassert(rc->o); - HDassert(rc->n>0); + HDassert(rc->n > 0); HDassert(rc->free_func); /* Decrement reference count */ rc->n--; /* Check if we should delete this object now */ - if(rc->n==0) { - if((rc->free_func)(rc->o)<0) { - H5FL_FREE(H5RC_t,rc); - HGOTO_ERROR(H5E_RS,H5E_CANTFREE,FAIL,"memory release failed"); + if(rc->n == 0) { + if((rc->free_func)(rc->o) < 0) { + (void)H5FL_FREE(H5RC_t, rc); + HGOTO_ERROR(H5E_RS, H5E_CANTFREE, FAIL, "memory release failed") } /* end if */ - H5FL_FREE(H5RC_t,rc); + (void)H5FL_FREE(H5RC_t, rc); } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5RC_decr() */ @@ -221,20 +221,20 @@ done: herr_t H5RS_decr(H5RS_str_t *rs) { - FUNC_ENTER_NOAPI_NOFUNC(H5RS_decr); + FUNC_ENTER_NOAPI_NOFUNC(H5RS_decr) /* Sanity check */ - assert(rs); - assert(rs->n > 0); + HDassert(rs); + HDassert(rs->n > 0); /* Decrement reference count for string */ - if((--rs->n)==0) { + if((--rs->n) == 0) { if(!rs->wrapped) - (void)H5FL_BLK_FREE(str_buf,rs->s); - H5FL_FREE(H5RS_str_t,rs); + (void)H5FL_BLK_FREE(str_buf, rs->s); + (void)H5FL_FREE(H5RS_str_t, rs); } /* end if */ - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5RS_decr() */ @@ -58,8 +58,8 @@ /* Local Macros */ /* Define the code template for insertions for the "OP" in the H5SL_LOCATE macro */ -#define H5SL_LOCATE_INSERT_FOUND(SLIST,X,UPDATE,I) \ - HGOTO_ERROR(H5E_SLIST,H5E_CANTINSERT,NULL,"can't insert duplicate key"); +#define H5SL_LOCATE_INSERT_FOUND(SLIST, X, UPDATE, I) \ + HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, NULL, "can't insert duplicate key") /* Define the code template for removals for the "OP" in the H5SL_LOCATE macro */ /* (NOTE: the code in H5SL_remove_first() is largely the same, fix bugs in both places) */ @@ -83,11 +83,11 @@ HGOTO_DONE(tmp); /* Define the code template for searches for the "OP" in the H5SL_LOCATE macro */ -#define H5SL_LOCATE_SEARCH_FOUND(SLIST,X,UPDATE,I) \ +#define H5SL_LOCATE_SEARCH_FOUND(SLIST, X, UPDATE, I) \ HGOTO_DONE(X->item); /* Define the code template for finds for the "OP" in the H5SL_LOCATE macro */ -#define H5SL_LOCATE_FIND_FOUND(SLIST,X,UPDATE,I) \ +#define H5SL_LOCATE_FIND_FOUND(SLIST, X, UPDATE, I) \ HGOTO_DONE(X); @@ -327,7 +327,7 @@ H5SL_new_node(size_t lvl, void *item, const void *key, uint32_t hashval) FUNC_ENTER_NOAPI_NOINIT(H5SL_new_node) /* Allocate the node */ - if(NULL == (ret_value = H5FL_ARR_MALLOC(H5SL_node_ptr_t, (lvl + 1)))) + if(NULL == (ret_value = (H5SL_node_t *)H5FL_ARR_MALLOC(H5SL_node_ptr_t, (lvl + 1)))) HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") /* Initialize node */ @@ -416,6 +416,9 @@ H5SL_insert_common(H5SL_t *slist, void *item, const void *key) case H5SL_TYPE_OBJ: H5SL_INSERT(OBJ, slist, x, update, const H5_obj_t, key, -) break; + + default: + HDassert(0 && "Unknown skiplist type!"); } /* end switch */ /* 'key' must not have been found in existing list, if we get here */ @@ -558,24 +561,24 @@ H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) herr_t H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_close_common); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_close_common) /* Check args */ - assert(slist); + HDassert(slist); /* Check internal consistency */ /* (Pre-condition) */ /* Free skip list nodes */ - (void)H5SL_release_common(slist,op,op_data); /* always succeeds */ + (void)H5SL_release_common(slist, op, op_data); /* always succeeds */ /* Release header node */ - H5FL_ARR_FREE(H5SL_node_ptr_t,slist->header); + H5FL_ARR_FREE(H5SL_node_ptr_t, slist->header); /* Free skip list object */ - H5FL_FREE(H5SL_t,slist); + (void)H5FL_FREE(H5SL_t, slist); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SL_close_common() */ @@ -599,7 +602,7 @@ H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) H5SL_t * H5SL_create(H5SL_type_t type, double p, size_t max_level) { - H5SL_t *new_slist=NULL; /* Pointer to new skip list object created */ + H5SL_t *new_slist = NULL; /* Pointer to new skip list object created */ H5SL_node_t *header; /* Pointer to skip list header node */ size_t u; /* Local index variable */ H5SL_t *ret_value; /* Return value */ @@ -612,46 +615,45 @@ H5SL_create(H5SL_type_t type, double p, size_t max_level) HDassert(type>=H5SL_TYPE_INT && type<=H5SL_TYPE_OBJ); /* Allocate skip list structure */ - if((new_slist=H5FL_MALLOC(H5SL_t))==NULL) - HGOTO_ERROR(H5E_SLIST,H5E_NOSPACE,NULL,"memory allocation failed"); + if(NULL == (new_slist = H5FL_MALLOC(H5SL_t))) + HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the static internal fields */ - new_slist->type=type; - new_slist->p=p; - new_slist->p1=(int)(p*RAND_MAX); - new_slist->max_level=max_level; + new_slist->type = type; + new_slist->p = p; + new_slist->p1 = (int)(p*RAND_MAX); + new_slist->max_level = max_level; /* Set the dynamic internal fields */ - new_slist->curr_level=-1; - new_slist->nobjs=0; + new_slist->curr_level = -1; + new_slist->nobjs = 0; /* Allocate the header node */ if(NULL == (header = H5SL_new_node((max_level - 1), NULL, NULL, ULONG_MAX))) HGOTO_ERROR(H5E_SLIST ,H5E_NOSPACE, NULL, "can't create new skip list node") /* Initialize header node's forward pointers */ - for(u=0; u<max_level; u++) - header->forward[u]=NULL; + for(u = 0; u < max_level; u++) + header->forward[u] = NULL; /* Initialize header node's backward pointer */ - header->backward=NULL; + header->backward = NULL; /* Attach the header */ - new_slist->header=header; - new_slist->last=header; + new_slist->header = header; + new_slist->last = header; /* Set the return value */ - ret_value=new_slist; + ret_value = new_slist; done: /* Error cleanup */ - if(ret_value==NULL) { - if(new_slist!=NULL) { - H5FL_FREE(H5SL_t,new_slist); - } /* end if */ + if(ret_value == NULL) { + if(new_slist != NULL) + (void)H5FL_FREE(H5SL_t, new_slist); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5SL_create() */ @@ -804,13 +806,13 @@ H5SL_remove(H5SL_t *slist, const void *key) H5SL_node_t **update[H5SL_LEVEL_MAX]; /* 'update' vector */ H5SL_node_t *x; /* Current node to examine */ uint32_t hashval = 0; /* Hash value for key */ - void *ret_value=NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_remove); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_remove) /* Check args */ - assert(slist); - assert(key); + HDassert(slist); + HDassert(key); /* Check internal consistency */ /* (Pre-condition) */ @@ -820,7 +822,7 @@ H5SL_remove(H5SL_t *slist, const void *key) /* Work through the forward pointers for a node, finding the node at each * level that is before the location to remove */ - x=slist->header; + x = slist->header; switch(slist->type) { case H5SL_TYPE_INT: H5SL_REMOVE(SCALAR, slist, x, update, const int, key, -) @@ -849,10 +851,13 @@ H5SL_remove(H5SL_t *slist, const void *key) case H5SL_TYPE_OBJ: H5SL_REMOVE(OBJ, slist, x, update, const H5_obj_t, key, -) break; + + default: + HDassert(0 && "Unknown skiplist type!"); } /* end switch */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5SL_remove() */ @@ -999,6 +1004,9 @@ H5SL_search(H5SL_t *slist, const void *key) case H5SL_TYPE_OBJ: H5SL_SEARCH(OBJ, slist, x, -, const H5_obj_t, key, -) break; + + default: + HDassert(0 && "Unknown skiplist type!"); } /* end switch */ /* 'key' must not have been found in list, if we get here */ @@ -1081,6 +1089,9 @@ H5SL_less(H5SL_t *slist, const void *key) case H5SL_TYPE_OBJ: H5SL_SEARCH(OBJ, slist, x, -, const H5_obj_t, key, -) break; + + default: + HDassert(0 && "Unknown skiplist type!"); } /* end switch */ /* An exact match for 'key' must not have been found in list, if we get here */ @@ -1176,6 +1187,9 @@ H5SL_greater(H5SL_t *slist, const void *key) case H5SL_TYPE_OBJ: H5SL_SEARCH(OBJ, slist, x, -, const H5_obj_t, key, -) break; + + default: + HDassert(0 && "Unknown skiplist type!"); } /* end switch */ /* An exact match for 'key' must not have been found in list, if we get here */ @@ -1261,6 +1275,9 @@ H5SL_find(H5SL_t *slist, const void *key) case H5SL_TYPE_OBJ: H5SL_FIND(OBJ, slist, x, -, const H5_obj_t, key, -) break; + + default: + HDassert(0 && "Unknown skiplist type!"); } /* end switch */ /* 'key' must not have been found in list, if we get here */ @@ -1479,28 +1496,28 @@ herr_t H5SL_iterate(H5SL_t *slist, H5SL_operator_t op, void *op_data) { H5SL_node_t *node; /* Pointers to skip list nodes */ - herr_t ret_value=0; /* Return value */ + herr_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_iterate); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_iterate) /* Check args */ - assert(slist); + HDassert(slist); /* Check internal consistency */ /* (Pre-condition) */ /* Free skip list nodes */ - node=slist->header->forward[0]; - while(node!=NULL) { + node = slist->header->forward[0]; + while(node != NULL) { /* Call the iterator callback */ /* Casting away const OK -QAK */ - if((ret_value=(op)(node->item,(void *)node->key,op_data))!=0) + if((ret_value = (op)(node->item, (void *)node->key, op_data)) != 0) break; - node=node->forward[0]; + node = node->forward[0]; } /* end while */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5SL_iterate() */ diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 371344a..7852fc6 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -154,7 +154,7 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1 size = H5SM_TABLE_SIZE(f) + (table->num_indexes * H5SM_INDEX_HEADER_SIZE(f)); /* Get a pointer to a buffer that's large enough for serialized table */ - if(NULL == (buf = H5WB_actual(wb, size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "can't get actual buffer") /* Read header from disk */ @@ -283,7 +283,7 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma size = H5SM_TABLE_SIZE(f) + (H5SM_INDEX_HEADER_SIZE(f) * table->num_indexes); /* Get a pointer to a buffer that's large enough for serialized table */ - if(NULL == (buf = H5WB_actual(wb, size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Get temporary pointer to buffer for serialized table */ @@ -371,7 +371,7 @@ H5SM_table_dest(H5F_t UNUSED *f, H5SM_master_table_t* table) H5FL_ARR_FREE(H5SM_index_header_t, table->indexes); - H5FL_FREE(H5SM_master_table_t, table); + (void)H5FL_FREE(H5SM_master_table_t, table); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM_table_dest() */ @@ -493,7 +493,7 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, size = H5SM_LIST_SIZE(f, header->num_messages); /* Get a pointer to a buffer that's large enough for serialized list index */ - if(NULL == (buf = H5WB_actual(wb, size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "can't get actual buffer") /* Read list from disk */ @@ -542,7 +542,7 @@ done: if(!ret_value && list) { if(list->messages) H5FL_ARR_FREE(H5SM_sohm_t, list->messages); - H5FL_FREE(H5SM_list_t, list); + (void)H5FL_FREE(H5SM_list_t, list); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -591,7 +591,7 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis size = H5SM_LIST_SIZE(f, list->header->num_messages); /* Get a pointer to a buffer that's large enough for serialized list index */ - if(NULL == (buf = H5WB_actual(wb, size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Get temporary pointer to buffer for serialized list index */ @@ -661,7 +661,7 @@ H5SM_list_dest(H5F_t UNUSED *f, H5SM_list_t* list) H5FL_ARR_FREE(H5SM_sohm_t, list->messages); - H5FL_FREE(H5SM_list_t, list); + (void)H5FL_FREE(H5SM_list_t, list); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM_list_dest() */ @@ -87,18 +87,18 @@ done: static herr_t H5ST_close_internal(H5ST_ptr_t p) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_close_internal); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_close_internal) /* Recursively free TST */ if(p) { H5ST_close_internal(p->lokid); - if (p->splitchar) + if(p->splitchar) H5ST_close_internal(p->eqkid); H5ST_close_internal(p->hikid); - H5FL_FREE(H5ST_node_t,p); + (void)H5FL_FREE(H5ST_node_t, p); } /* end if */ - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5ST_close_internal() */ @@ -123,23 +123,23 @@ H5ST_close_internal(H5ST_ptr_t p) herr_t H5ST_close(H5ST_tree_t *tree) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5ST_close,FAIL); + FUNC_ENTER_NOAPI(H5ST_close, FAIL) /* Check arguments */ - if(tree==NULL) - HGOTO_ERROR(H5E_ARGS,H5E_BADVALUE,FAIL,"invalid TST"); + if(NULL == tree) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid TST") /* Free the TST itself */ - if(H5ST_close_internal(tree->root)<0) - HGOTO_ERROR(H5E_TST,H5E_CANTFREE,FAIL,"can't free TST"); + if(H5ST_close_internal(tree->root) < 0) + HGOTO_ERROR(H5E_TST, H5E_CANTFREE, FAIL, "can't free TST") /* Free root node itself */ - H5FL_FREE(H5ST_tree_t,tree); + (void)H5FL_FREE(H5ST_tree_t, tree); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5ST_close() */ @@ -587,53 +587,54 @@ H5ST_delete_internal(H5ST_ptr_t *root, H5ST_ptr_t p) H5ST_ptr_t q, /* Temporary pointer to TST node */ newp; /* Pointer to node which will replace deleted node in tree */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_delete_internal); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_delete_internal) /* Find node to replace one being deleted */ if(p->lokid) { /* If the deleted node has lo & hi kids, attach them together */ if(p->hikid) { - q=p->lokid; + q = p->lokid; while(q->hikid) - q=q->hikid; - q->hikid=p->hikid; - p->hikid->parent=q; + q = q->hikid; + q->hikid = p->hikid; + p->hikid->parent = q; } /* end if */ - newp=p->lokid; + newp = p->lokid; } /* end if */ else if(p->hikid) { - newp=p->hikid; + newp = p->hikid; } /* end if */ else { - newp=NULL; + newp = NULL; } /* end else */ /* Deleted node is in middle of tree */ if(p->parent) { /* Attach new node to correct side of parent */ - if(p==p->parent->lokid) - p->parent->lokid=newp; + if(p == p->parent->lokid) + p->parent->lokid = newp; else - p->parent->hikid=newp; + p->parent->hikid = newp; if(newp) - newp->parent=p->parent; + newp->parent = p->parent; } /* end if */ else { if(newp) - newp->parent=p->parent; + newp->parent = p->parent; if(p->up) { - p->up->eqkid=newp; + p->up->eqkid = newp; + /* If we deleted the last node in the TST, delete the upper node also */ - if(newp==NULL) - H5ST_delete_internal(root,p->up); + if(NULL == newp) + H5ST_delete_internal(root, p->up); } /* end if */ else /* Deleted last node at top level of tree */ - *root=newp; + *root = newp; } /* end else */ - H5FL_FREE(H5ST_node_t,p); + (void)H5FL_FREE(H5ST_node_t, p); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5ST_delete_internal() */ diff --git a/src/H5Snone.c b/src/H5Snone.c index e14c417..fdea677 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -288,12 +288,12 @@ H5S_none_iter_next(H5S_sel_iter_t UNUSED *iter, size_t UNUSED nelem) static herr_t H5S_none_iter_next_block(H5S_sel_iter_t UNUSED *iter) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_iter_next); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_iter_next) /* Check args */ - assert (iter); + HDassert(iter); - FUNC_LEAVE_NOAPI(FAIL); + FUNC_LEAVE_NOAPI(FAIL) } /* H5S_none_iter_next_block() */ diff --git a/src/H5Sselect.c b/src/H5Sselect.c index ed3c740..2a9c4dc 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -291,20 +291,20 @@ H5S_select_serialize(const H5S_t *space, uint8_t *buf) hssize_t H5Sget_select_npoints(hid_t spaceid) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ + H5S_t *space; /* Dataspace to modify selection of */ hssize_t ret_value; /* return value */ - FUNC_ENTER_API(H5Sget_select_npoints, FAIL); + FUNC_ENTER_API(H5Sget_select_npoints, FAIL) H5TRACE1("Hs", "i", spaceid); /* Check args */ - if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); + if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") ret_value = H5S_GET_SELECT_NPOINTS(space); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Sget_select_npoints() */ @@ -365,20 +365,20 @@ H5S_get_select_npoints(const H5S_t *space) htri_t H5Sselect_valid(hid_t spaceid) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ - htri_t ret_value; /* return value */ + H5S_t *space; /* Dataspace to modify selection of */ + htri_t ret_value; /* return value */ - FUNC_ENTER_API(H5Sselect_valid, FAIL); + FUNC_ENTER_API(H5Sselect_valid, FAIL) H5TRACE1("t", "i", spaceid); /* Check args */ - if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); + if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") ret_value = H5S_SELECT_VALID(space); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Sselect_valid() */ @@ -516,22 +516,22 @@ done: herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[]) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ - herr_t ret_value; /* return value */ + H5S_t *space; /* Dataspace to modify selection of */ + herr_t ret_value; /* return value */ - FUNC_ENTER_API(H5Sget_select_bounds, FAIL); + FUNC_ENTER_API(H5Sget_select_bounds, FAIL) H5TRACE3("e", "i*h*h", spaceid, start, end); /* Check args */ - if(start==NULL || end==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer"); - if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); + if(start == NULL || end == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer") + if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - ret_value = H5S_SELECT_BOUNDS(space,start,end); + ret_value = H5S_SELECT_BOUNDS(space, start, end); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Sget_select_bounds() */ @@ -1134,7 +1134,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t { H5T_t *dt; /* Datatype structure */ H5S_sel_iter_t iter; /* Selection iteration info */ - hbool_t iter_init=0; /* Selection iteration info has been initialized */ + hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ uint8_t *loc; /* Current element location in buffer */ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of element in dataspace */ hssize_t nelmts; /* Number of elements in selection */ @@ -1157,44 +1157,44 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t FUNC_ENTER_NOAPI(H5S_select_iterate, FAIL); /* Check args */ - assert(buf); - assert(H5I_DATATYPE == H5I_get_type(type_id)); - assert(space); - assert(op); + HDassert(buf); + HDassert(H5I_DATATYPE == H5I_get_type(type_id)); + HDassert(space); + HDassert(op); /* Get the datatype size */ - if (NULL==(dt=H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype"); - if((elmt_size=H5T_get_size(dt))==0) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid"); + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") + if(0 == (elmt_size = H5T_get_size(dt))) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid") /* Initialize iterator */ - if (H5S_select_iter_init(&iter, space, elmt_size)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator"); - iter_init=1; /* Selection iteration info has been initialized */ + if(H5S_select_iter_init(&iter, space, elmt_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") + iter_init = TRUE; /* Selection iteration info has been initialized */ /* Get the number of elements in selection */ - if((nelmts = H5S_GET_SELECT_NPOINTS(space))<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); + if((nelmts = H5S_GET_SELECT_NPOINTS(space)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected") /* Get the rank of the dataspace */ - ndims=space->extent.rank; + ndims = space->extent.rank; - if (ndims > 0){ + if(ndims > 0) { /* Copy the size of the space */ - assert(space->extent.size); - HDmemcpy(space_size, space->extent.size, ndims*sizeof(hsize_t)); - } - space_size[ndims]=elmt_size; + HDassert(space->extent.size); + HDmemcpy(space_size, space->extent.size, ndims * sizeof(hsize_t)); + } /* end if */ + space_size[ndims] = elmt_size; /* Compute the maximum number of bytes required */ - H5_ASSIGN_OVERFLOW(max_elem,nelmts,hssize_t,size_t); + H5_ASSIGN_OVERFLOW(max_elem, nelmts, hssize_t, size_t); /* Loop, while elements left in selection */ - while(max_elem>0 && user_ret==0) { + while(max_elem > 0 && user_ret == 0) { /* Get the sequences of bytes */ if(H5S_SELECT_GET_SEQ_LIST(space, 0, &iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0) - HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") /* Loop, while sequences left to process */ for(curr_seq=0; curr_seq<nseq && user_ret==0; curr_seq++) { @@ -1235,12 +1235,10 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t done: /* Release selection iterator */ - if(iter_init) { - if (H5S_SELECT_ITER_RELEASE(&iter)<0) - HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); - } /* end if */ + if(iter_init && H5S_SELECT_ITER_RELEASE(&iter) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_iterate() */ @@ -1262,21 +1260,21 @@ done: H5S_sel_type H5Sget_select_type(hid_t space_id) { - H5S_t *space = NULL; /* dataspace to modify */ - H5S_sel_type ret_value; /* Return value */ + H5S_t *space; /* dataspace to modify */ + H5S_sel_type ret_value; /* Return value */ - FUNC_ENTER_API(H5Sget_select_type, H5S_SEL_ERROR); + FUNC_ENTER_API(H5Sget_select_type, H5S_SEL_ERROR) H5TRACE1("St", "i", space_id); /* Check args */ - if (NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5S_SEL_ERROR, "not a dataspace"); + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5S_SEL_ERROR, "not a dataspace") /* Set return value */ - ret_value=H5S_GET_SELECT_TYPE(space); + ret_value = H5S_GET_SELECT_TYPE(space); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Sget_select_type() */ @@ -20,23 +20,30 @@ * one particular datatype class are in another module. */ +/****************/ +/* Module Setup */ +/****************/ + #define H5T_PACKAGE /*suppress error about including H5Tpkg */ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5T_init_interface -#include "H5private.h" /*generic functions */ -#include "H5Dprivate.h" /*datasets (for H5Tcopy) */ -#include "H5Eprivate.h" /*error handling */ +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FOprivate.h" /* File objects */ -#include "H5Gprivate.h" /*groups */ -#include "H5Iprivate.h" /*ID functions */ -#include "H5MMprivate.h" /*memory management */ -#include "H5Pprivate.h" /* Property Lists */ -#include "H5Tpkg.h" /*data-type functions */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tpkg.h" /* Datatypes */ /* Check for header needed for SGI floating-point code */ #ifdef H5_HAVE_SYS_FPU_H @@ -465,13 +472,13 @@ static H5T_t *H5T_decode(const unsigned char *buf); #define H5T_INIT_TYPE_COPY_CREATE(BASE) { \ /* Base off of existing datatype */ \ if(NULL == (dt = H5T_copy(BASE, H5T_COPY_TRANSIENT))) \ - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "duplicating base type failed") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "duplicating base type failed") \ } #define H5T_INIT_TYPE_ALLOC_CREATE(BASE) { \ /* Allocate new datatype info */ \ if(NULL == (dt = H5T_alloc())) \ - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed") \ } @@ -484,7 +491,7 @@ static H5T_t *H5T_decode(const unsigned char *buf); H5_GLUE3(H5T_INIT_TYPE_,SIZE_TMPL,_SIZE)(SIZE) \ \ /* Adjust information for this type */ \ - H5_GLUE3(H5T_INIT_TYPE_,GUTS,_CORE) \ + H5_GLUE3(H5T_INIT_TYPE_, GUTS, _CORE) \ \ /* Atomize result */ \ if((GLOBAL = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) \ @@ -546,9 +553,9 @@ H5T_init_inf(void) uint8_t *d; /* Pointer to value to set */ size_t half_size; /* Half the type size */ size_t u; /* Local index value */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5T_init_inf); + FUNC_ENTER_NOAPI_NOINIT(H5T_init_inf) /* Get the float datatype */ if (NULL==(dst_p=H5I_object(H5T_NATIVE_FLOAT_g))) @@ -556,40 +563,40 @@ H5T_init_inf(void) dst = &dst_p->shared->u.atomic; /* Check that we can re-order the bytes correctly */ - if (H5T_ORDER_LE!=H5T_native_order_g && H5T_ORDER_BE!=H5T_native_order_g) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); + if(H5T_ORDER_LE != H5T_native_order_g && H5T_ORDER_BE != H5T_native_order_g) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") /* +Inf */ - d=(uint8_t *)&H5T_NATIVE_FLOAT_POS_INF_g; - H5T_bit_set (d, dst->u.f.sign, (size_t)1, FALSE); - H5T_bit_set (d, dst->u.f.epos, dst->u.f.esize, TRUE); - H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE); + d = (uint8_t *)&H5T_NATIVE_FLOAT_POS_INF_g; + H5T_bit_set(d, dst->u.f.sign, (size_t)1, FALSE); + H5T_bit_set(d, dst->u.f.epos, dst->u.f.esize, TRUE); + H5T_bit_set(d, dst->u.f.mpos, dst->u.f.msize, FALSE); /* Swap the bytes if the machine architecture is big-endian */ - if (H5T_ORDER_BE==H5T_native_order_g) { - half_size = dst_p->shared->size/2; - for (u=0; u<half_size; u++) { - uint8_t tmp = d[dst_p->shared->size-(u+1)]; - d[dst_p->shared->size-(u+1)] = d[u]; + if (H5T_ORDER_BE == H5T_native_order_g) { + half_size = dst_p->shared->size / 2; + for(u = 0; u < half_size; u++) { + uint8_t tmp = d[dst_p->shared->size - (u + 1)]; + d[dst_p->shared->size - (u + 1)] = d[u]; d[u] = tmp; - } - } + } /* end for */ + } /* end if */ /* -Inf */ - d=(uint8_t *)&H5T_NATIVE_FLOAT_NEG_INF_g; - H5T_bit_set (d, dst->u.f.sign, (size_t)1, TRUE); - H5T_bit_set (d, dst->u.f.epos, dst->u.f.esize, TRUE); - H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE); + d = (uint8_t *)&H5T_NATIVE_FLOAT_NEG_INF_g; + H5T_bit_set(d, dst->u.f.sign, (size_t)1, TRUE); + H5T_bit_set(d, dst->u.f.epos, dst->u.f.esize, TRUE); + H5T_bit_set(d, dst->u.f.mpos, dst->u.f.msize, FALSE); /* Swap the bytes if the machine architecture is big-endian */ - if (H5T_ORDER_BE==H5T_native_order_g) { - half_size = dst_p->shared->size/2; - for (u=0; u<half_size; u++) { - uint8_t tmp = d[dst_p->shared->size-(u+1)]; - d[dst_p->shared->size-(u+1)] = d[u]; + if(H5T_ORDER_BE == H5T_native_order_g) { + half_size = dst_p->shared->size / 2; + for(u = 0; u < half_size; u++) { + uint8_t tmp = d[dst_p->shared->size - (u + 1)]; + d[dst_p->shared->size - (u + 1)] = d[u]; d[u] = tmp; - } - } + } /* end for */ + } /* end if */ /* Get the double datatype */ if (NULL==(dst_p=H5I_object(H5T_NATIVE_DOUBLE_g))) @@ -601,40 +608,40 @@ H5T_init_inf(void) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); /* +Inf */ - d=(uint8_t *)&H5T_NATIVE_DOUBLE_POS_INF_g; - H5T_bit_set (d, dst->u.f.sign, (size_t)1, FALSE); - H5T_bit_set (d, dst->u.f.epos, dst->u.f.esize, TRUE); - H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE); + d = (uint8_t *)&H5T_NATIVE_DOUBLE_POS_INF_g; + H5T_bit_set(d, dst->u.f.sign, (size_t)1, FALSE); + H5T_bit_set(d, dst->u.f.epos, dst->u.f.esize, TRUE); + H5T_bit_set(d, dst->u.f.mpos, dst->u.f.msize, FALSE); /* Swap the bytes if the machine architecture is big-endian */ - if (H5T_ORDER_BE==H5T_native_order_g) { - half_size = dst_p->shared->size/2; - for (u=0; u<half_size; u++) { - uint8_t tmp = d[dst_p->shared->size-(u+1)]; - d[dst_p->shared->size-(u+1)] = d[u]; + if(H5T_ORDER_BE == H5T_native_order_g) { + half_size = dst_p->shared->size / 2; + for(u = 0; u < half_size; u++) { + uint8_t tmp = d[dst_p->shared->size - (u + 1)]; + d[dst_p->shared->size - (u + 1)] = d[u]; d[u] = tmp; - } - } + } /* end for */ + } /* end if */ /* -Inf */ - d=(uint8_t *)&H5T_NATIVE_DOUBLE_NEG_INF_g; - H5T_bit_set (d, dst->u.f.sign, (size_t)1, TRUE); - H5T_bit_set (d, dst->u.f.epos, dst->u.f.esize, TRUE); - H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE); + d = (uint8_t *)&H5T_NATIVE_DOUBLE_NEG_INF_g; + H5T_bit_set(d, dst->u.f.sign, (size_t)1, TRUE); + H5T_bit_set(d, dst->u.f.epos, dst->u.f.esize, TRUE); + H5T_bit_set(d, dst->u.f.mpos, dst->u.f.msize, FALSE); /* Swap the bytes if the machine architecture is big-endian */ - if (H5T_ORDER_BE==H5T_native_order_g) { - half_size = dst_p->shared->size/2; - for (u=0; u<half_size; u++) { - uint8_t tmp = d[dst_p->shared->size-(u+1)]; - d[dst_p->shared->size-(u+1)] = d[u]; + if(H5T_ORDER_BE == H5T_native_order_g) { + half_size = dst_p->shared->size / 2; + for(u = 0; u < half_size; u++) { + uint8_t tmp = d[dst_p->shared->size - (u + 1)]; + d[dst_p->shared->size - (u + 1)] = d[u]; d[u] = tmp; - } - } + } /* end for */ + } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_init_inf() */ /*------------------------------------------------------------------------- @@ -643,14 +650,11 @@ done: * Purpose: Perform hardware specific [floating-point] initialization * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol * Monday, November 24, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -659,25 +663,25 @@ H5T_init_hw(void) #ifdef H5_HAVE_GET_FPC_CSR union fpc_csr csr; /* Union to hold results of floating-point status register query */ #endif /* H5_HAVE_GET_FPC_CSR */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_hw); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_hw) #ifdef H5_HAVE_GET_FPC_CSR /* [This code is specific to SGI machines] */ /* Get the floating-point status register */ - csr.fc_word=get_fpc_csr(); + csr.fc_word = get_fpc_csr(); /* If the "flush denormalized values to zero" flag is set, unset it */ if(csr.fc_struct.flush) { - csr.fc_struct.flush=0; + csr.fc_struct.flush = 0; set_fpc_csr(csr.fc_word); } /* end if */ #endif /* H5_HAVE_GET_FPC_CSR */ - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_init_hw() */ /*-------------------------------------------------------------------------- @@ -734,7 +738,7 @@ H5T_init_interface(void) herr_t status; unsigned copied_dtype=1; /* Flag to indicate whether datatype was copied or allocated (for error cleanup) */ H5P_genclass_t *crt_pclass; /* Property list class for datatype creation properties */ - herr_t ret_value=SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5T_init_interface) @@ -747,11 +751,11 @@ H5T_init_interface(void) HDassert(H5T_NCLASSES < 16); /* Perform any necessary hardware initializations */ - if(H5T_init_hw()<0) + if(H5T_init_hw() < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") /* - * Initialize pre-defined native data types from code generated during + * Initialize pre-defined native datatypes from code generated during * the library configuration by H5detect. */ if(H5TN_init_interface()<0) @@ -788,7 +792,7 @@ H5T_init_interface(void) #endif /*------------------------------------------------------------ - * Native types + * Derived native types *------------------------------------------------------------ */ @@ -849,7 +853,7 @@ H5T_init_interface(void) H5T_INIT_TYPE(DOUBLEVAX,H5T_VAX_F64_g,COPY,native_double,SET,8) /*------------------------------------------------------------ - * Other "standard" types + * C99 types *------------------------------------------------------------ */ @@ -911,34 +915,34 @@ H5T_init_interface(void) std_u64be=dt; /* Keep type for later */ /*------------------------------------------------------------ - * Little- & Big-endian bitfields + * Native, Little- & Big-endian bitfields *------------------------------------------------------------ */ /* little-endian (order is irrelevant) 8-bit bitfield */ - H5T_INIT_TYPE(BITFIELD,H5T_STD_B8LE_g,COPY,std_u8le,NOSET,-) + H5T_INIT_TYPE(BITFIELD, H5T_STD_B8LE_g, COPY, std_u8le, NOSET, -) bitfield=dt; /* Keep type for later */ /* big-endian (order is irrelevant) 8-bit bitfield */ - H5T_INIT_TYPE(BITFIELD,H5T_STD_B8BE_g,COPY,std_u8be,NOSET,-) + H5T_INIT_TYPE(BITFIELD, H5T_STD_B8BE_g, COPY, std_u8be, NOSET, -) /* Little-endian 16-bit bitfield */ - H5T_INIT_TYPE(BITFIELD,H5T_STD_B16LE_g,COPY,std_u16le,NOSET,-) + H5T_INIT_TYPE(BITFIELD, H5T_STD_B16LE_g, COPY, std_u16le, NOSET, -) /* Big-endian 16-bit bitfield */ - H5T_INIT_TYPE(BITFIELD,H5T_STD_B16BE_g,COPY,std_u16be,NOSET,-) + H5T_INIT_TYPE(BITFIELD, H5T_STD_B16BE_g, COPY, std_u16be, NOSET, -) /* Little-endian 32-bit bitfield */ - H5T_INIT_TYPE(BITFIELD,H5T_STD_B32LE_g,COPY,std_u32le,NOSET,-) + H5T_INIT_TYPE(BITFIELD, H5T_STD_B32LE_g, COPY, std_u32le, NOSET, -) /* Big-endian 32-bit bitfield */ - H5T_INIT_TYPE(BITFIELD,H5T_STD_B32BE_g,COPY,std_u32be,NOSET,-) + H5T_INIT_TYPE(BITFIELD, H5T_STD_B32BE_g, COPY, std_u32be, NOSET, -) /* Little-endian 64-bit bitfield */ - H5T_INIT_TYPE(BITFIELD,H5T_STD_B64LE_g,COPY,std_u64le,NOSET,-) + H5T_INIT_TYPE(BITFIELD, H5T_STD_B64LE_g, COPY, std_u64le, NOSET, -) /* Big-endian 64-bit bitfield */ - H5T_INIT_TYPE(BITFIELD,H5T_STD_B64BE_g,COPY,std_u64be,NOSET,-) + H5T_INIT_TYPE(BITFIELD, H5T_STD_B64BE_g, COPY, std_u64be, NOSET, -) /*------------------------------------------------------------ * The Unix architecture for dates and times. @@ -946,25 +950,25 @@ H5T_init_interface(void) */ /* Little-endian 32-bit UNIX time_t */ - H5T_INIT_TYPE(TIME,H5T_UNIX_D32LE_g,COPY,std_u32le,NOSET,-) + H5T_INIT_TYPE(TIME, H5T_UNIX_D32LE_g, COPY, std_u32le, NOSET, -) /* Big-endian 32-bit UNIX time_t */ - H5T_INIT_TYPE(TIME,H5T_UNIX_D32BE_g,COPY,std_u32be,NOSET,-) + H5T_INIT_TYPE(TIME, H5T_UNIX_D32BE_g, COPY, std_u32be, NOSET, -) /* Little-endian 64-bit UNIX time_t */ - H5T_INIT_TYPE(TIME,H5T_UNIX_D64LE_g,COPY,std_u64le,NOSET,-) + H5T_INIT_TYPE(TIME, H5T_UNIX_D64LE_g, COPY, std_u64le, NOSET, -) /* Big-endian 64-bit UNIX time_t */ - H5T_INIT_TYPE(TIME,H5T_UNIX_D64BE_g,COPY,std_u64be,NOSET,-) + H5T_INIT_TYPE(TIME, H5T_UNIX_D64BE_g, COPY, std_u64be, NOSET, -) /* Indicate that the types that are created from here down are allocated * H5FL_ALLOC(), not copied with H5T_copy() */ - copied_dtype=0; + copied_dtype = FALSE; /* Opaque data */ - H5T_INIT_TYPE(OPAQ,H5T_NATIVE_OPAQUE_g,ALLOC,-,SET,1) + H5T_INIT_TYPE(OPAQ, H5T_NATIVE_OPAQUE_g, ALLOC, -, SET, 1) /*------------------------------------------------------------ * The `C' architecture @@ -972,7 +976,7 @@ H5T_init_interface(void) */ /* One-byte character string */ - H5T_INIT_TYPE(CSTRING,H5T_C_S1_g,ALLOC,-,SET,1) + H5T_INIT_TYPE(CSTRING, H5T_C_S1_g, ALLOC, -, SET, 1) string=dt; /* Keep type for later */ /*------------------------------------------------------------ @@ -981,19 +985,19 @@ H5T_init_interface(void) */ /* One-byte character string */ - H5T_INIT_TYPE(FORSTRING,H5T_FORTRAN_S1_g,ALLOC,-,SET,1) + H5T_INIT_TYPE(FORSTRING, H5T_FORTRAN_S1_g, ALLOC, -, SET, 1) /*------------------------------------------------------------ - * Pointer types + * Reference types *------------------------------------------------------------ */ - /* Object pointer (i.e. object header address in file) */ - H5T_INIT_TYPE(OBJREF,H5T_STD_REF_OBJ_g,ALLOC,-,SET,H5R_OBJ_REF_BUF_SIZE) + /* Object reference (i.e. object header address in file) */ + H5T_INIT_TYPE(OBJREF, H5T_STD_REF_OBJ_g, ALLOC, -, SET, H5R_OBJ_REF_BUF_SIZE) objref=dt; /* Keep type for later */ - /* Dataset Region pointer (i.e. selection inside a dataset) */ - H5T_INIT_TYPE(REGREF,H5T_STD_REF_DSETREG_g,ALLOC,-,SET,H5R_DSET_REG_REF_BUF_SIZE) + /* Dataset Region reference (i.e. selection inside a dataset) */ + H5T_INIT_TYPE(REGREF, H5T_STD_REF_DSETREG_g, ALLOC, -, SET, H5R_DSET_REG_REF_BUF_SIZE) /* * Register conversion functions beginning with the most general and @@ -1312,7 +1316,7 @@ H5T_init_interface(void) assert(H5P_CLS_DATATYPE_CREATE_g!=-1); /* Get the pointer to group creation class */ - if(NULL == (crt_pclass = H5I_object(H5P_CLS_DATATYPE_CREATE_g))) + if(NULL == (crt_pclass = (H5P_genclass_t *)H5I_object(H5P_CLS_DATATYPE_CREATE_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") /* Register datatype creation property class properties here. See similar @@ -1320,9 +1324,9 @@ H5T_init_interface(void) */ /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_DATATYPE_CREATE_g==(-1)) { + if(H5P_LST_DATATYPE_CREATE_g == (-1)) { /* Register the default datatype creation property list */ - if((H5P_LST_DATATYPE_CREATE_g = H5P_create_id(crt_pclass, FALSE))<0) + if((H5P_LST_DATATYPE_CREATE_g = H5P_create_id(crt_pclass, FALSE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") } /* end if */ @@ -1338,16 +1342,15 @@ done: H5T_close(array); /* Error cleanup */ - if(ret_value<0) { - if(dt!=NULL) { + if(ret_value < 0) { + if(dt) { /* Check if we should call H5T_close or H5FL_FREE */ if(copied_dtype) H5T_close(dt); - else - { - H5FL_FREE(H5T_shared_t, dt->shared); - H5FL_FREE(H5T_t,dt); - } + else { + (void)H5FL_FREE(H5T_shared_t, dt->shared); + (void)H5FL_FREE(H5T_t,dt); + } /* end else */ } /* end if */ } /* end if */ @@ -1358,32 +1361,30 @@ done: /*------------------------------------------------------------------------- * Function: H5T_unlock_cb * - * Purpose: Clear the immutable flag for a data type. This function is + * Purpose: Clear the immutable flag for a datatype. This function is * called when the library is closing in order to unlock all - * registered data types and thus make them free-able. + * registered datatypes and thus make them free-able. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Monday, April 27, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -H5T_unlock_cb (void *_dt, hid_t UNUSED id, void UNUSED *key) +H5T_unlock_cb(void *_dt, hid_t UNUSED id, void UNUSED *key) { H5T_t *dt = (H5T_t *)_dt; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_unlock_cb); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_unlock_cb) HDassert (dt && dt->shared); if (H5T_STATE_IMMUTABLE==dt->shared->state) dt->shared->state = H5T_STATE_RDONLY; - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5T_unlock_cb() */ /*------------------------------------------------------------------------- @@ -1400,10 +1401,6 @@ H5T_unlock_cb (void *_dt, hid_t UNUSED id, void UNUSED *key) * Programmer: Robb Matzke * Friday, November 20, 1998 * - * Modifications: - * Robb Matzke, 1998-06-11 - * Statistics are only printed for conversion functions that were - * called. *------------------------------------------------------------------------- */ int @@ -1412,7 +1409,7 @@ H5T_term_interface(void) int i, nprint=0, n=0; H5T_path_t *path = NULL; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_term_interface); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_term_interface) if (H5_interface_initialize_g) { /* Unregister all conversion functions */ @@ -1554,9 +1551,10 @@ H5T_term_interface(void) /* Mark interface as closed */ H5_interface_initialize_g = 0; n = 1; /*H5I*/ - } - FUNC_LEAVE_NOAPI(n); -} + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5T_term_interface() */ /*------------------------------------------------------------------------- @@ -1572,7 +1570,7 @@ H5T_term_interface(void) * Errors: * ARGS BADVALUE Invalid size. * DATATYPE CANTINIT Can't create type. - * DATATYPE CANTREGISTER Can't register data type atom. + * DATATYPE CANTREGISTER Can't register datatype atom. * * Programmer: Robb Matzke * Friday, December 5, 1997 @@ -1584,37 +1582,37 @@ H5T_term_interface(void) hid_t H5Tcreate(H5T_class_t type, size_t size) { - H5T_t *dt = NULL; - hid_t ret_value; + H5T_t *dt = NULL; /* New datatype constructed */ + hid_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Tcreate, FAIL); + FUNC_ENTER_API(H5Tcreate, FAIL) H5TRACE2("i", "Ttz", type, size); /* check args */ - if (size == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid size"); + if(size == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid size") /* create the type */ - if (NULL == (dt = H5T_create(type, size))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create type"); + if(NULL == (dt = H5T_create(type, size))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create type") - /* Make it an atom */ - if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type atom"); + /* Get an ID for the datatype */ + if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype ID") done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Tcreate() */ /*------------------------------------------------------------------------- * Function: H5Tcopy * - * Purpose: Copies a data type. The resulting data type is not locked. - * The data type should be closed when no longer needed by + * Purpose: Copies a datatype. The resulting datatype is not locked. + * The datatype should be closed when no longer needed by * calling H5Tclose(). * - * Return: Success: The ID of a new data type. + * Return: Success: The ID of a new datatype. * * Failure: Negative * @@ -1625,64 +1623,66 @@ done: * * Robb Matzke, 4 Jun 1998 * The returned type is always transient and unlocked. If the TYPE_ID - * argument is a dataset instead of a data type then this function - * returns a transient, modifiable data type which is a copy of the - * dataset's data type. + * argument is a dataset instead of a datatype then this function + * returns a transient, modifiable datatype which is a copy of the + * dataset's datatype. * *------------------------------------------------------------------------- */ hid_t H5Tcopy(hid_t type_id) { - H5T_t *dt = NULL; + H5T_t *dt; /* Pointer to the datatype to copy */ H5T_t *new_dt = NULL; - H5D_t *dset = NULL; - hid_t ret_value; + hid_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Tcopy, FAIL); + FUNC_ENTER_API(H5Tcopy, FAIL) H5TRACE1("i", "i", type_id); - switch (H5I_get_type (type_id)) { + switch(H5I_get_type(type_id)) { case H5I_DATATYPE: - /* The argument is a data type handle */ - if (NULL==(dt=H5I_object (type_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + /* The argument is a datatype handle */ + if(NULL == (dt = (H5T_t *)H5I_object(type_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") break; case H5I_DATASET: - /* The argument is a dataset handle */ - if (NULL==(dset=H5I_object (type_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); - if (NULL==(dt=H5D_typeof (dset))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get the dataset data type"); + { + H5D_t *dset; /* Dataset for datatype */ + + /* The argument is a dataset handle */ + if(NULL == (dset = (H5D_t *)H5I_object(type_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (dt = H5D_typeof(dset))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get the dataset datatype") + } break; default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type or dataset"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype or dataset") } /* end switch */ - /* Copy */ - if (NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT))) + /* Copy datatype */ + if(NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy"); /* Atomize result */ - if ((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type atom"); + if((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom") done: - if(ret_value<0) { - if(new_dt!=NULL) - H5T_close(new_dt); - } /* end if */ + if(ret_value < 0) + if(new_dt && H5T_close(new_dt) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to release datatype info") - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Tcopy() */ /*------------------------------------------------------------------------- * Function: H5Tclose * - * Purpose: Frees a data type and all associated memory. + * Purpose: Frees a datatype and all associated memory. * * Return: Non-negative on success/Negative on failure * @@ -1696,76 +1696,73 @@ done: herr_t H5Tclose(hid_t type_id) { - H5T_t *dt = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *dt; /* Pointer to datatype to close */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Tclose, FAIL); + FUNC_ENTER_API(H5Tclose, FAIL) H5TRACE1("e", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - if (H5T_STATE_IMMUTABLE==dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable data type"); + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_STATE_IMMUTABLE==dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") /* When the reference count reaches zero the resources are freed */ - if (H5I_dec_ref(type_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id"); + if(H5I_dec_ref(type_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Tclose() */ /*------------------------------------------------------------------------- * Function: H5Tequal * - * Purpose: Determines if two data types are equal. + * Purpose: Determines if two datatypes are equal. * * Return: Success: TRUE if equal, FALSE if unequal * * Failure: Negative * - * Errors: - * * Programmer: Robb Matzke * Wednesday, December 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t H5Tequal(hid_t type1_id, hid_t type2_id) { - const H5T_t *dt1 = NULL; - const H5T_t *dt2 = NULL; - htri_t ret_value; + const H5T_t *dt1; /* Pointer to first datatype */ + const H5T_t *dt2; /* Pointer to second datatype */ + htri_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Tequal, FAIL); + FUNC_ENTER_API(H5Tequal, FAIL) H5TRACE2("t", "ii", type1_id, type2_id); /* check args */ - if (NULL == (dt1 = H5I_object_verify(type1_id,H5I_DATATYPE)) || - NULL == (dt2 = H5I_object_verify(type2_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + if(NULL == (dt1 = (H5T_t *)H5I_object_verify(type1_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(NULL == (dt2 = (H5T_t *)H5I_object_verify(type2_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") ret_value = (0 == H5T_cmp(dt1, dt2, FALSE)) ? TRUE : FALSE; done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Tequal() */ /*------------------------------------------------------------------------- * Function: H5Tlock * * Purpose: Locks a type, making it read only and non-destructable. This - * is normally done by the library for predefined data types so + * is normally done by the library for predefined datatypes so * the application doesn't inadvertently change or delete a * predefined type. * - * Once a data type is locked it can never be unlocked unless + * Once a datatype is locked it can never be unlocked unless * the entire library is closed. * * Return: Non-negative on success/Negative on failure @@ -1776,7 +1773,7 @@ done: * Modifications: * * Robb Matzke, 1 Jun 1998 - * It is illegal to lock a named data type since we must allow named + * It is illegal to lock a named datatype since we must allow named * types to be closed (to release file resources) but locking a type * prevents that. *------------------------------------------------------------------------- @@ -1784,32 +1781,32 @@ done: herr_t H5Tlock(hid_t type_id) { - H5T_t *dt = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *dt; /* Datatype to operate on */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Tlock, FAIL); + FUNC_ENTER_API(H5Tlock, FAIL) H5TRACE1("e", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - if (H5T_STATE_NAMED==dt->shared->state || H5T_STATE_OPEN==dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to lock named data type"); + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_STATE_NAMED==dt->shared->state || H5T_STATE_OPEN==dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to lock named datatype") - if (H5T_lock (dt, TRUE)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient data type"); + if(H5T_lock(dt, TRUE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype") done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Tlock() */ /*------------------------------------------------------------------------- * Function: H5Tget_class * - * Purpose: Returns the data type class identifier for data type TYPE_ID. + * Purpose: Returns the datatype class identifier for datatype TYPE_ID. * - * Return: Success: One of the non-negative data type class + * Return: Success: One of the non-negative datatype class * constants. * * Failure: H5T_NO_CLASS (Negative) @@ -1817,29 +1814,27 @@ done: * Programmer: Robb Matzke * Monday, December 8, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ H5T_class_t H5Tget_class(hid_t type_id) { - H5T_t *dt = NULL; - H5T_class_t ret_value; /* Return value */ + H5T_t *dt; /* Pointer to datatype */ + H5T_class_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Tget_class, H5T_NO_CLASS); + FUNC_ENTER_API(H5Tget_class, H5T_NO_CLASS) H5TRACE1("Tt", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a data type"); + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype") /* Set return value */ - ret_value= H5T_get_class(dt, FALSE); + ret_value = H5T_get_class(dt, FALSE); done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Tget_class() */ /*------------------------------------------------------------------------- @@ -1908,28 +1903,28 @@ done: htri_t H5Tdetect_class(hid_t type, H5T_class_t cls) { - H5T_t *dt = NULL; + H5T_t *dt; /* Datatype to query */ htri_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Tdetect_class, FAIL); + FUNC_ENTER_API(H5Tdetect_class, FAIL) H5TRACE2("t", "iTt", type, cls); /* Check args */ - if (NULL == (dt = H5I_object_verify(type,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a data type"); - if (!(cls>H5T_NO_CLASS && cls<H5T_NCLASSES)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a data type class"); + if(NULL == (dt = (H5T_t *)H5I_object_verify(type,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype") + if(!(cls > H5T_NO_CLASS && cls < H5T_NCLASSES)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype class") /* Set return value. Consider VL string as a string for API, as a VL for * internal use. */ if(H5T_IS_VL_STRING(dt->shared)) - ret_value = (H5T_STRING==cls); + ret_value = (H5T_STRING == cls); else - ret_value=H5T_detect_class(dt,cls); + ret_value = H5T_detect_class(dt, cls); done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Tdetect_class() */ /*------------------------------------------------------------------------- @@ -2015,12 +2010,12 @@ H5Tis_variable_str(hid_t dtype_id) H5TRACE1("t", "i", dtype_id); /* Check args */ - if(NULL == (dt = H5I_object_verify(dtype_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + if(NULL == (dt = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Set return value */ if((ret_value = H5T_is_variable_str(dt)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't determine if datatype is VL-string"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't determine if datatype is VL-string") done: FUNC_LEAVE_API(ret_value); @@ -2062,28 +2057,26 @@ H5T_is_variable_str(const H5T_t *dt) * Programmer: Robb Matzke * Monday, December 8, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ size_t H5Tget_size(hid_t type_id) { - H5T_t *dt = NULL; - size_t ret_value; + H5T_t *dt; /* Datatype to query */ + size_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Tget_size, 0); + FUNC_ENTER_API(H5Tget_size, 0) H5TRACE1("z", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype"); + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") /* size */ - ret_value = H5T_get_size(dt); + ret_value = H5T_GET_SIZE(dt); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Tget_size() */ @@ -2102,51 +2095,47 @@ done: * Adjusting the size of an H5T_STRING automatically sets the * precision to 8*size. * - * All data types have a positive size. + * All datatypes have a positive size. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Moved the real work into a private function. - * *------------------------------------------------------------------------- */ herr_t H5Tset_size(hid_t type_id, size_t size) { - H5T_t *dt = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *dt; /* Datatype to modify */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Tset_size, FAIL); + FUNC_ENTER_API(H5Tset_size, FAIL) H5TRACE2("e", "iz", type_id, size); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only"); - if (size <= 0 && size!=H5T_VARIABLE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive"); - if (size == H5T_VARIABLE && dt->shared->type!=H5T_STRING) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "only strings may be variable length"); - if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); - if (H5T_REFERENCE==dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for this datatype"); - if (size==0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't adjust size to 0"); - - /* Do the work */ - if (H5T_set_size(dt, size)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for data type"); + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_STATE_TRANSIENT!=dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") + if(size <= 0 && size != H5T_VARIABLE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive") + if(size == H5T_VARIABLE && dt->shared->type != H5T_STRING) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "only strings may be variable length") + if(H5T_ENUM == dt->shared->type && dt->shared->u.enumer.nmembs > 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") + if(H5T_REFERENCE == dt->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for this datatype") + if(size == 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't adjust size to 0") + + /* Modify the datatype */ + if(H5T_set_size(dt, size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for datatype") done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Tset_size() */ /*------------------------------------------------------------------------- @@ -2155,7 +2144,7 @@ done: * Purpose: Returns the type from which TYPE is derived. In the case of * an enumeration type the return value is an integer type. * - * Return: Success: Type ID for base data type. + * Return: Success: Type ID for base datatype. * * Failure: negative * @@ -2169,27 +2158,27 @@ done: hid_t H5Tget_super(hid_t type) { - H5T_t *dt=NULL, *super=NULL; - hid_t ret_value; + H5T_t *dt; /* Datatype to query */ + H5T_t *super = NULL; /* Supertype */ + hid_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Tget_super, FAIL); + FUNC_ENTER_API(H5Tget_super, FAIL) H5TRACE1("i", "i", type); - if (NULL==(dt=H5I_object_verify(type,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - if((super=H5T_get_super(dt))==NULL) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "not a data type"); - if ((ret_value=H5I_register(H5I_DATATYPE, super, TRUE))<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register parent data type"); + if(NULL == (dt = (H5T_t *)H5I_object_verify(type,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(NULL == (super = H5T_get_super(dt))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "not a datatype") + if((ret_value = H5I_register(H5I_DATATYPE, super, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register parent datatype") done: - if(ret_value<0) { - if(super!=NULL) - H5T_close(super); - } /* end if */ + if(ret_value < 0) + if(super && H5T_close(super) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to release super datatype info") - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Tget_super() */ /*------------------------------------------------------------------------- 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 */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index aa11101..df35789 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -18,12 +18,19 @@ * to a file for the H5T interface. */ +/****************/ +/* Module Setup */ +/****************/ + #define H5T_PACKAGE /*suppress error about including H5Tpkg */ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5T_init_commit_interface +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FOprivate.h" /* File objects */ @@ -32,9 +39,48 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5Tpkg.h" /* Datatypes */ -/* Static local functions */ + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ static H5T_t *H5T_open_oid(const H5G_loc_t *loc, hid_t dxpl_id); + +/*********************/ +/* Public Variables */ +/*********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + /*-------------------------------------------------------------------------- NAME @@ -87,7 +133,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Get correct property list */ @@ -224,17 +270,17 @@ done: herr_t H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { - H5G_loc_t loc; - H5T_t *type = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5G_loc_t loc; /* Group location for location */ + H5T_t *type = NULL; /* Datatype created */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tcommit_anon, FAIL) H5TRACE4("e", "iiii", loc_id, type_id, tcpl_id, tapl_id); /* Check arguments */ - if(H5G_loc (loc_id, &loc) < 0) + if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Get correct property list */ @@ -302,8 +348,9 @@ H5T_commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id) if(H5T_is_sensible(type) <= 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "datatype is not sensible") - /* Mark datatype as being on disk now. This step changes the size of datatype as - * stored on disk. */ + /* Mark datatype as being on disk now. This step changes the size of + * datatype as stored on disk. + */ if(H5T_set_loc(type, file, H5T_LOC_DISK) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") @@ -350,8 +397,9 @@ H5T_commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id) if(H5FO_insert(type->sh_loc.file, type->sh_loc.u.loc.oh_addr, type->shared, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert datatype into list of open objects") - /* Mark datatype as being on memory now. Since this datatype may still be used in memory - * after committed to disk, change its size back as in memory. */ + /* Mark datatype as being on memory again. Since this datatype may still be + * used in memory after committed to disk, change its size back as in memory. + */ if(H5T_set_loc(type, NULL, H5T_LOC_MEMORY) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype in memory") @@ -391,14 +439,14 @@ done: htri_t H5Tcommitted(hid_t type_id) { - H5T_t *type = NULL; - htri_t ret_value; /* Return value */ + H5T_t *type; /* Datatype to query */ + htri_t ret_value; /* Return value */ FUNC_ENTER_API(H5Tcommitted, FAIL) H5TRACE1("t", "i", type_id); /* Check arguments */ - if(NULL == (type = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Set return value */ @@ -440,7 +488,6 @@ H5T_committed(const H5T_t *type) * ADJUST to the link count. * * Return: Success: New link count - * * Failure: Negative * * Programmer: Quincey Koziol @@ -484,15 +531,15 @@ done: hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) { - H5T_t *type = NULL; - H5G_loc_t loc; + H5T_t *type = NULL; /* Datatype opened in file */ + H5G_loc_t loc; /* Group location of object to open */ H5G_name_t path; /* Datatype group hier. path */ H5O_loc_t oloc; /* Datatype object location */ H5O_type_t obj_type; /* Type of object at location */ H5G_loc_t type_loc; /* Group object for datatype */ hbool_t obj_found = FALSE; /* Object at 'name' found */ hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datatype */ - hid_t ret_value = FAIL; + hid_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(H5Topen2, FAIL) H5TRACE3("i", "i*si", loc_id, name, tapl_id); @@ -530,7 +577,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a named datatype") /* Open it */ - if((type = H5T_open(&type_loc, dxpl_id)) == NULL) + if(NULL == (type = H5T_open(&type_loc, dxpl_id))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype") /* Register the type and return the ID */ @@ -580,11 +627,11 @@ H5Tget_create_plist(hid_t dtype_id) H5TRACE1("i", "i", dtype_id); /* Check arguments */ - if(NULL == (type = H5I_object_verify(dtype_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Copy the default datatype creation property list */ - if(NULL == (tcpl_plist = H5I_object(H5P_LST_DATATYPE_CREATE_g))) + if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get default creation property list") if((new_tcpl_id = H5P_copy_plist(tcpl_plist, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to copy the creation property list") @@ -598,7 +645,7 @@ H5Tget_create_plist(hid_t dtype_id) H5P_genplist_t *new_plist; /* New datatype creation property list */ /* Get property list object for new TCPL */ - if(NULL == (new_plist = H5I_object(new_tcpl_id))) + if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_tcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") /* Retrieve any object creation properties */ @@ -644,12 +691,12 @@ H5T_open(const H5G_loc_t *loc, hid_t dxpl_id) HDassert(loc); /* Check if datatype was already open */ - if((shared_fo = H5FO_opened(loc->oloc->file, loc->oloc->addr)) == NULL) { + if(NULL == (shared_fo = (H5T_shared_t *)H5FO_opened(loc->oloc->file, loc->oloc->addr))) { /* Clear any errors from H5FO_opened() */ H5E_clear_stack(NULL); /* Open the datatype object */ - if((dt = H5T_open_oid(loc, dxpl_id)) == NULL) + if(NULL == (dt = H5T_open_oid(loc, dxpl_id))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "not found") /* Add the datatype to the list of opened objects in the file */ @@ -748,16 +795,19 @@ done: static H5T_t * H5T_open_oid(const H5G_loc_t *loc, hid_t dxpl_id) { - H5T_t *dt = NULL; - H5T_t *ret_value; + H5T_t *dt = NULL; /* Datatype from the file */ + H5T_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5T_open_oid) HDassert(loc); + /* Open named datatype object in file */ if(H5O_open(loc->oloc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") - if(NULL == (dt = H5O_msg_read(loc->oloc, H5O_DTYPE_ID, NULL, dxpl_id))) + + /* Deserialize the datatype message into a datatype in memory */ + if(NULL == (dt = (H5T_t *)H5O_msg_read(loc->oloc, H5O_DTYPE_ID, NULL, dxpl_id))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header") /* Mark the type as named and open */ diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index 9dd426e..d9b5974 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -18,34 +18,77 @@ * in the H5T interface. */ +/****************/ +/* Module Setup */ +/****************/ + #define H5T_PACKAGE /*suppress error about including H5Tpkg */ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5T_init_compound_interface +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /*generic functions */ #include "H5Eprivate.h" /*error handling */ #include "H5Iprivate.h" /*ID functions */ #include "H5MMprivate.h" /*memory management */ #include "H5Tpkg.h" /*data-type functions */ -/* Static local functions */ +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ static herr_t H5T_pack(const H5T_t *dt); + +/*********************/ +/* Public Variables */ +/*********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + /*-------------------------------------------------------------------------- NAME H5T_init_compound_interface -- Initialize interface-specific information USAGE herr_t H5T_init_compound_interface() - RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - + H5T_init() currently). --------------------------------------------------------------------------*/ static herr_t H5T_init_compound_interface(void) @@ -79,24 +122,24 @@ H5T_init_compound_interface(void) size_t H5Tget_member_offset(hid_t type_id, unsigned membno) { - H5T_t *dt = NULL; - size_t ret_value; + H5T_t *dt; /* Datatype to query */ + size_t ret_value; /* Return value */ FUNC_ENTER_API(H5Tget_member_offset, 0) H5TRACE2("z", "iIu", type_id, membno); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a compound datatype") - if (membno >= dt->shared->u.compnd.nmembs) + if(membno >= dt->shared->u.compnd.nmembs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid member number") /* Value */ - ret_value = H5T_get_member_offset(dt, membno); + ret_value = H5T_GET_MEMBER_OFFSET(dt->shared, membno); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tget_member_offset() */ /*------------------------------------------------------------------------- @@ -116,25 +159,18 @@ done: * Programmer: Raymond Lu * October 8, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno) { - size_t ret_value; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_get_member_offset) - assert(dt); - assert(membno < dt->shared->u.compnd.nmembs); + HDassert(dt); + HDassert(membno < dt->shared->u.compnd.nmembs); - /* Value */ - ret_value = dt->shared->u.compnd.memb[membno].offset; - - FUNC_LEAVE_NOAPI(ret_value) -} + FUNC_LEAVE_NOAPI(dt->shared->u.compnd.memb[membno].offset) +} /* end H5T_get_member_offset() */ /*------------------------------------------------------------------------- @@ -156,21 +192,22 @@ H5T_get_member_offset(const H5T_t *dt, unsigned membno) H5T_class_t H5Tget_member_class(hid_t type_id, unsigned membno) { - H5T_t *dt = NULL; - H5T_class_t ret_value; + H5T_t *dt; /* Datatype to query */ + H5T_class_t ret_value; /* Return value */ FUNC_ENTER_API(H5Tget_member_class, H5T_NO_CLASS) H5TRACE2("Tt", "iIu", type_id, membno); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a compound datatype") - if (membno >= dt->shared->u.compnd.nmembs) + if(membno >= dt->shared->u.compnd.nmembs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5T_NO_CLASS, "invalid member number") /* Get the type's class. We have to use this function to get type class - * because of the concern of variable-length string. */ - ret_value = H5T_get_class(dt->shared->u.compnd.memb[membno].type, FALSE); + * because of the concern of variable-length string. + */ + ret_value = H5T_GET_CLASS(dt->shared->u.compnd.memb[membno].type->shared, FALSE); done: FUNC_LEAVE_API(ret_value) @@ -193,42 +230,35 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Robb Matzke, 4 Jun 1998 - * If the member type is a named type then this function returns a - * handle to the re-opened named type. - * *------------------------------------------------------------------------- */ hid_t H5Tget_member_type(hid_t type_id, unsigned membno) { - H5T_t *dt = NULL, *memb_dt = NULL; - hid_t ret_value; + H5T_t *dt; /* Datatype to query */ + H5T_t *memb_dt = NULL; /* Member datatype */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5Tget_member_type, FAIL) H5TRACE2("i", "iIu", type_id, membno); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype") - if (membno >= dt->shared->u.compnd.nmembs) + if(membno >= dt->shared->u.compnd.nmembs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number") - if ((memb_dt=H5T_get_member_type(dt, membno, H5T_COPY_REOPEN))==NULL) + if(NULL == (memb_dt = H5T_get_member_type(dt, membno, H5T_COPY_REOPEN))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to retrieve member type") - if ((ret_value = H5I_register(H5I_DATATYPE, memb_dt, TRUE)) < 0) + if((ret_value = H5I_register(H5I_DATATYPE, memb_dt, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable register datatype atom") done: - if(ret_value<0) { - if(memb_dt!=NULL) - if(H5T_close(memb_dt)<0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype") - } /* end if */ + if(ret_value < 0) + if(memb_dt && H5T_close(memb_dt) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype") FUNC_LEAVE_API(ret_value) -} +} /* end H5Tget_member_type() */ /*------------------------------------------------------------------------- @@ -246,27 +276,25 @@ done: * Programmer: Raymond Lu * October 8, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ H5T_t * H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method) { - H5T_t *ret_value = NULL; + H5T_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5T_get_member_type, NULL) - assert(dt); - assert(membno < dt->shared->u.compnd.nmembs); + HDassert(dt); + HDassert(membno < dt->shared->u.compnd.nmembs); /* Copy datatype into an atom */ - if (NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, method))) + if(NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, method))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy member datatype") done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_get_member_type() */ /*------------------------------------------------------------------------- @@ -275,31 +303,24 @@ done: * Purpose: Returns the size of the specified member. * * Return: Success: The size in bytes of the member's datatype. - * * Failure: 0 * * Programmer: Quincey Koziol * October 4, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ size_t H5T_get_member_size(const H5T_t *dt, unsigned membno) { - size_t ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_get_member_size) - assert(dt); - assert(membno < dt->shared->u.compnd.nmembs); + HDassert(dt); + HDassert(membno < dt->shared->u.compnd.nmembs); - /* Value */ - ret_value = dt->shared->u.compnd.memb[membno].type->shared->size; - FUNC_LEAVE_NOAPI(ret_value) -} + FUNC_LEAVE_NOAPI(dt->shared->u.compnd.memb[membno].type->shared->size) +} /* end H5T_get_member_size() */ /*------------------------------------------------------------------------- @@ -329,32 +350,32 @@ H5T_get_member_size(const H5T_t *dt, unsigned membno) herr_t H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id) { - H5T_t *parent = NULL; /*the compound parent datatype */ - H5T_t *member = NULL; /*the atomic member type */ - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *parent; /* The compound parent datatype */ + H5T_t *member; /* The member datatype */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tinsert, FAIL) H5TRACE4("e", "i*szi", parent_id, name, offset, member_id); /* Check args */ - if (parent_id==member_id) + if(parent_id == member_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't insert compound datatype within itself") - if (NULL == (parent = H5I_object_verify(parent_id,H5I_DATATYPE)) || H5T_COMPOUND != parent->shared->type) + if(NULL == (parent = (H5T_t *)H5I_object_verify(parent_id, H5I_DATATYPE)) || H5T_COMPOUND != parent->shared->type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype") - if (H5T_STATE_TRANSIENT!=parent->shared->state) + if(H5T_STATE_TRANSIENT != parent->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parent type read-only") - if (!name || !*name) + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no member name") - if (NULL == (member = H5I_object_verify(member_id,H5I_DATATYPE))) + if(NULL == (member = (H5T_t *)H5I_object_verify(member_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Insert */ - if (H5T_insert(parent, name, offset, member) < 0) + if(H5T_insert(parent, name, offset, member) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "unable to insert member") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tinsert() */ /*------------------------------------------------------------------------- @@ -375,23 +396,23 @@ done: herr_t H5Tpack(hid_t type_id) { - H5T_t *dt = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *dt; /* Datatype to modify */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tpack, FAIL) H5TRACE1("e", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_detect_class(dt,H5T_COMPOUND)<=0) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_detect_class(dt, H5T_COMPOUND) <= 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype") /* Pack */ - if (H5T_pack(dt) < 0) + if(H5T_pack(dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack compound datatype") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tpack() */ /*------------------------------------------------------------------------- @@ -407,17 +428,15 @@ done: * Programmer: Robb Matzke * Monday, December 8, 1997 * - * Modifications: - * Took out arrayness parameters - QAK, 10/6/00 - * *------------------------------------------------------------------------- */ herr_t H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) { - unsigned idx, i; + unsigned idx; /* Index of member to insert */ size_t total_size; - herr_t ret_value = SUCCEED; /* Return value */ + unsigned i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5T_insert, FAIL) @@ -436,10 +455,10 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) total_size = member->shared->size; for(i = 0; i < parent->shared->u.compnd.nmembs; i++) if((offset <= parent->shared->u.compnd.memb[i].offset && - offset + total_size > parent->shared->u.compnd.memb[i].offset) || + (offset + total_size) > parent->shared->u.compnd.memb[i].offset) || (parent->shared->u.compnd.memb[i].offset <= offset && - parent->shared->u.compnd.memb[i].offset + - parent->shared->u.compnd.memb[i].size > offset)) + (parent->shared->u.compnd.memb[i].offset + + parent->shared->u.compnd.memb[i].size) > offset)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member overlaps with another member") /* Does the new member overlap the end of the compound type? */ @@ -449,10 +468,10 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) /* Increase member array if necessary */ if(parent->shared->u.compnd.nmembs >= parent->shared->u.compnd.nalloc) { unsigned na = MAX(1, parent->shared->u.compnd.nalloc * 2); - H5T_cmemb_t *x = H5MM_realloc(parent->shared->u.compnd.memb, na * sizeof(H5T_cmemb_t)); + H5T_cmemb_t *x = (H5T_cmemb_t *)H5MM_realloc(parent->shared->u.compnd.memb, na * sizeof(H5T_cmemb_t)); if(!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed") parent->shared->u.compnd.nalloc = na; parent->shared->u.compnd.memb = x; } /* end if */ @@ -519,28 +538,24 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t H5T_pack(const H5T_t *dt) { - unsigned i; - size_t offset; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5T_pack) - assert(dt); + HDassert(dt); - if(H5T_detect_class(dt,H5T_COMPOUND)>0) { + if(H5T_detect_class(dt, H5T_COMPOUND) > 0) { /* If datatype has been packed, skip packing it and indicate success */ - if(H5T_is_packed(dt)== TRUE) + if(TRUE == H5T_is_packed(dt)) HGOTO_DONE(SUCCEED) /* Check for packing unmodifiable datatype */ - if (H5T_STATE_TRANSIENT!=dt->shared->state) + if(H5T_STATE_TRANSIENT != dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is read-only") if(dt->shared->parent) { @@ -548,25 +563,28 @@ H5T_pack(const H5T_t *dt) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack parent of datatype") /* Adjust size of datatype appropriately */ - if(dt->shared->type==H5T_ARRAY) + if(dt->shared->type == H5T_ARRAY) dt->shared->size = dt->shared->parent->shared->size * dt->shared->u.array.nelem; - else if(dt->shared->type!=H5T_VLEN) + else if(dt->shared->type != H5T_VLEN) dt->shared->size = dt->shared->parent->shared->size; } /* end if */ - else if(dt->shared->type==H5T_COMPOUND) { + else if(dt->shared->type == H5T_COMPOUND) { + size_t offset; /* Offset of member */ + unsigned i; /* Local index variable */ + /* Recursively pack the members */ - for (i=0; i<dt->shared->u.compnd.nmembs; i++) { - if (H5T_pack(dt->shared->u.compnd.memb[i].type) < 0) + for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { + if(H5T_pack(dt->shared->u.compnd.memb[i].type) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack part of a compound datatype") /* Update the member size */ dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].type)->shared->size; - } + } /* end for */ /* Remove padding between members */ - if(H5T_sort_value(dt, NULL)<0) + if(H5T_sort_value(dt, NULL) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOMPARE, FAIL, "value sort failed") - for (i=0, offset=0; i<dt->shared->u.compnd.nmembs; i++) { + for(i = 0, offset = 0; i < dt->shared->u.compnd.nmembs; i++) { dt->shared->u.compnd.memb[i].offset = offset; offset += dt->shared->u.compnd.memb[i].size; } @@ -575,13 +593,13 @@ H5T_pack(const H5T_t *dt) dt->shared->size = MAX(1, offset); /* Mark the type as packed now */ - dt->shared->u.compnd.packed=TRUE; + dt->shared->u.compnd.packed = TRUE; } /* end if */ } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_pack() */ /*------------------------------------------------------------------------- @@ -602,19 +620,19 @@ done: htri_t H5T_is_packed(const H5T_t *dt) { - htri_t ret_value=TRUE; /* Return value */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_is_packed) - assert(dt); + HDassert(dt); /* Go up the chain as far as possible */ while(dt->shared->parent) - dt=dt->shared->parent; + dt = dt->shared->parent; /* If this is a compound datatype, check if it is packed */ - if(dt->shared->type==H5T_COMPOUND) - ret_value=(htri_t)dt->shared->u.compnd.packed; + if(dt->shared->type == H5T_COMPOUND) + ret_value = (htri_t)dt->shared->u.compnd.packed; FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_is_packed() */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index a11f152..da787ee 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -14,11 +14,22 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Module Info: Data type conversions for the H5T interface. + * Module Info: Datatype conversions for the H5T interface. */ +/****************/ +/* Module Setup */ +/****************/ + #define H5T_PACKAGE /*suppress error about including H5Tpkg */ +/* Interface initialization */ +#define H5_INTERFACE_INIT_FUNC H5T_init_conv_interface + + +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ @@ -29,33 +40,10 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5Tpkg.h" /* Datatypes */ -/* Conversion data for H5T_conv_struct() */ -typedef struct H5T_conv_struct_t { - int *src2dst; /*mapping from src to dst member num */ - hid_t *src_memb_id; /*source member type ID's */ - hid_t *dst_memb_id; /*destination member type ID's */ - H5T_path_t **memb_path; /*conversion path for each member */ - H5T_subset_t smembs_subset; /*are source and dest members a subset of each other? */ -} H5T_conv_struct_t; -/* Conversion data for H5T_conv_enum() */ -typedef struct H5T_enum_struct_t { - int base; /*lowest `in' value */ - int length; /*num elements in arrays */ - int *src2dst; /*map from src to dst index */ -} H5T_enum_struct_t; - -/* Conversion data for the hardware conversion functions */ -typedef struct H5T_conv_hw_t { - size_t s_aligned; /*number source elements aligned */ - size_t d_aligned; /*number destination elements aligned*/ -} H5T_conv_hw_t; - -/* Declare a free list to manage pieces of vlen data */ -H5FL_BLK_DEFINE_STATIC(vlen_seq); - -/* Declare a free list to manage pieces of array data */ -H5FL_BLK_DEFINE_STATIC(array_seq); +/****************/ +/* Local Macros */ +/****************/ /* * These macros are for the bodies of functions that convert buffers of one @@ -138,17 +126,17 @@ H5FL_BLK_DEFINE_STATIC(array_seq); * CDATA: A pointer to the H5T_cdata_t structure that was passed to the * conversion function. * - * STYPE: The hid_t value for the source data type. + * STYPE: The hid_t value for the source datatype. * - * DTYPE: The hid_t value for the destination data type. + * DTYPE: The hid_t value for the destination datatype. * * BUF: A pointer to the conversion buffer. * * NELMTS: The number of values to be converted. * - * ST: The C name for source data type (e.g., int) + * ST: The C name for source datatype (e.g., int) * - * DT: The C name for the destination data type (e.g., signed char) + * DT: The C name for the destination datatype (e.g., signed char) * * D_MIN: The minimum possible destination value. For unsigned * destination types this should be zero. For signed @@ -621,7 +609,7 @@ H5FL_BLK_DEFINE_STATIC(array_seq); uint8_t *src, *s; /*source buffer */ \ uint8_t *dst, *d; /*destination buffer */ \ H5T_class_t tclass; /*datatype's class */ \ - H5T_t *st, *dt; /*data type descriptors */ \ + H5T_t *st, *dt; /*datatype descriptors */ \ ATYPE aligned; /*aligned type */ \ hbool_t s_mv, d_mv; /*move data to align it? */ \ ssize_t s_stride, d_stride; /*src and dst strides */ \ @@ -885,9 +873,90 @@ H5FL_BLK_DEFINE_STATIC(array_seq); /* Minimum size of variable-length conversion buffer */ #define H5T_VLEN_MIN_CONF_BUF_SIZE 4096 +/******************/ +/* Local Typedefs */ +/******************/ + +/* Conversion data for H5T_conv_struct() */ +typedef struct H5T_conv_struct_t { + int *src2dst; /*mapping from src to dst member num */ + hid_t *src_memb_id; /*source member type ID's */ + hid_t *dst_memb_id; /*destination member type ID's */ + H5T_path_t **memb_path; /*conversion path for each member */ + H5T_subset_t smembs_subset; /*are source and dest members a subset of each other? */ +} H5T_conv_struct_t; + +/* Conversion data for H5T_conv_enum() */ +typedef struct H5T_enum_struct_t { + int base; /*lowest `in' value */ + int length; /*num elements in arrays */ + int *src2dst; /*map from src to dst index */ +} H5T_enum_struct_t; + +/* Conversion data for the hardware conversion functions */ +typedef struct H5T_conv_hw_t { + size_t s_aligned; /*number source elements aligned */ + size_t d_aligned; /*number destination elements aligned*/ +} H5T_conv_hw_t; + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + static herr_t H5T_reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order); +/*********************/ +/* Public Variables */ +/*********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Declare a free list to manage pieces of vlen data */ +H5FL_BLK_DEFINE_STATIC(vlen_seq); + +/* Declare a free list to manage pieces of array data */ +H5FL_BLK_DEFINE_STATIC(array_seq); + + +/*-------------------------------------------------------------------------- +NAME + H5T_init_conv_interface -- Initialize interface-specific information +USAGE + herr_t H5T_init_conv_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Initializes any interface-specific data or routines. (Just calls + H5T_init() currently). +--------------------------------------------------------------------------*/ +static herr_t +H5T_init_conv_interface(void) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_conv_interface) + + FUNC_LEAVE_NOAPI(H5T_init()) +} /* H5T_init_conv_interface() */ + + /*------------------------------------------------------------------------- * Function: H5T_conv_noop * @@ -899,8 +968,6 @@ static herr_t H5T_reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order * Programmer: Robb Matzke * Wednesday, January 14, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -909,11 +976,11 @@ H5T_conv_noop(hid_t UNUSED src_id, hid_t UNUSED dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void UNUSED *buf, void UNUSED *background, hid_t UNUSED dxpl_id) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_noop, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_noop, FAIL) - switch (cdata->command) { + switch(cdata->command) { case H5T_CONV_INIT: cdata->need_bkg = H5T_BKG_NO; break; @@ -926,12 +993,12 @@ H5T_conv_noop(hid_t UNUSED src_id, hid_t UNUSED dst_id, H5T_cdata_t *cdata, break; default: - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_conv_noop() */ /*------------------------------------------------------------------------- @@ -962,377 +1029,380 @@ H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, H5T_t *src = NULL; H5T_t *dst = NULL; size_t i; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_order_opt, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_order_opt, FAIL) - switch (cdata->command) { - case H5T_CONV_INIT: - /* Capability query */ - if (NULL == (src = H5I_object(src_id)) || - NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - if (src->shared->size != dst->shared->size || - 0 != src->shared->u.atomic.offset || - 0 != dst->shared->u.atomic.offset) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); - if((src->shared->type==H5T_REFERENCE && dst->shared->type!=H5T_REFERENCE) || - (dst->shared->type==H5T_REFERENCE && src->shared->type!=H5T_REFERENCE)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); - if(src->shared->type!=H5T_REFERENCE && - !((H5T_ORDER_BE == src->shared->u.atomic.order && H5T_ORDER_LE == dst->shared->u.atomic.order) || - (H5T_ORDER_LE == src->shared->u.atomic.order && H5T_ORDER_BE == dst->shared->u.atomic.order))) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); - if (src->shared->size!=1 && src->shared->size!=2 && src->shared->size!=4 && - src->shared->size!=8 && src->shared->size!=16) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); - switch (src->shared->type) { - case H5T_INTEGER: - case H5T_BITFIELD: - case H5T_REFERENCE: - /* nothing to check */ - break; - - case H5T_FLOAT: - if (src->shared->u.atomic.u.f.sign != dst->shared->u.atomic.u.f.sign || - src->shared->u.atomic.u.f.epos != dst->shared->u.atomic.u.f.epos || - src->shared->u.atomic.u.f.esize != dst->shared->u.atomic.u.f.esize || - src->shared->u.atomic.u.f.ebias != dst->shared->u.atomic.u.f.ebias || - src->shared->u.atomic.u.f.mpos != dst->shared->u.atomic.u.f.mpos || - src->shared->u.atomic.u.f.msize != dst->shared->u.atomic.u.f.msize || - src->shared->u.atomic.u.f.norm != dst->shared->u.atomic.u.f.norm || - src->shared->u.atomic.u.f.pad != dst->shared->u.atomic.u.f.pad) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); - break; - - default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); - } - cdata->need_bkg = H5T_BKG_NO; - break; - - case H5T_CONV_CONV: - /* The conversion */ - if (NULL == (src = H5I_object(src_id)) || - NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - - /* Check for "no op" reference conversion */ - if(src->shared->type==H5T_REFERENCE) { - /* Sanity check */ - assert(dst->shared->type==H5T_REFERENCE); - - /* Check if we are on a little-endian machine (the order that - * the addresses in the file must be) and just get out now, there - * is no need to convert the object reference. Yes, this is - * icky and non-portable, but I can't think of a better way to - * support allowing the objno in the H5O_info_t struct and the - * hobj_ref_t type to be compared directly without introducing a - * "native" hobj_ref_t datatype and I think that would break a - * lot of existing programs. -QAK - */ - if(H5T_native_order_g == H5T_ORDER_LE) - break; - } /* end if */ + switch(cdata->command) { + case H5T_CONV_INIT: + /* Capability query */ + if(NULL == (src = H5I_object(src_id)) || + NULL == (dst = H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if(src->shared->size != dst->shared->size || + 0 != src->shared->u.atomic.offset || + 0 != dst->shared->u.atomic.offset) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + if((src->shared->type == H5T_REFERENCE && dst->shared->type != H5T_REFERENCE) || + (dst->shared->type == H5T_REFERENCE && src->shared->type != H5T_REFERENCE)) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + if(src->shared->type != H5T_REFERENCE && + !((H5T_ORDER_BE == src->shared->u.atomic.order && H5T_ORDER_LE == dst->shared->u.atomic.order) || + (H5T_ORDER_LE == src->shared->u.atomic.order && H5T_ORDER_BE == dst->shared->u.atomic.order))) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + if (src->shared->size != 1 && src->shared->size != 2 && src->shared->size != 4 && + src->shared->size != 8 && src->shared->size != 16) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + switch(src->shared->type) { + case H5T_INTEGER: + case H5T_BITFIELD: + case H5T_REFERENCE: + /* nothing to check */ + break; - buf_stride = buf_stride ? buf_stride : src->shared->size; - switch (src->shared->size) { - case 1: - /*no-op*/ - break; - case 2: - for (/*void*/; nelmts>=20; nelmts-=20) { - H5_SWAP_BYTES(buf, 0, 1); /* 0 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 1 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 2 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 3 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 4 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 5 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 6 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 7 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 8 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 9 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 10 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 11 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 12 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 13 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 14 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 15 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 16 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 17 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 18 */ - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 1); /* 19 */ - buf += buf_stride; - } - for (i=0; i<nelmts; i++, buf+=buf_stride) { - H5_SWAP_BYTES(buf, 0, 1); - } - break; - case 4: - for (/*void*/; nelmts>=20; nelmts-=20) { - H5_SWAP_BYTES(buf, 0, 3); /* 0 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 1 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 2 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 3 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 4 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 5 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 6 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 7 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 8 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 9 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 10 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 11 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 12 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 13 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 14 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 15 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 16 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 17 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 18 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 3); /* 19 */ - H5_SWAP_BYTES(buf, 1, 2); - buf += buf_stride; - } - for (i=0; i<nelmts; i++, buf+=buf_stride) { - H5_SWAP_BYTES(buf, 0, 3); - H5_SWAP_BYTES(buf, 1, 2); - } - break; - case 8: - for (/*void*/; nelmts>=10; nelmts-=10) { - H5_SWAP_BYTES(buf, 0, 7); /* 0 */ - H5_SWAP_BYTES(buf, 1, 6); - H5_SWAP_BYTES(buf, 2, 5); - H5_SWAP_BYTES(buf, 3, 4); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 7); /* 1 */ - H5_SWAP_BYTES(buf, 1, 6); - H5_SWAP_BYTES(buf, 2, 5); - H5_SWAP_BYTES(buf, 3, 4); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 7); /* 2 */ - H5_SWAP_BYTES(buf, 1, 6); - H5_SWAP_BYTES(buf, 2, 5); - H5_SWAP_BYTES(buf, 3, 4); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 7); /* 3 */ - H5_SWAP_BYTES(buf, 1, 6); - H5_SWAP_BYTES(buf, 2, 5); - H5_SWAP_BYTES(buf, 3, 4); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 7); /* 4 */ - H5_SWAP_BYTES(buf, 1, 6); - H5_SWAP_BYTES(buf, 2, 5); - H5_SWAP_BYTES(buf, 3, 4); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 7); /* 5 */ - H5_SWAP_BYTES(buf, 1, 6); - H5_SWAP_BYTES(buf, 2, 5); - H5_SWAP_BYTES(buf, 3, 4); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 7); /* 6 */ - H5_SWAP_BYTES(buf, 1, 6); - H5_SWAP_BYTES(buf, 2, 5); - H5_SWAP_BYTES(buf, 3, 4); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 7); /* 7 */ - H5_SWAP_BYTES(buf, 1, 6); - H5_SWAP_BYTES(buf, 2, 5); - H5_SWAP_BYTES(buf, 3, 4); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 7); /* 8 */ - H5_SWAP_BYTES(buf, 1, 6); - H5_SWAP_BYTES(buf, 2, 5); - H5_SWAP_BYTES(buf, 3, 4); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 7); /* 9 */ - H5_SWAP_BYTES(buf, 1, 6); - H5_SWAP_BYTES(buf, 2, 5); - H5_SWAP_BYTES(buf, 3, 4); - buf += buf_stride; - } - for (i=0; i<nelmts; i++, buf+=buf_stride) { - H5_SWAP_BYTES(buf, 0, 7); - H5_SWAP_BYTES(buf, 1, 6); - H5_SWAP_BYTES(buf, 2, 5); - H5_SWAP_BYTES(buf, 3, 4); + case H5T_FLOAT: + if(src->shared->u.atomic.u.f.sign != dst->shared->u.atomic.u.f.sign || + src->shared->u.atomic.u.f.epos != dst->shared->u.atomic.u.f.epos || + src->shared->u.atomic.u.f.esize != dst->shared->u.atomic.u.f.esize || + src->shared->u.atomic.u.f.ebias != dst->shared->u.atomic.u.f.ebias || + src->shared->u.atomic.u.f.mpos != dst->shared->u.atomic.u.f.mpos || + src->shared->u.atomic.u.f.msize != dst->shared->u.atomic.u.f.msize || + src->shared->u.atomic.u.f.norm != dst->shared->u.atomic.u.f.norm || + src->shared->u.atomic.u.f.pad != dst->shared->u.atomic.u.f.pad) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + break; + + default: + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") } + cdata->need_bkg = H5T_BKG_NO; break; - case 16: - for (/*void*/; nelmts>=10; nelmts-=10) { - H5_SWAP_BYTES(buf, 0, 15); /* 0 */ - H5_SWAP_BYTES(buf, 1, 14); - H5_SWAP_BYTES(buf, 2, 13); - H5_SWAP_BYTES(buf, 3, 12); - H5_SWAP_BYTES(buf, 4, 11); - H5_SWAP_BYTES(buf, 5, 10); - H5_SWAP_BYTES(buf, 6, 9); - H5_SWAP_BYTES(buf, 7, 8); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 15); /* 1 */ - H5_SWAP_BYTES(buf, 1, 14); - H5_SWAP_BYTES(buf, 2, 13); - H5_SWAP_BYTES(buf, 3, 12); - H5_SWAP_BYTES(buf, 4, 11); - H5_SWAP_BYTES(buf, 5, 10); - H5_SWAP_BYTES(buf, 6, 9); - H5_SWAP_BYTES(buf, 7, 8); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 15); /* 2 */ - H5_SWAP_BYTES(buf, 1, 14); - H5_SWAP_BYTES(buf, 2, 13); - H5_SWAP_BYTES(buf, 3, 12); - H5_SWAP_BYTES(buf, 4, 11); - H5_SWAP_BYTES(buf, 5, 10); - H5_SWAP_BYTES(buf, 6, 9); - H5_SWAP_BYTES(buf, 7, 8); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 15); /* 3 */ - H5_SWAP_BYTES(buf, 1, 14); - H5_SWAP_BYTES(buf, 2, 13); - H5_SWAP_BYTES(buf, 3, 12); - H5_SWAP_BYTES(buf, 4, 11); - H5_SWAP_BYTES(buf, 5, 10); - H5_SWAP_BYTES(buf, 6, 9); - H5_SWAP_BYTES(buf, 7, 8); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 15); /* 4 */ - H5_SWAP_BYTES(buf, 1, 14); - H5_SWAP_BYTES(buf, 2, 13); - H5_SWAP_BYTES(buf, 3, 12); - H5_SWAP_BYTES(buf, 4, 11); - H5_SWAP_BYTES(buf, 5, 10); - H5_SWAP_BYTES(buf, 6, 9); - H5_SWAP_BYTES(buf, 7, 8); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 15); /* 5 */ - H5_SWAP_BYTES(buf, 1, 14); - H5_SWAP_BYTES(buf, 2, 13); - H5_SWAP_BYTES(buf, 3, 12); - H5_SWAP_BYTES(buf, 4, 11); - H5_SWAP_BYTES(buf, 5, 10); - H5_SWAP_BYTES(buf, 6, 9); - H5_SWAP_BYTES(buf, 7, 8); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 15); /* 6 */ - H5_SWAP_BYTES(buf, 1, 14); - H5_SWAP_BYTES(buf, 2, 13); - H5_SWAP_BYTES(buf, 3, 12); - H5_SWAP_BYTES(buf, 4, 11); - H5_SWAP_BYTES(buf, 5, 10); - H5_SWAP_BYTES(buf, 6, 9); - H5_SWAP_BYTES(buf, 7, 8); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 15); /* 7 */ - H5_SWAP_BYTES(buf, 1, 14); - H5_SWAP_BYTES(buf, 2, 13); - H5_SWAP_BYTES(buf, 3, 12); - H5_SWAP_BYTES(buf, 4, 11); - H5_SWAP_BYTES(buf, 5, 10); - H5_SWAP_BYTES(buf, 6, 9); - H5_SWAP_BYTES(buf, 7, 8); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 15); /* 8 */ - H5_SWAP_BYTES(buf, 1, 14); - H5_SWAP_BYTES(buf, 2, 13); - H5_SWAP_BYTES(buf, 3, 12); - H5_SWAP_BYTES(buf, 4, 11); - H5_SWAP_BYTES(buf, 5, 10); - H5_SWAP_BYTES(buf, 6, 9); - H5_SWAP_BYTES(buf, 7, 8); - buf += buf_stride; - H5_SWAP_BYTES(buf, 0, 15); /* 9 */ - H5_SWAP_BYTES(buf, 1, 14); - H5_SWAP_BYTES(buf, 2, 13); - H5_SWAP_BYTES(buf, 3, 12); - H5_SWAP_BYTES(buf, 4, 11); - H5_SWAP_BYTES(buf, 5, 10); - H5_SWAP_BYTES(buf, 6, 9); - H5_SWAP_BYTES(buf, 7, 8); - buf += buf_stride; - } - for (i=0; i<nelmts; i++, buf+=buf_stride) { - H5_SWAP_BYTES(buf, 0, 15); - H5_SWAP_BYTES(buf, 1, 14); - H5_SWAP_BYTES(buf, 2, 13); - H5_SWAP_BYTES(buf, 3, 12); - H5_SWAP_BYTES(buf, 4, 11); - H5_SWAP_BYTES(buf, 5, 10); - H5_SWAP_BYTES(buf, 6, 9); - H5_SWAP_BYTES(buf, 7, 8); - } + + case H5T_CONV_CONV: + /* The conversion */ + if(NULL == (src = H5I_object(src_id)) || + NULL == (dst = H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + + /* Check for "no op" reference conversion */ + if(src->shared->type == H5T_REFERENCE) { + /* Sanity check */ + HDassert(dst->shared->type == H5T_REFERENCE); + + /* Check if we are on a little-endian machine (the order that + * the addresses in the file must be) and just get out now, there + * is no need to convert the object reference. Yes, this is + * icky and non-portable, but I can't think of a better way to + * support allowing the objno in the H5O_info_t struct and the + * hobj_ref_t type to be compared directly without introducing a + * "native" hobj_ref_t datatype and I think that would break a + * lot of existing programs. -QAK + */ + if(H5T_native_order_g == H5T_ORDER_LE) + break; + } /* end if */ + + buf_stride = buf_stride ? buf_stride : src->shared->size; + switch(src->shared->size) { + case 1: + /*no-op*/ + break; + + case 2: + for(/*void*/; nelmts >= 20; nelmts -= 20) { + H5_SWAP_BYTES(buf, 0, 1); /* 0 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 1 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 2 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 3 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 4 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 5 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 6 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 7 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 8 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 9 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 10 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 11 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 12 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 13 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 14 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 15 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 16 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 17 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 18 */ + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 1); /* 19 */ + buf += buf_stride; + } /* end for */ + for(i = 0; i < nelmts; i++, buf += buf_stride) + H5_SWAP_BYTES(buf, 0, 1); + break; + + case 4: + for(/*void*/; nelmts >= 20; nelmts -= 20) { + H5_SWAP_BYTES(buf, 0, 3); /* 0 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 1 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 2 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 3 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 4 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 5 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 6 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 7 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 8 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 9 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 10 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 11 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 12 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 13 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 14 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 15 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 16 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 17 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 18 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 3); /* 19 */ + H5_SWAP_BYTES(buf, 1, 2); + buf += buf_stride; + } /* end for */ + for(i = 0; i < nelmts; i++, buf += buf_stride) { + H5_SWAP_BYTES(buf, 0, 3); + H5_SWAP_BYTES(buf, 1, 2); + } /* end for */ + break; + + case 8: + for(/*void*/; nelmts >= 10; nelmts -= 10) { + H5_SWAP_BYTES(buf, 0, 7); /* 0 */ + H5_SWAP_BYTES(buf, 1, 6); + H5_SWAP_BYTES(buf, 2, 5); + H5_SWAP_BYTES(buf, 3, 4); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 7); /* 1 */ + H5_SWAP_BYTES(buf, 1, 6); + H5_SWAP_BYTES(buf, 2, 5); + H5_SWAP_BYTES(buf, 3, 4); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 7); /* 2 */ + H5_SWAP_BYTES(buf, 1, 6); + H5_SWAP_BYTES(buf, 2, 5); + H5_SWAP_BYTES(buf, 3, 4); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 7); /* 3 */ + H5_SWAP_BYTES(buf, 1, 6); + H5_SWAP_BYTES(buf, 2, 5); + H5_SWAP_BYTES(buf, 3, 4); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 7); /* 4 */ + H5_SWAP_BYTES(buf, 1, 6); + H5_SWAP_BYTES(buf, 2, 5); + H5_SWAP_BYTES(buf, 3, 4); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 7); /* 5 */ + H5_SWAP_BYTES(buf, 1, 6); + H5_SWAP_BYTES(buf, 2, 5); + H5_SWAP_BYTES(buf, 3, 4); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 7); /* 6 */ + H5_SWAP_BYTES(buf, 1, 6); + H5_SWAP_BYTES(buf, 2, 5); + H5_SWAP_BYTES(buf, 3, 4); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 7); /* 7 */ + H5_SWAP_BYTES(buf, 1, 6); + H5_SWAP_BYTES(buf, 2, 5); + H5_SWAP_BYTES(buf, 3, 4); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 7); /* 8 */ + H5_SWAP_BYTES(buf, 1, 6); + H5_SWAP_BYTES(buf, 2, 5); + H5_SWAP_BYTES(buf, 3, 4); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 7); /* 9 */ + H5_SWAP_BYTES(buf, 1, 6); + H5_SWAP_BYTES(buf, 2, 5); + H5_SWAP_BYTES(buf, 3, 4); + buf += buf_stride; + } /* end for */ + for(i = 0; i < nelmts; i++, buf += buf_stride) { + H5_SWAP_BYTES(buf, 0, 7); + H5_SWAP_BYTES(buf, 1, 6); + H5_SWAP_BYTES(buf, 2, 5); + H5_SWAP_BYTES(buf, 3, 4); + } /* end for */ + break; + + case 16: + for(/*void*/; nelmts >= 10; nelmts -= 10) { + H5_SWAP_BYTES(buf, 0, 15); /* 0 */ + H5_SWAP_BYTES(buf, 1, 14); + H5_SWAP_BYTES(buf, 2, 13); + H5_SWAP_BYTES(buf, 3, 12); + H5_SWAP_BYTES(buf, 4, 11); + H5_SWAP_BYTES(buf, 5, 10); + H5_SWAP_BYTES(buf, 6, 9); + H5_SWAP_BYTES(buf, 7, 8); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 15); /* 1 */ + H5_SWAP_BYTES(buf, 1, 14); + H5_SWAP_BYTES(buf, 2, 13); + H5_SWAP_BYTES(buf, 3, 12); + H5_SWAP_BYTES(buf, 4, 11); + H5_SWAP_BYTES(buf, 5, 10); + H5_SWAP_BYTES(buf, 6, 9); + H5_SWAP_BYTES(buf, 7, 8); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 15); /* 2 */ + H5_SWAP_BYTES(buf, 1, 14); + H5_SWAP_BYTES(buf, 2, 13); + H5_SWAP_BYTES(buf, 3, 12); + H5_SWAP_BYTES(buf, 4, 11); + H5_SWAP_BYTES(buf, 5, 10); + H5_SWAP_BYTES(buf, 6, 9); + H5_SWAP_BYTES(buf, 7, 8); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 15); /* 3 */ + H5_SWAP_BYTES(buf, 1, 14); + H5_SWAP_BYTES(buf, 2, 13); + H5_SWAP_BYTES(buf, 3, 12); + H5_SWAP_BYTES(buf, 4, 11); + H5_SWAP_BYTES(buf, 5, 10); + H5_SWAP_BYTES(buf, 6, 9); + H5_SWAP_BYTES(buf, 7, 8); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 15); /* 4 */ + H5_SWAP_BYTES(buf, 1, 14); + H5_SWAP_BYTES(buf, 2, 13); + H5_SWAP_BYTES(buf, 3, 12); + H5_SWAP_BYTES(buf, 4, 11); + H5_SWAP_BYTES(buf, 5, 10); + H5_SWAP_BYTES(buf, 6, 9); + H5_SWAP_BYTES(buf, 7, 8); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 15); /* 5 */ + H5_SWAP_BYTES(buf, 1, 14); + H5_SWAP_BYTES(buf, 2, 13); + H5_SWAP_BYTES(buf, 3, 12); + H5_SWAP_BYTES(buf, 4, 11); + H5_SWAP_BYTES(buf, 5, 10); + H5_SWAP_BYTES(buf, 6, 9); + H5_SWAP_BYTES(buf, 7, 8); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 15); /* 6 */ + H5_SWAP_BYTES(buf, 1, 14); + H5_SWAP_BYTES(buf, 2, 13); + H5_SWAP_BYTES(buf, 3, 12); + H5_SWAP_BYTES(buf, 4, 11); + H5_SWAP_BYTES(buf, 5, 10); + H5_SWAP_BYTES(buf, 6, 9); + H5_SWAP_BYTES(buf, 7, 8); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 15); /* 7 */ + H5_SWAP_BYTES(buf, 1, 14); + H5_SWAP_BYTES(buf, 2, 13); + H5_SWAP_BYTES(buf, 3, 12); + H5_SWAP_BYTES(buf, 4, 11); + H5_SWAP_BYTES(buf, 5, 10); + H5_SWAP_BYTES(buf, 6, 9); + H5_SWAP_BYTES(buf, 7, 8); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 15); /* 8 */ + H5_SWAP_BYTES(buf, 1, 14); + H5_SWAP_BYTES(buf, 2, 13); + H5_SWAP_BYTES(buf, 3, 12); + H5_SWAP_BYTES(buf, 4, 11); + H5_SWAP_BYTES(buf, 5, 10); + H5_SWAP_BYTES(buf, 6, 9); + H5_SWAP_BYTES(buf, 7, 8); + buf += buf_stride; + H5_SWAP_BYTES(buf, 0, 15); /* 9 */ + H5_SWAP_BYTES(buf, 1, 14); + H5_SWAP_BYTES(buf, 2, 13); + H5_SWAP_BYTES(buf, 3, 12); + H5_SWAP_BYTES(buf, 4, 11); + H5_SWAP_BYTES(buf, 5, 10); + H5_SWAP_BYTES(buf, 6, 9); + H5_SWAP_BYTES(buf, 7, 8); + buf += buf_stride; + } /* end for */ + for(i = 0; i < nelmts; i++, buf += buf_stride) { + H5_SWAP_BYTES(buf, 0, 15); + H5_SWAP_BYTES(buf, 1, 14); + H5_SWAP_BYTES(buf, 2, 13); + H5_SWAP_BYTES(buf, 3, 12); + H5_SWAP_BYTES(buf, 4, 11); + H5_SWAP_BYTES(buf, 5, 10); + H5_SWAP_BYTES(buf, 6, 9); + H5_SWAP_BYTES(buf, 7, 8); + } /* end for */ + break; + } /* end switch */ break; - } - break; - case H5T_CONV_FREE: - /* Free private data */ - break; + case H5T_CONV_FREE: + /* Free private data */ + break; - default: - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } + default: + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_conv_order_opt() */ /*------------------------------------------------------------------------- @@ -1368,73 +1438,72 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T_t *dst = NULL; size_t i; size_t j, md; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_order, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_order, FAIL) - switch (cdata->command) { - case H5T_CONV_INIT: - /* Capability query */ - if (NULL == (src = H5I_object(src_id)) || - NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - if (src->shared->size != dst->shared->size || 0 != src->shared->u.atomic.offset || - 0 != dst->shared->u.atomic.offset || - !((H5T_ORDER_BE == src->shared->u.atomic.order && - H5T_ORDER_LE == dst->shared->u.atomic.order) || - (H5T_ORDER_LE == src->shared->u.atomic.order && - H5T_ORDER_BE == dst->shared->u.atomic.order))) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); - switch (src->shared->type) { - case H5T_INTEGER: - case H5T_BITFIELD: - /* nothing to check */ - break; - - case H5T_FLOAT: - if (src->shared->u.atomic.u.f.sign != dst->shared->u.atomic.u.f.sign || - src->shared->u.atomic.u.f.epos != dst->shared->u.atomic.u.f.epos || - src->shared->u.atomic.u.f.esize != dst->shared->u.atomic.u.f.esize || - src->shared->u.atomic.u.f.ebias != dst->shared->u.atomic.u.f.ebias || - src->shared->u.atomic.u.f.mpos != dst->shared->u.atomic.u.f.mpos || - src->shared->u.atomic.u.f.msize != dst->shared->u.atomic.u.f.msize || - src->shared->u.atomic.u.f.norm != dst->shared->u.atomic.u.f.norm || - src->shared->u.atomic.u.f.pad != dst->shared->u.atomic.u.f.pad) { - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); - } - break; + switch(cdata->command) { + case H5T_CONV_INIT: + /* Capability query */ + if(NULL == (src = H5I_object(src_id)) || + NULL == (dst = H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if(src->shared->size != dst->shared->size || 0 != src->shared->u.atomic.offset || + 0 != dst->shared->u.atomic.offset || + !((H5T_ORDER_BE == src->shared->u.atomic.order && + H5T_ORDER_LE == dst->shared->u.atomic.order) || + (H5T_ORDER_LE == src->shared->u.atomic.order && + H5T_ORDER_BE == dst->shared->u.atomic.order))) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + switch(src->shared->type) { + case H5T_INTEGER: + case H5T_BITFIELD: + /* nothing to check */ + break; - default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); - } - cdata->need_bkg = H5T_BKG_NO; - break; - - case H5T_CONV_CONV: - /* The conversion */ - if (NULL == (src = H5I_object(src_id)) || - NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - - buf_stride = buf_stride ? buf_stride : src->shared->size; - md = src->shared->size / 2; - for (i=0; i<nelmts; i++, buf+=buf_stride) { - for (j=0; j<md; j++) - H5_SWAP_BYTES(buf, j, src->shared->size-(j+1)); - } - break; + case H5T_FLOAT: + if(src->shared->u.atomic.u.f.sign != dst->shared->u.atomic.u.f.sign || + src->shared->u.atomic.u.f.epos != dst->shared->u.atomic.u.f.epos || + src->shared->u.atomic.u.f.esize != dst->shared->u.atomic.u.f.esize || + src->shared->u.atomic.u.f.ebias != dst->shared->u.atomic.u.f.ebias || + src->shared->u.atomic.u.f.mpos != dst->shared->u.atomic.u.f.mpos || + src->shared->u.atomic.u.f.msize != dst->shared->u.atomic.u.f.msize || + src->shared->u.atomic.u.f.norm != dst->shared->u.atomic.u.f.norm || + src->shared->u.atomic.u.f.pad != dst->shared->u.atomic.u.f.pad) { + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + } /* end if */ + break; - case H5T_CONV_FREE: - /* Free private data */ - break; + default: + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + } /* end switch */ + cdata->need_bkg = H5T_BKG_NO; + break; - default: - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } + case H5T_CONV_CONV: + /* The conversion */ + if(NULL == (src = H5I_object(src_id)) || + NULL == (dst = H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + + buf_stride = buf_stride ? buf_stride : src->shared->size; + md = src->shared->size / 2; + for(i = 0; i < nelmts; i++, buf += buf_stride) + for(j = 0; j < md; j++) + H5_SWAP_BYTES(buf, j, src->shared->size - (j + 1)); + break; + + case H5T_CONV_FREE: + /* Free private data */ + break; + + default: + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_conv_order() */ /*------------------------------------------------------------------------- @@ -1461,7 +1530,7 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, void UNUSED *background, hid_t dxpl_id) { uint8_t *buf = (uint8_t*)_buf; - H5T_t *src=NULL, *dst=NULL; /*source and dest data types */ + H5T_t *src = NULL, *dst = NULL; /*source and dest data types */ int direction; /*direction of traversal */ size_t elmtno; /*element number */ size_t olap; /*num overlapping elements */ @@ -1472,25 +1541,25 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t i; uint8_t *src_rev=NULL; /*order-reversed source buffer */ H5P_genplist_t *plist; /*property list pointer */ - H5T_conv_cb_t cb_struct={NULL, NULL}; /*conversion callback structure */ + H5T_conv_cb_t cb_struct = {NULL, NULL}; /*conversion callback structure */ H5T_conv_ret_t except_ret; /*return of callback function */ hbool_t reverse; /*if reverse the order of destination */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_b_b, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_b_b, FAIL) switch(cdata->command) { case H5T_CONV_INIT: /* Capability query */ - if (NULL == (src = H5I_object(src_id)) || + if(NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - if (H5T_ORDER_LE!=src->shared->u.atomic.order && - H5T_ORDER_BE!=src->shared->u.atomic.order) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); - if (H5T_ORDER_LE!=dst->shared->u.atomic.order && - H5T_ORDER_BE!=dst->shared->u.atomic.order) - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if(H5T_ORDER_LE != src->shared->u.atomic.order && + H5T_ORDER_BE != src->shared->u.atomic.order) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + if(H5T_ORDER_LE != dst->shared->u.atomic.order && + H5T_ORDER_BE != dst->shared->u.atomic.order) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") cdata->need_bkg = H5T_BKG_NO; break; @@ -1499,29 +1568,29 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_CONV_CONV: /* Get the data types */ - if (NULL==(src=H5I_object(src_id)) || - NULL==(dst=H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + if(NULL == (src = H5I_object(src_id)) || + NULL == (dst = H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") /* * Do we process the values from beginning to end or vice versa? Also, * how many of the elements have the source and destination areas * overlapping? */ - if (src->shared->size==dst->shared->size || buf_stride) { + if(src->shared->size == dst->shared->size || buf_stride) { sp = dp = (uint8_t*)buf; direction = 1; olap = nelmts; - } else if (src->shared->size>=dst->shared->size) { - double olap_d = HDceil((double)(dst->shared->size)/ - (double)(src->shared->size-dst->shared->size)); + } else if(src->shared->size >= dst->shared->size) { + double olap_d = HDceil((double)(dst->shared->size) / + (double)(src->shared->size - dst->shared->size)); olap = (size_t)olap_d; sp = dp = (uint8_t*)buf; direction = 1; } else { - double olap_d = HDceil((double)(src->shared->size)/ - (double)(dst->shared->size-src->shared->size)); + double olap_d = HDceil((double)(src->shared->size) / + (double)(dst->shared->size - src->shared->size)); olap = (size_t)olap_d; sp = (uint8_t*)buf + (nelmts-1) * src->shared->size; dp = (uint8_t*)buf + (nelmts-1) * dst->shared->size; @@ -1529,39 +1598,39 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID"); + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID") /* Get conversion exception callback property */ - if (H5P_get(plist,H5D_XFER_CONV_CB_NAME,&cb_struct)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); + if(H5P_get(plist, H5D_XFER_CONV_CB_NAME, &cb_struct) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback") /* Allocate space for order-reversed source buffer */ - src_rev = (uint8_t*)H5MM_calloc(src->shared->size); + src_rev = (uint8_t *)H5MM_calloc(src->shared->size); /* The conversion loop */ - for (elmtno=0; elmtno<nelmts; elmtno++) { + for(elmtno = 0; elmtno < nelmts; elmtno++) { /* * If the source and destination buffers overlap then use a * temporary buffer for the destination. */ - if (direction>0) { + if(direction > 0) { s = sp; - d = elmtno<olap ? dbuf : dp; - } else { + d = elmtno < olap ? dbuf : dp; + } /* end if */ + else { s = sp; - d = elmtno+olap >= nelmts ? dbuf : dp; - } + d = (elmtno + olap) >= nelmts ? dbuf : dp; + } /* end else */ #ifndef NDEBUG /* I don't quite trust the overlap calculations yet --rpm */ - if (d==dbuf) { - assert ((dp>=sp && dp<sp+src->shared->size) || - (sp>=dp && sp<dp+dst->shared->size)); - } else { - assert ((dp<sp && dp+dst->shared->size<=sp) || - (sp<dp && sp+src->shared->size<=dp)); - } + if(d == dbuf) + HDassert((dp >= sp && dp < sp + src->shared->size) || + (sp >= dp && sp < dp + dst->shared->size)); + else + HDassert((dp < sp && dp + dst->shared->size<=sp) || + (sp < dp && sp + src->shared->size<=dp)); #endif /* @@ -1569,14 +1638,14 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * complicated. We'll do all the conversion stuff assuming * little endian and then we'll fix the order at the end. */ - if (H5T_ORDER_BE==src->shared->u.atomic.order) { - half_size = src->shared->size/2; - for (i=0; i<half_size; i++) { - uint8_t tmp = s[src->shared->size-(i+1)]; - s[src->shared->size-(i+1)] = s[i]; + if(H5T_ORDER_BE == src->shared->u.atomic.order) { + half_size = src->shared->size / 2; + for(i = 0; i < half_size; i++) { + uint8_t tmp = s[src->shared->size - (i + 1)]; + s[src->shared->size - (i + 1)] = s[i]; s[i] = tmp; - } - } + } /* end for */ + } /* end if */ /* Initiate these variables */ except_ret = H5T_CONV_UNHANDLED; @@ -1587,13 +1656,13 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * than the destination then invoke the overflow function or copy * as many bits as possible. Zero extra bits in the destination. */ - if (src->shared->u.atomic.prec>dst->shared->u.atomic.prec) { + if(src->shared->u.atomic.prec > dst->shared->u.atomic.prec) { /*overflow*/ if(cb_struct.func) { /*If user's exception handler is present, use it*/ H5T_reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, src_rev, d, cb_struct.user_data); - } + } /* end if */ if(except_ret == H5T_CONV_UNHANDLED) { H5T_bit_copy(d, dst->shared->u.atomic.offset, @@ -1614,68 +1683,71 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * Fill the destination padding areas. */ - switch (dst->shared->u.atomic.lsb_pad) { + switch(dst->shared->u.atomic.lsb_pad) { case H5T_PAD_ZERO: H5T_bit_set(d, (size_t)0, dst->shared->u.atomic.offset, FALSE); break; + case H5T_PAD_ONE: H5T_bit_set(d, (size_t)0, dst->shared->u.atomic.offset, TRUE); break; + default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported LSB padding"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported LSB padding") + } /* end switch */ msb_pad_offset = dst->shared->u.atomic.offset + dst->shared->u.atomic.prec; - switch (dst->shared->u.atomic.msb_pad) { + switch(dst->shared->u.atomic.msb_pad) { case H5T_PAD_ZERO: - H5T_bit_set(d, msb_pad_offset, 8*dst->shared->size-msb_pad_offset, - FALSE); + H5T_bit_set(d, msb_pad_offset, 8 * dst->shared->size - msb_pad_offset, FALSE); break; + case H5T_PAD_ONE: - H5T_bit_set(d, msb_pad_offset, 8*dst->shared->size-msb_pad_offset, - TRUE); + H5T_bit_set(d, msb_pad_offset, 8 * dst->shared->size - msb_pad_offset, TRUE); break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported MSB padding"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported MSB padding") + } /* end switch */ /* * Put the destination in the correct byte order. See note at * beginning of loop. */ - if (H5T_ORDER_BE==dst->shared->u.atomic.order && reverse) { - half_size = dst->shared->size/2; - for (i=0; i<half_size; i++) { - uint8_t tmp = d[dst->shared->size-(i+1)]; - d[dst->shared->size-(i+1)] = d[i]; + if(H5T_ORDER_BE == dst->shared->u.atomic.order && reverse) { + half_size = dst->shared->size / 2; + for(i = 0; i < half_size; i++) { + uint8_t tmp = d[dst->shared->size - (i + 1)]; + d[dst->shared->size - (i + 1)] = d[i]; d[i] = tmp; - } - } + } /* end for */ + } /* end if */ /* * If we had used a temporary buffer for the destination then we * should copy the value to the true destination buffer. */ - if (d==dbuf) HDmemcpy (dp, d, dst->shared->size); - if (buf_stride) { + if(d == dbuf) + HDmemcpy(dp, d, dst->shared->size); + if(buf_stride) { sp += direction * buf_stride; dp += direction * buf_stride; - } else { + } /* end if */ + else { sp += direction * src->shared->size; dp += direction * dst->shared->size; - } - } + } /* end else */ + } /* end for */ break; default: - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ done: if(src_rev) H5MM_free(src_rev); - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_conv_b_b() */ /*------------------------------------------------------------------------- @@ -1688,8 +1760,8 @@ done: * * Priv fields are indexed by source member number or * destination member number depending on whether the field - * contains information about the source data type or the - * destination data type (fields that contains the same + * contains information about the source datatype or the + * destination datatype (fields that contains the same * information for both source and destination are indexed by * source member number). The src2dst[] priv array maps source * member numbers to destination member numbers, but if the @@ -1727,7 +1799,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id) +H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id) { H5T_conv_struct_t *priv = (H5T_conv_struct_t*)(cdata->priv); int *src2dst = NULL; @@ -1737,20 +1809,20 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id) hid_t tid; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5T_conv_struct_init); + FUNC_ENTER_NOAPI_NOINIT(H5T_conv_struct_init) src_nmembs = src->shared->u.compnd.nmembs; dst_nmembs = dst->shared->u.compnd.nmembs; - if (!priv) { + if(!priv) { /* * Allocate private data structure and arrays. */ - if (NULL==(priv=cdata->priv=H5MM_calloc(sizeof(H5T_conv_struct_t))) || - NULL==(priv->src2dst=H5MM_malloc(src_nmembs * sizeof(int))) || - NULL==(priv->src_memb_id=H5MM_malloc(src_nmembs * sizeof(hid_t))) || - NULL==(priv->dst_memb_id=H5MM_malloc(dst_nmembs * sizeof(hid_t)))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + if(NULL == (priv = cdata->priv=H5MM_calloc(sizeof(H5T_conv_struct_t))) || + NULL == (priv->src2dst = H5MM_malloc(src_nmembs * sizeof(int))) || + NULL == (priv->src_memb_id = H5MM_malloc(src_nmembs * sizeof(hid_t))) || + NULL == (priv->dst_memb_id = H5MM_malloc(dst_nmembs * sizeof(hid_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") src2dst = priv->src2dst; /* The flag of special optimization to indicate if source members and destination @@ -1767,32 +1839,30 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id) * Build a mapping from source member number to destination member * number. If some source member is not a destination member then that * mapping element will be negative. Also create atoms for each - * source and destination member data type so we can look up the - * member data type conversion functions later. + * source and destination member datatype so we can look up the + * member datatype conversion functions later. */ - for (i=0; i<src_nmembs; i++) { + for(i = 0; i < src_nmembs; i++) { src2dst[i] = -1; - for (j=0; j<dst_nmembs; j++) { - if (!HDstrcmp (src->shared->u.compnd.memb[i].name, - dst->shared->u.compnd.memb[j].name)) { + for(j = 0; j < dst_nmembs; j++) { + if(!HDstrcmp(src->shared->u.compnd.memb[i].name, dst->shared->u.compnd.memb[j].name)) { src2dst[i] = j; break; - } - } - if (src2dst[i]>=0) { - type = H5T_copy (src->shared->u.compnd.memb[i].type, H5T_COPY_ALL); - tid = H5I_register (H5I_DATATYPE, type, FALSE); - assert (tid>=0); + } /* end if */ + } /* end for */ + if(src2dst[i] >= 0) { + type = H5T_copy(src->shared->u.compnd.memb[i].type, H5T_COPY_ALL); + tid = H5I_register(H5I_DATATYPE, type, FALSE); + HDassert(tid>=0); priv->src_memb_id[i] = tid; - type = H5T_copy (dst->shared->u.compnd.memb[src2dst[i]].type, - H5T_COPY_ALL); - tid = H5I_register (H5I_DATATYPE, type, FALSE); - assert (tid>=0); + type = H5T_copy(dst->shared->u.compnd.memb[src2dst[i]].type, H5T_COPY_ALL); + tid = H5I_register(H5I_DATATYPE, type, FALSE); + HDassert(tid >= 0); priv->dst_memb_id[src2dst[i]] = tid; - } - } - } + } /* end if */ + } /* end for */ + } /* end if */ else { /* Restore sorted conditions for the datatypes */ /* (Required for the src2dst array to be valid) */ @@ -1806,61 +1876,57 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id) */ src2dst = priv->src2dst; H5MM_xfree(priv->memb_path); - if (NULL==(priv->memb_path=H5MM_malloc(src->shared->u.compnd.nmembs * - sizeof(H5T_path_t*)))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + if(NULL == (priv->memb_path = H5MM_malloc(src->shared->u.compnd.nmembs * sizeof(H5T_path_t*)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - for (i=0; i<src_nmembs; i++) { - if (src2dst[i]>=0) { - H5T_path_t *tpath = H5T_path_find(src->shared->u.compnd.memb[i].type, - dst->shared->u.compnd.memb[src2dst[i]].type, NULL, NULL, dxpl_id, FALSE); + for(i = 0; i < src_nmembs; i++) { + if(src2dst[i] >= 0) { + H5T_path_t *tpath = H5T_path_find(src->shared->u.compnd.memb[i].type, dst->shared->u.compnd.memb[src2dst[i]].type, NULL, NULL, dxpl_id, FALSE); - if (NULL==(priv->memb_path[i] = tpath)) { + if(NULL == (priv->memb_path[i] = tpath)) { H5MM_xfree(priv->src2dst); H5MM_xfree(priv->src_memb_id); H5MM_xfree(priv->dst_memb_id); H5MM_xfree(priv->memb_path); cdata->priv = priv = H5MM_xfree (priv); - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert member data type"); - } - } - } + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert member datatype") + } /* end if */ + } /* end if */ + } /* end for */ /* Check if we need a background buffer */ - if (H5T_detect_class(src,H5T_COMPOUND)==TRUE || H5T_detect_class(dst,H5T_COMPOUND)==TRUE) { + if(H5T_detect_class(src, H5T_COMPOUND) == TRUE || H5T_detect_class(dst, H5T_COMPOUND) == TRUE) { cdata->need_bkg = H5T_BKG_YES; if(src_nmembs < dst_nmembs) { priv->smembs_subset = H5T_SUBSET_SRC; - for (i=0; i<src_nmembs; i++) { - /* If any of source members doesn't have counterpart in the same order or - * there's conversion between members, don't do the optimization. */ - if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != - dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == - FALSE) + for(i = 0; i < src_nmembs; i++) { + /* If any of source members doesn't have counterpart in the same + * order or there's conversion between members, don't do the + * optimization. + */ + if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) priv->smembs_subset = H5T_SUBSET_FALSE; - } + } /* end for */ } else if(dst_nmembs < src_nmembs) { priv->smembs_subset = H5T_SUBSET_DST; - for (i=0; i<dst_nmembs; i++) { + for(i = 0; i < dst_nmembs; i++) { /* If any of source members doesn't have counterpart in the same order or * there's conversion between members, don't do the optimization. */ - if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != - dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == - FALSE) + if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) priv->smembs_subset = H5T_SUBSET_FALSE; - } + } /* end for */ } else /* If the numbers of source and dest members are equal and no conversion is needed, * the case should have been handled as noop earlier in H5Dio.c. */ ; - } + } /* end if */ cdata->recalc = FALSE; done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_conv_struct_init() */ /*------------------------------------------------------------------------- @@ -1905,7 +1971,7 @@ H5T_conv_struct_subset(const H5T_cdata_t *cdata) /*------------------------------------------------------------------------- * Function: H5T_conv_struct * - * Purpose: Converts between compound data types. This is a soft + * Purpose: Converts between compound datatypes. This is a soft * conversion function. The algorithm is basically: * * For each element do @@ -1950,8 +2016,8 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, uint8_t *buf = (uint8_t *)_buf; /*cast for pointer arithmetic */ uint8_t *bkg = (uint8_t *)_bkg; /*background pointer arithmetic */ uint8_t *xbuf=buf, *xbkg=bkg; /*temp pointers into buf and bkg*/ - H5T_t *src = NULL; /*source data type */ - H5T_t *dst = NULL; /*destination data type */ + H5T_t *src = NULL; /*source datatype */ + H5T_t *dst = NULL; /*destination datatype */ int *src2dst = NULL; /*maps src member to dst member */ H5T_cmemb_t *src_memb = NULL; /*source struct member descript.*/ H5T_cmemb_t *dst_memb = NULL; /*destination struct memb desc. */ @@ -1963,7 +2029,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T_conv_struct_t *priv = (H5T_conv_struct_t *)(cdata->priv); herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_struct, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_struct, FAIL) switch (cdata->command) { case H5T_CONV_INIT: @@ -1975,7 +2041,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ if (NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); assert (H5T_COMPOUND==src->shared->type); assert (H5T_COMPOUND==dst->shared->type); @@ -2000,7 +2066,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ if (NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); assert (priv); assert (bkg && cdata->need_bkg); @@ -2052,7 +2118,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, (size_t)1, (size_t)0, (size_t)0, /*no striding (packed array)*/ xbuf + src_memb->offset, xbkg + dst_memb->offset, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member"); HDmemmove(xbuf + offset, xbuf + src_memb->offset, dst_memb->size); offset += dst_memb->size; } else { @@ -2081,7 +2147,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, (size_t)1, (size_t)0, (size_t)0, /*no striding (packed array)*/ xbuf + offset, xbkg + dst_memb->offset, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member"); } else offset -= dst_memb->size; HDmemmove(xbkg + dst_memb->offset, xbuf + offset, dst_memb->size); @@ -2116,14 +2182,14 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /*------------------------------------------------------------------------- * Function: H5T_conv_struct_opt * - * Purpose: Converts between compound data types in a manner more + * Purpose: Converts between compound datatypes in a manner more * efficient than the general-purpose H5T_conv_struct() * function. This function isn't applicable if the destination * is larger than the source type. This is a soft conversion @@ -2197,8 +2263,8 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, uint8_t *bkg = (uint8_t *)_bkg; /*background pointer arithmetic */ uint8_t *xbuf = NULL; /*temporary pointer into `buf' */ uint8_t *xbkg = NULL; /*temporary pointer into `bkg' */ - H5T_t *src = NULL; /*source data type */ - H5T_t *dst = NULL; /*destination data type */ + H5T_t *src = NULL; /*source datatype */ + H5T_t *dst = NULL; /*destination datatype */ int *src2dst = NULL; /*maps src member to dst member */ H5T_cmemb_t *src_memb = NULL; /*source struct member descript.*/ H5T_cmemb_t *dst_memb = NULL; /*destination struct memb desc. */ @@ -2211,7 +2277,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hbool_t no_stride = FALSE; /*flag to indicate no stride */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_struct_opt, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_struct_opt, FAIL) switch (cdata->command) { case H5T_CONV_INIT: @@ -2223,7 +2289,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ if (NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); assert (H5T_COMPOUND==src->shared->type); assert (H5T_COMPOUND==dst->shared->type); @@ -2290,7 +2356,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ if (NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Update cached data if necessary */ if (cdata->recalc && H5T_conv_struct_init (src, dst, cdata, dxpl_id)<0) @@ -2366,7 +2432,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, priv->src_memb_id[u], priv->dst_memb_id[src2dst[u]], nelmts, buf_stride, bkg_stride, xbuf, xbkg, dxpl_id)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member"); for (elmtno=0; elmtno<nelmts; elmtno++) { HDmemmove(xbkg, xbuf, dst_memb->size); xbuf += buf_stride; @@ -2404,7 +2470,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, buf_stride, bkg_stride, xbuf, xbkg, dxpl_id)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member"); for (elmtno=0; elmtno<nelmts; elmtno++) { HDmemmove(xbkg, xbuf, dst_memb->size); xbuf += buf_stride; @@ -2431,7 +2497,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -2462,7 +2528,7 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) unsigned i, j; /*counters */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5T_conv_enum_init); + FUNC_ENTER_NOAPI_NOINIT(H5T_conv_enum_init) cdata->need_bkg = H5T_BKG_NO; if (NULL==(priv=cdata->priv=H5MM_calloc(sizeof(*priv)))) @@ -2495,7 +2561,7 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) * value converted. However, if all of the following constraints are met * then we can build a perfect hash table and use an O(1) lookup method. * - * A: The source data type size matches one of our native data type + * A: The source datatype size matches one of our native datatype * sizes. * * B: After casting the source value bit pattern to a native type @@ -2567,7 +2633,7 @@ done: H5MM_xfree(priv); cdata->priv = NULL; } - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -2597,7 +2663,7 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, void UNUSED *bkg, hid_t UNUSED dxpl_id) { uint8_t *buf = (uint8_t*)_buf; /*cast for pointer arithmetic */ - H5T_t *src=NULL, *dst=NULL; /*src and dst data types */ + H5T_t *src=NULL, *dst=NULL; /*src and dst datatypes */ uint8_t *s=NULL, *d=NULL; /*src and dst BUF pointers */ int src_delta, dst_delta; /*conversion strides */ int n; /*src value cast as native int */ @@ -2608,7 +2674,7 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T_conv_ret_t except_ret; /*return of callback function */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_enum, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_enum, FAIL) switch (cdata->command) { case H5T_CONV_INIT: @@ -2620,7 +2686,7 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ if (NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); assert (H5T_ENUM==src->shared->type); assert (H5T_ENUM==dst->shared->type); if (H5T_conv_enum_init(src, dst, cdata)<0) @@ -2645,7 +2711,7 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_CONV_CONV: if (NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); assert (H5T_ENUM==src->shared->type); assert (H5T_ENUM==dst->shared->type); @@ -2752,14 +2818,14 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /*------------------------------------------------------------------------- * Function: H5T_conv_vlen * - * Purpose: Converts between VL data types in memory and on disk. + * Purpose: Converts between VL datatypes in memory and on disk. * This is a soft conversion function. The algorithm is * basically: * @@ -2795,8 +2861,7 @@ done: */ herr_t H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, - size_t buf_stride, size_t bkg_stride, void *buf, - void *bkg, hid_t dxpl_id) + size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dxpl_id) { H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */ H5T_vlen_alloc_info_t *vl_alloc_info=&_vl_alloc_info; /* VL allocation info */ @@ -2805,8 +2870,8 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, hbool_t write_to_file=FALSE; /* Flag to indicate writing to file */ hbool_t parent_is_vlen; /* Flag to indicate parent is vlen datatyp */ hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */ - H5T_t *src = NULL; /*source data type */ - H5T_t *dst = NULL; /*destination data type */ + H5T_t *src = NULL; /*source datatype */ + H5T_t *dst = NULL; /*destination datatype */ H5HG_t bg_hobjid, parent_hobjid; uint8_t *s; /*source buffer */ uint8_t *d; /*destination buffer */ @@ -2825,7 +2890,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t elmtno; /*element number counter */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_vlen, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_vlen, FAIL) switch (cdata->command) { case H5T_CONV_INIT: @@ -2836,11 +2901,10 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * information that remains (almost) constant for this * conversion path. */ - if (NULL == (src = H5I_object(src_id)) || - NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - assert (H5T_VLEN==src->shared->type); - assert (H5T_VLEN==dst->shared->type); + if(NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HDassert(H5T_VLEN == src->shared->type); + HDassert(H5T_VLEN == dst->shared->type); /* Variable-length types don't need a background buffer */ cdata->need_bkg = H5T_BKG_NO; @@ -2855,66 +2919,66 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * Conversion. */ - if (NULL == (src = H5I_object(src_id)) || - NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + if(NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Initialize source & destination strides */ - if (buf_stride) { - assert(buf_stride>=src->shared->size); - assert(buf_stride>=dst->shared->size); - H5_CHECK_OVERFLOW(buf_stride,size_t,ssize_t); + if(buf_stride) { + HDassert(buf_stride >= src->shared->size); + HDassert(buf_stride >= dst->shared->size); + H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t); s_stride = d_stride = (ssize_t)buf_stride; - } else { - H5_CHECK_OVERFLOW(src->shared->size,size_t,ssize_t); - H5_CHECK_OVERFLOW(dst->shared->size,size_t,ssize_t); + } /* end if */ + else { + H5_CHECK_OVERFLOW(src->shared->size, size_t, ssize_t); + H5_CHECK_OVERFLOW(dst->shared->size, size_t, ssize_t); s_stride = (ssize_t)src->shared->size; d_stride = (ssize_t)dst->shared->size; - } + } /* end else */ if(bkg) { if(bkg_stride) { - H5_CHECK_OVERFLOW(bkg_stride,size_t,ssize_t); - b_stride=(ssize_t)bkg_stride; + H5_CHECK_OVERFLOW(bkg_stride, size_t, ssize_t); + b_stride = (ssize_t)bkg_stride; } /* end if */ else - b_stride=d_stride; + b_stride = d_stride; } /* end if */ else - b_stride=0; + b_stride = 0; /* Get the size of the base types in src & dst */ - src_base_size=H5T_get_size(src->shared->parent); - dst_base_size=H5T_get_size(dst->shared->parent); + src_base_size = H5T_get_size(src->shared->parent); + dst_base_size = H5T_get_size(dst->shared->parent); /* Set up conversion path for base elements */ - if (NULL==(tpath=H5T_path_find(src->shared->parent, dst->shared->parent, NULL, NULL, dxpl_id, FALSE))) { - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes"); - } else if (!H5T_path_noop(tpath)) { - if ((tsrc_id = H5I_register(H5I_DATATYPE, H5T_copy(src->shared->parent, H5T_COPY_ALL), FALSE))<0 || - (tdst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->shared->parent, H5T_COPY_ALL), FALSE))<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion"); + if(NULL == (tpath = H5T_path_find(src->shared->parent, dst->shared->parent, NULL, NULL, dxpl_id, FALSE))) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes") + else if(!H5T_path_noop(tpath)) { + if((tsrc_id = H5I_register(H5I_DATATYPE, H5T_copy(src->shared->parent, H5T_COPY_ALL), FALSE)) < 0 || + (tdst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->shared->parent, H5T_COPY_ALL), FALSE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") } else - noop_conv=TRUE; + noop_conv = TRUE; /* Check if we need a temporary buffer for this conversion */ - parent_is_vlen=H5T_detect_class(dst->shared->parent,H5T_VLEN); + parent_is_vlen = H5T_detect_class(dst->shared->parent, H5T_VLEN); if(tpath->cdata.need_bkg || parent_is_vlen) { /* Set up initial background buffer */ - tmp_buf_size=MAX(src_base_size,dst_base_size); - if ((tmp_buf=H5FL_BLK_MALLOC(vlen_seq,tmp_buf_size))==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion"); + tmp_buf_size = MAX(src_base_size,dst_base_size); + if(NULL == (tmp_buf = H5FL_BLK_MALLOC(vlen_seq,tmp_buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") } /* end if */ /* Get the allocation info */ - if(H5T_vlen_get_alloc_info(dxpl_id,&vl_alloc_info)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info"); + if(H5T_vlen_get_alloc_info(dxpl_id,&vl_alloc_info) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info") /* Set flags to indicate we are writing to or reading from the file */ - if(dst->shared->u.vlen.f!=NULL) + if(dst->shared->u.vlen.f != NULL) write_to_file = TRUE; /* Set the flag for nested VL case */ - if(write_to_file && parent_is_vlen && bkg!=NULL) + if(write_to_file && parent_is_vlen && bkg != NULL) nested = TRUE; /* The outer loop of the type conversion macro, controlling which */ @@ -3094,14 +3158,14 @@ done: if(tmp_buf!=NULL) H5FL_BLK_FREE(vlen_seq,tmp_buf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /*------------------------------------------------------------------------- * Function: H5T_conv_array * - * Purpose: Converts between array data types in memory and on disk. + * Purpose: Converts between array datatypes in memory and on disk. * This is a soft conversion function. * * Return: Non-negative on success/Negative on failure @@ -3120,8 +3184,8 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, { H5T_path_t *tpath; /* Type conversion path */ hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */ - H5T_t *src = NULL; /*source data type */ - H5T_t *dst = NULL; /*destination data type */ + H5T_t *src = NULL; /*source datatype */ + H5T_t *dst = NULL; /*destination datatype */ uint8_t *sp, *dp; /*source and dest traversal ptrs */ size_t src_delta, dst_delta; /*source & destination stride */ int direction; /*direction of traversal */ @@ -3142,7 +3206,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * conversion path. */ if(NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") HDassert(H5T_ARRAY==src->shared->type); HDassert(H5T_ARRAY==dst->shared->type); @@ -3167,7 +3231,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * Conversion. */ if (NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* * Do we process the values from beginning to end or vice @@ -3273,12 +3337,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, - size_t buf_stride, size_t UNUSED bkg_stride, void *buf, - void UNUSED *bkg, hid_t dxpl_id) +H5T_conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, + hid_t dxpl_id) { - H5T_t *src = NULL; /*source data type */ - H5T_t *dst = NULL; /*destination data type */ + H5T_t *src = NULL; /*source datatype */ + H5T_t *dst = NULL; /*destination datatype */ int direction; /*direction of traversal */ size_t elmtno; /*element number */ size_t half_size; /*half the type size */ @@ -3295,13 +3359,13 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, hbool_t reverse; /*if reverse the order of destination */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_i_i, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_i_i, FAIL) switch (cdata->command) { case H5T_CONV_INIT: if (NULL==(src=H5I_object(src_id)) || NULL==(dst=H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_ORDER_LE!=src->shared->u.atomic.order && H5T_ORDER_BE!=src->shared->u.atomic.order) HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); @@ -3317,10 +3381,10 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; case H5T_CONV_CONV: - /* Get the data types */ + /* Get the datatypes */ if (NULL==(src=H5I_object(src_id)) || NULL==(dst=H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* * Do we process the values from beginning to end or vice versa? Also, @@ -3648,7 +3712,7 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, done: if(src_rev) H5MM_free(src_rev); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -3689,8 +3753,8 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, hid_t dxpl_id) { /* Traversal-related variables */ - H5T_t *src_p; /*source data type */ - H5T_t *dst_p; /*destination data type */ + H5T_t *src_p; /*source datatype */ + H5T_t *dst_p; /*destination datatype */ H5T_atomic_t src; /*atomic source info */ H5T_atomic_t dst; /*atomic destination info */ int direction; /*forward or backward traversal */ @@ -3721,13 +3785,13 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, hbool_t reverse; /*if reverse the order of destination */ herr_t ret_value=SUCCEED; /*return value */ - FUNC_ENTER_NOAPI(H5T_conv_f_f, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_f_f, FAIL) switch (cdata->command) { case H5T_CONV_INIT: if (NULL==(src_p=H5I_object(src_id)) || NULL==(dst_p=H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; if (H5T_ORDER_LE!=src.order && H5T_ORDER_BE!=src.order && H5T_ORDER_VAX!=src.order) @@ -3745,10 +3809,10 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; case H5T_CONV_CONV: - /* Get the data types */ + /* Get the datatypes */ if (NULL==(src_p=H5I_object(src_id)) || NULL==(dst_p=H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; expo_max = ((hssize_t)1 << dst.u.f.esize) - 1; @@ -4227,7 +4291,7 @@ done: if(src_rev) H5MM_free(src_rev); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4250,12 +4314,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, +H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { - H5T_t *src=NULL; /*source data type */ - H5T_t *dst=NULL; /*destination data type */ + H5T_t *src=NULL; /*source datatype */ + H5T_t *dst=NULL; /*destination datatype */ int direction; /*direction of traversal */ size_t elmtno; /*element number */ size_t olap; /*num overlapping elements */ @@ -4264,13 +4328,13 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, uint8_t *dbuf=NULL; /*temp buf for overlap convers. */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_s_s, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_s_s, FAIL) switch (cdata->command) { case H5T_CONV_INIT: if (NULL==(src=H5I_object(src_id)) || NULL==(dst=H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (8*src->shared->size != src->shared->u.atomic.prec || 8*dst->shared->size != dst->shared->u.atomic.prec) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad precision"); if (0 != src->shared->u.atomic.offset || 0 != dst->shared->u.atomic.offset) @@ -4289,10 +4353,10 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; case H5T_CONV_CONV: - /* Get the data types */ + /* Get the datatypes */ if (NULL==(src=H5I_object(src_id)) || NULL==(dst=H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* * Do we process the values from beginning to end or vice versa? Also, @@ -4454,7 +4518,7 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, done: H5MM_xfree(dbuf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4482,12 +4546,12 @@ H5T_conv_schar_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_uchar, FAIL) H5T_CONV_su(SCHAR, UCHAR, signed char, unsigned char, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4515,12 +4579,12 @@ H5T_conv_uchar_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_schar, FAIL) H5T_CONV_us(UCHAR, SCHAR, unsigned char, signed char, -, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4548,12 +4612,12 @@ H5T_conv_schar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_short, FAIL) H5T_CONV_sS(SCHAR, SHORT, signed char, short, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4581,12 +4645,12 @@ H5T_conv_schar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_ushort, FAIL) H5T_CONV_sU(SCHAR, USHORT, signed char, unsigned short, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4614,12 +4678,12 @@ H5T_conv_uchar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_short, FAIL) H5T_CONV_uS(UCHAR, SHORT, unsigned char, short, -, SHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4647,12 +4711,12 @@ H5T_conv_uchar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_ushort, FAIL) H5T_CONV_uU(UCHAR, USHORT, unsigned char, unsigned short, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4679,12 +4743,12 @@ H5T_conv_schar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_int, FAIL) H5T_CONV_sS(SCHAR, INT, signed char, int, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4711,12 +4775,12 @@ H5T_conv_schar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_uint, FAIL) H5T_CONV_sU(SCHAR, UINT, signed char, unsigned, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4743,12 +4807,12 @@ H5T_conv_uchar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_int, FAIL) H5T_CONV_uS(UCHAR, INT, unsigned char, int, -, INT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4775,12 +4839,12 @@ H5T_conv_uchar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_uint, FAIL) H5T_CONV_uU(UCHAR, UINT, unsigned char, unsigned, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4807,12 +4871,12 @@ H5T_conv_schar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_long, FAIL) H5T_CONV_sS(SCHAR, LONG, signed char, long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4840,12 +4904,12 @@ H5T_conv_schar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_ulong, FAIL) H5T_CONV_sU(SCHAR, ULONG, signed char, unsigned long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4872,12 +4936,12 @@ H5T_conv_uchar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_long, FAIL) H5T_CONV_uS(UCHAR, LONG, unsigned char, long, -, LONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4905,12 +4969,12 @@ H5T_conv_uchar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_ulong, FAIL) H5T_CONV_uU(UCHAR, ULONG, unsigned char, unsigned long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4938,12 +5002,12 @@ H5T_conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_llong, FAIL) H5T_CONV_sS(SCHAR, LLONG, signed char, long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -4971,12 +5035,12 @@ H5T_conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_ullong, FAIL) H5T_CONV_sU(SCHAR, ULLONG, signed char, unsigned long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5004,12 +5068,12 @@ H5T_conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_llong, FAIL) H5T_CONV_uS(UCHAR, LLONG, unsigned char, long_long, -, LLONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5037,12 +5101,12 @@ H5T_conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_ullong, FAIL) H5T_CONV_uU(UCHAR, ULLONG, unsigned char, unsigned long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5070,12 +5134,12 @@ H5T_conv_short_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_schar, FAIL) H5T_CONV_Ss(SHORT, SCHAR, short, signed char, SCHAR_MIN, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5103,12 +5167,12 @@ H5T_conv_short_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_uchar, FAIL) H5T_CONV_Su(SHORT, UCHAR, short, unsigned char, -, UCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5136,12 +5200,12 @@ H5T_conv_ushort_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_schar, FAIL) H5T_CONV_Us(USHORT, SCHAR, unsigned short, signed char, -, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5169,12 +5233,12 @@ H5T_conv_ushort_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_uchar, FAIL) H5T_CONV_Uu(USHORT, UCHAR, unsigned short, unsigned char, -, UCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5202,12 +5266,12 @@ H5T_conv_short_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_ushort, FAIL) H5T_CONV_su(SHORT, USHORT, short, unsigned short, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5235,12 +5299,12 @@ H5T_conv_ushort_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_short, FAIL) H5T_CONV_us(USHORT, SHORT, unsigned short, short, -, SHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5268,12 +5332,12 @@ H5T_conv_short_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_int, FAIL) H5T_CONV_sS(SHORT, INT, short, int, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5301,12 +5365,12 @@ H5T_conv_short_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_uint, FAIL) H5T_CONV_sU(SHORT, UINT, short, unsigned, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5334,12 +5398,12 @@ H5T_conv_ushort_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_int, FAIL) H5T_CONV_uS(USHORT, INT, unsigned short, int, -, INT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5367,12 +5431,12 @@ H5T_conv_ushort_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_uint, FAIL) H5T_CONV_uU(USHORT, UINT, unsigned short, unsigned, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5400,12 +5464,12 @@ H5T_conv_short_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_long, FAIL) H5T_CONV_sS(SHORT, LONG, short, long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5433,12 +5497,12 @@ H5T_conv_short_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_ulong, FAIL) H5T_CONV_sU(SHORT, ULONG, short, unsigned long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5466,12 +5530,12 @@ H5T_conv_ushort_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_long, FAIL) H5T_CONV_uS(USHORT, LONG, unsigned short, long, -, LONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5499,12 +5563,12 @@ H5T_conv_ushort_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_ulong, FAIL) H5T_CONV_uU(USHORT, ULONG, unsigned short, unsigned long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5532,12 +5596,12 @@ H5T_conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_llong, FAIL) H5T_CONV_sS(SHORT, LLONG, short, long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5565,12 +5629,12 @@ H5T_conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_ullong, FAIL) H5T_CONV_sU(SHORT, ULLONG, short, unsigned long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5598,12 +5662,12 @@ H5T_conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_llong, FAIL) H5T_CONV_uS(USHORT, LLONG, unsigned short, long_long, -, LLONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5631,12 +5695,12 @@ H5T_conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_ullong, FAIL) H5T_CONV_uU(USHORT, ULLONG, unsigned short, unsigned long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5664,12 +5728,12 @@ H5T_conv_int_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_schar, FAIL) H5T_CONV_Ss(INT, SCHAR, int, signed char, SCHAR_MIN, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5697,12 +5761,12 @@ H5T_conv_int_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_uchar, FAIL) H5T_CONV_Su(INT, UCHAR, int, unsigned char, -, UCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5730,12 +5794,12 @@ H5T_conv_uint_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_schar, FAIL) H5T_CONV_Us(UINT, SCHAR, unsigned, signed char, -, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5763,12 +5827,12 @@ H5T_conv_uint_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_uchar, FAIL) H5T_CONV_Uu(UINT, UCHAR, unsigned, unsigned char, -, UCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5796,12 +5860,12 @@ H5T_conv_int_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_short, FAIL) H5T_CONV_Ss(INT, SHORT, int, short, SHRT_MIN, SHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5829,12 +5893,12 @@ H5T_conv_int_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_ushort, FAIL) H5T_CONV_Su(INT, USHORT, int, unsigned short, -, USHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5862,12 +5926,12 @@ H5T_conv_uint_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_short, FAIL) H5T_CONV_Us(UINT, SHORT, unsigned, short, -, SHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5895,12 +5959,12 @@ H5T_conv_uint_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_ushort, FAIL) H5T_CONV_Uu(UINT, USHORT, unsigned, unsigned short, -, USHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5927,12 +5991,12 @@ H5T_conv_int_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_uint, FAIL) H5T_CONV_su(INT, UINT, int, unsigned, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5959,12 +6023,12 @@ H5T_conv_uint_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_int, FAIL) H5T_CONV_us(UINT, INT, unsigned, int, -, INT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -5991,12 +6055,12 @@ H5T_conv_int_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_long, FAIL) H5T_CONV_sS(INT, LONG, int, long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6023,12 +6087,12 @@ H5T_conv_int_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_ulong, FAIL) H5T_CONV_sU(INT, LONG, int, unsigned long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6055,12 +6119,12 @@ H5T_conv_uint_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_long, FAIL) H5T_CONV_uS(UINT, LONG, unsigned, long, -, LONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6087,12 +6151,12 @@ H5T_conv_uint_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_ulong, FAIL) H5T_CONV_uU(UINT, ULONG, unsigned, unsigned long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6119,12 +6183,12 @@ H5T_conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_llong, FAIL) H5T_CONV_sS(INT, LLONG, int, long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6151,12 +6215,12 @@ H5T_conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_ullong, FAIL) H5T_CONV_sU(INT, ULLONG, int, unsigned long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6183,12 +6247,12 @@ H5T_conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_llong, FAIL) H5T_CONV_uS(UINT, LLONG, unsigned, long_long, -, LLONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6216,12 +6280,12 @@ H5T_conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_ullong, FAIL) H5T_CONV_uU(UINT, ULLONG, unsigned, unsigned long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6248,12 +6312,12 @@ H5T_conv_long_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_schar, FAIL) H5T_CONV_Ss(LONG, SCHAR, long, signed char, SCHAR_MIN, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6280,12 +6344,12 @@ H5T_conv_long_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_uchar, FAIL) H5T_CONV_Su(LONG, UCHAR, long, unsigned char, -, UCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6313,12 +6377,12 @@ H5T_conv_ulong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_schar, FAIL) H5T_CONV_Us(ULONG, SCHAR, unsigned long, signed char, -, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6346,12 +6410,12 @@ H5T_conv_ulong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_uchar, FAIL) H5T_CONV_Uu(ULONG, UCHAR, unsigned long, unsigned char, -, UCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6378,12 +6442,12 @@ H5T_conv_long_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_short, FAIL) H5T_CONV_Ss(LONG, SHORT, long, short, SHRT_MIN, SHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6411,12 +6475,12 @@ H5T_conv_long_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_ushort, FAIL) H5T_CONV_Su(LONG, USHORT, long, unsigned short, -, USHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6443,12 +6507,12 @@ H5T_conv_ulong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_short, FAIL) H5T_CONV_Us(ULONG, SHORT, unsigned long, short, -, SHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6476,12 +6540,12 @@ H5T_conv_ulong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_ushort, FAIL) H5T_CONV_Uu(ULONG, USHORT, unsigned long, unsigned short, -, USHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6508,12 +6572,12 @@ H5T_conv_long_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_int, FAIL) H5T_CONV_Ss(LONG, INT, long, int, INT_MIN, INT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6540,12 +6604,12 @@ H5T_conv_long_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_uint, FAIL) H5T_CONV_Su(LONG, UINT, long, unsigned, -, UINT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6572,12 +6636,12 @@ H5T_conv_ulong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_int, FAIL) H5T_CONV_Us(ULONG, INT, unsigned long, int, -, INT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6604,12 +6668,12 @@ H5T_conv_ulong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_uint, FAIL) H5T_CONV_Uu(ULONG, UINT, unsigned long, unsigned, -, UINT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6636,12 +6700,12 @@ H5T_conv_long_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_ulong, FAIL) H5T_CONV_su(LONG, ULONG, long, unsigned long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6668,12 +6732,12 @@ H5T_conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_long, FAIL) H5T_CONV_us(ULONG, LONG, unsigned long, long, -, LONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6700,12 +6764,12 @@ H5T_conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_llong, FAIL) H5T_CONV_sS(LONG, LLONG, long, long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6733,12 +6797,12 @@ H5T_conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_ullong, FAIL) H5T_CONV_sU(LONG, ULLONG, long, unsigned long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6766,12 +6830,12 @@ H5T_conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_llong, FAIL) H5T_CONV_uS(ULONG, LLONG, unsigned long, long_long, -, LLONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6799,12 +6863,12 @@ H5T_conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_ullong, FAIL) H5T_CONV_uU(ULONG, ULLONG, unsigned long, unsigned long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6832,12 +6896,12 @@ H5T_conv_llong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_schar, FAIL) H5T_CONV_Ss(LLONG, SCHAR, long_long, signed char, SCHAR_MIN, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6865,12 +6929,12 @@ H5T_conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_uchar, FAIL) H5T_CONV_Su(LLONG, UCHAR, long_long, unsigned char, -, UCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6898,12 +6962,12 @@ H5T_conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_schar, FAIL) H5T_CONV_Us(ULLONG, SCHAR, unsigned long_long, signed char, -, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6931,12 +6995,12 @@ H5T_conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_uchar, FAIL) H5T_CONV_Uu(ULLONG, UCHAR, unsigned long_long, unsigned char, -, UCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6964,12 +7028,12 @@ H5T_conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_short, FAIL) H5T_CONV_Ss(LLONG, SHORT, long_long, short, SHRT_MIN, SHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -6997,12 +7061,12 @@ H5T_conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_ushort, FAIL) H5T_CONV_Su(LLONG, USHORT, long_long, unsigned short, -, USHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7030,12 +7094,12 @@ H5T_conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_short, FAIL) H5T_CONV_Us(ULLONG, SHORT, unsigned long_long, short, -, SHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7063,12 +7127,12 @@ H5T_conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_ushort, FAIL) H5T_CONV_Uu(ULLONG, USHORT, unsigned long_long, unsigned short, -, USHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7095,12 +7159,12 @@ H5T_conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_int, FAIL) H5T_CONV_Ss(LLONG, INT, long_long, int, INT_MIN, INT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7127,12 +7191,12 @@ H5T_conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_uint, FAIL) H5T_CONV_Su(LLONG, UINT, long_long, unsigned, -, UINT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7159,12 +7223,12 @@ H5T_conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_int, FAIL) H5T_CONV_Us(ULLONG, INT, unsigned long_long, int, -, INT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7192,12 +7256,12 @@ H5T_conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_uint, FAIL) H5T_CONV_Uu(ULLONG, UINT, unsigned long_long, unsigned, -, UINT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7224,12 +7288,12 @@ H5T_conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_long, FAIL) H5T_CONV_Ss(LLONG, LONG, long_long, long, LONG_MIN, LONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7257,12 +7321,12 @@ H5T_conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_ulong, FAIL) H5T_CONV_Su(LLONG, ULONG, long_long, unsigned long, -, ULONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7290,12 +7354,12 @@ H5T_conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_long, FAIL) H5T_CONV_Us(ULLONG, LONG, unsigned long_long, long, -, LONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7323,12 +7387,12 @@ H5T_conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_ulong, FAIL) H5T_CONV_Uu(ULLONG, ULONG, unsigned long_long, unsigned long, -, ULONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7356,12 +7420,12 @@ H5T_conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_ullong, FAIL) H5T_CONV_su(LLONG, ULLONG, long_long, unsigned long_long, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7389,12 +7453,12 @@ H5T_conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_llong, FAIL) H5T_CONV_us(ULLONG, LLONG, unsigned long_long, long_long, -, LLONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7426,12 +7490,12 @@ H5T_conv_float_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_double, FAIL) H5T_CONV_fF(FLOAT, DOUBLE, float, double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_FP_FP */ @@ -7460,12 +7524,12 @@ H5T_conv_float_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_ldouble, FAIL) H5T_CONV_fF(FLOAT, LDOUBLE, float, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_FP_LDOUBLE*/ @@ -7501,12 +7565,12 @@ H5T_conv_double_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_float, FAIL) H5T_CONV_Ff(DOUBLE, FLOAT, double, float, -FLT_MAX, FLT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_FP_FP*/ @@ -7535,13 +7599,13 @@ H5T_conv_double_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_ldouble, FAIL) H5T_CONV_fF(DOUBLE, LDOUBLE, double, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_FP_LDOUBLE*/ @@ -7570,12 +7634,12 @@ H5T_conv_ldouble_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_float, FAIL) H5T_CONV_Ff(LDOUBLE, FLOAT, long double, float, -FLT_MAX, FLT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_FP_LDOUBLE */ @@ -7604,12 +7668,12 @@ H5T_conv_ldouble_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_double, FAIL) H5T_CONV_Ff(LDOUBLE, DOUBLE, long double, double, -DBL_MAX, DBL_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_FP_LDOUBLE*/ @@ -7637,12 +7701,12 @@ H5T_conv_schar_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_float, FAIL) H5T_CONV_xF(SCHAR, FLOAT, signed char, float, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7669,12 +7733,12 @@ H5T_conv_schar_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_double, FAIL) H5T_CONV_xF(SCHAR, DOUBLE, signed char, double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7702,12 +7766,12 @@ H5T_conv_schar_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_schar_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_schar_ldouble, FAIL) H5T_CONV_xF(SCHAR, LDOUBLE, signed char, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_INTEGER_LDOUBLE */ @@ -7735,12 +7799,12 @@ H5T_conv_uchar_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_float, FAIL) H5T_CONV_xF(UCHAR, FLOAT, unsigned char, float, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7767,12 +7831,12 @@ H5T_conv_uchar_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_double, FAIL) H5T_CONV_xF(UCHAR, DOUBLE, unsigned char, double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7800,12 +7864,12 @@ H5T_conv_uchar_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uchar_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uchar_ldouble, FAIL) H5T_CONV_xF(UCHAR, LDOUBLE, unsigned char, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_INTEGER_LDOUBLE */ @@ -7833,12 +7897,12 @@ H5T_conv_short_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_float, FAIL) H5T_CONV_xF(SHORT, FLOAT, short, float, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7865,12 +7929,12 @@ H5T_conv_short_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_double, FAIL) H5T_CONV_xF(SHORT, DOUBLE, short, double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7898,12 +7962,12 @@ H5T_conv_short_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_short_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_short_ldouble, FAIL) H5T_CONV_xF(SHORT, LDOUBLE, short, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_INTEGER_LDOUBLE */ @@ -7931,12 +7995,12 @@ H5T_conv_ushort_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_float, FAIL) H5T_CONV_xF(USHORT, FLOAT, unsigned short, float, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7963,12 +8027,12 @@ H5T_conv_ushort_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_double, FAIL) H5T_CONV_xF(USHORT, DOUBLE, unsigned short, double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -7996,12 +8060,12 @@ H5T_conv_ushort_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ushort_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ushort_ldouble, FAIL) H5T_CONV_xF(USHORT, LDOUBLE, unsigned short, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_INTEGER_LDOUBLE */ @@ -8029,12 +8093,12 @@ H5T_conv_int_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_float, FAIL) H5T_CONV_xF(INT, FLOAT, int, float, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8061,12 +8125,12 @@ H5T_conv_int_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_double, FAIL) H5T_CONV_xF(INT, DOUBLE, int, double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8094,12 +8158,12 @@ H5T_conv_int_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_int_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_int_ldouble, FAIL) H5T_CONV_xF(INT, LDOUBLE, int, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_INTEGER_LDOUBLE */ @@ -8127,12 +8191,12 @@ H5T_conv_uint_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_float, FAIL) H5T_CONV_xF(UINT, FLOAT, unsigned int, float, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8159,12 +8223,12 @@ H5T_conv_uint_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_double, FAIL) H5T_CONV_xF(UINT, DOUBLE, unsigned int, double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8192,12 +8256,12 @@ H5T_conv_uint_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_uint_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_uint_ldouble, FAIL) H5T_CONV_xF(UINT, LDOUBLE, unsigned int, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_INTEGER_LDOUBLE */ @@ -8225,12 +8289,12 @@ H5T_conv_long_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_float, FAIL) H5T_CONV_xF(LONG, FLOAT, long, float, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8257,12 +8321,12 @@ H5T_conv_long_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_double, FAIL) H5T_CONV_xF(LONG, DOUBLE, long, double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8290,12 +8354,12 @@ H5T_conv_long_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_long_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_long_ldouble, FAIL) H5T_CONV_xF(LONG, LDOUBLE, long, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_INTEGER_LDOUBLE */ @@ -8324,12 +8388,12 @@ H5T_conv_ulong_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_float, FAIL) H5T_CONV_xF(ULONG, FLOAT, unsigned long, float, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_ULONG_FP */ @@ -8358,12 +8422,12 @@ H5T_conv_ulong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_double, FAIL) H5T_CONV_xF(ULONG, DOUBLE, unsigned long, double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_ULONG_FP */ @@ -8392,12 +8456,12 @@ H5T_conv_ulong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ulong_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ulong_ldouble, FAIL) H5T_CONV_xF(ULONG, LDOUBLE, unsigned long, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_ULONG_LDOUBLE */ @@ -8425,12 +8489,12 @@ H5T_conv_llong_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_float, FAIL) H5T_CONV_xF(LLONG, FLOAT, long_long, float, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8457,12 +8521,12 @@ H5T_conv_llong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_double, FAIL) H5T_CONV_xF(LLONG, DOUBLE, long_long, double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8490,12 +8554,12 @@ H5T_conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_llong_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_llong_ldouble, FAIL) H5T_CONV_xF(LLONG, LDOUBLE, long_long, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ @@ -8524,12 +8588,12 @@ H5T_conv_ullong_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_float, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_float, FAIL) H5T_CONV_xF(ULLONG, FLOAT, unsigned long_long, float, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_ULLONG_FP*/ @@ -8558,12 +8622,12 @@ H5T_conv_ullong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_double, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_double, FAIL) H5T_CONV_xF(ULLONG, DOUBLE, unsigned long_long, double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_ULLONG_FP*/ @@ -8592,12 +8656,12 @@ H5T_conv_ullong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ullong_ldouble, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ullong_ldouble, FAIL) H5T_CONV_xF(ULLONG, LDOUBLE, unsigned long_long, long double, -, -); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_ULLONG_LDOUBLE*/ @@ -8625,12 +8689,12 @@ H5T_conv_float_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_schar, FAIL) H5T_CONV_Fx(FLOAT, SCHAR, float, signed char, SCHAR_MIN, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8657,12 +8721,12 @@ H5T_conv_float_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_uchar, FAIL) H5T_CONV_Fx(FLOAT, UCHAR, float, unsigned char, 0, UCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8689,12 +8753,12 @@ H5T_conv_double_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_schar, FAIL) H5T_CONV_Fx(DOUBLE, SCHAR, double, signed char, SCHAR_MIN, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8721,12 +8785,12 @@ H5T_conv_double_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_uchar, FAIL) H5T_CONV_Fx(DOUBLE, UCHAR, double, unsigned char, 0, UCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8754,12 +8818,12 @@ H5T_conv_ldouble_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_schar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_schar, FAIL) H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8788,12 +8852,12 @@ H5T_conv_ldouble_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_uchar, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_uchar, FAIL) H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8821,12 +8885,12 @@ H5T_conv_float_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_short, FAIL) H5T_CONV_Fx(FLOAT, SHORT, float, short, SHRT_MIN, SHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8853,12 +8917,12 @@ H5T_conv_float_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_ushort, FAIL) H5T_CONV_Fx(FLOAT, USHORT, float, unsigned short, 0, USHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8885,12 +8949,12 @@ H5T_conv_double_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_short, FAIL) H5T_CONV_Fx(DOUBLE, SHORT, double, short, SHRT_MIN, SHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8917,12 +8981,12 @@ H5T_conv_double_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_ushort, FAIL) H5T_CONV_Fx(DOUBLE, USHORT, double, unsigned short, 0, USHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -8950,12 +9014,12 @@ H5T_conv_ldouble_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_short, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_short, FAIL) H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/ @@ -8984,12 +9048,12 @@ H5T_conv_ldouble_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_ushort, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_ushort, FAIL) H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -9017,12 +9081,12 @@ H5T_conv_float_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_int, FAIL) H5T_CONV_Fx(FLOAT, INT, float, int, INT_MIN, INT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -9049,12 +9113,12 @@ H5T_conv_float_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_uint, FAIL) H5T_CONV_Fx(FLOAT, UINT, float, unsigned int, 0, UINT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -9081,12 +9145,12 @@ H5T_conv_double_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_int, FAIL) H5T_CONV_Fx(DOUBLE, INT, double, int, INT_MIN, INT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -9113,12 +9177,12 @@ H5T_conv_double_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_uint, FAIL) H5T_CONV_Fx(DOUBLE, UINT, double, unsigned int, 0, UINT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -9146,12 +9210,12 @@ H5T_conv_ldouble_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_int, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_int, FAIL) H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -9180,12 +9244,12 @@ H5T_conv_ldouble_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_uint, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_uint, FAIL) H5T_CONV_Fx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_UINT */ @@ -9213,12 +9277,12 @@ H5T_conv_float_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_long, FAIL) H5T_CONV_Fx(FLOAT, LONG, float, long, LONG_MIN, LONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -9245,12 +9309,12 @@ H5T_conv_float_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_ulong, FAIL) H5T_CONV_Fx(FLOAT, ULONG, float, unsigned long, 0, ULONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -9277,12 +9341,12 @@ H5T_conv_double_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_long, FAIL) H5T_CONV_Fx(DOUBLE, LONG, double, long, LONG_MIN, LONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -9309,12 +9373,12 @@ H5T_conv_double_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_ulong, FAIL) H5T_CONV_Fx(DOUBLE, ULONG, double, unsigned long, 0, ULONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -9342,12 +9406,12 @@ H5T_conv_ldouble_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_long, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_long, FAIL) H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/ @@ -9376,12 +9440,12 @@ H5T_conv_ldouble_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_ulong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_ulong, FAIL) H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -9410,12 +9474,12 @@ H5T_conv_float_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_llong, FAIL) H5T_CONV_Fx(FLOAT, LLONG, float, long_long, LLONG_MIN, LLONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5T_CONV_INTERNAL_FP_LLONG */ @@ -9444,12 +9508,12 @@ H5T_conv_float_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_float_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_float_ullong, FAIL) H5T_CONV_Fx(FLOAT, ULLONG, float, unsigned long_long, 0, ULLONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_FP_ULLONG*/ @@ -9478,12 +9542,12 @@ H5T_conv_double_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_llong, FAIL) H5T_CONV_Fx(DOUBLE, LLONG, double, long_long, LLONG_MIN, LLONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_FP_LLONG*/ @@ -9512,12 +9576,12 @@ H5T_conv_double_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_double_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_double_ullong, FAIL) H5T_CONV_Fx(DOUBLE, ULLONG, double, unsigned long_long, 0, ULLONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_FP_ULLONG*/ @@ -9546,12 +9610,12 @@ H5T_conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_llong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_llong, FAIL) H5T_CONV_Fx(LDOUBLE, LLONG, long double, long_long, LLONG_MIN, LLONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/ @@ -9580,12 +9644,12 @@ H5T_conv_ldouble_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_ldouble_ullong, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_ldouble_ullong, FAIL) H5T_CONV_Fx(LDOUBLE, ULLONG, long double, unsigned long_long, 0, ULLONG_MAX); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5T_CONV_INTERNAL_LDOUBLE_ULLONG*/ @@ -9620,8 +9684,8 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, hid_t dxpl_id) { /* Traversal-related variables */ - H5T_t *src_p; /*source data type */ - H5T_t *dst_p; /*destination data type */ + H5T_t *src_p; /*source datatype */ + H5T_t *dst_p; /*destination datatype */ H5T_atomic_t src; /*atomic source info */ H5T_atomic_t dst; /*atomic destination info */ int direction; /*forward or backward traversal */ @@ -9649,13 +9713,13 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T_conv_ret_t except_ret; /*return of callback function */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_f_i, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_f_i, FAIL) switch (cdata->command) { case H5T_CONV_INIT: if (NULL==(src_p=H5I_object(src_id)) || NULL==(dst_p=H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; if (H5T_ORDER_LE!=src.order && H5T_ORDER_BE!=src.order && H5T_ORDER_VAX!=src.order) @@ -9671,10 +9735,10 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; case H5T_CONV_CONV: - /* Get the data types */ + /* Get the datatypes */ if (NULL==(src_p=H5I_object(src_id)) || NULL==(dst_p=H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; @@ -10174,7 +10238,7 @@ done: H5MM_xfree(int_buf); if(src_rev) H5MM_free(src_rev); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -10208,8 +10272,8 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, hid_t dxpl_id) { /* Traversal-related variables */ - H5T_t *src_p; /*source data type */ - H5T_t *dst_p; /*destination data type */ + H5T_t *src_p; /*source datatype */ + H5T_t *dst_p; /*destination datatype */ H5T_atomic_t src; /*atomic source info */ H5T_atomic_t dst; /*atomic destination info */ int direction; /*forward or backward traversal */ @@ -10239,13 +10303,13 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, hbool_t reverse; /*if reverse the order of destination */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_i_f, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_i_f, FAIL) switch (cdata->command) { case H5T_CONV_INIT: if (NULL==(src_p=H5I_object(src_id)) || NULL==(dst_p=H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; if (H5T_ORDER_LE!=dst.order && H5T_ORDER_BE!=dst.order && H5T_ORDER_VAX!=dst.order) @@ -10261,10 +10325,10 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, break; case H5T_CONV_CONV: - /* Get the data types */ + /* Get the datatypes */ if (NULL==(src_p=H5I_object(src_id)) || NULL==(dst_p=H5I_object(dst_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; @@ -10603,7 +10667,7 @@ done: H5MM_xfree(int_buf); if(src_rev) H5MM_free(src_rev); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -10633,7 +10697,7 @@ H5T_reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order) { size_t i; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_reverse_order); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_reverse_order) assert(s); assert(size); @@ -10651,5 +10715,6 @@ H5T_reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order) rev[i] = s[i]; } - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } + diff --git a/src/H5Tfields.c b/src/H5Tfields.c index 0237fc4..43f1369 100644 --- a/src/H5Tfields.c +++ b/src/H5Tfields.c @@ -76,22 +76,22 @@ H5T_init_fields_interface(void) int H5Tget_nmembers(hid_t type_id) { - H5T_t *dt = NULL; - int ret_value; + H5T_t *dt; /* Datatype to query */ + int ret_value; /* Return value */ FUNC_ENTER_API(H5Tget_nmembers, FAIL) H5TRACE1("Is", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - if((ret_value = H5T_get_nmembers(dt))<0) + if((ret_value = H5T_get_nmembers(dt)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot return member number") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tget_nmembers() */ /*------------------------------------------------------------------------- @@ -121,18 +121,18 @@ H5T_get_nmembers(const H5T_t *dt) FUNC_ENTER_NOAPI(H5T_get_nmembers, FAIL) - assert(dt); + HDassert(dt); - if (H5T_COMPOUND==dt->shared->type) + if(H5T_COMPOUND == dt->shared->type) ret_value = (int)dt->shared->u.compnd.nmembs; - else if (H5T_ENUM==dt->shared->type) + else if(H5T_ENUM == dt->shared->type) ret_value = (int)dt->shared->u.enumer.nmembs; else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for type class") done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_get_nmembers() */ /*------------------------------------------------------------------------- @@ -296,101 +296,94 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5T_sort_value(const H5T_t *dt, int *map) { - unsigned i, j, nmembs; + unsigned nmembs; /* Number of members for datatype */ size_t size; - hbool_t swapped; + hbool_t swapped; /* Whether we've swapped fields */ uint8_t tbuf[32]; - herr_t ret_value=SUCCEED; /* Return value */ + unsigned i, j; /* Local index variables */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5T_sort_value, FAIL) /* Check args */ - assert(dt); - assert(H5T_COMPOUND==dt->shared->type || H5T_ENUM==dt->shared->type); + HDassert(dt); + HDassert(H5T_COMPOUND == dt->shared->type || H5T_ENUM == dt->shared->type); /* Use a bubble sort because we can short circuit */ - if (H5T_COMPOUND==dt->shared->type) { - if (H5T_SORT_VALUE!=dt->shared->u.compnd.sorted) { + if(H5T_COMPOUND == dt->shared->type) { + if(H5T_SORT_VALUE != dt->shared->u.compnd.sorted) { dt->shared->u.compnd.sorted = H5T_SORT_VALUE; nmembs = dt->shared->u.compnd.nmembs; - for (i=nmembs-1, swapped=TRUE; i>0 && swapped; --i) { - for (j=0, swapped=FALSE; j<i; j++) { - if (dt->shared->u.compnd.memb[j].offset > - dt->shared->u.compnd.memb[j+1].offset) { - H5T_cmemb_t tmp = dt->shared->u.compnd.memb[j]; - dt->shared->u.compnd.memb[j] = dt->shared->u.compnd.memb[j+1]; - dt->shared->u.compnd.memb[j+1] = tmp; - if (map) { + for(i = nmembs - 1, swapped = TRUE; i > 0 && swapped; --i) { + for(j = 0, swapped = FALSE; j < i; j++) { + if(dt->shared->u.compnd.memb[j].offset > dt->shared->u.compnd.memb[j + 1].offset) { + H5T_cmemb_t tmp = dt->shared->u.compnd.memb[j]; + dt->shared->u.compnd.memb[j] = dt->shared->u.compnd.memb[j + 1]; + dt->shared->u.compnd.memb[j + 1] = tmp; + if(map) { int x = map[j]; - map[j] = map[j+1]; - map[j+1] = x; - } + + map[j] = map[j + 1]; + map[j + 1] = x; + } /* end if */ swapped = TRUE; - } - } - } + } /* end if */ + } /* end for */ + } /* end for */ #ifndef NDEBUG /* I never trust a sort :-) -RPM */ - for (i=0; i<nmembs-1; i++) { - assert(dt->shared->u.compnd.memb[i].offset < - dt->shared->u.compnd.memb[i+1].offset); - } + for(i = 0; i < (nmembs - 1); i++) + HDassert(dt->shared->u.compnd.memb[i].offset < dt->shared->u.compnd.memb[i + 1].offset); #endif - } - } else if (H5T_ENUM==dt->shared->type) { - if (H5T_SORT_VALUE!=dt->shared->u.enumer.sorted) { + } /* end if */ + } else if(H5T_ENUM == dt->shared->type) { + if(H5T_SORT_VALUE != dt->shared->u.enumer.sorted) { dt->shared->u.enumer.sorted = H5T_SORT_VALUE; nmembs = dt->shared->u.enumer.nmembs; size = dt->shared->size; - assert(size<=sizeof(tbuf)); - for (i=nmembs-1, swapped=TRUE; i>0 && swapped; --i) { - for (j=0, swapped=FALSE; j<i; j++) { - if (HDmemcmp(dt->shared->u.enumer.value+j*size, - dt->shared->u.enumer.value+(j+1)*size, - size)>0) { + HDassert(size <= sizeof(tbuf)); + for(i = (nmembs - 1), swapped = TRUE; i > 0 && swapped; --i) { + for(j = 0, swapped = FALSE; j < i; j++) { + if(HDmemcmp(dt->shared->u.enumer.value + (j * size), dt->shared->u.enumer.value + ((j + 1) * size), size) > 0) { /* Swap names */ char *tmp = dt->shared->u.enumer.name[j]; - dt->shared->u.enumer.name[j] = dt->shared->u.enumer.name[j+1]; - dt->shared->u.enumer.name[j+1] = tmp; + dt->shared->u.enumer.name[j] = dt->shared->u.enumer.name[j + 1]; + dt->shared->u.enumer.name[j + 1] = tmp; /* Swap values */ - HDmemcpy(tbuf, dt->shared->u.enumer.value+j*size, size); - HDmemcpy(dt->shared->u.enumer.value+j*size, - dt->shared->u.enumer.value+(j+1)*size, size); - HDmemcpy(dt->shared->u.enumer.value+(j+1)*size, tbuf, size); + HDmemcpy(tbuf, dt->shared->u.enumer.value + (j * size), size); + HDmemcpy(dt->shared->u.enumer.value + (j * size), + dt->shared->u.enumer.value + ((j + 1) * size), size); + HDmemcpy(dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size); /* Swap map */ - if (map) { + if(map) { int x = map[j]; - map[j] = map[j+1]; - map[j+1] = x; - } + + map[j] = map[j + 1]; + map[j + 1] = x; + } /* end if */ swapped = TRUE; - } - } - } + } /* end if */ + } /* end for */ + } /* end for */ #ifndef NDEBUG /* I never trust a sort :-) -RPM */ - for (i=0; i<nmembs-1; i++) { - assert(HDmemcmp(dt->shared->u.enumer.value+i*size, - dt->shared->u.enumer.value+(i+1)*size, - size)<0); - } + for(i = 0; i < (nmembs - 1); i++) + HDassert(HDmemcmp(dt->shared->u.enumer.value + (i * size), dt->shared->u.enumer.value + ((i + 1) * size), size) < 0); #endif - } - } + } /* end if */ + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_sort_value() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index b0abb9a..a534f1b 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -53,10 +53,10 @@ #define H5T_NAMELEN 32 /* Macro to ease detecting "complex" datatypes (i.e. those with base types or fields) */ -#define H5T_IS_COMPLEX(t) ((t)==H5T_COMPOUND || (t)==H5T_ENUM || (t)==H5T_VLEN || (t)==H5T_ARRAY) +#define H5T_IS_COMPLEX(t) ((t) == H5T_COMPOUND || (t) == H5T_ENUM || (t) == H5T_VLEN || (t) == H5T_ARRAY) /* Macro to ease detecting fixed "string" datatypes */ -#define H5T_IS_FIXED_STRING(dt) (H5T_STRING == (dt)->type) +#define H5T_IS_FIXED_STRING(dt) (H5T_STRING == (dt)->type) /* Macro to ease detecting variable-length "string" datatypes */ #define H5T_IS_VL_STRING(dt) (H5T_VLEN == (dt)->type && H5T_VLEN_STRING == (dt)->u.vlen.type) @@ -65,7 +65,14 @@ #define H5T_IS_STRING(dt) (H5T_IS_FIXED_STRING(dt) || H5T_IS_VL_STRING(dt)) /* Macro to ease detecting atomic datatypes */ -#define H5T_IS_ATOMIC(dt) (!(H5T_IS_COMPLEX((dt)->type) || (dt)->type==H5T_OPAQUE)) +#define H5T_IS_ATOMIC(dt) (!(H5T_IS_COMPLEX((dt)->type) || (dt)->type == H5T_OPAQUE)) + +/* Macro to ease retrieving class of shared datatype */ +/* (Externally, a VL string is a string; internally, a VL string is a VL. Lie + * to the user if they have a VL string and tell them it's in the string + * class) + */ +#define H5T_GET_CLASS(shared, internal) ((internal) ? (shared)->type : (H5T_IS_VL_STRING(shared) ? H5T_STRING : (shared)->type)) /* @@ -226,8 +233,8 @@ struct H5T_stats_t { /* The datatype conversion database */ struct H5T_path_t { char name[H5T_NAMELEN]; /*name for debugging only */ - H5T_t *src; /*source datatype ID */ - H5T_t *dst; /*destination datatype ID */ + H5T_t *src; /*source datatype */ + H5T_t *dst; /*destination datatype */ H5T_conv_t func; /*data conversion function */ hbool_t is_hard; /*is it a hard function? */ hbool_t is_noop; /*is it the noop conversion? */ @@ -277,13 +284,21 @@ typedef enum H5T_sort_t { H5T_SORT_VALUE = 2 /*sorted by memb offset or enum value*/ } H5T_sort_t; +/* A compound datatype member */ +typedef struct H5T_cmemb_t { + char *name; /*name of this member */ + size_t offset; /*offset from beginning of struct */ + size_t size; /*total size: dims * type_size */ + struct H5T_t *type; /*type of this member */ +} H5T_cmemb_t; + /* A compound datatype */ typedef struct H5T_compnd_t { unsigned nalloc; /*num entries allocated in MEMB array*/ unsigned nmembs; /*number of members defined in struct*/ H5T_sort_t sorted; /*how are members sorted? */ hbool_t packed; /*are members packed together? */ - struct H5T_cmemb_t *memb; /*array of struct members */ + H5T_cmemb_t *memb; /*array of struct members */ } H5T_compnd_t; /* An enumeration datatype */ @@ -306,7 +321,7 @@ typedef herr_t (*H5T_vlen_setnullfunc_t)(H5F_t *f, hid_t dxpl_id, void *_vl, voi /* VL types */ typedef enum { H5T_VLEN_BADTYPE = -1, /* invalid VL Type */ - H5T_VLEN_SEQUENCE=0, /* VL sequence */ + H5T_VLEN_SEQUENCE = 0, /* VL sequence */ H5T_VLEN_STRING, /* VL string */ H5T_VLEN_MAXTYPE /* highest type (Invalid as true type) */ } H5T_vlen_type_t; @@ -374,14 +389,6 @@ struct H5T_t { H5G_name_t path; /* group hier. path if the type is a named type */ }; -/* A compound datatype member */ -typedef struct H5T_cmemb_t { - char *name; /*name of this member */ - size_t offset; /*offset from beginning of struct */ - size_t size; /*total size: dims * type_size */ - struct H5T_t *type; /*type of this member */ -} H5T_cmemb_t; - /* The master list of soft conversion functions */ typedef struct H5T_soft_t { char name[H5T_NAMELEN]; /*name for debugging only */ @@ -1364,8 +1371,7 @@ H5_DLL H5T_t * H5T_vlen_create(const H5T_t *base); H5_DLL htri_t H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc); /* Array functions */ -H5_DLL H5T_t * H5T_array_create(H5T_t *base, unsigned ndims, - const hsize_t dim[/* ndims */]); +H5_DLL H5T_t *H5T_array_create(H5T_t *base, unsigned ndims, const hsize_t dim[/* ndims */]); H5_DLL int H5T_get_array_ndims(const H5T_t *dt); H5_DLL int H5T_get_array_dims(const H5T_t *dt, hsize_t dims[]); diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 36f8006..d99d3e7 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -33,7 +33,20 @@ /* Macro for size of temporary buffers to contain a single element */ #define H5T_ELEM_BUF_SIZE 256 -/* Forward references of package typedefs */ +/* If the module using this macro is allowed access to the private variables, access them directly */ +#ifdef H5T_PACKAGE +#define H5T_GET_SIZE(T) ((T)->shared->size) +#define H5T_GET_SHARED(T) ((T)->shared) +#define H5T_GET_MEMBER_OFFSET(T, I) ((T)->u.compnd.memb[I].offset) +#define H5T_GET_MEMBER_SIZE(T, I) ((T)->u.compnd.memb[I].shared->size) +#else /* H5T_PACKAGE */ +#define H5T_GET_SIZE(T) (H5T_get_size(T)) +#define H5T_GET_SHARED(T) (H5T_get_shared(T)) +#define H5T_GET_MEMBER_OFFSET(T, I) (H5T_get_member_offset((T), (I))) +#define H5T_GET_MEMBER_SIZE(T, I) (H5T_get_member_size((T), (I))) +#endif /* H5T_PACKAGE */ + +/* Forward references of package typedefs (declared in H5Tpkg.h) */ typedef struct H5T_t H5T_t; typedef struct H5T_stats_t H5T_stats_t; typedef struct H5T_path_t H5T_path_t; @@ -103,13 +116,13 @@ H5_DLL htri_t H5T_is_immutable(const H5T_t *dt); H5_DLL htri_t H5T_is_named(const H5T_t *dt); H5_DLL htri_t H5T_is_relocatable(const H5T_t *dt); H5_DLL H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst, - const char *name, H5T_conv_t func, hid_t dxpl_id, hbool_t is_api); + const char *name, H5T_conv_t func, hid_t dxpl_id, hbool_t is_api); H5_DLL hbool_t H5T_path_noop(const H5T_path_t *p); H5_DLL H5T_bkg_t H5T_path_bkg(const H5T_path_t *p); H5_DLL H5T_subset_t H5T_path_compound_subset(const H5T_path_t *p); H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, - size_t nelmts, size_t buf_stride, size_t bkg_stride, - void *buf, void *bkg, hid_t dset_xfer_plist); + size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, + hid_t dset_xfer_plist); H5_DLL herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_op_data); H5_DLL herr_t H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_alloc_info); H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc); diff --git a/src/H5Tvisit.c b/src/H5Tvisit.c index bd30a43..44e06fe 100644 --- a/src/H5Tvisit.c +++ b/src/H5Tvisit.c @@ -151,5 +151,5 @@ H5T_visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_iterate() */ +} /* end H5T_visit() */ diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 0404707..d80bd94 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -203,68 +203,63 @@ done: * Programmer: Quincey Koziol * Friday, June 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) { - htri_t ret_value = 0; /* Indicate that success, but no location change */ + htri_t ret_value = FALSE; /* Indicate success, but no location change */ FUNC_ENTER_NOAPI_NOINIT(H5T_vlen_set_loc) /* check parameters */ - assert(dt); - assert(loc>H5T_LOC_BADLOC && loc<H5T_LOC_MAXLOC); + HDassert(dt); + HDassert(loc > H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); /* Only change the location if it's different */ if(loc != dt->shared->u.vlen.loc || f != dt->shared->u.vlen.f) { - /* Indicate that the location changed */ - ret_value=TRUE; - switch(loc) { case H5T_LOC_MEMORY: /* Memory based VL datatype */ - assert(f==NULL); + HDassert(NULL == f); /* Mark this type as being stored in memory */ - dt->shared->u.vlen.loc=H5T_LOC_MEMORY; + dt->shared->u.vlen.loc = H5T_LOC_MEMORY; - if(dt->shared->u.vlen.type==H5T_VLEN_SEQUENCE) { + if(dt->shared->u.vlen.type == H5T_VLEN_SEQUENCE) { /* size in memory, disk size is different */ dt->shared->size = sizeof(hvl_t); /* Set up the function pointers to access the VL sequence in memory */ - dt->shared->u.vlen.getlen=H5T_vlen_seq_mem_getlen; - dt->shared->u.vlen.getptr=H5T_vlen_seq_mem_getptr; - dt->shared->u.vlen.isnull=H5T_vlen_seq_mem_isnull; - dt->shared->u.vlen.read=H5T_vlen_seq_mem_read; - dt->shared->u.vlen.write=H5T_vlen_seq_mem_write; - dt->shared->u.vlen.setnull=H5T_vlen_seq_mem_setnull; - } else if(dt->shared->u.vlen.type==H5T_VLEN_STRING) { + dt->shared->u.vlen.getlen = H5T_vlen_seq_mem_getlen; + dt->shared->u.vlen.getptr = H5T_vlen_seq_mem_getptr; + dt->shared->u.vlen.isnull = H5T_vlen_seq_mem_isnull; + dt->shared->u.vlen.read = H5T_vlen_seq_mem_read; + dt->shared->u.vlen.write = H5T_vlen_seq_mem_write; + dt->shared->u.vlen.setnull = H5T_vlen_seq_mem_setnull; + } else if(dt->shared->u.vlen.type == H5T_VLEN_STRING) { /* size in memory, disk size is different */ dt->shared->size = sizeof(char *); /* Set up the function pointers to access the VL string in memory */ - dt->shared->u.vlen.getlen=H5T_vlen_str_mem_getlen; - dt->shared->u.vlen.getptr=H5T_vlen_str_mem_getptr; - dt->shared->u.vlen.isnull=H5T_vlen_str_mem_isnull; - dt->shared->u.vlen.read=H5T_vlen_str_mem_read; - dt->shared->u.vlen.write=H5T_vlen_str_mem_write; - dt->shared->u.vlen.setnull=H5T_vlen_str_mem_setnull; + dt->shared->u.vlen.getlen = H5T_vlen_str_mem_getlen; + dt->shared->u.vlen.getptr = H5T_vlen_str_mem_getptr; + dt->shared->u.vlen.isnull = H5T_vlen_str_mem_isnull; + dt->shared->u.vlen.read = H5T_vlen_str_mem_read; + dt->shared->u.vlen.write = H5T_vlen_str_mem_write; + dt->shared->u.vlen.setnull = H5T_vlen_str_mem_setnull; } else { assert(0 && "Invalid VL type"); } /* Reset file ID (since this VL is in memory) */ - dt->shared->u.vlen.f=NULL; + dt->shared->u.vlen.f = NULL; break; case H5T_LOC_DISK: /* Disk based VL datatype */ - assert(f); + HDassert(f); /* Mark this type as being stored on disk */ - dt->shared->u.vlen.loc=H5T_LOC_DISK; + dt->shared->u.vlen.loc = H5T_LOC_DISK; /* * Size of element on disk is 4 bytes for the length, plus the size @@ -275,20 +270,23 @@ H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Set up the function pointers to access the VL information on disk */ /* VL sequences and VL strings are stored identically on disk, so use the same functions */ - dt->shared->u.vlen.getlen=H5T_vlen_disk_getlen; - dt->shared->u.vlen.getptr=H5T_vlen_disk_getptr; - dt->shared->u.vlen.isnull=H5T_vlen_disk_isnull; - dt->shared->u.vlen.read=H5T_vlen_disk_read; - dt->shared->u.vlen.write=H5T_vlen_disk_write; - dt->shared->u.vlen.setnull=H5T_vlen_disk_setnull; + dt->shared->u.vlen.getlen = H5T_vlen_disk_getlen; + dt->shared->u.vlen.getptr = H5T_vlen_disk_getptr; + dt->shared->u.vlen.isnull = H5T_vlen_disk_isnull; + dt->shared->u.vlen.read = H5T_vlen_disk_read; + dt->shared->u.vlen.write = H5T_vlen_disk_write; + dt->shared->u.vlen.setnull = H5T_vlen_disk_setnull; /* Set file ID (since this VL is on disk) */ - dt->shared->u.vlen.f=f; + dt->shared->u.vlen.f = f; break; default: HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype location") } /* end switch */ /*lint !e788 All appropriate cases are covered */ + + /* Indicate that the location changed */ + ret_value = TRUE; } /* end if */ done: diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h index cd67e96..15b7289 100644 --- a/src/H5Zprivate.h +++ b/src/H5Zprivate.h @@ -98,7 +98,8 @@ typedef struct H5Z_data_xform_t H5Z_data_xform_t; /* Defined in H5Ztrans.c */ H5_DLL H5Z_data_xform_t *H5Z_xform_create(const char *expr); H5_DLL herr_t H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop); H5_DLL herr_t H5Z_xform_destroy(H5Z_data_xform_t *data_xform_prop); -H5_DLL herr_t H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size, const H5T_t *buf_type); +H5_DLL herr_t H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void *array, + size_t array_size, const H5T_t *buf_type); H5_DLL hbool_t H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop); H5_DLL char* H5Z_xform_extract_xform_str(const H5Z_data_xform_t *data_xform_prop); diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index a58988e..c0a6972 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -20,8 +20,8 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Zpkg.h" /* Data filters */ #include "H5Vprivate.h" /* H5V_array_fill */ +#include "H5Zpkg.h" /* Data filters */ /* Token types */ @@ -885,7 +885,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } - + /*------------------------------------------------------------------------- * Function: H5Z_xform_eval * Purpose: If the transform is trivial, this function applies it. @@ -898,32 +898,31 @@ done: * *------------------------------------------------------------------------- */ - herr_t H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size, const H5T_t *buf_type) { H5Z_node *tree; hid_t array_type; - size_t i; H5Z_result res; - herr_t ret_value = SUCCEED; + size_t i; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5Z_xform_eval, FAIL) HDassert(data_xform_prop); - tree=data_xform_prop->parse_root; + tree = data_xform_prop->parse_root; /* Get the datatype ID for the buffer's type */ - if( (array_type = H5Z_xform_find_type(buf_type)) < 0) + if((array_type = H5Z_xform_find_type(buf_type)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Cannot perform data transform on this type.") - /*After this point, we're assured that the type of the array is handled by the eval code, so we no - * longer have to check for valid types */ + /* After this point, we're assured that the type of the array is handled by the eval code, + * so we no longer have to check for valid types + */ /* If it's a trivial data transform, perform it */ - if( tree->type == H5Z_XFORM_INTEGER || tree->type == H5Z_XFORM_FLOAT) - { + if(tree->type == H5Z_XFORM_INTEGER || tree->type == H5Z_XFORM_FLOAT) { if(array_type == H5T_NATIVE_CHAR) H5Z_XFORM_DO_OP5(char, array_size) else if(array_type == H5T_NATIVE_UCHAR) @@ -955,24 +954,22 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size H5Z_XFORM_DO_OP5(long double, array_size) #endif - } + } /* end if */ /* Otherwise, do the full data transform */ - else - { + else { /* Optimization for linear transform: */ if(data_xform_prop->dat_val_pointers->num_ptrs == 1) data_xform_prop->dat_val_pointers->ptr_dat_val[0] = array; + /* If it's a quadratic transform, we have no choice but to store multiple copies of the data */ - else - { - for(i=0; i<data_xform_prop->dat_val_pointers->num_ptrs; i++) - { - if( (data_xform_prop->dat_val_pointers->ptr_dat_val[i] = (void*)H5MM_malloc(array_size*H5Tget_size(array_type))) == NULL) + else { + for(i = 0; i < data_xform_prop->dat_val_pointers->num_ptrs; i++) { + if(NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val[i] = (void*)H5MM_malloc(array_size * H5Tget_size(array_type)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "Ran out of memory trying to allocate space for data in data transform") - HDmemcpy(data_xform_prop->dat_val_pointers->ptr_dat_val[i], array, array_size*H5Tget_size(array_type)); - } - } + HDmemcpy(data_xform_prop->dat_val_pointers->ptr_dat_val[i], array, array_size * H5Tget_size(array_type)); + } /* end for */ + } /* end else */ if(H5Z_xform_eval_full(tree, array_size, array_type, &res) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform") @@ -984,22 +981,20 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size if(data_xform_prop->dat_val_pointers->num_ptrs > 1) for(i=0; i<data_xform_prop->dat_val_pointers->num_ptrs; i++) HDfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]); - } + } /* end else */ done: - if(ret_value < 0) - { + if(ret_value < 0) { /* If we ran out of memory above copying the array for temp storage (which we easily can for * polynomial transforms of high order) we free those arrays which we already allocated */ if(data_xform_prop->dat_val_pointers->num_ptrs > 1) - for(i=0; i<data_xform_prop->dat_val_pointers->num_ptrs; i++) - if(data_xform_prop->dat_val_pointers->ptr_dat_val[i] != NULL) + for(i = 0; i < data_xform_prop->dat_val_pointers->num_ptrs; i++) + if(data_xform_prop->dat_val_pointers->ptr_dat_val[i]) HDfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]); - } - FUNC_LEAVE_NOAPI(ret_value); -} - + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5Z_xform_eval() */ /*------------------------------------------------------------------------- @@ -1017,38 +1012,34 @@ done: * will accumulate changes and, at the end, the new data will be copied from the lhs. *------------------------------------------------------------------------- */ -static herr_t -H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_type, H5Z_result* res) +static herr_t +H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_type, H5Z_result *res) { H5Z_result resl, resr; - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_xform_eval_full, FAIL); + FUNC_ENTER_NOAPI(H5Z_xform_eval_full, FAIL) /* check args */ - assert(tree); + HDassert(tree); - if (tree->type == H5Z_XFORM_INTEGER) - { + if (tree->type == H5Z_XFORM_INTEGER) { res->type = H5Z_XFORM_INTEGER; res->value.int_val = tree->value.int_val; - } - else if (tree->type == H5Z_XFORM_FLOAT) - { + } /* end if */ + else if (tree->type == H5Z_XFORM_FLOAT) { res->type = H5Z_XFORM_FLOAT; res->value.float_val = tree->value.float_val; - } - else if (tree->type == H5Z_XFORM_SYMBOL) - { + } /* end if */ + else if (tree->type == H5Z_XFORM_SYMBOL) { res->type = H5Z_XFORM_SYMBOL; /*since dat_val stores the address of the array which is really stored in the dat_val_pointers, * here we make dat_val store a pointer to the array itself instead of the address of it so that the * rest of the code below works normally. */ res->value.dat_val = *((void**)(tree->value.dat_val)); - } - else - { + } /* end if */ + else { if(H5Z_xform_eval_full(tree->lchild, array_size, array_type, &resl) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform") if(H5Z_xform_eval_full(tree->rchild, array_size, array_type, &resr) < 0) @@ -1081,7 +1072,8 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ default: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid expression tree") - } + } /* end switch */ + /* The result stores a pointer to the new data */ /* So, if the left hand side got its data modified, the result stores a pointers * to the left hand side's data, ditto for rhs */ @@ -1091,14 +1083,11 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ res->value.dat_val = resr.value.dat_val; else HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error during transform evaluation") - - } - + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} - +} /* end H5Z_xform_eval_full() */ /*------------------------------------------------------------------------- @@ -1113,77 +1102,76 @@ done: static hid_t H5Z_xform_find_type(const H5T_t* type) { - hid_t ret_value = SUCCEED; + hid_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5Z_xform_find_type); + FUNC_ENTER_NOAPI_NOINIT(H5Z_xform_find_type) - assert(type); + HDassert(type); /* Check for SHORT type */ - if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_SHORT,H5I_DATATYPE), FALSE ))==0) + if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_SHORT,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_SHORT) /* Check for INT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_INT,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_INT,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_INT) /* Check for LONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LONG,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LONG,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_LONG) /* Check for LONGLONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LLONG,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LLONG,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_LLONG) /* Check for UCHAR type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_UCHAR,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_UCHAR,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_UCHAR) /* Check for CHAR type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_CHAR,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_CHAR,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_CHAR) /* Check for SCHAR type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_SCHAR,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_SCHAR,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_SCHAR) /* Check for USHORT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_USHORT,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_USHORT,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_USHORT) /* Check for UINT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_UINT,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_UINT,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_UINT) /* Check for ULONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_ULONG,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_ULONG,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_ULONG) /* Check for ULONGLONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_ULLONG,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_ULLONG,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_ULLONG) /* Check for FLOAT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_FLOAT,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_FLOAT,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_FLOAT) /* Check for DOUBLE type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_DOUBLE,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_DOUBLE,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_DOUBLE) #if H5_SIZEOF_LONG_DOUBLE !=0 /* Check for LONGDOUBLE type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LDOUBLE,H5I_DATATYPE), FALSE))==0) + else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LDOUBLE,H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_LDOUBLE) #endif else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not find matching type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not find matching type") done: FUNC_LEAVE_NOAPI(ret_value) - -} +} /* end H5Z_xform_find_type() */ /*------------------------------------------------------------------------- diff --git a/src/H5detect.c b/src/H5detect.c index 35cca1a..e29157d 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -202,34 +202,36 @@ precision (detected_t *d) int _i, _j; \ unsigned char *_x; \ \ - memset (&INFO, 0, sizeof(INFO)); \ + HDmemset(&INFO, 0, sizeof(INFO)); \ INFO.varname = #VAR; \ INFO.size = sizeof(TYPE); \ \ - if(sizeof(TYPE)!=1) { \ - for (_i=sizeof(TYPE),_v=0; _i>0; --_i) _v = (_v<<8) + _i; \ - for (_i=0,_x=(unsigned char *)&_v; _i<(signed)sizeof(TYPE); _i++) { \ - _j = (*_x++)-1; \ - assert (_j<(signed)sizeof(TYPE)); \ + if(sizeof(TYPE) != 1) { \ + for(_i = sizeof(TYPE), _v = 0; _i > 0; --_i) \ + _v = (_v << 8) + _i; \ + for(_i = 0, _x = (unsigned char *)&_v; _i < (signed)sizeof(TYPE); _i++) { \ + _j = (*_x++) - 1; \ + assert(_j < (signed)sizeof(TYPE)); \ INFO.perm[_i] = _j; \ - } \ + } /* end for */ \ } else { /*Not able to detect order if type size is 1 byte. Use native int \ *instead. No effect on data, just make it look correct. */ \ - for (_i=sizeof(int),_int_v=0; _i>0; --_i) _int_v = (_int_v<<8) + _i; \ - for (_i=0,_x=(unsigned char *)&_int_v; _i<(signed)sizeof(int); _i++) { \ + for(_i = sizeof(int), _int_v = 0; _i > 0; --_i) \ + _int_v = (_int_v << 8) + _i; \ + for(_i = 0, _x = (unsigned char *)&_int_v; _i < (signed)sizeof(int); _i++) { \ _j = (*_x++)-1; \ - assert (_j<(signed)sizeof(int)); \ + assert(_j < (signed)sizeof(int)); \ INFO.perm[_i] = _j; \ - } \ - } \ + } /* end for */ \ + } /* end else */ \ \ - INFO.sign = ('U'!=*(#VAR)); \ + INFO.sign = ('U' != *(#VAR)); \ precision (&(INFO)); \ ALIGNMENT(TYPE, INFO); \ - if(!strcmp(INFO.varname, "SCHAR") || !strcmp(INFO.varname, "SHORT") || \ - !strcmp(INFO.varname, "INT") || !strcmp(INFO.varname, "LONG") || \ - !strcmp(INFO.varname, "LLONG")) { \ - COMP_ALIGNMENT(TYPE,INFO.comp_align); \ + if(!HDstrcmp(INFO.varname, "SCHAR") || !HDstrcmp(INFO.varname, "SHORT") || \ + !HDstrcmp(INFO.varname, "INT") || !HDstrcmp(INFO.varname, "LONG") || \ + !HDstrcmp(INFO.varname, "LLONG")) { \ + COMP_ALIGNMENT(TYPE, INFO.comp_align); \ } \ } @@ -358,16 +360,16 @@ precision (detected_t *d) #if defined(H5_HAVE_LONGJMP) && defined(H5_HAVE_SIGNAL) #define ALIGNMENT(TYPE,INFO) { \ - char *volatile _buf=NULL; \ - volatile TYPE _val=1; \ + char *volatile _buf = NULL; \ + volatile TYPE _val = 1; \ volatile TYPE _val2; \ - volatile size_t _ano=0; \ + volatile size_t _ano = 0; \ void (*_handler)(int) = signal(SIGBUS, sigbus_handler); \ void (*_handler2)(int) = signal(SIGSEGV, sigsegv_handler); \ \ - _buf = (char*)malloc(sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \ - if (setjmp(jbuf_g)) _ano++; \ - if (_ano<NELMTS(align_g)) { \ + _buf = (char*)malloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \ + if(setjmp(jbuf_g)) _ano++; \ + if(_ano < NELMTS(align_g)) { \ *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \ _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/ \ /* Cray Check: This section helps detect alignment on Cray's */ \ @@ -522,27 +524,88 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) /* Include files */ printf("\ +/****************/\n\ +/* Module Setup */\n\ +/****************/\n\ +\n\ #define H5T_PACKAGE /*suppress error about including H5Tpkg.h*/\n\ \n\ -#include \"H5private.h\"\n\ -#include \"H5Iprivate.h\"\n\ -#include \"H5Eprivate.h\"\n\ -#include \"H5FLprivate.h\"\n\ -#include \"H5Tpkg.h\"\n\ \n\ +/***********/\n\ +/* Headers */\n\ +/***********/\n\ +#include \"H5private.h\" /* Generic Functions */\n\ +#include \"H5Eprivate.h\" /* Error handling */\n\ +#include \"H5FLprivate.h\" /* Free Lists */\n\ +#include \"H5Iprivate.h\" /* IDs */\n\ +#include \"H5Tpkg.h\" /* Datatypes */\n\ +\n\ +\n\ +/****************/\n\ +/* Local Macros */\n\ +/****************/\n\ +\n\ +\n\ +/******************/\n\ +/* Local Typedefs */\n\ +/******************/\n\ +\n\ +\n\ +/********************/\n\ +/* Package Typedefs */\n\ +/********************/\n\ +\n\ +\n\ +/********************/\n\ +/* Local Prototypes */\n\ +/********************/\n\ +\n\ +\n\ +/********************/\n\ +/* Public Variables */\n\ +/********************/\n\ +\n\n\ +/*****************************/\n\ +/* Library Private Variables */\n\ +/*****************************/\n\ +\n\n\ +/*********************/\n\ +/* Package Variables */\n\ +/*********************/\n\ +\n\ +\n"); + printf("\n\ +/*******************/\n\ +/* Local Variables */\n\ +/*******************/\n\ \n"); /* The interface initialization function */ printf("\n\ +\n\ +/*-------------------------------------------------------------------------\n\ + * Function: H5TN_init_interface\n\ + *\n\ + * Purpose: Initialize pre-defined native datatypes from code generated\n\ + * during the library configuration by H5detect.\n\ + *\n\ + * Return: Success: non-negative\n\ + * Failure: negative\n\ + *\n\ + * Programmer: Robb Matzke\n\ + * Wednesday, December 16, 1998\n\ + *\n\ + *-------------------------------------------------------------------------\n\ + */\n\ herr_t\n\ H5TN_init_interface(void)\n\ {\n\ H5T_t *dt = NULL;\n\ herr_t ret_value = SUCCEED;\n\ \n\ - FUNC_ENTER_NOAPI(H5TN_init_interface, FAIL);\n"); + FUNC_ENTER_NOAPI(H5TN_init_interface, FAIL)\n"); - for (i = 0; i < nd; i++) { + for(i = 0; i < nd; i++) { /* The native endianess of this machine */ /* The INFO.perm now contains `-1' for bytes that aren't used and * are always zero. This happens on the Cray for `short' where @@ -568,7 +631,7 @@ H5TN_init_interface(void)\n\ /* The part common to fixed and floating types */ printf("\ if(NULL == (dt = H5T_alloc()))\n\ - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,\"memory allocation failed\")\n\ + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, \"datatype allocation failed\")\n\ dt->shared->state = H5T_STATE_IMMUTABLE;\n\ dt->shared->type = H5T_%s;\n\ dt->shared->size = %d;\n", @@ -621,8 +684,8 @@ H5TN_init_interface(void)\n\ /* Atomize the type */ printf("\ - if ((H5T_NATIVE_%s_g = H5I_register (H5I_DATATYPE, dt, FALSE))<0)\n\ - HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,\"can't initialize type system (atom registration failure\");\n", + if((H5T_NATIVE_%s_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)\n\ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \"can't register ID for built-in datatype\")\n", d[i].varname); printf(" H5T_NATIVE_%s_ALIGN_g = %lu;\n", d[i].varname, (unsigned long)(d[i].align)); @@ -656,16 +719,16 @@ H5TN_init_interface(void)\n\ printf("\ \n\ done:\n\ - if(ret_value<0) {\n\ + if(ret_value < 0) {\n\ if(dt != NULL) {\n\ if(dt->shared != NULL)\n\ H5FL_FREE(H5T_shared_t, dt->shared);\n\ H5FL_FREE(H5T_t, dt);\n\ } /* end if */\n\ - }\n\ + } /* end if */\n\ \n\ - FUNC_LEAVE_NOAPI(ret_value);\n}\n"); -} + FUNC_LEAVE_NOAPI(ret_value);\n} /* end H5TN_init_interface() */\n"); +} /* end print_results() */ /*------------------------------------------------------------------------- |