summaryrefslogtreecommitdiffstats
path: root/src/H5Dlayout.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-03-25 00:39:37 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-03-25 00:39:37 (GMT)
commitfeb20aac304b39e18c70f88cae2f7cf7d5c82db2 (patch)
treee15d7e751af4e3c42e77ea955d91db4cf27a71cf /src/H5Dlayout.c
parentbdac2ecdbff2c389a222b3d93ff1eb1d23ec6b23 (diff)
downloadhdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.zip
hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.gz
hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.bz2
Formats the source and updates the gcc warning pragmas
Diffstat (limited to 'src/H5Dlayout.c')
-rw-r--r--src/H5Dlayout.c303
1 files changed, 145 insertions, 158 deletions
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 679a33b..160f9f5 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -15,58 +15,49 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5HLprivate.h" /* Local heaps */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5HLprivate.h" /* Local heaps */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
/* Format version bounds for layout */
const unsigned H5O_layout_ver_bounds[] = {
- H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */
- H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */
- H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V110 */
- H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V112 */
- H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
+ H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */
+ H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V110 */
+ H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V112 */
+ H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_set_io_ops
*
@@ -83,7 +74,7 @@ const unsigned H5O_layout_ver_bounds[] = {
herr_t
H5D__layout_set_io_ops(const H5D_t *dataset)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -91,9 +82,9 @@ H5D__layout_set_io_ops(const H5D_t *dataset)
HDassert(dataset);
/* Set the I/O functions for each layout type */
- switch(dataset->shared->layout.type) {
+ switch (dataset->shared->layout.type) {
case H5D_CONTIGUOUS:
- if(dataset->shared->dcpl_cache.efl.nused > 0)
+ if (dataset->shared->dcpl_cache.efl.nused > 0)
dataset->shared->layout.ops = H5D_LOPS_EFL;
else
dataset->shared->layout.ops = H5D_LOPS_CONTIG;
@@ -103,7 +94,7 @@ H5D__layout_set_io_ops(const H5D_t *dataset)
dataset->shared->layout.ops = H5D_LOPS_CHUNK;
/* Set the chunk operations */
- switch(dataset->shared->layout.u.chunk.idx_type) {
+ switch (dataset->shared->layout.u.chunk.idx_type) {
case H5D_CHUNK_IDX_BTREE:
dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_BTREE;
break;
@@ -153,7 +144,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_set_io_ops() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_meta_size
*
@@ -172,7 +162,7 @@ done:
size_t
H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t include_compact_data)
{
- size_t ret_value = 0; /* Return value */
+ size_t ret_value = 0; /* Return value */
FUNC_ENTER_PACKAGE
@@ -180,32 +170,32 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
HDassert(f);
HDassert(layout);
- ret_value = 1 + /* Version number */
- 1; /* layout class type */
+ ret_value = 1 + /* Version number */
+ 1; /* layout class type */
- switch(layout->type) {
+ switch (layout->type) {
case H5D_COMPACT:
/* This information only present in older versions of message */
/* Size of raw data */
ret_value += 2;
- if(include_compact_data)
+ if (include_compact_data)
ret_value += layout->storage.u.compact.size; /* data for compact dataset */
break;
case H5D_CONTIGUOUS:
/* This information only present in older versions of message */
- ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
- ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */
+ ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
+ ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */
break;
case H5D_CHUNKED:
- if(layout->version < H5O_LAYOUT_VERSION_4) {
+ if (layout->version < H5O_LAYOUT_VERSION_4) {
/* Number of dimensions (1 byte) */
HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
ret_value++;
/* B-tree address */
- ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
+ ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
/* Dimension sizes */
ret_value += layout->u.chunk.ndims * 4;
@@ -228,9 +218,10 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
/* Type of chunk index */
ret_value++;
- switch(layout->u.chunk.idx_type) {
+ switch (layout->u.chunk.idx_type) {
case H5D_CHUNK_IDX_BTREE:
- HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, 0, "v1 B-tree index type found for layout message >v3")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, 0,
+ "v1 B-tree index type found for layout message >v3")
case H5D_CHUNK_IDX_NONE:
/* nothing */
@@ -238,10 +229,10 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
case H5D_CHUNK_IDX_SINGLE:
/* Possible filter information */
- if(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
- ret_value += H5F_SIZEOF_SIZE(f); /* Size of chunk (in file) */
- ret_value += 4; /* Filter mask for chunk */
- } /* end if */
+ if (layout->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
+ ret_value += H5F_SIZEOF_SIZE(f); /* Size of chunk (in file) */
+ ret_value += 4; /* Filter mask for chunk */
+ } /* end if */
break;
case H5D_CHUNK_IDX_FARRAY:
@@ -270,8 +261,8 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
break;
case H5D_VIRTUAL:
- ret_value += H5F_SIZEOF_ADDR(f); /* Address of global heap */
- ret_value += 4; /* Global heap index */
+ ret_value += H5F_SIZEOF_ADDR(f); /* Address of global heap */
+ ret_value += 4; /* Global heap index */
break;
case H5D_LAYOUT_ERROR:
@@ -284,7 +275,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_meta_size() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_set_version
*
@@ -299,8 +289,8 @@ done:
herr_t
H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout)
{
- unsigned version; /* Message version */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -312,7 +302,7 @@ H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout)
version = MAX(layout->version, H5O_layout_ver_bounds[H5F_LOW_BOUND(f)]);
/* Version bounds check */
- if(version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(f)])
+ if (version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(f)])
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "layout version out of bounds")
/* Set the message version */
@@ -322,7 +312,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_set_version() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_set_latest_indexing
*
@@ -336,10 +325,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space,
- const H5D_dcpl_cache_t *dcpl_cache)
+H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, const H5D_dcpl_cache_t *dcpl_cache)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -349,104 +337,104 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space,
HDassert(dcpl_cache);
/* The indexing methods only apply to chunked datasets (currently) */
- if(layout->type == H5D_CHUNKED) {
- int sndims; /* Rank of dataspace */
- unsigned ndims; /* Rank of dataspace */
+ if (layout->type == H5D_CHUNKED) {
+ int sndims; /* Rank of dataspace */
+ unsigned ndims; /* Rank of dataspace */
/* Query the dimensionality of the dataspace */
- if((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0)
+ if ((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "invalid dataspace rank")
ndims = (unsigned)sndims;
/* Avoid scalar/null dataspace */
- if(ndims > 0) {
- hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum dimension sizes */
- hsize_t cur_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */
- unsigned unlim_count = 0; /* Count of unlimited max. dimensions */
- hbool_t single = TRUE; /* Fulfill single chunk indexing */
- unsigned u; /* Local index variable */
+ if (ndims > 0) {
+ hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum dimension sizes */
+ hsize_t cur_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */
+ unsigned unlim_count = 0; /* Count of unlimited max. dimensions */
+ hbool_t single = TRUE; /* Fulfill single chunk indexing */
+ unsigned u; /* Local index variable */
/* Query the dataspace's dimensions */
- if(H5S_get_simple_extent_dims(space, cur_dims, max_dims) < 0)
+ if (H5S_get_simple_extent_dims(space, cur_dims, max_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace max. dimensions")
/* Spin through the max. dimensions, looking for unlimited dimensions */
- for(u = 0; u < ndims; u++) {
- if(max_dims[u] == H5S_UNLIMITED)
+ for (u = 0; u < ndims; u++) {
+ if (max_dims[u] == H5S_UNLIMITED)
unlim_count++;
- if(cur_dims[u] != max_dims[u] || cur_dims[u] != layout->u.chunk.dim[u])
+ if (cur_dims[u] != max_dims[u] || cur_dims[u] != layout->u.chunk.dim[u])
single = FALSE;
} /* end for */
/* Chunked datasets with unlimited dimension(s) */
- if(unlim_count) { /* dataset with unlimited dimension(s) must be chunked */
- if(1 == unlim_count) { /* Chunked dataset with only 1 unlimited dimension */
+ if (unlim_count) { /* dataset with unlimited dimension(s) must be chunked */
+ if (1 == unlim_count) { /* Chunked dataset with only 1 unlimited dimension */
/* Set the chunk index type to an extensible array */
- layout->u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY;
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY;
layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY;
- layout->storage.u.chunk.ops = H5D_COPS_EARRAY;
+ layout->storage.u.chunk.ops = H5D_COPS_EARRAY;
/* Set the extensible array creation parameters */
/* (use hard-coded defaults for now, until we give applications
* control over this with a property list - QAK)
*/
- layout->u.chunk.u.earray.cparam.max_nelmts_bits = H5D_EARRAY_MAX_NELMTS_BITS;
- layout->u.chunk.u.earray.cparam.idx_blk_elmts = H5D_EARRAY_IDX_BLK_ELMTS;
+ layout->u.chunk.u.earray.cparam.max_nelmts_bits = H5D_EARRAY_MAX_NELMTS_BITS;
+ layout->u.chunk.u.earray.cparam.idx_blk_elmts = H5D_EARRAY_IDX_BLK_ELMTS;
layout->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs = H5D_EARRAY_SUP_BLK_MIN_DATA_PTRS;
- layout->u.chunk.u.earray.cparam.data_blk_min_elmts = H5D_EARRAY_DATA_BLK_MIN_ELMTS;
- layout->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits = H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS;
- } /* end if */
+ layout->u.chunk.u.earray.cparam.data_blk_min_elmts = H5D_EARRAY_DATA_BLK_MIN_ELMTS;
+ layout->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits =
+ H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS;
+ } /* end if */
else { /* Chunked dataset with > 1 unlimited dimensions */
/* Set the chunk index type to v2 B-tree */
- layout->u.chunk.idx_type = H5D_CHUNK_IDX_BT2;
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_BT2;
layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BT2;
- layout->storage.u.chunk.ops = H5D_COPS_BT2;
+ layout->storage.u.chunk.ops = H5D_COPS_BT2;
/* Set the v2 B-tree creation parameters */
/* (use hard-coded defaults for now, until we give applications
* control over this with a property list - QAK)
*/
- layout->u.chunk.u.btree2.cparam.node_size = H5D_BT2_NODE_SIZE;
+ layout->u.chunk.u.btree2.cparam.node_size = H5D_BT2_NODE_SIZE;
layout->u.chunk.u.btree2.cparam.split_percent = H5D_BT2_SPLIT_PERC;
- layout->u.chunk.u.btree2.cparam.merge_percent = H5D_BT2_MERGE_PERC;
- } /* end else */
- } /* end if */
- else { /* Chunked dataset with fixed dimensions */
+ layout->u.chunk.u.btree2.cparam.merge_percent = H5D_BT2_MERGE_PERC;
+ } /* end else */
+ } /* end if */
+ else { /* Chunked dataset with fixed dimensions */
/* Check for correct condition for using "single chunk" chunk index */
- if(single) {
- layout->u.chunk.idx_type = H5D_CHUNK_IDX_SINGLE;
+ if (single) {
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_SINGLE;
layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_SINGLE;
- layout->storage.u.chunk.ops = H5D_COPS_SINGLE;
+ layout->storage.u.chunk.ops = H5D_COPS_SINGLE;
} /* end if */
- else if(!dcpl_cache->pline.nused &&
- dcpl_cache->fill.alloc_time == H5D_ALLOC_TIME_EARLY) {
+ else if (!dcpl_cache->pline.nused && dcpl_cache->fill.alloc_time == H5D_ALLOC_TIME_EARLY) {
/* Set the chunk index type to "none" Index */
- layout->u.chunk.idx_type = H5D_CHUNK_IDX_NONE;
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_NONE;
layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_NONE;
- layout->storage.u.chunk.ops = H5D_COPS_NONE;
+ layout->storage.u.chunk.ops = H5D_COPS_NONE;
} /* end else-if */
else {
/* Set the chunk index type to Fixed Array */
- layout->u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
- layout->storage.u.chunk.ops = H5D_COPS_FARRAY;
+ layout->storage.u.chunk.ops = H5D_COPS_FARRAY;
/* Set the fixed array creation parameters */
/* (use hard-coded defaults for now, until we give applications
* control over this with a property list - QAK)
*/
- layout->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits = H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS;
+ layout->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits =
+ H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS;
} /* end else */
- } /* end else */
- } /* end if */
- } /* end if */
+ } /* end else */
+ } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_set_latest_indexing() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_oh_create
*
@@ -463,11 +451,11 @@ done:
herr_t
H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
{
- H5O_layout_t *layout; /* Dataset's layout information */
- const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
- unsigned layout_mesg_flags; /* Flags for inserting layout message */
- hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_layout_t * layout; /* Dataset's layout information */
+ const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
+ unsigned layout_mesg_flags; /* Flags for inserting layout message */
+ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -477,20 +465,21 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
HDassert(dset);
/* Set some local variables, for convenience */
- layout = &dset->shared->layout;
+ layout = &dset->shared->layout;
fill_prop = &dset->shared->dcpl_cache.fill;
/* Update the filters message, if this is a chunked dataset */
- if(layout->type == H5D_CHUNKED) {
- H5O_pline_t *pline; /* Dataset's I/O pipeline information */
+ if (layout->type == H5D_CHUNKED) {
+ H5O_pline_t *pline; /* Dataset's I/O pipeline information */
pline = &dset->shared->dcpl_cache.pline;
- if(pline->nused > 0 && H5O_msg_append_oh(file, oh, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, pline) < 0)
+ if (pline->nused > 0 &&
+ H5O_msg_append_oh(file, oh, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message")
} /* end if */
/* Initialize the layout information for the new dataset */
- if(dset->shared->layout.ops->init && (dset->shared->layout.ops->init)(file, dset, dapl_id) < 0)
+ if (dset->shared->layout.ops->init && (dset->shared->layout.ops->init)(file, dset, dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information")
/* Indicate that the layout information was initialized */
@@ -500,46 +489,46 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
* Allocate storage if space allocate time is early; otherwise delay
* allocation until later.
*/
- if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY) {
+ if (fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY) {
H5D_io_info_t io_info;
io_info.dset = dset;
- if(H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0)
+ if (H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
}
/* Update external storage message, if it's used */
- if(dset->shared->dcpl_cache.efl.nused > 0) {
+ if (dset->shared->dcpl_cache.efl.nused > 0) {
H5O_efl_t *efl = &dset->shared->dcpl_cache.efl; /* Dataset's external file list */
- H5HL_t *heap; /* Pointer to local heap for EFL file names */
- size_t heap_size = H5HL_ALIGN(1);
- size_t u;
+ H5HL_t * heap; /* Pointer to local heap for EFL file names */
+ size_t heap_size = H5HL_ALIGN(1);
+ size_t u;
/* Determine size of heap needed to stored the file names */
- for(u = 0; u < efl->nused; ++u)
+ for (u = 0; u < efl->nused; ++u)
heap_size += H5HL_ALIGN(HDstrlen(efl->slot[u].name) + 1);
/* Create the heap for the EFL file names */
- if(H5HL_create(file, heap_size, &efl->heap_addr/*out*/) < 0)
+ if (H5HL_create(file, heap_size, &efl->heap_addr /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create EFL file name heap")
/* Pin the heap down in memory */
- if(NULL == (heap = H5HL_protect(file, efl->heap_addr, H5AC__NO_FLAGS_SET)))
+ if (NULL == (heap = H5HL_protect(file, efl->heap_addr, H5AC__NO_FLAGS_SET)))
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 (UFAIL == H5HL_insert(file, heap, (size_t)1, "")) {
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 */
+ 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 (UFAIL ==
+ (offset = H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
} /* end if */
@@ -549,12 +538,12 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
} /* end for */
/* Release the heap */
- if(H5HL_unprotect(heap) < 0)
+ if (H5HL_unprotect(heap) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to unprotect EFL file name heap")
heap = NULL;
/* Insert EFL message into dataset object header */
- if(H5O_msg_append_oh(file, oh, H5O_EFL_ID, H5O_MSG_FLAG_CONSTANT, 0, efl) < 0)
+ if (H5O_msg_append_oh(file, oh, H5O_EFL_ID, H5O_MSG_FLAG_CONSTANT, 0, efl) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message")
} /* end if */
@@ -562,34 +551,32 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
/* (Don't make layout message constant unless allocation time is early and
* non-filtered and has >0 elements, since space may not be allocated -QAK) */
/* (Note: this is relying on H5D__alloc_storage not calling H5O_msg_write during dataset creation) */
- if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type
- && !dset->shared->dcpl_cache.pline.nused
- && (0 != H5S_GET_EXTENT_NPOINTS(dset->shared->space)))
+ if (fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type &&
+ !dset->shared->dcpl_cache.pline.nused && (0 != H5S_GET_EXTENT_NPOINTS(dset->shared->space)))
layout_mesg_flags = H5O_MSG_FLAG_CONSTANT;
else
- layout_mesg_flags = 0;
+ layout_mesg_flags = 0;
/* Store VDS info in global heap */
- if(H5D_VIRTUAL == layout->type)
- if(H5D__virtual_store_layout(file, layout) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to store VDS info")
+ if (H5D_VIRTUAL == layout->type)
+ if (H5D__virtual_store_layout(file, layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to store VDS info")
/* Create layout message */
- if(H5O_msg_append_oh(file, oh, H5O_LAYOUT_ID, layout_mesg_flags, 0, layout) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
+ if (H5O_msg_append_oh(file, oh, H5O_LAYOUT_ID, layout_mesg_flags, 0, layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
done:
/* Error cleanup */
- if(ret_value < 0)
- if(layout_init)
+ if (ret_value < 0)
+ if (layout_init)
/* Destroy any cached layout information for the dataset */
- if(dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset) < 0)
+ if (dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__layout_oh_create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_oh_read
*
@@ -606,9 +593,9 @@ done:
herr_t
H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist)
{
- htri_t msg_exists; /* Whether a particular type of message exists */
- hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t msg_exists; /* Whether a particular type of message exists */
+ hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -617,15 +604,15 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist)
HDassert(plist);
/* Get the optional filters message */
- if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_PLINE_ID)) < 0)
+ if ((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_PLINE_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
- if(msg_exists) {
+ if (msg_exists) {
/* Retrieve the I/O pipeline message */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline))
+ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message")
/* Set the I/O pipeline info in the property list */
- if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &dataset->shared->dcpl_cache.pline) < 0)
+ if (H5P_set(plist, H5O_CRT_PIPELINE_NAME, &dataset->shared->dcpl_cache.pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set pipeline")
} /* end if */
@@ -635,20 +622,20 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist)
* values are copied to the dataset create plist so the user can query
* them.
*/
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout)))
+ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message")
layout_copied = TRUE;
/* Check for external file list message (which might not exist) */
- if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_EFL_ID)) < 0)
+ if ((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_EFL_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
- if(msg_exists) {
+ if (msg_exists) {
/* Retrieve the EFL message */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, &dataset->shared->dcpl_cache.efl))
+ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, &dataset->shared->dcpl_cache.efl))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message")
/* Set the EFL info in the property list */
- if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->shared->dcpl_cache.efl) < 0)
+ if (H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->shared->dcpl_cache.efl) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set external file list")
/* Set the dataset's I/O operations */
@@ -659,31 +646,31 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist)
HDassert(dataset->shared->layout.ops);
/* Initialize the layout information for the dataset */
- if(dataset->shared->layout.ops->init && (dataset->shared->layout.ops->init)(dataset->oloc.file, dataset, dapl_id) < 0)
+ if (dataset->shared->layout.ops->init &&
+ (dataset->shared->layout.ops->init)(dataset->oloc.file, dataset, dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information")
/* Adjust chunk dimensions to omit datatype size (in last dimension) for creation property */
- if(H5D_CHUNKED == dataset->shared->layout.type)
+ if (H5D_CHUNKED == dataset->shared->layout.type)
dataset->shared->layout.u.chunk.ndims--;
/* Copy layout to the DCPL */
- if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout) < 0)
+ if (H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout")
/* Set chunk sizes */
- if(H5D_CHUNKED == dataset->shared->layout.type)
- if(H5D__chunk_set_sizes(dataset) < 0)
+ if (H5D_CHUNKED == dataset->shared->layout.type)
+ if (H5D__chunk_set_sizes(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes")
done:
- if(ret_value < 0 && layout_copied)
- if(H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0)
+ if (ret_value < 0 && layout_copied)
+ if (H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_oh_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_oh_write
*
@@ -700,8 +687,8 @@ done:
herr_t
H5D__layout_oh_write(const H5D_t *dataset, H5O_t *oh, unsigned update_flags)
{
- htri_t msg_exists; /* Whether the layout message exists */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t msg_exists; /* Whether the layout message exists */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -710,15 +697,15 @@ H5D__layout_oh_write(const H5D_t *dataset, H5O_t *oh, unsigned update_flags)
HDassert(oh);
/* Check if the layout message has been added to the dataset's header */
- if((msg_exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0)
+ if ((msg_exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to check if layout message exists")
- if(msg_exists) {
+ if (msg_exists) {
/* Write the layout message to the dataset's header */
- if(H5O_msg_write_oh(dataset->oloc.file, oh, H5O_LAYOUT_ID, 0, update_flags, &dataset->shared->layout) < 0)
+ if (H5O_msg_write_oh(dataset->oloc.file, oh, H5O_LAYOUT_ID, 0, update_flags,
+ &dataset->shared->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout message")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_oh_write() */
-