From b48686febd832aefbc44274bff9e0408bbc84aa0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 20 Sep 2018 13:38:40 -0700 Subject: Normalization with vol_integration (misc internal and datatype) --- src/H5AC.c | 19 ++- src/H5Aint.c | 10 +- src/H5B.c | 4 +- src/H5B2.c | 2 +- src/H5B2hdr.c | 3 +- src/H5Bdbg.c | 4 +- src/H5C.c | 33 ++-- src/H5CX.c | 6 +- src/H5Cimage.c | 14 +- src/H5Ctag.c | 2 +- src/H5F.c | 171 ++++++++++--------- src/H5FApkg.h | 15 +- src/H5Fquery.c | 6 +- src/H5HF.c | 2 +- src/H5HFdbg.c | 15 +- src/H5HFhdr.c | 6 +- src/H5HFiblock.c | 348 +++++++++++++++++++-------------------- src/H5HFman.c | 1 + src/H5HFprivate.h | 12 +- src/H5HFsection.c | 12 +- src/H5HFspace.c | 7 +- src/H5HG.c | 74 ++++----- src/H5HGcache.c | 4 +- src/H5HGpkg.h | 2 +- src/H5I.c | 6 +- src/H5Lpublic.h | 4 +- src/H5Ocopy.c | 7 +- src/H5Odtype.c | 9 +- src/H5R.c | 48 +++--- src/H5Rdeprec.c | 16 +- src/H5Rint.c | 16 +- src/H5Rpkg.h | 12 +- src/H5Rprivate.h | 6 - src/H5SM.c | 118 ++++++------- src/H5T.c | 262 ++++++++++++----------------- src/H5Tcommit.c | 236 ++++++++++++-------------- src/H5Tcompound.c | 10 +- src/H5Tconv.c | 67 ++++---- src/H5Tdeprec.c | 22 +-- src/H5Tenum.c | 2 - src/H5Toh.c | 2 +- src/H5Torder.c | 10 +- src/H5Tpkg.h | 4 +- src/H5Tprivate.h | 1 - src/H5Tvlen.c | 24 ++- src/H5Z.c | 114 +++++++------ src/H5detect.c | 421 +++++++++++++++++++++++------------------------ src/H5make_libsettings.c | 30 ++-- src/Makefile.am | 7 +- 49 files changed, 1066 insertions(+), 1160 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 989ee10..9894e39 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -2620,7 +2620,7 @@ done: * * Purpose: Sets the metadata tag property in the provided property list. * - * Return: SUCCEED on success, FAIL otherwise. + * Return: void * * Programmer: Mike McGreevy * December 1, 2009 @@ -2773,7 +2773,7 @@ H5AC_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flag HDassert(f->shared); /* Call cache level function to expunge entries with specified tag and type id */ - if(H5C_expunge_tag_type_metadata(f, tag, type_id, flags)<0) + if(H5C_expunge_tag_type_metadata(f, tag, type_id, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot expunge tagged type entries") done: @@ -2924,16 +2924,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC_set_ring + * Function: H5AC_set_ring * - * Purpose: Routine to set the ring on a DXPL (for passing through - * to the metadata cache). + * Purpose: Routine to set the ring on a DXPL (for passing through + * to the metadata cache). * - * Return: Success: Non-negative - * Failure: Negative + * Return: void * - * Programmer: Quincey Koziol - * Tuesday, September 8, 2015 + * Programmer: Quincey Koziol + * Tuesday, September 8, 2015 * *------------------------------------------------------------------------- */ @@ -2942,6 +2941,8 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Note: orig_ring can be NULL so don't check it with HDassert() */ + /* Get the current ring value and return that (if orig_ring is NOT null) */ if(orig_ring) *orig_ring = H5CX_get_ring(); diff --git a/src/H5Aint.c b/src/H5Aint.c index 807c67e..4c7568a 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -240,7 +240,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * (to maintain ref. count incr/decr similarity with "shared message" * type of datatype sharing) */ - if(H5T_committed(attr->shared->dt)) + if(H5T_is_named(attr->shared->dt)) /* Increment the reference count on the shared datatype */ if(H5T_link(attr->shared->dt, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, NULL, "unable to adjust shared datatype link count") @@ -2112,14 +2112,14 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s if(H5T_set_loc(attr_dst->shared->dt, file_dst, H5T_LOC_DISK) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "cannot mark datatype on disk") - if(!H5T_committed(attr_src->shared->dt)) { + if(!H5T_is_named(attr_src->shared->dt)) { /* If the datatype is not named, it may have been shared in the * source file's heap. Un-share it for now. We'll try to shared * it in the destination file below. */ if(H5O_msg_reset_share(H5O_DTYPE_ID, attr_dst->shared->dt) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset datatype sharing") - } /* end if */ + } /* Copy the dataspace for the attribute. Make sure the maximal dimension is also copied. * Otherwise the comparison in the test may complain about it. SLU 2011/4/12 */ @@ -2354,7 +2354,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, HDassert(file_src); HDassert(file_dst); - if(H5T_committed(attr_src->shared->dt)) { + if(H5T_is_named(attr_src->shared->dt)) { H5O_loc_t *src_oloc_dt; /* Pointer to source datatype's object location */ H5O_loc_t *dst_oloc_dt; /* Pointer to dest. datatype's object location */ @@ -2374,7 +2374,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, /* Update shared message info from named datatype info */ H5T_update_shared(attr_dst->shared->dt); - } /* end if */ + } /* Try to share both the datatype and dataset. This does nothing if the * datatype is committed or sharing is disabled. diff --git a/src/H5B.c b/src/H5B.c index 53d5529..71b9020 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -471,12 +471,12 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, * Create the new B-tree node. */ if(H5B_create(f, shared->type, udata, &split_bt_ud->addr/*out*/) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") cache_udata.f = f; cache_udata.type = shared->type; cache_udata.rc_shared = bt_ud->bt->rc_shared; if(NULL == (split_bt_ud->bt = (H5B_t *)H5AC_protect(f, H5AC_BT, split_bt_ud->addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree") split_bt_ud->bt->level = bt_ud->bt->level; /* diff --git a/src/H5B2.c b/src/H5B2.c index 1f964b8..cf8e4a9 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -220,7 +220,7 @@ H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata) /* Look up the B-tree header */ if(NULL == (hdr = H5B2__hdr_protect(f, addr, ctx_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") /* Check for pending heap deletion */ if(hdr->pending_delete) diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index e9b6810..68669e8 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -523,8 +523,7 @@ done: *------------------------------------------------------------------------- */ H5B2_hdr_t * -H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, - unsigned flags) +H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags) { H5B2_hdr_cache_ud_t udata; /* User data for cache callbacks */ H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */ diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index 5cad81b..c491783 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -80,7 +80,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); HDassert(shared); @@ -91,7 +91,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, cache_udata.type = type; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") /* * Print the values. diff --git a/src/H5C.c b/src/H5C.c index c4d4eed..a22eca0 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -1284,7 +1284,7 @@ H5C_insert_entry(H5F_t * f, insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 ); flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 ); - /* Get the ring type from the DXPL */ + /* Get the ring type from the API context */ ring = H5CX_get_ring(); entry_ptr = (H5C_cache_entry_t *)thing; @@ -2331,10 +2331,10 @@ H5C_protect(H5F_t * f, haddr_t tag; /* Tag value */ /* The entry is already in the cache, but make sure that the tag value - is still legal. This will ensure that had - the entry NOT been in the cache, tagging was still set up correctly - and it would have received a legal tag value after getting loaded - from disk. */ + * is still legal. This will ensure that had the entry NOT been in the + * cache, tagging was still set up correctly and it would have received + * a legal tag value after getting loaded from disk. + */ /* Get the tag */ tag = H5CX_get_tag(); @@ -2389,10 +2389,10 @@ H5C_protect(H5F_t * f, else empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - /* try to free up if necceary and if evictions are permitted. Note - * that if evictions are enabled, we will call H5C__make_space_in_cache() - * regardless if the min_free_space requirement is not met. - */ + /* try to free up if necceary and if evictions are permitted. Note + * that if evictions are enabled, we will call H5C__make_space_in_cache() + * regardless if the min_free_space requirement is not met. + */ if ( ( cache_ptr->evictions_enabled ) && ( ( (cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size) @@ -2438,10 +2438,10 @@ H5C_protect(H5F_t * f, * * Second, when writes are not permitted it is also possible * for the cache to grow without bound. - * - * Third, the user may choose to disable evictions -- causing - * the cache to grow without bound until evictions are - * re-enabled. + * + * Third, the user may choose to disable evictions -- causing + * the cache to grow without bound until evictions are + * re-enabled. * * Finally, we usually don't check to see if the cache is * oversized at the end of an unprotect. As a result, it is @@ -4287,11 +4287,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5C__autoadjust__ageout(H5F_t * f, - double hit_rate, - enum H5C_resize_status * status_ptr, - size_t * new_max_cache_size_ptr, - hbool_t write_permitted) +H5C__autoadjust__ageout(H5F_t * f, double hit_rate, enum H5C_resize_status * status_ptr, + size_t * new_max_cache_size_ptr, hbool_t write_permitted) { H5C_t * cache_ptr = f->shared->cache; size_t test_size; diff --git a/src/H5CX.c b/src/H5CX.c index f809d1c..faf0b24 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -53,7 +53,7 @@ * each thread individually. The association of contexts to threads will * be handled by the pthread library. * - * In order for this macro to work, H5E_get_my_stack() must be preceeded + * In order for this macro to work, H5E__get_my_stack() must be preceeded * by "H5CX_node_t *ctx =". */ #define H5CX_get_my_context() H5CX__get_context() @@ -320,7 +320,9 @@ typedef struct H5CX_lapl_cache_t { /********************/ /* Local Prototypes */ /********************/ +#ifdef H5_HAVE_THREADSAFE static H5CX_node_t **H5CX__get_context(void); +#endif /* H5_HAVE_THREADSAFE */ static void H5CX__push_common(H5CX_node_t *cnode); static H5CX_node_t *H5CX__pop_common(void); @@ -862,7 +864,7 @@ done: * * Purpose: Sanity checks and sets up collective operations. * - * Note: Should be called for all API routines that modify file + * Note: Should be called for all API routines that modify file * file metadata but don't pass in an access property list. * * Return: Non-negative on success / Negative on failure diff --git a/src/H5Cimage.c b/src/H5Cimage.c index 26b6506..bdab1a3 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -1139,22 +1139,22 @@ H5C__load_cache_image(H5F_t *f) */ if(H5F_addr_defined(cache_ptr->image_addr)) { /* Sanity checks */ - HDassert(cache_ptr->image_len > 0); + HDassert(cache_ptr->image_len > 0); HDassert(cache_ptr->image_buffer == NULL); - /* Allocate space for the image */ + /* Allocate space for the image */ if(NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer") - /* Load the image from file */ - if(H5C__read_cache_image(f, cache_ptr) < 0) + /* Load the image from file */ + if(H5C__read_cache_image(f, cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block") - /* Reconstruct cache contents, from image */ - if(H5C__reconstruct_cache_contents(f, cache_ptr) < 0) + /* Reconstruct cache contents, from image */ + if(H5C__reconstruct_cache_contents(f, cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "Can't reconstruct cache contents from image block") - /* Free the image buffer */ + /* Free the image buffer */ cache_ptr->image_buffer = H5MM_xfree(cache_ptr->image_buffer); /* Update stats -- must do this now, as we are about diff --git a/src/H5Ctag.c b/src/H5Ctag.c index 66aedd9..0f08ede 100644 --- a/src/H5Ctag.c +++ b/src/H5Ctag.c @@ -471,7 +471,7 @@ H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx) if(H5C__flush_single_entry(ctx->f, entry, H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Entry eviction failed.") ctx->evicted_entries_last_pass = TRUE; - } /* end else-if */ + } else ctx->skipped_pf_dirty_entries = TRUE; diff --git a/src/H5F.c b/src/H5F.c index 65fbc9e..68bdfd3 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -21,20 +21,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tprivate.h" /* Datatypes */ /****************/ @@ -76,10 +76,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* File ID class */ static const H5I_class_t H5I_FILE_CLS[1] = {{ - H5I_FILE, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ + H5I_FILE, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ }}; @@ -113,16 +113,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_term_package + * Function: H5F_term_package * - * Purpose: Terminate this interface: free all memory and reset global - * variables to their initial values. Release all ID groups - * associated with this interface. + * Purpose: Terminate this interface: free all memory and reset global + * variables to their initial values. Release all ID groups + * associated with this interface. + * + * Return: Success: Positive if anything was done that might + * have affected other interfaces; + * zero otherwise. + * + * Failure: Never fails * - * Return: Success: Positive if anything was done that might - * have affected other interfaces; - * zero otherwise. - * Failure: Never fails. *------------------------------------------------------------------------- */ int @@ -155,35 +157,38 @@ H5F_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Fget_create_plist + * Function: H5Fget_create_plist * - * Purpose: Get an atom for a copy of the file-creation property list for - * this file. This function returns an atom with a copy of the - * properties used to create a file. + * Purpose: Get an atom for a copy of the file-creation property list for + * this file. This function returns an atom with a copy of the + * properties used to create a file. + * + * Return: Success: Object ID for a copy of the file creation + * property list. + * + * Failure: H5I_INVALID_HID * - * Return: Success: template ID - * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5Fget_create_plist(hid_t file_id) { - H5F_t *file; /* File info */ - H5P_genplist_t *plist; /* Property list */ - hid_t ret_value; /* Return value */ + H5F_t *file; /* File info */ + H5P_genplist_t *plist; /* Property list */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") if(NULL == (plist = (H5P_genplist_t *)H5I_object(file->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") - /* Create the property list object to return */ + /* Retrieve the file creation property list */ if((ret_value = H5P_copy_plist(plist, TRUE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file creation properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") done: FUNC_LEAVE_API(ret_value) @@ -191,37 +196,39 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_access_plist + * Function: H5Fget_access_plist * - * Purpose: Returns a copy of the file access property list of the - * specified file. + * Purpose: Returns a copy of the file access property list of the + * specified file. * * NOTE: Make sure that, if you are going to overwrite * information in the copied property list that was * previously opened and assigned to the property list, then * you must close it before overwriting the values. * - * Return: Success: Object ID for a copy of the file access - * property list. - * Failure: FAIL + * Return: Success: Object ID for a copy of the file access + * property list. + * + * Failure: H5I_INVALID_HID + * *------------------------------------------------------------------------- */ hid_t H5Fget_access_plist(hid_t file_id) { - H5F_t *f; /* File info */ - hid_t ret_value; /* Return value */ + H5F_t *file; /* File info */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* Check args */ - if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file's access property list */ - if((ret_value = H5F_get_access_plist(f, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list") + if((ret_value = H5F_get_access_plist(file, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") done: FUNC_LEAVE_API(ret_value) @@ -309,30 +316,30 @@ done: * Purpose: Returns a pointer to the file handle of the low-level file * driver. * - * Return: Success: non-negative value. - * Failure: negative. + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t -H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle) +H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) { - H5F_t *file; /* File to query */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ii**x", file_id, fapl, file_handle); + H5TRACE3("e", "ii**x", file_id, fapl_id, file_handle); /* Check args */ if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer") - /* Get the file */ + /* Get the file object */ 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_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5F_get_vfd_handle(file, fapl, file_handle) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") + if(H5F_get_vfd_handle(file, fapl_id, file_handle) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: FUNC_LEAVE_API(ret_value) @@ -340,16 +347,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fis_hdf5 + * Function: H5Fis_hdf5 * - * Purpose: Check the file signature to detect an HDF5 file. + * Purpose: Check the file signature to detect an HDF5 file. * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. + * Bugs: This function is not robust: it only uses the default file + * driver when attempting to open the file when in fact it + * should use all known file drivers. + * + * Return: TRUE/FALSE/FAIL * - * Return: Success: TRUE/FALSE - * Failure: Negative *------------------------------------------------------------------------- */ htri_t @@ -360,7 +367,7 @@ H5Fis_hdf5(const char *name) FUNC_ENTER_API(FAIL) H5TRACE1("t", "*s", name); - /* Check args and all the boring stuff. */ + /* Check args */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") @@ -394,37 +401,39 @@ done: * the list of file creation and file access properties. * * Return: Success: A file ID - * Failure: FAIL + * + * Failure: H5I_INVALID_HID + * *------------------------------------------------------------------------- */ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5F_t *new_file = NULL; /* file struct for new file */ - hid_t ret_value; /* return value */ + H5F_t *new_file = NULL; /* file struct for new file */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); /* Check/fix arguments */ - if (!filename || !*filename) + if(!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name") /* In this routine, we only accept the following flags: * H5F_ACC_EXCL, H5F_ACC_TRUNC and H5F_ACC_SWMR_WRITE */ - if (flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) + if(flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid flags") /* The H5F_ACC_EXCL and H5F_ACC_TRUNC flags are mutually exclusive */ - if ((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) + if((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "mutually exclusive flags for file creation") /* Check file creation property list */ - if (H5P_DEFAULT == fcpl_id) + if(H5P_DEFAULT == fcpl_id) fcpl_id = H5P_FILE_CREATE_DEFAULT; else - if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) + if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not file create property list") /* Verify access property list and set up collective metadata if appropriate */ @@ -435,7 +444,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * the EXCL or TRUNC bit is set. All newly-created files are opened for * reading and writing. */ - if (0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC))) + if(0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC))) flags |= H5F_ACC_EXCL; /*default*/ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; @@ -444,7 +453,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ - if ((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) + if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file") /* Keep this ID in file object structure */ diff --git a/src/H5FApkg.h b/src/H5FApkg.h index 6ce899e..8f76fc9 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -275,8 +275,7 @@ H5_DLL herr_t H5FA__hdr_decr(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr); H5_DLL size_t H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_modified(H5FA_hdr_t *hdr); -H5_DLL H5FA_hdr_t *H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, - unsigned flags); +H5_DLL H5FA_hdr_t *H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags); H5_DLL herr_t H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags); H5_DLL herr_t H5FA__hdr_delete(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_dest(H5FA_hdr_t *hdr); @@ -285,8 +284,7 @@ H5_DLL herr_t H5FA__hdr_dest(H5FA_hdr_t *hdr); H5_DLL H5FA_dblock_t *H5FA__dblock_alloc(H5FA_hdr_t *hdr); H5_DLL haddr_t H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty); H5_DLL unsigned H5FA__dblock_sblk_idx(const H5FA_hdr_t *hdr, hsize_t idx); -H5_DLL H5FA_dblock_t *H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, - unsigned flags); +H5_DLL H5FA_dblock_t *H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags); H5_DLL herr_t H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags); H5_DLL herr_t H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr); H5_DLL herr_t H5FA__dblock_dest(H5FA_dblock_t *dblock); @@ -294,16 +292,13 @@ H5_DLL herr_t H5FA__dblock_dest(H5FA_dblock_t *dblock); /* Data block page routines */ H5_DLL herr_t H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts); H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts); -H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, - size_t dblk_page_nelmts, unsigned flags); +H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts, unsigned flags); H5_DLL herr_t H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags); H5_DLL herr_t H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page); /* Debugging routines for dumping file structures */ -H5_DLL herr_t H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, - int fwidth, const H5FA_class_t *cls, haddr_t obj_addr); -H5_DLL herr_t H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, - int indent, int fwidth, const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr); +H5_DLL herr_t H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t obj_addr); +H5_DLL herr_t H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr); /* Testing routines */ #ifdef H5FA_TESTING diff --git a/src/H5Fquery.c b/src/H5Fquery.c index be24072..2500ea8 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -277,11 +277,11 @@ H5F_get_nopen_objs(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_file_id + * Function: H5F_get_file_id * - * Purpose: Retrieve the file's 'file_id' value + * Purpose: Retrieve the file's 'file_id' value * - * Return: 'file_id' on success/abort on failure (shouldn't fail) + * Return: 'file_id' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hid_t diff --git a/src/H5HF.c b/src/H5HF.c index b7a6244..3df7e7b 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -167,7 +167,7 @@ H5HF_create(H5F_t *f, const H5HF_create_t *cparam) /* Create shared fractal heap header */ if(HADDR_UNDEF == (fh_addr = H5HF_hdr_create(f, cparam))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header") /* Allocate fractal heap wrapper */ if(NULL == (fh = H5FL_MALLOC(H5HF_t))) diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 70dfeed..fc437dc 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -395,7 +395,7 @@ H5HF_hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* Print the information about the heap's header */ H5HF_hdr_print(hdr, FALSE, stream, indent, fwidth); @@ -531,13 +531,13 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, hdr_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* * Load the heap direct block */ if(NULL == (dblock = H5HF__man_dblock_protect(hdr, addr, block_size, NULL, 0, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap direct block") /* Print opening message */ HDfprintf(stream, "%*sFractal Heap Direct Block...\n", indent, ""); @@ -788,13 +788,13 @@ H5HF_iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, hdr_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* * Load the heap indirect block */ if(NULL == (iblock = H5HF__man_iblock_protect(hdr, addr, nrows, NULL, 0, FALSE, H5AC__READ_ONLY_FLAG, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block") /* Print the information about the heap's indirect block */ H5HF_iblock_print(iblock, FALSE, stream, indent, fwidth); @@ -878,8 +878,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, - int fwidth) +H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, int fwidth) { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ herr_t ret_value = SUCCEED; /* Return value */ @@ -897,7 +896,7 @@ H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, fh_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* Initialize the free space information for the heap */ if(H5HF__space_start(hdr, FALSE) < 0) diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 8166d88..b014017 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -484,7 +484,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* Second phase of header final initialization */ /* (needs ID and filter lengths set up) */ if(H5HF_hdr_finish_init_phase2(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #2 of header final initialization") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #2 of header final initialization") /* Extra checking for possible gap between max. direct block size minus * overhead and "huge" object size */ @@ -494,11 +494,11 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* Allocate space for the header on disk */ if(HADDR_UNDEF == (hdr->heap_addr = H5MF_alloc(f, H5FD_MEM_FHEAP_HDR, (hsize_t)hdr->heap_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header") /* Cache the new fractal heap header */ if(H5AC_insert_entry(f, H5AC_FHEAP_HDR, hdr->heap_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache") /* Set address of heap header to return */ ret_value = hdr->heap_addr; diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index e5c2559..20a62b7 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -256,52 +256,52 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock) /* Check for last reference to block */ if(iblock->rc == 0) { - /* If this indirect block has a parent, reset it's child iblock pointer */ - if(iblock->parent) { - H5HF_indirect_t *par_iblock = iblock->parent; /* Parent indirect block */ - unsigned indir_idx; /* Index in parent's child iblock pointer array */ - - /* Sanity check */ - HDassert(par_iblock->child_iblocks); - HDassert(iblock->par_entry >= (iblock->hdr->man_dtable.max_direct_rows - * iblock->hdr->man_dtable.cparam.width)); - - /* Compute index in parent's child iblock pointer array */ - indir_idx = iblock->par_entry - (iblock->hdr->man_dtable.max_direct_rows - * iblock->hdr->man_dtable.cparam.width); - - /* Reset pointer to pinned child indirect block in parent */ - HDassert(par_iblock->child_iblocks[indir_idx]); - par_iblock->child_iblocks[indir_idx] = NULL; - } /* end if */ - else { - /* Check for root indirect block */ - if(iblock->block_off == 0) { - /* Sanity check - shouldn't be recursively unpinning root indirect block */ - HDassert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED); - - /* Check if we should reset the root iblock pointer */ - if(H5HF_ROOT_IBLOCK_PINNED == iblock->hdr->root_iblock_flags) { - HDassert(NULL != iblock->hdr->root_iblock); - iblock->hdr->root_iblock = NULL; - } /* end if */ - - /* Indicate that the root indirect block is unpinned */ - iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED)); - } /* end if */ - } /* end else */ - - /* Check if the block is still in the cache */ - if(!iblock->removed_from_cache) { - /* Unpin the indirect block, making it evictable again */ - if(H5HF__iblock_unpin(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") - } /* end if */ - else { - /* Destroy the indirect block */ - if(H5HF_man_iblock_dest(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") - } /* end else */ + /* If this indirect block has a parent, reset it's child iblock pointer */ + if(iblock->parent) { + H5HF_indirect_t *par_iblock = iblock->parent; /* Parent indirect block */ + unsigned indir_idx; /* Index in parent's child iblock pointer array */ + + /* Sanity check */ + HDassert(par_iblock->child_iblocks); + HDassert(iblock->par_entry >= (iblock->hdr->man_dtable.max_direct_rows + * iblock->hdr->man_dtable.cparam.width)); + + /* Compute index in parent's child iblock pointer array */ + indir_idx = iblock->par_entry - (iblock->hdr->man_dtable.max_direct_rows + * iblock->hdr->man_dtable.cparam.width); + + /* Reset pointer to pinned child indirect block in parent */ + HDassert(par_iblock->child_iblocks[indir_idx]); + par_iblock->child_iblocks[indir_idx] = NULL; + } /* end if */ + else { + /* Check for root indirect block */ + if(iblock->block_off == 0) { + /* Sanity check - shouldn't be recursively unpinning root indirect block */ + HDassert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED); + + /* Check if we should reset the root iblock pointer */ + if(H5HF_ROOT_IBLOCK_PINNED == iblock->hdr->root_iblock_flags) { + HDassert(NULL != iblock->hdr->root_iblock); + iblock->hdr->root_iblock = NULL; + } /* end if */ + + /* Indicate that the root indirect block is unpinned */ + iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED)); + } /* end if */ + } /* end else */ + + /* Check if the block is still in the cache */ + if(!iblock->removed_from_cache) { + /* Unpin the indirect block, making it evictable again */ + if(H5HF__iblock_unpin(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") + } /* end if */ + else { + /* Destroy the indirect block */ + if(H5HF_man_iblock_dest(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") + } /* end else */ } /* end if */ done: @@ -408,13 +408,13 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) dblock->parent = iblock; dblock->par_entry = 0; - /* Destroy flush dependency between direct block and header */ - if(H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) + /* Destroy flush dependency between direct block and header */ + if(H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") dblock->fd_parent = NULL; - /* Create flush dependency between direct block and new root indirect block */ - if(H5AC_create_flush_dependency(iblock, dblock) < 0) + /* Create flush dependency between direct block and new root indirect block */ + if(H5AC_create_flush_dependency(iblock, dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") dblock->fd_parent = iblock; @@ -1059,14 +1059,14 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, iblock->block_off += hdr->man_dtable.row_block_off[par_entry / hdr->man_dtable.cparam.width]; iblock->block_off += hdr->man_dtable.row_block_size[par_entry / hdr->man_dtable.cparam.width] * (par_entry % hdr->man_dtable.cparam.width); - /* Set indirect block parent as flush dependency parent */ - iblock->fd_parent = par_iblock; + /* Set indirect block parent as flush dependency parent */ + iblock->fd_parent = par_iblock; } /* end if */ else { iblock->block_off = 0; /* Must be the root indirect block... */ - /* Set heap header as flush dependency parent */ - iblock->fd_parent = hdr; + /* Set heap header as flush dependency parent */ + iblock->fd_parent = hdr; } /* end else */ /* Update indirect block's statistics */ @@ -1430,69 +1430,69 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) if(H5HF__man_iblock_root_revert(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't convert root indirect block back to root direct block") - /* If the indirect block wasn't removed already (by reverting it) */ - if(!iblock->removed_from_cache) { - /* Check for reducing size of root indirect block */ - if(iblock->nchildren > 0 && hdr->man_dtable.cparam.start_root_rows != 0 - && entry > iblock->max_child) { - unsigned max_child_row; /* Row for max. child entry */ - - /* Compute information needed for determining whether to reduce size of root indirect block */ - max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; - - /* Check if the root indirect block should be reduced */ - if(iblock->nrows > 1 && max_child_row <= (iblock->nrows / 2)) - if(H5HF__man_iblock_root_halve(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce size of root indirect block") - } /* end if */ - } /* end if */ + /* If the indirect block wasn't removed already (by reverting it) */ + if(!iblock->removed_from_cache) { + /* Check for reducing size of root indirect block */ + if(iblock->nchildren > 0 && hdr->man_dtable.cparam.start_root_rows != 0 + && entry > iblock->max_child) { + unsigned max_child_row; /* Row for max. child entry */ + + /* Compute information needed for determining whether to reduce size of root indirect block */ + max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; + + /* Check if the root indirect block should be reduced */ + if(iblock->nrows > 1 && max_child_row <= (iblock->nrows / 2)) + if(H5HF__man_iblock_root_halve(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce size of root indirect block") + } /* end if */ + } /* end if */ } /* end if */ /* If the indirect block wasn't removed already (by reverting it) */ if(!iblock->removed_from_cache) { - /* Mark indirect block as modified */ - if(H5HF_iblock_dirty(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") - - /* Check for last child being removed from indirect block */ - if(iblock->nchildren == 0) { - hbool_t did_protect = FALSE; /* Whether the indirect block was protected */ - - /* If this indirect block's refcount is >1, then it's being deleted - * from the fractal heap (since its nchildren == 0), but is still - * referred to from free space sections in the heap (refcount >1). - * Its space in the file needs to be freed now, and it also needs - * to be removed from the metadata cache now, in case the space in - * the file is reused by another piece of metadata that is inserted - * into the cache before the indirect block's entry is evicted - * (having two entries at the same address would be an error, from - * the cache's perspective). - */ - /* Lock indirect block for deletion */ - if(NULL == (del_iblock = H5HF__man_iblock_protect(hdr, iblock->addr, iblock->nrows, iblock->parent, iblock->par_entry, TRUE, H5AC__NO_FLAGS_SET, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") - HDassert(did_protect == TRUE); - - /* Check for deleting root indirect block (and no root direct block) */ - if(iblock->block_off == 0 && hdr->man_dtable.curr_root_rows > 0) - /* Reset header information back to "empty heap" state */ - if(H5HF__hdr_empty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty") - - /* Detach from parent indirect block */ - if(iblock->parent) { - /* Destroy flush dependency between indirect block and parent */ - if(H5AC_destroy_flush_dependency(iblock->fd_parent, iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") - iblock->fd_parent = NULL; - - /* Detach from parent indirect block */ - if(H5HF__man_iblock_detach(iblock->parent, iblock->par_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block") - iblock->parent = NULL; - iblock->par_entry = 0; - } /* end if */ - } /* end if */ + /* Mark indirect block as modified */ + if(H5HF_iblock_dirty(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") + + /* Check for last child being removed from indirect block */ + if(iblock->nchildren == 0) { + hbool_t did_protect = FALSE; /* Whether the indirect block was protected */ + + /* If this indirect block's refcount is >1, then it's being deleted + * from the fractal heap (since its nchildren == 0), but is still + * referred to from free space sections in the heap (refcount >1). + * Its space in the file needs to be freed now, and it also needs + * to be removed from the metadata cache now, in case the space in + * the file is reused by another piece of metadata that is inserted + * into the cache before the indirect block's entry is evicted + * (having two entries at the same address would be an error, from + * the cache's perspective). + */ + /* Lock indirect block for deletion */ + if(NULL == (del_iblock = H5HF__man_iblock_protect(hdr, iblock->addr, iblock->nrows, iblock->parent, iblock->par_entry, TRUE, H5AC__NO_FLAGS_SET, &did_protect))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") + HDassert(did_protect == TRUE); + + /* Check for deleting root indirect block (and no root direct block) */ + if(iblock->block_off == 0 && hdr->man_dtable.curr_root_rows > 0) + /* Reset header information back to "empty heap" state */ + if(H5HF__hdr_empty(hdr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty") + + /* Detach from parent indirect block */ + if(iblock->parent) { + /* Destroy flush dependency between indirect block and parent */ + if(H5AC_destroy_flush_dependency(iblock->fd_parent, iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + iblock->fd_parent = NULL; + + /* Detach from parent indirect block */ + if(H5HF__man_iblock_detach(iblock->parent, iblock->par_entry) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block") + iblock->parent = NULL; + iblock->par_entry = 0; + } /* end if */ + } /* end if */ } /* end if */ /* Decrement the reference count on this indirect block if we're not deleting it */ @@ -1501,48 +1501,48 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) * not being deleted) */ if(H5HF__iblock_decr(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") iblock = NULL; /* Delete indirect block from cache, if appropriate */ if(del_iblock) { - unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotect */ - hbool_t took_ownership = FALSE; /* Flag to indicate that block ownership has transitioned */ - - /* If the refcount is still >0, unpin the block and take ownership - * from the cache, otherwise let the cache destroy it. - */ - if(del_iblock->rc > 0) { - cache_flags |= (H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG); - cache_flags |= H5AC__UNPIN_ENTRY_FLAG; - took_ownership = TRUE; - } /* end if */ - else { - /* Entry should be removed from the cache */ - cache_flags |= H5AC__DELETED_FLAG; - - /* If the indirect block is in real file space, tell - * the cache to free its file space as well. - */ - if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) - cache_flags |= H5AC__FREE_FILE_SPACE_FLAG; - } /* end else */ - - /* Unprotect the indirect block, with appropriate flags */ - if(H5HF__man_iblock_unprotect(del_iblock, cache_flags, TRUE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") - - /* if took ownership, free file space & mark block as removed from cache */ - if(took_ownership) { - /* Free indirect block disk space, if it's in real space */ - if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) - if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, del_iblock->addr, (hsize_t)del_iblock->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") - del_iblock->addr = HADDR_UNDEF; - - /* Mark block as removed from the cache */ - del_iblock->removed_from_cache = TRUE; - } /* end if */ + unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotect */ + hbool_t took_ownership = FALSE; /* Flag to indicate that block ownership has transitioned */ + + /* If the refcount is still >0, unpin the block and take ownership + * from the cache, otherwise let the cache destroy it. + */ + if(del_iblock->rc > 0) { + cache_flags |= (H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG); + cache_flags |= H5AC__UNPIN_ENTRY_FLAG; + took_ownership = TRUE; + } /* end if */ + else { + /* Entry should be removed from the cache */ + cache_flags |= H5AC__DELETED_FLAG; + + /* If the indirect block is in real file space, tell + * the cache to free its file space as well. + */ + if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) + cache_flags |= H5AC__FREE_FILE_SPACE_FLAG; + } /* end else */ + + /* Unprotect the indirect block, with appropriate flags */ + if(H5HF__man_iblock_unprotect(del_iblock, cache_flags, TRUE) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + + /* if took ownership, free file space & mark block as removed from cache */ + if(took_ownership) { + /* Free indirect block disk space, if it's in real space */ + if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) + if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, del_iblock->addr, (hsize_t)del_iblock->size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") + del_iblock->addr = HADDR_UNDEF; + + /* Mark block as removed from the cache */ + del_iblock->removed_from_cache = TRUE; + } /* end if */ } /* end if */ done: @@ -1633,24 +1633,24 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, if(H5F_addr_defined(iblock->ents[entry].addr)) { /* Are we in a direct or indirect block row */ if(row < hdr->man_dtable.max_direct_rows) { - hsize_t dblock_size; /* Size of direct block on disk */ + hsize_t dblock_size; /* Size of direct block on disk */ - /* Check for I/O filters on this heap */ - if(hdr->filter_len > 0) - dblock_size = iblock->filt_ents[entry].size; - else - dblock_size = hdr->man_dtable.row_block_size[row]; + /* Check for I/O filters on this heap */ + if(hdr->filter_len > 0) + dblock_size = iblock->filt_ents[entry].size; + else + dblock_size = hdr->man_dtable.row_block_size[row]; /* Delete child direct block */ if(H5HF__man_dblock_delete(hdr->f, iblock->ents[entry].addr, dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap child direct block") } /* end if */ else { - hsize_t row_block_size; /* The size of blocks in this row */ + hsize_t row_block_size; /* The size of blocks in this row */ unsigned child_nrows; /* Number of rows in new indirect block */ - /* Get the row's block size */ - row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row]; + /* Get the row's block size */ + row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row]; /* Compute # of rows in next child indirect block to use */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, row_block_size); @@ -1733,30 +1733,30 @@ H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr, /* Indirect entries in this indirect block */ if(iblock->nrows > hdr->man_dtable.max_direct_rows) { - unsigned first_row_bits; /* Number of bits used bit addresses in first row */ + unsigned first_row_bits; /* Number of bits used bit addresses in first row */ unsigned num_indirect_rows; /* Number of rows of blocks in each indirect block */ unsigned entry; /* Current entry in row */ size_t u; /* Local index variable */ entry = hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width; - first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + - H5VM_log2_of2(hdr->man_dtable.cparam.width); + first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + + H5VM_log2_of2(hdr->man_dtable.cparam.width); num_indirect_rows = - (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; + (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++, num_indirect_rows++) { size_t v; /* Local index variable */ - for(v = 0; v < hdr->man_dtable.cparam.width; v++, entry++) - if(H5F_addr_defined(iblock->ents[entry].addr)) - if(H5HF__man_iblock_size(f, hdr, iblock->ents[entry].addr, num_indirect_rows, iblock, entry, heap_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to get fractal heap storage info for indirect block") + for(v = 0; v < hdr->man_dtable.cparam.width; v++, entry++) + if(H5F_addr_defined(iblock->ents[entry].addr)) + if(H5HF__man_iblock_size(f, hdr, iblock->ents[entry].addr, num_indirect_rows, iblock, entry, heap_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to get fractal heap storage info for indirect block") } /* end for */ } /* end if */ done: /* Release the indirect block */ if(iblock && H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") iblock = NULL; FUNC_LEAVE_NOAPI(ret_value) @@ -1810,17 +1810,17 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, */ prev_par_block_off = par_block_off = 0; while(row >= hdr->man_dtable.max_direct_rows) { - /* Retain previous parent block offset */ - prev_par_block_off = par_block_off; + /* Retain previous parent block offset */ + prev_par_block_off = par_block_off; /* Compute the new parent indirect block's offset in the heap's address space */ /* (based on previous block offset) */ par_block_off += hdr->man_dtable.row_block_off[row]; par_block_off += hdr->man_dtable.row_block_size[row] * col; - /* Preserve current row & column */ - prev_row = row; - prev_col = col; + /* Preserve current row & column */ + prev_row = row; + prev_col = col; /* Look up row & column in new indirect block for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, (block_off - par_block_off), &row, &col) < 0) diff --git a/src/H5HFman.c b/src/H5HFman.c index 394bcff..7f90f49 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -140,6 +140,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) /* Check for row section */ if(sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || sec_node->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW) { + /* Allocate 'single' selection out of 'row' selection */ if(H5HF__man_iblock_alloc_row(hdr, &sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't break up row section") diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h index 5086afb..587a8fc 100644 --- a/src/H5HFprivate.h +++ b/src/H5HFprivate.h @@ -110,15 +110,13 @@ H5_DLL H5HF_t *H5HF_create(H5F_t *f, const H5HF_create_t *cparam); H5_DLL H5HF_t *H5HF_open(H5F_t *f, haddr_t fh_addr); H5_DLL herr_t H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p/*out*/); H5_DLL herr_t H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr/*out*/); -H5_DLL herr_t H5HF_insert(H5HF_t *fh, size_t size, const void *obj, - void *id/*out*/); +H5_DLL herr_t H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id/*out*/); H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, const void *id, size_t *obj_len_p/*out*/); H5_DLL herr_t H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p/*out*/); H5_DLL herr_t H5HF_read(H5HF_t *fh, const void *id, void *obj/*out*/); H5_DLL herr_t H5HF_write(H5HF_t *fh, void *id, hbool_t *id_changed, const void *obj); -H5_DLL herr_t H5HF_op(H5HF_t *fh, const void *id, H5HF_operator_t op, - void *op_data); +H5_DLL herr_t H5HF_op(H5HF_t *fh, const void *id, H5HF_operator_t op, void *op_data); H5_DLL herr_t H5HF_remove(H5HF_t *fh, const void *id); H5_DLL herr_t H5HF_close(H5HF_t *fh); H5_DLL herr_t H5HF_delete(H5F_t *f, haddr_t fh_addr); @@ -128,11 +126,9 @@ H5_DLL herr_t H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats); H5_DLL herr_t H5HF_size(const H5HF_t *fh, hsize_t *heap_size/*out*/); /* Debugging routines */ -H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, - int indent, int fwidth); +H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, int indent, int fwidth); #ifdef H5HF_DEBUGGING -H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, - int fwidth); +H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth); #endif /* H5HF_DEBUGGING */ #endif /* _H5HFprivate_H */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 66c8414..36e966e 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -692,8 +692,7 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, *------------------------------------------------------------------------- */ herr_t -H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - size_t amt) +H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, size_t amt) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2094,8 +2093,7 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *------------------------------------------------------------------------- */ static herr_t -H5HF__sect_row_debug(const H5FS_section_info_t *_sect, - FILE *stream, int indent, int fwidth) +H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, int fwidth) { const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Section to dump info */ @@ -2666,8 +2664,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, - unsigned start_entry, unsigned nentries) +H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ H5HF_free_section_t *first_row_sect = NULL; /* First row section in new indirect section */ @@ -2841,8 +2838,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - H5HF_indirect_t *sect_iblock) +H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_indirect_t *sect_iblock) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 5260ae2..37a0502 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -311,7 +311,7 @@ H5HF__space_revert_root(const H5HF_hdr_t *hdr) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) - /* Iterate over all sections, resetting the parent pointers in 'single' sections */ + /* Iterate over all sections, resetting the parent pointers in 'single' sections */ if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_revert_root_cb, NULL) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to reset parent pointers") @@ -404,7 +404,7 @@ H5HF__space_create_root(const H5HF_hdr_t *hdr, H5HF_indirect_t *root_iblock) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) - /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */ + /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */ if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_create_root_cb, root_iblock) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to set parent pointers") @@ -602,8 +602,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - uint16_t new_class) +H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, uint16_t new_class) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HG.c b/src/H5HG.c index 53f1b2a..b9d8dc3 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -83,7 +83,7 @@ /********************/ static haddr_t H5HG__create(H5F_t *f, size_t size); - +static size_t H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr); /*********************/ /* Package Variables */ @@ -204,11 +204,11 @@ H5HG__create(H5F_t *f, size_t size) /* Add this heap to the beginning of the CWFS list */ if(H5F_cwfs_add(f, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to add global heap collection to file's CWFS") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to add global heap collection to file's CWFS") /* Add the heap to the cache */ if(H5AC_insert_entry(f, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection") ret_value = addr; @@ -223,7 +223,7 @@ done: /* Check if the heap object was allocated */ if(heap) /* Destroy the heap object */ - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy global heap collection") } /* end if */ } /* end if */ @@ -275,7 +275,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HG_alloc + * Function: H5HG__alloc * * Purpose: Given a heap with enough free space, this function will split * the free space to make a new empty heap object and initialize @@ -293,14 +293,14 @@ done: *------------------------------------------------------------------------- */ static size_t -H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) +H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) { size_t idx; uint8_t *p; size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(heap); @@ -363,27 +363,27 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) heap->obj[0].begin = NULL; } /* end if */ else if(heap->obj[0].size-need >= H5HG_SIZEOF_OBJHDR (f)) { - /* - * Some free space remains and it's larger than a heap object header, - * so write the new free heap object header to the heap. - */ - heap->obj[0].size -= need; - heap->obj[0].begin += need; - p = heap->obj[0].begin; - UINT16ENCODE(p, 0); /*id*/ - UINT16ENCODE(p, 0); /*nrefs*/ - UINT32ENCODE(p, 0); /*reserved*/ - H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + /* + * Some free space remains and it's larger than a heap object header, + * so write the new free heap object header to the heap. + */ + heap->obj[0].size -= need; + heap->obj[0].begin += need; + p = heap->obj[0].begin; + UINT16ENCODE(p, 0); /*id*/ + UINT16ENCODE(p, 0); /*nrefs*/ + UINT32ENCODE(p, 0); /*reserved*/ + H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); + HDassert(H5HG_ISALIGNED(heap->obj[0].size)); } /* end else-if */ else { - /* - * Some free space remains but it's smaller than a heap object header, - * so we don't write the header. - */ - heap->obj[0].size -= need; - heap->obj[0].begin += need; - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + /* + * Some free space remains but it's smaller than a heap object header, + * so we don't write the header. + */ + heap->obj[0].size -= need; + heap->obj[0].begin += need; + HDassert(H5HG_ISALIGNED(heap->obj[0].size)); } /* Mark the heap as dirty */ @@ -394,7 +394,7 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) done: FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HG_alloc() */ +} /* end H5HG__alloc() */ /*------------------------------------------------------------------------- @@ -522,7 +522,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) HDassert(hobj); if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") /* Find a large enough collection on the CWFS list */ need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); @@ -548,7 +548,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") /* Split the free space to make room for the new object */ - if(0 == (idx = H5HG_alloc(f, heap, size, &heap_flags))) + if(0 == (idx = H5HG__alloc(f, heap, size, &heap_flags))) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate global heap object") /* Copy data into the heap */ @@ -608,7 +608,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size) /* Load the heap */ if(NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap") HDassert(hobj->idx < heap->nused); HDassert(heap->obj[hobj->idx].begin); @@ -617,7 +617,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size) /* Allocate a buffer for the object read in, if the user didn't give one */ if(!object && NULL == (object = H5MM_malloc(size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(object, p, size); /* @@ -678,7 +678,7 @@ H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust) HDassert(f); HDassert(hobj); if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") /* Load the heap */ if(NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__NO_FLAGS_SET))) @@ -839,11 +839,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5HG_free + * Function: H5HG__free * - * Purpose: Destroys a global heap collection in memory + * Purpose: Destroys a global heap collection in memory * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, January 15, 2003 @@ -851,7 +851,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HG_free(H5HG_heap_t *heap) +H5HG__free(H5HG_heap_t *heap) { herr_t ret_value = SUCCEED; /* Return value */ @@ -872,5 +872,5 @@ H5HG_free(H5HG_heap_t *heap) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HG_free() */ +} /* H5HG__free() */ diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 3a770ae..beaea7b 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -374,7 +374,7 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata, done: if(!ret_value && heap) - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection") FUNC_LEAVE_NOAPI(ret_value) @@ -485,7 +485,7 @@ H5HG__cache_heap_free_icr(void *_thing) HDassert(heap->cache_info.type == H5AC_GHEAP); /* Destroy global heap collection */ - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy global heap collection") done: diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index a735ba0..4ed9b10 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -137,7 +137,7 @@ struct H5HG_heap_t { /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5HG_free(H5HG_heap_t *heap); +H5_DLL herr_t H5HG__free(H5HG_heap_t *heap); H5_DLL H5HG_heap_t *H5HG__protect(H5F_t *f, haddr_t addr, unsigned flags); #endif /* _H5HGpkg_H */ diff --git a/src/H5I.c b/src/H5I.c index 3cf592d..6cb1947 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -144,7 +144,7 @@ static herr_t H5I__debug(H5I_type_t type); * Return: Success: Positive if any action was taken that might * affect some other interface; zero otherwise. * - * Failure: Negative. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -2032,8 +2032,8 @@ done: /*------------------------------------------------------------------------- * Function: H5Iget_file_id * - * Purpose: The public version of H5I_get_file_id(), obtains the file - * ID given an object ID. User has to close this ID. + * Purpose: Obtains the file ID given an object ID. The user has to + * close this ID. * * Return: Success: The file ID associated with the object * diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index e6fd37c..7bdb001 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -41,10 +41,10 @@ #define H5L_SAME_LOC (hid_t)0 /* Current version of the H5L_class_t struct */ -#define H5L_LINK_CLASS_T_VERS 1 +#define H5L_LINK_CLASS_T_VERS 1 /* Previous versions of the H5L_class_t struct */ -#define H5L_LINK_CLASS_T_VERS_0 0 +#define H5L_LINK_CLASS_T_VERS_0 0 #ifdef __cplusplus extern "C" { diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index b57eaf6..fa57862 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -1541,7 +1541,7 @@ H5O_copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get attribute datatype") /* Check if the datatype is committed and search the skip list if so */ - if(H5T_committed(dt)) { + if(H5T_is_named(dt)) { /* Allocate key */ if(NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") @@ -1658,9 +1658,8 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, if(NULL == (key->dt = (H5T_t *)H5O_msg_read(obj_oloc, H5O_DTYPE_ID, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message") - /* Check if the datatype is committed and search the skip list if so - */ - if(H5T_committed(key->dt)) { + /* Check if the datatype is committed and search the skip list if so */ + if(H5T_is_named(key->dt)) { /* Get datatype object fileno */ H5F_GET_FILENO(obj_oloc->file, key->fileno); diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 8060398..b8eb4a7 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -1485,7 +1485,7 @@ H5O_dtype_can_share(const void *_mesg) HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is immutable") /* Don't share committed datatypes */ - if((tri_ret = H5T_committed(mesg)) > 0) + if((tri_ret = H5T_is_named(mesg)) > 0) HGOTO_DONE(FALSE) else if(tri_ret < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is shared") @@ -1619,14 +1619,15 @@ H5O__dtype_shared_post_copy_upd(const H5O_loc_t H5_ATTR_UNUSED *src_oloc, FUNC_ENTER_STATIC if(dt_dst->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { - HDassert(H5T_committed(dt_dst)); + HDassert(H5T_is_named(dt_dst)); if(H5O_loc_reset(&(dt_dst->oloc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to reset location") dt_dst->oloc.file = dt_dst->sh_loc.file; dt_dst->oloc.addr = dt_dst->sh_loc.u.loc.oh_addr; } /* end if */ - else - HDassert(!H5T_committed(dt_dst)); + else { + HDassert(!H5T_is_named(dt_dst)); + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5R.c b/src/H5R.c index 95abc32..65aa6cb 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -93,7 +93,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t { H5G_loc_t loc; /* File location */ H5S_t *space = NULL; /* Pointer to dataspace containing region */ - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id); @@ -101,17 +101,17 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t /* Check args */ if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - 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 (!name || !*name) + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if (ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION) + 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) && ref_type == H5R_DATASET_REGION) + if(space_id == (-1) && ref_type == H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid") - if (space_id != (-1) && (NULL == (space = (H5S_t *)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") /* Set up collective metadata if appropriate */ @@ -165,13 +165,13 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r H5TRACE4("i", "iiRt*x", obj_id, oapl_id, ref_type, _ref); /* Check args */ - if (H5G_loc(obj_id, &loc) < 0) + if(H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if (oapl_id < 0) + if(oapl_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") - if (_ref == NULL) + if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") /* Verify access property list and set up collective metadata if appropriate */ @@ -181,7 +181,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r /* Get the file pointer from the entry */ file = loc.oloc->file; - /* Create reference */ + /* Dereference */ if((ret_value = H5R__dereference(file, oapl_id, ref_type, _ref)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") @@ -224,11 +224,11 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) H5TRACE3("i", "iRt*x", id, ref_type, ref); /* Check args */ - if (H5G_loc(id, &loc) < 0) + if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if (ref_type != H5R_DATASET_REGION) + if(ref_type != H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") - if (ref == NULL) + if(ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") /* Get the dataspace with the correct region selected */ @@ -236,7 +236,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace") /* Atomize */ - if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) + if((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") done: @@ -278,14 +278,14 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type); /* Check args */ - if (H5G_loc(id, &loc) < 0) + if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if (ref == NULL) + if(ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - /* Get the object information */ + /* Get the object type */ if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") @@ -333,17 +333,17 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, { H5G_loc_t loc; /* Group location */ H5F_t *file; /* File object */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size); /* Check args */ - if (H5G_loc(id, &loc) < 0) + if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") - if (_ref == NULL) + if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer") /* Get the file pointer from the entry */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index fb62430..41765cf 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -37,12 +37,12 @@ #include "H5Ppublic.h" /* Property lists */ /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Oprivate.h" /* Object headers */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Oprivate.h" /* Object headers */ #include "H5Rpkg.h" /* References */ @@ -119,7 +119,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) /* Get the object information */ if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, &obj_type) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type") /* Set return value */ ret_value = H5G_map_obj_type(obj_type); @@ -166,9 +166,9 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) /* Get the file pointer from the entry */ file = loc.oloc->file; - /* Create reference */ + /* Dereference */ if((ret_value = H5R__dereference(file, H5P_DATASET_ACCESS_DEFAULT, ref_type, _ref)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, "unable dereference object") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Rint.c b/src/H5Rint.c index d2f315b..1bbe217 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -221,8 +221,7 @@ H5R_term_package(void) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, - H5S_t *space) +H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space) { H5G_loc_t obj_loc; /* Group hier. location of object */ H5G_name_t path; /* Object group hier. path */ @@ -371,8 +370,7 @@ done: Added a check for undefined reference pointer. --------------------------------------------------------------------------*/ hid_t -H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, - const void *_ref) +H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, const void *_ref) { H5O_loc_t oloc; /* Object location */ H5G_name_t path; /* Path of object */ @@ -459,7 +457,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_GROUP, group, TRUE)) < 0) { H5G_close(group); HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register group") - } /* end if */ + } break; } @@ -475,7 +473,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) { H5T_close(type); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register datatype") - } /* end if */ + } break; } @@ -492,7 +490,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) { H5D_close(dset); HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset") - } /* end if */ + } break; } @@ -536,7 +534,7 @@ H5R__get_region(H5F_t *file, const void *_ref) const uint8_t *p; /* Pointer to OID to store */ H5HG_t hobjid; /* Heap object ID */ uint8_t *buf = NULL; /* Buffer to store serialized selection in */ - H5S_t *ret_value; /* Return value */ + H5S_t *ret_value; /* Return value */ FUNC_ENTER_PACKAGE @@ -574,7 +572,7 @@ done: H5MM_xfree(buf); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R__get_region() */ +} /* end H5R__get_region() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index fbbff50..504d2af 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -50,15 +50,11 @@ /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, - H5R_type_t ref_type, H5S_t *space); -H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, - const void *_ref); +H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space); +H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, const void *_ref); H5_DLL H5S_t *H5R__get_region(H5F_t *file, const void *_ref); -H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, - const void *_ref, H5O_type_t *obj_type); -H5_DLL ssize_t H5R__get_name(H5F_t *file, hid_t id, H5R_type_t ref_type, - const void *_ref, char *name, size_t size); +H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type); +H5_DLL ssize_t H5R__get_name(H5F_t *file, hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size); #endif /* _H5Rpkg_H */ diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h index 8c0ba8f..1bf2e92 100644 --- a/src/H5Rprivate.h +++ b/src/H5Rprivate.h @@ -20,11 +20,6 @@ #include "H5Rpublic.h" /* Private headers needed by this file */ -#include "H5Fprivate.h" /* Files */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspaces */ - /**************************/ /* Library Private Macros */ @@ -45,6 +40,5 @@ /* Library Private Prototypes */ /******************************/ - #endif /* _H5Rprivate_H */ diff --git a/src/H5SM.c b/src/H5SM.c index 1bf6301..0fa3489 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -142,7 +142,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc) /* Initialize master table */ if(NULL == (table = H5FL_CALLOC(H5SM_master_table_t))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table") table->num_indexes = H5F_SOHM_NINDEXES(f); table->table_size = H5SM_TABLE_SIZE(f); @@ -209,11 +209,11 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc) /* Allocate space for the table on disk */ if(HADDR_UNDEF == (table_addr = H5MF_alloc(f, H5FD_MEM_SOHM_TABLE, (hsize_t)table->table_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table") /* Cache the new table */ if(H5AC_insert_entry(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache") /* Record the address of the master table in the file */ H5F_SET_SOHM_ADDR(f, table_addr); @@ -386,7 +386,7 @@ H5SM_type_shared(H5F_t *f, unsigned type_id) done: /* Release the master SOHM table */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_type_shared() */ @@ -424,11 +424,11 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Look up index for message type */ if((index_num = H5SM_get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to find correct SOHM index") /* Retrieve heap address for index */ *fheap_addr = table->indexes[index_num].heap_addr; @@ -436,7 +436,7 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) done: /* Release the master SOHM table */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_get_fheap_addr() */ @@ -648,9 +648,9 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) /* Allocate list in memory */ if(NULL == (list = H5FL_CALLOC(H5SM_list_t))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") if(NULL == (list->messages = (H5SM_sohm_t *)H5FL_ARR_CALLOC(H5SM_sohm_t, num_entries))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") /* Initialize messages in list */ for(x = 0; x < num_entries; x++) @@ -661,11 +661,11 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) /* Allocate space for the list on disk */ if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_SOHM_INDEX, (hsize_t)header->list_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") /* Put the list into the cache */ if(H5AC_insert_entry(f, H5AC_SOHM_LIST, addr, list, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache") /* Set return value */ ret_value = addr; @@ -773,7 +773,7 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, /* Unprotect list in cache and release heap */ if(H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") *_list = list = NULL; /* Delete the old list index (but not its heap, which the new index is @@ -973,7 +973,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, done: /* Release the master SOHM table, if we protected it */ if(my_table && my_table != table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), my_table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_can_share() */ @@ -1081,7 +1081,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* "complex" sharing checks */ if((tri_ret = H5SM_can_share(f, table, &index_num, type_id, mesg)) < 0) @@ -1103,7 +1103,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, */ if(H5SM__write_mesg(f, open_oh, &(table->indexes[index_num]), (defer_flags & H5SM_DEFER) != 0, type_id, mesg, &cache_flags) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "can't write shared message") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "can't write shared message") /* Set flags if this message was "written" without error and wasn't a * 'defer' attempt; it is now either fully shared or "shareable". @@ -1130,7 +1130,7 @@ done: /* Release the master SOHM table */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_try_share() */ @@ -1254,15 +1254,15 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Encode the message to be written */ if((buf_size = H5O_msg_raw_size(f, type_id, TRUE, mesg)) == 0) - HGOTO_ERROR(H5E_SOHM, H5E_BADSIZE, FAIL, "can't find message size") + HGOTO_ERROR(H5E_SOHM, H5E_BADSIZE, FAIL, "can't find message size") if(NULL == (encoding_buf = H5MM_malloc(buf_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding") if(H5O_msg_encode(f, type_id, TRUE, (unsigned char *)encoding_buf, mesg) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, FAIL, "can't encode message to be shared") + HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, FAIL, "can't encode message to be shared") /* Open the fractal heap for this index */ if(NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up a key for the message to be written */ key.file = f; @@ -1285,14 +1285,14 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* The index is a list; get it from the cache */ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &cache_udata, defer ? H5AC__READ_ONLY_FLAG : H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") /* See if the message is already in the index and get its location. * Also record the first empty list position we find in case we need it * later. */ if(H5SM__find_in_list(list, &key, &empty_pos, &list_pos) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") if(defer) { if(list_pos != UFAIL) @@ -1503,7 +1503,7 @@ done: /* If we got a list out of the cache, release it (it is always dirty after writing a message) */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, defer ? H5AC__NO_FLAGS_SET : H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") if(encoding_buf) encoding_buf = H5MM_xfree(encoding_buf); @@ -1557,11 +1557,11 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Find the correct index and try to delete from it */ if((index_num = H5SM_get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") /* If mesg_buf is not NULL, the message's reference count has reached * zero and any file space it uses needs to be freed. mesg_buf holds the @@ -1572,7 +1572,7 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) /* Release the master SOHM table */ if(H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") table = NULL; /* If buf was allocated, delete the message it holds. This message may @@ -1590,7 +1590,7 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) done: /* Release the master SOHM table (should only happen on error) */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") /* Release any native message we decoded */ if(native_mesg) @@ -1794,7 +1794,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Open the heap for this type of message. */ if(NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Get the message size and encoded message for the message to be deleted, * either from its OH or from the heap. @@ -1813,7 +1813,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Get the encoded message */ if(H5SM__read_mesg(f, &key.message, fheap, open_oh, &buf_size, &encoding_buf) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up key for message to be deleted. */ key.file = f; @@ -1833,13 +1833,13 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* If the index is stored as a list, get it from the cache */ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") /* Find the message in the list */ if(H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") if(list_pos == UFAIL) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") if(list->messages[list_pos].location == H5SM_IN_HEAP) --(list->messages[list_pos].u.heap_loc.ref_count); @@ -1859,7 +1859,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, * If it succeeds, a copy of the modified message will be returned. */ if(H5B2_modify(bt2, &key, H5SM__decr_ref, &message) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") /* Point to the message */ message_ptr = &message; @@ -1893,7 +1893,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Remove the message from the heap if it was stored in the heap*/ if(old_loc == H5SM_IN_HEAP) if(H5HF_remove(fheap, &(message_ptr->u.heap_loc.fheap_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove message from heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove message from heap") /* Return the message's encoding so anything it references can be freed */ @@ -1905,7 +1905,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Unprotect cache and release heap */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") list = NULL; HDassert(fheap); @@ -1929,7 +1929,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, done: /* Release the SOHM list */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") /* Release the fractal heap & v2 B-tree if we opened them */ if(fheap && H5HF_close(fheap) < 0) @@ -2068,7 +2068,7 @@ done: /* Release the master SOHM table if we took it out of the cache */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_get_info() */ @@ -2180,16 +2180,16 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &tbl_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Find the correct index and find the message in it */ if((index_num = H5SM_get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") header = &(table->indexes[index_num]); /* Open the heap for this message type */ if(NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up a SOHM message to correspond to the shared message passed in */ key.message.location = H5SM_IN_HEAP; @@ -2198,7 +2198,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, /* Get the encoded message */ if(H5SM__read_mesg(f, &key.message, fheap, NULL, &buf_size, &encoding_buf) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up key for message to locate */ key.file = f; @@ -2218,13 +2218,13 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, /* If the index is stored as a list, get it from the cache */ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &lst_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") /* Find the message in the list */ if(H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") if(list_pos == UFAIL) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") /* Copy the message */ message = list->messages[list_pos]; @@ -2243,7 +2243,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, if((msg_exists = H5B2_find(bt2, &key, H5SM_get_refcount_bt2_cb, &message)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "error finding message in index") if(!msg_exists) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") } /* end else */ /* Set the refcount for the message */ @@ -2253,9 +2253,9 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, done: /* Release resources */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") if(fheap && H5HF_close(fheap) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") if(bt2 && H5B2_close(bt2) < 0) @@ -2418,11 +2418,11 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, oloc.file = f; oloc.addr = mesg->u.mesg_loc.oh_addr; if(H5O_open(&oloc) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header") + HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header") /* Load the object header from the cache */ if(NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header") } /* end if */ else oh = open_oh; @@ -2559,11 +2559,11 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, if(table_vers == UFAIL) table_vers = H5F_SOHM_VERS(f); else if(table_vers != H5F_SOHM_VERS(f)) - HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n"); + HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n"); if(num_indexes == UFAIL) num_indexes = H5F_SOHM_NINDEXES(f); else if(num_indexes != H5F_SOHM_NINDEXES(f)) - HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n"); + HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n"); /* Check arguments. Version must be 0, the only version implemented so far */ if(table_vers > HDF5_SHAREDHEADER_VERSION) @@ -2576,7 +2576,7 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, table_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") HDfprintf(stream, "%*sShared Message Master Table...\n", indent, ""); for(x = 0; x < num_indexes; ++x) { @@ -2604,7 +2604,7 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, done: if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_table_debug() */ @@ -2650,7 +2650,7 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, table_addr, &tbl_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Determine which index the list is part of */ index_num = table->num_indexes; @@ -2708,11 +2708,11 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, done: if(fh && H5HF_close(fh) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap") if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, list_addr, list, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_list_debug() */ @@ -2757,7 +2757,7 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Get SOHM header size */ *hdr_size = table->table_size; @@ -2771,7 +2771,7 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) if(NULL == (bt2 = H5B2_open(f, table->indexes[u].index_addr, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") - if(H5B2_size(bt2, &(ih_info->index_size)) < 0) + if(H5B2_size(bt2, &(ih_info->index_size)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") /* Close the v2 B-tree */ @@ -2792,8 +2792,8 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Get heap storage size */ - if(H5HF_size(fheap, &(ih_info->heap_size)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info") + if(H5HF_size(fheap, &(ih_info->heap_size)) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info") /* Close the fractal heap */ if(H5HF_close(fheap) < 0) diff --git a/src/H5T.c b/src/H5T.c index 76b0663..a9d2168 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -28,24 +28,19 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#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" /* 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 -#include -#endif /* H5_HAVE_SYS_FPU_H */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#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" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tpkg.h" /* Datatypes */ /****************/ @@ -292,17 +287,13 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_lib_conv_t func); -static herr_t H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_conv_func_t *conv); -static herr_t H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_conv_t func); +static herr_t H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_lib_conv_t func); +static herr_t H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_func_t *conv); +static herr_t H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_t func); static htri_t H5T__compiler_conv(H5T_t *src, H5T_t *dst); static herr_t H5T__set_size(H5T_t *dt, size_t size); static herr_t H5T__close_cb(H5T_t *dt); -static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, - const char *name, H5T_conv_func_t *conv); +static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_func_t *conv); /*****************************/ @@ -1391,7 +1382,7 @@ H5T_top_term_package(void) if((path->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { - fprintf(H5DEBUG(T), "H5T: conversion function " + HDfprintf(H5DEBUG(T), "H5T: conversion function " "0x%08lx failed to free private data for " "%s (ignored)\n", (unsigned long)(path->conv.u.app_func), path->name); @@ -1597,6 +1588,35 @@ H5T_term_package(void) /*------------------------------------------------------------------------- + * Function: H5T__close_cb + * + * Purpose: Called when the ref count reaches zero on the datatype's ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__close_cb(H5T_t *dt) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(dt); + HDassert(dt->shared); + + /* Close the datatype */ + if(H5T_close(dt) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__close_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5Tcreate * * Purpose: Create a new type and initialize it to reasonable values. @@ -1626,7 +1646,7 @@ H5Tcreate(H5T_class_t type, size_t size) /* check args. We support string (fixed-size or variable-length) now. */ if(size <= 0 && size != H5T_VARIABLE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive") /* create the type */ if(NULL == (dt = H5T__create(type, size))) @@ -1644,33 +1664,27 @@ done: /*------------------------------------------------------------------------- * Function: H5Tcopy * - * 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 datatype. + * Purpose: Copies a datatype. The resulting datatype is not locked. + * The datatype should be closed when no longer needed by + * calling H5Tclose(). * - * Failure: Negative + * Return: Success: The ID of a new datatype * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * - * Modifications: + * Failure: H5I_INVALID_HID * - * Robb Matzke, 4 Jun 1998 - * The returned type is always transient and unlocked. If the TYPE_ID - * 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. + * Note: The returned type is always transient and unlocked. If the + * TYPE_ID 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; /* Pointer to the datatype to copy */ - H5T_t *new_dt = NULL; - hid_t ret_value; /* Return value */ + H5T_t *dt = NULL; /* Pointer to the datatype to copy */ + H5T_t *new_dt = NULL; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", type_id); @@ -1721,7 +1735,7 @@ H5Tcopy(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype atom") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(new_dt && H5T_close_real(new_dt) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release datatype info") @@ -1835,9 +1849,9 @@ H5Tlock(hid_t type_id) H5TRACE1("e", "i", type_id); /* Check args */ - if(NULL == (dt = (H5T_t *)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") - if(H5T_STATE_NAMED==dt->shared->state || H5T_STATE_OPEN==dt->shared->state) + 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) @@ -1972,15 +1986,6 @@ done: * Programmer: Quincey Koziol * Wednesday, November 29, 2000 * - * Modifications: - * Raymond Lu - * 4 December 2009 - * Added a flag as a parameter to indicate whether the caller is - * H5Tdetect_class. I also added the check for VL string type - * just like the public function. Because we want to tell users - * VL string is a string type but we treat it as a VL type - * internally, H5T_detect_class needs to know where the caller - * is from. *------------------------------------------------------------------------- */ htri_t @@ -2213,7 +2218,7 @@ H5Tget_super(hid_t type) { H5T_t *dt; /* Datatype to query */ H5T_t *super = NULL; /* Supertype */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", type); @@ -2226,7 +2231,7 @@ H5Tget_super(hid_t type) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register parent datatype") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(super && H5T_close_real(super) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release super datatype info") @@ -2289,7 +2294,7 @@ H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, FUNC_ENTER_STATIC /* Check args */ - HDassert(H5T_PERS_HARD==pers || H5T_PERS_SOFT==pers); + HDassert(H5T_PERS_HARD == pers || H5T_PERS_SOFT == pers); HDassert(name && *name); HDassert(src); HDassert(dst); @@ -2354,8 +2359,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if(NULL == (new_path = H5T__path_find_real(src, dst, name, conv))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path") - /* - * Notify all other functions to recalculate private data since some + /* Notify all other functions to recalculate private data since some * functions might cache a list of conversion functions. For * instance, the compound type converter caches a list of conversion * functions for the members, so adding a new function should cause @@ -2445,7 +2449,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((old_path->conv.u.app_func)(tmp_sid, tmp_did, &(old_path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx " "failed to free private data for %s (ignored)\n", (unsigned long)(old_path->conv.u.app_func), old_path->name); #endif @@ -2455,7 +2459,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((old_path->conv.u.lib_func)(tmp_sid, tmp_did, &(old_path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " + HDfprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " "failed to free private data for %s (ignored)\n", (unsigned long)(old_path->conv.u.lib_func), old_path->name); #endif @@ -2627,7 +2631,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((path->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " "to free private data for %s (ignored)\n", (unsigned long)(path->conv.u.app_func), path->name); #endif @@ -2637,7 +2641,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((path->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " "to free private data for %s (ignored)\n", (unsigned long)(path->conv.u.lib_func), path->name); #endif @@ -3151,7 +3155,7 @@ H5T__create(H5T_class_t type, size_t size) case H5T_REFERENCE: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL, "unknown data type class") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "unknown data type class") } /* end switch */ /* Set the size except VL string */ @@ -3166,8 +3170,8 @@ done: if(dt) { dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); dt = H5FL_FREE(H5T_t, dt); - } /* end if */ - } /* end if */ + } + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__create() */ @@ -3186,27 +3190,6 @@ done: * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modifications: - * - * Robb Matzke, 4 Jun 1998 - * Added the METHOD argument. If it's H5T_COPY_TRANSIENT then the - * result will be an unlocked transient type. Otherwise if it's - * H5T_COPY_ALL then the result is a named type if the original is a - * named type, but the result is not opened. Finally, if it's - * H5T_COPY_REOPEN and the original type is a named type then the result - * is a named type and the type object header is opened again. The - * H5T_COPY_REOPEN method is used when returning a named type to the - * application. - * - * Robb Matzke, 22 Dec 1998 - * Now able to copy enumeration data types. - * - * Robb Matzke, 20 May 1999 - * Now able to copy opaque types. - * - * Pedro Vicente, 21 Sep 2002 - * Added a deep copy of the symbol table entry - * *------------------------------------------------------------------------- */ H5T_t * @@ -3498,9 +3481,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_lock (H5T_t *dt, hbool_t immutable) +H5T_lock(H5T_t *dt, hbool_t immutable) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3511,7 +3494,8 @@ H5T_lock (H5T_t *dt, hbool_t immutable) dt->shared->state = immutable ? H5T_STATE_IMMUTABLE : H5T_STATE_RDONLY; break; case H5T_STATE_RDONLY: - if (immutable) dt->shared->state = H5T_STATE_IMMUTABLE; + if(immutable) + dt->shared->state = H5T_STATE_IMMUTABLE; break; case H5T_STATE_IMMUTABLE: case H5T_STATE_NAMED: @@ -3601,10 +3585,8 @@ H5T__free(H5T_t *dt) /* Free the ID to name info */ H5G_name_free(&(dt->path)); - /* - * Don't free locked datatypes. - */ - if(H5T_STATE_IMMUTABLE==dt->shared->state) + /* Don't free locked datatypes */ + if(H5T_STATE_IMMUTABLE == dt->shared->state) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close immutable datatype") /* Close the datatype */ @@ -3613,7 +3595,7 @@ H5T__free(H5T_t *dt) for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { dt->shared->u.compnd.memb[i].name = (char *)H5MM_xfree(dt->shared->u.compnd.memb[i].name); (void)H5T_close_real(dt->shared->u.compnd.memb[i].type); - } /* end for */ + } dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_xfree(dt->shared->u.compnd.memb); dt->shared->u.compnd.nmembs = 0; break; @@ -3661,7 +3643,7 @@ done: * * Purpose: Frees a datatype and all associated memory. * - * Hote: Does _not_ deal with open hamed datatypes, etc. + * Hote: Does _not_ deal with open named datatypes, etc. * * Return: Non-negative on success/Negative on failure * @@ -3700,41 +3682,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__close_cb - * - * Purpose: Callback routine for closing a datatype ID. Closes the datatype - * object that was attached to the ID. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T__close_cb(H5T_t *dt) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* check args */ - HDassert(dt && dt->shared); - - /* Call actual datatype close routine */ - if(H5T_close(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T__close_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5T_close + * Function: H5T_close * - * Purpose: Frees a data type and all associated memory. Deals with - * open named datatypes appropriately. + * Purpose: Frees a data type and all associated memory. Deals with + * open named datatypes appropriately. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Monday, December 8, 1997 @@ -3749,7 +3702,8 @@ H5T_close(H5T_t *dt) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(dt && dt->shared); + HDassert(dt); + HDassert(dt->shared); /* Named datatype cleanups */ if(dt->shared->state == H5T_STATE_OPEN) { @@ -3761,8 +3715,7 @@ H5T_close(H5T_t *dt) HDassert(H5F_addr_defined(dt->sh_loc.u.loc.oh_addr)); HDassert(H5F_addr_defined(dt->oloc.addr)); - /* - * If a named type is being closed then close the object header and + /* If a named type is being closed then close the object header and * remove from the list of open objects in the file. */ @@ -3862,7 +3815,7 @@ H5T__set_size(H5T_t *dt, size_t size) dt->shared->size = dt->shared->parent->shared->size * dt->shared->u.array.nelem; else if(dt->shared->type!=H5T_VLEN) dt->shared->size = dt->shared->parent->shared->size; - } /* end if */ + } else { if (H5T_IS_ATOMIC(dt->shared)) { offset = dt->shared->u.atomic.offset; @@ -3876,7 +3829,7 @@ H5T__set_size(H5T_t *dt, size_t size) offset = 8 * size - prec; if (prec > 8*size) prec = 8 * size; - } /* end if */ + } else prec = offset = 0; @@ -3974,7 +3927,7 @@ H5T__set_size(H5T_t *dt, size_t size) dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec+offset || dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first"); - } /* end if */ + } break; case H5T_ENUM: @@ -4000,7 +3953,7 @@ H5T__set_size(H5T_t *dt, size_t size) if (H5T_IS_ATOMIC(dt->shared)) { dt->shared->u.atomic.offset = offset; dt->shared->u.atomic.prec = prec; - } /* end if */ + } } /* end if */ /* Check if the new compound type is packed */ @@ -4038,7 +3991,7 @@ H5T_get_size(const H5T_t *dt) HDassert(dt); FUNC_LEAVE_NOAPI(dt->shared->size) -} +} /* end H5T_get_size() */ /*------------------------------------------------------------------------- @@ -4615,7 +4568,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if(H5T__conv_noop((hid_t)FAIL, (hid_t)FAIL, &(H5T_g.path[0]->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); + HDfprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); #endif H5E_clear_stack(NULL); /*ignore the error*/ } /* end if */ @@ -4623,8 +4576,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_g.npaths = 1; } /* end if */ - /* - * Find the conversion path. If source and destination types are equal + /* Find the conversion path. If source and destination types are equal * then use entry[0], otherwise do a binary search over the * remaining entries. * @@ -4663,8 +4615,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, */ old_npaths = H5T_g.npaths; - /* - * If we didn't find the path, if the caller is an API function specifying + /* If we didn't find the path, if the caller is an API function specifying * a new hard conversion function, or if the caller is a private function * specifying a new hard conversion and the path is a soft conversion, then * create a new path and add the new function to the path. @@ -4686,8 +4637,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, else path = table; - /* - * If a hard conversion function is specified and none is defined for the + /* If a hard conversion function is specified and none is defined for the * path, or the caller is an API function, or the caller is a private function but * the existing path is a soft function, then add the new conversion to the path * and initialize its conversion data. @@ -4793,7 +4743,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if((table->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", (unsigned long)(path->conv.u.app_func), path->name); #endif H5E_clear_stack(NULL); /*ignore the failure*/ @@ -4803,7 +4753,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if((table->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", (unsigned long)(path->conv.u.lib_func), path->name); #endif H5E_clear_stack(NULL); /*ignore the failure*/ @@ -5028,7 +4978,7 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, H5_timer_end(&(tpath->stats.timer), &timer); tpath->stats.ncalls++; tpath->stats.nelmts += nelmts; - } /* end if */ + } #endif done: @@ -5150,14 +5100,10 @@ done: /*------------------------------------------------------------------------- * Function: H5T_is_named * - * Purpose: Check if a datatype is named. - * - * Return: TRUE + * Purpose: Check if a datatype is named/committed. * - * FALSE + * Return: TRUE/FALSE/FAIL * - * Programmer: Pedro Vicente - * Tuesday, Sep 3, 2002 *------------------------------------------------------------------------- */ htri_t @@ -5213,7 +5159,7 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path") dt->shared->state = H5T_STATE_TRANSIENT; - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 649bd2e..ce537dc 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -56,8 +56,6 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id); -static hid_t H5T__get_create_plist(const H5T_t *type); static H5T_t *H5T__open_oid(const H5G_loc_t *loc); @@ -83,15 +81,12 @@ static H5T_t *H5T__open_oid(const H5G_loc_t *loc); /*------------------------------------------------------------------------- - * Function: H5Tcommit2 + * Function: H5Tcommit2 * - * Purpose: Save a transient datatype to a file and turn the type handle - * into a "named", immutable type. + * Purpose: Save a transient datatype to a file and turn the type handle + * into a "named", immutable type. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * April 5, 2007 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -100,7 +95,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id) { H5G_loc_t loc; /* Location to create datatype */ - H5T_t *type; /* Datatype for ID */ + H5T_t *type = NULL; /* Datatype for ID */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -108,11 +103,13 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Get correct property list */ if(H5P_DEFAULT == lcpl_id) @@ -134,7 +131,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, /* Commit the type */ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: FUNC_LEAVE_API(ret_value) @@ -194,7 +191,7 @@ done: * to return it to the state it was in before it was committed. */ if(ret_value < 0 && (NULL != ocrt_info.new_obj)) { - if(dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { + if(dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { /* Remove the datatype from the list of opened objects in the file */ if(H5FO_top_decr(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object") @@ -212,9 +209,9 @@ done: /* Mark datatype as being back in memory */ if(H5T_set_loc(dt, dt->sh_loc.file, H5T_LOC_MEMORY)) HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to return datatype to memory") - dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED; + dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED; dt->shared->state = old_state; - } /* end if */ + } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -222,21 +219,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tcommit_anon + * Function: H5Tcommit_anon * - * Purpose: Save a transient datatype to a file and turn the type handle - * into a "named", immutable type. + * Purpose: Save a transient datatype to a file and turn the type handle + * into a "named", immutable type. * * The resulting ID should be linked into the file with * H5Olink or it will be deleted when closed. * - * Note: Datatype access property list is unused currently, but is - * checked for sanity anyway. + * Note: The datatype access property list is unused currently, but + * is checked for sanity anyway. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Peter Cao - * May 17, 2005 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -244,7 +238,7 @@ herr_t H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { H5G_loc_t loc; /* Group location for location */ - H5T_t *type = NULL; /* Datatype created */ + H5T_t *type = NULL; /* Datatype created */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -252,9 +246,11 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_is_named(type)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") /* Get correct property list */ if(H5P_DEFAULT == tcpl_id) @@ -267,9 +263,9 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Commit the type */ + /* Commit the datatype */ if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: FUNC_LEAVE_API(ret_value) @@ -277,24 +273,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__commit_anon + * Function: H5T__commit_anon * - * Purpose: Create an anonymous committed datatype. + * Purpose: Create an anonymous committed datatype. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 12, 2017 * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) { H5O_loc_t *oloc; /* Object location for datatype */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(file); @@ -303,7 +299,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) /* Commit the type */ if(H5T__commit(file, type, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Release the datatype's object header */ @@ -392,9 +388,9 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id) * type message and then give the object header a name. */ if(H5O_create(file, dtype_size, (size_t)1, tcpl_id, &temp_oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header") if(H5O_msg_create(&temp_oloc, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, type) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message") /* Copy the new object header's location into the datatype, taking ownership of it */ if(H5O_loc_copy(&(type->oloc), &temp_oloc, H5_COPY_SHALLOW) < 0) @@ -442,23 +438,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tcommitted - * - * Purpose: Determines if a datatype is committed or not. - * - * Return: Success: TRUE if committed, FALSE otherwise. + * Function: H5Tcommitted * - * Failure: Negative + * Purpose: Determines if a datatype is committed or not. * - * Programmer: Robb Matzke - * Thursday, June 4, 1998 + * Return: TRUE/FALSE/FAIL * *------------------------------------------------------------------------- */ htri_t H5Tcommitted(hid_t type_id) { - H5T_t *type; /* Datatype to query */ + H5T_t *type; /* Datatype to query */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -466,10 +457,10 @@ H5Tcommitted(hid_t type_id) /* Check arguments */ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Set return value */ - ret_value = H5T_committed(type); + ret_value = H5T_is_named(type); done: FUNC_LEAVE_API(ret_value) @@ -477,30 +468,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_committed - * - * Purpose: Determines if a datatype is committed or not. - * - * Return: Success: TRUE if committed, FALSE otherwise. - * - * Programmer: Quincey Koziol - * Wednesday, September 24, 2003 - * - *------------------------------------------------------------------------- - */ -htri_t -H5T_committed(const H5T_t *type) -{ - /* Use no-init for efficiency */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(type); - - FUNC_LEAVE_NOAPI(H5T_STATE_OPEN == type->shared->state || H5T_STATE_NAMED == type->shared->state) -} /* end H5T_committed() */ - - -/*------------------------------------------------------------------------- * Function: H5T_link * * Purpose: Adjust the link count for an object header by adding @@ -519,14 +486,14 @@ H5T_link(const H5T_t *type, int adjust) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) HDassert(type); HDassert(type->sh_loc.type == H5O_SHARE_TYPE_COMMITTED); /* Adjust the link count on the named datatype */ if((ret_value = H5O_link(&type->oloc, adjust)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_LINKCOUNT, FAIL, "unable to adjust named datatype link count") + HGOTO_ERROR(H5E_DATATYPE, H5E_LINKCOUNT, (-1), "unable to adjust named datatype link count") done: FUNC_LEAVE_NOAPI(ret_value) @@ -534,16 +501,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Topen2 + * Function: H5Topen2 * - * Purpose: Opens a named datatype using a Datatype Access Property + * Purpose: Opens a named datatype using a Datatype Access Property * List. * - * Return: Success: Object ID of the named datatype. - * Failure: Negative + * Return: Success: Object ID of the named datatype * - * Programmer: James Laird - * Thursday July 27, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -560,24 +525,26 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Open it */ + /* Open the datatype */ if(NULL == (type = H5T__open_name(&loc, name))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(type != NULL) (void)H5T_close(type); @@ -586,47 +553,56 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tget_create_plist - * - * Purpose: Returns a copy of the datatype creation property list. + * Function: H5Tget_create_plist * - * Note: There are no datatype creation properties currently, just - * object creation ones. + * Purpose: Returns a copy of the datatype creation property list. * - * Return: Success: ID for a copy of the datatype creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Note: There are no datatype creation properties currently, just + * object creation ones. * - * Failure: FAIL + * Return: Success: ID for a copy of the datatype creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Tget_create_plist(hid_t dtype_id) { - H5T_t *type; /* Datatype object for ID */ - herr_t status; /* Generic status value */ - hid_t ret_value = FAIL; /* Return value */ + H5T_t *type = NULL; /* Datatype object for ID */ + htri_t is_named = FAIL; /* Is the datatype named? */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dtype_id); /* Check arguments */ if(NULL == (type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype") /* Check if the datatype is committed */ - if((status = H5T_committed(type)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check whether datatype is committed") + if(FAIL == (is_named = H5T_is_named(type))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't check whether datatype is committed") - /* Retrieve further information, if the datatype is committed */ - if(status > 0) - /* Retrieve datatype creation properties */ + /* If the datatype is not committed/named, just copy the default + * creation property list and return that. + */ + if(FALSE == is_named) { + H5P_genplist_t *tcpl_plist = NULL; + + /* Copy the default datatype creation property list */ + if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_ID_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list") + if((ret_value = H5P_copy_plist(tcpl_plist, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") + } + /* If the datatype is committed, retrieve further information */ + else { if((ret_value = H5T__get_create_plist(type)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") + } done: FUNC_LEAVE_API(ret_value) @@ -666,7 +642,7 @@ H5Tflush(hid_t type_id) /* Flush metadata for named datatype */ if(H5O_flush_common(&dt->oloc, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") done: FUNC_LEAVE_API(ret_value) @@ -704,7 +680,7 @@ H5Trefresh(hid_t type_id) if(H5CX_set_loc(type_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call private function to refresh datatype object */ + /* Refresh the datatype's metadata */ if((H5O_refresh_metadata(type_id, dt->oloc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") @@ -714,50 +690,50 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__get_create_plist + * Function: H5T__get_create_plist * - * Purpose: Returns a copy of the datatype creation property list. + * Purpose: Returns a copy of the datatype creation property list. * - * Note: There are no datatype creation properties currently, just - * object creation ones. + * Note: There are no datatype creation properties currently, just + * object creation ones. * - * Return: Success: ID for a copy of the datatype creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Return: Success: ID for a copy of the datatype creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * Wednesday, December 13, 2017 * *------------------------------------------------------------------------- */ -static hid_t +hid_t H5T__get_create_plist(const H5T_t *type) { H5P_genplist_t *tcpl_plist; /* Existing datatype creation propertty list */ H5P_genplist_t *new_plist; /* New datatype creation property list */ hid_t new_tcpl_id = FAIL; /* New datatype creation property list */ - hid_t ret_value = FAIL; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(type); /* Copy the default datatype creation property list */ if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_ID_g))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "can't get default creation property list") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "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") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") /* Get property list object for new TCPL */ if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_tcpl_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "can't get property list") /* Retrieve any object creation properties */ if(H5O_get_create_plist(&type->oloc, new_plist) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") /* Set the return value */ ret_value = new_tcpl_id; @@ -766,7 +742,7 @@ done: if(ret_value < 0) if(new_tcpl_id > 0) if(H5I_dec_app_ref(new_tcpl_id) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to close temporary object") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, H5I_INVALID_HID, "unable to close temporary object") FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_create_plist() */ @@ -981,11 +957,11 @@ H5T__open_oid(const H5G_loc_t *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") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") /* Deserialize the datatype message into a datatype in memory */ if(NULL == (dt = (H5T_t *)H5O_msg_read(loc->oloc, H5O_DTYPE_ID, NULL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header") /* Mark the type as named and open */ dt->shared->state = H5T_STATE_OPEN; diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index feece57..d4f1008 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -202,7 +202,7 @@ done: * modifying the returned datatype does not * modify the member type. * - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, January 7, 1998 @@ -221,17 +221,17 @@ H5Tget_member_type(hid_t type_id, unsigned membno) /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a compound datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a compound datatype") if(membno >= dt->shared->u.compnd.nmembs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number") /* Retrieve the datatype for the member */ if(NULL == (memb_dt = H5T_get_member_type(dt, membno, H5T_COPY_REOPEN))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type") /* Get an ID for the datatype */ if((ret_value = H5I_register(H5I_DATATYPE, memb_dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype atom") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype atom") done: if(ret_value < 0) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 803a6da..563de65 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2962,7 +2962,7 @@ H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne src_parent = src->shared->parent; if(NULL == (tpath = H5T_path_find(src_parent, dst))) { - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype") } else if(!H5T_path_noop(tpath)) { if((src_parent_id = H5I_register(H5I_DATATYPE, H5T_copy(src_parent, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") @@ -8295,14 +8295,6 @@ H5_GCC_DIAG_ON(float-equal) * Programmer: Raymond Lu * Wednesday, Jan 21, 2004 * - * Raymond Lu - * Wednesday, April 21, 2004 - * There is a new design for exception handling like overflow, - * which is passed in as a transfer property. - * - * Raymond Lu - * Monday, March 13, 2006 - * Added support for VAX floating-point types. *------------------------------------------------------------------------- */ herr_t @@ -9008,8 +9000,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } #endif - /* - * Put the data in little endian order so our loops aren't so + /* Put the data in little endian order so our loops aren't so * complicated. We'll do all the conversion stuff assuming * little endian and then we'll fix the order at the end. */ @@ -9022,26 +9013,23 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } } - /*zero-set all destination bits*/ + /* Zero-set all destination bits*/ H5T__bit_set (d, dst.offset, dst.prec, FALSE); /* Copy source into a temporary buffer */ H5T__bit_copy(int_buf, (size_t)0, s, src.offset, src.prec); - /* - * Find the sign bit value of the source. - */ + /* Find the sign bit value of the source */ if(H5T_SGN_2 == src.u.i.sign) sign = (size_t)H5T__bit_get_d(int_buf, src.prec - 1, (size_t)1); - /* - * What is the bit position(starting from 0 as first one) for the most significant - * bit(MSB) of S which is set? + /* What is the bit position(starting from 0 as first one) for the most significant + * bit(MSB) of S which is set? */ if(H5T_SGN_2 == src.u.i.sign) { sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE); if(sign && sfirst < 0) - /* The case 0x80...00, which is negative with maximal value */ + /* The case 0x80...00, which is negative with maximal value */ is_max_neg = 1; } else if(H5T_SGN_NONE == src.u.i.sign) sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec, H5T_BIT_MSB, TRUE); @@ -9050,9 +9038,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(!sign && sfirst < 0) goto padding; - /* - * Convert source integer if it's negative - */ + /* Convert source integer if it's negative */ if(H5T_SGN_2 == src.u.i.sign && sign) { if(!is_max_neg) { /* Equivalent to ~(i - 1) */ @@ -9060,10 +9046,10 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T__bit_neg(int_buf, (size_t)0, buf_size * 8); sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE); } else { - /* If it's maximal negative number 0x80...000, treat it as if it overflowed - * (create a carry) to help conversion. i.e. a character type number 0x80 - * is treated as 0x100. - */ + /* If it's maximal negative number 0x80...000, treat it as if it overflowed + * (create a carry) to help conversion. i.e. a character type number 0x80 + * is treated as 0x100. + */ sfirst = (ssize_t)(src.prec - 1); is_max_neg = 0; } @@ -9072,7 +9058,8 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Sign bit has been negated if bit vector isn't 0x80...00. Set all bits in front of * sign bit to 0 in the temporary buffer because they're all negated from the previous - * step. */ + * step. + */ H5T__bit_set(int_buf, src.prec, (buf_size * 8) - src.prec, 0); /* Set sign bit in destination */ @@ -9081,14 +9068,14 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, first = (size_t)sfirst; - /* - * Calculate the true destination exponent by adjusting according to + /* Calculate the true destination exponent by adjusting according to * the destination exponent bias. Implied and non-implied normalization * should be the same. */ if (H5T_NORM_NONE==dst.u.f.norm || H5T_NORM_IMPLIED==dst.u.f.norm) { expo = first + dst.u.f.ebias; - } else { + } + else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet") } @@ -9096,13 +9083,14 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (H5T_NORM_IMPLIED==dst.u.f.norm) { /* Imply first bit */ H5T__bit_set(int_buf, first, (size_t)1, 0); - } else if (H5T_NORM_NONE==dst.u.f.norm) { - first++; + } + else if (H5T_NORM_NONE==dst.u.f.norm) { + first++; } /* Roundup for mantissa */ if(first > dst.u.f.msize) { - /* If the bit sequence is bigger than the mantissa part, there'll be some + /* If the bit sequence is bigger than the mantissa part, there'll be some * precision loss. Let user's handler deal with the case if it's present */ if(cb_struct.func) { @@ -9114,14 +9102,15 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_HANDLED) { reverse = FALSE; goto padding; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") - /* If user's exception handler does deal with it, we do it by dropping off the - * extra bits at the end and do rounding. If we have .50...0(decimal) after radix - * point, we do roundup when the least significant digit before radix is odd, we do - * rounddown if it's even. - */ + /* If user's exception handler does deal with it, we do it by dropping off the + * extra bits at the end and do rounding. If we have .50...0(decimal) after radix + * point, we do roundup when the least significant digit before radix is odd, we do + * rounddown if it's even. + */ /* Check 1st dropoff bit, see if it's set. */ if(H5T__bit_get_d(int_buf, ((first - dst.u.f.msize) - 1), (size_t)1)) { diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 13d2f5f..a7f54a7 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -109,19 +109,19 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Commit the datatype to the file, using default property list values */ + /* Commit the datatype */ if(H5T__commit_named(&loc, name, type, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: FUNC_LEAVE_API(ret_value) @@ -137,7 +137,7 @@ done: * * Return: Success: Object ID of the named datatype. * - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Monday, June 1, 1998 @@ -149,7 +149,7 @@ H5Topen1(hid_t loc_id, const char *name) { H5T_t *type = NULL; H5G_loc_t loc; - hid_t ret_value = H5I_INVALID_HID; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); @@ -160,19 +160,19 @@ H5Topen1(hid_t loc_id, const char *name) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") - /* Open it */ + /* Open the datatype */ if(NULL == (type = H5T__open_name(&loc, name))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(type && H5T_close(type) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype") FUNC_LEAVE_API(ret_value) } /* end H5Topen1() */ diff --git a/src/H5Tenum.c b/src/H5Tenum.c index ade7d08..0ed1775 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -46,8 +46,6 @@ static herr_t H5T_enum_valueof(const H5T_t *dt, const char *name, * Programmer: Robb Matzke * Tuesday, December 22, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t diff --git a/src/H5Toh.c b/src/H5Toh.c index c0139fe..c5ee994 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -180,7 +180,7 @@ H5O__dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc) /* Commit the type to the file */ if(H5T__commit(f, crt_info->dt, crt_info->tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") /* Set up the new named datatype's location */ if(NULL == (obj_loc->oloc = H5T_oloc(crt_info->dt))) diff --git a/src/H5Torder.c b/src/H5Torder.c index 877316d..1995a03 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -199,7 +199,7 @@ done: herr_t H5Tset_order(hid_t type_id, H5T_order_t order) { - H5T_t *dt; /* Datatype to modify */ + H5T_t *dt = NULL; /* Datatype to modify */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -207,15 +207,15 @@ H5Tset_order(hid_t type_id, H5T_order_t order) /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") if(order < H5T_ORDER_LE || order > H5T_ORDER_NONE || order == H5T_ORDER_MIXED) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order") if(H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only") /* Call internal routine to set the order */ if(H5T_set_order(dt, order) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index e1b996c..04e9451 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -167,7 +167,7 @@ struct H5T_path_t { char name[H5T_NAMELEN]; /*name for debugging only */ H5T_t *src; /*source datatype */ H5T_t *dst; /*destination datatype */ - H5T_conv_func_t conv; /* Conversion funcion */ + H5T_conv_func_t conv; /* Conversion function */ hbool_t is_hard; /*is it a hard function? */ hbool_t is_noop; /*is it the noop conversion? */ hbool_t are_compounds; /*are source and dest both compounds?*/ @@ -447,10 +447,12 @@ H5_DLL herr_t H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, H5_DLL herr_t H5T__upgrade_version(H5T_t *dt, unsigned new_version); /* Committed / named datatype routines */ +H5_DLL herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id); H5_DLL herr_t H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id); H5_DLL herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_id, hid_t tcpl_id); H5_DLL H5T_t *H5T__open_name(const H5G_loc_t *loc, const char *name); +H5_DLL hid_t H5T__get_create_plist(const H5T_t *type); /* Conversion functions */ H5_DLL herr_t H5T__conv_noop(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 89cdcfd..9dae53b 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -144,7 +144,6 @@ H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); /* Operations on named datatypes */ H5_DLL H5T_t *H5T_open(const H5G_loc_t *loc); -H5_DLL htri_t H5T_committed(const H5T_t *type); H5_DLL int H5T_link(const H5T_t *type, int adjust); H5_DLL herr_t H5T_update_shared(H5T_t *type); diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index ba31cd1..467847f 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -204,7 +204,7 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) 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; - } /* end if */ + } else if(dt->shared->u.vlen.type == H5T_VLEN_STRING) { /* size in memory, disk size is different */ dt->shared->size = sizeof(char *); @@ -216,9 +216,10 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) 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; - } /* end else-if */ - else + } + else { HDassert(0 && "Invalid VL type"); + } /* Reset file ID (since this VL is in memory) */ dt->shared->u.vlen.f = NULL; @@ -667,8 +668,7 @@ H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len) */ static herr_t H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_alloc_info, - void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, - size_t base_size) + void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) { char *t; /* Pointer to temporary buffer allocated */ size_t len; /* Maximum length of the string to copy */ @@ -847,10 +847,11 @@ H5T_vlen_disk_read(H5F_t *f, void *_vl, void *buf, size_t H5_ATTR_UNUSED len) UINT32DECODE(vl, hobjid.idx); /* Check if this sequence actually has any data */ - if(hobjid.addr > 0) + if(hobjid.addr > 0) { /* Read the VL information from disk */ if(NULL == H5HG_read(f, &hobjid, buf, NULL)) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "Unable to read VL information") + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -898,10 +899,11 @@ H5T_vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_all UINT32DECODE(bg, bg_hobjid.idx); /* Free heap object for old data */ - if(bg_hobjid.addr > 0) + if(bg_hobjid.addr > 0) { /* Free heap object */ if(H5HG_remove(f, &bg_hobjid) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object") + } } /* end if */ /* Set the length of the sequence */ @@ -1159,6 +1161,10 @@ done: * * Purpose: Alternative method to reclaim any VL data for a buffer element. * + * Use this function when the datatype is already available, but + * the allocation info is needed from the context before jumping + * into recursion. + * * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy @@ -1169,8 +1175,8 @@ done: herr_t H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt) { - H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */ - herr_t ret_value = SUCCEED; /* return value */ + H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */ + herr_t ret_value = SUCCEED; /* return value */ HDassert(dt); HDassert(elem); diff --git a/src/H5Z.c b/src/H5Z.c index 14b0400..9dc358c 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -43,10 +43,10 @@ typedef struct H5Z_stats_t { #endif /* H5Z_DEBUG */ typedef struct H5Z_object_t { - H5Z_filter_t filter_id; /* ID of the filter we're looking for */ - htri_t found; /* Whether we find an object using the filter */ + H5Z_filter_t filter_id; /* ID of the filter we're looking for */ + htri_t found; /* Whether we find an object using the filter */ #ifdef H5_HAVE_PARALLEL - hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */ + hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */ #endif /* H5_HAVE_PARALLEL */ } H5Z_object_t; @@ -339,12 +339,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Zunregister + * Function: H5Zunregister * - * Purpose: This function unregisters a filter. + * Purpose: This function unregisters a filter. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -371,13 +371,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__unregister + * Function: H5Z__unregister * - * Purpose: Same as the public version except this one allows filters - * to be unset for predefined method numbers found = TRUE; ret_value = TRUE; - } /* end if */ + } done: if (ocpl_id > 0) @@ -518,15 +522,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister_dset_cb + * Function: H5Z__check_unregister_dset_cb + * + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened objects. If the object is a dataset + * or a group and it uses the filter to be unregistered, the + * function returns TRUE. * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened objects. If the object is a dataset - * or a group and it uses the filter to be unregistered, the - * function returns TRUE. + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * - * Return: TRUE if the object uses the filter. - * FALSE otherwise. *------------------------------------------------------------------------- */ static int @@ -555,7 +561,7 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void * if (filter_in_pline) { object->found = TRUE; ret_value = TRUE; - } /* end if */ + } done: if (ocpl_id > 0) @@ -567,27 +573,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__flush_file_cb + * Function: H5Z__flush_file_cb * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened files and flush them. + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened files and flush them. * - * Return: FALSE if finishes flushing and moves on - * FAIL if there is an error + * Return: NON-NEGATIVE if finishes flushing and moves on + * NEGATIVE if there is an error *------------------------------------------------------------------------- */ static int H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) { - H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ - H5Z_object_t *object = (H5Z_object_t *)key; - int ret_value = FALSE; /* Return value */ + H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ + H5Z_object_t *object = (H5Z_object_t *)key; + int ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC /* Sanity checks */ - HDassert(f); - HDassert(object); + HDassert(obj_ptr); + HDassert(key); /* Do a global flush if the file is opened for write */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { @@ -817,11 +823,11 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get dataset creation property list object */ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") /* Peek at the layout information */ if (H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, dcpl_layout) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") /* Check if the dataset is chunked */ if (H5D_CHUNKED == dcpl_layout->type) { @@ -829,7 +835,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get I/O pipeline information */ if (H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") /* Check if the chunks have filters */ if (dcpl_pline.nused > 0) { @@ -846,12 +852,12 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get ID for dataspace to pass to filter routines */ if ((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) { (void)H5S_close(space); - HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") } /* Make the callbacks */ if (H5Z_prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") } } } @@ -1519,13 +1525,13 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) /* if the pipeline has no filters, just return */ if (pline->nused == 0) - HGOTO_DONE (SUCCEED) + HGOTO_DONE(SUCCEED) /* Delete all filters */ if (H5Z_FILTER_ALL == filter) { if (H5O_msg_reset(H5O_PLINE_ID, pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFREE, FAIL, "can't release pipeline info") - } /* end if */ + } /* Delete filter */ else { size_t idx; /* Index of filter in pipeline */ @@ -1568,7 +1574,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) pline->nused--; /* Reset information for previous last filter in pipeline */ - HDmemset (&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); + HDmemset(&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); } /* end else */ done: @@ -1596,7 +1602,7 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags) /* Get the filter info */ if (H5Z_get_filter_info(filter, filter_config_flags) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5detect.c b/src/H5detect.c index aac58de..4424009 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -150,12 +150,13 @@ static H5JMP_BUF jbuf_g; #endif + /*------------------------------------------------------------------------- - * Function: precision + * Function: precision * - * Purpose: Determine the precision and offset. + * Purpose: Determine the precision and offset. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -163,22 +164,22 @@ precision (detected_t *d) { unsigned int n; - if (0 == d->msize) { + if(0 == d->msize) { /* * An integer. The permutation can have negative values at the * beginning or end which represent padding of bytes. We must adjust * the precision and offset accordingly. */ - if (d->perm[0] < 0) { + if(d->perm[0] < 0) { /* * Lower addresses are padded. */ - for (n = 0; n < d->size && d->perm[n] < 0; n++) + for(n = 0; n < d->size && d->perm[n] < 0; n++) /*void*/; d->precision = 8 * (d->size - n); d->offset = 0; } - else if (d->perm[d->size - 1] < 0) { + else if(d->perm[d->size - 1] < 0) { /* * Higher addresses are padded. */ @@ -202,18 +203,18 @@ precision (detected_t *d) } } - + /*------------------------------------------------------------------------- - * Function: DETECT_I/DETECT_BYTE + * Function: DETECT_I/DETECT_BYTE * - * Purpose: These macro takes a type like `int' and a base name like - * `nati' and detects the byte order. The VAR is used to - * construct the names of the C variables defined. + * Purpose: These macro takes a type like `int' and a base name like + * `nati' and detects the byte order. The VAR is used to + * construct the names of the C variables defined. * - * DETECT_I is used for types that are larger than one byte, - * DETECT_BYTE is used for types that are exactly one byte. + * DETECT_I is used for types that are larger than one byte, + * DETECT_BYTE is used for types that are exactly one byte. * - * Return: void + * Return: void * * Modifications: * @@ -276,15 +277,15 @@ precision (detected_t *d) DETECT_I_BYTE_CORE(TYPE,VAR,INFO,TYPE) \ } - + /*------------------------------------------------------------------------- - * Function: DETECT_F + * Function: DETECT_F * - * Purpose: This macro takes a floating point type like `double' and - * a base name like `natd' and detects byte order, mantissa - * location, exponent location, sign bit location, presence or - * absence of implicit mantissa bit, and exponent bias and - * initializes a detected_t structure with those properties. + * Purpose: This macro takes a floating point type like `double' and + * a base name like `natd' and detects byte order, mantissa + * location, exponent location, sign bit location, presence or + * absence of implicit mantissa bit, and exponent bias and + * initializes a detected_t structure with those properties. *------------------------------------------------------------------------- */ #define DETECT_F(TYPE,VAR,INFO) { \ @@ -373,15 +374,15 @@ precision (detected_t *d) } \ } - + /*------------------------------------------------------------------------- - * Function: DETECT_M + * Function: DETECT_M * - * Purpose: This macro takes only miscellaneous structures or pointer - * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It - * constructs the names and decides the alignment in structure. + * Purpose: This macro takes only miscellaneous structures or pointer + * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It + * constructs the names and decides the alignment in structure. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ #define DETECT_M(TYPE,VAR,INFO) { \ @@ -449,15 +450,16 @@ precision (detected_t *d) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- - * Function: sigsegv_handler + * Function: sigsegv_handler * - * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -481,15 +483,16 @@ sigsegv_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- - * Function: sigbus_handler + * Function: sigbus_handler * - * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -513,15 +516,16 @@ sigbus_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- - * Function: sigill_handler + * Function: sigill_handler * - * Purpose: Handler for SIGILL. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGILL. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -543,13 +547,13 @@ sigill_handler(int H5_ATTR_UNUSED signo) } #endif - + /*------------------------------------------------------------------------- - * Function: print_results + * Function: print_results * - * Purpose: Prints information about the detected data types. + * Purpose: Prints information about the detected data types. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -696,7 +700,7 @@ H5T__init_native(void)\n\ d[i].precision); /*precision */ /*HDassert((d[i].perm[0]>0)==(byte_order>0));*/ /* Double-check that byte-order doesn't change */ - if (0 == d[i].msize) { + if(0 == d[i].msize) { /* The part unique to fixed point types */ fprintf(rawoutstream, "\ dt->shared->u.atomic.u.i.sign = H5T_SGN_%s;\n", @@ -822,13 +826,13 @@ done:\n\ fprintf(rawoutstream, "/* sigill_handler called: %d times */\n", sigill_handler_called_g); } /* end print_results() */ - + /*------------------------------------------------------------------------- - * Function: iprint + * Function: iprint * - * Purpose: Prints information about the fields of a floating point format. + * Purpose: Prints information about the fields of a floating point format. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ @@ -837,17 +841,17 @@ iprint(detected_t *d) { unsigned int pass; - for (pass = (d->size - 1) / 4; ; --pass) { + for(pass = (d->size - 1) / 4; ; --pass) { unsigned int i, k; /* * Print the byte ordering above the bit fields. */ fprintf(rawoutstream, " * "); - for (i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) { + for(i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) { fprintf(rawoutstream, "%4d", d->perm[i]); - if (i > pass * 4) + if(i > pass * 4) HDfputs(" ", stdout); - if (!i) + if(!i) break; } @@ -855,24 +859,24 @@ iprint(detected_t *d) * Print the bit fields */ fprintf(rawoutstream, "\n * "); - for (i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31, + for(i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31, 8 * d->size - 1); i >= pass * 4; --i) { unsigned int j; - for (j = 8; j > 0; --j) { - if (k == d->sign && d->msize) { + for(j = 8; j > 0; --j) { + if(k == d->sign && d->msize) { HDfputc('S', rawoutstream); } - else if (k >= d->epos && k < d->epos + d->esize) { + else if(k >= d->epos && k < d->epos + d->esize) { HDfputc('E', rawoutstream); } - else if (k >= d->mpos && k < d->mpos + d->msize) { + else if(k >= d->mpos && k < d->mpos + d->msize) { HDfputc('M', rawoutstream); } - else if (d->msize) { + else if(d->msize) { HDfputc('?', rawoutstream); /*unknown floating point bit */ } - else if (d->sign) { + else if(d->sign) { HDfputc('I', rawoutstream); } else { @@ -880,27 +884,30 @@ iprint(detected_t *d) } --k; } - if (i > pass * 4) HDfputc(' ', rawoutstream); - if (!i) break; + if(i > pass * 4) + HDfputc(' ', rawoutstream); + if(!i) + break; } HDfputc('\n', rawoutstream); - if (!pass) break; + if(!pass) + break; } /* * Is there an implicit bit in the mantissa. */ - if (d->msize) { + if(d->msize) { fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no"); } /* * Alignment */ - if (0 == d->align) { + if(0 == d->align) { fprintf(rawoutstream, " * Alignment: NOT CALCULATED\n"); } - else if (1 == d->align) { + else if(1 == d->align) { fprintf(rawoutstream, " * Alignment: none\n"); } else { @@ -909,17 +916,17 @@ iprint(detected_t *d) } - + /*------------------------------------------------------------------------- - * Function: byte_cmp + * Function: byte_cmp * - * Purpose: Compares two chunks of memory A and B and returns the - * byte index into those arrays of the first byte that - * differs between A and B. Ignores differences where the - * corresponding bit in pad_mask is set to 0. + * Purpose: Compares two chunks of memory A and B and returns the + * byte index into those arrays of the first byte that + * differs between A and B. Ignores differences where the + * corresponding bit in pad_mask is set to 0. * - * Return: Success: Index of differing byte. - * Failure: -1 if all bytes are the same. + * Return: Success: Index of differing byte. + * Failure: -1 if all bytes are the same. *------------------------------------------------------------------------- */ static int @@ -936,17 +943,17 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) return -1; } - + /*------------------------------------------------------------------------- - * Function: bit_cmp + * Function: bit_cmp * - * Purpose: Compares two bit vectors and returns the index for the - * first bit that differs between the two vectors. The - * size of the vector is NBYTES. PERM is a mapping from - * actual order to little endian. Ignores differences where - * the corresponding bit in pad_mask is set to 0. + * Purpose: Compares two bit vectors and returns the index for the + * first bit that differs between the two vectors. The + * size of the vector is NBYTES. PERM is a mapping from + * actual order to little endian. Ignores differences where + * the corresponding bit in pad_mask is set to 0. * - * Return: Index of first differing bit. + * Return: Index of first differing bit. * *------------------------------------------------------------------------- */ @@ -959,14 +966,14 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, unsigned char *b = (unsigned char *) _b; unsigned char aa, bb; - for (i = 0; i < nbytes; i++) { + for(i = 0; i < nbytes; i++) { HDassert(perm[i] < (int) nbytes); - if ((aa = (unsigned char) (a[perm[i]] & pad_mask[perm[i]])) + if((aa = (unsigned char) (a[perm[i]] & pad_mask[perm[i]])) != (bb = (unsigned char) (b[perm[i]] & pad_mask[perm[i]]))) { unsigned int j; - for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { - if ((aa & 1) != (bb & 1)) return i * 8 + j; + for(j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { + if((aa & 1) != (bb & 1)) return i * 8 + j; } fprintf(stderr, "INTERNAL ERROR"); HDabort(); @@ -977,19 +984,19 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, return 0; } - + /*------------------------------------------------------------------------- - * Function: fix_order + * Function: fix_order * - * Purpose: Given an array PERM with elements FIRST through LAST - * initialized with zero origin byte numbers, this function - * creates a permutation vector that maps the actual order - * of a floating point number to little-endian. + * Purpose: Given an array PERM with elements FIRST through LAST + * initialized with zero origin byte numbers, this function + * creates a permutation vector that maps the actual order + * of a floating point number to little-endian. * - * This function assumes that the mantissa byte ordering - * implies the total ordering. + * This function assumes that the mantissa byte ordering + * implies the total ordering. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -997,28 +1004,28 @@ fix_order(int n, int last, int *perm, const char **mesg) { int i; - if (last > 1) { + if(last > 1) { /* * We have at least three points to consider. */ - if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { + if(perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { /* * Little endian. */ - if (mesg) + if(mesg) *mesg = "Little-endian"; - for (i = 0; i < n; i++) + for(i = 0; i < n; i++) perm[i] = i; } - else if (perm[last] > perm[last - 1] + else if(perm[last] > perm[last - 1] && perm[last - 1] > perm[last - 2]) { /* * Big endian. */ - if (mesg) + if(mesg) *mesg = "Big-endian"; - for (i = 0; i < n; i++) + for(i = 0; i < n; i++) perm[i] = (n - 1) - i; } @@ -1030,9 +1037,9 @@ fix_order(int n, int last, int *perm, const char **mesg) * case - JKM & QAK) */ HDassert(0 == n % 2); - if (mesg) + if(mesg) *mesg = "VAX"; - for (i = 0; i < n; i += 2) { + for(i = 0; i < n; i += 2) { perm[i] = (n - 2) - i; perm[i + 1] = (n - 1) - i; } @@ -1045,34 +1052,31 @@ fix_order(int n, int last, int *perm, const char **mesg) } } - + /*------------------------------------------------------------------------- - * Function: imp_bit - * - * Purpose: Looks for an implicit bit in the mantissa. The value - * of _A should be 1.0 and the value of _B should be 0.5. - * Some floating-point formats discard the most significant - * bit of the mantissa after normalizing since it will always - * be a one (except for 0.0). If this is true for the native - * floating point values stored in _A and _B then the function - * returns non-zero. + * Function: imp_bit * - * This function assumes that the exponent occupies higher - * order bits than the mantissa and that the most significant - * bit of the mantissa is next to the least significant bit - * of the exponent. + * Purpose: Looks for an implicit bit in the mantissa. The value + * of _A should be 1.0 and the value of _B should be 0.5. + * Some floating-point formats discard the most significant + * bit of the mantissa after normalizing since it will always + * be a one (except for 0.0). If this is true for the native + * floating point values stored in _A and _B then the function + * returns non-zero. * + * This function assumes that the exponent occupies higher + * order bits than the mantissa and that the most significant + * bit of the mantissa is next to the least significant bit + * of the exponent. * - * Return: Success: Non-zero if the most significant bit - * of the mantissa is discarded (ie, the - * mantissa has an implicit `one' as the - * most significant bit). Otherwise, - * returns zero. * - * Failure: 1 + * Return: Success: Non-zero if the most significant bit + * of the mantissa is discarded (ie, the + * mantissa has an implicit `one' as the + * most significant bit). Otherwise, + * returns zero. * - * Modifications: - * Fixed a bug that occurs with non-implicit architectures. + * Failure: 1 * *------------------------------------------------------------------------- */ @@ -1102,7 +1106,7 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ return (a[perm[major]] >> minor) & 0x01 ? 0 : 1; } - + /*------------------------------------------------------------------------- * Function: find_bias * @@ -1111,10 +1115,6 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ * * Return: The exponent bias. * - * Modifications: - * Fixed a bug with non-implicit architectures returning the - * wrong exponent bias. - * *------------------------------------------------------------------------- */ H5_ATTR_PURE static unsigned int @@ -1124,7 +1124,7 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) unsigned char mask; unsigned int b, shift = 0, nbits, bias = 0; - while (esize > 0) { + while(esize > 0) { nbits = MIN(esize, (8 - epos % 8)); mask = (unsigned char) ((1 << nbits) - 1); b = (unsigned int) (a[perm[epos / 8]] >> (epos % 8)) & mask; @@ -1137,13 +1137,13 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) return bias; } - + /*------------------------------------------------------------------------- - * Function: print_header + * Function: print_header * - * Purpose: Prints the C file header for the generated file. + * Purpose: Prints the C file header for the generated file. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -1210,8 +1210,8 @@ bit.\n"; { size_t n; char *comma; - if ((pwd = HDgetpwuid(HDgetuid()))) { - if ((comma = HDstrchr(pwd->pw_gecos, ','))) { + if((pwd = HDgetpwuid(HDgetuid()))) { + if((comma = HDstrchr(pwd->pw_gecos, ','))) { n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); HDstrncpy(real_name, pwd->pw_gecos, n); real_name[n] = '\0'; @@ -1221,9 +1221,8 @@ bit.\n"; real_name[sizeof(real_name) - 1] = '\0'; } } - else { + else real_name[0] = '\0'; - } } #else real_name[0] = '\0'; @@ -1233,7 +1232,7 @@ bit.\n"; * The FQDM of this host or the empty string. */ #ifdef H5_HAVE_GETHOSTNAME - if (HDgethostname(host_name, sizeof(host_name)) < 0) { + if(HDgethostname(host_name, sizeof(host_name)) < 0) { host_name[0] = '\0'; } #else @@ -1248,23 +1247,23 @@ bit.\n"; fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); - if (pwd || real_name[0] || host_name[0]) { + if(pwd || real_name[0] || host_name[0]) { fprintf(rawoutstream, " *\t\t\t"); - if (real_name[0]) + if(real_name[0]) fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID - if (pwd) HDfputs(pwd->pw_name, rawoutstream); + if(pwd) HDfputs(pwd->pw_name, rawoutstream); #endif - if (host_name[0]) + if(host_name[0]) fprintf(rawoutstream, "@%s", host_name); - if (real_name[0]) + if(real_name[0]) fprintf(rawoutstream, ">"); HDfputc('\n', rawoutstream); } fprintf(rawoutstream, " *\n * Purpose:\t\t"); - for (s = purpose; *s; s++) { + for(s = purpose; *s; s++) { HDfputc(*s, rawoutstream); - if ('\n' == *s && s[1]) + if('\n' == *s && s[1]) fprintf(rawoutstream, " *\t\t\t"); } @@ -1273,19 +1272,19 @@ bit.\n"; fprintf(rawoutstream, " *\tIt was generated by code in `H5detect.c'.\n"); fprintf(rawoutstream, " *\n *"); - for (i = 0; i < 73; i++) + for(i = 0; i < 73; i++) HDfputc('-', rawoutstream); fprintf(rawoutstream, "\n */\n\n"); } - + /*------------------------------------------------------------------------- - * Function: detect_C89_integers + * Function: detect_C89_integers * - * Purpose: Detect C89 integer types + * Purpose: Detect C89 integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1301,13 +1300,13 @@ detect_C89_integers(void) DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++; } - + /*------------------------------------------------------------------------- - * Function: detect_C89_floats + * Function: detect_C89_floats * - * Purpose: Detect C89 floating point types + * Purpose: Detect C89 floating point types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1317,13 +1316,13 @@ detect_C89_floats(void) DETECT_F(double, DOUBLE, d_g[nd_g]); nd_g++; } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers8 + * Function: detect_C99_integers8 * - * Purpose: Detect C99 8 bit integer types + * Purpose: Detect C99 8 bit integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1373,13 +1372,13 @@ detect_C99_integers8(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers16 + * Function: detect_C99_integers16 * - * Purpose: Detect C99 16 bit integer types + * Purpose: Detect C99 16 bit integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1405,13 +1404,13 @@ detect_C99_integers16(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers32 + * Function: detect_C99_integers32 * - * Purpose: Detect C99 32 bit integer types + * Purpose: Detect C99 32 bit integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1437,13 +1436,13 @@ detect_C99_integers32(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers64 + * Function: detect_C99_integers64 * - * Purpose: Detect C99 64 bit integer types + * Purpose: Detect C99 64 bit integer types * - * Return: void + * Return: void * *------------------------------------------------------------------------- */ @@ -1483,13 +1482,13 @@ detect_C99_integers64(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers + * Function: detect_C99_integers * - * Purpose: Detect C99 integer types + * Purpose: Detect C99 integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1503,13 +1502,13 @@ detect_C99_integers(void) detect_C99_integers64(); } - + /*------------------------------------------------------------------------- - * Function: detect_C99_floats + * Function: detect_C99_floats * - * Purpose: Detect C99 floating point types + * Purpose: Detect C99 floating point types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1528,13 +1527,13 @@ detect_C99_floats(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_alignments + * Function: detect_alignments * - * Purpose: Detect structure alignments + * Purpose: Detect structure alignments * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1570,9 +1569,9 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) volatile int nfailures = 0; volatile int nsuccesses = 0; - for (i=0;i0 || nsuccesses != ntries) { + if(nfailures>0 || nsuccesses != ntries) { fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " "Found %d failures and %d successes\n", signum, ntries, nfailures, nsuccesses); @@ -1605,13 +1604,13 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) } #endif - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Main entry point. + * Purpose: Main entry point. * - * Return: Success: 0 + * Return: Success: EXIT_SUCCESS * * Modifications: * Some compilers, e.g., Intel C v7.0, took a long time to compile @@ -1628,17 +1627,16 @@ main(int argc, char *argv[]) FILE *f; /* temporary holding place for the stream pointer * so that rawoutstream is changed only when succeeded */ - if (argc > 1) { + if(argc > 1) fname = argv[1]; - } + /* First check if filename is string "NULL" */ - if (fname != NULL) { + if(fname != NULL) { /* binary output */ - if ((f = HDfopen(fname, "w")) != NULL) { + if((f = HDfopen(fname, "w")) != NULL) rawoutstream = f; - } } - if (!rawoutstream) + if(!rawoutstream) rawoutstream = stdout; #if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) @@ -1650,7 +1648,7 @@ main(int argc, char *argv[]) int nvpairs[2]; nvpairs[0] = SSIN_UACPROC; nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS; - if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) { + if(setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) { fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", HDstrerror(errno)); } @@ -1659,15 +1657,15 @@ main(int argc, char *argv[]) #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* verify the SIGBUS and SIGSEGV handlers work properly */ - if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { + if(verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigbus_handler", SIGBUS); } - if (verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) { + if(verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigsegv_handler", SIGSEGV); } - if (verify_signal_handlers(SIGILL, sigill_handler) != 0) { + if(verify_signal_handlers(SIGILL, sigill_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigill_handler", SIGILL); } @@ -1694,8 +1692,8 @@ main(int argc, char *argv[]) print_results (nd_g, d_g, na_g, m_g); - if (rawoutstream && rawoutstream != stdout) { - if (HDfclose(rawoutstream)) + if(rawoutstream && rawoutstream != stdout) { + if(HDfclose(rawoutstream)) fprintf(stderr, "closing rawoutstream"); else rawoutstream = NULL; @@ -1703,3 +1701,4 @@ main(int argc, char *argv[]) return EXIT_SUCCESS; } + diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index d4caabb..da7c8d9 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -40,6 +40,7 @@ static const char *FileHeader = "\n\ FILE *rawoutstream = NULL; + /*------------------------------------------------------------------------- * Function: insert_libhdf5_settings * @@ -104,7 +105,7 @@ insert_libhdf5_settings(FILE *flibinfo) #endif } /* insert_libhdf5_settings() */ - + /*------------------------------------------------------------------------- * Function: make_libinfo * @@ -122,7 +123,7 @@ make_libinfo(void) insert_libhdf5_settings(rawoutstream); } - + /*------------------------------------------------------------------------- * Function: print_header * @@ -228,7 +229,7 @@ information about the library build configuration\n"; fprintf(rawoutstream, "\n */\n\n"); } - + /*------------------------------------------------------------------------- * Function: print_footer * @@ -243,13 +244,13 @@ print_footer(void) /* nothing */ } - + /*------------------------------------------------------------------------- * Function: main * * Purpose: Main entry point. * - * Return: Success: 0 + * Return: Success: EXIT_SUCCESS *------------------------------------------------------------------------- */ int @@ -257,19 +258,19 @@ main(int argc, char *argv[]) { char *fname = NULL; FILE *f; /* temporary holding place for the stream pointer - * so that rawoutstream is changed only when succeeded */ + * so that rawoutstream is changed only when succeeded + */ - if (argc > 1) { + if(argc > 1) fname = argv[1]; - } + /* First check if filename is string "NULL" */ - if (fname != NULL) { + if(fname != NULL) { /* binary output */ - if ((f = HDfopen(fname, "w")) != NULL) { + if((f = HDfopen(fname, "w")) != NULL) rawoutstream = f; - } } - if (!rawoutstream) + if(!rawoutstream) rawoutstream = stdout; print_header(); @@ -279,8 +280,8 @@ main(int argc, char *argv[]) print_footer(); - if (rawoutstream && rawoutstream != stdout) { - if (HDfclose(rawoutstream)) + if(rawoutstream && rawoutstream != stdout) { + if(HDfclose(rawoutstream)) fprintf(stderr, "closing rawoutstream"); else rawoutstream = NULL; @@ -288,3 +289,4 @@ main(int argc, char *argv[]) HDexit(EXIT_SUCCESS); } + diff --git a/src/Makefile.am b/src/Makefile.am index bc5c09e..472dfc6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -113,7 +113,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \ H5Topaque.c \ H5Torder.c \ - H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \ + H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ + H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ H5Zscaleoffset.c H5Zszip.c H5Ztrans.c @@ -138,8 +139,8 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h H5PLpublic.h \ - H5Rpublic.h H5Spublic.h \ - H5Tpublic.h H5Zpublic.h + H5Rpublic.h H5Spublic.h H5Tpublic.h \ + H5Zpublic.h # install libhdf5.settings in lib directory settingsdir=$(libdir) -- cgit v0.12