summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5C.c39
-rw-r--r--src/H5Cdbg.c23
-rw-r--r--src/H5Cimage.c9
-rw-r--r--src/H5Clog.h8
-rw-r--r--src/H5Cprivate.h16
-rw-r--r--src/H5Dchunk.c6
-rw-r--r--src/H5Dearray.c16
-rw-r--r--src/H5Dlayout.c17
-rw-r--r--src/H5Gent.c13
-rw-r--r--src/H5Gstab.c5
-rw-r--r--src/H5HFdbg.c2
-rw-r--r--src/H5HL.c42
-rw-r--r--src/H5HLdbg.c2
-rw-r--r--src/H5HLprivate.h2
-rw-r--r--src/H5Oefl.c8
-rw-r--r--src/H5Osdspace.c23
-rw-r--r--src/H5Pdapl.c2
-rw-r--r--src/H5Pdxpl.c5
-rw-r--r--src/H5Pfapl.c2
-rw-r--r--src/H5SM.c59
-rw-r--r--src/H5Smpio.c3
-rw-r--r--src/H5T.c4
-rw-r--r--src/H5Tbit.c9
-rw-r--r--src/H5VM.c386
-rw-r--r--src/H5VMprivate.h2
-rw-r--r--src/H5Zdeflate.c2
-rw-r--r--src/H5Zscaleoffset.c2
-rw-r--r--src/H5private.h1
-rw-r--r--src/H5timer.c40
-rw-r--r--src/H5trace.c2
30 files changed, 363 insertions, 387 deletions
diff --git a/src/H5C.c b/src/H5C.c
index 1547189..233d6ae 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -459,8 +459,8 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id,
(cache_ptr->resize_ctl).max_increment = H5C__DEF_AR_MAX_INCREMENT;
(cache_ptr->resize_ctl).flash_incr_mode = H5C_flash_incr__off;
- (cache_ptr->resize_ctl).flash_multiple = 1.0f;
- (cache_ptr->resize_ctl).flash_threshold = 0.25f;
+ (cache_ptr->resize_ctl).flash_multiple = 1.0;
+ (cache_ptr->resize_ctl).flash_threshold = 0.25;
(cache_ptr->resize_ctl).decr_mode = H5C_decr__off;
(cache_ptr->resize_ctl).upper_hr_threshold = H5C__DEF_AR_UPPER_THRESHHOLD;
@@ -2718,7 +2718,7 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_p
break;
case H5C_incr__threshold:
- if ((config_ptr->lower_hr_threshold <= (double)0.0f) || (config_ptr->increment <= (double)1.0f) ||
+ if ((config_ptr->lower_hr_threshold <= 0.0) || (config_ptr->increment <= 1.0) ||
((config_ptr->apply_max_increment) && (config_ptr->max_increment <= 0)))
cache_ptr->size_increase_possible = FALSE;
break;
@@ -2738,21 +2738,21 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_p
break;
case H5C_decr__threshold:
- if ((config_ptr->upper_hr_threshold >= (double)1.0f) || (config_ptr->decrement >= (double)1.0f) ||
+ if ((config_ptr->upper_hr_threshold >= 1.0) || (config_ptr->decrement >= 1.0) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
break;
case H5C_decr__age_out:
- if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
+ if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
break;
case H5C_decr__age_out_with_threshold:
- if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
+ if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)) ||
- (config_ptr->upper_hr_threshold >= (double)1.0f))
+ (config_ptr->upper_hr_threshold >= 1.0))
cache_ptr->size_decrease_possible = FALSE;
break;
@@ -3730,8 +3730,7 @@ done:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"initial_size must be in the interval [min_size, max_size]")
- if ((config_ptr->min_clean_fraction < (double)0.0f) ||
- (config_ptr->min_clean_fraction > (double)1.0f))
+ if ((config_ptr->min_clean_fraction < 0.0) || (config_ptr->min_clean_fraction > 1.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"min_clean_fraction must be in the interval [0.0, 1.0]")
@@ -3747,12 +3746,11 @@ done:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode")
if (config_ptr->incr_mode == H5C_incr__threshold) {
- if ((config_ptr->lower_hr_threshold < (double)0.0f) ||
- (config_ptr->lower_hr_threshold > (double)1.0f))
+ if ((config_ptr->lower_hr_threshold < 0.0) || (config_ptr->lower_hr_threshold > 1.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"lower_hr_threshold must be in the range [0.0, 1.0]")
- if (config_ptr->increment < (double)1.0f)
+ if (config_ptr->increment < 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"increment must be greater than or equal to 1.0")
@@ -3767,12 +3765,10 @@ done:
break;
case H5C_flash_incr__add_space:
- if ((config_ptr->flash_multiple < (double)0.1f) ||
- (config_ptr->flash_multiple > (double)10.0f))
+ if ((config_ptr->flash_multiple < 0.1) || (config_ptr->flash_multiple > 10.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"flash_multiple must be in the range [0.1, 10.0]")
- if ((config_ptr->flash_threshold < (double)0.1f) ||
- (config_ptr->flash_threshold > (double)1.0f))
+ if ((config_ptr->flash_threshold < 0.1) || (config_ptr->flash_threshold > 1.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"flash_threshold must be in the range [0.1, 1.0]")
break;
@@ -3793,10 +3789,10 @@ done:
}
if (config_ptr->decr_mode == H5C_decr__threshold) {
- if (config_ptr->upper_hr_threshold > (double)1.0f)
+ if (config_ptr->upper_hr_threshold > 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0")
- if ((config_ptr->decrement > (double)1.0f) || (config_ptr->decrement < (double)0.0f))
+ if ((config_ptr->decrement > 1.0) || (config_ptr->decrement < 0.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]")
/* no need to check max_decrement as it is a size_t
@@ -3812,8 +3808,8 @@ done:
if (config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big")
- if ((config_ptr->apply_empty_reserve) && ((config_ptr->empty_reserve > (double)1.0f) ||
- (config_ptr->empty_reserve < (double)0.0f)))
+ if ((config_ptr->apply_empty_reserve) &&
+ ((config_ptr->empty_reserve > 1.0) || (config_ptr->empty_reserve < 0.0)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"empty_reserve must be in the interval [0.0, 1.0]")
@@ -3823,8 +3819,7 @@ done:
} /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */
if (config_ptr->decr_mode == H5C_decr__age_out_with_threshold) {
- if ((config_ptr->upper_hr_threshold > (double)1.0f) ||
- (config_ptr->upper_hr_threshold < (double)0.0f))
+ if ((config_ptr->upper_hr_threshold > 1.0) || (config_ptr->upper_hr_threshold < 0.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"upper_hr_threshold must be in the interval [0.0, 1.0]")
} /* H5C_decr__age_out_with_threshold */
diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c
index e602284..c52c8d5 100644
--- a/src/H5Cdbg.c
+++ b/src/H5Cdbg.c
@@ -429,11 +429,11 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
int32_t aggregate_max_pins = 0;
double hit_rate;
double prefetch_use_rate;
- double average_successful_search_depth = 0.0f;
- double average_failed_search_depth = 0.0f;
- double average_entries_skipped_per_calls_to_msic = 0.0f;
- double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0f;
- double average_entries_scanned_per_calls_to_msic = 0.0f;
+ double average_successful_search_depth = 0.0;
+ double average_failed_search_depth = 0.0;
+ double average_entries_skipped_per_calls_to_msic = 0.0;
+ double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0;
+ double average_entries_scanned_per_calls_to_msic = 0.0;
#endif /* H5C_COLLECT_CACHE_STATS */
herr_t ret_value = SUCCEED; /* Return value */
@@ -492,9 +492,9 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
} /* end for */
if ((total_hits > 0) || (total_misses > 0))
- hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses));
+ hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses));
else
- hit_rate = 0.0f;
+ hit_rate = 0.0;
if (cache_ptr->successful_ht_searches > 0)
average_successful_search_depth = ((double)(cache_ptr->total_successful_ht_search_depth)) /
@@ -630,10 +630,9 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
(long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID]));
if (cache_ptr->prefetches > 0)
- prefetch_use_rate =
- (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
+ prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
else
- prefetch_use_rate = 0.0f;
+ prefetch_use_rate = 0.0;
HDfprintf(stdout, "%s prefetched entry use rate = %lf\n", cache_ptr->prefix, prefetch_use_rate);
@@ -658,10 +657,10 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
((cache_ptr->class_table_ptr))[i]->name);
if ((cache_ptr->hits[i] > 0) || (cache_ptr->misses[i] > 0))
- hit_rate = (double)100.0f * ((double)(cache_ptr->hits[i])) /
+ hit_rate = 100.0 * ((double)(cache_ptr->hits[i])) /
((double)(cache_ptr->hits[i] + cache_ptr->misses[i]));
else
- hit_rate = 0.0f;
+ hit_rate = 0.0;
HDfprintf(stdout, "%s hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix,
(long)(cache_ptr->hits[i]), (long)(cache_ptr->misses[i]), hit_rate);
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index fcf1b1c..24aafba 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -980,15 +980,14 @@ H5C_image_stats(H5C_t *cache_ptr, hbool_t H5_ATTR_UNUSED print_header)
} /* end for */
if ((total_hits > 0) || (total_misses > 0))
- hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses));
+ hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses));
else
- hit_rate = 0.0f;
+ hit_rate = 0.0;
if (cache_ptr->prefetches > 0)
- prefetch_use_rate =
- (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
+ prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
else
- prefetch_use_rate = 0.0f;
+ prefetch_use_rate = 0.0;
if (print_header) {
HDfprintf(stdout, "\nhit prefetches prefetch image pf hit\n");
diff --git a/src/H5Clog.h b/src/H5Clog.h
index bd5c413..790a073 100644
--- a/src/H5Clog.h
+++ b/src/H5Clog.h
@@ -79,10 +79,10 @@ typedef struct H5C_log_class_t {
/* Logging information */
struct H5C_log_info_t {
- hbool_t enabled; /* Was the logging set up? */
- hbool_t logging; /* Are we currently logging? */
- H5C_log_class_t *cls; /* Callbacks for writing log messages */
- void * udata; /* Log-specific data */
+ hbool_t enabled; /* Was the logging set up? */
+ hbool_t logging; /* Are we currently logging? */
+ const H5C_log_class_t *cls; /* Callbacks for writing log messages */
+ void * udata; /* Log-specific data */
};
/*****************************/
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 6863763..102c9bf 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -115,20 +115,20 @@
#define H5C__CURR_CACHE_IMAGE_CTL_VER 1
/* Default configuration settings */
-#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999f
-#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9f
+#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999
+#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9
#define H5C__DEF_AR_MAX_SIZE ((size_t)(16 * 1024 * 1024))
#define H5C__DEF_AR_INIT_SIZE ((size_t)(1 * 1024 * 1024))
#define H5C__DEF_AR_MIN_SIZE ((size_t)(1 * 1024 * 1024))
-#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5f
-#define H5C__DEF_AR_INCREMENT 2.0f
+#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5
+#define H5C__DEF_AR_INCREMENT 2.0
#define H5C__DEF_AR_MAX_INCREMENT ((size_t)(2 * 1024 * 1024))
-#define H5C__DEF_AR_FLASH_MULTIPLE 1.0f
-#define H5C__DEV_AR_FLASH_THRESHOLD 0.25f
-#define H5C__DEF_AR_DECREMENT 0.9f
+#define H5C__DEF_AR_FLASH_MULTIPLE 1.0
+#define H5C__DEV_AR_FLASH_THRESHOLD 0.25
+#define H5C__DEF_AR_DECREMENT 0.9
#define H5C__DEF_AR_MAX_DECREMENT ((size_t)(1 * 1024 * 1024))
#define H5C__DEF_AR_EPCHS_B4_EVICT 3
-#define H5C__DEF_AR_EMPTY_RESERVE 0.05f
+#define H5C__DEF_AR_EMPTY_RESERVE 0.05
#define H5C__MIN_AR_EPOCH_LENGTH 100
#define H5C__DEF_AR_EPOCH_LENGTH 50000
#define H5C__MAX_AR_EPOCH_LENGTH 1000000
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 7700c0e..a727d88 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -708,10 +708,8 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize
} /* end for */
/* Get the "down" sizes for each dimension */
- if (H5VM_array_down(ndims, layout->chunks, layout->down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
- if (H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
+ H5VM_array_down(ndims, layout->chunks, layout->down_chunks);
+ H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks);
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
index 24e8df2..abce233 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -1160,9 +1160,7 @@ done:
static herr_t
H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(layout);
@@ -1182,8 +1180,7 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
H5VM_swizzle_coords(hsize_t, swizzled_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled "down" sizes for each dimension */
- if (H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
+ H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks);
/* Get the swizzled max number of chunks in each dimension */
H5MM_memcpy(swizzled_max_chunks, layout->max_chunks,
@@ -1191,13 +1188,10 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
H5VM_swizzle_coords(hsize_t, swizzled_max_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled max "down" sizes for each dimension */
- if (H5VM_array_down((layout->ndims - 1), swizzled_max_chunks,
- layout->u.earray.swizzled_max_down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
- } /* end if */
+ H5VM_array_down((layout->ndims - 1), swizzled_max_chunks, layout->u.earray.swizzled_max_down_chunks);
+ }
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_idx_resize() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index a855651..c8b4b33 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -502,6 +502,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
H5HL_t * heap; /* Pointer to local heap for EFL file names */
size_t heap_size = H5HL_ALIGN(1);
size_t u;
+ size_t name_offset;
/* Determine size of heap needed to stored the file names */
for (u = 0; u < efl->nused; ++u)
@@ -516,24 +517,22 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect EFL file name heap")
/* Insert "empty" name first */
- if (UFAIL == H5HL_insert(file, heap, (size_t)1, "")) {
+ if (H5HL_insert(file, heap, (size_t)1, "", &name_offset) < 0) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
- } /* end if */
+ }
for (u = 0; u < efl->nused; ++u) {
- size_t offset; /* Offset of file name in heap */
-
/* Insert file name into heap */
- if (UFAIL ==
- (offset = H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) {
+ if (H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name, &name_offset) <
+ 0) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
- } /* end if */
+ }
/* Store EFL file name offset */
- efl->slot[u].name_offset = offset;
- } /* end for */
+ efl->slot[u].name_offset = name_offset;
+ }
/* Release the heap */
if (H5HL_unprotect(heap) < 0)
diff --git a/src/H5Gent.c b/src/H5Gent.c
index a0fa28d..b200c0e 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -387,11 +387,8 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk
/* Reset the new entry */
H5G__ent_reset(ent);
- /*
- * Add the new name to the heap.
- */
- name_offset = H5HL_insert(f, heap, HDstrlen(name) + 1, name);
- if (0 == name_offset || UFAIL == name_offset)
+ /* Add the new name to the heap */
+ if (H5HL_insert(f, heap, HDstrlen(name) + 1, name, &name_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap")
ent->name_off = name_offset;
@@ -479,14 +476,12 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk
size_t lnk_offset; /* Offset to sym-link value */
/* Insert link value into local heap */
- if (UFAIL ==
- (lnk_offset = H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name)))
+ if (H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap")
ent->type = H5G_CACHED_SLINK;
ent->cache.slink.lval_offset = lnk_offset;
- } /* end case */
- break;
+ } break;
case H5L_TYPE_ERROR:
case H5L_TYPE_EXTERNAL:
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 6203fd0..67f7524 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -150,11 +150,10 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap")
/* Insert name into the heap */
- if (UFAIL == (name_offset = H5HL_insert(f, heap, (size_t)1, "")))
+ if (H5HL_insert(f, heap, (size_t)1, "", &name_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert name into heap")
- /*
- * B-tree's won't work if the first name isn't at the beginning
+ /* B-trees won't work if the first name isn't at the beginning
* of the heap.
*/
HDassert(0 == name_offset);
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index cc61aa1..a244035 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -543,7 +543,7 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
amount_free = 0;
HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of available space for data used:",
- ((double)100.0f * (double)((dblock->size - blk_prefix_size) - amount_free) /
+ (100.0 * (double)((dblock->size - blk_prefix_size) - amount_free) /
(double)(dblock->size - blk_prefix_size)));
/*
diff --git a/src/H5HL.c b/src/H5HL.c
index 50d24c3..ca83445 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -508,27 +508,31 @@ END_FUNC(STATIC) /* end H5HL__dirty() */
*
* Purpose: Inserts a new item into the heap.
*
- * Return: Success: Offset of new item within heap.
- * Failure: UFAIL
+ * Return: Success: SUCCEED
+ * Offset set to location of new item within heap
+ *
+ * Failure: FAIL
+ * Offset set to SIZE_MAX
*
* Programmer: Robb Matzke
* Jul 17 1997
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
- H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf))
+BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
+ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *offset_out))
H5HL_free_t *fl = NULL, *last_fl = NULL;
- size_t offset = 0;
size_t need_size;
+ size_t offset = 0;
hbool_t found;
- /* check arguments */
+ /* Check arguments */
HDassert(f);
HDassert(heap);
HDassert(buf_size > 0);
HDassert(buf);
+ HDassert(offset_out);
/* Mark heap as dirty in cache */
/* (A bit early in the process, but it's difficult to determine in the
@@ -539,20 +543,18 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
if (FAIL == H5HL__dirty(heap))
H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty");
- /*
- * In order to keep the free list descriptors aligned on word boundaries,
+ /* In order to keep the free list descriptors aligned on word boundaries,
* whatever that might mean, we round the size up to the next multiple of
* a word.
*/
need_size = H5HL_ALIGN(buf_size);
- /*
- * Look for a free slot large enough for this object and which would
+ /* Look for a free slot large enough for this object and which would
* leave zero or at least H5G_SIZEOF_FREE bytes left over.
*/
for (fl = heap->freelist, found = FALSE; fl; fl = fl->next) {
if (fl->size > need_size && fl->size - need_size >= H5HL_SIZEOF_FREE(f)) {
- /* a big enough free block was found */
+ /* A big enough free block was found */
offset = fl->offset;
fl->offset += need_size;
fl->size -= need_size;
@@ -562,20 +564,19 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
break;
}
else if (fl->size == need_size) {
- /* free block of exact size found */
+ /* Free block of exact size found */
offset = fl->offset;
fl = H5HL__remove_free(heap, fl);
found = TRUE;
break;
}
else if (!last_fl || last_fl->offset < fl->offset) {
- /* track free space that's closest to end of heap */
+ /* Track free space that's closest to end of heap */
last_fl = fl;
}
} /* end for */
- /*
- * If no free chunk was large enough, then allocate more space and
+ /* If no free chunk was large enough, then allocate more space and
* add it to the free list. If the heap ends with a free chunk, we
* can extend that free chunk. Otherwise we'll have to make another
* free chunk. If the heap must expand, we double its size.
@@ -587,7 +588,8 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
htri_t was_extended; /* Whether the local heap's data segment on disk was extended */
/* At least double the heap's size, making certain there's enough room
- * for the new object */
+ * for the new object
+ */
need_more = MAX(need_size, heap->dblk_size);
/* If there is no last free block or it's not at the end of the heap,
@@ -657,8 +659,7 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
}
} /* end if */
else {
- /*
- * Create a new free list element large enough that we can
+ /* Create a new free list element large enough that we can
* take some space out of it right away.
*/
offset = old_dblk_size;
@@ -700,11 +701,10 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
/* Copy the data into the heap */
H5MM_memcpy(heap->dblk_image + offset, buf, buf_size);
- /* Set return value */
- ret_value = offset;
+ *offset_out = offset;
CATCH
- /* No special processing on errors */
+ /* No special processing on exit */
END_FUNC(PRIV) /* H5HL_insert() */
diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c
index d0cfa96..76e4ec0 100644
--- a/src/H5HLdbg.c
+++ b/src/H5HLdbg.c
@@ -102,7 +102,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
if (h->dblk_size)
HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:",
- ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size));
+ (100.0 * (double)(h->dblk_size - amount_free) / (double)h->dblk_size));
/* Print the data in a VMS-style octal dump */
H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size);
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index 739e761..5c98846 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -57,7 +57,7 @@ H5_DLL herr_t H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr /*out*/);
H5_DLL herr_t H5HL_delete(H5F_t *f, haddr_t addr);
H5_DLL herr_t H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size);
H5_DLL herr_t H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size);
-H5_DLL size_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t size, const void *buf);
+H5_DLL herr_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t size, const void *buf, size_t *offset);
H5_DLL void * H5HL_offset_into(const H5HL_t *heap, size_t offset);
H5_DLL H5HL_t *H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags);
H5_DLL herr_t H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size);
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 5ec85aa..2fdb296 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -466,7 +466,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
HGOTO_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to protect EFL file name heap")
/* Insert "empty" name first */
- if (UFAIL == (name_offset = H5HL_insert(file_dst, heap, (size_t)1, "")))
+ if (H5HL_insert(file_dst, heap, (size_t)1, "", &name_offset) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap")
HDassert(0 == name_offset);
@@ -483,10 +483,10 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
/* copy the name from the source */
for (idx = 0; idx < efl_src->nused; idx++) {
efl_dst->slot[idx].name = H5MM_xstrdup(efl_src->slot[idx].name);
- if (UFAIL == (efl_dst->slot[idx].name_offset = H5HL_insert(
- file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name)))
+ if (H5HL_insert(file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name,
+ &(efl_dst->slot[idx].name_offset)) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap")
- } /* end for */
+ }
/* Set return value */
ret_value = efl_dst;
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index c715df8..6a2557f 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -106,12 +106,13 @@ H5FL_ARR_EXTERN(hsize_t);
--------------------------------------------------------------------------*/
static void *
H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p)
{
- H5S_extent_t *sdim = NULL; /* New extent dimensionality structure */
- unsigned flags, version;
- unsigned i; /* Local counting variable */
- void * ret_value = NULL; /* Return value */
+ H5S_extent_t * sdim = NULL; /* New extent dimensionality structure */
+ unsigned flags, version;
+ unsigned i; /* Local counting variable */
+ const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -158,6 +159,13 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN
/* Decode dimension sizes */
if (sdim->rank > 0) {
+ /* Ensure that rank doesn't cause reading passed buffer's end,
+ due to possible data corruption */
+ uint8_t sizeof_size = H5F_SIZEOF_SIZE(f);
+ if (p + (sizeof_size * sdim->rank - 1) > p_end) {
+ HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "rank might cause reading passed buffer's end")
+ }
+
if (NULL == (sdim->size = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
@@ -167,6 +175,11 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN
if (flags & H5S_VALID_MAX) {
if (NULL == (sdim->max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
+ /* Ensure that rank doesn't cause reading passed buffer's end */
+ if (p + (sizeof_size * sdim->rank - 1) > p_end)
+ HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "rank might cause reading passed buffer's end")
+
for (i = 0; i < sdim->rank; i++)
H5F_DECODE_LENGTH(f, p, sdim->max[i]);
} /* end if */
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index 0ef1519..3b14959 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -768,7 +768,7 @@ H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double
/* Check arguments. Note that we allow negative values - they are
* considered to "unset" the property. */
- if (rdcc_w0 > (double)1.0f)
+ if (rdcc_w0 > 1.0)
HGOTO_ERROR(
H5E_ARGS, H5E_BADVALUE, FAIL,
"raw data cache w0 value must be between 0.0 and 1.0 inclusive, or H5D_CHUNK_CACHE_W0_DEFAULT");
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index f2fb127..1f2153a 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -1486,9 +1486,8 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right)
H5TRACE4("e", "iddd", plist_id, left, middle, right);
/* Check arguments */
- if (left < (double)0.0f || left > (double)1.0f || middle < (double)0.0f || middle > (double)1.0f ||
- right < (double)0.0f || right > (double)1.0f)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0")
+ if (left < 0.0 || left > 1.0 || middle < 0.0 || middle > 1.0 || right < 0.0 || right > 1.0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0 <= X <= 1.0")
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 1a69c10..fe5a81e 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -1634,7 +1634,7 @@ H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, size_t rdcc_nslots,
H5TRACE5("e", "iIszzd", plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0);
/* Check arguments */
- if (rdcc_w0 < (double)0.0f || rdcc_w0 > (double)1.0f)
+ if (rdcc_w0 < 0.0 || rdcc_w0 > 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"raw data cache w0 value must be between 0.0 and 1.0 inclusive")
diff --git a/src/H5SM.c b/src/H5SM.c
index ad2d9ef..a72a4dd 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -1220,16 +1220,16 @@ static herr_t
H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t defer, unsigned type_id,
void *mesg, unsigned *cache_flags_ptr)
{
- H5SM_list_t * list = NULL; /* List index */
- H5SM_mesg_key_t key; /* Key used to search the index */
- H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- H5O_shared_t shared; /* Shared H5O message */
- hbool_t found = FALSE; /* Was the message in the index? */
- H5HF_t * fheap = NULL; /* Fractal heap handle */
- H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
- size_t buf_size; /* Size of the encoded message */
- void * encoding_buf = NULL; /* Buffer for encoded message */
- size_t empty_pos = UFAIL; /* Empty entry in list */
+ H5SM_list_t * list = NULL; /* List index */
+ H5SM_mesg_key_t key; /* Key used to search the index */
+ H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
+ H5O_shared_t shared; /* Shared H5O message */
+ hbool_t found = FALSE; /* Was the message in the index? */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
+ size_t buf_size; /* Size of the encoded message */
+ void * encoding_buf = NULL; /* Buffer for encoded message */
+ size_t empty_pos = SIZE_MAX; /* Empty entry in list */
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC_TAG(H5AC__SOHM_TAG)
@@ -1283,11 +1283,11 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t
HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
if (defer) {
- if (list_pos != UFAIL)
+ if (list_pos != SIZE_MAX)
found = TRUE;
} /* end if */
else {
- if (list_pos != UFAIL) {
+ if (list_pos != SIZE_MAX) {
/* If the message was previously shared in an object header, share
* it in the heap now.
*/
@@ -1442,13 +1442,13 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t
/* Insert the new message into the SOHM index */
if (header->index_type == H5SM_LIST) {
/* Index is a list. Find an empty spot if we haven't already */
- if (empty_pos == UFAIL) {
+ if (empty_pos == SIZE_MAX) {
size_t pos;
if (H5SM__find_in_list(list, NULL, &empty_pos, &pos) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
- if (pos == UFAIL || empty_pos == UFAIL)
+ if (pos == SIZE_MAX || empty_pos == SIZE_MAX)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list")
}
/* Insert message into list */
@@ -1608,9 +1608,14 @@ done:
*
* If EMPTY_POS is NULL, don't store anything in it.
*
- * Return: Message's position in the list on success
- * UFAIL if message couldn't be found
- * empty_pos set to position of empty message or UFAIL.
+ * Return: Success: SUCCEED
+ * pos = position (if found)
+ * pos = SIZE_MAX (if not found)
+ * empty_pos = indeterminate (if found)
+ * empty_pos = 1st empty position (if not found)
+ *
+ * Failure: FAIL
+ * pos & empty_pos indeterminate
*
* Programmer: James Laird
* Tuesday, May 2, 2006
@@ -1631,7 +1636,7 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *
/* Initialize empty_pos to an invalid value */
if (empty_pos)
- *empty_pos = UFAIL;
+ *empty_pos = SIZE_MAX;
/* Find the first (only) message equal to the key passed in.
* Also record the first empty position we find.
@@ -1654,11 +1659,11 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *
/* Found earlier position possible, don't check any more */
empty_pos = NULL;
- } /* end if */
- } /* end for */
+ }
+ }
/* If we reached this point, we didn't find the message */
- *pos = UFAIL;
+ *pos = SIZE_MAX;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1826,7 +1831,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c
/* Find the message in the list */
if (H5SM__find_in_list(list, &key, NULL, &list_pos) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list")
- if (list_pos == UFAIL)
+ if (list_pos == SIZE_MAX)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
if (list->messages[list_pos].location == H5SM_IN_HEAP)
@@ -2208,7 +2213,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize
/* Find the message in the list */
if (H5SM__find_in_list(list, &key, NULL, &list_pos) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list")
- if (list_pos == UFAIL)
+ if (list_pos == SIZE_MAX)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
/* Copy the message */
@@ -2505,7 +2510,7 @@ H5SM_list_free(H5SM_list_t *list)
*
* Purpose: Print debugging information for the master table.
*
- * If table_vers and num_indexes are not UFAIL, they are used
+ * If table_vers and num_indexes are not UINT_MAX, they are used
* instead of the values in the superblock.
*
* Return: Non-negative on success/Negative on failure
@@ -2532,14 +2537,14 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, int fwi
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- /* If table_vers and num_indexes are UFAIL, replace them with values from
+ /* If table_vers and num_indexes are UINT_MAX, replace them with values from
* userblock
*/
- if (table_vers == UFAIL)
+ if (table_vers == UINT_MAX)
table_vers = H5F_SOHM_VERS(f);
else if (table_vers != H5F_SOHM_VERS(f))
HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n");
- if (num_indexes == UFAIL)
+ if (num_indexes == UINT_MAX)
num_indexes = H5F_SOHM_NINDEXES(f);
else if (num_indexes != H5F_SOHM_NINDEXES(f))
HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n");
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 9a38aaa..7b85209 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -1014,8 +1014,7 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *ne
elmt_type_is_derived = TRUE;
/* Compute 'down' sizes for each dimension */
- if (H5VM_array_down(space->extent.rank, space->extent.size, down) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGETSIZE, FAIL, "couldn't compute 'down' dimension sizes")
+ H5VM_array_down(space->extent.rank, space->extent.size, down);
/* Acquire an operation generation value for creating MPI datatypes */
op_gen = H5S__hyper_get_op_gen();
diff --git a/src/H5T.c b/src/H5T.c
index 8856f17..739c8b2 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -540,8 +540,8 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0;
/* (+/- Inf for all floating-point types) */
float H5T_NATIVE_FLOAT_POS_INF_g = 0.0f;
float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0f;
-double H5T_NATIVE_DOUBLE_POS_INF_g = (double)0.0f;
-double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f;
+double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0;
+double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0;
/* Declare the free list for H5T_t's and H5T_shared_t's */
H5FL_DEFINE(H5T_t);
diff --git a/src/H5Tbit.c b/src/H5Tbit.c
index e2ca4b9..9f0c061 100644
--- a/src/H5Tbit.c
+++ b/src/H5Tbit.c
@@ -228,10 +228,7 @@ done:
* Purpose: Return a small bit sequence as a number. Bit vector starts
* at OFFSET and is SIZE bits long.
*
- * Return: Success: The bit sequence interpretted as an unsigned
- * integer.
- *
- * Failure: 0
+ * Return: The bit sequence interpretted as an unsigned integer
*
*-------------------------------------------------------------------------
*/
@@ -264,8 +261,8 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size)
case H5T_ORDER_NONE:
case H5T_ORDER_MIXED:
default:
- /* Unknown endianness. Bail out. */
- HGOTO_DONE(UFAIL)
+ /* This function can't return errors */
+ HDassert(0 && "unknown byte order");
}
/* Set return value */
diff --git a/src/H5VM.c b/src/H5VM.c
index 7ce3476..71074b5 100644
--- a/src/H5VM.c
+++ b/src/H5VM.c
@@ -43,20 +43,20 @@ static void H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n
#endif /* LATER */
/*-------------------------------------------------------------------------
- * Function: H5VM__stride_optimize1
+ * Function: H5VM__stride_optimize1
*
- * Purpose: Given a stride vector which references elements of the
- * specified size, optimize the dimensionality, the stride
- * vector, and the element size to minimize the dimensionality
- * and the number of memory accesses.
+ * Purpose: Given a stride vector which references elements of the
+ * specified size, optimize the dimensionality, the stride
+ * vector, and the element size to minimize the dimensionality
+ * and the number of memory accesses.
*
- * All arguments are passed by reference and their values may be
- * modified by this function.
+ * All arguments are passed by reference and their values may be
+ * modified by this function.
*
- * Return: None
+ * Return: void
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -66,15 +66,12 @@ H5VM__stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c
{
FUNC_ENTER_STATIC_NOERR
- /*
- * This has to be true because if we optimize the dimensionality down to
+ /* This has to be true because if we optimize the dimensionality down to
* zero we still must make one reference.
*/
HDassert(1 == H5VM_vector_reduce_product(0, NULL));
- /*
- * Combine adjacent memory accesses
- */
+ /* Combine adjacent memory accesses */
while (*np && stride1[*np - 1] > 0 && (hsize_t)(stride1[*np - 1]) == *elmt_size) {
*elmt_size *= size[*np - 1];
if (--*np)
@@ -85,20 +82,20 @@ H5VM__stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c
}
/*-------------------------------------------------------------------------
- * Function: H5VM__stride_optimize2
+ * Function: H5VM__stride_optimize2
*
- * Purpose: Given two stride vectors which reference elements of the
- * specified size, optimize the dimensionality, the stride
- * vectors, and the element size to minimize the dimensionality
- * and the number of memory accesses.
+ * Purpose: Given two stride vectors which reference elements of the
+ * specified size, optimize the dimensionality, the stride
+ * vectors, and the element size to minimize the dimensionality
+ * and the number of memory accesses.
*
- * All arguments are passed by reference and their values may be
- * modified by this function.
+ * All arguments are passed by reference and their values may be
+ * modified by this function.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -108,16 +105,13 @@ H5VM__stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c
{
FUNC_ENTER_STATIC_NOERR
- /*
- * This has to be true because if we optimize the dimensionality down to
+ /* This has to be true because if we optimize the dimensionality down to
* zero we still must make one reference.
*/
HDassert(1 == H5VM_vector_reduce_product(0, NULL));
HDassert(*elmt_size > 0);
- /*
- * Combine adjacent memory accesses
- */
+ /* Combine adjacent memory accesses */
/* Unroll loop for common cases */
switch (*np) {
@@ -206,29 +200,26 @@ H5VM__stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c
}
/*-------------------------------------------------------------------------
- * Function: H5VM_hyper_stride
- *
- * Purpose: Given a description of a hyperslab, this function returns
- * (through STRIDE[]) the byte strides appropriate for accessing
- * all bytes of the hyperslab and the byte offset where the
- * striding will begin. The SIZE can be passed to the various
- * stride functions.
+ * Function: H5VM_hyper_stride
*
- * The dimensionality of the whole array, the hyperslab, and the
- * returned stride array is N. The whole array dimensions are
- * TOTAL_SIZE and the hyperslab is at offset OFFSET and has
- * dimensions SIZE.
+ * Purpose: Given a description of a hyperslab, this function returns
+ * (through STRIDE[]) the byte strides appropriate for accessing
+ * all bytes of the hyperslab and the byte offset where the
+ * striding will begin. The SIZE can be passed to the various
+ * stride functions.
*
- * The stride and starting point returned will cause the
- * hyperslab elements to be referenced in C order.
+ * The dimensionality of the whole array, the hyperslab, and the
+ * returned stride array is N. The whole array dimensions are
+ * TOTAL_SIZE and the hyperslab is at offset OFFSET and has
+ * dimensions SIZE.
*
- * Return: Success: Byte offset from beginning of array to start
- * of striding.
+ * The stride and starting point returned will cause the
+ * hyperslab elements to be referenced in C order.
*
- * Failure: abort() -- should never fail
+ * Return: Byte offset from beginning of array to start of striding.
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -308,23 +299,22 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, co
}
/*-------------------------------------------------------------------------
- * Function: H5VM_hyper_eq
+ * Function: H5VM_hyper_eq
*
- * Purpose: Determines whether two hyperslabs are equal. This function
- * assumes that both hyperslabs are relative to the same array,
- * for if not, they could not possibly be equal.
+ * Purpose: Determines whether two hyperslabs are equal. This function
+ * assumes that both hyperslabs are relative to the same array,
+ * for if not, they could not possibly be equal.
*
- * Return: Success: TRUE if the hyperslabs are equal (that is,
- * both refer to exactly the same elements of an
- * array)
+ * Return: TRUE if the hyperslabs are equal (that is,
+ * both refer to exactly the same elements of an
+ * array)
*
- * FALSE otherwise.
+ * FALSE otherwise
*
- * Failure: TRUE the rank is zero or if both hyperslabs
- * are of zero size.
+ * Never returns FAIL
*
- * Programmer: Robb Matzke
- * Friday, October 17, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 17, 1997
*
*-------------------------------------------------------------------------
*/
@@ -360,19 +350,19 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VM_hyper_fill
*
- * Purpose: Similar to memset() except it operates on hyperslabs...
+ * Purpose: Similar to memset() except it operates on hyperslabs...
*
- * Fills a hyperslab of array BUF with some value VAL. BUF
- * is treated like a C-order array with N dimensions where the
- * size of each dimension is TOTAL_SIZE[]. The hyperslab which
- * will be filled with VAL begins at byte offset OFFSET[] from
- * the minimum corner of BUF and continues for SIZE[] bytes in
- * each dimension.
+ * Fills a hyperslab of array BUF with some value VAL. BUF
+ * is treated like a C-order array with N dimensions where the
+ * size of each dimension is TOTAL_SIZE[]. The hyperslab which
+ * will be filled with VAL begins at byte offset OFFSET[] from
+ * the minimum corner of BUF and continues for SIZE[] bytes in
+ * each dimension.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
*-------------------------------------------------------------------------
*/
@@ -418,31 +408,31 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, const hsize_t *total_size, con
}
/*-------------------------------------------------------------------------
- * Function: H5VM_hyper_copy
+ * Function: H5VM_hyper_copy
*
- * Purpose: Copies a hyperslab from the source to the destination.
+ * Purpose: Copies a hyperslab from the source to the destination.
*
- * A hyperslab is a logically contiguous region of
- * multi-dimensional size SIZE of an array whose dimensionality
- * is N and whose total size is DST_TOTAL_SIZE or SRC_TOTAL_SIZE.
- * The minimum corner of the hyperslab begins at a
- * multi-dimensional offset from the minimum corner of the DST
- * (destination) or SRC (source) array. The sizes and offsets
- * are assumed to be in C order, that is, the first size/offset
- * varies the slowest while the last varies the fastest in the
- * mapping from N-dimensional space to linear space. This
- * function assumes that the array elements are single bytes (if
- * your array has multi-byte elements then add an additional
- * dimension whose size is that of your element).
+ * A hyperslab is a logically contiguous region of
+ * multi-dimensional size SIZE of an array whose dimensionality
+ * is N and whose total size is DST_TOTAL_SIZE or SRC_TOTAL_SIZE.
+ * The minimum corner of the hyperslab begins at a
+ * multi-dimensional offset from the minimum corner of the DST
+ * (destination) or SRC (source) array. The sizes and offsets
+ * are assumed to be in C order, that is, the first size/offset
+ * varies the slowest while the last varies the fastest in the
+ * mapping from N-dimensional space to linear space. This
+ * function assumes that the array elements are single bytes (if
+ * your array has multi-byte elements then add an additional
+ * dimension whose size is that of your element).
*
- * The SRC and DST array may be the same array, but the results
- * are undefined if the source hyperslab overlaps the
- * destination hyperslab.
+ * The SRC and DST array may be the same array, but the results
+ * are undefined if the source hyperslab overlaps the
+ * destination hyperslab.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
*-------------------------------------------------------------------------
*/
@@ -597,13 +587,13 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size,
/*-------------------------------------------------------------------------
* Function: H5VM_stride_fill
*
- * Purpose: Fills all bytes of a hyperslab with the same value using
- * memset().
+ * Purpose: Fills all bytes of a hyperslab with the same value using
+ * memset().
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -648,19 +638,19 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize
/*-------------------------------------------------------------------------
* Function: H5VM_stride_copy
*
- * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
- * DST and SRC while copying bytes from SRC to DST. This
- * function minimizes the number of calls to memcpy() by
- * combining various strides, but it will never touch memory
- * outside the hyperslab defined by the strides.
+ * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
+ * DST and SRC while copying bytes from SRC to DST. This
+ * function minimizes the number of calls to memcpy() by
+ * combining various strides, but it will never touch memory
+ * outside the hyperslab defined by the strides.
*
- * Note: If the src_stride is all zero and elmt_size is one, then it's
- * probably more efficient to use H5VM_stride_fill() instead.
+ * Note: If the src_stride is all zero and elmt_size is one, then it's
+ * probably more efficient to use H5VM_stride_fill() instead.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -714,19 +704,19 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize
/*-------------------------------------------------------------------------
* Function: H5VM_stride_copy_s
*
- * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
- * DST and SRC while copying bytes from SRC to DST. This
- * function minimizes the number of calls to memcpy() by
- * combining various strides, but it will never touch memory
- * outside the hyperslab defined by the strides.
+ * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
+ * DST and SRC while copying bytes from SRC to DST. This
+ * function minimizes the number of calls to memcpy() by
+ * combining various strides, but it will never touch memory
+ * outside the hyperslab defined by the strides.
*
- * Note: If the src_stride is all zero and elmt_size is one, then it's
- * probably more efficient to use H5VM_stride_fill() instead.
+ * Note: If the src_stride is all zero and elmt_size is one, then it's
+ * probably more efficient to use H5VM_stride_fill() instead.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -780,17 +770,17 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss
#ifdef LATER
/*-------------------------------------------------------------------------
- * Function: H5VM__stride_copy2
+ * Function: H5VM__stride_copy2
*
- * Purpose: Similar to H5VM_stride_copy() except the source and
- * destination each have their own dimensionality and size and
- * we copy exactly NELMTS elements each of size ELMT_SIZE. The
- * size counters wrap if NELMTS is more than a size counter.
+ * Purpose: Similar to H5VM_stride_copy() except the source and
+ * destination each have their own dimensionality and size and
+ * we copy exactly NELMTS elements each of size ELMT_SIZE. The
+ * size counters wrap if NELMTS is more than a size counter.
*
- * Return: None
+ * Return: void
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -852,16 +842,16 @@ H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size,
#endif /* LATER */
/*-------------------------------------------------------------------------
- * Function: H5VM_array_fill
+ * Function: H5VM_array_fill
*
- * Purpose: Fills all bytes of an array with the same value using
- * memset(). Increases amount copied by power of two until the
- * halfway point is crossed, then copies the rest in one swoop.
+ * Purpose: Fills all bytes of an array with the same value using
+ * memset(). Increases amount copied by power of two until the
+ * halfway point is crossed, then copies the rest in one swoop.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, June 18, 1998
+ * Programmer: Quincey Koziol
+ * Thursday, June 18, 1998
*
*-------------------------------------------------------------------------
*/
@@ -904,25 +894,25 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
} /* H5VM_array_fill() */
/*-------------------------------------------------------------------------
- * Function: H5VM_array_down
+ * Function: H5VM_array_down
*
- * Purpose: Given a set of dimension sizes, calculate the size of each
+ * Purpose: Given a set of dimension sizes, calculate the size of each
* "down" slice. This is the size of the dimensions for all the
* dimensions below the current one, which is used for indexing
* offsets in this dimension.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: void
*
- * Programmer: Quincey Koziol
- * Monday, April 28, 2003
+ * Programmer: Quincey Koziol
+ * Monday, April 28, 2003
*
*-------------------------------------------------------------------------
*/
-herr_t
+void
H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down)
{
- hsize_t acc; /*accumulator */
- int i; /*counter */
+ hsize_t acc; /* Accumulator */
+ int i; /* Counter */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -930,31 +920,31 @@ H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down)
HDassert(total_size);
HDassert(down);
- /* Build the sizes of each dimension in the array */
- /* (From fastest to slowest) */
+ /* Build the sizes of each dimension in the array
+ * (From fastest to slowest)
+ */
for (i = (int)(n - 1), acc = 1; i >= 0; i--) {
down[i] = acc;
acc *= total_size[i];
- } /* end for */
+ }
- FUNC_LEAVE_NOAPI(SUCCEED)
+ FUNC_LEAVE_NOAPI_VOID
} /* end H5VM_array_down() */
/*-------------------------------------------------------------------------
* Function: H5VM_array_offset_pre
*
- * Purpose: Given a coordinate description of a location in an array, this
- * function returns the byte offset of the coordinate.
+ * Purpose: Given a coordinate description of a location in an array, this
+ * function returns the byte offset of the coordinate.
*
- * The dimensionality of the whole array, and the offset is N.
+ * The dimensionality of the whole array, and the offset is N.
* The whole array dimensions are TOTAL_SIZE and the coordinate
* is at offset OFFSET.
*
- * Return: Success: Byte offset from beginning of array to element offset
- * Failure: abort() -- should never fail
+ * Return: Byte offset from beginning of array to element offset
*
* Programmer: Quincey Koziol
- * Tuesday, June 22, 1999
+ * Tuesday, June 22, 1999
*
*-------------------------------------------------------------------------
*/
@@ -980,18 +970,17 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset)
/*-------------------------------------------------------------------------
* Function: H5VM_array_offset
*
- * Purpose: Given a coordinate description of a location in an array, this
- * function returns the byte offset of the coordinate.
+ * Purpose: Given a coordinate description of a location in an array,
+ * this function returns the byte offset of the coordinate.
*
- * The dimensionality of the whole array, and the offset is N.
+ * The dimensionality of the whole array, and the offset is N.
* The whole array dimensions are TOTAL_SIZE and the coordinate
* is at offset OFFSET.
*
- * Return: Success: Byte offset from beginning of array to element offset
- * Failure: abort() -- should never fail
+ * Return: Byte offset from beginning of array to element offset
*
* Programmer: Quincey Koziol
- * Tuesday, June 22, 1999
+ * Tuesday, June 22, 1999
*
*-------------------------------------------------------------------------
*/
@@ -1001,38 +990,36 @@ H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset)
hsize_t acc_arr[H5VM_HYPER_NDIMS]; /* Accumulated size of down dimensions */
hsize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI((HDabort(), 0)) /*lint !e527 Don't worry about unreachable statement */
+ FUNC_ENTER_NOAPI_NOERR
HDassert(n <= H5VM_HYPER_NDIMS);
HDassert(total_size);
HDassert(offset);
/* Build the sizes of each dimension in the array */
- if (H5VM_array_down(n, total_size, acc_arr) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, UFAIL, "can't compute down sizes")
+ H5VM_array_down(n, total_size, acc_arr);
/* Set return value */
ret_value = H5VM_array_offset_pre(n, acc_arr, offset);
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VM_array_offset() */
/*-------------------------------------------------------------------------
* Function: H5VM_array_calc_pre
*
- * Purpose: Given a linear offset in an array, the dimensions of that
+ * Purpose: Given a linear offset in an array, the dimensions of that
* array and the pre-computed 'down' (accumulator) sizes, this
* function computes the coordinates of that offset in the array.
*
- * The dimensionality of the whole array, and the coordinates is N.
+ * The dimensionality of the whole array, and the coordinates is N.
* The array dimensions are TOTAL_SIZE and the coordinates
* are returned in COORD. The linear offset is in OFFSET.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, July 16, 2009
+ * Programmer: Quincey Koziol
+ * Thursday, July 16, 2009
*
*-------------------------------------------------------------------------
*/
@@ -1059,18 +1046,18 @@ H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *co
/*-------------------------------------------------------------------------
* Function: H5VM_array_calc
*
- * Purpose: Given a linear offset in an array and the dimensions of that
+ * Purpose: Given a linear offset in an array and the dimensions of that
* array, this function computes the coordinates of that offset
* in the array.
*
- * The dimensionality of the whole array, and the coordinates is N.
+ * The dimensionality of the whole array, and the coordinates is N.
* The array dimensions are TOTAL_SIZE and the coordinates
* are returned in COORD. The linear offset is in OFFSET.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Wednesday, April 16, 2003
+ * Programmer: Quincey Koziol
+ * Wednesday, April 16, 2003
*
*-------------------------------------------------------------------------
*/
@@ -1088,8 +1075,7 @@ H5VM_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t *
HDassert(coords);
/* Build the sizes of each dimension in the array */
- if (H5VM_array_down(n, total_size, idx) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute down sizes")
+ H5VM_array_down(n, total_size, idx);
/* Compute the coordinates from the offset */
if (H5VM_array_calc_pre(offset, n, idx, coords) < 0)
@@ -1102,7 +1088,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VM_chunk_index
*
- * Purpose: Given a coordinate offset (COORD), the size of each chunk
+ * Purpose: Given a coordinate offset (COORD), the size of each chunk
* (CHUNK), the number of chunks in each dimension (NCHUNKS)
* and the number of dimensions of all of these (NDIMS), calculate
* a "chunk index" for the chunk that the coordinate offset is
@@ -1132,10 +1118,10 @@ done:
* The chunk index is placed in the CHUNK_IDX location for return
* from this function
*
- * Return: Chunk index on success (can't fail)
+ * Return: Chunk index on success (can't fail)
*
- * Programmer: Quincey Koziol
- * Monday, April 21, 2003
+ * Programmer: Quincey Koziol
+ * Monday, April 21, 2003
*
*-------------------------------------------------------------------------
*/
@@ -1160,14 +1146,14 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, co
} /* end H5VM_chunk_index() */
/*-------------------------------------------------------------------------
- * Function: H5VM_chunk_scaled
+ * Function: H5VM_chunk_scaled
*
- * Purpose: Compute the scaled coordinates for a chunk offset
+ * Purpose: Compute the scaled coordinates for a chunk offset
*
- * Return: <none>
+ * Return: void
*
- * Programmer: Quincey Koziol
- * Wednesday, November 19, 2014
+ * Programmer: Quincey Koziol
+ * Wednesday, November 19, 2014
*
*-------------------------------------------------------------------------
*/
@@ -1195,7 +1181,7 @@ H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, h
/*-------------------------------------------------------------------------
* Function: H5VM_chunk_index_scaled
*
- * Purpose: Given a coordinate offset (COORD), the size of each chunk
+ * Purpose: Given a coordinate offset (COORD), the size of each chunk
* (CHUNK), the number of chunks in each dimension (NCHUNKS)
* and the number of dimensions of all of these (NDIMS), calculate
* a "chunk index" for the chunk that the coordinate offset is
@@ -1225,13 +1211,13 @@ H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, h
* The chunk index is placed in the CHUNK_IDX location for return
* from this function
*
- * Note: This routine is identical to H5VM_chunk_index(), except for
- * caching the scaled information. Make changes in both places.
+ * Note: This routine is identical to H5VM_chunk_index(), except for
+ * caching the scaled information. Make changes in both places.
*
- * Return: Chunk index on success (can't fail)
+ * Return: Chunk index on success (can't fail)
*
- * Programmer: Vailin Choi
- * Monday, February 9, 2015
+ * Programmer: Vailin Choi
+ * Monday, February 9, 2015
*
*-------------------------------------------------------------------------
*/
@@ -1266,22 +1252,22 @@ H5VM_chunk_index_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *ch
/*-------------------------------------------------------------------------
* Function: H5VM_opvv
*
- * Purpose: Perform an operation on a source & destination sequences
- * of offset/length pairs. Each set of sequnces has an array
- * of lengths, an array of offsets, the maximum number of
- * sequences and the current sequence to start at in the sequence.
+ * Purpose: Perform an operation on a source & destination sequences
+ * of offset/length pairs. Each set of sequnces has an array
+ * of lengths, an array of offsets, the maximum number of
+ * sequences and the current sequence to start at in the sequence.
*
* There may be different numbers of bytes in the source and
* destination sequences, the operation stops when either the
* source or destination sequence runs out of information.
*
- * Note: The algorithm in this routine is [basically] the same as for
- * H5VM_memcpyvv(). Changes should be made to both!
+ * Note: The algorithm in this routine is [basically] the same as for
+ * H5VM_memcpyvv(). Changes should be made to both!
*
- * Return: Non-negative # of bytes operated on, on success/Negative on failure
+ * Return: Non-negative # of bytes operated on, on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, September 30, 2010
+ * Programmer: Quincey Koziol
+ * Thursday, September 30, 2010
*
*-------------------------------------------------------------------------
*/
@@ -1469,7 +1455,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VM_memcpyvv
*
- * Purpose: Given source and destination buffers in memory (SRC & DST)
+ * Purpose: Given source and destination buffers in memory (SRC & DST)
* copy sequences of from the source buffer into the destination
* buffer. Each set of sequences has an array of lengths, an
* array of offsets, the maximum number of sequences and the
@@ -1479,13 +1465,13 @@ done:
* destination sequences, data copying stops when either the
* source or destination buffer runs out of sequence information.
*
- * Note: The algorithm in this routine is [basically] the same as for
- * H5VM_opvv(). Changes should be made to both!
+ * Note: The algorithm in this routine is [basically] the same as for
+ * H5VM_opvv(). Changes should be made to both!
*
- * Return: Non-negative # of bytes copied on success/Negative on failure
+ * Return: Non-negative # of bytes copied on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Friday, May 2, 2003
+ * Programmer: Quincey Koziol
+ * Friday, May 2, 2003
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h
index 2fea2fc..0d3bd0f 100644
--- a/src/H5VMprivate.h
+++ b/src/H5VMprivate.h
@@ -105,7 +105,7 @@ H5_DLL herr_t H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *_
const hssize_t *dst_stride, void *_dst, const hssize_t *src_stride,
const void *_src);
H5_DLL herr_t H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count);
-H5_DLL herr_t H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down);
+H5_DLL void H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down);
H5_DLL hsize_t H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset);
H5_DLL hsize_t H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset);
H5_DLL herr_t H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *coords);
diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c
index d8fed41..d29d8e5 100644
--- a/src/H5Zdeflate.c
+++ b/src/H5Zdeflate.c
@@ -48,7 +48,7 @@ const H5Z_class2_t H5Z_DEFLATE[1] = {{
H5Z__filter_deflate, /* The actual filter function */
}};
-#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * (double)1.001f) + 12)
+#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12)
/*-------------------------------------------------------------------------
* Function: H5Z__filter_deflate
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 25acc05..97678b0 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -1116,7 +1116,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu
unsigned filavail; /* flag indicating if fill value is defined or not */
H5Z_SO_scale_type_t scale_type = H5Z_SO_FLOAT_DSCALE; /* scale type */
int scale_factor = 0; /* scale factor */
- double D_val = 0.0f; /* decimal scale factor */
+ double D_val = 0.0; /* decimal scale factor */
uint32_t minbits = 0; /* minimum number of bits to store values */
unsigned long long minval = 0; /* minimum value of input buffer */
enum H5Z_scaleoffset_t type; /* memory type corresponding to dataset datatype */
diff --git a/src/H5private.h b/src/H5private.h
index fc213e5..6100b6d 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -360,7 +360,6 @@
*/
#define SUCCEED 0
#define FAIL (-1)
-#define UFAIL (unsigned)(-1)
/* The HDF5 library uses the symbol `ERR` frequently. So do
* header files for libraries such as curses(3), terminfo(3), etc.
diff --git a/src/H5timer.c b/src/H5timer.c
index ac3a01e..9af38f0 100644
--- a/src/H5timer.c
+++ b/src/H5timer.c
@@ -41,9 +41,9 @@
#define H5TIMER_TIME_STRING_LEN 1536
/* Conversion factors */
-#define H5_SEC_PER_DAY (double)(24.0F * 60.0F * 60.0F)
-#define H5_SEC_PER_HOUR (double)(60.0F * 60.0F)
-#define H5_SEC_PER_MIN (double)(60.0F)
+#define H5_SEC_PER_DAY (24.0 * 60.0 * 60.0)
+#define H5_SEC_PER_HOUR (60.0 * 60.0)
+#define H5_SEC_PER_MIN (60.0)
/******************/
/* Local Typedefs */
@@ -99,13 +99,13 @@ H5_bandwidth(char *buf /*out*/, double nbytes, double nseconds)
{
double bw;
- if (nseconds <= (double)0.0F)
+ if (nseconds <= 0.0)
HDstrcpy(buf, " NaN");
else {
bw = nbytes / nseconds;
- if (H5_DBL_ABS_EQUAL(bw, (double)0.0F))
+ if (H5_DBL_ABS_EQUAL(bw, 0.0))
HDstrcpy(buf, "0.000 B/s");
- else if (bw < (double)1.0F)
+ else if (bw < 1.0)
HDsprintf(buf, "%10.4e", bw);
else if (bw < (double)H5_KB) {
HDsprintf(buf, "%05.4f", bw);
@@ -223,7 +223,7 @@ H5_now_usec(void)
double
H5_get_time(void)
{
- double ret_value = (double)0.0f;
+ double ret_value = 0.0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -232,14 +232,14 @@ H5_get_time(void)
struct timespec ts;
HDclock_gettime(CLOCK_MONOTONIC, &ts);
- ret_value = (double)ts.tv_sec + ((double)ts.tv_nsec / (double)1000000000.0f);
+ ret_value = (double)ts.tv_sec + ((double)ts.tv_nsec / 1000000000.0);
}
#elif defined(H5_HAVE_GETTIMEOFDAY)
{
struct timeval now_tv;
HDgettimeofday(&now_tv, NULL);
- ret_value = (double)now_tv.tv_sec + ((double)now_tv.tv_usec / (double)1000000.0f);
+ ret_value = (double)now_tv.tv_sec + ((double)now_tv.tv_usec / 1000000.0);
}
#else
ret_value = (double)HDtime(NULL);
@@ -288,8 +288,8 @@ H5__timer_get_timevals(H5_timevals_t *times /*in,out*/)
if (HDgetrusage(RUSAGE_SELF, &res) < 0)
return -1;
- times->system = (double)res.ru_stime.tv_sec + ((double)res.ru_stime.tv_usec / (double)1.0E6F);
- times->user = (double)res.ru_utime.tv_sec + ((double)res.ru_utime.tv_usec / (double)1.0E6F);
+ times->system = (double)res.ru_stime.tv_sec + ((double)res.ru_stime.tv_usec / 1.0E6);
+ times->user = (double)res.ru_utime.tv_sec + ((double)res.ru_utime.tv_usec / 1.0E6);
}
#else
/* No suitable way to get system/user times */
@@ -588,7 +588,7 @@ H5_timer_get_time_string(double seconds)
double remainder_sec = 0.0;
/* Extract larger time units from count of seconds */
- if (seconds > (double)60.0F) {
+ if (seconds > 60.0) {
/* Set initial # of seconds */
remainder_sec = seconds;
@@ -616,19 +616,19 @@ H5_timer_get_time_string(double seconds)
* time unit. Perhaps this could be passed as an integer.
* (name? round_up_size? ?)
*/
- if (seconds < (double)0.0F)
+ if (seconds < 0.0)
HDsprintf(s, "N/A");
- else if (H5_DBL_ABS_EQUAL((double)0.0F, seconds))
+ else if (H5_DBL_ABS_EQUAL(0.0, seconds))
HDsprintf(s, "0.0 s");
- else if (seconds < (double)1.0E-6F)
+ else if (seconds < 1.0E-6)
/* t < 1 us, Print time in ns */
- HDsprintf(s, "%.f ns", seconds * (double)1.0E9F);
- else if (seconds < (double)1.0E-3F)
+ HDsprintf(s, "%.f ns", seconds * 1.0E9);
+ else if (seconds < 1.0E-3)
/* t < 1 ms, Print time in us */
- HDsprintf(s, "%.1f us", seconds * (double)1.0E6F);
- else if (seconds < (double)1.0F)
+ HDsprintf(s, "%.1f us", seconds * 1.0E6);
+ else if (seconds < 1.0)
/* t < 1 s, Print time in ms */
- HDsprintf(s, "%.1f ms", seconds * (double)1.0E3F);
+ HDsprintf(s, "%.1f ms", seconds * 1.0E3);
else if (seconds < H5_SEC_PER_MIN)
/* t < 1 m, Print time in s */
HDsprintf(s, "%.2f s", seconds);
diff --git a/src/H5trace.c b/src/H5trace.c
index a70a9e2..1565a86 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -2676,5 +2676,5 @@ error:
if (H5_debug_g.ttimes)
return function_times.elapsed;
else
- return (double)0.0F;
+ return 0.0;
} /* end H5_trace() */