summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5D.c35
-rw-r--r--test/fillval.c14
2 files changed, 24 insertions, 25 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 9f5ee19..dbd2315 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -2495,25 +2495,24 @@ H5D_init_storage(H5D_t *dset, hbool_t full_overwrite, hid_t dxpl_id)
switch (dset->shared->layout.type) {
case H5D_COMPACT:
- {
- hssize_t snpoints; /* Number of points in space (for error checking) */
- size_t npoints; /* Number of points in space */
-
- /* Get the number of elements in the dataset's dataspace */
- snpoints = H5S_GET_EXTENT_NPOINTS(dset->shared->space);
- HDassert(snpoints >= 0);
- H5_ASSIGN_OVERFLOW(npoints, snpoints, hssize_t, size_t);
-
- /* If we will be immediately overwriting the values, don't bother to clear them */
- if(!full_overwrite) {
- /* If the fill value is defined, initialize the data buffer with it */
- if(dset->shared->dcpl_cache.fill.buf)
- /* Initialize the cached data buffer with the fill value */
- H5V_array_fill(dset->shared->layout.u.compact.buf, dset->shared->dcpl_cache.fill.buf, (size_t)dset->shared->dcpl_cache.fill.size, npoints);
- else /* If the fill value is default, zero set data buf. */
- HDmemset(dset->shared->layout.u.compact.buf, 0, dset->shared->layout.u.compact.size);
+ /* If we will be immediately overwriting the values, don't bother to clear them */
+ if(!full_overwrite) {
+ /* If the fill value is defined, initialize the data buffer with it */
+ if(dset->shared->dcpl_cache.fill.buf) {
+ hssize_t snpoints; /* Number of points in space (for error checking) */
+ size_t npoints; /* Number of points in space */
+
+ /* Get the number of elements in the dataset's dataspace */
+ snpoints = H5S_GET_EXTENT_NPOINTS(dset->shared->space);
+ HDassert(snpoints >= 0);
+ H5_ASSIGN_OVERFLOW(npoints, snpoints, hssize_t, size_t);
+
+ /* Initialize the cached data buffer with the fill value */
+ H5V_array_fill(dset->shared->layout.u.compact.buf, dset->shared->dcpl_cache.fill.buf, (size_t)dset->shared->dcpl_cache.fill.size, npoints);
} /* end if */
- }
+ else /* If the fill value is default, zero set data buf. */
+ HDmemset(dset->shared->layout.u.compact.buf, 0, dset->shared->layout.u.compact.size);
+ } /* end if */
break;
case H5D_CONTIGUOUS:
diff --git a/test/fillval.c b/test/fillval.c
index a66a5fe..092a3d7 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -73,20 +73,20 @@ static hid_t create_compound_type(void)
{
hid_t ret_value=-1;
- if((ret_value = H5Tcreate(H5T_COMPOUND, sizeof(comp_datatype)))<0)
+ if((ret_value = H5Tcreate(H5T_COMPOUND, sizeof(comp_datatype))) < 0)
goto error;
- if(H5Tinsert(ret_value, "a", HOFFSET(comp_datatype,a), H5T_NATIVE_FLOAT)<0)
+ if(H5Tinsert(ret_value, "a", HOFFSET(comp_datatype, a), H5T_NATIVE_FLOAT) < 0)
goto error;
- if(H5Tinsert(ret_value, "x", HOFFSET(comp_datatype,x), H5T_NATIVE_INT)<0)
+ if(H5Tinsert(ret_value, "x", HOFFSET(comp_datatype, x), H5T_NATIVE_INT) < 0)
goto error;
- if(H5Tinsert(ret_value, "y", HOFFSET(comp_datatype,y),
- H5T_NATIVE_DOUBLE)<0) goto error;
- if(H5Tinsert(ret_value, "z", HOFFSET(comp_datatype,z), H5T_NATIVE_CHAR)<0)
+ if(H5Tinsert(ret_value, "y", HOFFSET(comp_datatype, y), H5T_NATIVE_DOUBLE) < 0)
+ goto error;
+ if(H5Tinsert(ret_value, "z", HOFFSET(comp_datatype, z), H5T_NATIVE_CHAR) < 0)
goto error;
return ret_value;
- error:
+error:
H5E_BEGIN_TRY {
H5Tclose(ret_value);
} H5E_END_TRY;