summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5AC.c2
-rw-r--r--src/H5B.c77
-rw-r--r--src/H5Bprivate.h20
-rw-r--r--src/H5D.c22
-rw-r--r--src/H5Distore.c102
-rw-r--r--src/H5Dprivate.h46
-rw-r--r--src/H5Dpublic.h2
-rw-r--r--src/H5F.c50
-rw-r--r--src/H5Farray.c62
-rw-r--r--src/H5Fcore.c165
-rw-r--r--src/H5Ffamily.c19
-rw-r--r--src/H5Fistore.c102
-rw-r--r--src/H5Flow.c643
-rw-r--r--src/H5Fprivate.h32
-rw-r--r--src/H5Fpublic.h2
-rw-r--r--src/H5Fsec2.c12
-rw-r--r--src/H5Fstdio.c22
-rw-r--r--src/H5G.c8
-rw-r--r--src/H5Gent.c4
-rw-r--r--src/H5Gnode.c44
-rw-r--r--src/H5HG.c15
-rw-r--r--src/H5HL.c25
-rw-r--r--src/H5MF.c4
-rw-r--r--src/H5MFprivate.h4
-rw-r--r--src/H5MM.c2
-rw-r--r--src/H5O.c22
-rw-r--r--src/H5Ocont.c6
-rw-r--r--src/H5Odtype.c2
-rw-r--r--src/H5Oefl.c20
-rw-r--r--src/H5Olayout.c6
-rw-r--r--src/H5Oname.c10
-rw-r--r--src/H5Oprivate.h12
-rw-r--r--src/H5Osdspace.c17
-rw-r--r--src/H5Oshared.c8
-rw-r--r--src/H5Ostab.c8
-rw-r--r--src/H5P.c44
-rw-r--r--src/H5Ppublic.h16
-rw-r--r--src/H5S.c92
-rw-r--r--src/H5Sprivate.h84
-rw-r--r--src/H5Spublic.h19
-rw-r--r--src/H5Ssimp.c161
-rw-r--r--src/H5Tconv.c11
-rw-r--r--src/H5Tpkg.h96
-rw-r--r--src/H5V.c160
-rw-r--r--src/H5Vprivate.h161
-rw-r--r--src/H5private.h11
-rw-r--r--src/H5public.h13
-rw-r--r--src/debug.c11
-rw-r--r--src/h5ls.c28
-rw-r--r--src/hdf5.h7
50 files changed, 1306 insertions, 1205 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 0b76288..b666a97 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -172,7 +172,7 @@ H5AC_dest(H5F_t *f)
*
*-------------------------------------------------------------------------
*/
-void *
+void *
H5AC_find_f(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
const void *udata1, void *udata2)
{
diff --git a/src/H5B.c b/src/H5B.c
index 86e34ac..62bb783 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -99,46 +99,45 @@
#define BOUND(MIN,X,MAX) ((X)<(MIN)?(MIN):((X)>(MAX)?(MAX):(X)))
/* PRIVATE PROTOTYPES */
-static H5B_ins_t H5B_insert_helper(H5F_t *f, const haddr_t *addr,
- const H5B_class_t *type,
- uint8 *lt_key,
- hbool_t *lt_key_changed,
- uint8 *md_key, void *udata,
- uint8 *rt_key,
- hbool_t *rt_key_changed,
- haddr_t *retval);
-static herr_t H5B_insert_child(H5F_t *f, const H5B_class_t *type,
- H5B_t *bt, intn idx,
- const haddr_t *child,
- H5B_ins_t anchor, void *md_key);
-static herr_t H5B_flush(H5F_t *f, hbool_t destroy,
- const haddr_t *addr, H5B_t *b);
-static H5B_t *H5B_load(H5F_t *f, const haddr_t *addr,
- const void *_type, void *udata);
-static herr_t H5B_decode_key(H5F_t *f, H5B_t *bt, intn idx);
-static herr_t H5B_decode_keys(H5F_t *f, H5B_t *bt, intn idx);
-static size_t H5B_nodesize(H5F_t *f, const H5B_class_t *type,
- size_t *total_nkey_size, size_t sizeof_rkey);
-static herr_t H5B_split(H5F_t *f, const H5B_class_t *type,
- H5B_t *old_bt, const haddr_t *old_addr,
- void *udata, haddr_t *new_addr /*out*/ );
+static H5B_ins_t H5B_insert_helper(H5F_t *f, const haddr_t *addr,
+ const H5B_class_t *type,
+ uint8 *lt_key,
+ hbool_t *lt_key_changed,
+ uint8 *md_key, void *udata,
+ uint8 *rt_key,
+ hbool_t *rt_key_changed,
+ haddr_t *retval);
+static herr_t H5B_insert_child(H5F_t *f, const H5B_class_t *type,
+ H5B_t *bt, intn idx,
+ const haddr_t *child,
+ H5B_ins_t anchor, void *md_key);
+static herr_t H5B_flush(H5F_t *f, hbool_t destroy,
+ const haddr_t *addr, H5B_t *b);
+static H5B_t *H5B_load(H5F_t *f, const haddr_t *addr,
+ const void *_type, void *udata);
+static herr_t H5B_decode_key(H5F_t *f, H5B_t *bt, intn idx);
+static herr_t H5B_decode_keys(H5F_t *f, H5B_t *bt, intn idx);
+static size_t H5B_nodesize(H5F_t *f, const H5B_class_t *type,
+ size_t *total_nkey_size, size_t sizeof_rkey);
+static herr_t H5B_split(H5F_t *f, const H5B_class_t *type,
+ H5B_t *old_bt, const haddr_t *old_addr,
+ void *udata, haddr_t *new_addr /*out*/ );
#ifdef H5B_DEBUG
-static herr_t H5B_assert(H5F_t *f, const haddr_t *addr,
- const H5B_class_t *type, void *udata);
+static herr_t H5B_assert(H5F_t *f, const haddr_t *addr,
+ const H5B_class_t *type, void *udata);
#endif
/* H5B inherits cache-like properties from H5AC */
-static const H5AC_class_t H5AC_BT[1] = {
- {
- H5AC_BT_ID,
- (void *(*)(H5F_t *, const haddr_t *, const void *, void *)) H5B_load,
- (herr_t (*)(H5F_t *, hbool_t, const haddr_t *, void *)) H5B_flush,
- }
-};
+static const H5AC_class_t H5AC_BT[1] = {{
+ H5AC_BT_ID,
+ (void *(*)(H5F_t*, const haddr_t*, const void*, void*))H5B_load,
+ (herr_t (*)(H5F_t*, hbool_t, const haddr_t*, void*))H5B_flush,
+}};
/* Interface initialization? */
#define INTERFACE_INIT NULL
static hbool_t interface_initialize_g = FALSE;
+
/*-------------------------------------------------------------------------
* Function: H5B_create
@@ -183,7 +182,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *retval)
*/
sizeof_rkey = (type->get_sizeof_rkey) (f, udata);
size = H5B_nodesize(f, type, &total_native_keysize, sizeof_rkey);
- if (H5MF_alloc(f, H5MF_META, size, retval) < 0) {
+ if (H5MF_alloc(f, H5MF_META, (hsize_t)size, retval) < 0) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"can't allocate file space for B-tree root node");
}
@@ -254,7 +253,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *retval)
*
*-------------------------------------------------------------------------
*/
-static H5B_t *
+static H5B_t *
H5B_load(H5F_t *f, const haddr_t *addr, const void *_type, void *udata)
{
const H5B_class_t *type = (const H5B_class_t *) _type;
@@ -282,7 +281,7 @@ H5B_load(H5F_t *f, const haddr_t *addr, const void *_type, void *udata)
bt->native = H5MM_xmalloc(total_nkey_size);
bt->key = H5MM_xmalloc((2 * H5B_K(f, type) + 1) * sizeof(H5B_key_t));
bt->child = H5MM_xmalloc(2 * H5B_K(f, type) * sizeof(haddr_t));
- if (H5F_block_read(f, addr, size, bt->page) < 0) {
+ if (H5F_block_read(f, addr, (hsize_t)size, bt->page) < 0) {
HRETURN_ERROR(H5E_BTREE, H5E_READERROR, NULL,
"can't read B-tree node");
}
@@ -425,7 +424,7 @@ H5B_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt)
* bother writing data for the child entries that don't exist or
* for the final unchanged children.
*/
- if (H5F_block_write(f, addr, size, bt->page) < 0) {
+ if (H5F_block_write(f, addr, (hsize_t)size, bt->page) < 0) {
HRETURN_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL,
"unable to save B-tree node to disk");
}
@@ -821,7 +820,7 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
*/
size = H5B_nodesize(f, type, NULL, bt->sizeof_rkey);
buf = H5MM_xmalloc(size);
- if (H5MF_alloc(f, H5MF_META, size, &old_root /*out */ ) < 0) {
+ if (H5MF_alloc(f, H5MF_META, (hsize_t)size, &old_root/*out*/) < 0) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"unable to allocate file space to move root");
}
@@ -829,11 +828,11 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
HRETURN_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL,
"unable to flush B-tree root node");
}
- if (H5F_block_read(f, addr, size, buf) < 0) {
+ if (H5F_block_read(f, addr, (hsize_t)size, buf) < 0) {
HRETURN_ERROR(H5E_BTREE, H5E_READERROR, FAIL,
"unable to read B-tree root node");
}
- if (H5F_block_write(f, &old_root, size, buf) < 0) {
+ if (H5F_block_write(f, &old_root, (hsize_t)size, buf) < 0) {
HRETURN_ERROR(H5E_BTREE, H5E_WRITEERROR, FAIL,
"unable to move B-tree root node");
}
diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h
index a7db2fc..b108db8 100644
--- a/src/H5Bprivate.h
+++ b/src/H5Bprivate.h
@@ -68,24 +68,24 @@ struct H5B_t; /*forward decl */
typedef struct H5B_class_t {
H5B_subid_t id; /*id as found in file*/
size_t sizeof_nkey; /*size of native (memory) key*/
- size_t (*get_sizeof_rkey) (H5F_t *, const void *); /*raw key size */
+ size_t (*get_sizeof_rkey) (H5F_t*, const void*); /*raw key size */
herr_t (*new_node) (H5F_t*, H5B_ins_t, void*, void*, void*, haddr_t*);
- intn (*cmp2) (H5F_t *, void *, void *, void *); /*compare 2 keys */
- intn (*cmp3) (H5F_t *, void *, void *, void *); /*compare 3 keys */
- herr_t (*found) (H5F_t *, const haddr_t *, const void *, void *,
- const void *);
+ intn (*cmp2) (H5F_t*, void*, void*, void*); /*compare 2 keys */
+ intn (*cmp3) (H5F_t*, void*, void*, void*); /*compare 3 keys */
+ herr_t (*found) (H5F_t*, const haddr_t*, const void*, void*,
+ const void*);
/* insert new data */
- H5B_ins_t (*insert) (H5F_t *, const haddr_t *, void *, hbool_t *,
- void *, void *, void *, hbool_t *, haddr_t *);
+ H5B_ins_t (*insert) (H5F_t*, const haddr_t*, void*, hbool_t*,
+ void*, void*, void*, hbool_t*, haddr_t*);
/* min insert uses min leaf, not new(), similarily for max insert */
hbool_t follow_min;
hbool_t follow_max;
- herr_t (*list) (H5F_t *, const haddr_t *, void *); /*walk leaf nodes*/
- herr_t (*decode) (H5F_t *, struct H5B_t *, uint8 *, void *);
- herr_t (*encode) (H5F_t *, struct H5B_t *, uint8 *, void *);
+ herr_t (*list) (H5F_t*, const haddr_t*, void*); /*walk leaf nodes*/
+ herr_t (*decode) (H5F_t*, struct H5B_t*, uint8*, void*);
+ herr_t (*encode) (H5F_t*, struct H5B_t*, uint8*, void*);
} H5B_class_t;
/*
diff --git a/src/H5D.c b/src/H5D.c
index 8d29685..6d043ea 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -456,7 +456,8 @@ H5Dget_create_plist (hid_t dataset_id)
}
/* Create an atom */
- if ((ret_value=H5I_register ((H5I_group_t)(H5_TEMPLATE_0+H5P_DATASET_CREATE),
+ if ((ret_value=H5I_register ((H5I_group_t)(H5_TEMPLATE_0+
+ H5P_DATASET_CREATE),
copied_parms))<0) {
HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL,
"unable to register creation property list");
@@ -667,7 +668,7 @@ H5Dwrite(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id,
*-------------------------------------------------------------------------
*/
herr_t
-H5Dextend (hid_t dataset_id, const size_t *size)
+H5Dextend (hid_t dataset_id, const hsize_t *size)
{
H5D_t *dataset = NULL;
@@ -724,7 +725,7 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space,
H5D_t *new_dset = NULL;
H5D_t *ret_value = NULL;
intn i, ndims;
- size_t max_dim[H5O_LAYOUT_NDIMS];
+ hsize_t max_dim[H5O_LAYOUT_NDIMS];
H5O_efl_t *efl = NULL;
H5F_t *f = H5G_fileof (loc);
@@ -750,7 +751,7 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space,
new_dset->layout.type = new_dset->create_parms->layout;
new_dset->layout.ndims = H5S_get_ndims(space) + 1;
assert((unsigned)(new_dset->layout.ndims) <= NELMTS(new_dset->layout.dim));
- new_dset->layout.dim[new_dset->layout.ndims - 1] = H5T_get_size(type);
+ new_dset->layout.dim[new_dset->layout.ndims-1] = H5T_get_size(type);
switch (new_dset->create_parms->layout) {
case H5D_CONTIGUOUS:
@@ -770,8 +771,8 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space,
}
}
if (efl->nused>0) {
- size_t max_points = H5S_get_npoints_max (space);
- size_t max_storage = H5O_efl_total_size (efl);
+ hsize_t max_points = H5S_get_npoints_max (space);
+ hsize_t max_storage = H5O_efl_total_size (efl);
if (H5S_UNLIMITED==max_points) {
if (H5O_EFL_UNLIMITED!=max_storage) {
@@ -804,7 +805,7 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space,
HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL,
"external storage not supported with chunked layout");
}
- for (i = 0; i < new_dset->layout.ndims - 1; i++) {
+ for (i=0; i<new_dset->layout.ndims-1; i++) {
new_dset->layout.dim[i] = new_dset->create_parms->chunk_size[i];
}
break;
@@ -974,7 +975,6 @@ H5D_open(H5G_t *loc, const char *name)
break;
default:
- assert("not implemented yet" && 0);
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet");
}
@@ -1091,7 +1091,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
const H5S_t *file_space, const H5D_xfer_t *xfer_parms,
void *buf/*out*/)
{
- size_t nelmts; /*number of elements */
+ hsize_t nelmts; /*number of elements */
size_t smine_start; /*strip mine start loc */
size_t smine_nelmts; /*elements per strip */
uint8 *tconv_buf = NULL; /*data type conv buffer */
@@ -1319,7 +1319,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
const H5S_t *file_space, const H5D_xfer_t *xfer_parms,
const void *buf)
{
- size_t nelmts; /*total number of elmts */
+ hsize_t nelmts; /*total number of elmts */
size_t smine_start; /*strip mine start loc */
size_t smine_nelmts; /*elements per strip */
uint8 *tconv_buf = NULL; /*data type conv buffer */
@@ -1543,7 +1543,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
*-------------------------------------------------------------------------
*/
herr_t
-H5D_extend (H5D_t *dataset, const size_t *size)
+H5D_extend (H5D_t *dataset, const hsize_t *size)
{
herr_t changed;
diff --git a/src/H5Distore.c b/src/H5Distore.c
index c737d9d..1f84aab 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -49,10 +49,11 @@ static herr_t H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8 *raw,
static herr_t H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8 *raw,
void *_key);
static herr_t H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout,
- H5F_isop_t op, const size_t offset_f[],
- const size_t size[],
- const size_t offset_m[],
- const size_t size_m[],
+ H5F_isop_t op,
+ const hssize_t offset_f[],
+ const hsize_t size[],
+ const hssize_t offset_m[],
+ const hsize_t size_m[],
void *buf);
/*
@@ -71,8 +72,8 @@ static herr_t H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout,
*/
typedef struct H5F_istore_key_t {
uintn file_number; /*external file number */
- size_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/
- size_t size[H5O_LAYOUT_NDIMS]; /*logical chunk size */
+ hssize_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/
+ hsize_t size[H5O_LAYOUT_NDIMS]; /*logical chunk size */
} H5F_istore_key_t;
typedef struct H5F_istore_ud1_t {
@@ -119,7 +120,7 @@ H5B_class_t H5B_ISTORE[1] = {{
*-------------------------------------------------------------------------
*/
static size_t
-H5F_istore_sizeof_rkey(H5F_t *f __attribute__((unused)), const void *_udata)
+H5F_istore_sizeof_rkey(H5F_t __unused__ *f, const void *_udata)
{
const H5F_istore_ud1_t *udata = (const H5F_istore_ud1_t *) _udata;
size_t nbytes;
@@ -152,7 +153,7 @@ H5F_istore_sizeof_rkey(H5F_t *f __attribute__((unused)), const void *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
+H5F_istore_decode_key(H5F_t __unused__ *f, H5B_t *bt, uint8 *raw, void *_key)
{
H5F_istore_key_t *key = (H5F_istore_key_t *) _key;
intn i;
@@ -196,7 +197,7 @@ H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
+H5F_istore_encode_key(H5F_t __unused__ *f, H5B_t *bt, uint8 *raw, void *_key)
{
H5F_istore_key_t *key = (H5F_istore_key_t *) _key;
intn ndims = (intn)(bt->sizeof_rkey / 8);
@@ -245,8 +246,8 @@ H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
*-------------------------------------------------------------------------
*/
static intn
-H5F_istore_cmp2(H5F_t *f __attribute__((unused)), void *_lt_key,
- void *_udata, void *_rt_key)
+H5F_istore_cmp2(H5F_t __unused__ *f, void *_lt_key, void *_udata,
+ void *_rt_key)
{
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
H5F_istore_key_t *rt_key = (H5F_istore_key_t *) _rt_key;
@@ -261,7 +262,7 @@ H5F_istore_cmp2(H5F_t *f __attribute__((unused)), void *_lt_key,
assert(udata->mesg.ndims > 0 && udata->mesg.ndims <= H5O_LAYOUT_NDIMS);
/* Compare the offsets but ignore the other fields */
- cmp = H5V_vector_cmp(udata->mesg.ndims, lt_key->offset, rt_key->offset);
+ cmp = H5V_vector_cmp_s(udata->mesg.ndims, lt_key->offset, rt_key->offset);
FUNC_LEAVE(cmp);
}
@@ -297,8 +298,8 @@ H5F_istore_cmp2(H5F_t *f __attribute__((unused)), void *_lt_key,
*-------------------------------------------------------------------------
*/
static intn
-H5F_istore_cmp3(H5F_t *f __attribute__((unused)),
- void *_lt_key, void *_udata, void *_rt_key)
+H5F_istore_cmp3(H5F_t __unused__ *f, void *_lt_key, void *_udata,
+ void *_rt_key)
{
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
H5F_istore_key_t *rt_key = (H5F_istore_key_t *) _rt_key;
@@ -312,9 +313,10 @@ H5F_istore_cmp3(H5F_t *f __attribute__((unused)),
assert(udata);
assert(udata->mesg.ndims > 0 && udata->mesg.ndims <= H5O_LAYOUT_NDIMS);
- if (H5V_vector_lt(udata->mesg.ndims, udata->key.offset, lt_key->offset)) {
+ if (H5V_vector_lt_s(udata->mesg.ndims, udata->key.offset,
+ lt_key->offset)) {
cmp = -1;
- } else if (H5V_vector_ge(udata->mesg.ndims, udata->key.offset,
+ } else if (H5V_vector_ge_s(udata->mesg.ndims, udata->key.offset,
rt_key->offset)) {
cmp = 1;
}
@@ -350,7 +352,7 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
H5F_istore_key_t *rt_key = (H5F_istore_key_t *) _rt_key;
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata;
- size_t nbytes;
+ hsize_t nbytes;
intn i;
FUNC_ENTER(H5F_istore_new_node, FAIL);
@@ -391,7 +393,9 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
* a zero-width chunk.
*/
if (H5B_INS_LEFT != op) {
- rt_key->offset[i] = udata->key.offset[i] + udata->key.size[i];
+ assert (udata->key.size[i] < MAX_HSSIZET);
+ rt_key->offset[i] = udata->key.offset[i] +
+ (hssize_t)udata->key.size[i];
rt_key->size[i] = 0;
}
}
@@ -423,8 +427,9 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_found(H5F_t *f, const haddr_t *addr, const void *_lt_key,
- void *_udata, const void *_rt_key __attribute__((unused)))
+H5F_istore_found(H5F_t __unused__ *f, const haddr_t *addr,
+ const void *_lt_key, void *_udata,
+ const void __unused__ *_rt_key)
{
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata;
const H5F_istore_key_t *lt_key = (const H5F_istore_key_t *) _lt_key;
@@ -483,10 +488,10 @@ H5F_istore_found(H5F_t *f, const haddr_t *addr, const void *_lt_key,
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5F_istore_insert(H5F_t *f, const haddr_t *addr,
- void *_lt_key, hbool_t *lt_key_changed,
- void *_md_key, void *_udata,
- void *_rt_key, hbool_t *rt_key_changed,
+H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
+ hbool_t __unused__ *lt_key_changed,
+ void *_md_key, void *_udata, void *_rt_key,
+ hbool_t __unused__ *rt_key_changed,
haddr_t *new_node/*out*/)
{
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
@@ -495,7 +500,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr,
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata;
intn i, cmp;
H5B_ins_t ret_value = H5B_INS_ERROR;
- size_t nbytes;
+ hsize_t nbytes;
FUNC_ENTER(H5F_istore_insert, H5B_INS_ERROR);
@@ -541,7 +546,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr,
* current node. The MD_KEY is where the split occurs.
*/
md_key->file_number = udata->key.file_number;
- for (i = 0, nbytes = 1; i < udata->mesg.ndims; i++) {
+ for (i=0, nbytes=1; i<udata->mesg.ndims; i++) {
assert(0 == udata->key.offset[i] % udata->mesg.dim[i]);
assert(udata->key.size[i] == udata->mesg.dim[i]);
md_key->offset[i] = udata->key.offset[i];
@@ -604,18 +609,19 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr,
*/
static herr_t
H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
- const size_t offset_f[], const size_t size[],
- const size_t offset_m[], const size_t size_m[],
+ const hssize_t offset_f[], const hsize_t size[],
+ const hssize_t offset_m[], const hsize_t size_m[],
void *buf/*in or out*/)
{
intn i, carry;
- size_t idx_cur[H5O_LAYOUT_NDIMS];
- size_t idx_min[H5O_LAYOUT_NDIMS];
- size_t idx_max[H5O_LAYOUT_NDIMS];
- size_t sub_size[H5O_LAYOUT_NDIMS];
- size_t offset_wrt_chunk[H5O_LAYOUT_NDIMS];
- size_t sub_offset_m[H5O_LAYOUT_NDIMS];
+ hsize_t idx_cur[H5O_LAYOUT_NDIMS];
+ hsize_t idx_min[H5O_LAYOUT_NDIMS];
+ hsize_t idx_max[H5O_LAYOUT_NDIMS];
+ hsize_t sub_size[H5O_LAYOUT_NDIMS];
+ hssize_t offset_wrt_chunk[H5O_LAYOUT_NDIMS];
+ hssize_t sub_offset_m[H5O_LAYOUT_NDIMS];
size_t chunk_size;
+ hsize_t acc;
uint8 *chunk = NULL;
H5F_istore_ud1_t udata;
herr_t status;
@@ -649,14 +655,16 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
* destination.
*/
if (H5F_ISTORE_READ==op) {
- for (i=0, chunk_size=1; i<layout->ndims; i++) {
+ for (i=0, acc=1; i<layout->ndims; i++) {
if (offset_f[i] % layout->dim[i]) break; /*src not aligned*/
if (size[i]!=layout->dim[i]) break; /*src not a chunk*/
if (size_m[i]!=layout->dim[i]) break; /*dst not a chunk*/
udata.key.offset[i] = offset_f[i];
udata.key.size[i] = layout->dim[i];
- chunk_size *= layout->dim[i];
+ acc *= layout->dim[i];
}
+ chunk_size = acc;
+ assert ((hsize_t)chunk_size==acc);
if (i==layout->ndims) {
udata.mesg = *layout;
@@ -665,7 +673,8 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
status = H5B_find (f, H5B_ISTORE, &(layout->addr), &udata);
if (status>=0 && H5F_addr_defined (&(udata.addr))) {
assert (0==udata.key.file_number);
- if (H5F_block_read (f, &(udata.addr), chunk_size, buf)<0) {
+ if (H5F_block_read (f, &(udata.addr), (hsize_t)chunk_size,
+ buf)<0) {
HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL,
"unable to read raw storage chunk");
}
@@ -708,11 +717,12 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
for (i=0; i<layout->ndims; i++) {
/* The location and size of the chunk being accessed */
- udata.key.offset[i] = idx_cur[i] * layout->dim[i];
+ assert (layout->dim[i] < MAX_HSSIZET);
+ udata.key.offset[i] = idx_cur[i] * (hssize_t)(layout->dim[i]);
udata.key.size[i] = layout->dim[i];
/* The offset and size wrt the chunk */
- offset_wrt_chunk[i] = MAX((offset_f ? offset_f[i] : 0),
+ offset_wrt_chunk[i] = MAX((offset_f?offset_f[i]:0),
udata.key.offset[i]) -
udata.key.offset[i];
sub_size[i] = MIN((idx_cur[i] + 1) * layout->dim[i],
@@ -737,11 +747,12 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
* partial chunk then load the chunk from disk.
*/
if (H5F_ISTORE_READ == op ||
- !H5V_vector_zerop(layout->ndims, offset_wrt_chunk) ||
- !H5V_vector_eq(layout->ndims, sub_size, udata.key.size)) {
+ !H5V_vector_zerop_s(layout->ndims, offset_wrt_chunk) ||
+ !H5V_vector_eq_u(layout->ndims, sub_size, udata.key.size)) {
if (status>=0 && H5F_addr_defined(&(udata.addr))) {
assert(0==udata.key.file_number);
- if (H5F_block_read(f, &(udata.addr), chunk_size, chunk) < 0) {
+ if (H5F_block_read(f, &(udata.addr), (hsize_t)chunk_size,
+ chunk) < 0) {
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL,
"unable to read raw storage chunk");
}
@@ -755,7 +766,8 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
udata.key.size, offset_wrt_chunk, chunk,
size_m, sub_offset_m, buf);
assert(0 == udata.key.file_number);
- if (H5F_block_write(f, &(udata.addr), chunk_size, chunk) < 0) {
+ if (H5F_block_write(f, &(udata.addr), (hsize_t)chunk_size,
+ chunk) < 0) {
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"unable to write raw storage chunk");
}
@@ -799,7 +811,7 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
*/
herr_t
H5F_istore_read(H5F_t *f, const H5O_layout_t *layout,
- const size_t offset[], const size_t size[], void *buf)
+ const hssize_t offset[], const hsize_t size[], void *buf)
{
FUNC_ENTER(H5F_istore_read, FAIL);
@@ -838,7 +850,7 @@ H5F_istore_read(H5F_t *f, const H5O_layout_t *layout,
*/
herr_t
H5F_istore_write(H5F_t *f, const H5O_layout_t *layout,
- const size_t offset[], const size_t size[],
+ const hssize_t offset[], const hsize_t size[],
const void *buf)
{
FUNC_ENTER(H5F_istore_write, FAIL);
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 6068f00..6f0c23c 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -1,13 +1,13 @@
/****************************************************************************
- * NCSA HDF *
- * Software Development Group *
- * National Center for Supercomputing Applications *
- * University of Illinois at Urbana-Champaign *
- * 605 E. Springfield, Champaign IL 61820 *
- * *
- * For conditions of distribution and use, see the accompanying *
- * hdf/COPYING file. *
- * *
+ * NCSA HDF *
+ * Software Development Group *
+ * National Center for Supercomputing Applications *
+ * University of Illinois at Urbana-Champaign *
+ * 605 E. Springfield, Champaign IL 61820 *
+ * *
+ * For conditions of distribution and use, see the accompanying *
+ * hdf/COPYING file. *
+ * *
****************************************************************************/
/*
@@ -20,11 +20,11 @@
/* Private headers needed by this file */
#include <H5private.h>
-#include <H5Fprivate.h> /*for the H5F_t type */
-#include <H5Gprivate.h> /*symbol tables */
-#include <H5Oprivate.h> /*object Headers */
-#include <H5Sprivate.h> /*for the H5S_t type */
-#include <H5Tprivate.h> /*for the H5T_t type */
+#include <H5Fprivate.h> /*for the H5F_t type */
+#include <H5Gprivate.h> /*symbol tables */
+#include <H5Oprivate.h> /*object Headers */
+#include <H5Sprivate.h> /*for the H5S_t type */
+#include <H5Tprivate.h> /*for the H5T_t type */
/*
* Feature: Define H5D_DEBUG on the compiler command line if you want to
@@ -42,9 +42,9 @@
/* Dataset creation property list */
typedef struct H5D_create_t {
- H5D_layout_t layout; /*storage layout */
- intn chunk_ndims; /*chunk dimensionality */
- size_t chunk_size[32]; /*chunk size if chunked storage */
+ H5D_layout_t layout; /*storage layout */
+ intn chunk_ndims; /*chunk dimensionality */
+ hsize_t chunk_size[32]; /*chunk size if chunked storage */
H5O_efl_t efl; /*external file list */
} H5D_create_t;
@@ -62,16 +62,16 @@ extern const H5D_xfer_t H5D_xfer_dflt;
/* Functions defined in H5D.c */
H5D_t *H5D_create (H5G_t *loc, const char *name, const H5T_t *type,
- const H5S_t *space, const H5D_create_t *create_parms);
+ const H5S_t *space, const H5D_create_t *create_parms);
H5D_t *H5D_open (H5G_t *loc, const char *name);
herr_t H5D_close (H5D_t *dataset);
herr_t H5D_read (H5D_t *dataset, const H5T_t *mem_type,
- const H5S_t *mem_space, const H5S_t *file_space,
- const H5D_xfer_t *xfer_parms, void *buf/*out*/);
+ const H5S_t *mem_space, const H5S_t *file_space,
+ const H5D_xfer_t *xfer_parms, void *buf/*out*/);
herr_t H5D_write (H5D_t *dataset, const H5T_t *mem_type,
- const H5S_t *mem_space, const H5S_t *file_space,
- const H5D_xfer_t *xfer_parms, const void *buf);
+ const H5S_t *mem_space, const H5S_t *file_space,
+ const H5D_xfer_t *xfer_parms, const void *buf);
hid_t H5D_find_name (hid_t file_id, H5I_group_t UNUSED, const char *name);
-herr_t H5D_extend (H5D_t *dataset, const size_t *size);
+herr_t H5D_extend (H5D_t *dataset, const hsize_t *size);
#endif
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 2987056..bfaacd2 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -46,7 +46,7 @@ herr_t H5Dread (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t xfer_parms_id, void *buf/*out*/);
herr_t H5Dwrite (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t xfer_parms_id, const void *buf);
-herr_t H5Dextend (hid_t dataset_id, const size_t *size);
+herr_t H5Dextend (hid_t dataset_id, const hsize_t *size);
#ifdef __cplusplus
}
diff --git a/src/H5F.c b/src/H5F.c
index e6d649a..f7193c9 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -68,21 +68,21 @@ const H5F_create_t H5F_create_dflt = {
0, /* Default user-block size */
4, /* Default 1/2 rank for symtab leaf nodes */
{ /* Default 1/2 rank for btree intern nodes */
- 16, /* Symbol table internal nodes */
- 32, /* Indexed storage internal nodes */
- 0, /* unused */
- 0, /* unused */
- 0, /* unused */
- 0, /* unused */
- 0, /* unused */
- 0, /* unused */
+ 16, /* Symbol table internal nodes */
+ 32, /* Indexed storage internal nodes */
+ 0, /* unused */
+ 0, /* unused */
+ 0, /* unused */
+ 0, /* unused */
+ 0, /* unused */
+ 0, /* unused */
},
- sizeof(size_t), /* Default offset size */
- sizeof(size_t), /* Default length size */
- HDF5_BOOTBLOCK_VERSION, /* Current Boot-Block version # */
- HDF5_FREESPACE_VERSION, /* Current Free-Space info version # */
+ sizeof(hsize_t), /* Default offset size */
+ sizeof(hsize_t), /* Default length size */
+ HDF5_BOOTBLOCK_VERSION, /* Current Boot-Block version # */
+ HDF5_FREESPACE_VERSION, /* Current Free-Space info version # */
HDF5_OBJECTDIR_VERSION, /* Current Object Directory info version # */
- HDF5_SHAREDHEADER_VERSION, /* Current Shared-Header format version # */
+ HDF5_SHAREDHEADER_VERSION, /* Current Shared-Header format version # */
};
/*
@@ -923,7 +923,7 @@ H5F_open(const char *name, uintn flags,
H5G_SIZEOF_ENTRY(f);
assert(variable_size <= sizeof buf);
addr1 = f->shared->boot_addr;
- H5F_addr_inc(&addr1, fixed_size);
+ H5F_addr_inc(&addr1, (hsize_t)fixed_size);
if (H5F_low_read(f->shared->lf, access_parms, &addr1, variable_size,
buf) < 0) {
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, NULL,
@@ -1275,7 +1275,7 @@ H5F_flush(H5F_t *f, hbool_t invalidate)
/* update file length if necessary */
if (!H5F_addr_defined(&(f->shared->hdf5_eof))) {
H5F_addr_reset(&(f->shared->hdf5_eof));
- H5F_addr_inc(&(f->shared->hdf5_eof), (size_t)(p-buf));
+ H5F_addr_inc(&(f->shared->hdf5_eof), (hsize_t)(p-buf));
H5F_low_seteof(f->shared->lf, &(f->shared->hdf5_eof));
}
@@ -1454,14 +1454,14 @@ H5Fclose(hid_t fid)
*-------------------------------------------------------------------------
*/
herr_t
-H5F_block_read(H5F_t *f, const haddr_t *addr, size_t size, void *buf)
+H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, void *buf)
{
haddr_t abs_addr;
FUNC_ENTER(H5F_block_read, FAIL);
- if (0 == size)
- return 0;
+ if (0==size) return 0;
+ assert (size < MAX_SIZET);
/* convert the relative address to an absolute address */
abs_addr = f->shared->base_addr;
@@ -1469,7 +1469,7 @@ H5F_block_read(H5F_t *f, const haddr_t *addr, size_t size, void *buf)
/* Read the data */
if (H5F_low_read(f->shared->lf, &(f->shared->access_parms),
- &abs_addr, size, buf) < 0) {
+ &abs_addr, (size_t)size, buf) < 0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "low-level read failed");
}
FUNC_LEAVE(SUCCEED);
@@ -1499,14 +1499,14 @@ H5F_block_read(H5F_t *f, const haddr_t *addr, size_t size, void *buf)
*-------------------------------------------------------------------------
*/
herr_t
-H5F_block_write(H5F_t *f, const haddr_t *addr, size_t size, const void *buf)
+H5F_block_write(H5F_t *f, const haddr_t *addr, hsize_t size, const void *buf)
{
haddr_t abs_addr;
FUNC_ENTER(H5F_block_write, FAIL);
- if (0 == size)
- return 0;
+ if (0==size) return 0;
+ assert (size < MAX_SIZET);
if (0 == (f->intent & H5F_ACC_RDWR)) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "no write intent");
@@ -1518,7 +1518,7 @@ H5F_block_write(H5F_t *f, const haddr_t *addr, size_t size, const void *buf)
/* Write the data */
if (H5F_low_write(f->shared->lf, &(f->shared->access_parms),
- &abs_addr, size, buf)) {
+ &abs_addr, (size_t)size, buf)) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low-level write failed");
}
@@ -1547,8 +1547,8 @@ H5F_block_write(H5F_t *f, const haddr_t *addr, size_t size, const void *buf)
*-------------------------------------------------------------------------
*/
herr_t
-H5F_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
- intn fwidth)
+H5F_debug(H5F_t *f, const haddr_t __unused__ *addr, FILE * stream,
+ intn indent, intn fwidth)
{
FUNC_ENTER(H5F_debug, FAIL);
diff --git a/src/H5Farray.c b/src/H5Farray.c
index 08aeac4..138a20f 100644
--- a/src/H5Farray.c
+++ b/src/H5Farray.c
@@ -46,7 +46,7 @@ herr_t
H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/)
{
intn i;
- size_t nbytes;
+ hsize_t nbytes;
FUNC_ENTER (H5F_arr_create, FAIL);
@@ -113,17 +113,18 @@ H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/)
herr_t
H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_efl_t *efl,
- const size_t _hslab_size[], const size_t mem_size[],
- const size_t mem_offset[], const size_t file_offset[],
+ const hsize_t _hslab_size[], const hsize_t mem_size[],
+ const hssize_t mem_offset[], const hssize_t file_offset[],
void *_buf/*out*/)
{
uint8 *buf = (uint8 *)_buf; /*cast for arithmetic */
- ssize_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
- ssize_t mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
- size_t hslab_size[H5O_LAYOUT_NDIMS]; /*hyperslab size */
- size_t idx[H5O_LAYOUT_NDIMS]; /*multi-dim counter */
- size_t mem_start, file_start; /*byte offsets to start */
- size_t elmt_size = 1; /*bytes per element */
+ hssize_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
+ hssize_t mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
+ hsize_t hslab_size[H5O_LAYOUT_NDIMS]; /*hyperslab size */
+ hsize_t idx[H5O_LAYOUT_NDIMS]; /*multi-dim counter */
+ size_t mem_start; /*byte offset to start */
+ hsize_t file_start; /*byte offset to start */
+ hsize_t elmt_size = 1; /*bytes per element */
size_t nelmts, z; /*number of elements */
intn ndims; /*stride dimensionality */
haddr_t addr; /*address in file */
@@ -146,12 +147,22 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
switch (layout->type) {
case H5D_CONTIGUOUS:
+ ndims = layout->ndims;
+ /*
+ * Offsets must not be negative for this type of storage.
+ */
+ for (i=0; i<ndims; i++) {
+ if (mem_offset[i]<0 || file_offset[i]<0) {
+ HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL,
+ "negative offsets are not valid");
+ }
+ }
+
/*
* Calculate the strides needed to walk through the array on disk
* and memory. Optimize the strides to result in the fewest number of
* I/O requests.
*/
- ndims = layout->ndims;
mem_start = H5V_hyper_stride (ndims, hslab_size, mem_size,
mem_offset, mem_stride/*out*/);
file_start = H5V_hyper_stride (ndims, hslab_size, layout->dim,
@@ -263,17 +274,18 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
*/
herr_t
H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
- const struct H5O_efl_t *efl, const size_t _hslab_size[],
- const size_t mem_size[], const size_t mem_offset[],
- const size_t file_offset[], const void *_buf)
+ const struct H5O_efl_t *efl, const hsize_t _hslab_size[],
+ const hsize_t mem_size[], const hssize_t mem_offset[],
+ const hssize_t file_offset[], const void *_buf)
{
const uint8 *buf = (const uint8 *)_buf; /*cast for arithmetic */
- ssize_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
- ssize_t mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
- size_t hslab_size[H5O_LAYOUT_NDIMS]; /*hyperslab size */
- size_t idx[H5O_LAYOUT_NDIMS]; /*multi-dim counter */
- size_t mem_start, file_start; /*byte offsets to start */
- size_t elmt_size = 1; /*bytes per element */
+ hssize_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
+ hssize_t mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
+ hsize_t hslab_size[H5O_LAYOUT_NDIMS]; /*hyperslab size */
+ hsize_t idx[H5O_LAYOUT_NDIMS]; /*multi-dim counter */
+ hsize_t mem_start; /*byte offset to start */
+ hsize_t file_start; /*byte offset to start */
+ hsize_t elmt_size = 1; /*bytes per element */
size_t nelmts, z; /*number of elements */
intn ndims; /*dimensionality */
haddr_t addr; /*address in file */
@@ -297,12 +309,22 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
switch (layout->type) {
case H5D_CONTIGUOUS:
+ ndims = layout->ndims;
+ /*
+ * Offsets must not be negative for this type of storage.
+ */
+ for (i=0; i<ndims; i++) {
+ if (mem_offset[i]<0 || file_offset[i]<0) {
+ HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL,
+ "negative offsets are not valid");
+ }
+ }
+
/*
* Calculate the strides needed to walk through the array on disk.
* Optimize the strides to result in the fewest number of I/O
* requests.
*/
- ndims = layout->ndims;
mem_start = H5V_hyper_stride (ndims, hslab_size, mem_size,
mem_offset, mem_stride/*out*/);
file_start = H5V_hyper_stride (ndims, hslab_size, layout->dim,
diff --git a/src/H5Fcore.c b/src/H5Fcore.c
index 9ff3c44..4f8e216 100644
--- a/src/H5Fcore.c
+++ b/src/H5Fcore.c
@@ -1,17 +1,17 @@
/*
* Copyright (C) 1997 NCSA
- * All rights reserved.
+ * All rights reserved.
*
* Programmer: Robb Matzke <matzke@llnl.gov>
- * Wednesday, October 22, 1997
+ * Wednesday, October 22, 1997
*
- * Purpose: This file implements an in-core temporary file. It's intended
- * for storing small temporary files such as wrappers generated
- * on the fly.
+ * Purpose: This file implements an in-core temporary file. It's intended
+ * for storing small temporary files such as wrappers generated
+ * on the fly.
*
* Note: This is mostly an exercise to help clean up parts of the H5F
- * package since this driver is quite different than the other
- * low level drivers we have so far.
+ * package since this driver is quite different than the other
+ * low level drivers we have so far.
*
*/
#include <H5private.h>
@@ -19,10 +19,10 @@
#include <H5Fprivate.h>
#include <H5MMprivate.h>
-#define H5F_CORE_DEV 0xffff /*pseudo dev for core until we fix things */
+#define H5F_CORE_DEV 0xffff /*pseudo dev for core until we fix things */
-#define PABLO_MASK H5F_core
-static hbool_t interface_initialize_g = FALSE;
+#define PABLO_MASK H5F_core
+static hbool_t interface_initialize_g = FALSE;
#define INTERFACE_INIT NULL
static hbool_t H5F_core_access(const char *name,
@@ -38,41 +38,40 @@ static herr_t H5F_core_write(H5F_low_t *lf, const H5F_access_t *access_parms,
const haddr_t *addr, size_t size,
const uint8 *buf);
-const H5F_low_class_t H5F_LOW_CORE_g[1] = {{
- H5F_core_access, /* access method */
- H5F_core_open, /* open method */
- H5F_core_close, /* close method */
- H5F_core_read, /* read method */
- H5F_core_write, /* write method */
- NULL, /* flush method */
- NULL, /* extend method */
+const H5F_low_class_t H5F_LOW_CORE_g[1] = {{
+ H5F_core_access, /* access method */
+ H5F_core_open, /* open method */
+ H5F_core_close, /* close method */
+ H5F_core_read, /* read method */
+ H5F_core_write, /* write method */
+ NULL, /* flush method */
+ NULL, /* extend method */
}};
/*-------------------------------------------------------------------------
- * Function: H5F_core_access
+ * Function: H5F_core_access
*
- * Purpose: Determines if the specified file already exists. This driver
- * doesn't use names, so every call to H5F_core_open() would
- * create a new file. Therefore, this function always returns
- * false and KEY is never initialized.
+ * Purpose: Determines if the specified file already exists. This driver
+ * doesn't use names, so every call to H5F_core_open() would
+ * create a new file. Therefore, this function always returns
+ * false and KEY is never initialized.
*
- * Return: Success: FALSE
+ * Return: Success: FALSE
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Friday, October 24, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 24, 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static hbool_t
-H5F_core_access(const char *name __attribute__((unused)),
- const H5F_access_t *access_parms __attribute__((unused)),
- int mode __attribute__((unused)),
- H5F_search_t *key/*out*/ __attribute__((unused)))
+H5F_core_access(const char __unused__*name,
+ const H5F_access_t __unused__ *access_parms,
+ int __unused__ mode, H5F_search_t __unused__ *key/*out*/)
{
FUNC_ENTER(H5F_core_access, FAIL);
FUNC_LEAVE(FALSE);
@@ -80,39 +79,39 @@ H5F_core_access(const char *name __attribute__((unused)),
/*-------------------------------------------------------------------------
- * Function: H5F_core_open
+ * Function: H5F_core_open
*
- * Purpose: Opens a temporary file which will exist only in memory. The
- * NAME argument is unused. The FLAGS are a bit field with
- * the possible values defined in H5F_low_open().
+ * Purpose: Opens a temporary file which will exist only in memory. The
+ * NAME argument is unused. The FLAGS are a bit field with
+ * the possible values defined in H5F_low_open().
*
* Errors:
- * IO CANTOPENFILE Must creat file with write access.
+ * IO CANTOPENFILE Must creat file with write access.
*
- * Return: Success: Low-level file pointer
+ * Return: Success: Low-level file pointer
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
- * Wednesday, October 22, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 22, 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static H5F_low_t *
-H5F_core_open(const char *name __attribute__((unused)),
- const H5F_access_t *access_parms __attribute__((unused)),
+H5F_core_open(const char __unused__ *name,
+ const H5F_access_t __unused__ *access_parms,
uintn flags, H5F_search_t *key/*out*/)
{
- H5F_low_t *lf = NULL;
- static ino_t ino = 0;
+ H5F_low_t *lf = NULL;
+ static ino_t ino = 0;
FUNC_ENTER(H5F_core_open, NULL);
if (0 == (flags & H5F_ACC_RDWR) || 0 == (flags & H5F_ACC_CREAT)) {
- HRETURN_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL,
- "must creat file with write access");
+ HRETURN_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL,
+ "must creat file with write access");
}
lf = H5MM_xcalloc(1, sizeof(H5F_low_t));
@@ -122,8 +121,8 @@ H5F_core_open(const char *name __attribute__((unused)),
H5F_addr_reset(&(lf->eof));
if (key) {
- key->dev = H5F_CORE_DEV;
- key->ino = ino++;
+ key->dev = H5F_CORE_DEV;
+ key->ino = ino++;
}
FUNC_LEAVE(lf);
@@ -131,26 +130,25 @@ H5F_core_open(const char *name __attribute__((unused)),
/*-------------------------------------------------------------------------
- * Function: H5F_core_close
+ * Function: H5F_core_close
*
- * Purpose: Closes a file.
+ * Purpose: Closes a file.
*
* Errors:
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 22, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 22, 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_core_close(H5F_low_t *lf,
- const H5F_access_t *access_parms __attribute__((unused)))
+H5F_core_close(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms)
{
FUNC_ENTER(H5F_core_close, FAIL);
@@ -163,32 +161,31 @@ H5F_core_close(H5F_low_t *lf,
/*-------------------------------------------------------------------------
- * Function: H5F_core_read
+ * Function: H5F_core_read
*
- * Purpose: Reads SIZE bytes beginning at address ADDR in file LF and
- * places them in buffer BUF. Reading past the logical or
- * physical end of the file returns zeros instead of failing.
+ * Purpose: Reads SIZE bytes beginning at address ADDR in file LF and
+ * places them in buffer BUF. Reading past the logical or
+ * physical end of the file returns zeros instead of failing.
*
* Errors:
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 22, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 22, 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_core_read(H5F_low_t *lf,
- const H5F_access_t *access_parms __attribute__((unused)),
+H5F_core_read(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms,
const haddr_t *addr, size_t size, uint8 *buf)
{
- size_t n;
- size_t eof;
+ size_t n;
+ size_t eof;
FUNC_ENTER(H5F_core_read, FAIL);
@@ -199,11 +196,11 @@ H5F_core_read(H5F_low_t *lf,
eof = MIN(lf->eof.offset, lf->u.core.size);
if (addr->offset >= eof) {
- HDmemset(buf, 0, size);
+ HDmemset(buf, 0, size);
} else {
- n = MIN(size, eof - addr->offset);
- HDmemcpy(buf, lf->u.core.mem + addr->offset, n);
- HDmemset(buf + n, 0, size - n);
+ n = MIN(size, eof-addr->offset);
+ HDmemcpy(buf, lf->u.core.mem + addr->offset, n);
+ HDmemset(buf+n, 0, size-n);
}
FUNC_LEAVE(SUCCEED);
@@ -211,20 +208,20 @@ H5F_core_read(H5F_low_t *lf,
/*-------------------------------------------------------------------------
- * Function: H5F_core_write
+ * Function: H5F_core_write
*
- * Purpose: Writes SIZE bytes from the beginning of BUF into file LF at
- * file address ADDR. The file is extended as necessary to
- * accommodate the new data.
+ * Purpose: Writes SIZE bytes from the beginning of BUF into file LF at
+ * file address ADDR. The file is extended as necessary to
+ * accommodate the new data.
*
* Errors:
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 22, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 22, 1997
*
* Modifications:
*
@@ -255,17 +252,17 @@ H5F_core_write(H5F_low_t *lf, const H5F_access_t *access_parms,
need_more = addr->offset+size - lf->u.core.alloc;
need_more = increment*((need_more+increment-1)/increment);
- lf->u.core.alloc = lf->u.core.alloc + need_more;
- lf->u.core.mem = H5MM_xrealloc(lf->u.core.mem, lf->u.core.alloc);
+ lf->u.core.alloc = lf->u.core.alloc + need_more;
+ lf->u.core.mem = H5MM_xrealloc(lf->u.core.mem, lf->u.core.alloc);
}
/* Move the physical EOF marker */
if (addr->offset + size > lf->u.core.size) {
- lf->u.core.size = addr->offset + size;
+ lf->u.core.size = addr->offset + size;
}
/* Copy data */
- HDmemcpy(lf->u.core.mem + addr->offset, buf, size);
+ HDmemcpy(lf->u.core.mem+addr->offset, buf, size);
FUNC_LEAVE(SUCCEED);
}
diff --git a/src/H5Ffamily.c b/src/H5Ffamily.c
index 0458d38..402a96c 100644
--- a/src/H5Ffamily.c
+++ b/src/H5Ffamily.c
@@ -42,7 +42,7 @@ static hbool_t interface_initialize_g = FALSE;
#define H5F_FAM_MASK(N) (((uint64)1<<(N))-1)
#define H5F_FAM_OFFSET(ADDR,N) ((off_t)((ADDR)->offset & H5F_FAM_MASK(N)))
-#define H5F_FAM_MEMBNO(ADDR,N) ((intn)((ADDR)->offset >> N))
+#define H5F_FAM_MEMBNO(ADDR,N) ((intn)((ADDR)->offset >> (N)))
static hbool_t H5F_fam_access(const char *name,
const H5F_access_t *access_parms, int mode,
@@ -300,7 +300,7 @@ H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms,
haddr_t cur_addr;
intn membno;
off_t offset;
- size_t member_size;
+ hsize_t member_size;
FUNC_ENTER(H5F_fam_read, FAIL);
@@ -308,7 +308,7 @@ H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms,
assert(addr && H5F_addr_defined(addr));
assert(buf);
- member_size = (size_t) 1 << lf->u.fam.offset_bits;
+ member_size = (hsize_t) 1 << lf->u.fam.offset_bits;
membno = H5F_FAM_MEMBNO(addr, lf->u.fam.offset_bits);
offset = H5F_FAM_OFFSET(addr, lf->u.fam.offset_bits);
cur_addr = *addr;
@@ -318,7 +318,7 @@ H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms,
HDmemset(buf, 0, size);
break;
} else {
- nbytes = MIN(size, member_size - offset);
+ nbytes = MIN(size, member_size-offset);
cur_addr.offset = offset;
if (H5F_low_read(lf->u.fam.memb[membno],
access_parms->u.fam.memb_access,
@@ -335,6 +335,7 @@ H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms,
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5F_fam_write
@@ -366,7 +367,7 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms,
H5F_low_t *member = NULL;
char member_name[4096];
intn i;
- size_t member_size;
+ hsize_t member_size;
const H5F_low_class_t *memb_type = NULL;
FUNC_ENTER(H5F_fam_write, FAIL);
@@ -385,7 +386,7 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms,
memb_type = H5F_low_class (H5F_LOW_DFLT);
}
- member_size = (size_t) 1 << lf->u.fam.offset_bits;
+ member_size = (hsize_t) 1 << lf->u.fam.offset_bits;
membno = H5F_FAM_MEMBNO(addr, lf->u.fam.offset_bits);
offset = H5F_FAM_OFFSET(addr, lf->u.fam.offset_bits);
cur_addr = *addr;
@@ -431,7 +432,7 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms,
* Make sure the logical eof is large enough to handle the request.
*/
max_addr = cur_addr;
- H5F_addr_inc(&max_addr, nbytes);
+ H5F_addr_inc(&max_addr, (hsize_t)nbytes);
H5F_low_seteof(lf->u.fam.memb[membno], &max_addr);
/* Write the data to the member */
@@ -475,7 +476,7 @@ H5F_fam_flush(H5F_low_t *lf, const H5F_access_t *access_parms)
int membno, nerrors = 0;
uint8 buf[1];
haddr_t addr1, addr2, addr3;
- size_t max_offset;
+ hsize_t max_offset;
FUNC_ENTER(H5F_fam_flush, FAIL);
@@ -491,7 +492,7 @@ H5F_fam_flush(H5F_low_t *lf, const H5F_access_t *access_parms)
H5F_addr_inc(&addr1, max_offset);
H5F_low_size(lf->u.fam.memb[0], &addr2); /*remember logical eof */
addr3 = addr1;
- H5F_addr_inc(&addr3, (size_t) 1);
+ H5F_addr_inc(&addr3, (hsize_t)1);
H5F_low_seteof(lf->u.fam.memb[0], &addr3); /*prevent a warning */
if (H5F_low_read(lf->u.fam.memb[0], access_parms->u.fam.memb_access,
&addr1, 1, buf) < 0) {
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index c737d9d..1f84aab 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -49,10 +49,11 @@ static herr_t H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8 *raw,
static herr_t H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8 *raw,
void *_key);
static herr_t H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout,
- H5F_isop_t op, const size_t offset_f[],
- const size_t size[],
- const size_t offset_m[],
- const size_t size_m[],
+ H5F_isop_t op,
+ const hssize_t offset_f[],
+ const hsize_t size[],
+ const hssize_t offset_m[],
+ const hsize_t size_m[],
void *buf);
/*
@@ -71,8 +72,8 @@ static herr_t H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout,
*/
typedef struct H5F_istore_key_t {
uintn file_number; /*external file number */
- size_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/
- size_t size[H5O_LAYOUT_NDIMS]; /*logical chunk size */
+ hssize_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/
+ hsize_t size[H5O_LAYOUT_NDIMS]; /*logical chunk size */
} H5F_istore_key_t;
typedef struct H5F_istore_ud1_t {
@@ -119,7 +120,7 @@ H5B_class_t H5B_ISTORE[1] = {{
*-------------------------------------------------------------------------
*/
static size_t
-H5F_istore_sizeof_rkey(H5F_t *f __attribute__((unused)), const void *_udata)
+H5F_istore_sizeof_rkey(H5F_t __unused__ *f, const void *_udata)
{
const H5F_istore_ud1_t *udata = (const H5F_istore_ud1_t *) _udata;
size_t nbytes;
@@ -152,7 +153,7 @@ H5F_istore_sizeof_rkey(H5F_t *f __attribute__((unused)), const void *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
+H5F_istore_decode_key(H5F_t __unused__ *f, H5B_t *bt, uint8 *raw, void *_key)
{
H5F_istore_key_t *key = (H5F_istore_key_t *) _key;
intn i;
@@ -196,7 +197,7 @@ H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
+H5F_istore_encode_key(H5F_t __unused__ *f, H5B_t *bt, uint8 *raw, void *_key)
{
H5F_istore_key_t *key = (H5F_istore_key_t *) _key;
intn ndims = (intn)(bt->sizeof_rkey / 8);
@@ -245,8 +246,8 @@ H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
*-------------------------------------------------------------------------
*/
static intn
-H5F_istore_cmp2(H5F_t *f __attribute__((unused)), void *_lt_key,
- void *_udata, void *_rt_key)
+H5F_istore_cmp2(H5F_t __unused__ *f, void *_lt_key, void *_udata,
+ void *_rt_key)
{
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
H5F_istore_key_t *rt_key = (H5F_istore_key_t *) _rt_key;
@@ -261,7 +262,7 @@ H5F_istore_cmp2(H5F_t *f __attribute__((unused)), void *_lt_key,
assert(udata->mesg.ndims > 0 && udata->mesg.ndims <= H5O_LAYOUT_NDIMS);
/* Compare the offsets but ignore the other fields */
- cmp = H5V_vector_cmp(udata->mesg.ndims, lt_key->offset, rt_key->offset);
+ cmp = H5V_vector_cmp_s(udata->mesg.ndims, lt_key->offset, rt_key->offset);
FUNC_LEAVE(cmp);
}
@@ -297,8 +298,8 @@ H5F_istore_cmp2(H5F_t *f __attribute__((unused)), void *_lt_key,
*-------------------------------------------------------------------------
*/
static intn
-H5F_istore_cmp3(H5F_t *f __attribute__((unused)),
- void *_lt_key, void *_udata, void *_rt_key)
+H5F_istore_cmp3(H5F_t __unused__ *f, void *_lt_key, void *_udata,
+ void *_rt_key)
{
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
H5F_istore_key_t *rt_key = (H5F_istore_key_t *) _rt_key;
@@ -312,9 +313,10 @@ H5F_istore_cmp3(H5F_t *f __attribute__((unused)),
assert(udata);
assert(udata->mesg.ndims > 0 && udata->mesg.ndims <= H5O_LAYOUT_NDIMS);
- if (H5V_vector_lt(udata->mesg.ndims, udata->key.offset, lt_key->offset)) {
+ if (H5V_vector_lt_s(udata->mesg.ndims, udata->key.offset,
+ lt_key->offset)) {
cmp = -1;
- } else if (H5V_vector_ge(udata->mesg.ndims, udata->key.offset,
+ } else if (H5V_vector_ge_s(udata->mesg.ndims, udata->key.offset,
rt_key->offset)) {
cmp = 1;
}
@@ -350,7 +352,7 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
H5F_istore_key_t *rt_key = (H5F_istore_key_t *) _rt_key;
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata;
- size_t nbytes;
+ hsize_t nbytes;
intn i;
FUNC_ENTER(H5F_istore_new_node, FAIL);
@@ -391,7 +393,9 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
* a zero-width chunk.
*/
if (H5B_INS_LEFT != op) {
- rt_key->offset[i] = udata->key.offset[i] + udata->key.size[i];
+ assert (udata->key.size[i] < MAX_HSSIZET);
+ rt_key->offset[i] = udata->key.offset[i] +
+ (hssize_t)udata->key.size[i];
rt_key->size[i] = 0;
}
}
@@ -423,8 +427,9 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_found(H5F_t *f, const haddr_t *addr, const void *_lt_key,
- void *_udata, const void *_rt_key __attribute__((unused)))
+H5F_istore_found(H5F_t __unused__ *f, const haddr_t *addr,
+ const void *_lt_key, void *_udata,
+ const void __unused__ *_rt_key)
{
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata;
const H5F_istore_key_t *lt_key = (const H5F_istore_key_t *) _lt_key;
@@ -483,10 +488,10 @@ H5F_istore_found(H5F_t *f, const haddr_t *addr, const void *_lt_key,
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5F_istore_insert(H5F_t *f, const haddr_t *addr,
- void *_lt_key, hbool_t *lt_key_changed,
- void *_md_key, void *_udata,
- void *_rt_key, hbool_t *rt_key_changed,
+H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
+ hbool_t __unused__ *lt_key_changed,
+ void *_md_key, void *_udata, void *_rt_key,
+ hbool_t __unused__ *rt_key_changed,
haddr_t *new_node/*out*/)
{
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
@@ -495,7 +500,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr,
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata;
intn i, cmp;
H5B_ins_t ret_value = H5B_INS_ERROR;
- size_t nbytes;
+ hsize_t nbytes;
FUNC_ENTER(H5F_istore_insert, H5B_INS_ERROR);
@@ -541,7 +546,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr,
* current node. The MD_KEY is where the split occurs.
*/
md_key->file_number = udata->key.file_number;
- for (i = 0, nbytes = 1; i < udata->mesg.ndims; i++) {
+ for (i=0, nbytes=1; i<udata->mesg.ndims; i++) {
assert(0 == udata->key.offset[i] % udata->mesg.dim[i]);
assert(udata->key.size[i] == udata->mesg.dim[i]);
md_key->offset[i] = udata->key.offset[i];
@@ -604,18 +609,19 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr,
*/
static herr_t
H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
- const size_t offset_f[], const size_t size[],
- const size_t offset_m[], const size_t size_m[],
+ const hssize_t offset_f[], const hsize_t size[],
+ const hssize_t offset_m[], const hsize_t size_m[],
void *buf/*in or out*/)
{
intn i, carry;
- size_t idx_cur[H5O_LAYOUT_NDIMS];
- size_t idx_min[H5O_LAYOUT_NDIMS];
- size_t idx_max[H5O_LAYOUT_NDIMS];
- size_t sub_size[H5O_LAYOUT_NDIMS];
- size_t offset_wrt_chunk[H5O_LAYOUT_NDIMS];
- size_t sub_offset_m[H5O_LAYOUT_NDIMS];
+ hsize_t idx_cur[H5O_LAYOUT_NDIMS];
+ hsize_t idx_min[H5O_LAYOUT_NDIMS];
+ hsize_t idx_max[H5O_LAYOUT_NDIMS];
+ hsize_t sub_size[H5O_LAYOUT_NDIMS];
+ hssize_t offset_wrt_chunk[H5O_LAYOUT_NDIMS];
+ hssize_t sub_offset_m[H5O_LAYOUT_NDIMS];
size_t chunk_size;
+ hsize_t acc;
uint8 *chunk = NULL;
H5F_istore_ud1_t udata;
herr_t status;
@@ -649,14 +655,16 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
* destination.
*/
if (H5F_ISTORE_READ==op) {
- for (i=0, chunk_size=1; i<layout->ndims; i++) {
+ for (i=0, acc=1; i<layout->ndims; i++) {
if (offset_f[i] % layout->dim[i]) break; /*src not aligned*/
if (size[i]!=layout->dim[i]) break; /*src not a chunk*/
if (size_m[i]!=layout->dim[i]) break; /*dst not a chunk*/
udata.key.offset[i] = offset_f[i];
udata.key.size[i] = layout->dim[i];
- chunk_size *= layout->dim[i];
+ acc *= layout->dim[i];
}
+ chunk_size = acc;
+ assert ((hsize_t)chunk_size==acc);
if (i==layout->ndims) {
udata.mesg = *layout;
@@ -665,7 +673,8 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
status = H5B_find (f, H5B_ISTORE, &(layout->addr), &udata);
if (status>=0 && H5F_addr_defined (&(udata.addr))) {
assert (0==udata.key.file_number);
- if (H5F_block_read (f, &(udata.addr), chunk_size, buf)<0) {
+ if (H5F_block_read (f, &(udata.addr), (hsize_t)chunk_size,
+ buf)<0) {
HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL,
"unable to read raw storage chunk");
}
@@ -708,11 +717,12 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
for (i=0; i<layout->ndims; i++) {
/* The location and size of the chunk being accessed */
- udata.key.offset[i] = idx_cur[i] * layout->dim[i];
+ assert (layout->dim[i] < MAX_HSSIZET);
+ udata.key.offset[i] = idx_cur[i] * (hssize_t)(layout->dim[i]);
udata.key.size[i] = layout->dim[i];
/* The offset and size wrt the chunk */
- offset_wrt_chunk[i] = MAX((offset_f ? offset_f[i] : 0),
+ offset_wrt_chunk[i] = MAX((offset_f?offset_f[i]:0),
udata.key.offset[i]) -
udata.key.offset[i];
sub_size[i] = MIN((idx_cur[i] + 1) * layout->dim[i],
@@ -737,11 +747,12 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
* partial chunk then load the chunk from disk.
*/
if (H5F_ISTORE_READ == op ||
- !H5V_vector_zerop(layout->ndims, offset_wrt_chunk) ||
- !H5V_vector_eq(layout->ndims, sub_size, udata.key.size)) {
+ !H5V_vector_zerop_s(layout->ndims, offset_wrt_chunk) ||
+ !H5V_vector_eq_u(layout->ndims, sub_size, udata.key.size)) {
if (status>=0 && H5F_addr_defined(&(udata.addr))) {
assert(0==udata.key.file_number);
- if (H5F_block_read(f, &(udata.addr), chunk_size, chunk) < 0) {
+ if (H5F_block_read(f, &(udata.addr), (hsize_t)chunk_size,
+ chunk) < 0) {
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL,
"unable to read raw storage chunk");
}
@@ -755,7 +766,8 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
udata.key.size, offset_wrt_chunk, chunk,
size_m, sub_offset_m, buf);
assert(0 == udata.key.file_number);
- if (H5F_block_write(f, &(udata.addr), chunk_size, chunk) < 0) {
+ if (H5F_block_write(f, &(udata.addr), (hsize_t)chunk_size,
+ chunk) < 0) {
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"unable to write raw storage chunk");
}
@@ -799,7 +811,7 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op,
*/
herr_t
H5F_istore_read(H5F_t *f, const H5O_layout_t *layout,
- const size_t offset[], const size_t size[], void *buf)
+ const hssize_t offset[], const hsize_t size[], void *buf)
{
FUNC_ENTER(H5F_istore_read, FAIL);
@@ -838,7 +850,7 @@ H5F_istore_read(H5F_t *f, const H5O_layout_t *layout,
*/
herr_t
H5F_istore_write(H5F_t *f, const H5O_layout_t *layout,
- const size_t offset[], const size_t size[],
+ const hssize_t offset[], const hsize_t size[],
const void *buf)
{
FUNC_ENTER(H5F_istore_write, FAIL);
diff --git a/src/H5Flow.c b/src/H5Flow.c
index f29b7d3..5074815 100644
--- a/src/H5Flow.c
+++ b/src/H5Flow.c
@@ -1,14 +1,14 @@
/*
* Copyright (C) 1997 NCSA
- * All rights reserved.
+ * All rights reserved.
*
* Programmer: Robb Matzke <matzke@viper.llnl.gov>
- * Wednesday, October 22, 1997
+ * Wednesday, October 22, 1997
*
- * Purpose: This file contains virtual functions for the H5F_low
- * class. These are functions that operate on various kinds
- * of files at a level where the file is just a one-dimensional
- * array of bytes.
+ * Purpose: This file contains virtual functions for the H5F_low
+ * class. These are functions that operate on various kinds
+ * of files at a level where the file is just a one-dimensional
+ * array of bytes.
*/
#include <H5private.h>
#include <H5Eprivate.h>
@@ -20,8 +20,8 @@
#define addr_defined(X) (((uint64)(-1)!=(X)->offset) ? TRUE : FALSE)
-#define PABLO_MASK H5F_low
-static hbool_t interface_initialize_g = FALSE;
+#define PABLO_MASK H5F_low
+static hbool_t interface_initialize_g = FALSE;
#define INTERFACE_INIT NULL
@@ -36,7 +36,7 @@ static hbool_t interface_initialize_g = FALSE;
* Failure: NULL
*
* Programmer: Robb Matzke
- * Wednesday, February 18, 1998
+ * Wednesday, February 18, 1998
*
* Modifications:
*
@@ -86,43 +86,43 @@ H5F_low_class (H5F_driver_t driver)
/*-------------------------------------------------------------------------
- * Function: H5F_low_open
+ * Function: H5F_low_open
*
- * Purpose: Opens a file of type TYPE with name NAME according to the
- * field of bit flags FLAGS which are:
- *
- * H5F_ACC_WRITE: The file is open for read/write access.
- * Without this bit set, the file would be open
- * for read-only access.
+ * Purpose: Opens a file of type TYPE with name NAME according to the
+ * field of bit flags FLAGS which are:
+ *
+ * H5F_ACC_WRITE: The file is open for read/write access.
+ * Without this bit set, the file would be open
+ * for read-only access.
*
- * H5F_ACC_CREAT: The file is created if it doesn't already
- * exist. On unix, the file permissions are set
- * to 0666 modified by the umask.
+ * H5F_ACC_CREAT: The file is created if it doesn't already
+ * exist. On unix, the file permissions are set
+ * to 0666 modified by the umask.
*
- * H5F_ACC_EXCL: This function will fail if the file already
- * exists.
+ * H5F_ACC_EXCL: This function will fail if the file already
+ * exists.
*
- * H5F_ACC_TRUNC: Truncate the file to a zero-length file as it
- * is opened. This allows existing files to be
- * overwritten.
+ * H5F_ACC_TRUNC: Truncate the file to a zero-length file as it
+ * is opened. This allows existing files to be
+ * overwritten.
*
- * The KEY argument is initialized with data which is unique to
- * this file. Opening the same file (even by a different name)
- * should return the same key.
+ * The KEY argument is initialized with data which is unique to
+ * this file. Opening the same file (even by a different name)
+ * should return the same key.
*
- * This is a virtual function only; the actual open operation is
- * performed by the subclass. This function will fail if the
- * subclass hasn't defined an open method.
+ * This is a virtual function only; the actual open operation is
+ * performed by the subclass. This function will fail if the
+ * subclass hasn't defined an open method.
*
* Errors:
- * IO CANTOPENFILE Open failed.
+ * IO CANTOPENFILE Open failed.
*
- * Return: Success: Pointer to the new file descriptor.
+ * Return: Success: Pointer to the new file descriptor.
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
- * Wednesday, October 22, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 22, 1997
*
* Modifications:
*
@@ -133,7 +133,7 @@ H5F_low_open(const H5F_low_class_t *type, const char *name,
const H5F_access_t *access_parms, uintn flags,
H5F_search_t *key/*out*/)
{
- H5F_low_t *lf = NULL;
+ H5F_low_t *lf = NULL;
FUNC_ENTER(H5F_low_open, NULL);
@@ -141,7 +141,7 @@ H5F_low_open(const H5F_low_class_t *type, const char *name,
assert(name && *name);
if (NULL == (lf = (type->open) (name, access_parms, flags, key))) {
- HRETURN_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed");
+ HRETURN_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "open failed");
}
lf->type = type;
@@ -149,28 +149,28 @@ H5F_low_open(const H5F_low_class_t *type, const char *name,
}
/*-------------------------------------------------------------------------
- * Function: H5F_low_close
+ * Function: H5F_low_close
*
- * Purpose: Closes a low-level file. The subclass should free all
- * resources used by the file descriptor but should not free the
- * file descriptor itself. The close method in the subclass is
- * optional; lack of a close method results in only the file
- * descriptor being freed.
+ * Purpose: Closes a low-level file. The subclass should free all
+ * resources used by the file descriptor but should not free the
+ * file descriptor itself. The close method in the subclass is
+ * optional; lack of a close method results in only the file
+ * descriptor being freed.
*
- * It is safe to call this function with a null pointer for the
- * file descriptor. This function returns a null pointer that
- * the caller can assign to the file descriptor pointer as it's
- * closed like `desc=H5F_low_close(desc)'.
+ * It is safe to call this function with a null pointer for the
+ * file descriptor. This function returns a null pointer that
+ * the caller can assign to the file descriptor pointer as it's
+ * closed like `desc=H5F_low_close(desc)'.
*
* Errors:
- * IO CLOSEERROR Close failed.
+ * IO CLOSEERROR Close failed.
*
- * Return: Success: NULL
+ * Return: Success: NULL
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
- * Wednesday, October 22, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 22, 1997
*
* Modifications:
*
@@ -182,36 +182,36 @@ H5F_low_close(H5F_low_t *lf, const H5F_access_t *access_parms)
FUNC_ENTER(H5F_low_close, NULL);
if (lf) {
- if ((lf->type->close) (lf, access_parms) < 0) {
- H5MM_xfree(lf);
- HRETURN_ERROR(H5E_IO, H5E_CLOSEERROR, NULL, "close failed");
- }
- H5MM_xfree(lf);
+ if ((lf->type->close) (lf, access_parms) < 0) {
+ H5MM_xfree(lf);
+ HRETURN_ERROR(H5E_IO, H5E_CLOSEERROR, NULL, "close failed");
+ }
+ H5MM_xfree(lf);
}
FUNC_LEAVE(NULL);
}
/*-------------------------------------------------------------------------
- * Function: H5F_low_read
+ * Function: H5F_low_read
*
- * Purpose: Reads SIZE bytes of data beginning at address ADDR of the
- * file LF and puts the result in BUF. Behavior when reading
- * past the logical or physical end of file is to return zeros
- * for that part of the request.
+ * Purpose: Reads SIZE bytes of data beginning at address ADDR of the
+ * file LF and puts the result in BUF. Behavior when reading
+ * past the logical or physical end of file is to return zeros
+ * for that part of the request.
*
- * This is only a virtual function; the subclass must define a
- * read method or this function will fail.
+ * This is only a virtual function; the subclass must define a
+ * read method or this function will fail.
*
* Errors:
- * IO READERROR Read failed.
- * IO UNSUPPORTED No read method.
+ * IO READERROR Read failed.
+ * IO UNSUPPORTED No read method.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 22, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 22, 1997
*
* Modifications:
*
@@ -221,7 +221,7 @@ herr_t
H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms,
const haddr_t *addr, size_t size, uint8 *buf/*out*/)
{
- herr_t ret_value = FAIL;
+ herr_t ret_value = FAIL;
FUNC_ENTER(H5F_low_read, FAIL);
@@ -230,37 +230,37 @@ H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms,
assert(buf);
if (lf->type->read) {
- if ((ret_value = (lf->type->read) (lf, access_parms, addr, size,
+ if ((ret_value = (lf->type->read) (lf, access_parms, addr, size,
buf)) < 0) {
- HRETURN_ERROR(H5E_IO, H5E_READERROR, ret_value, "read failed");
- }
+ HRETURN_ERROR(H5E_IO, H5E_READERROR, ret_value, "read failed");
+ }
} else {
- HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "no read method");
+ HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "no read method");
}
FUNC_LEAVE(ret_value);
}
/*-------------------------------------------------------------------------
- * Function: H5F_low_write
+ * Function: H5F_low_write
*
- * Purpose: Writes SIZE bytes of data from BUF into the file LF beginning
- * at address ADDR of the file. Writing past the logical or
- * physical end of file causes the file to be extended.
+ * Purpose: Writes SIZE bytes of data from BUF into the file LF beginning
+ * at address ADDR of the file. Writing past the logical or
+ * physical end of file causes the file to be extended.
*
- * This is a virtual function only; if the subclass doesn't
- * define a write method then this function will fail.
+ * This is a virtual function only; if the subclass doesn't
+ * define a write method then this function will fail.
*
* Errors:
- * IO UNSUPPORTED No write method.
- * IO WRITEERROR Write failed.
+ * IO UNSUPPORTED No write method.
+ * IO WRITEERROR Write failed.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 22, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 22, 1997
*
* Modifications:
*
@@ -270,8 +270,8 @@ herr_t
H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms,
const haddr_t *addr, size_t size, const uint8 *buf)
{
- herr_t ret_value = FAIL;
- haddr_t tmp_addr;
+ herr_t ret_value = FAIL;
+ haddr_t tmp_addr;
FUNC_ENTER(H5F_low_write, FAIL);
@@ -281,43 +281,45 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms,
/* Extend the file eof marker if we write past it */
tmp_addr = *addr;
- H5F_addr_inc(&tmp_addr, size);
+ H5F_addr_inc(&tmp_addr, (hsize_t)size);
if (H5F_addr_gt(&tmp_addr, &(lf->eof))) {
- fprintf(stderr, "H5F: extending file w/o allocation\n");
- lf->eof = tmp_addr;
+ fprintf(stderr, "H5F: extending file w/o allocation\n");
+ lf->eof = tmp_addr;
}
+
/* Write the data */
if (lf->type->write) {
- if ((ret_value = (lf->type->write) (lf, access_parms, addr, size,
+ if ((ret_value = (lf->type->write) (lf, access_parms, addr, size,
buf)) < 0) {
- HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, ret_value, "write failed");
- }
+ HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, ret_value, "write failed");
+ }
} else {
- HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "no write method");
+ HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "no write method");
}
FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
- * Function: H5F_low_flush
+ * Function: H5F_low_flush
*
- * Purpose: Flushes file buffers to disk. For instance, the stdio.h
- * driver would call fflush(). Flushing also insures that the
- * file exists to the current logical EOF (the library maintains
- * a notion of EOF which is independent of the physical EOF) by
- * reading and writing the last byte. On some systems, this
- * allocates a single block at the end of the file while on
- * other systems it allocates all blocks up to the end of the
- * file. Extending the physical file is necessary because
- * H5F_open() checks for truncated files.
+ * Purpose: Flushes file buffers to disk. For instance, the stdio.h
+ * driver would call fflush(). Flushing also insures that the
+ * file exists to the current logical EOF (the library maintains
+ * a notion of EOF which is independent of the physical EOF) by
+ * reading and writing the last byte. On some systems, this
+ * allocates a single block at the end of the file while on
+ * other systems it allocates all blocks up to the end of the
+ * file. Extending the physical file is necessary because
+ * H5F_open() checks for truncated files.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Monday, November 10, 1997
+ * Programmer: Robb Matzke
+ * Monday, November 10, 1997
*
* Modifications:
*
@@ -326,8 +328,8 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms,
herr_t
H5F_low_flush(H5F_low_t *lf, const H5F_access_t *access_parms)
{
- haddr_t last_byte;
- uint8 buf[1];
+ haddr_t last_byte;
+ uint8 buf[1];
FUNC_ENTER(H5F_low_flush, FAIL);
@@ -336,58 +338,59 @@ H5F_low_flush(H5F_low_t *lf, const H5F_access_t *access_parms)
/* Make sure the last block of the file has been allocated on disk */
H5F_addr_reset(&last_byte);
if (addr_defined(&(lf->eof)) && H5F_addr_gt(&(lf->eof), &last_byte)) {
- last_byte = lf->eof;
- last_byte.offset -= 1;
- if (H5F_low_read(lf, access_parms, &last_byte, 1, buf) >= 0) {
- H5F_low_write(lf, access_parms, &last_byte, 1, buf);
- }
+ last_byte = lf->eof;
+ last_byte.offset -= 1;
+ if (H5F_low_read(lf, access_parms, &last_byte, 1, buf) >= 0) {
+ H5F_low_write(lf, access_parms, &last_byte, 1, buf);
+ }
}
/* Invoke the subclass the flush method */
if (lf->type->flush) {
- if ((lf->type->flush) (lf, access_parms) < 0) {
- HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
- "low level flush failed");
- }
+ if ((lf->type->flush) (lf, access_parms) < 0) {
+ HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
+ "low level flush failed");
+ }
}
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
- * Function: H5F_low_size
- *
- * Purpose: Returns the current logical size of the file in bytes. This
- * may differ from the physical size of the file (most
- * subclasses extend the physical file size during the write
- * operation instead of the alloc operation).
- *
- * The next absolute file address is returned through the
- * EOF argument. This is the address of the logical end of
- * file (that is, the address of the first byte past the last
- * byte which is logically in the file).
- *
- * Warning: The return value type (size_t) may not be large enough to
- * represent the true size of the file. In such cases, the
- * maximum possible size is returned. It is better to look at
- * the EOF output argument to determine the total size.
+ * Function: H5F_low_size
+ *
+ * Purpose: Returns the current logical size of the file in bytes. This
+ * may differ from the physical size of the file (most
+ * subclasses extend the physical file size during the write
+ * operation instead of the alloc operation).
+ *
+ * The next absolute file address is returned through the
+ * EOF argument. This is the address of the logical end of
+ * file (that is, the address of the first byte past the last
+ * byte which is logically in the file).
+ *
+ * Warning: The return value type may not be large enough to represent
+ * the true size of the file. In such cases, the maximum
+ * possible size is returned. It is better to look at the EOF
+ * output argument to determine the total size.
*
* Errors:
- * IO UNSUPPORTED No size method.
+ * IO UNSUPPORTED No size method.
*
- * Return: Success: Current size of file
+ * Return: Success: Current size of file
*
- * Failure: 0
+ * Failure: 0
*
- * Programmer: Robb Matzke
- * Wednesday, October 22, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 22, 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
-size_t
-H5F_low_size(H5F_low_t *lf, haddr_t *eof /*out */ )
+hsize_t
+H5F_low_size(H5F_low_t *lf, haddr_t *eof/*out*/)
{
- size_t size = (size_t) (-1); /*max possible size */
+ hsize_t size = (hsize_t)(-1); /*max possible size */
FUNC_ENTER(H5F_low_size, 0);
@@ -395,41 +398,41 @@ H5F_low_size(H5F_low_t *lf, haddr_t *eof /*out */ )
assert(eof);
*eof = lf->eof;
- if (eof->offset < size)
- size = eof->offset;
+ if (eof->offset < size) size = eof->offset;
FUNC_LEAVE(size);
}
+
/*-------------------------------------------------------------------------
- * Function: H5F_low_access
+ * Function: H5F_low_access
*
- * Purpose: Determines if a file can be accessed in a particular way by a
- * particular subclass. The access modes for a file are the
- * same as those of access(2), namely
+ * Purpose: Determines if a file can be accessed in a particular way by a
+ * particular subclass. The access modes for a file are the
+ * same as those of access(2), namely
*
- * F_OK: determines if the file (or all parts of a multi-part
- * file) exists.
+ * F_OK: determines if the file (or all parts of a multi-part
+ * file) exists.
*
- * R_OK: determines if the file (or all parts of a multi-part
- * file) are readable.
+ * R_OK: determines if the file (or all parts of a multi-part
+ * file) are readable.
*
- * W_OK: determines if the file (or all parts of a multi-part
- * file) are writable.
+ * W_OK: determines if the file (or all parts of a multi-part
+ * file) are writable.
*
- * If a subclass doesn't define an access method, then we treat
- * the name as if it were a local Unix file and test
- * accessibility with the access(2) function. The KEY is
- * returned as a device number and i-node pair.
+ * If a subclass doesn't define an access method, then we treat
+ * the name as if it were a local Unix file and test
+ * accessibility with the access(2) function. The KEY is
+ * returned as a device number and i-node pair.
*
- * Return: Success: TRUE or FALSE. If TRUE, then KEY is
- * initialized with data that makes this file
- * unique (same value as H5F_low_open).
+ * Return: Success: TRUE or FALSE. If TRUE, then KEY is
+ * initialized with data that makes this file
+ * unique (same value as H5F_low_open).
*
- * Failure: FAIL, KEY is undefined.
+ * Failure: FAIL, KEY is undefined.
*
- * Programmer: Robb Matzke
- * Friday, October 24, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 24, 1997
*
* Modifications:
*
@@ -438,45 +441,45 @@ H5F_low_size(H5F_low_t *lf, haddr_t *eof /*out */ )
hbool_t
H5F_low_access(const H5F_low_class_t *type, const char *name,
const H5F_access_t *access_parms, int mode,
- H5F_search_t *key/*out*/)
+ H5F_search_t *key/*out*/)
{
- hbool_t ret_value;
- struct stat sb;
+ hbool_t ret_value;
+ struct stat sb;
FUNC_ENTER(H5F_low_size, FAIL);
assert(type);
if (type->access) {
- ret_value = (type->access) (name, access_parms, mode, key /*out*/);
+ ret_value = (type->access) (name, access_parms, mode, key /*out*/);
} else {
- ret_value = (0 == access(name, mode) ? TRUE : FALSE);
- if (key) {
- stat(name, &sb);
- key->dev = sb.st_dev;
- key->ino = sb.st_ino;
- }
+ ret_value = (0 == access(name, mode) ? TRUE : FALSE);
+ if (key) {
+ stat(name, &sb);
+ key->dev = sb.st_dev;
+ key->ino = sb.st_ino;
+ }
}
FUNC_LEAVE(ret_value);
}
/*-------------------------------------------------------------------------
- * Function: H5F_low_extend
+ * Function: H5F_low_extend
*
- * Purpose: Increases the logical size of a file by moving the logical
- * end of file marker. A subclass can override this function by
- * providing its own allocation method.
+ * Purpose: Increases the logical size of a file by moving the logical
+ * end of file marker. A subclass can override this function by
+ * providing its own allocation method.
*
- * Return: Success: SUCCEED, the address of the old end-of-file
- * is returned through the ADDR argument and the
- * logical size of the file has been extended by
- * SIZE bytes.
+ * Return: Success: SUCCEED, the address of the old end-of-file
+ * is returned through the ADDR argument and the
+ * logical size of the file has been extended by
+ * SIZE bytes.
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Thursday, November 13, 1997
+ * Programmer: Robb Matzke
+ * Thursday, November 13, 1997
*
* Modifications:
*
@@ -484,7 +487,7 @@ H5F_low_access(const H5F_low_class_t *type, const char *name,
*/
herr_t
H5F_low_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op,
- size_t size, haddr_t *addr/*out*/)
+ hsize_t size, haddr_t *addr/*out*/)
{
FUNC_ENTER(H5F_low_alloc, FAIL);
@@ -493,29 +496,29 @@ H5F_low_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op,
assert(addr);
if (lf->type->extend) {
- if ((lf->type->extend) (lf, access_parms, op, size, addr/*out*/) < 0) {
- HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "unable to extend file");
- }
+ if ((lf->type->extend) (lf, access_parms, op, size, addr/*out*/) < 0) {
+ HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "unable to extend file");
+ }
} else {
- *addr = lf->eof;
- H5F_addr_inc(&(lf->eof), size);
+ *addr = lf->eof;
+ H5F_addr_inc(&(lf->eof), size);
}
FUNC_LEAVE(SUCCEED);
}
/*-------------------------------------------------------------------------
- * Function: H5F_low_seteof
+ * Function: H5F_low_seteof
*
- * Purpose: Sets the logical end-of-file to the specified address.
+ * Purpose: Sets the logical end-of-file to the specified address.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Thursday, November 13, 1997
+ * Programmer: Robb Matzke
+ * Thursday, November 13, 1997
*
* Modifications:
*
@@ -535,18 +538,18 @@ H5F_low_seteof(H5F_low_t *lf, const haddr_t *addr)
}
/*-------------------------------------------------------------------------
- * Function: H5F_addr_cmp
+ * Function: H5F_addr_cmp
*
- * Purpose: Compares two addresses.
+ * Purpose: Compares two addresses.
*
- * Return: Success: <0 if A1<A2
- * =0 if A1=A2
- * >0 if A1>A2
+ * Return: Success: <0 if A1<A2
+ * =0 if A1=A2
+ * >0 if A1>A2
*
- * Failure: never fails
+ * Failure: never fails
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
@@ -561,22 +564,22 @@ H5F_addr_cmp(const haddr_t *a1, const haddr_t *a2)
assert(a2 && addr_defined(a2));
if (a1->offset < a2->offset)
- HRETURN(-1);
+ HRETURN(-1);
if (a1->offset > a2->offset)
- HRETURN(1);
+ HRETURN(1);
FUNC_LEAVE(0);
}
/*-------------------------------------------------------------------------
- * Function: H5F_addr_undef
+ * Function: H5F_addr_undef
*
- * Purpose: Cause an address to become undefined.
+ * Purpose: Cause an address to become undefined.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
@@ -591,16 +594,16 @@ H5F_addr_undef(haddr_t *addr /*out */ )
}
/*-------------------------------------------------------------------------
- * Function: H5F_addr_defined
+ * Function: H5F_addr_defined
*
- * Purpose: Determines if an address has a defined value.
+ * Purpose: Determines if an address has a defined value.
*
- * Return: Success: TRUE or FALSE
+ * Return: Success: TRUE or FALSE
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
@@ -614,14 +617,14 @@ H5F_addr_defined(const haddr_t *addr)
}
/*-------------------------------------------------------------------------
- * Function: H5F_addr_reset
+ * Function: H5F_addr_reset
*
- * Purpose: Reset the address to zero.
+ * Purpose: Reset the address to zero.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
@@ -635,16 +638,16 @@ H5F_addr_reset(haddr_t *addr/*out*/)
}
/*-------------------------------------------------------------------------
- * Function: H5F_addr_zerop
+ * Function: H5F_addr_zerop
*
- * Purpose: Determines if an address is zero.
+ * Purpose: Determines if an address is zero.
*
- * Return: Success: TRUE or FALSE
+ * Return: Success: TRUE or FALSE
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
@@ -658,16 +661,16 @@ H5F_addr_zerop(const haddr_t *addr)
}
/*-------------------------------------------------------------------------
- * Function: H5F_addr_encode
+ * Function: H5F_addr_encode
*
- * Purpose: Encodes an address into the buffer pointed to by *PP and
- * then increments the pointer to the first byte after the
- * address. An undefined value is stored as all 1's.
+ * Purpose: Encodes an address into the buffer pointed to by *PP and
+ * then increments the pointer to the first byte after the
+ * address. An undefined value is stored as all 1's.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
@@ -676,42 +679,42 @@ H5F_addr_zerop(const haddr_t *addr)
void
H5F_addr_encode(H5F_t *f, uint8 **pp, const haddr_t *addr)
{
- uint i;
- haddr_t tmp;
+ uint i;
+ haddr_t tmp;
assert(f);
assert(pp && *pp);
assert(addr);
if (addr_defined(addr)) {
- tmp = *addr;
- for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
- *(*pp)++ = (uint8)(tmp.offset & 0xff);
- tmp.offset >>= 8;
- }
- assert("overflow" && 0 == tmp.offset);
+ tmp = *addr;
+ for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
+ *(*pp)++ = (uint8)(tmp.offset & 0xff);
+ tmp.offset >>= 8;
+ }
+ assert("overflow" && 0 == tmp.offset);
} else {
- for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
- *(*pp)++ = 0xff;
- }
+ for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
+ *(*pp)++ = 0xff;
+ }
}
}
/*-------------------------------------------------------------------------
- * Function: H5F_addr_decode
+ * Function: H5F_addr_decode
*
- * Purpose: Decodes an address from the buffer pointed to by *PP and
- * updates the pointer to point to the next byte after the
- * address.
+ * Purpose: Decodes an address from the buffer pointed to by *PP and
+ * updates the pointer to point to the next byte after the
+ * address.
*
- * If the value read is all 1's then the address is returned
- * with an undefined value.
+ * If the value read is all 1's then the address is returned
+ * with an undefined value.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
@@ -720,10 +723,10 @@ H5F_addr_encode(H5F_t *f, uint8 **pp, const haddr_t *addr)
void
H5F_addr_decode(H5F_t *f, const uint8 **pp, haddr_t *addr/*out*/)
{
- uint i;
- haddr_t tmp;
- uint8 c;
- hbool_t all_zero = TRUE;
+ uint i;
+ haddr_t tmp;
+ uint8 c;
+ hbool_t all_zero = TRUE;
assert(f);
assert(pp && *pp);
@@ -732,29 +735,29 @@ H5F_addr_decode(H5F_t *f, const uint8 **pp, haddr_t *addr/*out*/)
addr->offset = 0;
for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
- c = *(*pp)++;
- if (c != 0xff) all_zero = FALSE;
-
- if (i<sizeof(addr->offset)) {
- tmp.offset = c;
- tmp.offset <<= i * 8; /*use tmp to get casting right */
- addr->offset |= tmp.offset;
- } else if (!all_zero) {
- assert(0 == **pp); /*overflow */
- }
+ c = *(*pp)++;
+ if (c != 0xff) all_zero = FALSE;
+
+ if (i<sizeof(addr->offset)) {
+ tmp.offset = c;
+ tmp.offset <<= i * 8; /*use tmp to get casting right */
+ addr->offset |= tmp.offset;
+ } else if (!all_zero) {
+ assert(0 == **pp); /*overflow */
+ }
}
if (all_zero) H5F_addr_undef(addr);
}
/*-------------------------------------------------------------------------
- * Function: H5F_addr_print
+ * Function: H5F_addr_print
*
- * Purpose: Print an address
+ * Purpose: Print an address
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
@@ -769,35 +772,35 @@ H5F_addr_print(FILE *stream, const haddr_t *addr)
assert(addr);
if (addr_defined(addr)) {
- /*
- * It would be nice if we could use the `%Lu', `%llu', or `%qu', but
- * we don't know which is supported. So we split the address into a
- * low 4-bytes and a high 4-bytes. If the high 4-bytes are non-zero
- * then we print the address in hexadecimal, otherwise we use decimal.
- */
- tmp = *addr;
- tmp.offset >>= 32;
- if (tmp.offset) {
- fprintf(stream, "0x%08lx%08lx",
- (unsigned long) (tmp.offset),
- (unsigned long) (addr->offset & 0xffffffff));
- } else {
- fprintf(stream, "%lu", (unsigned long) (addr->offset));
- }
+ /*
+ * It would be nice if we could use the `%Lu', `%llu', or `%qu', but
+ * we don't know which is supported. So we split the address into a
+ * low 4-bytes and a high 4-bytes. If the high 4-bytes are non-zero
+ * then we print the address in hexadecimal, otherwise we use decimal.
+ */
+ tmp = *addr;
+ tmp.offset >>= 32;
+ if (tmp.offset) {
+ fprintf(stream, "0x%08lx%08lx",
+ (unsigned long) (tmp.offset),
+ (unsigned long) (addr->offset & 0xffffffff));
+ } else {
+ fprintf(stream, "%lu", (unsigned long) (addr->offset));
+ }
} else {
- fprintf(stream, "UNDEF");
+ fprintf(stream, "UNDEF");
}
}
/*-------------------------------------------------------------------------
- * Function: H5F_addr_pow2
+ * Function: H5F_addr_pow2
*
- * Purpose: Returns an address which is a power of two.
+ * Purpose: Returns an address which is a power of two.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
@@ -814,21 +817,21 @@ H5F_addr_pow2(uintn n, haddr_t *addr /*out */ )
}
/*-------------------------------------------------------------------------
- * Function: H5F_addr_inc
+ * Function: H5F_addr_inc
*
- * Purpose: Increments an address by some number of bytes.
+ * Purpose: Increments an address by some number of bytes.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void
-H5F_addr_inc(haddr_t *addr/*in,out */, size_t inc)
+H5F_addr_inc(haddr_t *addr/*in,out*/, hsize_t inc)
{
assert(addr && addr_defined(addr));
assert(addr->offset <= addr->offset + inc);
@@ -845,14 +848,14 @@ H5F_addr_inc(haddr_t *addr/*in,out */, size_t inc)
* Return: void
*
* Programmer: Robb Matzke
- * Monday, April 6, 1998
+ * Monday, April 6, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void
-H5F_addr_adj(haddr_t *addr/*in,out */, ssize_t adj)
+H5F_addr_adj(haddr_t *addr/*in,out */, hssize_t adj)
{
#ifndef NDEBUG
assert(addr && addr_defined(addr));
@@ -868,14 +871,14 @@ H5F_addr_adj(haddr_t *addr/*in,out */, ssize_t adj)
/*-------------------------------------------------------------------------
- * Function: H5F_addr_add
+ * Function: H5F_addr_add
*
- * Purpose: Adds two addresses and puts the result in the first argument.
+ * Purpose: Adds two addresses and puts the result in the first argument.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
@@ -890,17 +893,17 @@ H5F_addr_add(haddr_t *a1 /*in,out */ , const haddr_t *a2)
}
/*-------------------------------------------------------------------------
- * Function: H5F_addr_hash
+ * Function: H5F_addr_hash
*
- * Purpose: Computes a hash value of an address between 0 and MOD-1,
- * inclusive.
+ * Purpose: Computes a hash value of an address between 0 and MOD-1,
+ * inclusive.
*
- * Return: Success: The hash value
+ * Return: Success: The hash value
*
- * Failure: never fails
+ * Failure: never fails
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
*
* Modifications:
*
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 23046b0..9c9e26e 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -223,7 +223,7 @@
* File-creation property list.
*/
typedef struct H5F_create_t {
- size_t userblock_size; /* Size of the file user block in bytes */
+ hsize_t userblock_size; /* Size of the file user block in bytes */
intn sym_leaf_k; /* 1/2 rank for symbol table leaf nodes */
intn btree_k[8]; /* 1/2 rank for btree internal nodes */
size_t sizeof_addr; /* Number of bytes in an address */
@@ -307,7 +307,7 @@ typedef struct H5F_low_class_t {
const H5F_access_t *access_parms);
herr_t (*extend)(struct H5F_low_t *lf,
const H5F_access_t *access_parms,
- intn op, size_t size, haddr_t *addr);
+ intn op, hsize_t size, haddr_t *addr);
} H5F_low_class_t;
typedef struct H5F_low_t {
@@ -479,32 +479,32 @@ herr_t H5F_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
/* Functions that operate on array storage */
herr_t H5F_arr_create(H5F_t *f, struct H5O_layout_t *layout /*in,out*/);
herr_t H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
- const struct H5O_efl_t *efl, const size_t _hslab_size[],
- const size_t mem_size[], const size_t mem_offset[],
- const size_t file_offset[], void *_buf/*out*/);
+ const struct H5O_efl_t *efl, const hsize_t _hslab_size[],
+ const hsize_t mem_size[], const hssize_t mem_offset[],
+ const hssize_t file_offset[], void *_buf/*out*/);
herr_t H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
- const struct H5O_efl_t *efl, const size_t _hslab_size[],
- const size_t mem_size[], const size_t mem_offset[],
- const size_t file_offset[], const void *_buf);
+ const struct H5O_efl_t *efl, const hsize_t _hslab_size[],
+ const hsize_t mem_size[], const hssize_t mem_offset[],
+ const hssize_t file_offset[], const void *_buf);
/* Functions that operate on indexed storage */
herr_t H5F_istore_create(H5F_t *f, struct H5O_layout_t *layout /*in,out*/);
herr_t H5F_istore_read(H5F_t *f, const struct H5O_layout_t *layout,
- const size_t offset[], const size_t size[],
+ const hssize_t offset[], const hsize_t size[],
void *buf /*out */ );
herr_t H5F_istore_write(H5F_t *f, const struct H5O_layout_t *layout,
- const size_t offset[], const size_t size[],
+ const hssize_t offset[], const hsize_t size[],
const void *buf);
/* Functions that operate on contiguous storage wrt boot block */
-herr_t H5F_block_read(H5F_t *f, const haddr_t *addr, size_t size, void *buf);
-herr_t H5F_block_write(H5F_t *f, const haddr_t *addr, size_t size,
+herr_t H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, void *buf);
+herr_t H5F_block_write(H5F_t *f, const haddr_t *addr, hsize_t size,
const void *buf);
/* Functions that operate directly on low-level files */
const H5F_low_class_t *H5F_low_class (H5F_driver_t driver);
herr_t H5F_low_extend(H5F_low_t *lf, const H5F_access_t *access_parms,
- intn op, size_t size, haddr_t *addr);
+ intn op, hsize_t size, haddr_t *addr);
herr_t H5F_low_seteof(H5F_low_t *lf, const haddr_t *addr);
hbool_t H5F_low_access(const H5F_low_class_t *type, const char *name,
const H5F_access_t *access_parms, int mode,
@@ -513,7 +513,7 @@ H5F_low_t *H5F_low_open(const H5F_low_class_t *type, const char *name,
const H5F_access_t *access_parms, uintn flags,
H5F_search_t *key);
H5F_low_t *H5F_low_close(H5F_low_t *lf, const H5F_access_t *access_parms);
-size_t H5F_low_size(H5F_low_t *lf, haddr_t *addr);
+hsize_t H5F_low_size(H5F_low_t *lf, haddr_t *addr);
herr_t H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms,
const haddr_t *addr, size_t size, uint8 *buf);
herr_t H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms,
@@ -537,8 +537,8 @@ void H5F_addr_encode(H5F_t *, uint8 **, const haddr_t *);
void H5F_addr_decode(H5F_t *, const uint8 **, haddr_t *);
void H5F_addr_print(FILE *, const haddr_t *);
void H5F_addr_pow2(uintn, haddr_t *);
-void H5F_addr_inc(haddr_t *addr/*in,out*/, size_t inc);
-void H5F_addr_adj(haddr_t *addr/*in,out*/, ssize_t adj);
+void H5F_addr_inc(haddr_t *addr/*in,out*/, hsize_t inc);
+void H5F_addr_adj(haddr_t *addr/*in,out*/, hssize_t adj);
void H5F_addr_add(haddr_t *, const haddr_t *);
uintn H5F_addr_hash(const haddr_t *, uintn mod);
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index f0fb3f2..08aa314 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -59,7 +59,7 @@ typedef enum H5F_driver_t {
} H5F_driver_t;
/* Unlimited file size for H5Pset_external() */
-#define H5F_UNLIMITED ((size_t)(-1L))
+#define H5F_UNLIMITED ((hsize_t)(-1L))
/* Parallel styles passed to H5Pset_mpi() */
#ifdef HAVE_PARALLEL
diff --git a/src/H5Fsec2.c b/src/H5Fsec2.c
index 16395dd..11f6b9c 100644
--- a/src/H5Fsec2.c
+++ b/src/H5Fsec2.c
@@ -69,8 +69,7 @@ const H5F_low_class_t H5F_LOW_SEC2_g[1] = {{
*-------------------------------------------------------------------------
*/
static H5F_low_t *
-H5F_sec2_open(const char *name,
- const H5F_access_t *access_parms __attribute__((unused)),
+H5F_sec2_open(const char *name, const H5F_access_t __unused__ *access_parms,
uintn flags, H5F_search_t *key/*out*/)
{
intn oflags;
@@ -122,8 +121,7 @@ H5F_sec2_open(const char *name,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_sec2_close(H5F_low_t *lf,
- const H5F_access_t *access_parms __attribute__((unused)))
+H5F_sec2_close(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms)
{
FUNC_ENTER(H5F_sec2_close, FAIL);
@@ -158,8 +156,7 @@ H5F_sec2_close(H5F_low_t *lf,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_sec2_read(H5F_low_t *lf,
- const H5F_access_t *access_parms __attribute__((unused)),
+H5F_sec2_read(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms,
const haddr_t *addr, size_t size, uint8 *buf)
{
ssize_t n;
@@ -263,8 +260,7 @@ H5F_sec2_read(H5F_low_t *lf,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_sec2_write(H5F_low_t *lf,
- const H5F_access_t *access_parms __attribute__((unused)),
+H5F_sec2_write(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms,
const haddr_t *addr, size_t size, const uint8 *buf)
{
uint64 mask;
diff --git a/src/H5Fstdio.c b/src/H5Fstdio.c
index 7e45878..fbccc5e 100644
--- a/src/H5Fstdio.c
+++ b/src/H5Fstdio.c
@@ -70,8 +70,7 @@ const H5F_low_class_t H5F_LOW_STDIO_g[1] = {{
*-------------------------------------------------------------------------
*/
static H5F_low_t *
-H5F_stdio_open(const char *name,
- const H5F_access_t *access_parms __attribute__((unused)),
+H5F_stdio_open(const char *name, const H5F_access_t __unused__ *access_parms,
uintn flags, H5F_search_t *key/*out*/)
{
H5F_low_t *lf = NULL;
@@ -113,9 +112,9 @@ H5F_stdio_open(const char *name,
if (fseek(lf->u.stdio.f, 0, SEEK_END) < 0) {
lf->u.stdio.op = H5F_OP_UNKNOWN;
} else {
- ssize_t x = ftell (lf->u.stdio.f);
+ hssize_t x = ftell (lf->u.stdio.f);
assert (x>=0);
- H5F_addr_inc(&(lf->eof), (size_t)x);
+ H5F_addr_inc(&(lf->eof), (hsize_t)x);
}
/* The unique key */
@@ -147,8 +146,7 @@ H5F_stdio_open(const char *name,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_stdio_close(H5F_low_t *lf,
- const H5F_access_t *access_parms __attribute__((unused)))
+H5F_stdio_close(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms)
{
FUNC_ENTER(H5F_stdio_close, FAIL);
@@ -183,8 +181,7 @@ H5F_stdio_close(H5F_low_t *lf,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_stdio_read(H5F_low_t *lf,
- const H5F_access_t *access_parms __attribute__((unused)),
+H5F_stdio_read(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms,
const haddr_t *addr, size_t size, uint8 *buf/*out*/)
{
size_t n;
@@ -292,10 +289,8 @@ H5F_stdio_read(H5F_low_t *lf,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_stdio_write(H5F_low_t *lf,
- const H5F_access_t *access_parms __attribute__((unused)),
- const haddr_t *addr, size_t size,
- const uint8 *buf)
+H5F_stdio_write(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms,
+ const haddr_t *addr, size_t size, const uint8 *buf)
{
uint64 mask;
#ifdef HAVE_FSEEK64
@@ -380,8 +375,7 @@ H5F_stdio_write(H5F_low_t *lf,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_stdio_flush(H5F_low_t *lf,
- const H5F_access_t *access_parms __attribute__((unused)))
+H5F_stdio_flush(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms)
{
FUNC_ENTER(H5F_stdio_flush, FAIL);
diff --git a/src/H5G.c b/src/H5G.c
index d93cb8e..4367b74 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -513,9 +513,8 @@ H5Giterate (hid_t loc_id, const char *name, int *idx,
*-------------------------------------------------------------------------
*/
herr_t
-H5Gmove (hid_t loc_id __attribute__((unused)),
- const char *src __attribute__((unused)),
- const char *dst __attribute__((unused)))
+H5Gmove (hid_t __unused__ loc_id, const char __unused__ *src,
+ const char __unused__ *dst)
{
FUNC_ENTER (H5Gmove, FAIL);
@@ -606,8 +605,7 @@ H5Glink (hid_t loc_id, H5G_link_t type, const char *cur_name,
*-------------------------------------------------------------------------
*/
herr_t
-H5Gunlink (hid_t loc_id __attribute__((unused)),
- const char *name __attribute__((unused)))
+H5Gunlink (hid_t __unused__ loc_id, const char __unused__ *name)
{
FUNC_ENTER (H5Gunlink, FAIL);
diff --git a/src/H5Gent.c b/src/H5Gent.c
index 2a95778..66c08ae 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -349,8 +349,8 @@ H5G_ent_encode(H5F_t *f, uint8 **pp, H5G_entry_t *ent)
*-------------------------------------------------------------------------
*/
herr_t
-H5G_ent_debug(H5F_t *f __attribute__((unused)), H5G_entry_t *ent,
- FILE * stream, intn indent, intn fwidth)
+H5G_ent_debug(H5F_t __unused__ *f, H5G_entry_t *ent, FILE * stream,
+ intn indent, intn fwidth)
{
FUNC_ENTER(H5G_ent_debug, FAIL);
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 5292607..02172da 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -108,7 +108,7 @@ static intn interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
static size_t
-H5G_node_sizeof_rkey(H5F_t *f, const void *udata __attribute__((unused)))
+H5G_node_sizeof_rkey(H5F_t *f, const void __unused__ *udata)
{
return H5F_SIZEOF_SIZE(f); /*the name offset */
}
@@ -132,8 +132,7 @@ H5G_node_sizeof_rkey(H5F_t *f, const void *udata __attribute__((unused)))
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_decode_key(H5F_t *f, H5B_t *bt __attribute__((unused)), uint8 *raw,
- void *_key)
+H5G_node_decode_key(H5F_t *f, H5B_t __unused__ *bt, uint8 *raw, void *_key)
{
H5G_node_key_t *key = (H5G_node_key_t *) _key;
@@ -167,8 +166,7 @@ H5G_node_decode_key(H5F_t *f, H5B_t *bt __attribute__((unused)), uint8 *raw,
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_encode_key(H5F_t *f, H5B_t *bt __attribute__((unused)),
- uint8 *raw, void *_key)
+H5G_node_encode_key(H5F_t *f, H5B_t __unused__ *bt, uint8 *raw, void *_key)
{
H5G_node_key_t *key = (H5G_node_key_t *) _key;
@@ -231,15 +229,13 @@ H5G_node_size(H5F_t *f)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_create(H5F_t *f, H5B_ins_t op,
- void *_lt_key, void *_udata __attribute__((unused)),
- void *_rt_key,
- haddr_t *addr/*out*/)
+H5G_node_create(H5F_t *f, H5B_ins_t __unused__ op, void *_lt_key,
+ void __unused__ *_udata, void *_rt_key, haddr_t *addr/*out*/)
{
H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key;
H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key;
H5G_node_t *sym = NULL;
- size_t size = 0;
+ hsize_t size = 0;
FUNC_ENTER(H5G_node_create, FAIL);
@@ -315,9 +311,8 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr,
/*
* Look for dirty entries and set the node dirty flag.
*/
- for (i = 0; i < sym->nsyms; i++) {
- if (sym->entry[i].dirty)
- sym->dirty = TRUE;
+ for (i=0; i<sym->nsyms; i++) {
+ if (sym->entry[i].dirty) sym->dirty = TRUE;
}
/*
@@ -344,7 +339,7 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr,
H5G_ent_encode_vec(f, &p, sym->entry, sym->nsyms);
HDmemset(p, 0, size - (p - buf));
- status = H5F_block_write(f, addr, size, buf);
+ status = H5F_block_write(f, addr, (hsize_t)size, buf);
buf = H5MM_xfree(buf);
if (status < 0)
HRETURN_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL,
@@ -381,8 +376,8 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr,
*-------------------------------------------------------------------------
*/
static H5G_node_t *
-H5G_node_load(H5F_t *f, const haddr_t *addr, const void *_udata1,
- void *_udata2)
+H5G_node_load(H5F_t *f, const haddr_t *addr, const void __unused__ *_udata1,
+ void __unused__ *_udata2)
{
H5G_node_t *sym = NULL;
size_t size = 0;
@@ -408,7 +403,7 @@ H5G_node_load(H5F_t *f, const haddr_t *addr, const void *_udata1,
sym = H5MM_xcalloc(1, sizeof(H5G_node_t));
sym->entry = H5MM_xcalloc((intn)(2*H5G_NODE_K(f)), sizeof(H5G_entry_t));
- if (H5F_block_read(f, addr, size, buf) < 0) {
+ if (H5F_block_read(f, addr, (hsize_t)size, buf) < 0) {
HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL,
"unabel to read symbol table node");
}
@@ -589,9 +584,8 @@ H5G_node_cmp3(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_found(H5F_t *f, const haddr_t *addr,
- const void *_lt_key __attribute__((unused)),
- void *_udata, const void *_rt_key __attribute__((unused)))
+H5G_node_found(H5F_t *f, const haddr_t *addr, const void __unused__ *_lt_key,
+ void *_udata, const void __unused__ *_rt_key)
{
H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata;
H5G_node_t *sn = NULL;
@@ -699,12 +693,10 @@ H5G_node_found(H5F_t *f, const haddr_t *addr,
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5G_node_insert(H5F_t *f, const haddr_t *addr,
- void *_lt_key __attribute__((unused)),
- hbool_t *lt_key_changed __attribute__((unused)),
- void *_md_key, void *_udata,
- void *_rt_key, hbool_t *rt_key_changed __attribute__((unused)),
- haddr_t *new_node)
+H5G_node_insert(H5F_t *f, const haddr_t *addr, void __unused__ *_lt_key,
+ hbool_t __unused__ *lt_key_changed, void *_md_key,
+ void *_udata, void *_rt_key,
+ hbool_t __unused__ *rt_key_changed, haddr_t *new_node)
{
H5G_node_key_t *md_key = (H5G_node_key_t *) _md_key;
H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key;
diff --git a/src/H5HG.c b/src/H5HG.c
index f457839..568461c 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -104,7 +104,7 @@ H5HG_create (H5F_t *f, size_t size)
if (size<H5HG_MINSIZE) size = H5HG_MINSIZE;
/* Create it */
- if (H5MF_alloc (f, H5MF_META, size, &addr/*out*/)<0) {
+ if (H5MF_alloc (f, H5MF_META, (hsize_t)size, &addr/*out*/)<0) {
HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, NULL,
"unable to allocate file space for global heap");
}
@@ -180,7 +180,8 @@ H5HG_create (H5F_t *f, size_t size)
*-------------------------------------------------------------------------
*/
static H5HG_heap_t *
-H5HG_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2)
+H5HG_load (H5F_t *f, const haddr_t *addr, const void __unused__ *udata1,
+ void __unused__ *udata2)
{
H5HG_heap_t *heap = NULL;
H5HG_heap_t *ret_value = NULL;
@@ -199,7 +200,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2)
heap = H5MM_xcalloc (1, sizeof(H5HG_heap_t));
heap->addr = *addr;
heap->chunk = H5MM_xmalloc (H5HG_MINSIZE);
- if (H5F_block_read (f, addr, H5HG_MINSIZE, heap->chunk)<0) {
+ if (H5F_block_read (f, addr, (hsize_t)H5HG_MINSIZE, heap->chunk)<0) {
HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL,
"unable to read global heap collection");
}
@@ -230,9 +231,9 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2)
*/
if (heap->size > H5HG_MINSIZE) {
haddr_t next_addr = *addr;
- H5F_addr_inc (&next_addr, H5HG_MINSIZE);
+ H5F_addr_inc (&next_addr, (hsize_t)H5HG_MINSIZE);
heap->chunk = H5MM_xrealloc (heap->chunk, heap->size);
- if (H5F_block_read (f, &next_addr, heap->size-H5HG_MINSIZE,
+ if (H5F_block_read (f, &next_addr, (hsize_t)(heap->size-H5HG_MINSIZE),
heap->chunk+H5HG_MINSIZE)<0) {
HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL,
"unable to read global heap collection");
@@ -337,7 +338,7 @@ H5HG_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HG_heap_t *heap)
assert (heap);
if (heap->dirty) {
- if (H5F_block_write (f, addr, heap->size, heap->chunk)<0) {
+ if (H5F_block_write (f, addr, (hsize_t)(heap->size), heap->chunk)<0) {
HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL,
"unable to write global heap collection to file");
}
@@ -796,7 +797,7 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
* to the file free list.
*/
heap->dirty = FALSE;
- H5MF_free (f, &(heap->addr), heap->size);
+ H5MF_free (f, &(heap->addr), (hsize_t)(heap->size));
H5AC_flush (f, H5AC_GHEAP, &(heap->addr), TRUE);
heap = NULL;
} else {
diff --git a/src/H5HL.c b/src/H5HL.c
index 82cfd31..67fb9a8 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -110,7 +110,7 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr/*out*/)
/* allocate file version */
total_size = H5HL_SIZEOF_HDR(f) + size_hint;
- if (H5MF_alloc(f, H5MF_META, total_size, addr/*out*/) < 0) {
+ if (H5MF_alloc(f, H5MF_META, (hsize_t)total_size, addr/*out*/) < 0) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"unable to allocate file memory");
}
@@ -118,7 +118,7 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr/*out*/)
/* allocate memory version */
heap = H5MM_xcalloc(1, sizeof(H5HL_t));
heap->addr = *addr;
- H5F_addr_inc(&(heap->addr), H5HL_SIZEOF_HDR(f));
+ H5F_addr_inc(&(heap->addr), (hsize_t)H5HL_SIZEOF_HDR(f));
heap->disk_alloc = size_hint;
heap->mem_alloc = size_hint;
heap->chunk = H5MM_xcalloc(1, H5HL_SIZEOF_HDR(f) + size_hint);
@@ -162,7 +162,8 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr/*out*/)
*-------------------------------------------------------------------------
*/
static H5HL_t *
-H5HL_load(H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2)
+H5HL_load(H5F_t *f, const haddr_t *addr, const void __unused__ *udata1,
+ void __unused__ *udata2)
{
uint8 hdr[52];
const uint8 *p = NULL;
@@ -180,7 +181,7 @@ H5HL_load(H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2)
assert(!udata1);
assert(!udata2);
- if (H5F_block_read(f, addr, H5HL_SIZEOF_HDR(f), hdr) < 0) {
+ if (H5F_block_read(f, addr, (hsize_t)H5HL_SIZEOF_HDR(f), hdr) < 0) {
HRETURN_ERROR(H5E_HEAP, H5E_READERROR, NULL,
"unable to read heap header");
}
@@ -212,7 +213,7 @@ H5HL_load(H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2)
H5F_addr_decode(f, &p, &(heap->addr));
heap->chunk = H5MM_xcalloc(1, H5HL_SIZEOF_HDR(f) + heap->mem_alloc);
if (heap->disk_alloc &&
- H5F_block_read(f, &(heap->addr), heap->disk_alloc,
+ H5F_block_read(f, &(heap->addr), (hsize_t)(heap->disk_alloc),
heap->chunk + H5HL_SIZEOF_HDR(f)) < 0) {
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL,
"unable to read heap data");
@@ -296,13 +297,13 @@ H5HL_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HL_t *heap)
*/
if (heap->mem_alloc > heap->disk_alloc) {
haddr_t old_addr = heap->addr, new_addr;
- if (H5MF_alloc(f, H5MF_META, heap->mem_alloc,
+ if (H5MF_alloc(f, H5MF_META, (hsize_t)(heap->mem_alloc),
&new_addr/*out*/)<0) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"unable to allocate file space for heap");
}
heap->addr = new_addr;
- H5MF_free(f, &old_addr, heap->disk_alloc);
+ H5MF_free(f, &old_addr, (hsize_t)(heap->disk_alloc));
H5E_clear(); /*don't really care if the free failed */
heap->disk_alloc = heap->mem_alloc;
}
@@ -339,20 +340,22 @@ H5HL_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HL_t *heap)
* Copy buffer to disk.
*/
hdr_end_addr = *addr;
- H5F_addr_inc(&hdr_end_addr, H5HL_SIZEOF_HDR(f));
+ H5F_addr_inc(&hdr_end_addr, (hsize_t)H5HL_SIZEOF_HDR(f));
if (H5F_addr_eq(&(heap->addr), &hdr_end_addr)) {
/* The header and data are contiguous */
- if (H5F_block_write(f, addr, H5HL_SIZEOF_HDR(f) + heap->disk_alloc,
+ if (H5F_block_write(f, addr,
+ (hsize_t)(H5HL_SIZEOF_HDR(f)+heap->disk_alloc),
heap->chunk) < 0) {
HRETURN_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL,
"unable to write heap header and data to file");
}
} else {
- if (H5F_block_write(f, addr, H5HL_SIZEOF_HDR(f), heap->chunk)<0) {
+ if (H5F_block_write(f, addr, (hsize_t)H5HL_SIZEOF_HDR(f),
+ heap->chunk)<0) {
HRETURN_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL,
"unable to write heap header to file");
}
- if (H5F_block_write(f, &(heap->addr), heap->disk_alloc,
+ if (H5F_block_write(f, &(heap->addr), (hsize_t)(heap->disk_alloc),
heap->chunk + H5HL_SIZEOF_HDR(f)) < 0) {
HRETURN_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL,
"unable to write heap data to file");
diff --git a/src/H5MF.c b/src/H5MF.c
index a50d98f..9d22c8a 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -51,7 +51,7 @@ static intn interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_alloc(H5F_t *f, intn op, size_t size, haddr_t *addr /*out */ )
+H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
{
haddr_t tmp_addr;
@@ -111,7 +111,7 @@ H5MF_alloc(H5F_t *f, intn op, size_t size, haddr_t *addr /*out */ )
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_free(H5F_t *f, const haddr_t *addr, size_t size)
+H5MF_free(H5F_t __unused__ *f, const haddr_t *addr, hsize_t size)
{
FUNC_ENTER(H5MF_free, FAIL);
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index 739966a..ea80ca1 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -37,6 +37,6 @@
/*
* Library prototypes...
*/
-herr_t H5MF_alloc (H5F_t *f, intn, size_t size, haddr_t *addr/*out*/);
-herr_t H5MF_free (H5F_t *f, const haddr_t *addr, size_t size);
+herr_t H5MF_alloc (H5F_t *f, intn, hsize_t size, haddr_t *addr/*out*/);
+herr_t H5MF_free (H5F_t *f, const haddr_t *addr, hsize_t size);
#endif
diff --git a/src/H5MM.c b/src/H5MM.c
index 2182a2d..c0e6d72 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -168,7 +168,7 @@ H5MM_xstrdup(const char *s)
*
*-------------------------------------------------------------------------
*/
-void *
+void *
H5MM_xfree(const void *mem)
{
/*
diff --git a/src/H5O.c b/src/H5O.c
index 7049288..b601809 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -149,7 +149,7 @@ H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/)
/* allocate disk space for header and first chunk */
size = H5O_SIZEOF_HDR(f) + size_hint;
ent->file = f;
- if (H5MF_alloc(f, H5MF_META, size, &(ent->header)/*out*/) < 0) {
+ if (H5MF_alloc(f, H5MF_META, (hsize_t)size, &(ent->header)/*out*/) < 0) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"unable to allocate file space for object header hdr");
}
@@ -166,7 +166,7 @@ H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/)
oh->chunk = H5MM_xmalloc(oh->alloc_nchunks * sizeof(H5O_chunk_t));
tmp_addr = ent->header;
- H5F_addr_inc(&tmp_addr, H5O_SIZEOF_HDR(f));
+ H5F_addr_inc(&tmp_addr, (hsize_t)H5O_SIZEOF_HDR(f));
oh->chunk[0].dirty = TRUE;
oh->chunk[0].addr = tmp_addr;
oh->chunk[0].size = size_hint;
@@ -308,7 +308,8 @@ H5O_close(H5G_entry_t *obj_ent)
*-------------------------------------------------------------------------
*/
static H5O_t *
-H5O_load(H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2)
+H5O_load(H5F_t *f, const haddr_t *addr, const void __unused__ *_udata1,
+ void __unused__ *_udata2)
{
H5O_t *oh = NULL;
H5O_t *ret_value = NULL;
@@ -334,7 +335,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2)
/* read fixed-lenth part of object header */
hdr_size = H5O_SIZEOF_HDR(f);
- if (H5F_block_read(f, addr, hdr_size, buf) < 0) {
+ if (H5F_block_read(f, addr, (hsize_t)hdr_size, buf) < 0) {
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL,
"unable to read object header");
}
@@ -358,7 +359,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2)
/* decode first chunk info */
chunk_addr = *addr;
- H5F_addr_inc(&chunk_addr, H5O_SIZEOF_HDR(f));
+ H5F_addr_inc(&chunk_addr, (hsize_t)H5O_SIZEOF_HDR(f));
UINT32DECODE(p, chunk_size);
/* build the message array */
@@ -381,7 +382,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2)
oh->chunk[chunkno].addr = chunk_addr;
oh->chunk[chunkno].size = chunk_size;
oh->chunk[chunkno].image = H5MM_xmalloc(chunk_size);
- if (H5F_block_read(f, &chunk_addr, chunk_size,
+ if (H5F_block_read(f, &chunk_addr, (hsize_t)chunk_size,
oh->chunk[chunkno].image) < 0) {
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL,
"unable to read object header data");
@@ -520,7 +521,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
HDmemset (p, 0, H5O_SIZEOF_HDR(f)-12);
/* write the object header header */
- if (H5F_block_write(f, addr, H5O_SIZEOF_HDR(f), buf) < 0) {
+ if (H5F_block_write(f, addr, (hsize_t)H5O_SIZEOF_HDR(f), buf) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL,
"unable to write object header hdr to disk");
}
@@ -550,7 +551,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
assert(cont->chunkno < oh->nchunks);
assert(!H5F_addr_defined(&(oh->chunk[cont->chunkno].addr)));
cont->size = oh->chunk[cont->chunkno].size;
- if (H5MF_alloc(f, H5MF_META, cont->size,
+ if (H5MF_alloc(f, H5MF_META, (hsize_t)(cont->size),
&(cont->addr)/*out*/) < 0) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"unable to allocate space for object "
@@ -590,7 +591,8 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
for (i = 0; i < oh->nchunks; i++) {
if (oh->chunk[i].dirty) {
assert(H5F_addr_defined(&(oh->chunk[i].addr)));
- if (H5F_block_write(f, &(oh->chunk[i].addr), oh->chunk[i].size,
+ if (H5F_block_write(f, &(oh->chunk[i].addr),
+ (hsize_t)(oh->chunk[i].size),
oh->chunk[i].image) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL,
"unable to write object header data to disk");
@@ -1697,7 +1699,7 @@ H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
fprintf(stream, "\n");
tmp_addr = *addr;
- H5F_addr_inc(&tmp_addr, H5O_SIZEOF_HDR(f));
+ H5F_addr_inc(&tmp_addr, (hsize_t)H5O_SIZEOF_HDR(f));
if (0 == i && H5F_addr_ne(&(oh->chunk[i].addr), &tmp_addr)) {
fprintf(stream, "*** WRONG ADDRESS!\n");
}
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index 5d59875..e9bda3e 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -66,7 +66,7 @@ static intn interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
static void *
-H5O_cont_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
+H5O_cont_decode(H5F_t *f, const uint8 *p, H5HG_t __unused__ *hobj)
{
H5O_cont_t *cont = NULL;
@@ -139,8 +139,8 @@ H5O_cont_encode(H5F_t *f, uint8 *p, const void *_mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_cont_debug(H5F_t *f, const void *_mesg, FILE * stream,
- intn indent, intn fwidth)
+H5O_cont_debug(H5F_t __unused__ *f, const void *_mesg, FILE * stream,
+ intn indent, intn fwidth)
{
const H5O_cont_t *cont = (const H5O_cont_t *) _mesg;
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 31c1c4e..bfbe5a3 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -479,7 +479,7 @@ H5O_dtype_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
message in the "raw" disk form.
--------------------------------------------------------------------------*/
static herr_t
-H5O_dtype_encode(H5F_t *f, uint8 *p, const void *mesg)
+H5O_dtype_encode(H5F_t __unused__ *f, uint8 *p, const void *mesg)
{
const H5T_t *dt = (const H5T_t *) mesg;
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 948435a..ba598b7 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -59,7 +59,7 @@ static hbool_t interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
static void *
-H5O_efl_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
+H5O_efl_decode(H5F_t *f, const uint8 *p, H5HG_t __unused__ *hobj)
{
H5O_efl_t *mesg = NULL;
int i;
@@ -324,11 +324,11 @@ H5O_efl_reset(void *_mesg)
*
*-------------------------------------------------------------------------
*/
-size_t
+hsize_t
H5O_efl_total_size (H5O_efl_t *efl)
{
int i;
- size_t ret_value = 0, tmp;
+ hsize_t ret_value = 0, tmp;
FUNC_ENTER (H5O_efl_total_size, 0);
@@ -369,8 +369,8 @@ H5O_efl_total_size (H5O_efl_t *efl)
*-------------------------------------------------------------------------
*/
herr_t
-H5O_efl_read (H5F_t *f __attribute__((unused)), const H5O_efl_t *efl,
- haddr_t *addr, size_t size, uint8 *buf)
+H5O_efl_read (H5F_t __unused__ *f, const H5O_efl_t *efl, haddr_t *addr,
+ hsize_t size, uint8 *buf)
{
int i, fd=-1;
size_t to_read, cur, skip=0;
@@ -382,6 +382,7 @@ H5O_efl_read (H5F_t *f __attribute__((unused)), const H5O_efl_t *efl,
/* Check args */
assert (efl && efl->nused>0);
assert (addr && H5F_addr_defined (addr));
+ assert (size < MAX_SIZET);
assert (buf || 0==size);
/* Find the first efl member from which to read */
@@ -454,8 +455,8 @@ H5O_efl_read (H5F_t *f __attribute__((unused)), const H5O_efl_t *efl,
*-------------------------------------------------------------------------
*/
herr_t
-H5O_efl_write (H5F_t *f __attribute__((unused)), const H5O_efl_t *efl,
- haddr_t *addr, size_t size, const uint8 *buf)
+H5O_efl_write (H5F_t __unused__ *f, const H5O_efl_t *efl, haddr_t *addr,
+ hsize_t size, const uint8 *buf)
{
int i, fd=-1;
size_t to_write, cur, skip=0;
@@ -466,6 +467,7 @@ H5O_efl_write (H5F_t *f __attribute__((unused)), const H5O_efl_t *efl,
/* Check args */
assert (efl && efl->nused>0);
assert (addr && H5F_addr_defined (addr));
+ assert (size < MAX_SIZET);
assert (buf || 0==size);
/* Find the first efl member in which to write */
@@ -538,8 +540,8 @@ H5O_efl_write (H5F_t *f __attribute__((unused)), const H5O_efl_t *efl,
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_efl_debug(H5F_t *f, const void *_mesg, FILE * stream, intn indent,
- intn fwidth)
+H5O_efl_debug(H5F_t __unused__ *f, const void *_mesg, FILE * stream,
+ intn indent, intn fwidth)
{
const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg;
char buf[64];
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 7949136..42b21e5 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -59,7 +59,7 @@ static hbool_t interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
static void *
-H5O_layout_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
+H5O_layout_decode(H5F_t *f, const uint8 *p, H5HG_t __unused__ *hobj)
{
H5O_layout_t *mesg = NULL;
intn i;
@@ -234,8 +234,8 @@ H5O_layout_size(H5F_t *f, const void *_mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_layout_debug(H5F_t *f, const void *_mesg, FILE * stream, intn indent,
- intn fwidth)
+H5O_layout_debug(H5F_t __unused__ *f, const void *_mesg, FILE * stream,
+ intn indent, intn fwidth)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
intn i;
diff --git a/src/H5Oname.c b/src/H5Oname.c
index cd7e144..a31e08d 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -68,7 +68,7 @@ static hbool_t interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
static void *
-H5O_name_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
+H5O_name_decode(H5F_t __unused__ *f, const uint8 *p, H5HG_t __unused__ *hobj)
{
H5O_name_t *mesg;
@@ -105,7 +105,7 @@ H5O_name_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_name_encode(H5F_t *f, uint8 *p, const void *_mesg)
+H5O_name_encode(H5F_t __unused__ *f, uint8 *p, const void *_mesg)
{
const H5O_name_t *mesg = (const H5O_name_t *) _mesg;
@@ -180,7 +180,7 @@ H5O_name_copy(const void *_mesg, void *_dest)
*-------------------------------------------------------------------------
*/
static size_t
-H5O_name_size(H5F_t *f, const void *_mesg)
+H5O_name_size(H5F_t __unused__ *f, const void *_mesg)
{
const H5O_name_t *mesg = (const H5O_name_t *) _mesg;
size_t size;
@@ -247,8 +247,8 @@ H5O_name_reset(void *_mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_name_debug(H5F_t *f, const void *_mesg, FILE *stream, intn indent,
- intn fwidth)
+H5O_name_debug(H5F_t __unused__ *f, const void *_mesg, FILE *stream,
+ intn indent, intn fwidth)
{
const H5O_name_t *mesg = (const H5O_name_t *)_mesg;
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index de86366..7f4fd63 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -140,8 +140,8 @@ extern const H5O_class_t H5O_EFL[1]; /*external file list class */
typedef struct H5O_efl_entry_t {
size_t name_offset; /*offset of name within heap */
char *name; /*malloc'd name */
- size_t offset; /*offset of data within file */
- size_t size; /*size allocated within file */
+ off_t offset; /*offset of data within file */
+ hsize_t size; /*size allocated within file */
} H5O_efl_entry_t;
typedef struct H5O_efl_t {
@@ -162,7 +162,7 @@ typedef struct H5O_layout_t {
int type; /*type of layout, H5D_layout_t */
haddr_t addr; /*file address of data or B-tree */
intn ndims; /*num dimensions in stored data */
- size_t dim[H5O_LAYOUT_NDIMS]; /*size of data or chunk */
+ hsize_t dim[H5O_LAYOUT_NDIMS]; /*size of data or chunk */
} H5O_layout_t;
/*
@@ -230,10 +230,10 @@ herr_t H5O_debug (H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
intn fwidth);
/* EFL operators */
-size_t H5O_efl_total_size (H5O_efl_t *efl);
+hsize_t H5O_efl_total_size (H5O_efl_t *efl);
herr_t H5O_efl_read (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr,
- size_t size, uint8 *buf);
+ hsize_t size, uint8 *buf);
herr_t H5O_efl_write (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr,
- size_t size, const uint8 *buf);
+ hsize_t size, const uint8 *buf);
#endif
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 16c1c71..cb079fa 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -69,7 +69,8 @@ static hbool_t interface_initialize_g = FALSE;
within this function using malloc() and is returned to the caller.
--------------------------------------------------------------------------*/
static void *
-H5O_sdspace_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
+H5O_sdspace_decode(H5F_t __unused__ *f, const uint8 *p,
+ H5HG_t __unused__ *hobj)
{
H5S_simple_t *sdim = NULL;/* New simple dimensionality structure */
intn u; /* local counting variable */
@@ -87,16 +88,16 @@ H5O_sdspace_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
UINT32DECODE(p, sdim->rank);
UINT32DECODE(p, flags);
if (sdim->rank > 0) {
- sdim->size = H5MM_xmalloc(sizeof(uint32) * sdim->rank);
+ sdim->size = H5MM_xmalloc(sizeof(sdim->size[0]) * sdim->rank);
for (u = 0; u < sdim->rank; u++)
UINT32DECODE(p, sdim->size[u]);
if (flags & 0x01) {
- sdim->max = H5MM_xmalloc(sizeof(uint32) * sdim->rank);
+ sdim->max = H5MM_xmalloc(sizeof(sdim->max[0]) * sdim->rank);
for (u = 0; u < sdim->rank; u++)
UINT32DECODE(p, sdim->max[u]);
}
if (flags & 0x02) {
- sdim->perm = H5MM_xmalloc(sizeof(uint32) * sdim->rank);
+ sdim->perm = H5MM_xmalloc(sizeof(sdim->perm[0]) * sdim->rank);
for (u = 0; u < sdim->rank; u++)
UINT32DECODE(p, sdim->perm[u]);
}
@@ -131,7 +132,7 @@ H5O_sdspace_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
dimensionality message in the "raw" disk form.
--------------------------------------------------------------------------*/
static herr_t
-H5O_sdspace_encode(H5F_t *f, uint8 *p, const void *mesg)
+H5O_sdspace_encode(H5F_t __unused__ *f, uint8 *p, const void *mesg)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
intn u; /* Local counting variable */
@@ -230,7 +231,7 @@ H5O_sdspace_copy(const void *mesg, void *dest)
portion of the message). It doesn't take into account alignment.
--------------------------------------------------------------------------*/
static size_t
-H5O_sdspace_size(H5F_t *f __attribute__((unused)), const void *mesg)
+H5O_sdspace_size(H5F_t __unused__ *f, const void *mesg)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
size_t ret_value = 8; /* all dimensionality messages are at least 8 bytes long (rank and flags) */
@@ -263,8 +264,8 @@ H5O_sdspace_size(H5F_t *f __attribute__((unused)), const void *mesg)
parameter.
--------------------------------------------------------------------------*/
static herr_t
-H5O_sdspace_debug(H5F_t *f, const void *mesg, FILE * stream,
- intn indent, intn fwidth)
+H5O_sdspace_debug(H5F_t __unused__ *f, const void *mesg,
+ FILE * stream, intn indent, intn fwidth)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
intn u; /* local counting variable */
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 0616425..37c7312 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -60,7 +60,7 @@ static hbool_t interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
static void *
-H5O_shared_decode (H5F_t *f, const uint8 *buf, H5HG_t *hobj)
+H5O_shared_decode (H5F_t *f, const uint8 *buf, H5HG_t __unused__ *hobj)
{
H5O_shared_t *mesg;
@@ -133,7 +133,7 @@ H5O_shared_encode (H5F_t *f, uint8 *buf/*out*/, const void *_mesg)
*-------------------------------------------------------------------------
*/
static size_t
-H5O_shared_size (H5F_t *f, const void *_mesg __attribute__((unused)))
+H5O_shared_size (H5F_t *f, const void __unused__ *_mesg)
{
FUNC_ENTER (H5O_shared_size, 0);
FUNC_LEAVE (H5F_SIZEOF_ADDR(f)+4);
@@ -157,8 +157,8 @@ H5O_shared_size (H5F_t *f, const void *_mesg __attribute__((unused)))
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_shared_debug (H5F_t *f, const void *_mesg, FILE *stream, intn indent,
- intn fwidth)
+H5O_shared_debug (H5F_t __unused__ *f, const void *_mesg,
+ FILE *stream, intn indent, intn fwidth)
{
const H5O_shared_t *mesg = (const H5O_shared_t *)_mesg;
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 5c29942..37c749b 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -67,7 +67,7 @@ static hbool_t interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
static void *
-H5O_stab_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
+H5O_stab_decode(H5F_t *f, const uint8 *p, H5HG_t __unused__ *hobj)
{
H5O_stab_t *stab;
@@ -218,7 +218,7 @@ H5O_stab_copy(const void *_mesg, void *_dest)
*-------------------------------------------------------------------------
*/
static size_t
-H5O_stab_size(H5F_t *f, const void *_mesg __attribute__((unused)))
+H5O_stab_size(H5F_t *f, const void __unused__ *_mesg)
{
FUNC_ENTER(H5O_stab_size, 0);
FUNC_LEAVE(2 * H5F_SIZEOF_ADDR(f));
@@ -242,8 +242,8 @@ H5O_stab_size(H5F_t *f, const void *_mesg __attribute__((unused)))
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_stab_debug(H5F_t *f, const void *_mesg, FILE * stream, intn indent,
- intn fwidth)
+H5O_stab_debug(H5F_t __unused__ *f, const void *_mesg, FILE * stream,
+ intn indent, intn fwidth)
{
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
diff --git a/src/H5P.c b/src/H5P.c
index 0d30037..6e67b4f 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -447,9 +447,9 @@ H5Pget_version(hid_t tid, int *boot/*out*/, int *freelist/*out*/,
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_userblock(hid_t tid, size_t size)
+H5Pset_userblock(hid_t tid, hsize_t size)
{
- intn i;
+ uintn i;
H5F_create_t *tmpl = NULL;
FUNC_ENTER(H5Pset_userblock, FAIL);
@@ -460,11 +460,11 @@ H5Pset_userblock(hid_t tid, size_t size)
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a file creation template");
}
- for (i=8; i<8*(intn)sizeof(int); i++) {
- uintn p2 = 8 == i ? 0 : 1 << i;
+ for (i=8; i<8*sizeof(hsize_t); i++) {
+ hsize_t p2 = 8==i ? 0 : ((hsize_t)1<<i);
if (size == p2) break;
}
- if (i>=8*(intn)sizeof(int)) {
+ if (i>=8*sizeof(hsize_t)) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"userblock size is not valid");
}
@@ -491,9 +491,9 @@ H5Pset_userblock(hid_t tid, size_t size)
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_userblock(hid_t tid, size_t *size)
+H5Pget_userblock(hid_t tid, hsize_t *size)
{
- H5F_create_t *tmpl = NULL;
+ H5F_create_t *tmpl = NULL;
FUNC_ENTER(H5Pget_userblock, FAIL);
@@ -504,8 +504,7 @@ H5Pget_userblock(hid_t tid, size_t *size)
"not a file creation template");
}
/* Get value */
- if (size)
- *size = tmpl->userblock_size;
+ if (size) *size = tmpl->userblock_size;
FUNC_LEAVE(SUCCEED);
}
@@ -870,7 +869,7 @@ H5Pget_layout(hid_t tid)
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_chunk(hid_t tid, int ndims, const size_t dim[])
+H5Pset_chunk(hid_t tid, int ndims, const hsize_t dim[])
{
int i;
H5D_create_t *tmpl = NULL;
@@ -887,7 +886,7 @@ H5Pset_chunk(hid_t tid, int ndims, const size_t dim[])
HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL,
"chunk dimensionality must be positive");
}
- if (ndims > (intn)NELMTS(tmpl->chunk_size)) {
+ if ((size_t)ndims > NELMTS(tmpl->chunk_size)) {
HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL,
"chunk dimensionality is too large");
}
@@ -895,7 +894,7 @@ H5Pset_chunk(hid_t tid, int ndims, const size_t dim[])
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"no chunk dimensions specified");
}
- for (i = 0; i < ndims; i++) {
+ for (i=0; i<ndims; i++) {
if (dim[i] <= 0) {
HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL,
"all chunk dimensions must be positive");
@@ -905,8 +904,9 @@ H5Pset_chunk(hid_t tid, int ndims, const size_t dim[])
/* Set value */
tmpl->layout = H5D_CHUNKED;
tmpl->chunk_ndims = ndims;
- for (i = 0; i < ndims; i++)
+ for (i = 0; i < ndims; i++) {
tmpl->chunk_size[i] = dim[i];
+ }
FUNC_LEAVE(SUCCEED);
}
@@ -931,10 +931,10 @@ H5Pset_chunk(hid_t tid, int ndims, const size_t dim[])
*-------------------------------------------------------------------------
*/
int
-H5Pget_chunk(hid_t tid, int max_ndims, size_t dim[] /*out */ )
+H5Pget_chunk(hid_t tid, int max_ndims, hsize_t dim[]/*out*/)
{
- int i;
- H5D_create_t *tmpl = NULL;
+ int i;
+ H5D_create_t *tmpl = NULL;
FUNC_ENTER(H5Pget_chunk, FAIL);
@@ -948,7 +948,7 @@ H5Pget_chunk(hid_t tid, int max_ndims, size_t dim[] /*out */ )
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"not a chunked storage layout");
}
- for (i = 0; i < tmpl->chunk_ndims && i < max_ndims && dim; i++) {
+ for (i=0; i<tmpl->chunk_ndims && i<max_ndims && dim; i++) {
dim[i] = tmpl->chunk_size[i];
}
@@ -984,7 +984,7 @@ H5Pget_chunk(hid_t tid, int max_ndims, size_t dim[] /*out */ )
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_external (hid_t plist_id, const char *name, size_t offset, size_t size)
+H5Pset_external (hid_t plist_id, const char *name, off_t offset, hsize_t size)
{
int idx;
size_t total, tmp;
@@ -1002,6 +1002,10 @@ H5Pset_external (hid_t plist_id, const char *name, size_t offset, size_t size)
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"no name given");
}
+ if (offset<0) {
+ HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
+ "negative external file offset");
+ }
if (size<=0) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"zero size");
@@ -1104,7 +1108,7 @@ H5Pget_external_count (hid_t plist_id)
*/
herr_t
H5Pget_external (hid_t plist_id, int idx, size_t name_size, char *name/*out*/,
- size_t *offset/*out*/, size_t *size/*out*/)
+ off_t *offset/*out*/, hsize_t *size/*out*/)
{
H5D_create_t *plist = NULL;
@@ -1590,7 +1594,7 @@ H5Pset_family (hid_t tid, hid_t memb_tid)
{
H5F_access_t *tmpl = NULL;
- H5F_access_t *memb_tmpl = NULL;
+ H5F_access_t *memb_tmpl = &H5F_access_dflt;
FUNC_ENTER (H5Pset_family, FAIL);
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 714782f..db01166 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -48,8 +48,8 @@ hid_t H5Pcopy (hid_t tid);
H5P_class_t H5Pget_class (hid_t tid);
herr_t H5Pget_version (hid_t tid, int *boot/*out*/, int *freelist/*out*/,
int *stab/*out*/, int *shhdr/*out*/);
-herr_t H5Pset_userblock (hid_t tid, size_t size);
-herr_t H5Pget_userblock (hid_t tid, size_t *size);
+herr_t H5Pset_userblock (hid_t tid, hsize_t size);
+herr_t H5Pget_userblock (hid_t tid, hsize_t *size);
herr_t H5Pset_sizes (hid_t tid, size_t sizeof_addr, size_t sizeof_size);
herr_t H5Pget_sizes (hid_t tid, size_t *sizeof_addr/*out*/,
size_t *sizeof_size/*out*/);
@@ -59,14 +59,14 @@ herr_t H5Pset_istore_k (hid_t tid, int ik);
herr_t H5Pget_istore_k (hid_t tid, int *ik/*out*/);
herr_t H5Pset_layout (hid_t tid, H5D_layout_t layout);
H5D_layout_t H5Pget_layout (hid_t tid);
-herr_t H5Pset_chunk (hid_t tid, int ndims, const size_t dim[]);
-int H5Pget_chunk (hid_t tid, int max_ndims, size_t dim[]/*out*/);
-herr_t H5Pset_external (hid_t plist_id, const char *name, size_t offset,
- size_t size);
+herr_t H5Pset_chunk (hid_t tid, int ndims, const hsize_t dim[]);
+int H5Pget_chunk (hid_t tid, int max_ndims, hsize_t dim[]/*out*/);
+herr_t H5Pset_external (hid_t plist_id, const char *name, off_t offset,
+ hsize_t size);
int H5Pget_external_count (hid_t plist_id);
herr_t H5Pget_external (hid_t plist_id, int idx, size_t name_size,
- char *name/*out*/, size_t *offset/*out*/,
- size_t *size/*out*/);
+ char *name/*out*/, off_t *offset/*out*/,
+ hsize_t *size/*out*/);
H5F_driver_t H5Pget_driver (hid_t tid);
herr_t H5Pset_stdio (hid_t tid);
herr_t H5Pget_stdio (hid_t tid);
diff --git a/src/H5S.c b/src/H5S.c
index 8d854ea..177b5dc 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -108,7 +108,7 @@ H5S_term_interface(void)
*-------------------------------------------------------------------------
*/
hid_t
-H5Screate_simple(int rank, const size_t *dims, const size_t *maxdims)
+H5Screate_simple(int rank, const hsize_t *dims, const hsize_t *maxdims)
{
H5S_t *ds = NULL;
hid_t ret_value = FAIL;
@@ -146,12 +146,12 @@ H5Screate_simple(int rank, const size_t *dims, const size_t *maxdims)
/* Initialize rank and dimensions */
ds->u.simple.rank = rank;
- ds->u.simple.size = H5MM_xcalloc(1, rank*sizeof(size_t));
- HDmemcpy(ds->u.simple.size, dims, rank*sizeof(size_t));
+ ds->u.simple.size = H5MM_xcalloc(1, rank*sizeof(hsize_t));
+ HDmemcpy(ds->u.simple.size, dims, rank*sizeof(hsize_t));
if (maxdims) {
- ds->u.simple.max = H5MM_xcalloc(1, rank*sizeof(size_t));
- HDmemcpy (ds->u.simple.max, maxdims, rank*sizeof(size_t));
+ ds->u.simple.max = H5MM_xcalloc(1, rank*sizeof(hsize_t));
+ HDmemcpy (ds->u.simple.max, maxdims, rank*sizeof(hsize_t));
}
#ifdef LATER /* QAK */
} /* end if */
@@ -392,11 +392,11 @@ H5S_copy(const H5S_t *src)
*
*-------------------------------------------------------------------------
*/
-size_t
+hsize_t
H5Sget_npoints(hid_t space_id)
{
H5S_t *ds = NULL;
- size_t ret_value = 0;
+ hsize_t ret_value = 0;
FUNC_ENTER(H5Sget_npoints, 0);
@@ -427,10 +427,10 @@ H5Sget_npoints(hid_t space_id)
*
*-------------------------------------------------------------------------
*/
-size_t
+hsize_t
H5S_get_npoints(const H5S_t *ds)
{
- size_t ret_value = 0;
+ hsize_t ret_value = 0;
intn i;
FUNC_ENTER(H5S_get_npoints, 0);
@@ -493,10 +493,10 @@ H5S_get_npoints(const H5S_t *ds)
*
*-------------------------------------------------------------------------
*/
-size_t
+hsize_t
H5S_get_npoints_max(const H5S_t *ds)
{
- size_t ret_value = 0;
+ hsize_t ret_value = 0;
intn i;
FUNC_ENTER(H5S_get_npoints_max, 0);
@@ -513,7 +513,7 @@ H5S_get_npoints_max(const H5S_t *ds)
if (ds->u.simple.max) {
for (ret_value=1, i=0; i<ds->u.simple.rank; i++) {
if (H5S_UNLIMITED==ds->u.simple.max[i]) {
- ret_value = (size_t)(-1L);
+ ret_value = MAX_HSIZET;
break;
} else {
ret_value *= ds->u.simple.max[i];
@@ -642,9 +642,8 @@ H5S_get_ndims(const H5S_t *ds)
*-------------------------------------------------------------------------
*/
int
-H5Sget_dims(hid_t space_id, size_t dims[]/*out*/)
+H5Sget_dims(hid_t space_id, hsize_t dims[]/*out*/)
{
-
H5S_t *ds = NULL;
intn ret_value = 0;
@@ -681,10 +680,10 @@ H5Sget_dims(hid_t space_id, size_t dims[]/*out*/)
*-------------------------------------------------------------------------
*/
intn
-H5S_get_dims(const H5S_t *ds, size_t dims[], size_t max_dims[])
+H5S_get_dims(const H5S_t *ds, hsize_t dims[], hsize_t max_dims[])
{
- intn ret_value = FAIL;
- intn i;
+ intn ret_value = FAIL;
+ intn i;
FUNC_ENTER(H5S_get_dims, FAIL);
@@ -790,7 +789,7 @@ H5S_modify(H5G_entry_t *ent, const H5S_t *ds)
*-------------------------------------------------------------------------
*/
H5S_t *
-H5S_read(H5F_t *f, H5G_entry_t *ent)
+H5S_read(H5F_t __unused__ *f, H5G_entry_t *ent)
{
H5S_t *ds = NULL;
@@ -991,7 +990,7 @@ H5Sis_simple(hid_t sid)
be unlimited in size.
--------------------------------------------------------------------------*/
herr_t
-H5Sset_space(hid_t sid, int rank, const size_t *dims)
+H5Sset_space(hid_t sid, int rank, const hsize_t *dims)
{
H5S_t *space = NULL; /* dataspace to modify */
intn u; /* local counting variable */
@@ -1000,12 +999,15 @@ H5Sset_space(hid_t sid, int rank, const size_t *dims)
FUNC_ENTER(H5Sset_space, FAIL);
/* Check args */
- if ((space = H5I_object(sid)) == NULL)
+ if ((space = H5I_object(sid)) == NULL) {
HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space");
- if (rank > 0 && dims == NULL)
+ }
+ if (rank > 0 && dims == NULL) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified");
- if (rank<0)
+ }
+ if (rank<0) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank");
+ }
if (dims) {
for (u=0; u<rank; u++) {
if (dims[u]<=0) {
@@ -1063,8 +1065,8 @@ H5Sset_space(hid_t sid, int rank, const size_t *dims)
/* Set the rank and copy the dims */
space->u.simple.rank = rank;
- space->u.simple.size = H5MM_xcalloc(rank, sizeof(size_t));
- HDmemcpy(space->u.simple.size, dims, sizeof(size_t) * rank);
+ space->u.simple.size = H5MM_xcalloc(rank, sizeof(hsize_t));
+ HDmemcpy(space->u.simple.size, dims, sizeof(hsize_t) * rank);
}
FUNC_LEAVE(ret_value);
@@ -1093,26 +1095,30 @@ H5Sset_space(hid_t sid, int rank, const size_t *dims)
datasets which extend in arbitrary directions.
--------------------------------------------------------------------------*/
herr_t
-H5Sset_hyperslab(hid_t sid, const int *start, const size_t *count, const size_t *stride)
+H5Sset_hyperslab(hid_t sid, const hssize_t *start, const hsize_t *count,
+ const hsize_t *stride)
{
- H5S_t *space = NULL; /* dataspace to modify */
- size_t *tmp_stride=NULL; /* temp. copy of stride */
- intn u; /* local counting variable */
- herr_t ret_value = SUCCEED;
+ H5S_t *space = NULL; /* dataspace to modify */
+ hsize_t *tmp_stride=NULL; /* temp. copy of stride */
+ intn u; /* local counting variable */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER(H5Sset_hyperslab, FAIL);
/* Get the object */
- if (H5_DATASPACE != H5I_group(sid) || (space = H5I_object(sid)) == NULL)
+ if (H5_DATASPACE != H5I_group(sid) || (space = H5I_object(sid)) == NULL) {
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space");
- if (start == NULL || count==NULL)
+ }
+ if (start == NULL || count==NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"invalid hyperslab selected");
+ }
/* We can't modify other types of dataspaces currently, so error out */
- if (space->type!=H5S_SIMPLE)
+ if (space->type!=H5S_SIMPLE) {
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL,
"unknown dataspace type");
+ }
/* Set up stride values for later use */
tmp_stride= H5MM_xmalloc(space->u.simple.rank*sizeof(tmp_stride[0]));
@@ -1122,7 +1128,7 @@ H5Sset_hyperslab(hid_t sid, const int *start, const size_t *count, const size_t
/* Range check arguments */
for (u=0; u<space->u.simple.rank; u++) {
- if (start[u]<0 || (size_t)(start[u])>=space->u.simple.size[u]) {
+ if (start[u]<0 || (hsize_t)(start[u])>=space->u.simple.size[u]) {
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,
"hyperslab bounds out of range");
}
@@ -1135,9 +1141,9 @@ H5Sset_hyperslab(hid_t sid, const int *start, const size_t *count, const size_t
/* Allocate space for the hyperslab information */
if (NULL==space->h.start) {
- space->h.start= H5MM_xcalloc(space->u.simple.rank, sizeof(intn));
- space->h.count= H5MM_xcalloc(space->u.simple.rank, sizeof(size_t));
- space->h.stride= H5MM_xcalloc(space->u.simple.rank, sizeof(size_t));
+ space->h.start= H5MM_xcalloc(space->u.simple.rank, sizeof(hsize_t));
+ space->h.count= H5MM_xcalloc(space->u.simple.rank, sizeof(hsize_t));
+ space->h.stride= H5MM_xcalloc(space->u.simple.rank, sizeof(hsize_t));
}
/* Build hyperslab */
@@ -1177,8 +1183,8 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5Sget_hyperslab (hid_t sid, int offset[]/*out*/, size_t size[]/*out*/,
- size_t stride[]/*out*/)
+H5Sget_hyperslab (hid_t sid, hssize_t offset[]/*out*/, hsize_t size[]/*out*/,
+ hsize_t stride[]/*out*/)
{
const H5S_t *ds = NULL;
intn ret_value = FAIL;
@@ -1218,11 +1224,11 @@ H5Sget_hyperslab (hid_t sid, int offset[]/*out*/, size_t size[]/*out*/,
*-------------------------------------------------------------------------
*/
intn
-H5S_get_hyperslab (const H5S_t *ds, int offset[]/*out*/,
- size_t size[]/*out*/, size_t stride[]/*out*/)
+H5S_get_hyperslab (const H5S_t *ds, hssize_t offset[]/*out*/,
+ hsize_t size[]/*out*/, hsize_t stride[]/*out*/)
{
- intn i;
- intn ret_value = FAIL;
+ intn i;
+ intn ret_value = FAIL;
FUNC_ENTER (H5S_get_hyperslab, FAIL);
@@ -1336,7 +1342,7 @@ H5S_find (const H5S_t *mem_space, const H5S_t *file_space)
*-------------------------------------------------------------------------
*/
intn
-H5S_extend (H5S_t *space, const size_t *size)
+H5S_extend (H5S_t *space, const hsize_t *size)
{
intn i, ret_value=0;
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index da19695..db6bf9e 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -1,13 +1,13 @@
/****************************************************************************
- * NCSA HDF *
- * Software Development Group *
- * National Center for Supercomputing Applications *
- * University of Illinois at Urbana-Champaign *
- * 605 E. Springfield, Champaign IL 61820 *
- * *
- * For conditions of distribution and use, see the accompanying *
- * hdf/COPYING file. *
- * *
+ * NCSA HDF *
+ * Software Development Group *
+ * National Center for Supercomputing Applications *
+ * University of Illinois at Urbana-Champaign *
+ * 605 E. Springfield, Champaign IL 61820 *
+ * *
+ * For conditions of distribution and use, see the accompanying *
+ * hdf/COPYING file. *
+ * *
****************************************************************************/
/*
@@ -20,35 +20,35 @@
/* Private headers needed by this file */
#include <H5private.h>
-#include <H5Gprivate.h> /*for H5G_entry_t */
+#include <H5Gprivate.h> /*for H5G_entry_t */
#include <H5Oprivate.h>
#define H5S_RESERVED_ATOMS 2
/* Flags to indicate special dataspace features are active */
-#define H5S_VALID_MAX 0x01
-#define H5S_VALID_PERM 0x02
+#define H5S_VALID_MAX 0x01
+#define H5S_VALID_PERM 0x02
typedef struct H5S_hyperslab_t {
- intn *start; /* Location of start of hyperslab */
- size_t *count; /* Number of elements in hyperslab */
- size_t *stride; /* Packing of values of hyperslab */
+ hssize_t *start; /* Location of start of hyperslab */
+ hsize_t *count; /* Number of elements in hyperslab */
+ hsize_t *stride; /* Packing of values of hyperslab */
} H5S_hyperslab_t;
typedef struct H5S_simple_t {
- intn rank; /*number of dimensions */
- size_t *size; /*dimension sizes */
- size_t *max; /*maximum dimension sizes or NULL */
- intn *perm; /*dimension permutations or NULL */
+ intn rank; /*number of dimensions */
+ hsize_t *size; /*dimension sizes */
+ hsize_t *max; /*maximum dimension sizes or NULL */
+ intn *perm; /*dimension permutations or NULL */
} H5S_simple_t;
typedef struct H5S_t {
- H5S_class_t type; /*type of dimensionality object */
+ H5S_class_t type; /*type of dimensionality object */
union {
- H5S_simple_t simple; /*simple dimensionality information */
+ H5S_simple_t simple; /*simple dimensionality information */
} u;
- uintn hslab_def; /* Whether the hyperslab is defined */
- H5S_hyperslab_t h; /* Hyperslab information */
+ uintn hslab_def; /* Whether the hyperslab is defined */
+ H5S_hyperslab_t h; /* Hyperslab information */
} H5S_t;
/*
@@ -56,7 +56,7 @@ typedef struct H5S_t {
* are numbered.
*/
typedef struct H5S_number_t {
- int _place_holder; /*remove this field! */
+ int _place_holder; /*remove this field! */
} H5S_number_t;
/*
@@ -65,7 +65,7 @@ typedef struct H5S_number_t {
typedef struct H5S_tconv_t {
/* Initialize element numbering information */
size_t (*init)(const struct H5O_layout_t *layout, const H5S_t *mem_space,
- const H5S_t *file_space, size_t desired_nelmts,
+ const H5S_t *file_space, size_t desired_nelmts,
H5S_number_t *numbering/*out*/);
/* Gather elements from disk to type conversion buffer */
@@ -76,13 +76,13 @@ typedef struct H5S_tconv_t {
/* Scatter elements from type conversion buffer to application buffer */
herr_t (*mscat)(const void *tconv_buf, size_t elmt_size,
- const H5S_t *mem_space, const H5S_number_t *numbering,
- size_t start, size_t nelmts, void *buf/*out*/);
+ const H5S_t *mem_space, const H5S_number_t *numbering,
+ size_t start, size_t nelmts, void *buf/*out*/);
/* Gather elements from app buffer to type conversion buffer */
size_t (*mgath)(const void *buf, size_t elmt_size,
- const H5S_t *mem_space, const H5S_number_t *numbering,
- size_t start, size_t nelmts, void *tconv_buf/*out*/);
+ const H5S_t *mem_space, const H5S_number_t *numbering,
+ size_t start, size_t nelmts, void *tconv_buf/*out*/);
/* Scatter elements from type conversion buffer to disk */
herr_t (*fscat)(H5F_t *f, const struct H5O_layout_t *layout,
@@ -105,35 +105,35 @@ typedef struct H5S_tconv_t {
H5S_t *H5S_copy (const H5S_t *src);
herr_t H5S_close (H5S_t *ds);
-size_t H5S_get_npoints (const H5S_t *ds);
-size_t H5S_get_npoints_max(const H5S_t *ds);
+hsize_t H5S_get_npoints (const H5S_t *ds);
+hsize_t H5S_get_npoints_max(const H5S_t *ds);
intn H5S_get_ndims (const H5S_t *ds);
-intn H5S_get_dims (const H5S_t *ds, size_t dims[]/*out*/,
- size_t max_dims[]/*out*/);
+intn H5S_get_dims (const H5S_t *ds, hsize_t dims[]/*out*/,
+ hsize_t max_dims[]/*out*/);
herr_t H5S_modify (H5G_entry_t *ent, const H5S_t *space);
H5S_t *H5S_read (H5F_t *f, H5G_entry_t *ent);
intn H5S_cmp (const H5S_t *ds1, const H5S_t *ds2);
hbool_t H5S_is_simple (const H5S_t *sdim);
uintn H5S_nelem (const H5S_t *space);
const H5S_conv_t *H5S_find (const H5S_t *mem_space, const H5S_t *file_space);
-intn H5S_get_hyperslab (const H5S_t *ds, int offset[]/*out*/,
- size_t size[]/*out*/, size_t stride[]/*out*/);
-intn H5S_extend (H5S_t *space, const size_t *size);
+intn H5S_get_hyperslab (const H5S_t *ds, hssize_t offset[]/*out*/,
+ hsize_t size[]/*out*/, hsize_t stride[]/*out*/);
+intn H5S_extend (H5S_t *space, const hsize_t *size);
/* Conversion functions for simple data spaces */
size_t H5S_simp_init (const struct H5O_layout_t *layout,
- const H5S_t *mem_space, const H5S_t *file_space,
- size_t desired_nelmts, H5S_number_t *numbering/*out*/);
+ const H5S_t *mem_space, const H5S_t *file_space,
+ size_t desired_nelmts, H5S_number_t *numbering/*out*/);
size_t H5S_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, const H5S_number_t *numbering,
size_t start, size_t nelmts, void *tconv_buf/*out*/);
herr_t H5S_simp_mscat (const void *tconv_buf, size_t elmt_size,
- const H5S_t *mem_space, const H5S_number_t *numbering,
- size_t start, size_t nelmts, void *buf/*out*/);
+ const H5S_t *mem_space, const H5S_number_t *numbering,
+ size_t start, size_t nelmts, void *buf/*out*/);
size_t H5S_simp_mgath (const void *buf, size_t elmt_size,
- const H5S_t *mem_space, const H5S_number_t *numbering,
- size_t start, size_t nelmts, void *tconv_buf/*out*/);
+ const H5S_t *mem_space, const H5S_number_t *numbering,
+ size_t start, size_t nelmts, void *tconv_buf/*out*/);
herr_t H5S_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, const H5S_number_t *numbering,
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index f69b623..a10852e 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -22,7 +22,7 @@
/* Define atomic datatypes */
#define H5S_ALL (-2)
-#define H5S_UNLIMITED ((size_t)(-1L))
+#define H5S_UNLIMITED ((hsize_t)(hssize_t)(-1))
/* Different types of dataspaces */
typedef enum H5S_class_t {
@@ -37,18 +37,19 @@ extern "C" {
#endif
/* Functions in H5S.c */
-hid_t H5Screate_simple (int rank, const size_t dims[], const size_t maxdims[]);
+hid_t H5Screate_simple (int rank, const hsize_t dims[],
+ const hsize_t maxdims[]);
hid_t H5Scopy (hid_t space_id);
herr_t H5Sclose (hid_t space_id);
-size_t H5Sget_npoints (hid_t space_id);
+hsize_t H5Sget_npoints (hid_t space_id);
int H5Sget_ndims (hid_t space_id);
-int H5Sget_dims (hid_t space_id, size_t dims[]);
+int H5Sget_dims (hid_t space_id, hsize_t dims[]);
hbool_t H5Sis_simple (hid_t space_id);
-herr_t H5Sset_space (hid_t space_id, int rank, const size_t *dims);
-herr_t H5Sset_hyperslab(hid_t sid, const int *start, const size_t *count,
- const size_t *stride);
-int H5Sget_hyperslab (hid_t sid, int offset[]/*out*/,
- size_t size[]/*out*/, size_t stride[]/*out*/);
+herr_t H5Sset_space (hid_t space_id, int rank, const hsize_t *dims);
+herr_t H5Sset_hyperslab(hid_t sid, const hssize_t *start, const hsize_t *count,
+ const hsize_t *stride);
+int H5Sget_hyperslab (hid_t sid, hssize_t offset[]/*out*/,
+ hsize_t size[]/*out*/, hsize_t stride[]/*out*/);
#ifdef __cplusplus
}
diff --git a/src/H5Ssimp.c b/src/H5Ssimp.c
index a7580c3..976840f 100644
--- a/src/H5Ssimp.c
+++ b/src/H5Ssimp.c
@@ -36,14 +36,14 @@ static intn interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
size_t
-H5S_simp_init (const struct H5O_layout_t *layout, const H5S_t *mem_space,
- const H5S_t *file_space, size_t desired_nelmts,
- H5S_number_t *numbering/*out*/)
+H5S_simp_init (const struct H5O_layout_t __unused__ *layout,
+ const H5S_t *mem_space, const H5S_t *file_space,
+ size_t desired_nelmts, H5S_number_t *numbering/*out*/)
{
- size_t nelmts;
+ hsize_t nelmts;
int m_ndims, f_ndims; /*mem, file dimensionality */
- size_t size[H5O_LAYOUT_NDIMS]; /*size of selected hyperslab */
- size_t acc;
+ hsize_t size[H5O_LAYOUT_NDIMS]; /*size of selected hyperslab */
+ hsize_t acc;
int i;
FUNC_ENTER (H5S_simp_init, 0);
@@ -92,7 +92,8 @@ H5S_simp_init (const struct H5O_layout_t *layout, const H5S_t *mem_space,
}
}
- FUNC_LEAVE (nelmts);
+ assert (nelmts < MAX_SIZET);
+ FUNC_LEAVE ((size_t)nelmts);
}
/*-------------------------------------------------------------------------
@@ -125,17 +126,14 @@ size_t
H5S_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_efl_t *efl,
size_t elmt_size, const H5S_t *file_space,
- const H5S_number_t *numbering, size_t start, size_t nelmts,
- void *buf/*out*/)
+ const H5S_number_t __unused__ *numbering,
+ size_t start, size_t nelmts, void *buf/*out*/)
{
- size_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of slab in file*/
- size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
- size_t zero[H5O_LAYOUT_NDIMS]; /*zero */
- size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
- size_t acc; /*accumulator */
-#ifndef LATER
- intn file_offset_signed[H5O_LAYOUT_NDIMS];
-#endif
+ hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of slab in file*/
+ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
+ hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */
+ hsize_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
+ hsize_t acc; /*accumulator */
intn space_ndims; /*dimensionality of space*/
intn i; /*counters */
@@ -157,24 +155,11 @@ H5S_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
* currently pass sample information into H5F_arr_read() much less
* H5F_istore_read().
*/
-#ifdef LATER
if ((space_ndims=H5S_get_hyperslab (file_space, file_offset,
hsize, sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
"unable to retrieve hyperslab parameters");
}
-#else
- /* Argument type problems to be fixed later..... -RPM */
- if ((space_ndims=H5S_get_hyperslab (file_space, file_offset_signed,
- hsize, sample))<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
- "unable to retrieve hyperslab parameters");
- }
- for (i=0; i<space_ndims; i++) {
- assert (file_offset_signed[i]>=0);
- file_offset[i] = file_offset_signed[i];
- }
-#endif
/* Check that there is no subsampling of the hyperslab */
for (i=0; i<space_ndims; i++) {
@@ -194,7 +179,7 @@ H5S_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
/* The fastest varying dimension is for the data point itself */
file_offset[space_ndims] = 0;
hsize[space_ndims] = elmt_size;
- HDmemset (zero, 0, layout->ndims*sizeof(size_t));
+ HDmemset (zero, 0, layout->ndims*sizeof(*zero));
/*
* Gather from file.
@@ -230,18 +215,16 @@ H5S_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
*/
herr_t
H5S_simp_mscat (const void *tconv_buf, size_t elmt_size,
- const H5S_t *mem_space, const H5S_number_t *numbering,
+ const H5S_t *mem_space,
+ const H5S_number_t __unused__ *numbering,
size_t start, size_t nelmts, void *buf/*out*/)
{
- size_t mem_offset[H5O_LAYOUT_NDIMS]; /*slab offset in app buf*/
- size_t mem_size[H5O_LAYOUT_NDIMS]; /*total size of app buf */
- size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
- size_t zero[H5O_LAYOUT_NDIMS]; /*zero */
- size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
- size_t acc; /*accumulator */
-#ifndef LATER
- intn mem_offset_signed[H5O_LAYOUT_NDIMS];
-#endif
+ hssize_t mem_offset[H5O_LAYOUT_NDIMS]; /*slab offset in app buf*/
+ hsize_t mem_size[H5O_LAYOUT_NDIMS]; /*total size of app buf */
+ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
+ hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */
+ hsize_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
+ hsize_t acc; /*accumulator */
intn space_ndims; /*dimensionality of space*/
intn i; /*counters */
@@ -261,24 +244,11 @@ H5S_simp_mscat (const void *tconv_buf, size_t elmt_size,
* only handle hyperslabs with unit sample because there's currently no
* way to pass sample information to H5V_hyper_copy().
*/
-#ifdef LATER
if ((space_ndims=H5S_get_hyperslab (mem_space, mem_offset, hsize,
sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab parameters");
}
-#else
- /* Argument type problems to be fixed later..... -RPM */
- if ((space_ndims=H5S_get_hyperslab (mem_space, mem_offset_signed,
- hsize, sample))<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
- "unable to retrieve hyperslab parameters");
- }
- for (i=0; i<space_ndims; i++) {
- assert (mem_offset_signed[i]>=0);
- mem_offset[i] = mem_offset_signed[i];
- }
-#endif
/* Check that there is no subsampling of the hyperslab */
for (i=0; i<space_ndims; i++) {
@@ -303,7 +273,7 @@ H5S_simp_mscat (const void *tconv_buf, size_t elmt_size,
mem_offset[space_ndims] = 0;
mem_size[space_ndims] = elmt_size;
hsize[space_ndims] = elmt_size;
- HDmemset (zero, 0, (space_ndims+1)*sizeof(size_t));
+ HDmemset (zero, 0, (space_ndims+1)*sizeof(*zero));
/*
* Scatter from conversion buffer to application memory.
@@ -342,18 +312,16 @@ H5S_simp_mscat (const void *tconv_buf, size_t elmt_size,
*/
size_t
H5S_simp_mgath (const void *buf, size_t elmt_size,
- const H5S_t *mem_space, const H5S_number_t *numbering,
+ const H5S_t *mem_space,
+ const H5S_number_t __unused__ *numbering,
size_t start, size_t nelmts, void *tconv_buf/*out*/)
{
- size_t mem_offset[H5O_LAYOUT_NDIMS]; /*slab offset in app buf*/
- size_t mem_size[H5O_LAYOUT_NDIMS]; /*total size of app buf */
- size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
- size_t zero[H5O_LAYOUT_NDIMS]; /*zero */
- size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
- size_t acc; /*accumulator */
-#ifndef LATER
- intn mem_offset_signed[H5O_LAYOUT_NDIMS];
-#endif
+ hssize_t mem_offset[H5O_LAYOUT_NDIMS]; /*slab offset in app buf*/
+ hsize_t mem_size[H5O_LAYOUT_NDIMS]; /*total size of app buf */
+ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
+ hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */
+ hsize_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
+ hsize_t acc; /*accumulator */
intn space_ndims; /*dimensionality of space*/
intn i; /*counters */
@@ -373,24 +341,11 @@ H5S_simp_mgath (const void *buf, size_t elmt_size,
* only handle hyperslabs with unit sample because there's currently no
* way to pass sample information to H5V_hyper_copy().
*/
-#ifdef LATER
if ((space_ndims=H5S_get_hyperslab (mem_space, mem_offset, hsize,
sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
"unable to retrieve hyperslab parameters");
}
-#else
- /* Argument type problems to be fixed later..... -RPM */
- if ((space_ndims=H5S_get_hyperslab (mem_space, mem_offset_signed,
- hsize, sample))<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
- "unable to retrieve hyperslab parameters");
- }
- for (i=0; i<space_ndims; i++) {
- assert (mem_offset_signed[i]>=0);
- mem_offset[i] = mem_offset_signed[i];
- }
-#endif
/* Check that there is no subsampling of the hyperslab */
for (i=0; i<space_ndims; i++) {
@@ -415,7 +370,7 @@ H5S_simp_mgath (const void *buf, size_t elmt_size,
mem_offset[space_ndims] = 0;
mem_size[space_ndims] = elmt_size;
hsize[space_ndims] = elmt_size;
- HDmemset (zero, 0, (space_ndims+1)*sizeof(size_t));
+ HDmemset (zero, 0, (space_ndims+1)*sizeof(*zero));
/*
* Scatter from conversion buffer to application memory.
@@ -455,17 +410,14 @@ herr_t
H5S_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_efl_t *efl,
size_t elmt_size, const H5S_t *file_space,
- const H5S_number_t *numbering, size_t start, size_t nelmts,
- const void *buf)
+ const H5S_number_t __unused__ *numbering,
+ size_t start, size_t nelmts, const void *buf)
{
- size_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of hyperslab */
- size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
- size_t zero[H5O_LAYOUT_NDIMS]; /*zero vector */
- size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
- size_t acc; /*accumulator */
-#ifndef LATER
- intn file_offset_signed[H5O_LAYOUT_NDIMS];
-#endif
+ hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of hyperslab */
+ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
+ hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero vector */
+ hsize_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
+ hsize_t acc; /*accumulator */
intn space_ndims; /*space dimensionality */
intn i; /*counters */
@@ -487,24 +439,11 @@ H5S_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout,
* currently pass sample information into H5F_arr_read() much less
* H5F_istore_read().
*/
-#ifdef LATER
if ((space_ndims=H5S_get_hyperslab (file_space, file_offset, hsize,
sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab parameters");
}
-#else
- /* Argument type problems to be fixed later..... -RPM */
- if ((space_ndims=H5S_get_hyperslab (file_space, file_offset_signed,
- hsize, sample))<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
- "unable to retrieve hyperslab parameters");
- }
- for (i=0; i<space_ndims; i++) {
- assert (file_offset_signed[i]>=0);
- file_offset[i] = file_offset_signed[i];
- }
-#endif
/* Check that there is no subsampling of the hyperslab */
for (i=0; i<space_ndims; i++) {
@@ -524,7 +463,7 @@ H5S_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout,
/* The fastest varying dimension is for the data point itself */
file_offset[space_ndims] = 0;
hsize[space_ndims] = elmt_size;
- HDmemset (zero, 0, layout->ndims*sizeof(size_t));
+ HDmemset (zero, 0, layout->ndims*sizeof(*zero));
/*
* Scatter to file.
@@ -564,10 +503,10 @@ H5S_simp_read (H5F_t *f, const struct H5O_layout_t *layout,
const H5S_t *file_space, const H5S_t *mem_space,
void *buf/*out*/)
{
- size_t hslab_size[H5O_LAYOUT_NDIMS];
- size_t file_offset[H5O_LAYOUT_NDIMS];
- size_t mem_size[H5O_LAYOUT_NDIMS];
- size_t mem_offset[H5O_LAYOUT_NDIMS];
+ hssize_t file_offset[H5O_LAYOUT_NDIMS];
+ hsize_t hslab_size[H5O_LAYOUT_NDIMS];
+ hssize_t mem_offset[H5O_LAYOUT_NDIMS];
+ hsize_t mem_size[H5O_LAYOUT_NDIMS];
int i;
FUNC_ENTER (H5S_simp_read, FAIL);
@@ -669,10 +608,10 @@ H5S_simp_write (H5F_t *f, const struct H5O_layout_t *layout,
const H5S_t *file_space, const H5S_t *mem_space,
const void *buf)
{
- size_t hslab_size[H5O_LAYOUT_NDIMS];
- size_t file_offset[H5O_LAYOUT_NDIMS];
- size_t mem_size[H5O_LAYOUT_NDIMS];
- size_t mem_offset[H5O_LAYOUT_NDIMS];
+ hssize_t file_offset[H5O_LAYOUT_NDIMS];
+ hsize_t hslab_size[H5O_LAYOUT_NDIMS];
+ hssize_t mem_offset[H5O_LAYOUT_NDIMS];
+ hsize_t mem_size[H5O_LAYOUT_NDIMS];
int i;
FUNC_ENTER (H5S_simp_write, FAIL);
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 7a6d2e5..0e53d18 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -45,12 +45,9 @@ static intn interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
herr_t
-H5T_conv_noop(hid_t src_id __attribute__((unused)),
- hid_t dst_id __attribute__((unused)),
- H5T_cdata_t *cdata,
- size_t nelmts __attribute__((unused)),
- void *buf __attribute__((unused)),
- void *background __attribute__((unused)))
+H5T_conv_noop(hid_t __unused__ src_id, hid_t __unused__ dst_id,
+ H5T_cdata_t *cdata, size_t __unused__ nelmts,
+ void __unused__ *buf, void __unused__ *background)
{
FUNC_ENTER(H5T_conv_noop, FAIL);
@@ -102,7 +99,7 @@ H5T_conv_noop(hid_t src_id __attribute__((unused)),
*/
herr_t
H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
- void *_buf, void *background __attribute__((unused)))
+ void *_buf, void __unused__ *background)
{
uint8 *buf = (uint8 *) _buf;
uint8 tmp;
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 84b1235..e6eed20 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -1,13 +1,13 @@
/*
* Copyright (C) 1997 NCSA
- * All rights reserved.
+ * All rights reserved.
*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Monday, December 8, 1997
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Monday, December 8, 1997
*
- * Purpose: This file contains declarations which are visible only within
- * the H5T package. Source files outside the H5T package should
- * include H5Tprivate.h instead.
+ * Purpose: This file contains declarations which are visible only within
+ * the H5T package. Source files outside the H5T package should
+ * include H5Tprivate.h instead.
*/
#ifndef H5T_PACKAGE
#error "Do not include this file outside the H5T package!"
@@ -27,65 +27,65 @@
#include <H5Tprivate.h>
typedef struct H5T_atomic_t {
- H5T_order_t order; /*byte order */
- size_t prec; /*precision in bits */
- size_t offset; /*bit position of lsb of value */
- H5T_pad_t lsb_pad;/*type of lsb padding */
- H5T_pad_t msb_pad;/*type of msb padding */
+ H5T_order_t order; /*byte order */
+ size_t prec; /*precision in bits */
+ size_t offset; /*bit position of lsb of value */
+ H5T_pad_t lsb_pad;/*type of lsb padding */
+ H5T_pad_t msb_pad;/*type of msb padding */
union {
- struct {
- H5T_sign_t sign; /*type of integer sign */
- } i; /*integer; integer types */
+ struct {
+ H5T_sign_t sign; /*type of integer sign */
+ } i; /*integer; integer types */
- struct {
- size_t sign; /*bit position of sign bit */
- size_t epos; /*position of lsb of exponent */
- size_t esize; /*size of exponent in bits */
- uint64 ebias; /*exponent bias */
- size_t mpos; /*position of lsb of mantissa */
- size_t msize; /*size of mantissa */
- H5T_norm_t norm; /*normalization */
- H5T_pad_t pad; /*type of padding for internal bits */
- } f; /*floating-point types */
+ struct {
+ size_t sign; /*bit position of sign bit */
+ size_t epos; /*position of lsb of exponent */
+ size_t esize; /*size of exponent in bits */
+ uint64 ebias; /*exponent bias */
+ size_t mpos; /*position of lsb of mantissa */
+ size_t msize; /*size of mantissa */
+ H5T_norm_t norm; /*normalization */
+ H5T_pad_t pad; /*type of padding for internal bits */
+ } f; /*floating-point types */
- struct {
- H5T_cset_t cset; /*character set */
- H5T_str_t pad; /*space or null padding of extra bytes */
- } s;
+ struct {
+ H5T_cset_t cset; /*character set */
+ H5T_str_t pad; /*space or null padding of extra bytes */
+ } s;
} u;
} H5T_atomic_t;
typedef struct H5T_compnd_t {
- intn nalloc; /*num entries allocated in MEMB array*/
- intn nmembs; /*number of members defined in struct*/
- struct H5T_member_t *memb; /*array of struct members */
+ intn nalloc; /*num entries allocated in MEMB array*/
+ intn nmembs; /*number of members defined in struct*/
+ struct H5T_member_t *memb; /*array of struct members */
} H5T_compnd_t;
struct H5T_t {
- hbool_t locked; /*if locked, then can't be modified */
+ hbool_t locked; /*if locked, then can't be modified */
H5HG_t sh_heap; /*if defined, type is in global heap */
H5F_t *sh_file; /*file pointer if this is a shared type */
- H5T_class_t type; /*which class of type is this? */
- size_t size; /*total size of an instance of this type */
+ H5T_class_t type; /*which class of type is this? */
+ size_t size; /*total size of an instance of this type */
union {
- H5T_atomic_t atomic; /*an atomic data type */
- H5T_compnd_t compnd; /*a compound data type (struct) */
+ H5T_atomic_t atomic; /*an atomic data type */
+ H5T_compnd_t compnd; /*a compound data type (struct) */
} u;
};
typedef struct H5T_member_t {
- char *name; /*name of this member */
- size_t offset; /*offset from beginning of struct */
- intn ndims; /*member dimensionality */
- size_t dim[4]; /*size in each dimension */
- intn perm[4]; /*index permutation */
- struct H5T_t *type; /*type of this member */
+ char *name; /*name of this member */
+ size_t offset; /*offset from beginning of struct */
+ intn ndims; /*member dimensionality */
+ size_t dim[4]; /*size in each dimension */
+ intn perm[4]; /*index permutation */
+ struct H5T_t *type; /*type of this member */
} H5T_member_t;
/* The data type conversion database */
typedef struct H5T_path_t {
- H5T_t *src; /*source data type ID */
- H5T_t *dst; /*destination data type ID */
+ H5T_t *src; /*source data type ID */
+ H5T_t *dst; /*destination data type ID */
H5T_conv_t func; /*data conversion function */
hbool_t is_hard; /*is it a hard function? */
H5T_cdata_t cdata; /*data for this function */
@@ -93,14 +93,14 @@ typedef struct H5T_path_t {
/* The master list of soft conversion functions */
typedef struct H5T_soft_t {
- H5T_class_t src; /*source data type class */
- H5T_class_t dst; /*destination data type class */
- H5T_conv_t func; /*the conversion function */
+ H5T_class_t src; /*source data type class */
+ H5T_class_t dst; /*destination data type class */
+ H5T_conv_t func; /*the conversion function */
} H5T_soft_t;
/* Function prototypes for H5T package scope */
H5T_path_t *H5T_path_find (const H5T_t *src, const H5T_t *dst,
- hbool_t create, H5T_conv_t func);
+ hbool_t create, H5T_conv_t func);
/* Conversion functions */
herr_t H5T_conv_order (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
diff --git a/src/H5V.c b/src/H5V.c
index bd686c2f..88570a5 100644
--- a/src/H5V.c
+++ b/src/H5V.c
@@ -40,11 +40,9 @@ static hbool_t interface_initialize_g = TRUE;
*-------------------------------------------------------------------------
*/
herr_t
-H5V_stride_optimize1(intn *np/*in,out*/, size_t *_elmt_size/*in,out*/,
- size_t *size, ssize_t *stride1)
+H5V_stride_optimize1(intn *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
+ hsize_t *size, hssize_t *stride1)
{
- ssize_t *elmt_size = (ssize_t *)_elmt_size;
-
FUNC_ENTER(H5V_stride_optimize1, FAIL);
/*
@@ -52,12 +50,13 @@ H5V_stride_optimize1(intn *np/*in,out*/, size_t *_elmt_size/*in,out*/,
* zero we still must make one reference.
*/
assert(1 == H5V_vector_reduce_product(0, NULL));
- assert (*elmt_size>0);
/*
* Combine adjacent memory accesses
*/
- while (*np && stride1[*np-1] == *elmt_size) {
+ while (*np &&
+ stride1[*np-1]>0 &&
+ (hsize_t)(stride1[*np-1])==*elmt_size) {
*elmt_size *= size[*np-1];
if (--*np) {
stride1[*np-1] += size[*np] * stride1[*np];
@@ -90,11 +89,9 @@ H5V_stride_optimize1(intn *np/*in,out*/, size_t *_elmt_size/*in,out*/,
*-------------------------------------------------------------------------
*/
herr_t
-H5V_stride_optimize2(intn *np/*in,out*/, size_t *_elmt_size/*in,out*/,
- size_t *size, ssize_t *stride1, ssize_t *stride2)
+H5V_stride_optimize2(intn *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
+ hsize_t *size, hssize_t *stride1, hssize_t *stride2)
{
- ssize_t *elmt_size = (ssize_t *)_elmt_size;
-
FUNC_ENTER(H5V_stride_optimize2, FAIL);
/*
@@ -107,8 +104,11 @@ H5V_stride_optimize2(intn *np/*in,out*/, size_t *_elmt_size/*in,out*/,
/*
* Combine adjacent memory accesses
*/
- while (*np && stride1[*np-1] == *elmt_size &&
- stride2[*np-1] == *elmt_size) {
+ while (*np &&
+ stride1[*np-1] > 0 &&
+ (hsize_t)(stride1[*np-1]) == *elmt_size &&
+ stride2[*np-1] > 0 &&
+ (hsize_t)(stride2[*np-1]) == *elmt_size) {
*elmt_size *= size[*np-1];
if (--*np) {
stride1[*np-1] += size[*np] * stride1[*np];
@@ -148,13 +148,13 @@ H5V_stride_optimize2(intn *np/*in,out*/, size_t *_elmt_size/*in,out*/,
*
*-------------------------------------------------------------------------
*/
-size_t
-H5V_hyper_stride(intn n, const size_t *size,
- const size_t *total_size, const size_t *offset,
- ssize_t *stride/*out*/)
+hsize_t
+H5V_hyper_stride(intn n, const hsize_t *size,
+ const hsize_t *total_size, const hssize_t *offset,
+ hssize_t *stride/*out*/)
{
- size_t skip; /*starting point byte offset */
- size_t acc; /*accumulator */
+ hsize_t skip; /*starting point byte offset */
+ hsize_t acc; /*accumulator */
int i; /*counter */
FUNC_ENTER(H5V_hyper_stride, (abort(), 0));
@@ -165,20 +165,21 @@ H5V_hyper_stride(intn n, const size_t *size,
assert(stride);
/* init */
- stride[n - 1] = 1;
- skip = offset ? offset[n - 1] : 0;
+ stride[n-1] = 1;
+ skip = offset ? offset[n-1] : 0;
/* others */
- for (i = n - 2, acc = 1; i >= 0; --i) {
- size_t tmp = acc * (total_size[i+1] - size[i+1]);
- assert (tmp<((size_t)1<<(8*sizeof(ssize_t)-1)));
- stride[i] = (ssize_t)tmp; /*overflow checked*/
+ for (i=n-2, acc=1; i>=0; --i) {
+ hsize_t tmp = acc * (total_size[i+1] - size[i+1]);
+ assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
+ stride[i] = (hssize_t)tmp; /*overflow checked*/
acc *= total_size[i+1];
skip += acc * (offset ? offset[i] : 0);
}
FUNC_LEAVE(skip);
}
+
/*-------------------------------------------------------------------------
* Function: H5V_hyper_eq
@@ -205,16 +206,15 @@ H5V_hyper_stride(intn n, const size_t *size,
*/
hbool_t
H5V_hyper_eq(intn n,
- const size_t *offset1, const size_t *size1,
- const size_t *offset2, const size_t *size2)
+ const hssize_t *offset1, const hsize_t *size1,
+ const hssize_t *offset2, const hsize_t *size2)
{
- size_t nelmts1 = 1, nelmts2 = 1;
+ hsize_t nelmts1 = 1, nelmts2 = 1;
intn i;
- if (n <= 0)
- return TRUE;
+ if (n <= 0) return TRUE;
- for (i = 0; i < n; i++) {
+ for (i=0; i<n; i++) {
if ((offset1 ? offset1[i] : 0) != (offset2 ? offset2[i] : 0)) {
return FALSE;
}
@@ -247,19 +247,24 @@ H5V_hyper_eq(intn n,
*/
hbool_t
H5V_hyper_disjointp(intn n,
- const size_t *offset1, const size_t *size1,
- const size_t *offset2, const size_t *size2)
+ const hssize_t *offset1, const hsize_t *size1,
+ const hssize_t *offset2, const hsize_t *size2)
{
intn i;
if (!n || !size1 || !size2) return TRUE;
- for (i = 0; i < n; i++) {
- if (0 == size1[i] || 0 == size2[i]) return TRUE;
+ for (i=0; i<n; i++) {
+ assert (size1[i]<MAX_HSSIZET);
+ assert (size2[i]<MAX_HSSIZET);
+
+ if (0==size1[i] || 0==size2[i]) return TRUE;
if (((offset1?offset1[i]:0) < (offset2?offset2[i]:0) &&
- (offset1?offset1[i]:0) + size1[i] <= (offset2?offset2[i]:0)) ||
+ ((offset1?offset1[i]:0) + (hssize_t)size1[i] <=
+ (offset2?offset2[i]:0))) ||
((offset2?offset2[i]:0) < (offset1?offset1[i]:0) &&
- (offset2?offset2[i]:0) + size2[i] <= (offset1?offset1[i]:0))) {
+ ((offset2?offset2[i]:0) + (hssize_t)size2[i] <=
+ (offset1?offset1[i]:0)))) {
return TRUE;
}
}
@@ -290,15 +295,15 @@ H5V_hyper_disjointp(intn n,
*-------------------------------------------------------------------------
*/
herr_t
-H5V_hyper_fill(intn n, const size_t *_size,
- const size_t *total_size, const size_t *offset, void *_dst,
+H5V_hyper_fill(intn n, const hsize_t *_size,
+ const hsize_t *total_size, const hssize_t *offset, void *_dst,
uintn fill_value)
{
uint8 *dst = (uint8 *) _dst; /*cast for ptr arithmetic */
- size_t size[H5V_HYPER_NDIMS]; /*a modifiable copy of _size */
- ssize_t dst_stride[H5V_HYPER_NDIMS]; /*destination stride info */
- size_t dst_start; /*byte offset to start of stride*/
- size_t elmt_size = 1; /*bytes per element */
+ hsize_t size[H5V_HYPER_NDIMS]; /*a modifiable copy of _size */
+ hssize_t dst_stride[H5V_HYPER_NDIMS]; /*destination stride info */
+ hsize_t dst_start; /*byte offset to start of stride*/
+ hsize_t elmt_size = 1; /*bytes per element */
herr_t status; /*function return status */
#ifndef NDEBUG
int i;
@@ -326,11 +331,12 @@ H5V_hyper_fill(intn n, const size_t *_size,
H5V_stride_optimize1(&n, &elmt_size, size, dst_stride);
/* Copy */
- status = H5V_stride_fill(n, elmt_size, size, dst_stride, dst + dst_start,
+ status = H5V_stride_fill(n, elmt_size, size, dst_stride, dst+dst_start,
fill_value);
FUNC_LEAVE(status);
}
+
/*-------------------------------------------------------------------------
* Function: H5V_hyper_copy
@@ -366,23 +372,23 @@ H5V_hyper_fill(intn n, const size_t *_size,
*-------------------------------------------------------------------------
*/
herr_t
-H5V_hyper_copy(intn n, const size_t *_size,
+H5V_hyper_copy(intn n, const hsize_t *_size,
/*destination*/
- const size_t *dst_size, const size_t *dst_offset,
+ const hsize_t *dst_size, const hssize_t *dst_offset,
void *_dst,
/*source*/
- const size_t *src_size, const size_t *src_offset,
+ const hsize_t *src_size, const hssize_t *src_offset,
const void *_src)
{
const uint8 *src = (const uint8 *)_src; /*cast for ptr arithmtc */
uint8 *dst = (uint8 *) _dst; /*cast for ptr arithmtc */
- size_t size[H5V_HYPER_NDIMS]; /*a modifiable _size */
- ssize_t src_stride[H5V_HYPER_NDIMS]; /*source stride info */
- ssize_t dst_stride[H5V_HYPER_NDIMS]; /*dest stride info */
- size_t dst_start, src_start; /*offset to start at */
- size_t elmt_size = 1; /*element size in bytes */
+ hsize_t size[H5V_HYPER_NDIMS]; /*a modifiable _size */
+ hssize_t src_stride[H5V_HYPER_NDIMS]; /*source stride info */
+ hssize_t dst_stride[H5V_HYPER_NDIMS]; /*dest stride info */
+ hsize_t dst_start, src_start; /*offset to start at */
+ hsize_t elmt_size = 1; /*element size in bytes */
herr_t status; /*return status */
#ifndef NDEBUG
intn i;
@@ -417,8 +423,8 @@ H5V_hyper_copy(intn n, const size_t *_size,
/* Perform the copy in terms of stride */
status = H5V_stride_copy(n, elmt_size, size,
- dst_stride, dst + dst_start,
- src_stride, src + src_start);
+ dst_stride, dst+dst_start,
+ src_stride, src+src_start);
FUNC_LEAVE(status);
}
@@ -441,24 +447,25 @@ H5V_hyper_copy(intn n, const size_t *_size,
*-------------------------------------------------------------------------
*/
herr_t
-H5V_stride_fill(intn n, size_t elmt_size, const size_t *size,
- const ssize_t *stride, void *_dst, uintn fill_value)
+H5V_stride_fill(intn n, hsize_t elmt_size, const hsize_t *size,
+ const hssize_t *stride, void *_dst, uintn fill_value)
{
uint8 *dst = (uint8 *) _dst; /*cast for ptr arithmetic */
- size_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */
- size_t nelmts; /*number of elements to fill */
- uintn i; /*counter */
+ hsize_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */
+ hsize_t nelmts; /*number of elements to fill */
+ hsize_t i; /*counter */
intn j; /*counter */
hbool_t carry; /*subtraction carray value */
FUNC_ENTER(H5V_stride_fill, FAIL);
+ assert (elmt_size < MAX_SIZET);
H5V_vector_cpy(n, idx, size);
nelmts = H5V_vector_reduce_product(n, size);
for (i=0; i<nelmts; i++) {
/* Copy an element */
- HDmemset(dst, (signed)fill_value, elmt_size);
+ HDmemset(dst, (signed)fill_value, (size_t)elmt_size);
/* Decrement indices and advance pointer */
for (j=n-1, carry=TRUE; j>=0 && carry; --j) {
@@ -496,20 +503,20 @@ H5V_stride_fill(intn n, size_t elmt_size, const size_t *size,
*-------------------------------------------------------------------------
*/
herr_t
-H5V_stride_copy(intn n, size_t elmt_size, const size_t *size,
- const ssize_t *dst_stride, void *_dst,
- const ssize_t *src_stride, const void *_src)
+H5V_stride_copy(int n, hsize_t elmt_size, const hsize_t *size,
+ const hssize_t *dst_stride, void *_dst,
+ const hssize_t *src_stride, const void *_src)
{
uint8 *dst = (uint8 *) _dst; /*cast for ptr arithmetic*/
const uint8 *src = (const uint8 *) _src; /*cast for ptr arithmetic*/
- size_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */
- size_t nelmts; /*num elements to copy */
- uintn i; /*counter */
+ hsize_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */
+ hsize_t nelmts; /*num elements to copy */
+ hsize_t i; /*counter */
intn j; /*counters */
hbool_t carry; /*carray for subtraction*/
FUNC_ENTER(H5V_stride_copy, FAIL);
-
+ assert (elmt_size<MAX_SIZET);
if (n) {
H5V_vector_cpy(n, idx, size);
@@ -517,7 +524,7 @@ H5V_stride_copy(intn n, size_t elmt_size, const size_t *size,
for (i=0; i<nelmts; i++) {
/* Copy an element */
- HDmemcpy(dst, src, elmt_size);
+ HDmemcpy(dst, src, (size_t)elmt_size);
/* Decrement indices and advance pointers */
for (j=n-1, carry=TRUE; j>=0 && carry; --j) {
@@ -529,7 +536,7 @@ H5V_stride_copy(intn n, size_t elmt_size, const size_t *size,
}
}
} else {
- HDmemcpy (dst, src, elmt_size);
+ HDmemcpy (dst, src, (size_t)elmt_size);
HRETURN (SUCCEED);
}
@@ -557,25 +564,28 @@ H5V_stride_copy(intn n, size_t elmt_size, const size_t *size,
*-------------------------------------------------------------------------
*/
herr_t
-H5V_stride_copy2(size_t nelmts, size_t elmt_size,
+H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
/* destination */
- intn dst_n, const size_t *dst_size, const ssize_t *dst_stride,
+ intn dst_n, const hsize_t *dst_size,
+ const hssize_t *dst_stride,
void *_dst,
/* source */
- intn src_n, const size_t *src_size, const ssize_t *src_stride,
+ intn src_n, const hsize_t *src_size,
+ const hssize_t *src_stride,
const void *_src)
{
uint8 *dst = (uint8 *) _dst;
const uint8 *src = (const uint8 *) _src;
- size_t dst_idx[H5V_HYPER_NDIMS];
- size_t src_idx[H5V_HYPER_NDIMS];
- uintn i;
+ hsize_t dst_idx[H5V_HYPER_NDIMS];
+ hsize_t src_idx[H5V_HYPER_NDIMS];
+ hsize_t i;
intn j;
hbool_t carry;
FUNC_ENTER(H5V_stride_copy2, FAIL);
+ assert (elmt_size < MAX_SIZET);
H5V_vector_cpy(dst_n, dst_idx, dst_size);
H5V_vector_cpy(src_n, src_idx, src_size);
@@ -583,7 +593,7 @@ H5V_stride_copy2(size_t nelmts, size_t elmt_size,
for (i=0; i<nelmts; i++) {
/* Copy an element */
- HDmemcpy(dst, src, elmt_size);
+ HDmemcpy(dst, src, (size_t)elmt_size);
/* Decrement indices and advance pointers */
for (j=dst_n-1, carry=TRUE; j>=0 && carry; --j) {
diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h
index 76c638f..64f085a 100644
--- a/src/H5Vprivate.h
+++ b/src/H5Vprivate.h
@@ -11,49 +11,57 @@
#include <H5private.h>
/* Vector comparison functions like Fortran66 comparison operators */
-#define H5V_vector_eq(N,V1,V2) (H5V_vector_cmp (N, V1, V2)==0)
-#define H5V_vector_lt(N,V1,V2) (H5V_vector_cmp (N, V1, V2)<0)
-#define H5V_vector_gt(N,V1,V2) (H5V_vector_cmp (N, V1, V2)>0)
-#define H5V_vector_le(N,V1,V2) (H5V_vector_cmp (N, V1, V2)<=0)
-#define H5V_vector_ge(N,V1,V2) (H5V_vector_cmp (N, V1, V2)>=0)
+#define H5V_vector_eq_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)==0)
+#define H5V_vector_lt_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)<0)
+#define H5V_vector_gt_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)>0)
+#define H5V_vector_le_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)<=0)
+#define H5V_vector_ge_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)>=0)
+#define H5V_vector_eq_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)==0)
+#define H5V_vector_lt_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)<0)
+#define H5V_vector_gt_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)>0)
+#define H5V_vector_le_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)<=0)
+#define H5V_vector_ge_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)>=0)
/* Other functions */
#define H5V_vector_cpy(N,DST,SRC) { \
- if (SRC) HDmemcpy (DST, SRC, (N)*sizeof(size_t)); \
- else HDmemset (DST, 0, (N)*sizeof(size_t)); \
+ assert (sizeof(*(DST))==sizeof(*(SRC))); \
+ if (SRC) HDmemcpy (DST, SRC, (N)*sizeof(*(DST))); \
+ else HDmemset (DST, 0, (N)*sizeof(*(DST))); \
}
-#define H5V_vector_zero(N,DST) HDmemset(DST,0,(N)*sizeof(size_t))
+#define H5V_vector_zero(N,DST) HDmemset(DST,0,(N)*sizeof(*(DST)))
/* A null pointer is equivalent to a zero vector */
#define H5V_ZERO NULL
-size_t H5V_hyper_stride(intn n, const size_t *size, const size_t *total_size,
- const size_t *offset, ssize_t *stride);
-hbool_t H5V_hyper_disjointp(intn n, const size_t *offset1,
- const size_t *size1, const size_t *offset2,
- const size_t *size2);
-hbool_t H5V_hyper_eq(intn n, const size_t *offset1, const size_t *size1,
- const size_t *offset2, const size_t *size2);
-herr_t H5V_hyper_fill(intn n, const size_t *total_size, const size_t *offset,
- const size_t *size, void *buf, uintn val);
-herr_t H5V_hyper_copy(intn n, const size_t *size,
- const size_t *dst_total_size, const size_t *dst_offset,
- void *_dst, const size_t *src_total_size,
- const size_t *src_offset, const void *_src);
-herr_t H5V_stride_fill(intn n, size_t elmt_size, const size_t *size,
- const ssize_t *stride, void *_dst, uintn fill_value);
-herr_t H5V_stride_copy(intn n, size_t elmt_size, const size_t *_size,
- const ssize_t *dst_stride, void *_dst,
- const ssize_t *src_stride, const void *_src);
-herr_t H5V_stride_copy2(size_t nelmts, size_t elmt_size, intn dst_n,
- const size_t *dst_size, const ssize_t *dst_stride,
- void *_dst, intn src_n, const size_t *src_size,
- const ssize_t *src_stride, const void *_src);
-herr_t H5V_stride_optimize1(intn *np, size_t *elmt_size, size_t *size,
- ssize_t *stride1);
-herr_t H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size,
- ssize_t *stride1, ssize_t *stride2);
+hsize_t H5V_hyper_stride(intn n, const hsize_t *size,
+ const hsize_t *total_size, const hssize_t *offset,
+ hssize_t *stride);
+hbool_t H5V_hyper_disjointp(intn n, const hssize_t *offset1,
+ const hsize_t *size1, const hssize_t *offset2,
+ const hsize_t *size2);
+hbool_t H5V_hyper_eq(intn n, const hssize_t *offset1, const hsize_t *size1,
+ const hssize_t *offset2, const hsize_t *size2);
+herr_t H5V_hyper_fill(intn n, const hsize_t *_size, const hsize_t *total_size,
+ const hssize_t *offset, void *_dst, uintn fill_value);
+herr_t H5V_hyper_copy(intn n, const hsize_t *size,
+ const hsize_t *dst_total_size,
+ const hssize_t *dst_offset, void *_dst,
+ const hsize_t *src_total_size,
+ const hssize_t *src_offset, const void *_src);
+herr_t H5V_stride_fill(intn n, hsize_t elmt_size, const hsize_t *size,
+ const hssize_t *stride, void *_dst, uintn fill_value);
+herr_t H5V_stride_copy(intn n, hsize_t elmt_size, const hsize_t *_size,
+ const hssize_t *dst_stride, void *_dst,
+ const hssize_t *src_stride, const void *_src);
+herr_t H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size, intn dst_n,
+ const hsize_t *dst_size, const hssize_t *dst_stride,
+ void *_dst, intn src_n, const hsize_t *src_size,
+ const hssize_t *src_stride, const void *_src);
+herr_t H5V_stride_optimize1(intn *np, hsize_t *elmt_size, hsize_t *size,
+ hssize_t *stride1);
+herr_t H5V_stride_optimize2(intn *np, hsize_t *elmt_size, hsize_t *size,
+ hssize_t *stride1, hssize_t *stride2);
/*-------------------------------------------------------------------------
@@ -75,9 +83,8 @@ herr_t H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size,
*
*-------------------------------------------------------------------------
*/
-static inline size_t
-__attribute__((unused))
-H5V_vector_reduce_product(intn n, const size_t *v)
+static inline hsize_t __unused__
+H5V_vector_reduce_product(intn n, const hsize_t *v)
{
size_t ans = 1;
@@ -87,7 +94,7 @@ H5V_vector_reduce_product(intn n, const size_t *v)
}
/*-------------------------------------------------------------------------
- * Function: H5V_vector_zerop
+ * Function: H5V_vector_zerop_u
*
* Purpose: Determines if all elements of a vector are zero.
*
@@ -103,9 +110,8 @@ H5V_vector_reduce_product(intn n, const size_t *v)
*
*-------------------------------------------------------------------------
*/
-static inline hbool_t
-__attribute__((unused))
-H5V_vector_zerop(intn n, const size_t *v)
+static inline hbool_t __unused__
+H5V_vector_zerop_u(intn n, const hsize_t *v)
{
if (!v) return TRUE;
while (n--) {
@@ -115,7 +121,34 @@ H5V_vector_zerop(intn n, const size_t *v)
}
/*-------------------------------------------------------------------------
- * Function: H5V_vector_cmp
+ * Function: H5V_vector_zerop_s
+ *
+ * Purpose: Determines if all elements of a vector are zero.
+ *
+ * Return: Success: TRUE if all elements are zero,
+ * FALSE otherwise
+ *
+ * Failure: TRUE if N is zero
+ *
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static inline hbool_t __unused__
+H5V_vector_zerop_s(intn n, const hssize_t *v)
+{
+ if (!v) return TRUE;
+ while (n--) {
+ if (*v++) return FALSE;
+ }
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: H5V_vector_cmp_u
*
* Purpose: Compares two vectors of the same size and determines if V1 is
* lexicographically less than, equal, or greater than V2.
@@ -133,9 +166,8 @@ H5V_vector_zerop(intn n, const size_t *v)
*
*-------------------------------------------------------------------------
*/
-static inline intn
-__attribute__((unused))
-H5V_vector_cmp(intn n, const size_t *v1, const size_t *v2)
+static inline intn __unused__
+H5V_vector_cmp_u (intn n, const hsize_t *v1, const hsize_t *v2)
{
if (v1 == v2) return 0;
while (n--) {
@@ -146,6 +178,40 @@ H5V_vector_cmp(intn n, const size_t *v1, const size_t *v2)
}
return 0;
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5V_vector_cmp_s
+ *
+ * Purpose: Compares two vectors of the same size and determines if V1 is
+ * lexicographically less than, equal, or greater than V2.
+ *
+ * Return: Success: -1 if V1 is less than V2
+ * 0 if they are equal
+ * 1 if V1 is greater than V2
+ *
+ * Failure: 0 if N is zero
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 8, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static inline intn __unused__
+H5V_vector_cmp_s (intn n, const hssize_t *v1, const hssize_t *v2)
+{
+ if (v1 == v2) return 0;
+ while (n--) {
+ if ((v1 ? *v1 : 0) < (v2 ? *v2 : 0)) return -1;
+ if ((v1 ? *v1 : 0) > (v2 ? *v2 : 0)) return 1;
+ if (v1) v1++;
+ if (v2) v2++;
+ }
+ return 0;
+}
+
/*-------------------------------------------------------------------------
* Function: H5V_vector_inc
@@ -161,9 +227,8 @@ H5V_vector_cmp(intn n, const size_t *v1, const size_t *v2)
*
*-------------------------------------------------------------------------
*/
-static inline void
-__attribute__((unused))
-H5V_vector_inc(intn n, size_t *v1, const size_t *v2)
+static inline void __unused__
+H5V_vector_inc(intn n, hsize_t *v1, const hsize_t *v2)
{
while (n--) *v1++ += *v2++;
}
diff --git a/src/H5private.h b/src/H5private.h
index 8d319bb..5a5557d 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -57,7 +57,10 @@
/* Does the compiler support the __attribute__(()) syntax? */
#ifndef HAVE_ATTRIBUTE
-# define __attribute__(X) /*void */
+# define __attribute__(X) /*void*/
+# define __unused__ /*void*/
+#else
+# define __unused__ __attribute__((unused))
#endif
/* Does the compiler expand __FUNCTION__? */
@@ -95,6 +98,12 @@
# define MAX3(a,b,c) MAX(MAX(a,b),c)
#endif
+/* maximum value of various types */
+#define MAX_SIZET ((hsize_t)(size_t)(ssize_t)(-1))
+#define MAX_SSIZET ((hsize_t)(ssize_t)((size_t)1<<(8*sizeof(ssize_t)-1)))
+#define MAX_HSIZET ((hsize_t)(hssize_t)(-1))
+#define MAX_HSSIZET ((hsize_t)1<<(8*sizeof(hssize_t)-1))
+
/*
* HDF Boolean type.
*/
diff --git a/src/H5public.h b/src/H5public.h
index 912d935..642af05 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -41,6 +41,19 @@ typedef int herr_t;
*/
typedef int hbool_t;
+/*
+ * The sizes of file-objects in hdf5 have there own types defined here. On
+ * most systems, these are the same as size_t and ssize_t, but on systems
+ * with small address spaces these are defined to be larger.
+ */
+#if 1
+typedef size_t hsize_t;
+typedef ssize_t hssize_t;
+#else
+typedef unsigned long long hsize_t;
+typedef signed long long hssize_t;
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/debug.c b/src/debug.c
index a15362c..17454a1 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -47,7 +47,7 @@
int
main(int argc, char *argv[])
{
- hid_t fid;
+ hid_t fid, plist=H5P_DEFAULT;
H5F_t *f;
haddr_t addr;
uint8 sig[16];
@@ -58,7 +58,11 @@ main(int argc, char *argv[])
/*
* Open the file and get the file descriptor.
*/
- if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
+ if (strchr (argv[1], '%')) {
+ plist = H5Pcreate (H5P_FILE_ACCESS);
+ H5Pset_family (plist, H5P_DEFAULT);
+ }
+ if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, plist)) < 0) {
fprintf(stderr, "cannot open file\n");
HDexit(1);
}
@@ -66,6 +70,7 @@ main(int argc, char *argv[])
fprintf(stderr, "cannot obtain H5F_t pointer\n");
HDexit(2);
}
+
/*
* Parse command arguments.
*/
@@ -84,7 +89,7 @@ main(int argc, char *argv[])
printf("Reading signature at address ");
H5F_addr_print(stdout, &addr);
printf(" (rel)\n");
- if (H5F_block_read(f, &addr, sizeof(sig), sig) < 0) {
+ if (H5F_block_read(f, &addr, (hsize_t)sizeof(sig), sig) < 0) {
fprintf(stderr, "cannot read signature\n");
HDexit(3);
}
diff --git a/src/h5ls.c b/src/h5ls.c
index 07bdd74..1bc5570 100644
--- a/src/h5ls.c
+++ b/src/h5ls.c
@@ -9,11 +9,15 @@
#include <hdf5.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <H5config.h>
#ifndef HAVE_ATTRIBUTE
# undef __attribute__
# define __attribute__(X) /*void*/
+# define __unused__ /*void*/
+#else
+# define __unused__ __attribute__((unused))
#endif
@@ -34,7 +38,7 @@
*-------------------------------------------------------------------------
*/
static herr_t
-list (hid_t group, const char *name, void *op_data __attribute__((unused)))
+list (hid_t group, const char *name, void __unused__ *op_data)
{
hid_t obj;
hid_t (*func)(void*);
@@ -48,7 +52,7 @@ list (hid_t group, const char *name, void *op_data __attribute__((unused)))
/* Print info about each name */
printf ("%-30s", name);
if ((obj=H5Dopen (group, name))>=0) {
- size_t size[64];
+ hsize_t size[64];
hid_t space = H5Dget_space (obj);
int ndims = H5Sget_dims (space, size);
printf (" Dataset {");
@@ -91,15 +95,27 @@ list (hid_t group, const char *name, void *op_data __attribute__((unused)))
int
main (int argc, char *argv[])
{
- hid_t file;
+ hid_t file, plist=H5P_DEFAULT;
herr_t status;
+ const char *fname = NULL;
+ const char *gname = "/";
- assert (3==argc);
+ assert (argc>=2 && argc<=3);
+ fname = argv[1];
+ if (argc>=3) gname = argv[2];
- file = H5Fopen (argv[1], H5F_ACC_RDONLY, H5P_DEFAULT);
+ /*
+ * Open the file. If the file name contains a `%' then assume that a
+ * file family is being opened.
+ */
+ if (strchr (fname, '%')) {
+ plist = H5Pcreate (H5P_FILE_ACCESS);
+ H5Pset_family (plist, H5P_DEFAULT);
+ }
+ file = H5Fopen (fname, H5F_ACC_RDONLY, plist);
assert (file>=0);
- status = H5Giterate (file, argv[2], NULL, list, NULL);
+ status = H5Giterate (file, gname, NULL, list, NULL);
assert (status>=0);
H5Fclose (file);
diff --git a/src/hdf5.h b/src/hdf5.h
index 73f269b..8c71ace 100644
--- a/src/hdf5.h
+++ b/src/hdf5.h
@@ -25,10 +25,11 @@
#include <H5Epublic.h> /* Errors */
#include <H5Fpublic.h> /* Files */
#include <H5Gpublic.h> /* Groups */
-#include <H5HLpublic.h>
+#include <H5HGpublic.h> /* Global heaps */
+#include <H5HLpublic.h> /* Local heaps */
#include <H5Ipublic.h> /* IDs */
-#include <H5MFpublic.h>
-#include <H5MMpublic.h>
+#include <H5MFpublic.h> /* File memory management */
+#include <H5MMpublic.h> /* Core memory management */
#include <H5Opublic.h> /* Object headers */
#include <H5Ppublic.h> /* Property lists */
#include <H5Spublic.h> /* Dataspaces */