summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-05-30 07:38:48 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-05-30 07:38:48 (GMT)
commit6468a613fd14570a29bb54c0437bbc087f770621 (patch)
tree4c9389c1d670f85a95371271f5411f14e375fdd6
parenta1a05d220a037a6f035cadd9316f0eaca88e300f (diff)
downloadhdf5-6468a613fd14570a29bb54c0437bbc087f770621.zip
hdf5-6468a613fd14570a29bb54c0437bbc087f770621.tar.gz
hdf5-6468a613fd14570a29bb54c0437bbc087f770621.tar.bz2
Many normalizations with develop.
-rw-r--r--src/H5AC.c347
-rw-r--r--src/H5ACmpio.c8
-rw-r--r--src/H5ACprivate.h2
-rw-r--r--src/H5C.c33
-rw-r--r--src/H5CX.c20
-rw-r--r--src/H5Clog_json.c2
-rw-r--r--src/H5Clog_trace.c2
-rw-r--r--src/H5Ctag.c2
-rw-r--r--src/H5Dchunk.c76
-rw-r--r--src/H5Dcontig.c1
-rw-r--r--src/H5Dfarray.c234
-rw-r--r--src/H5Dnone.c55
-rw-r--r--src/H5Dpublic.h23
-rw-r--r--src/H5Dsingle.c10
-rw-r--r--src/H5Dvirtual.c15
-rw-r--r--src/H5Faccum.c1
-rw-r--r--src/H5Fefc.c10
-rw-r--r--src/H5Ffake.c3
-rw-r--r--src/H5Fmount.c4
-rw-r--r--src/H5Fpkg.h2
-rw-r--r--src/H5Fsuper.c118
-rw-r--r--src/H5Glink.c10
-rw-r--r--src/H5Gname.c56
-rw-r--r--src/H5Gtraverse.c19
-rw-r--r--src/H5HF.c4
-rw-r--r--src/H5HFhdr.c7
-rw-r--r--src/H5HFsection.c12
-rw-r--r--src/H5HFtiny.c1
-rw-r--r--src/H5HG.c77
-rw-r--r--src/H5HGcache.c4
-rw-r--r--src/H5HGpkg.h4
-rw-r--r--src/H5HGprivate.h2
-rw-r--r--src/H5L.c447
-rw-r--r--src/H5Lexternal.c72
-rw-r--r--src/H5Lprivate.h3
-rw-r--r--src/H5Shyper.c56
36 files changed, 875 insertions, 867 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index a1b096c..8312f8b 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -134,16 +134,16 @@ static const H5AC_class_t *const H5AC_class_s[] = {
};
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_init
*
* Purpose: Initialize the interface from some other layer.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, January 18, 2003
*
*-------------------------------------------------------------------------
@@ -160,15 +160,15 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC_init() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5AC__init_package
+ * Function H5AC__init_package
*
- * Purpose: Initialize interface-specific information
+ * Purpose: Initialize interface-specific information
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, July 18, 2002
*
*-------------------------------------------------------------------------
@@ -196,17 +196,17 @@ H5AC__init_package(void)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5AC__init_package() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_term_package
*
- * Purpose: Terminate this interface.
+ * Purpose: Terminate this interface.
*
- * Return: Success: Positive if anything was done that might
+ * Return: Success: Positive if anything was done that might
* affect other interfaces; zero otherwise.
- * Failure: Negative.
+ * Failure: Negative.
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, July 18, 2002
*
*-------------------------------------------------------------------------
@@ -223,7 +223,7 @@ H5AC_term_package(void)
FUNC_LEAVE_NOAPI(0)
} /* end H5AC_term_package() */
-
+
/*-------------------------------------------------------------------------
*
* Function: H5AC_cache_image_pending()
@@ -261,7 +261,7 @@ H5AC_cache_image_pending(const H5F_t *f)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_cache_image_pending() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_create
*
@@ -309,9 +309,9 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
#ifdef H5_HAVE_PARALLEL
if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- MPI_Comm mpi_comm;
+ MPI_Comm mpi_comm;
int mpi_rank;
- int mpi_size;
+ int mpi_size;
if(MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(f)))
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator")
@@ -400,7 +400,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
#endif /* H5_HAVE_PARALLEL */
if(NULL == f->shared->cache)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
#ifdef H5_HAVE_PARALLEL
if(aux_ptr != NULL)
@@ -458,7 +458,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_create() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_dest
*
@@ -556,17 +556,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_dest() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_evict
*
* Purpose: Evict all entries except the pinned entries
- * in the cache.
+ * in the cache.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi
- * Dec 2013
+ * Dec 2013
*
*-------------------------------------------------------------------------
*/
@@ -596,13 +596,13 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_evict() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_expunge_entry
*
- * Purpose: Expunge the target entry from the cache without writing it
- * to disk even if it is dirty. The entry must not be either
- * pinned or protected.
+ * Purpose: Expunge the target entry from the cache without writing it
+ * to disk even if it is dirty. The entry must not be either
+ * pinned or protected.
*
* Return: Non-negative on success/Negative on failure
*
@@ -639,17 +639,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_expunge_entry() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_flush
*
- * Purpose: Flush (and possibly destroy) the metadata cache associated
- * with the specified file.
+ * Purpose: Flush (and possibly destroy) the metadata cache associated
+ * with the specified file.
*
- * If the cache contains protected entries, the function will
- * fail, as protected entries cannot be flushed. However
- * all unprotected entries should be flushed before the
- * function returns failure.
+ * If the cache contains protected entries, the function will
+ * fail, as protected entries cannot be flushed. However
+ * all unprotected entries should be flushed before the
+ * function returns failure.
*
* Return: Non-negative on success/Negative on failure if there was a
* request to flush all items and something was protected.
@@ -696,7 +696,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_flush() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_force_cache_image_load()
*
@@ -736,20 +736,20 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_force_cache_image_load() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_get_entry_status
*
* Purpose: Given a file address, determine whether the metadata
- * cache contains an entry at that location. If it does,
- * also determine whether the entry is dirty, protected,
- * pinned, etc. and return that information to the caller
- * in *status.
+ * cache contains an entry at that location. If it does,
+ * also determine whether the entry is dirty, protected,
+ * pinned, etc. and return that information to the caller
+ * in *status.
*
- * If the specified entry doesn't exist, set *status_ptr
- * to zero.
+ * If the specified entry doesn't exist, set *status_ptr
+ * to zero.
*
- * On error, the value of *status is undefined.
+ * On error, the value of *status is undefined.
*
* Return: Non-negative on success/Negative on failure
*
@@ -761,14 +761,14 @@ done:
herr_t
H5AC_get_entry_status(const H5F_t *f, haddr_t addr, unsigned *status)
{
- hbool_t in_cache; /* Entry @ addr is in the cache */
- hbool_t is_dirty; /* Entry @ addr is in the cache and dirty */
- hbool_t is_protected; /* Entry @ addr is in the cache and protected */
- hbool_t is_pinned; /* Entry @ addr is in the cache and pinned */
- hbool_t is_corked;
- hbool_t is_flush_dep_child; /* Entry @ addr is in the cache and is a flush dependency child */
- hbool_t is_flush_dep_parent; /* Entry @ addr is in the cache and is a flush dependency parent */
- hbool_t image_is_up_to_date; /* Entry @ addr is in the cache and has an up to date image */
+ hbool_t in_cache; /* Entry @ addr is in the cache */
+ hbool_t is_dirty; /* Entry @ addr is in the cache and dirty */
+ hbool_t is_protected; /* Entry @ addr is in the cache and protected */
+ hbool_t is_pinned; /* Entry @ addr is in the cache and pinned */
+ hbool_t is_corked;
+ hbool_t is_flush_dep_child; /* Entry @ addr is in the cache and is a flush dependency child */
+ hbool_t is_flush_dep_parent; /* Entry @ addr is in the cache and is a flush dependency parent */
+ hbool_t image_is_up_to_date; /* Entry @ addr is in the cache and has an up to date image */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -781,7 +781,7 @@ H5AC_get_entry_status(const H5F_t *f, haddr_t addr, unsigned *status)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_status() failed")
if(in_cache) {
- *status |= H5AC_ES__IN_CACHE;
+ *status |= H5AC_ES__IN_CACHE;
if(is_dirty)
*status |= H5AC_ES__IS_DIRTY;
if(is_protected)
@@ -804,7 +804,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_entry_status() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_insert_entry
*
@@ -876,7 +876,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_insert_entry() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_load_cache_image_on_next_protect
*
@@ -911,12 +911,12 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_load_cache_image_on_next_protect() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_dirty
*
- * Purpose: Mark a pinned or protected entry as dirty. The target
- * entry MUST be either pinned, protected, or both.
+ * Purpose: Mark a pinned or protected entry as dirty. The target
+ * entry MUST be either pinned, protected, or both.
*
* Return: Non-negative on success/Negative on failure
*
@@ -965,12 +965,12 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_dirty() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_clean
*
- * Purpose: Mark a pinned entry as clean. The target
- * entry MUST be pinned.
+ * Purpose: Mark a pinned entry as clean. The target
+ * entry MUST be pinned.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1018,12 +1018,12 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_clean() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_unserialized
*
- * Purpose: Mark a pinned or protected entry as unserialized. The target
- * entry MUST be either pinned, protected, or both.
+ * Purpose: Mark a pinned or protected entry as unserialized. The target
+ * entry MUST be either pinned, protected, or both.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1060,12 +1060,12 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_unserialized() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_serialized
*
- * Purpose: Mark a pinned entry as serialized. The target
- * entry MUST be pinned.
+ * Purpose: Mark a pinned entry as serialized. The target
+ * entry MUST be pinned.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1101,7 +1101,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_serialized() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_move_entry
*
@@ -1160,11 +1160,11 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_move_entry() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_pin_protected_entry()
*
- * Purpose: Pin a protected cache entry. The entry must be protected
+ * Purpose: Pin a protected cache entry. The entry must be protected
* at the time of call, and must be unpinned.
*
* Return: Non-negative on success/Negative on failure
@@ -1203,7 +1203,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_pin_protected_entry() */
-
+
/*-------------------------------------------------------------------------
*
* Function: H5AC_prep_for_file_close
@@ -1241,11 +1241,11 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_prep_for_file_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_create_flush_dependency()
*
- * Purpose: Create a flush dependency between two entries in the metadata
+ * Purpose: Create a flush dependency between two entries in the metadata
* cache.
*
* Return: Non-negative on success/Negative on failure
@@ -1285,21 +1285,21 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_create_flush_dependency() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_protect
*
* Purpose: If the target entry is not in the cache, load it. If
- * necessary, attempt to evict one or more entries to keep
- * the cache within its maximum size.
+ * necessary, attempt to evict one or more entries to keep
+ * the cache within its maximum size.
*
- * Mark the target entry as protected, and return its address
- * to the caller. The caller must call H5AC_unprotect() when
- * finished with the entry.
+ * Mark the target entry as protected, and return its address
+ * to the caller. The caller must call H5AC_unprotect() when
+ * finished with the entry.
*
- * While it is protected, the entry may not be either evicted
- * or flushed -- nor may it be accessed by another call to
- * H5AC_protect. Any attempt to do so will result in a failure.
+ * While it is protected, the entry may not be either evicted
+ * or flushed -- nor may it be accessed by another call to
+ * H5AC_protect. Any attempt to do so will result in a failure.
*
* Return: Success: Ptr to the object.
* Failure: NULL
@@ -1341,7 +1341,7 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata,
/* Check for invalid access request */
if((0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) && (0 == (flags & H5C__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "no write intent on file")
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "no write intent on file")
#if H5AC_DO_TAGGING_SANITY_CHECKS
if(!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0)
@@ -1367,11 +1367,11 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_protect() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_resize_entry
*
- * Purpose: Resize a pinned or protected entry.
+ * Purpose: Resize a pinned or protected entry.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1420,12 +1420,12 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_resize_entry() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_unpin_entry()
*
- * Purpose: Unpin a cache entry. The entry must be unprotected at
- * the time of call, and must be pinned.
+ * Purpose: Unpin a cache entry. The entry must be unprotected at
+ * the time of call, and must be pinned.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1463,11 +1463,11 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unpin_entry() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_destroy_flush_dependency()
*
- * Purpose: Destroy a flush dependency between two entries.
+ * Purpose: Destroy a flush dependency between two entries.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1506,31 +1506,31 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_destroy_flush_dependency() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_unprotect
*
- * Purpose: Undo an H5AC_protect() call -- specifically, mark the
- * entry as unprotected, remove it from the protected list,
- * and give it back to the replacement policy.
+ * Purpose: Undo an H5AC_protect() call -- specifically, mark the
+ * entry as unprotected, remove it from the protected list,
+ * and give it back to the replacement policy.
*
- * The TYPE and ADDR arguments must be the same as those in
- * the corresponding call to H5AC_protect() and the THING
- * argument must be the value returned by that call to
- * H5AC_protect().
+ * The TYPE and ADDR arguments must be the same as those in
+ * the corresponding call to H5AC_protect() and the THING
+ * argument must be the value returned by that call to
+ * H5AC_protect().
*
- * If the deleted flag is TRUE, simply remove the target entry
- * from the cache, clear it, and free it without writing it to
- * disk.
+ * If the deleted flag is TRUE, simply remove the target entry
+ * from the cache, clear it, and free it without writing it to
+ * disk.
*
- * This version of the function is a complete re-write to
- * use the new metadata cache. While there isn't all that
- * much difference between the old and new Purpose sections,
- * the original version is given below.
+ * This version of the function is a complete re-write to
+ * use the new metadata cache. While there isn't all that
+ * much difference between the old and new Purpose sections,
+ * the original version is given below.
*
- * Original purpose section:
+ * Original purpose section:
*
- * This function should be called to undo the effect of
+ * This function should be called to undo the effect of
* H5AC_protect(). The TYPE and ADDR arguments should be the
* same as the corresponding call to H5AC_protect() and the
* THING argument should be the value returned by H5AC_protect().
@@ -1618,7 +1618,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unprotect() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_get_cache_auto_resize_config
*
@@ -1698,12 +1698,12 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr,
if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr))) {
config_ptr->dirty_bytes_threshold = aux_ptr->dirty_bytes_threshold;
- config_ptr->metadata_write_strategy = aux_ptr->metadata_write_strategy;
+ config_ptr->metadata_write_strategy = aux_ptr->metadata_write_strategy;
} /* end if */
else {
#endif /* H5_HAVE_PARALLEL */
config_ptr->dirty_bytes_threshold = H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD;
- config_ptr->metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY;
+ config_ptr->metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY;
#ifdef H5_HAVE_PARALLEL
} /* end else */
}
@@ -1713,7 +1713,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_cache_auto_resize_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_get_cache_size
*
@@ -1742,7 +1742,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_cache_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_get_cache_hit_rate
*
@@ -1769,7 +1769,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_cache_hit_rate() */
-
+
/*-------------------------------------------------------------------------
*
* Function: H5AC_reset_cache_hit_rate_stats()
@@ -1796,7 +1796,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_reset_cache_hit_rate_stats() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_set_cache_auto_resize_config
*
@@ -1813,7 +1813,7 @@ herr_t
H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr)
{
H5C_auto_size_ctl_t internal_config;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1888,21 +1888,21 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_set_cache_auto_resize_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_validate_config()
*
* Purpose: Run a sanity check on the contents of the supplied
- * instance of H5AC_cache_config_t.
+ * instance of H5AC_cache_config_t.
*
* Do nothing and return SUCCEED if no errors are detected,
* and flag an error and return FAIL otherwise.
*
- * At present, this function operates by packing the data
- * from the instance of H5AC_cache_config_t into an instance
- * of H5C_auto_size_ctl_t, and then calling
- * H5C_validate_resize_config(). As H5AC_cache_config_t and
- * H5C_auto_size_ctl_t diverge, we may have to change this.
+ * At present, this function operates by packing the data
+ * from the instance of H5AC_cache_config_t into an instance
+ * of H5C_auto_size_ctl_t, and then calling
+ * H5C_validate_resize_config(). As H5AC_cache_config_t and
+ * H5C_auto_size_ctl_t diverge, we may have to change this.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1965,22 +1965,22 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_validate_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_validate_cache_image_config()
*
* Purpose: Run a sanity check on the contents of the supplied
- * instance of H5AC_cache_image_config_t.
+ * instance of H5AC_cache_image_config_t.
*
* Do nothing and return SUCCEED if no errors are detected,
* and flag an error and return FAIL otherwise.
*
- * At present, this function operates by packing the data
- * from the instance of H5AC_cache_image_config_t into an
- * instance of H5C_cache_image_ctl_t, and then calling
- * H5C_validate_cache_image_config(). If and when
+ * At present, this function operates by packing the data
+ * from the instance of H5AC_cache_image_config_t into an
+ * instance of H5C_cache_image_ctl_t, and then calling
+ * H5C_validate_cache_image_config(). If and when
* H5AC_cache_image_config_t and H5C_cache_image_ctl_t
- * diverge, we may have to change this.
+ * diverge, we may have to change this.
*
* Return: Non-negative on success/Negative on failure
*
@@ -2020,19 +2020,19 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_validate_cache_image_config() */
-
+
/*-------------------------------------------------------------------------
*
* Function: H5AC__check_if_write_permitted
*
* Purpose: Determine if a write is permitted under the current
- * circumstances, and set *write_permitted_ptr accordingly.
- * As a general rule it is, but when we are running in parallel
- * mode with collective I/O, we must ensure that a read cannot
- * cause a write.
+ * circumstances, and set *write_permitted_ptr accordingly.
+ * As a general rule it is, but when we are running in parallel
+ * mode with collective I/O, we must ensure that a read cannot
+ * cause a write.
*
- * In the event of failure, the value of *write_permitted_ptr
- * is undefined.
+ * In the event of failure, the value of *write_permitted_ptr
+ * is undefined.
*
* Return: Non-negative on success/Negative on failure.
*
@@ -2050,7 +2050,7 @@ H5_ATTR_UNUSED
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
- hbool_t write_permitted = TRUE;
+ hbool_t write_permitted = TRUE;
FUNC_ENTER_STATIC_NOERR
@@ -2064,9 +2064,9 @@ H5_ATTR_UNUSED
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
if((aux_ptr->mpi_rank == 0) || (aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED))
- write_permitted = aux_ptr->write_permitted;
+ write_permitted = aux_ptr->write_permitted;
else
- write_permitted = FALSE;
+ write_permitted = FALSE;
} /* end if */
#endif /* H5_HAVE_PARALLEL */
@@ -2075,17 +2075,17 @@ H5_ATTR_UNUSED
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5AC__check_if_write_permitted() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC__ext_config_2_int_config()
*
* Purpose: Utility function to translate an instance of
- * H5AC_cache_config_t to an instance of H5C_auto_size_ctl_t.
+ * H5AC_cache_config_t to an instance of H5C_auto_size_ctl_t.
*
- * Places translation in *int_conf_ptr and returns SUCCEED
- * if successful. Returns FAIL on failure.
+ * Places translation in *int_conf_ptr and returns SUCCEED
+ * if successful. Returns FAIL on failure.
*
- * Does only minimal sanity checking.
+ * Does only minimal sanity checking.
*
* Return: Non-negative on success/Negative on failure
*
@@ -2141,7 +2141,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__ext_config_2_int_config() */
-
+
/*------------------------------------------------------------------------------
* Function: H5AC_ignore_tags()
*
@@ -2177,13 +2177,13 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_ignore_tags() */
-
+
/*------------------------------------------------------------------------------
* Function: H5AC_tag()
*
* 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
@@ -2205,7 +2205,7 @@ H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag)
FUNC_LEAVE_NOAPI_VOID
} /* H5AC_tag */
-
+
/*------------------------------------------------------------------------------
* Function: H5AC_retag_copied_metadata()
*
@@ -2239,7 +2239,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_retag_copied_metadata() */
-
+
/*------------------------------------------------------------------------------
* Function: H5AC_flush_tagged_metadata()
*
@@ -2274,7 +2274,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_flush_tagged_metadata */
-
+
/*------------------------------------------------------------------------------
* Function: H5AC_evict_tagged_metadata()
*
@@ -2309,7 +2309,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_evict_tagged_metadata() */
-
+
/*------------------------------------------------------------------------------
* Function: H5AC_expunge_tag_type_metadata()
*
@@ -2336,14 +2336,14 @@ 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:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_expunge_tag_type_metadata*/
-
+
/*------------------------------------------------------------------------------
* Function: H5AC_get_tag()
*
@@ -2377,7 +2377,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC_get_tag() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_cork
*
@@ -2424,7 +2424,7 @@ done:
} /* H5AC_cork() */
#if H5AC_DO_TAGGING_SANITY_CHECKS
-
+
/*-------------------------------------------------------------------------
*
* Function: H5AC__verify_tag
@@ -2459,14 +2459,14 @@ done:
} /* H5AC__verify_tag */
#endif /* H5AC_DO_TAGGING_SANITY_CHECKS */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_get_entry_ring
*
* Purpose: Given a file address, retrieve the ring for an entry at that
* address.
*
- * On error, the value of *ring is not modified.
+ * On error, the value of *ring is not modified.
*
* Return: Non-negative on success/Negative on failure
*
@@ -2495,18 +2495,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_entry_ring() */
-
+
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -2515,6 +2514,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();
@@ -2525,7 +2526,7 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring)
FUNC_LEAVE_NOAPI_VOID
} /* end H5AC_set_ring() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_unsettle_entry_ring()
*
@@ -2543,11 +2544,11 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring)
* are in the process of a file shutdown, post an error
* message, and return FAIL.
*
- * Note that this function simply passes the call on to
- * the metadata cache proper, and returns the result.
+ * Note that this function simply passes the call on to
+ * the metadata cache proper, and returns the result.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* September 17, 2016
@@ -2573,7 +2574,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unsettle_entry_ring() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_unsettle_ring()
*
@@ -2615,12 +2616,12 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unsettle_ring() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_remove_entry()
*
* Purpose: Remove an entry from the cache. Must be not protected, pinned,
- * dirty, involved in flush dependencies, etc.
+ * dirty, involved in flush dependencies, etc.
*
* Return: Non-negative on success/Negative on failure
*
@@ -2656,7 +2657,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_remove_entry() */
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_get_mdc_image_info
*
diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c
index 5e4e6b4..f097e83 100644
--- a/src/H5ACmpio.c
+++ b/src/H5ACmpio.c
@@ -498,7 +498,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t *aux_ptr,
+H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t H5_ATTR_NDEBUG_UNUSED *aux_ptr,
int sync_point_op)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -821,9 +821,8 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr)
{
H5AC_t * cache_ptr;
H5AC_aux_t * aux_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(entry_ptr);
@@ -853,8 +852,7 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr)
/* Decrement the dirty byte count */
aux_ptr->dirty_bytes -= entry_ptr->size;
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5AC__log_cleaned_entry() */
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 1416847..5e6c491 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -429,7 +429,7 @@ H5_DLL herr_t H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr,
/* Tag & Ring routines */
H5_DLL void H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag);
H5_DLL herr_t H5AC_flush_tagged_metadata(H5F_t *f, haddr_t metadata_tag);
-H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t * f, haddr_t metadata_tag, hbool_t match_global);
+H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t *f, haddr_t metadata_tag, hbool_t match_global);
H5_DLL herr_t H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag);
H5_DLL herr_t H5AC_ignore_tags(const H5F_t *f);
H5_DLL herr_t H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked);
diff --git a/src/H5C.c b/src/H5C.c
index cc415ec..f706a35 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1286,7 +1286,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;
@@ -2314,10 +2314,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();
@@ -2372,10 +2372,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)
@@ -2421,10 +2421,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
@@ -4260,11 +4260,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 a910c33..1d9349f 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -175,7 +175,7 @@
* corresponding property in the property list to be set when the API
* context is popped, when returning from the API routine. Note that the
* naming of these fields, <foo> and <foo>_set, is important for the
-* H5CX_TEST_SET_PROP and H5CX_SET_PROP macros to work properly.
+ * H5CX_TEST_SET_PROP and H5CX_SET_PROP macros to work properly.
*/
typedef struct H5CX_t {
/* DXPL */
@@ -300,9 +300,9 @@ typedef struct H5CX_t {
hbool_t ohdr_flags_valid; /* Whether the object headers flags are valid */
/* Cached DAPL properties */
- char *extfile_prefix; /* Prefix for external file */
+ const char *extfile_prefix; /* Prefix for external file */
hbool_t extfile_prefix_valid; /* Whether the prefix for external file is valid */
- char *vds_prefix; /* Prefix for VDS */
+ const char *vds_prefix; /* Prefix for VDS */
hbool_t vds_prefix_valid; /* Whether the prefix for VDS is valid */
/* Cached FAPL properties */
@@ -376,8 +376,8 @@ typedef struct H5CX_dcpl_cache_t {
/* Typedef for cached default dataset access property list information */
/* (Same as the cached DXPL struct, above, except for the default DXPL) */
typedef struct H5CX_dapl_cache_t {
- char *extfile_prefix; /* Prefix for external file */
- char *vds_prefix; /* Prefix for VDS */
+ const char *extfile_prefix; /* Prefix for external file */
+ const char *vds_prefix; /* Prefix for VDS */
} H5CX_dapl_cache_t;
/* Typedef for cached default file access property list information */
@@ -387,7 +387,6 @@ typedef struct H5CX_fapl_cache_t {
H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */
} H5CX_fapl_cache_t;
-
/********************/
/* Local Prototypes */
/********************/
@@ -575,7 +574,7 @@ H5CX__init_package(void)
/* Get the default DCPL cache information */
- /* Get the default link access property list */
+ /* Get the default dataset creation property list */
if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_CREATE_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list")
@@ -743,9 +742,9 @@ H5CX__push_common(H5CX_node_t *cnode)
/* Set non-zero context info */
cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ cnode->ctx.dapl_id = H5P_DATASET_ACCESS_DEFAULT;
cnode->ctx.lcpl_id = H5P_LINK_CREATE_DEFAULT;
cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
- cnode->ctx.dapl_id = H5P_DATASET_ACCESS_DEFAULT;
cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT;
cnode->ctx.tag = H5AC__INVALID_TAG;
cnode->ctx.ring = H5AC_RING_USER;
@@ -951,7 +950,7 @@ done:
* Return: <none>
*
* Programmer: Chris Hogan
- * November 27, 2019
+ * October 28, 2019
*
*-------------------------------------------------------------------------
*/
@@ -1128,7 +1127,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
@@ -2258,6 +2257,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_libver_bounds() */
+
/*-------------------------------------------------------------------------
* Function: H5CX_get_ext_file_prefix
*
diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c
index 051a81d..ab25a55 100644
--- a/src/H5Clog_json.c
+++ b/src/H5Clog_json.c
@@ -1281,7 +1281,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config,
+H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t H5_ATTR_NDEBUG_UNUSED *config,
herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c
index 118d03d..63fe382 100644
--- a/src/H5Clog_trace.c
+++ b/src/H5Clog_trace.c
@@ -41,7 +41,7 @@
/****************/
/* Max log message size */
-#define H5C_MAX_TRACE_LOG_MSG_SIZE 2048
+#define H5C_MAX_TRACE_LOG_MSG_SIZE 4096
/******************/
diff --git a/src/H5Ctag.c b/src/H5Ctag.c
index 756d0be..e92d0e4 100644
--- a/src/H5Ctag.c
+++ b/src/H5Ctag.c
@@ -497,7 +497,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/H5Dchunk.c b/src/H5Dchunk.c
index bf547d6..0f7bccf 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -269,7 +269,6 @@ static int H5D__get_num_chunks_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata
static int H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
static int H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
-
/* "Nonexistent" layout operation callback */
static ssize_t
H5D__nonexistent_readvv(const H5D_io_info_t *io_info,
@@ -421,10 +420,11 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
io_info.dset = dset;
/* Allocate dataspace and initialize it if it hasn't been. */
- if(!H5D__chunk_is_space_alloc(&layout->storage))
+ if(!H5D__chunk_is_space_alloc(&layout->storage)) {
/* Allocate storage */
if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
+ }
/* Calculate the index of this chunk */
H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, scaled);
@@ -580,7 +580,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
/* Get the new file address / chunk size after flushing */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
- } /* end if */
+ }
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
@@ -677,8 +677,8 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
/* Get the new file address / chunk size after flushing */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
- } /* end if */
- } /* end if */
+ }
+ }
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
@@ -4251,9 +4251,9 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
while(!carry) {
hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
- /* Look up this chunk */
- if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
+ /* Look up this chunk */
+ if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
#ifndef NDEBUG
/* None of the chunks should be allocated */
if(H5D_CHUNK_IDX_NONE != sc->idx_type) {
@@ -4286,7 +4286,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
/* Check to make sure the buffer is large enough. It is
* possible (though ill-advised) for the filter to shrink the
- * buffer. */
+ * buffer.
+ */
if(fb_info.fill_buf_size < orig_chunk_size) {
if(NULL == (fb_info.fill_buf = H5D__chunk_mem_realloc(fb_info.fill_buf, orig_chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory reallocation failed for raw data chunk")
@@ -4518,10 +4519,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
HGOTO_DONE(SUCCEED)
} /* end if */
- /*
- * Initialize structures needed to lock chunks into cache
- */
-
/* Set up chunked I/O info object, for operations on chunks (in callback).
* Note that we only need to set chunk_offset once, as the array's address
* will never change. */
@@ -4684,12 +4681,12 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
/* Distribute evenly the number of blocks between processes. */
if(mpi_size == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Resulted in division by zero")
- num_blocks = chunk_info->num_io / mpi_size; /* value should be the same on all procs */
+ num_blocks = (size_t)(chunk_info->num_io / (size_t)mpi_size); /* value should be the same on all procs */
/* after evenly distributing the blocks between processes, are
there any leftover blocks for each individual process
(round-robin) */
- leftover_blocks = chunk_info->num_io % mpi_size;
+ leftover_blocks = (size_t)(chunk_info->num_io % (size_t)mpi_size);
/* Cast values to types needed by MPI */
H5_CHECKED_ASSIGN(blocks, int, num_blocks, size_t);
@@ -4698,9 +4695,9 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
/* Allocate buffers */
/* (MSC - should not need block_lens if MPI_type_create_hindexed_block is working) */
- if(NULL == (block_lens = (int *)H5MM_malloc((blocks + 1) * sizeof(int))))
+ if(NULL == (block_lens = (int *)H5MM_malloc((size_t)(blocks + 1) * sizeof(int))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk lengths buffer")
- if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((blocks + 1) * sizeof(MPI_Aint))))
+ if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((size_t)(blocks + 1) * sizeof(MPI_Aint))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file displacement buffer")
for(i = 0 ; i < blocks ; i++) {
@@ -4735,8 +4732,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
if(need_addr_sort)
HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr);
- /* MSC
- * should use this if MPI_type_create_hindexed block is working
+ /* MSC - should use this if MPI_type_create_hindexed block is working:
* mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type);
*/
mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type);
@@ -4791,7 +4787,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_collective_fill() */
-
static int
H5D__chunk_cmp_addr(const void *addr1, const void *addr2)
@@ -4821,7 +4816,6 @@ H5D__chunk_cmp_addr(const void *addr1, const void *addr2)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_cmp_addr() */
-
#endif /* H5_HAVE_PARALLEL */
@@ -5404,7 +5398,6 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Set it in the userdata to return */
udata->chunk_addr[chunk_index] = chunk_rec->chunk_addr;
-done:
FUNC_LEAVE_NOAPI(H5_ITER_CONT)
} /* H5D__chunk_addrmap_cb() */
@@ -6393,7 +6386,8 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers)
}
#ifdef H5AC_DEBUG
- if (H5DEBUG(AC)) headers = TRUE;
+ if (H5DEBUG(AC))
+ headers = TRUE;
#endif
if (headers) {
@@ -6621,31 +6615,31 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded")
} /* end block */
- if(old_chunk && H5F_addr_defined(old_chunk->offset)) {
- /* Sanity check */
+ if(old_chunk && H5F_addr_defined(old_chunk->offset)) {
+ /* Sanity check */
HDassert(!H5F_addr_defined(new_chunk->offset) || H5F_addr_eq(new_chunk->offset, old_chunk->offset));
/* Check for chunk being same size */
- if(new_chunk->length != old_chunk->length) {
- /* Release previous chunk */
- /* Only free the old location if not doing SWMR writes - otherwise
+ if(new_chunk->length != old_chunk->length) {
+ /* Release previous chunk */
+ /* Only free the old location if not doing SWMR writes - otherwise
* we must keep the old chunk around in case a reader has an
* outdated version of the B-tree node
*/
- if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
- alloc_chunk = TRUE;
- } /* end if */
+ if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
+ if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
+ alloc_chunk = TRUE;
+ } /* end if */
else {
- /* Don't need to reallocate chunk, but send its address back up */
+ /* Don't need to reallocate chunk, but send its address back up */
if(!H5F_addr_defined(new_chunk->offset))
new_chunk->offset = old_chunk->offset;
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
else {
HDassert(!H5F_addr_defined(new_chunk->offset));
- alloc_chunk = TRUE;
+ alloc_chunk = TRUE;
} /* end else */
} /* end if */
else {
@@ -6750,7 +6744,7 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk")
/* Read the non-filtered edge chunk */
- if(H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0)
+ if (H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
/* Pass the chunk through the pipeline */
@@ -6871,8 +6865,8 @@ H5D__get_num_chunks_cb(const H5D_chunk_rec_t H5_ATTR_UNUSED *chunk_rec, void *_u
* Note: Currently, this function only gets the number of all written
* chunks, regardless the dataspace.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Binh-Minh Ribler
* September 2018 (HDFFV-10615)
@@ -7081,9 +7075,9 @@ done:
static int
H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
- hsize_t ii;
H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata;
hbool_t different = FALSE; /* TRUE when a scaled value pair mismatch */
+ hsize_t ii; /* Local index value */
int ret_value = H5_ITER_CONT; /* Callback return value */
FUNC_ENTER_STATIC_NOERR
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 08ab149..2a4a3a7 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -40,6 +40,7 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5FOprivate.h" /* File objects */
#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c
index 5972f10..c4a3d4b 100644
--- a/src/H5Dfarray.c
+++ b/src/H5Dfarray.c
@@ -11,12 +11,12 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Vailin Choi <vchoi@hdfgroup.org>
- * Thursday, April 30, 2009
+/* Programmer: Vailin Choi
+ * Thursday, April 30, 2009
*
- * Purpose: Fixed array indexed (chunked) I/O functions.
- * The chunk coordinate is mapped as an index into an array of
- * disk addresses for the chunks.
+ * Purpose: Fixed array indexed (chunked) I/O functions.
+ * The chunk coordinate is mapped as an index into an array of
+ * disk addresses for the chunks.
*
*/
@@ -30,13 +30,13 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FAprivate.h" /* Fixed arrays */
-#include "H5FLprivate.h" /* Free Lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FAprivate.h" /* Fixed arrays */
+#include "H5FLprivate.h" /* Free Lists */
#include "H5MFprivate.h" /* File space management */
-#include "H5VMprivate.h" /* Vector functions */
+#include "H5VMprivate.h" /* Vector functions */
/****************/
@@ -210,16 +210,16 @@ H5FL_DEFINE_STATIC(H5D_farray_ctx_t);
/* Declare a free list to manage the H5D_farray_ctx_ud_t struct */
H5FL_DEFINE_STATIC(H5D_farray_ctx_ud_t);
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_crt_context
*
- * Purpose: Create context for callbacks
+ * Purpose: Create context for callbacks
*
- * Return: Success: non-NULL
- * Failure: NULL
+ * Return: Success: non-NULL
+ * Failure: NULL
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -259,7 +259,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_crt_context() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_dst_context
*
@@ -289,7 +289,7 @@ H5D__farray_dst_context(void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_dst_context() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_fill
*
@@ -319,7 +319,7 @@ H5D__farray_fill(void *nat_blk, size_t nelmts)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_fill() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_encode
*
@@ -363,7 +363,7 @@ H5D__farray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_encode() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_decode
*
@@ -407,7 +407,7 @@ H5D__farray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_decode() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_debug
*
@@ -441,7 +441,7 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_debug() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_crt_dbg_context
*
@@ -516,7 +516,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_crt_dbg_context() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_dst_dbg_context
*
@@ -534,7 +534,7 @@ done:
static herr_t
H5D__farray_dst_dbg_context(void *_dbg_ctx)
{
- H5D_farray_ctx_ud_t *dbg_ctx = (H5D_farray_ctx_ud_t *)_dbg_ctx; /* Context for fixed array callback */
+ H5D_farray_ctx_ud_t *dbg_ctx = (H5D_farray_ctx_ud_t *)_dbg_ctx; /* Context for fixed array callback */
FUNC_ENTER_STATIC_NOERR
@@ -547,7 +547,7 @@ H5D__farray_dst_dbg_context(void *_dbg_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_dst_dbg_context() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_filt_fill
*
@@ -578,7 +578,7 @@ H5D__farray_filt_fill(void *nat_blk, size_t nelmts)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_filt_fill() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_filt_encode
*
@@ -612,7 +612,7 @@ H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx
/* Encode element */
/* (advances 'raw' pointer) */
H5F_addr_encode_len(ctx->file_addr_len, &raw, elmt->addr);
- UINT64ENCODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len);
+ UINT64ENCODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len);
UINT32ENCODE(raw, elmt->filter_mask);
/* Advance native element pointer */
@@ -625,7 +625,7 @@ H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_filt_encode() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_filt_decode
*
@@ -658,7 +658,7 @@ H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx
/* Decode element */
/* (advances 'raw' pointer) */
H5F_addr_decode_len(ctx->file_addr_len, &raw, &elmt->addr);
- UINT64DECODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len);
+ UINT64DECODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len);
UINT32DECODE(raw, elmt->filter_mask);
/* Advance native element pointer */
@@ -671,7 +671,7 @@ H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_filt_decode() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_filt_debug
*
@@ -706,7 +706,7 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_filt_debug() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_depend
*
@@ -768,7 +768,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_depend() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_init
*
@@ -796,7 +796,7 @@ H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNU
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_idx_init() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_open
*
@@ -836,7 +836,7 @@ H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info)
/* Open the fixed array for the chunk index */
if(NULL == (idx_info->storage->u.farray.fa = H5FA_open(idx_info->f, idx_info->storage->idx_addr, &udata)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open fixed array")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open fixed array")
/* Check for SWMR writes to the file */
if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
@@ -847,7 +847,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_open() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_create
*
@@ -887,7 +887,7 @@ H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info)
/* General parameters */
if(idx_info->pline->nused > 0) {
- unsigned chunk_size_len; /* Size of encoded chunk size */
+ unsigned chunk_size_len; /* Size of encoded chunk size */
/* Compute the size required for encoding the size of a chunk, allowing
* for an extra byte, in case the filter makes the chunk larger.
@@ -913,11 +913,11 @@ H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info)
/* Create the fixed array for the chunk index */
if(NULL == (idx_info->storage->u.farray.fa = H5FA_create(idx_info->f, &cparam, &udata)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create fixed array")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create fixed array")
/* Get the address of the fixed array in file */
if(H5FA_get_addr(idx_info->storage->u.farray.fa, &(idx_info->storage->idx_addr)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array address")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array address")
/* Check for SWMR writes to the file */
if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
@@ -928,7 +928,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_create() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_is_space_alloc
*
@@ -952,7 +952,7 @@ H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
} /* end H5D__farray_idx_is_space_alloc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_insert
*
@@ -988,7 +988,7 @@ H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
if(H5D__farray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
} else /* Patch the top level file pointer contained in fa if needed */
- H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
+ H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
/* Set convenience pointer to fixed array structure */
fa = idx_info->storage->u.farray.fa;
@@ -1002,13 +1002,13 @@ H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
if(idx_info->pline->nused > 0) {
H5D_farray_filt_elmt_t elmt; /* Fixed array element */
- elmt.addr = udata->chunk_block.offset;
+ elmt.addr = udata->chunk_block.offset;
H5_CHECKED_ASSIGN(elmt.nbytes, uint32_t, udata->chunk_block.length, hsize_t);
elmt.filter_mask = udata->filter_mask;
/* Set the info for the chunk */
if(H5FA_set(fa, udata->chunk_idx, &elmt) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info")
} /* end if */
else {
/* Set the address for the chunk */
@@ -1020,17 +1020,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__farray_idx_insert() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_get_addr
*
- * Purpose: Get the file address of a chunk if file space has been
- * assigned. Save the retrieved information in the udata
- * supplied.
+ * Purpose: Get the file address of a chunk if file space has been
+ * assigned. Save the retrieved information in the udata
+ * supplied.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1059,7 +1059,7 @@ H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda
if(H5D__farray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
} else /* Patch the top level file pointer contained in fa if needed */
- H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
+ H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
/* Set convenience pointer to fixed array structure */
fa = idx_info->storage->u.farray.fa;
@@ -1088,26 +1088,26 @@ H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
/* Update the other (constant) information for the chunk */
- udata->chunk_block.length = idx_info->layout->size;
+ udata->chunk_block.length = idx_info->layout->size;
udata->filter_mask = 0;
} /* end else */
if(!H5F_addr_defined(udata->chunk_block.offset))
- udata->chunk_block.length = 0;
+ udata->chunk_block.length = 0;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__farray_idx_get_addr() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_iterate_cb
*
- * Purpose: Callback routine for fixed array element iteration.
+ * Purpose: Callback routine for fixed array element iteration.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1135,8 +1135,8 @@ H5D__farray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *
/* Make "generic chunk" callback */
if(H5F_addr_defined(udata->chunk_rec.chunk_addr))
- if((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0)
- HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
+ if((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0)
+ HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
/* Update coordinates of chunk in dataset */
ndims = udata->common.layout->ndims - 1;
@@ -1159,16 +1159,16 @@ H5D__farray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__farray_idx_iterate_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_iterate
*
- * Purpose: Iterate over the chunks in an index, making a callback
+ * Purpose: Iterate over the chunks in an index, making a callback
* for each one.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1199,50 +1199,50 @@ H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info,
if(H5D__farray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
} else /* Patch the top level file pointer contained in fa if needed */
- H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
+ H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
/* Set convenience pointer to fixed array structure */
fa = idx_info->storage->u.farray.fa;
/* Get the fixed array statistics */
if(H5FA_get_stats(fa, &fa_stat) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics")
/* Check if there are any array elements */
if(fa_stat.nelmts > 0) {
H5D_farray_it_ud_t udata; /* User data for iteration callback */
- /* Initialize userdata */
- HDmemset(&udata, 0, sizeof udata);
- udata.common.layout = idx_info->layout;
- udata.common.storage = idx_info->storage;
+ /* Initialize userdata */
+ HDmemset(&udata, 0, sizeof udata);
+ udata.common.layout = idx_info->layout;
+ udata.common.storage = idx_info->storage;
HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec));
udata.filtered = (idx_info->pline->nused > 0);
if(!udata.filtered) {
udata.chunk_rec.nbytes = idx_info->layout->size;
udata.chunk_rec.filter_mask = 0;
} /* end if */
- udata.cb = chunk_cb;
- udata.udata = chunk_udata;
+ udata.cb = chunk_cb;
+ udata.udata = chunk_udata;
/* Iterate over the fixed array elements */
- if((ret_value = H5FA_iterate(fa, H5D__farray_idx_iterate_cb, &udata)) < 0)
- HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over fixed array chunk index");
+ if((ret_value = H5FA_iterate(fa, H5D__farray_idx_iterate_cb, &udata)) < 0)
+ HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over fixed array chunk index");
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_iterate() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_remove
*
- * Purpose: Remove chunk from index.
+ * Purpose: Remove chunk from index.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1250,9 +1250,9 @@ done:
static herr_t
H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata)
{
- H5FA_t *fa; /* Pointer to fixed array structure */
- hsize_t idx; /* Array index of chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FA_t *fa; /* Pointer to fixed array structure */
+ hsize_t idx; /* Array index of chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1271,7 +1271,7 @@ H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t
if(H5D__farray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
} else /* Patch the top level file pointer contained in fa if needed */
- if(H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0)
+ if(H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch fixed array file pointer")
/* Set convenience pointer to fixed array structure */
@@ -1328,16 +1328,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__farray_idx_remove() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_delete_cb
*
- * Purpose: Delete space for chunk in file
+ * Purpose: Delete space for chunk in file
*
- * Return: Success: Non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: negative
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1365,17 +1365,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_delete_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_delete
*
- * Purpose: Delete index and raw data storage for entire dataset
+ * Purpose: Delete index and raw data storage for entire dataset
* (i.e. all chunks)
*
- * Return: Success: Non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: negative
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1398,7 +1398,7 @@ H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info)
if(H5F_addr_defined(idx_info->storage->idx_addr)) {
H5D_farray_ctx_ud_t ctx_udata; /* User data for fixed array open call */
- /* Iterate over the chunk addresses in the fixed array, deleting each chunk */
+ /* Iterate over the chunk addresses in the fixed array, deleting each chunk */
if(H5D__farray_idx_iterate(idx_info, H5D__farray_idx_delete_cb, idx_info->f) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses")
@@ -1423,15 +1423,15 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_delete() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_copy_setup
*
- * Purpose: Set up any necessary information for copying chunks
+ * Purpose: Set up any necessary information for copying chunks
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1478,15 +1478,15 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_copy_setup() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_copy_shutdown
*
- * Purpose: Shutdown any information from copying chunks
+ * Purpose: Shutdown any information from copying chunks
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1517,7 +1517,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_copy_shutdown() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_size
*
@@ -1526,7 +1526,7 @@ done:
* Return: Success: Non-negative
* Failure: negative
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1558,7 +1558,7 @@ H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
/* Get the fixed array statistics */
if(H5FA_get_stats(fa, &fa_stat) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics")
*index_size = fa_stat.hdr_size;
*index_size += fa_stat.dblk_size;
@@ -1573,15 +1573,15 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_reset
*
- * Purpose: Reset indexing information.
+ * Purpose: Reset indexing information.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1596,21 +1596,21 @@ H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
/* Reset index info */
if(reset_addr)
- storage->idx_addr = HADDR_UNDEF;
+ storage->idx_addr = HADDR_UNDEF;
storage->u.farray.fa = NULL;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_idx_reset() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_dump
*
- * Purpose: Dump indexing information to a stream.
+ * Purpose: Dump indexing information to a stream.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1629,15 +1629,15 @@ H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_idx_dump() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_dest
*
- * Purpose: Release indexing information in memory.
+ * Purpose: Release indexing information in memory.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1657,8 +1657,8 @@ H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info)
/* Check if the fixed array is open */
if(idx_info->storage->u.farray.fa) {
- /* Patch the top level file pointer contained in fa if needed */
- if(H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0)
+ /* Patch the top level file pointer contained in fa if needed */
+ if(H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch fixed array file pointer")
/* Close fixed array */
diff --git a/src/H5Dnone.c b/src/H5Dnone.c
index 83451ab..40ddcb8 100644
--- a/src/H5Dnone.c
+++ b/src/H5Dnone.c
@@ -244,7 +244,7 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
hsize_t idx; /* Array index of chunk */
int ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(idx_info);
@@ -267,33 +267,34 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
/* Iterate over all the chunks in the dataset's dataspace */
for(u = 0; u < idx_info->layout->nchunks && ret_value == H5_ITER_CONT; u++) {
- /* Calculate the index of this chunk */
- idx = H5VM_array_offset_pre(ndims, idx_info->layout->max_down_chunks, chunk_rec.scaled);
-
- /* Calculate the address of the chunk */
- chunk_rec.chunk_addr = idx_info->storage->idx_addr + idx * idx_info->layout->size;
-
- /* Make "generic chunk" callback */
- if((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0)
- HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
-
- /* Update coordinates of chunk in dataset */
- curr_dim = (int)(ndims - 1);
- while(curr_dim >= 0) {
- /* Increment coordinate in current dimension */
- chunk_rec.scaled[curr_dim]++;
-
- /* Check if we went off the end of the current dimension */
- if(chunk_rec.scaled[curr_dim] >= idx_info->layout->chunks[curr_dim]) {
- /* Reset coordinate & move to next faster dimension */
- chunk_rec.scaled[curr_dim] = 0;
- curr_dim--;
- } /* end if */
- else
- break;
- } /* end while */
+ /* Calculate the index of this chunk */
+ idx = H5VM_array_offset_pre(ndims, idx_info->layout->max_down_chunks, chunk_rec.scaled);
+
+ /* Calculate the address of the chunk */
+ chunk_rec.chunk_addr = idx_info->storage->idx_addr + idx * idx_info->layout->size;
+
+ /* Make "generic chunk" callback */
+ if((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, H5_ITER_ERROR, "failure in generic chunk iterator callback")
+
+ /* Update coordinates of chunk in dataset */
+ curr_dim = (int)(ndims - 1);
+ while(curr_dim >= 0) {
+ /* Increment coordinate in current dimension */
+ chunk_rec.scaled[curr_dim]++;
+
+ /* Check if we went off the end of the current dimension */
+ if(chunk_rec.scaled[curr_dim] >= idx_info->layout->chunks[curr_dim]) {
+ /* Reset coordinate & move to next faster dimension */
+ chunk_rec.scaled[curr_dim] = 0;
+ curr_dim--;
+ } /* end if */
+ else
+ break;
+ } /* end while */
} /* end for */
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__none_idx_iterate() */
@@ -377,7 +378,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+H5D__none_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_info_src,
const H5D_chk_idx_info_t *idx_info_dst)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index e5f4e07..42d0a93 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -104,17 +104,6 @@ typedef enum H5D_vds_view_t {
/* Callback for H5Pset_append_flush() in a dataset access property list */
typedef herr_t (*H5D_append_cb_t)(hid_t dataset_id, hsize_t *cur_dims, void *op_data);
-/********************/
-/* Public Variables */
-/********************/
-
-/*********************/
-/* Public Prototypes */
-/*********************/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Define the operator function pointer for H5Diterate() */
typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim,
const hsize_t *point, void *operator_data);
@@ -128,6 +117,18 @@ typedef herr_t (*H5D_scatter_func_t)(const void **src_buf/*out*/,
typedef herr_t (*H5D_gather_func_t)(const void *dst_buf,
size_t dst_buf_bytes_used, void *op_data);
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id,
hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id);
H5_DLL hid_t H5Dcreate_anon(hid_t file_id, hid_t type_id, hid_t space_id,
diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c
index d58b6d2..33274bb 100644
--- a/src/H5Dsingle.c
+++ b/src/H5Dsingle.c
@@ -244,10 +244,10 @@ H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
} /* end if */
if(dset)
- if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0)
- /* Mark the layout dirty so that the address of the single chunk will be flushed later */
- if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty")
+ if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0)
+ /* Mark the layout dirty so that the address of the single chunk will be flushed later */
+ if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -437,7 +437,7 @@ H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+H5D__single_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_info_src,
const H5D_chk_idx_info_t *idx_info_dst)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index d9396f3..f11b904 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -509,7 +509,7 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize source selection")
/* Virtual selection */
- if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p) < 0)
+ if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize virtual selection")
} /* end for */
@@ -526,7 +526,6 @@ done:
heap_block = (uint8_t *)H5MM_xfree(heap_block);
str_size = (size_t *)H5MM_xfree(str_size);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_store_layout() */
@@ -3016,8 +3015,8 @@ done:
static herr_t
H5D__virtual_refresh_source_dset(H5D_t **dset)
{
- hid_t dset_id; /* Temporary dataset identifier */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t temp_id = H5I_INVALID_HID; /* Temporary dataset identifier */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -3025,20 +3024,20 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
HDassert(dset && *dset);
/* Get a temporary identifier for this source dataset */
- if((dset_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0)
+ if((temp_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register source dataset ID")
/* Refresh source dataset */
- if(H5D__refresh(dset_id, *dset) < 0)
+ if(H5D__refresh(temp_id, *dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset")
/* Discard the identifier & replace the dataset */
- if(NULL == (*dset = (H5D_t *)H5I_remove(dset_id)))
+ if(NULL == (*dset = (H5D_t *)H5I_remove(temp_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__virtual_refresh_source_dsets() */
+} /* end H5D__virtual_refresh_source_dset() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index 053aad2..8d7852b 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -38,6 +38,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index 6c9a0b0..d1e5e73 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -58,7 +58,7 @@ struct H5F_efc_t {
unsigned max_nfiles; /* Maximum size of the external file cache */
unsigned nrefs; /* Number of times this file appears in another file's EFC */
int tag; /* Temporary variable used by H5F__efc_try_close() */
- H5F_shared_t *tmp_next; /* Next file in temporary list used by H5F__efc_try_close() */
+ H5F_shared_t *tmp_next; /* Next file in temporary list used by H5F__efc_try_close() */
};
/* Private prototypes */
@@ -705,7 +705,7 @@ static void
H5F__efc_try_close_tag2(H5F_shared_t *sf, H5F_shared_t **tail)
{
H5F_efc_ent_t *ent = NULL; /* EFC entry */
- H5F_shared_t *esf; /* Convenience pointer to ent->file->shared */
+ H5F_shared_t *esf; /* Convenience pointer to ent->file->shared */
FUNC_ENTER_STATIC_NOERR
@@ -811,11 +811,11 @@ H5F__efc_try_close_tag2(H5F_shared_t *sf, H5F_shared_t **tail)
herr_t
H5F__efc_try_close(H5F_t *f)
{
- H5F_shared_t *tail; /* Tail of linked list of found files. Head will be f->shared. */
+ H5F_shared_t *tail; /* Tail of linked list of found files. Head will be f->shared. */
H5F_shared_t *uncloseable_head = NULL; /* Head of linked list of files found to be uncloseable by the first pass */
H5F_shared_t *uncloseable_tail = NULL; /* Tail of linked list of files found to be uncloseable by the first pass */
- H5F_shared_t *sf; /* Temporary file pointer */
- H5F_shared_t *next; /* Temporary file pointer */
+ H5F_shared_t *sf; /* Temporary file pointer */
+ H5F_shared_t *next; /* Temporary file pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
diff --git a/src/H5Ffake.c b/src/H5Ffake.c
index 7476a92..67bd180 100644
--- a/src/H5Ffake.c
+++ b/src/H5Ffake.c
@@ -18,8 +18,6 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Pprivate.h" /* Property lists */
/* PRIVATE PROTOTYPES */
@@ -61,6 +59,7 @@ H5F_fake_alloc(uint8_t sizeof_size)
else
f->shared->sizeof_size = sizeof_size;
+ /* Set return value */
ret_value = f;
done:
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 5dd0ebd..3c7946d 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -132,7 +132,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED
*/
if(child->parent)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted")
- if(H5G_loc_find(loc, name, &mp_loc/*out*/) < 0)
+ if(H5G_loc_find(loc, name, &mp_loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
/* If the mount location is holding its file open, that file will close
* and remove the mount as soon as we exit this function. Prevent the
@@ -462,7 +462,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
plist_id = H5P_FILE_MOUNT_DEFAULT;
else
if(TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a file mount property list ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index e5a673f..5aff3a6 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -422,7 +422,7 @@ H5_DLL herr_t H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_
H5_DLL herr_t H5F__super_free(H5F_super_t *sblock);
/* Superblock extension related routines */
-H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
+H5_DLL herr_t H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
H5_DLL herr_t H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, hbool_t may_create, unsigned mesg_flags);
H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id);
H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created);
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 4d94f57..cec9541 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -144,7 +144,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_super_ext_open
+ * Function: H5F__super_ext_open
*
* Purpose: Open an existing superblock extension
*
@@ -156,11 +156,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
+H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -178,7 +178,7 @@ H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5F_super_ext_open() */
+} /* H5F__super_ext_open() */
/*-------------------------------------------------------------------------
@@ -408,7 +408,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
} /* end if */
else {
- /* Locate the signature as per per the serial library */
+ /* Locate the signature as per per the serial library */
#endif /* H5_HAVE_PARALLEL */
if(H5FD_locate_signature(file, &super_addr) < 0)
@@ -522,7 +522,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
#endif /* H5_HAVE_PARALLEL */
/* Check if superblock address is different from base address and adjust
- * base address and "end of address" address if so.
+ * base address and "end of file" address if so.
*/
if(!H5F_addr_eq(super_addr, sblock->base_addr)) {
/* Check if the superblock moved earlier in the file */
@@ -715,7 +715,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
} /* end if */
/* Open the superblock extension */
- if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
+ if(H5F__super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
/* Check for the extension having a 'driver info' message */
@@ -793,15 +793,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
if(NULL == H5O_msg_read(&ext_loc, H5O_FSINFO_ID, &fsinfo))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free-space manager info message")
- /* Update changed values */
-
/* Version bounds check */
if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION ||
fsinfo.version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)])
HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "File space info message's version out of bounds")
+
+ /* Update changed values */
if(f->shared->fs_version != fsinfo.version)
f->shared->fs_version = fsinfo.version;
-
if(f->shared->fs_strategy != fsinfo.strategy) {
f->shared->fs_strategy = fsinfo.strategy;
@@ -900,14 +899,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
if(null_fsm_addr) {
if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension")
- } /* end if */
+ }
else {
if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "error in removing message from superblock extension")
if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension")
- } /* end else */
+ }
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
f->shared->sblock = NULL;
#endif /* JRM */
@@ -980,20 +979,20 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
/* Write driver info information to the superblock extension */
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
- /* KLUGE ALERT!!
- *
- * H5F__super_ext_write_msg() expects f->shared->sblock to
- * be set -- verify that it is NULL, and then set it.
- * Set it back to NULL when we are done.
- */
- HDassert(f->shared->sblock == NULL);
- f->shared->sblock = sblock;
+ /* KLUGE ALERT!!
+ *
+ * H5F__super_ext_write_msg() expects f->shared->sblock to
+ * be set -- verify that it is NULL, and then set it.
+ * Set it back to NULL when we are done.
+ */
+ HDassert(f->shared->sblock == NULL);
+ f->shared->sblock = sblock;
#endif /* JRM */
- if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0)
+ if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension")
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
- f->shared->sblock = NULL;
+ f->shared->sblock = NULL;
#endif /* JRM */
} /* end if */
@@ -1338,10 +1337,11 @@ H5F__super_init(H5F_t *f)
/* Create the Shared Object Header Message table and register it with
* the metadata cache, if this file supports shared messages.
*/
- if(f->shared->sohm_nindexes > 0)
+ if(f->shared->sohm_nindexes > 0) {
/* Initialize the shared message code & write the SOHM message to the extension */
if(H5SM_init(f, plist, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create SOHM table")
+ }
/* Check for non-default v1 B-tree 'K' values to store */
if(sblock->btree_k[H5B_SNODE_ID] != HDF5_BTREE_SNODE_IK_DEF ||
@@ -1526,9 +1526,10 @@ H5F_eoa_dirty(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo as dirty")
} /* end if */
/* If the driver info is stored as a message, update that instead */
- else if(f->shared->drvinfo_sb_msg_exists)
+ else if(f->shared->drvinfo_sb_msg_exists) {
if(H5F__update_super_ext_driver_msg(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo message as dirty")
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1699,13 +1700,13 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg,
/* Open/create the superblock extension object header */
if(H5F_addr_defined(f->shared->sblock->ext_addr)) {
- if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
+ if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
} /* end if */
else {
HDassert(may_create);
- if(H5F__super_ext_create(f, &ext_loc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension")
+ if(H5F__super_ext_create(f, &ext_loc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension")
ext_created = TRUE;
} /* end else */
HDassert(H5F_addr_defined(ext_loc.addr));
@@ -1713,24 +1714,24 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg,
/* Check if message with ID does not exist in the object header */
if((status = H5O_msg_exists(&ext_loc, id)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists")
/* Check for creating vs. writing */
if(may_create) {
if(status)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should not exist")
- /* Create the message with ID in the superblock extension */
- if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header")
+ /* Create the message with ID in the superblock extension */
+ if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header")
} /* end if */
else {
if(!status)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should exist")
- /* Update the message with ID in the superblock extension */
- if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header")
+ /* Update the message with ID in the superblock extension */
+ if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header")
} /* end else */
done:
@@ -1780,36 +1781,37 @@ H5F__super_ext_remove_msg(H5F_t *f, unsigned id)
H5AC_set_ring(H5AC_RING_SBE, &orig_ring);
/* Open superblock extension object header */
- if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension")
+ if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension")
ext_opened = TRUE;
/* Check if message with ID exists in the object header */
if((status = H5O_msg_exists(&ext_loc, id)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message")
- else if(status) { /* message exists */
- H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */
-
- /* Remove the message */
- if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message")
-
- /* Get info for the superblock extension's object header */
- if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
-
- /* If the object header is an empty base chunk, remove superblock extension */
- if(hdr_info.nchunks == 1) {
- if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
- else if((unsigned)null_count == hdr_info.nmesgs) {
- HDassert(H5F_addr_defined(ext_loc.addr));
- if(H5O_delete(f, ext_loc.addr) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
- f->shared->sblock->ext_addr = HADDR_UNDEF;
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message")
+ else if(status) {
+ /* message exists */
+ H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */
+
+ /* Remove the message */
+ if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message")
+
+ /* Get info for the superblock extension's object header */
+ if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
+
+ /* If the object header is an empty base chunk, remove superblock extension */
+ if(hdr_info.nchunks == 1) {
+ if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
+ else if((unsigned)null_count == hdr_info.nmesgs) {
+ HDassert(H5F_addr_defined(ext_loc.addr));
+ if(H5O_delete(f, ext_loc.addr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
+ f->shared->sblock->ext_addr = HADDR_UNDEF;
+ } /* end else-if */
} /* end if */
} /* end if */
- } /* end if */
done:
/* Reset the ring in the API context */
diff --git a/src/H5Glink.c b/src/H5Glink.c
index 1f4edd5..04ccbc5 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -417,11 +417,20 @@ herr_t
H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type,
H5_iter_order_t order)
{
+ herr_t ret_value = SUCCEED;
+
FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(ltable);
+ /* Can't sort when empty since the links table will be NULL */
+ if(0 == ltable->nlinks)
+ HGOTO_DONE(ret_value);
+
+ /* This should never be NULL if the number of links is non-zero */
+ HDassert(ltable->lnks);
+
/* Pick appropriate sorting routine */
if(idx_type == H5_INDEX_NAME) {
if(order == H5_ITER_INC)
@@ -441,6 +450,7 @@ H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type,
HDassert(order == H5_ITER_NATIVE);
} /* end else */
+done:
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5G__link_sort_table() */
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 19c198e..3114fcc 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -1155,7 +1155,7 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file,
else {
/* We pass NULL as link pointer when we need to search all IDs */
search_group = search_dataset = search_datatype = TRUE;
- } /* end else */
+ }
/* Check if we need to operate on the objects affected */
if(search_group || search_dataset || search_datatype) {
@@ -1166,26 +1166,26 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file,
src_file = H5F_PARENT(src_file);
/* Set up common information for callback */
- names.src_file = src_file;
- names.src_full_path_r = src_full_path_r;
- names.dst_file = dst_file;
- names.dst_full_path_r = dst_full_path_r;
- names.op = op;
+ names.src_file = src_file;
+ names.src_full_path_r = src_full_path_r;
+ names.dst_file = dst_file;
+ names.dst_full_path_r = dst_full_path_r;
+ names.op = op;
/* Search through group IDs */
if(search_group)
if(H5I_iterate(H5I_GROUP, H5G_name_replace_cb, &names, FALSE) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups")
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups")
/* Search through dataset IDs */
if(search_dataset)
if(H5I_iterate(H5I_DATASET, H5G_name_replace_cb, &names, FALSE) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets")
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets")
/* Search through datatype IDs */
if(search_datatype)
if(H5I_iterate(H5I_DATATYPE, H5G_name_replace_cb, &names, FALSE) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes")
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes")
} /* end if */
} /* end if */
@@ -1200,11 +1200,11 @@ done:
* Purpose: Callback for retrieving object's name by address
*
* Return: Positive if path is for object desired
- * 0 if not correct object
- * negative on failure.
+ * 0 if not correct object
+ * negative on failure.
*
* Programmer: Quincey Koziol
- * November 4 2007
+ * November 4 2007
*
*-------------------------------------------------------------------------
*/
@@ -1217,7 +1217,7 @@ H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info_t *linfo,
H5G_name_t obj_path; /* Object's group hier. path */
H5O_loc_t obj_oloc; /* Object's object location */
hbool_t obj_found = FALSE; /* Object at 'path' found */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1269,10 +1269,11 @@ done:
*
* Purpose: Tries to figure out the path to an object from it's address
*
- * Return: returns size of path name, and copies it into buffer
- * pointed to by name if that buffer is big enough.
- * 0 if it cannot find the path
- * negative on failure.
+ * Return: Success: Returns size of path name, and copies it into buffer
+ * pointed to by name if that buffer is big enough.
+ * 0 if it cannot find the path
+ *
+ * Failure: -1
*
* Programmer: Quincey Koziol
* November 4 2007
@@ -1283,25 +1284,25 @@ ssize_t
H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc,
char *name, size_t size)
{
- H5G_gnba_iter_t udata; /* User data for iteration */
- H5G_loc_t root_loc; /* Root group's location */
- hbool_t found_obj = FALSE; /* If we found the object */
- herr_t status; /* Status from iteration */
- ssize_t ret_value = -1; /* Return value */
+ H5G_gnba_iter_t udata; /* User data for iteration */
+ H5G_loc_t root_loc; /* Root group's location */
+ hbool_t found_obj = FALSE; /* If we found the object */
+ herr_t status; /* Status from iteration */
+ ssize_t ret_value = -1; /* Return value */
/* Portably clear udata struct (before FUNC_ENTER) */
HDmemset(&udata, 0, sizeof(udata));
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI((-1))
- /* Construct the link info for the file's root group */
+ /* Construct a group location for root group of the file */
if(H5G_loc(file, &root_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get root group's location")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get root group's location")
/* Check for root group being the object looked for */
if(root_loc.oloc->addr == loc->addr && root_loc.oloc->file == loc->file) {
if(NULL == (udata.path = H5MM_strdup("")))
- HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "can't duplicate path string")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, (-1), "can't duplicate path string")
found_obj = TRUE;
} /* end if */
else {
@@ -1311,7 +1312,7 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc,
/* Visit all the links in the file */
if((status = H5G_visit(file, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group traversal failed while looking for object name")
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, (-1), "group traversal failed while looking for object name")
else if(status > 0)
found_obj = TRUE;
} /* end else */
@@ -1342,3 +1343,4 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_get_name_by_addr() */
+
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 8e6c7f9..b0a2d60 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -324,7 +324,7 @@ H5G__traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
/* Traverse the link */
if(H5G__traverse_real(&tmp_grp_loc, lnk->u.soft.name, target, H5G__traverse_slink_cb, &udata) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
/* Pass back information about whether the object exists */
*obj_exists = udata.exists;
@@ -830,20 +830,21 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver
if(!op)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no operation provided")
- /* Retrieve the original # of soft / UD links that are able to be traversed */
- /* (So that multiple calls to H5G_traverse don't incorrectly look
- * like they've traversed too many. Nested calls, like in H5L__move(),
+ /* Retrieve the original # of soft / UD links that are able to be traversed
+ * (So that multiple calls to H5G_traverse don't incorrectly look
+ * like they've traversed too many. Nested calls, like in H5L_move(),
* may need their own mechanism to set & reset the # of links to traverse)
*/
if(H5CX_get_nlinks(&orig_nlinks) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
/* Set up invalid tag. This is a precautionary step only. Setting an invalid
- tag here will ensure that no metadata accessed while doing the traversal
- is given an improper tag, unless another one is specifically set up
- first. This will ensure we're not accidentally tagging something we
- shouldn't be during the traversal. Note that for best tagging assertion
- coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised. */
+ * tag here will ensure that no metadata accessed while doing the traversal
+ * is given an improper tag, unless another one is specifically set up
+ * first. This will ensure we're not accidentally tagging something we
+ * shouldn't be during the traversal. Note that for best tagging assertion
+ * coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised.
+ */
H5_BEGIN_TAG(H5AC__INVALID_TAG);
/* Go perform "real" traversal */
diff --git a/src/H5HF.c b/src/H5HF.c
index 4a28416..5d52ca4 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -42,6 +42,8 @@
#include "H5FOprivate.h" /* File objects */
#include "H5HFpkg.h" /* Fractal heaps */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+
/****************/
/* Local Macros */
@@ -167,7 +169,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/H5HFhdr.c b/src/H5HFhdr.c
index 57dacab..5750a03 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -36,6 +36,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5HFpkg.h" /* Fractal heaps */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
@@ -484,7 +485,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 +495,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/H5HFsection.c b/src/H5HFsection.c
index 5aeac50..a0f984b 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -1185,9 +1185,9 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5
H5HF_indirect_t *iblock; /* Indirect block that section's direct block resides in */
haddr_t dblock_addr; /* Direct block address */
size_t dblock_size; /* Direct block size */
- size_t dblock_overhead; /* Direct block's overhead */
unsigned dblock_status = 0; /* Direct block's status in the metadata cache */
- herr_t status; /* Generic status value */
+ size_t H5_ATTR_NDEBUG_UNUSED dblock_overhead; /* Direct block's overhead */
+ herr_t H5_ATTR_NDEBUG_UNUSED status; /* Generic status value */
/* Sanity check settings for section's direct block's parent */
iblock = sect->u.single.parent;
@@ -2038,7 +2038,7 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t
const H5HF_hdr_t *hdr; /* Fractal heap header */
const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Pointer to section to check */
const H5HF_free_section_t *indir_sect; /* Pointer to underlying indirect section */
- unsigned indir_idx; /* Index of row in underlying indirect section's row array */
+ unsigned H5_ATTR_NDEBUG_UNUSED indir_idx; /* Index of row in underlying indirect section's row array */
FUNC_ENTER_STATIC_NOERR
@@ -4125,7 +4125,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect)
dir_nrows = (max_dir_row - start_row) + 1;
HDassert(dir_nrows == sect->u.indirect.dir_nrows);
for(u = 0; u < dir_nrows; u++) {
- const H5HF_free_section_t *tmp_row_sect; /* Pointer to row section */
+ const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_row_sect; /* Pointer to row section */
tmp_row_sect = sect->u.indirect.dir_rows[u];
HDassert(tmp_row_sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW
@@ -4133,7 +4133,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect)
HDassert(tmp_row_sect->u.row.under == sect);
HDassert(tmp_row_sect->u.row.row == (start_row + u));
if(u > 0) {
- const H5HF_free_section_t *tmp_row_sect2; /* Pointer to row section */
+ const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_row_sect2; /* Pointer to row section */
tmp_row_sect2 = sect->u.indirect.dir_rows[u - 1];
HDassert(tmp_row_sect2->u.row.row < tmp_row_sect->u.row.row);
@@ -4160,7 +4160,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect)
HDassert(tmp_child_sect->sect_info.type == H5HF_FSPACE_SECT_INDIRECT);
HDassert(tmp_child_sect->u.indirect.parent == sect);
if(u > 0) {
- const H5HF_free_section_t *tmp_child_sect2; /* Pointer to child indirect section */
+ const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_child_sect2; /* Pointer to child indirect section */
tmp_child_sect2 = sect->u.indirect.indir_ents[u - 1];
HDassert(H5F_addr_lt(tmp_child_sect2->sect_info.addr, tmp_child_sect->sect_info.addr));
diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c
index f4b0ae1..113124c 100644
--- a/src/H5HFtiny.c
+++ b/src/H5HFtiny.c
@@ -35,6 +35,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5HFpkg.h" /* Fractal heaps */
+#include "H5MMprivate.h" /* Memory management */
/****************/
diff --git a/src/H5HG.c b/src/H5HG.c
index 5a8b4e2..f9d780c 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() */
/*-------------------------------------------------------------------------
@@ -505,7 +505,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/)
+H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj/*out*/)
{
size_t need; /*total space needed for object */
size_t idx;
@@ -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")
H5MM_memcpy(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)))
@@ -785,6 +785,7 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap")
HDassert(hobj->idx < heap->nused);
+
/* When the application selects the same location to rewrite the VL element by using H5Sselect_elements,
* it can happen that the entry has been removed by first rewrite. Here we simply skip the removal of
* the entry and let the second rewrite happen (see HDFFV-10635). In the future, it'd be nice to handle
@@ -845,11 +846,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
@@ -857,7 +858,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5HG_free(H5HG_heap_t *heap)
+H5HG__free(H5HG_heap_t *heap)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -878,5 +879,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 f7e6456..7485aad 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 53cf864..3119de4 100644
--- a/src/H5HGpkg.h
+++ b/src/H5HGpkg.h
@@ -130,14 +130,14 @@ struct H5HG_heap_t {
/* If this value is >65535 then all indices */
/* have been used at some time and the */
/* correct new index should be searched for */
- struct H5F_shared_t *shared; /* shared file */
+ struct H5F_shared_t *shared; /* shared file */
H5HG_obj_t *obj; /*array of object descriptions */
};
/******************************/
/* 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/H5HGprivate.h b/src/H5HGprivate.h
index 1c609e2..70e770b 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -51,7 +51,7 @@ typedef struct H5HG_heap_t H5HG_heap_t;
/* Main global heap routines */
-H5_DLL herr_t H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/);
+H5_DLL herr_t H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj/*out*/);
H5_DLL void *H5HG_read(H5F_t *f, H5HG_t *hobj, void *object, size_t *buf_size/*out*/);
H5_DLL int H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust);
H5_DLL herr_t H5HG_get_obj_size(H5F_t *f, H5HG_t *hobj, size_t *obj_size);
diff --git a/src/H5L.c b/src/H5L.c
index 00fb221..ac62129 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -21,18 +21,18 @@
/***********/
/* 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" /* File access */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lpkg.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* File objects */
-#include "H5Pprivate.h" /* Property lists */
+#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" /* File access */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lpkg.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* File objects */
+#include "H5Pprivate.h" /* Property lists */
/****************/
/* Local Macros */
@@ -63,7 +63,7 @@ typedef struct {
typedef struct {
const char *dst_name; /* Destination name for moving object */
H5T_cset_t cset; /* Char set for new name */
- const H5G_loc_t *dst_loc; /* Destination location for moving object */
+ const H5G_loc_t *dst_loc; /* Destination location for moving object */
unsigned dst_target_flags; /* Target flags for destination object */
hbool_t copy; /* TRUE if this is a copy operation */
size_t orig_nlinks; /* The original value for the # of soft / UD links that can be traversed */
@@ -91,6 +91,7 @@ typedef struct {
void *buf; /* User buffer */
} H5L_trav_gv_t;
+
/********************/
/* Local Prototypes */
/********************/
@@ -267,16 +268,16 @@ H5L_term_package(void)
/*-------------------------------------------------------------------------
- * Function: H5Lmove
+ * Function: H5Lmove
*
- * Purpose: Renames an object within an HDF5 file and moves it to a new
+ * Purpose: Renames an object within an HDF5 file and moves it to a new
* group. The original name SRC is unlinked from the group graph
* and then inserted with the new name DST (which can specify a
* new path for the object) as an atomic operation. The names
- * are interpreted relative to SRC_LOC_ID and
- * DST_LOC_ID, which are either file IDs or group ID.
+ * are interpreted relative to SRC_LOC_ID and DST_LOC_ID,
+ * which are either file IDs or group ID.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
* Wednesday, March 29, 2006
@@ -339,13 +340,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcopy
+ * Function: H5Lcopy
*
- * Purpose: Creates an identical copy of a link with the same creation
+ * Purpose: Creates an identical copy of a link with the same creation
* time and target. The new link can have a different name
* and be in a different location than the original.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
* Wednesday, March 29, 2006
@@ -400,7 +401,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
/* Copy the link */
if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link")
done:
FUNC_LEAVE_API(ret_value)
@@ -408,17 +409,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcreate_soft
+ * Function: H5Lcreate_soft
*
- * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET.
+ * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET.
*
- * LINK_TARGET can be anything and is interpreted at lookup
+ * LINK_TARGET can be anything and is interpreted at lookup
* time relative to the group which contains the final component
* of LINK_NAME. For instance, if LINK_TARGET is `./foo' and
* LINK_NAME is `./x/y/bar' and a request is made for `./x/y/bar'
* then the actual object looked up is `./x/y/./foo'.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -426,8 +427,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lcreate_soft(const char *link_target, hid_t link_loc_id,
- const char *link_name, hid_t lcpl_id, hid_t lapl_id)
+H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name,
+ hid_t lcpl_id, hid_t lapl_id)
{
H5G_loc_t link_loc; /* Group location for new link */
herr_t ret_value = SUCCEED; /* Return value */
@@ -438,14 +439,18 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id,
/* Check arguments */
if(H5G_loc(link_loc_id, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!link_target || !*link_target)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no target specified")
- if(!link_name || !*link_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ if(!link_target)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be NULL")
+ if(!*link_target)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be an empty string")
+ if(!link_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_name parameter cannot be NULL")
+ if(!*link_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_name parameter cannot be an empty string")
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
- /* Check the link creation property list */
+ /* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
@@ -458,7 +463,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id,
/* Create the link */
if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link")
done:
FUNC_LEAVE_API(ret_value)
@@ -466,15 +471,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcreate_hard
+ * Function: H5Lcreate_hard
*
- * Purpose: Creates a hard link from NEW_NAME to CUR_NAME.
+ * Purpose: Creates a hard link from NEW_NAME to CUR_NAME.
*
- * CUR_NAME must name an existing object. CUR_NAME and
+ * CUR_NAME must name an existing object. CUR_NAME and
* NEW_NAME are interpreted relative to CUR_LOC_ID and
* NEW_LOC_ID, which are either file IDs or group IDs.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -497,13 +502,17 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC")
if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!cur_name || !*cur_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
- if(!new_name || !*new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ if(!cur_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be NULL")
+ if(!*cur_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be an empty string")
+ if(!new_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be NULL")
+ if(!*new_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be an empty string")
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
@@ -538,23 +547,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcreate_ud
+ * Function: H5Lcreate_ud
*
- * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME
+ * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME
* with user-specified data UDATA.
*
- * The format of the information pointed to by UDATA is
+ * The format of the information pointed to by UDATA is
* defined by the user. UDATA_SIZE holds the size of this buffer.
*
- * LINK_NAME is interpreted relative to LINK_LOC_ID.
+ * LINK_NAME is interpreted relative to LINK_LOC_ID.
*
- * The property list specified by LCPL_ID holds properties used
+ * The property list specified by LCPL_ID holds properties used
* to create the link.
*
* The link class of the new link must already be registered
* with the library.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
* Tuesday, December 13, 2005
@@ -576,11 +585,11 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
if(H5G_loc(link_loc_id, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!link_name || !*link_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class")
- /* Check the link creation property list */
+ /* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
@@ -601,16 +610,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ldelete
+ * Function: H5Ldelete
*
- * Purpose: Removes the specified NAME from the group graph and
- * decrements the link count for the object to which NAME
- * points. If the link count reaches zero then all file-space
- * associated with the object will be reclaimed (but if the
- * object is open, then the reclamation of the file space is
- * delayed until all handles to the object are closed).
+ * Purpose: Removes the specified NAME from the group graph and
+ * decrements the link count for the object to which NAME
+ * points. If the link count reaches zero then all file-space
+ * associated with the object will be reclaimed (but if the
+ * object is open, then the reclamation of the file space is
+ * delayed until all handles to the object are closed).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -628,9 +637,9 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_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")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
@@ -676,13 +685,13 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
/* 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(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
@@ -728,9 +737,9 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
/* Check arguments */
if(H5G_loc(loc_id, &loc))
- 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 specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
@@ -799,12 +808,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lexists
+ * Function: H5Lexists
*
- * Purpose: Checks if a link of a given name exists in a group
+ * Purpose: Checks if a link of a given name exists in a group
*
- * Return: Success: TRUE/FALSE
- * Failure: Negative
+ * Return: Success: TRUE/FALSE/FAIL
*
* Programmer: Quincey Koziol
* Friday, March 16, 2007
@@ -823,8 +831,10 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
/* Check arguments */
if(H5G_loc(loc_id, &loc))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ 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")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
@@ -840,13 +850,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lget_info
- *
- * Purpose: Gets metadata for a link.
+ * Function: H5Lget_info
*
- * Return: Success: Non-negative with information in LINFO
+ * Purpose: Gets metadata for a link.
*
- * Failure: Negative
+ * Return: Success: Non-negative with information in LINFO
+ * Failure: Negative
*
* Programmer: James Laird
* Wednesday, June 21, 2006
@@ -867,7 +876,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
if(H5G_loc(loc_id, &loc))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
@@ -883,13 +892,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lget_info_by_idx
+ * Function: H5Lget_info_by_idx
*
- * Purpose: Gets metadata for a link, according to the order within an
+ * Purpose: Gets metadata for a link, according to the order within an
* index.
*
- * Return: Success: Non-negative with information in LINFO
- * Failure: Negative
+ * Return: Success: Non-negative with information in LINFO
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* Monday, November 6, 2006
@@ -910,13 +919,13 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
/* Check arguments */
if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
@@ -1011,11 +1020,11 @@ H5Lunregister(H5L_type_t id)
/* Check args */
if(id < 0 || id > H5L_TYPE_MAX)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type")
/* Do it */
if(H5L_unregister(id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type")
done:
FUNC_LEAVE_API(ret_value)
@@ -1023,14 +1032,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lis_registered
+ * Function: H5Lis_registered
*
- * Purpose: Tests whether a user-defined link class has been registered
+ * Purpose: Tests whether a user-defined link class has been registered
* or not.
*
- * Return: Positive if the link class has been registered
- * Zero if it is unregistered
- * Negative on error (if the class is not a valid UD class ID)
+ * Return: TRUE if the link class has been registered
+ * FALSE if it is unregistered
+ * FAIL on error (if the class is not a valid UD class ID)
*
* Programmer: James Laird
* Monday, July 10, 2006
@@ -1052,7 +1061,7 @@ H5Lis_registered(H5L_type_t id)
/* Is the link class already registered? */
for(i = 0; i < H5L_table_used_g; i++)
- if(H5L_table_g[i].id == id) {
+ if(H5L_table_g[i].id == id) {
ret_value = TRUE;
break;
} /* end if */
@@ -1063,16 +1072,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lget_name_by_idx
+ * Function: H5Lget_name_by_idx
*
- * Purpose: Gets name for a link, according to the order within an
+ * Purpose: Gets name for a link, according to the order within an
* index.
*
* Same pattern of behavior as H5Iget_name.
*
- * Return: Success: Non-negative length of name, with information
- * in NAME buffer
- * Failure: Negative
+ * Return: Success: Non-negative length of name, with information
+ * in NAME buffer
+ *
+ * Failure: -1
*
* Programmer: Quincey Koziol
* Saturday, November 11, 2006
@@ -1087,27 +1097,27 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
H5G_loc_t loc; /* Location of group */
ssize_t ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE8("Zs", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, name, size,
lapl_id);
/* Check arguments */
if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, (-1), "can't set access property list info")
/* Get the link information */
if((ret_value = H5L__get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name")
done:
FUNC_LEAVE_API(ret_value)
@@ -1163,23 +1173,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Literate_by_name
+ * Function: H5Literate_by_name
*
- * Purpose: Iterates over links in a group, with user callback routine,
+ * Purpose: Iterates over links in a group, with user callback routine,
* according to the order within an index.
*
* Same pattern of behavior as H5Giterate.
*
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, November 16, 2006
*
*-------------------------------------------------------------------------
@@ -1196,14 +1206,16 @@ H5Literate_by_name(hid_t loc_id, const char *group_name,
op_data, lapl_id);
/* Check arguments */
- if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(!group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL")
+ if(!*group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
@@ -1219,9 +1231,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lvisit
+ * Function: H5Lvisit
*
- * Purpose: Recursively visit all the links in a group and all
+ * Purpose: Recursively visit all the links in a group and all
* the groups that are linked to from that group. Links within
* each group are visited according to the order within the
* specified index (unless the specified index does not exist for
@@ -1233,16 +1245,16 @@ done:
* callback with more than one link that points to a particular
* _object_.
*
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
* Programmer: Quincey Koziol
- * November 24 2007
+ * November 24 2007
*
*-------------------------------------------------------------------------
*/
@@ -1261,13 +1273,13 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
if(!(H5I_GROUP == id_type || H5I_FILE == id_type))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
- /* Call internal routine */
+ /* Iterate over the links */
if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
@@ -1277,9 +1289,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lvisit_by_name
+ * Function: H5Lvisit_by_name
*
- * Purpose: Recursively visit all the links in a group and all
+ * Purpose: Recursively visit all the links in a group and all
* the groups that are linked to from that group. Links within
* each group are visited according to the order within the
* specified index (unless the specified index does not exist for
@@ -1291,16 +1303,16 @@ done:
* callback with more than one link that points to a particular
* _object_.
*
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
- * Programmer: Quincey Koziol
- * November 3 2007
+ * Programmer: Quincey Koziol
+ * November 3 2007
*
*-------------------------------------------------------------------------
*/
@@ -1315,12 +1327,14 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
lapl_id);
/* Check args */
- if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(!group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL")
+ if(!*group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
@@ -1328,7 +1342,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Call internal routine */
+ /* Visit the links */
if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
@@ -1522,8 +1536,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc,
- hid_t lcpl_id)
+H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id)
{
H5O_link_t lnk; /* Link to insert */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1915,11 +1928,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L_create_soft
+ * Function: H5L_create_soft
*
- * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH.
+ * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -2213,10 +2226,9 @@ done:
* Function: H5L__get_val_by_idx
*
* Purpose: Internal routine to query a link value according to the
- * index within a group
+ * index within a group
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 27, 2017
@@ -2290,7 +2302,7 @@ H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk
/* Remove the link from the group */
if(H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, name) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group")
done:
/* Indicate that this callback didn't take ownership of the group *
@@ -2385,10 +2397,9 @@ done:
* Function: H5L__delete_by_idx
*
* Purpose: Internal routine to delete a link according to its index
- * within a group.
+ * within a group.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 27, 2017
@@ -2404,7 +2415,7 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
FUNC_ENTER_STATIC
- /* Check arguments */
+ /* Sanity check */
HDassert(loc);
HDassert(name && *name);
@@ -2593,7 +2604,7 @@ H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk,
/* Insert the link into its new location */
if(H5G_traverse(udata->dst_loc, udata->dst_name, udata->dst_target_flags, H5L__move_dest_cb, &udata_out) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
/* If this is a move and not a copy operation, change the object's name and remove the old link */
if(!udata->copy) {
@@ -2968,11 +2979,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L_get_info
+ * Function: H5L_get_info
*
- * Purpose: Returns metadata about a link.
+ * Purpose: Returns metadata about a link.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: James Laird
* Monday, April 17 2006
@@ -3055,11 +3066,7 @@ done:
* Purpose: Internal routine to retrieve link info according to an
* index's order.
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -3138,11 +3145,7 @@ done:
* Purpose: Internal routine to retrieve link name according to an
* index's order.
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -3181,55 +3184,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__iterate
- *
- * Purpose: Internal routine to iterate over links
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data)
-{
- H5G_link_iterate_t lnk_op; /* Link operator */
- hsize_t last_lnk; /* Index of last object looked at */
- hsize_t idx; /* Internal location to hold index */
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check arguments */
- HDassert(group_name);
- HDassert(op);
-
- /* Set up iteration beginning/end info */
- idx = (idx_p == NULL ? 0 : *idx_p);
- last_lnk = 0;
-
- /* Build link operator info */
- lnk_op.op_type = H5G_LINK_OP_NEW;
- lnk_op.op_func.op_new = op;
-
- /* Iterate over the links */
- if((ret_value = H5G_iterate(grp_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
-
- /* Set the index we stopped at */
- if(idx_p)
- *idx_p = last_lnk;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__iterate() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__link_copy_file
*
* Purpose: Copy a link and the object it points to from one file to
@@ -3359,3 +3313,48 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5L__link_copy_file() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__iterate
+ *
+ * Purpose: Iterates through links in a group
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data)
+{
+ H5G_link_iterate_t lnk_op; /* Link operator */
+ hsize_t last_lnk; /* Index of last object looked at */
+ hsize_t idx; /* Internal location to hold index */
+ herr_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(group_name);
+ HDassert(op);
+
+ /* Set up iteration beginning/end info */
+ idx = (idx_p == NULL ? 0 : *idx_p);
+ last_lnk = 0;
+
+ /* Build link operator info */
+ lnk_op.op_type = H5G_LINK_OP_NEW;
+ lnk_op.op_func.op_new = op;
+
+ /* Iterate over the links */
+ if((ret_value = H5G_iterate(grp_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
+
+ /* Set the index we stopped at */
+ if(idx_p)
+ *idx_p = last_lnk;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__iterate() */
+
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 7f978e8..140c4cb 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -102,7 +102,7 @@ static const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{
* link access property list, appends that prefix to the
* filename being opened.
*
- * Return: ID of the opened object on success/Negative on failure
+ * Return: ID of the opened object on success/H5I_INVALID_HID on failure
*
* Programmer: James Laird
* Monday, July 10, 2006
@@ -124,13 +124,13 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
size_t fname_len; /* Length of external link file name */
unsigned intent; /* File access permissions */
H5L_elink_cb_t cb_info; /* Callback info struct */
- hid_t fapl_id = -1; /* File access property list for external link's file */
- hid_t ext_obj = -1; /* ID for external link's object */
+ hid_t fapl_id = H5I_INVALID_HID; /* File access property list for external link's file */
+ hid_t ext_obj_id = H5I_INVALID_HID; /* ID for external link's object */
char *parent_group_name = NULL;/* Temporary pointer to group name */
char local_group_name[H5L_EXT_TRAVERSE_BUF_SIZE]; /* Local buffer to hold group name */
H5P_genplist_t *fa_plist; /* File access property list pointer */
- H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */
- char *elink_prefix; /* Pointer to elink prefix */
+ H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */
+ char *elink_prefix = NULL; /* Pointer to elink prefix */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -140,9 +140,9 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* Check external link version & flags */
if(((*p >> 4) & 0x0F) > H5L_EXT_VERSION)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad version number for external link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad version number for external link")
if((*p & 0x0F) & ~H5L_EXT_FLAGS_ALL)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad flags for external link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad flags for external link")
p++;
/* Gather some information from the external link's user data */
@@ -152,19 +152,19 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
/* Get the fapl_id set for lapl_id if any */
if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get fapl for links")
/* Get the location for the group holding the external link */
if(H5G_loc(cur_group, &loc) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get object location")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get object location")
/* get the access flags set for lapl_id if any */
if(H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, &intent) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink file access flags")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink file access flags")
/* get the file access mode flags for the parent file, if they were not set
* on lapl_id */
@@ -172,15 +172,15 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
intent = H5F_INTENT(loc.oloc->file);
if((fapl_id == H5P_DEFAULT) && ((fapl_id = H5F_get_access_plist(loc.oloc->file, FALSE)) < 0))
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get parent's file access property list")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get parent's file access property list")
/* Get callback_info */
if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink callback info")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink callback info")
/* Get file access property list */
if(NULL == (fa_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
/* Make callback if it exists */
if(cb_info.func) {
@@ -192,7 +192,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* Query length of parent group name */
if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve length of group name")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve length of group name")
/* Account for null terminator */
group_name_len++;
@@ -200,59 +200,59 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* Check if we need to allocate larger buffer */
if((size_t)group_name_len > sizeof(local_group_name)) {
if(NULL == (parent_group_name = (char *)H5MM_malloc((size_t)group_name_len)))
- HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len)
} /* end if */
else
parent_group_name = local_group_name;
/* Get parent group name */
if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve group name")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve group name")
/* Make callback */
if((cb_info.func)(parent_file_name, parent_group_name, file_name, obj_name, &intent, fapl_id, cb_info.user_data) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "traversal operator failed")
+ HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, H5I_INVALID_HID, "traversal operator failed")
/* Check access flags */
if((intent & H5F_ACC_TRUNC) || (intent & H5F_ACC_EXCL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags")
} /* end if */
/* Set file close degree for new file to "weak" */
if(H5P_set(fa_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
/* Get the current elink prefix */
if(H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &elink_prefix) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get external link prefix")
/* Search for the target file */
if(NULL == (ext_file = H5F_prefix_open_file(loc.oloc->file, H5F_PREFIX_ELINK, elink_prefix, file_name, intent, fapl_id)))
- HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s'", file_name)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open external file, external link file name = '%s'", file_name)
/* Retrieve the "group location" for the file's root group */
if(H5G_root_loc(ext_file, &root_loc) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "unable to create location for file")
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, H5I_INVALID_HID, "unable to create location for file")
/* Open the object referenced in the external file */
- if((ext_obj = H5O_open_name(&root_loc, obj_name, FALSE)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ if((ext_obj_id = H5O_open_name(&root_loc, obj_name, FALSE)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
/* Set return value */
- ret_value = ext_obj;
+ ret_value = ext_obj_id;
done:
/* Release resources */
if(fapl_id > 0 && H5I_dec_ref(fapl_id) < 0)
- HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
+ HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for file access property list")
if(ext_file && H5F_efc_close(loc.oloc->file, ext_file) < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, FAIL, "problem closing external file")
+ HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problem closing external file")
if(parent_group_name && parent_group_name != local_group_name)
parent_group_name = (char *)H5MM_xfree(parent_group_name);
if(ret_value < 0) {
/* Close object if it's open and something failed */
- if(ext_obj >= 0 && H5I_dec_ref(ext_obj) < 0)
- HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for external object")
+ if(ext_obj_id >= 0 && H5I_dec_ref(ext_obj_id) < 0)
+ HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for external object")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -312,7 +312,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Lcreate_external
*
- * Purpose: Creates an external link from LINK_NAME to OBJ_NAME.
+ * Purpose: Creates an external link from LINK_NAME to OBJ_NAME.
*
* External links are links to objects in other HDF5 files. They
* are allowed to "dangle" like soft links internal to a file.
@@ -322,9 +322,9 @@ done:
* LINK_NAME is interpreted relative to LINK_LOC_ID, which is
* either a file ID or a group ID.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Wednesday, May 18, 2005
*
*-------------------------------------------------------------------------
@@ -334,7 +334,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id)
{
H5G_loc_t link_loc; /* Group location to create link */
- char *norm_obj_name = NULL; /* Pointer to normalized current name */
+ char *norm_obj_name = NULL; /* Pointer to normalized current name */
void *ext_link_buf = NULL; /* Buffer to contain external link */
size_t buf_size; /* Size of buffer to hold external link */
size_t file_name_len; /* Length of file name string */
@@ -356,7 +356,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
if(!link_name || !*link_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
- /* Check the link creation property list */
+ /* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
@@ -387,7 +387,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
/* Create an external link */
if(H5L__create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link")
done:
H5MM_xfree(ext_link_buf);
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index 3bbb6b6..cdd6531 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -63,7 +63,7 @@ typedef struct {
/* User data for path traversal routine for getting link info by index */
typedef struct {
/* In */
- H5_index_t idx_type; /* Index to use */
+ H5_index_t idx_type; /* Index to use */
H5_iter_order_t order; /* Order to iterate in index */
hsize_t n; /* Offset of link within index */
@@ -98,7 +98,6 @@ typedef struct H5L_elink_cb_t {
void *user_data;
} H5L_elink_cb_t;
-
/*****************************/
/* Library Private Variables */
/*****************************/
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index c462d1a..405e6a9 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -5026,6 +5026,7 @@ H5S__hyper_append_span(H5S_hyper_span_t **prev_span,
FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(prev_span);
HDassert(span_tree);
@@ -5668,7 +5669,7 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
if(span_a->high < span_b->low) {
/* Merge/add span 'a' with/to the merged spans */
if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Advance span 'a' */
H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -5683,19 +5684,19 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
if(H5S__hyper_cmp_spans(span_a->down, span_b->down)) {
/* Merge/add copy of span 'a' with/to merged spans */
if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* Merge/add lower part of span 'a' with/to merged spans */
if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Get merged span tree for overlapped section */
tmp_spans = H5S__hyper_merge_spans_helper(span_a->down,span_b->down);
/* Merge/add overlapped section to merged spans */
if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->high,tmp_spans,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Release merged span tree for overlapped section */
H5S__hyper_free_span_info(tmp_spans);
@@ -5707,7 +5708,7 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Allocate new span node to append to list */
if((tmp_span = H5S__hyper_new_span(span_a->high+1,span_b->high,span_b->down,span_b->next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance span 'a' */
H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -5732,19 +5733,19 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
if(H5S__hyper_cmp_spans(span_a->down, span_b->down)) {
/* Merge/add copy of lower & middle parts of span 'a' to merged spans */
if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* Merge/add lower part of span 'a' to merged spans */
if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Get merged span tree for overlapped section */
tmp_spans = H5S__hyper_merge_spans_helper(span_a->down,span_b->down);
/* Merge/add overlapped section to merged spans */
if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,tmp_spans,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Release merged span tree for overlapped section */
H5S__hyper_free_span_info(tmp_spans);
@@ -5772,14 +5773,14 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
if(H5S__hyper_cmp_spans(span_a->down, span_b->down)) {
/* Merge/add copy of lower & middle parts of span 'b' to merged spans */
if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* Check if there is a lower part of span 'b' */
if(span_a->low > span_b->low) {
/* Merge/add lower part of span 'b' to merged spans */
if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* No lower part of span 'b' , keep going... */
@@ -5790,7 +5791,7 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Merge/add overlapped section to merged spans */
if(H5S__hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,tmp_spans,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span")
/* Release merged span tree for overlapped section */
H5S__hyper_free_span_info(tmp_spans);
@@ -6310,10 +6311,6 @@ done:
to span tree able to be generated from a single H5S_SELECT_SET operation.
EXAMPLES
REVISION LOG
- This routine is the optimization of the old version. The previous version
- can only detect a singluar selection. This version is general enough to
- detect any regular selection.
- KY, 2005/9/22
--------------------------------------------------------------------------*/
static hbool_t
H5S__hyper_rebuild(H5S_t *space)
@@ -6972,7 +6969,8 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
/* Patch count and block to remove unlimited and include the
- * existing selection */
+ * existing selection.
+ */
H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, bounds_end[unlim_dim] + (hsize_t)1);
HDassert((tmp_count == 1) || (opt_count != H5S_hyper_ones_g));
HDassert((tmp_block == 1) || (opt_block != H5S_hyper_ones_g));
@@ -7774,7 +7772,7 @@ done:
const hsize_t *count; IN: Number of blocks included in hyperslab
const hsize_t *block; IN: Size of block in hyperslab
RETURNS
- Dataspace ID on success/Negative on failure
+ Dataspace ID on success / H5I_INVALID_HID on failure
DESCRIPTION
Combines a hyperslab selection with the current selection for a dataspace,
creating a new dataspace to return the generated selection.
@@ -7905,7 +7903,7 @@ done:
H5S_seloper_t op; IN: Selection operation
hid_t space2; IN: Second Dataspace ID
RETURNS
- Dataspace ID on success/Negative on failure
+ Dataspace ID on success / H5I_INVALID_HID on failure
DESCRIPTION
Combine two existing hyperslab selections with an operation, returning
a new dataspace with the resulting selection. The dataspace extent from
@@ -9996,7 +9994,7 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
} /* end else */
FUNC_LEAVE_NOAPI_VOID
-} /* end H5S_hyper_get_clip_diminfo() */
+} /* end H5S__hyper_get_clip_diminfo() */
/*--------------------------------------------------------------------------
@@ -10042,6 +10040,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
/* Save original unlimited dimension */
orig_unlim_dim = hslab->unlim_dim;
+ /* Set up convenience pointer */
diminfo = &hslab->opt_diminfo[orig_unlim_dim];
/* Save original count in unlimited dimension */
@@ -10079,7 +10078,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
> (clip_size - diminfo->start)) {
hsize_t start[H5S_MAX_RANK];
hsize_t block[H5S_MAX_RANK];
- unsigned i;
+ unsigned u;
/* Last block is partial, need to construct compound selection */
/* Fill start with zeros */
@@ -10087,11 +10086,11 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
/* Set block to clip_size in unlimited dimension, H5S_MAX_SIZE in
* others so only unlimited dimension is clipped */
- for(i = 0; i < space->extent.rank; i++)
- if((int)i == orig_unlim_dim)
- block[i] = clip_size;
+ for(u = 0; u < space->extent.rank; u++)
+ if((int)u == orig_unlim_dim)
+ block[u] = clip_size;
else
- block[i] = H5S_MAX_SIZE;
+ block[u] = H5S_MAX_SIZE;
/* Generate span tree in selection */
if(!hslab->span_lst)
@@ -10101,8 +10100,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
/* Indicate that the regular dimensions are no longer valid */
hslab->diminfo_valid = FALSE;
- /* "And" selection with calculated block to perform clip operation
- */
+ /* "And" selection with calculated block to perform clip operation */
if(H5S__generate_hyperslab(space, H5S_SELECT_AND, start, H5S_hyper_ones_g, H5S_hyper_ones_g, block) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
} /* end if */
@@ -10541,12 +10539,12 @@ H5Sis_regular_hyperslab(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sis_regular_hyperslab() */
+} /* end H5Sis_regular_hyperslab() */
/*--------------------------------------------------------------------------
NAME
- H5Sgetregular_hyperslab
+ H5Sget_regular_hyperslab
PURPOSE
Retrieve a regular hyperslab selection
USAGE
@@ -10605,5 +10603,5 @@ H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[],
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_regular_hyperslab() */
+} /* end H5Sget_regular_hyperslab() */