summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-08 21:43:02 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-08 21:43:02 (GMT)
commitc01750fa740943c0083711b353278143c79d50a3 (patch)
treefd475b7c7a3639c05b30625b43547850d687b948
parent68fa66bf8130d6a6e607e233da8cc61a154bf172 (diff)
downloadhdf5-c01750fa740943c0083711b353278143c79d50a3.zip
hdf5-c01750fa740943c0083711b353278143c79d50a3.tar.gz
hdf5-c01750fa740943c0083711b353278143c79d50a3.tar.bz2
[svn-r338] Changes since 19980407
---------------------- ./src/H5B.c ./src/H5D.c ./src/H5Dprivate.h ./src/H5Dpublic.h ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fpublic.h ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5HG.c ./src/H5HL.c ./src/H5MF.c ./src/H5MFprivate.h ./src/H5O.c ./src/H5Ocont.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Olayout.c ./src/H5Oname.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5P.c ./src/H5Ppublic.h ./src/H5S.c ./src/H5Sprivate.h ./src/H5Spublic.h ./src/H5Ssimp.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5V.c ./src/H5Vprivate.h ./src/H5private.h ./src/H5public.h ./src/h5ls.c ./test/cmpd_dset.c ./test/dsets.c ./test/extend.c ./test/external.c ./test/hyperslab.c ./test/iopipe.c ./test/istore.c ./test/shtype.c ./test/tfile.c ./test/th5s.c Anything having to do with the size of a dataset now uses the types `hsize_t' and `hssize_t' which must be the same size and at least as large as `size_t'. This isn't fully tested yet, so hsize_t and hssize_t are defined as size_t and ssize_t in H5public.h. Setting them to larger values will trip up gcc versions less than 2.8.1 on x86 platforms. Documented unused function formals with `__unused__' before the formal name. This also has the effect of supressing warning messages for gcc since it's defined to be `__attribute__((unused))' in the H5private.h file. ./src/debug.c ./src/h5ls.c If the file name contains a `%' then the file is opened as a file family with H5P_DEFAULT for the file member access property list. ./src/h5ls.c The group name is optional, defaulting to `/'. ./src/hdf5.h Added some missing public header files.
-rwxr-xr-xconfigure2
-rw-r--r--configure.in2
-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
-rw-r--r--test/.distdep89
-rw-r--r--test/cmpd_dset.c39
-rw-r--r--test/dsets.c13
-rw-r--r--test/extend.c20
-rw-r--r--test/external.c80
-rw-r--r--test/hyperslab.c170
-rw-r--r--test/iopipe.c33
-rw-r--r--test/istore.c767
-rw-r--r--test/shtype.c11
-rw-r--r--test/tfile.c114
-rw-r--r--test/th5s.c64
63 files changed, 2041 insertions, 1874 deletions
diff --git a/configure b/configure
index 90400c8..2a8184d 100755
--- a/configure
+++ b/configure
@@ -953,7 +953,7 @@ else
fi
if test Xyes = "X$GCC"; then
- CFLAGS="$CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline"
+ CFLAGS="$CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline"
fi
echo $ac_n "checking for production mode""... $ac_c" 1>&6
diff --git a/configure.in b/configure.in
index fcb350c..c4a9ef7 100644
--- a/configure.in
+++ b/configure.in
@@ -90,7 +90,7 @@ dnl ----------------------------------------------------------------------
dnl Turn on warning flags for gcc.
dnl
if test Xyes = "X$GCC"; then
- CFLAGS="$CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline"
+ CFLAGS="$CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline"
fi
dnl ----------------------------------------------------------------------
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 */
diff --git a/test/.distdep b/test/.distdep
index 5cbdc57..45b0ac7 100644
--- a/test/.distdep
+++ b/test/.distdep
@@ -136,6 +136,7 @@ dtypes.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
@@ -146,15 +147,7 @@ dtypes.o: \
../src/H5Iprivate.h \
../src/H5private.h \
../src/H5Tprivate.h \
- ../src/H5Gprivate.h \
- ../src/H5Bprivate.h
-hyperslab.o: \
- hyperslab.c \
- ../src/H5private.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5MMprivate.h \
- ../src/H5MMpublic.h
+ ../src/H5Gprivate.h
istore.o: \
istore.c \
../src/H5private.h \
@@ -192,6 +185,7 @@ dsets.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
@@ -199,8 +193,8 @@ dsets.o: \
../src/H5Ppublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
-cmpd_dset.o: \
- cmpd_dset.c \
+extend.o: \
+ extend.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -211,14 +205,15 @@ cmpd_dset.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
../src/H5Spublic.h
-extend.o: \
- extend.c \
+iopipe.o: \
+ iopipe.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -229,12 +224,32 @@ extend.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
- ../src/H5Opublic.h
-external.o: \
- external.c \
+ ../src/H5Opublic.h \
+ ../src/H5Ppublic.h \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h
+gheap.o: \
+ gheap.c \
+ ../src/H5private.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Eprivate.h \
+ ../src/H5Epublic.h \
+ ../src/H5Ipublic.h \
+ ../src/H5Fprivate.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Gprivate.h \
+ ../src/H5Gpublic.h \
+ ../src/H5Bprivate.h \
+ ../src/H5Bpublic.h \
+ ../src/H5HGprivate.h \
+ ../src/H5HGpublic.h
+shtype.o: \
+ shtype.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -245,15 +260,22 @@ external.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
- ../src/H5Spublic.h \
- ../src/H5Tpublic.h
-iopipe.o: \
- iopipe.c \
+ ../src/H5Spublic.h
+hyperslab.o: \
+ hyperslab.c \
+ ../src/H5private.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5MMprivate.h \
+ ../src/H5MMpublic.h
+external.o: \
+ external.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -264,6 +286,7 @@ iopipe.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
@@ -271,24 +294,8 @@ iopipe.o: \
../src/H5Ppublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
-gheap.o: \
- gheap.c \
- ../src/H5private.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Eprivate.h \
- ../src/H5Epublic.h \
- ../src/H5Ipublic.h \
- ../src/H5Fprivate.h \
- ../src/H5Fpublic.h \
- ../src/H5Gprivate.h \
- ../src/H5Gpublic.h \
- ../src/H5Bprivate.h \
- ../src/H5Bpublic.h \
- ../src/H5HGprivate.h \
- ../src/H5HGpublic.h
-shtype.o: \
- shtype.c \
+cmpd_dset.o: \
+ cmpd_dset.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -299,7 +306,11 @@ shtype.o: \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
- ../src/H5Opublic.h
+ ../src/H5Opublic.h \
+ ../src/H5Ppublic.h \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index eae78d9..2e22206 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -125,11 +125,10 @@ main (void)
int ndims;
hid_t file, dataset, space, PRESERVE;
herr_t status;
- static size_t dim[] = {NX, NY};
- size_t f_offset[2]; /*offset of hyperslab in file */
- int f_temp_offset[2];
- size_t h_size[2]; /*size of hyperslab */
- size_t h_sample[2]; /*hyperslab sampling */
+ static hsize_t dim[] = {NX, NY};
+ hssize_t f_offset[2]; /*offset of hyperslab in file */
+ hsize_t h_size[2]; /*size of hyperslab */
+ hsize_t h_sample[2]; /*hyperslab sampling */
/* Create the file */
file = H5Fcreate ("cmpd_dset.h5", H5F_ACC_TRUNC,
@@ -398,9 +397,7 @@ STEP 8: Read middle third hyperslab into memory array.\n");
h_size[1] = 2*NY/3 - f_offset[1];
h_sample[0] = 1;
h_sample[1] = 1;
- f_temp_offset[0] = (int)(f_offset[0]);
- f_temp_offset[1] = (int)(f_offset[1]);
- status = H5Sset_hyperslab (s8_f_sid, f_temp_offset, h_size, h_sample);
+ status = H5Sset_hyperslab (s8_f_sid, f_offset, h_size, h_sample);
assert (status>=0);
/* Create memory data space */
@@ -408,7 +405,7 @@ STEP 8: Read middle third hyperslab into memory array.\n");
assert (s8_m_sid>=0);
/* Read the dataset */
- s8 = calloc (h_size[0]*h_size[1], sizeof(s1_t));
+ s8 = calloc ((size_t)(h_size[0]*h_size[1]), sizeof(s1_t));
assert (s8);
status = H5Dread (dataset, s1_tid, s8_m_sid, s8_f_sid, H5P_DEFAULT, s8);
assert (status>=0);
@@ -454,8 +451,10 @@ STEP 9: Read middle third of hyperslab into middle third of memory array.\n");
for (j=0; j<NY; j++) {
s1_t *ps1 = s1 + i*NY + j;
s2_t *ps2 = s2 + i*NY + j;
- if (i>=f_offset[0] && i<f_offset[0]+h_size[0] &&
- j>=f_offset[1] && j<f_offset[1]+h_size[1]) {
+ if ((hssize_t)i>=f_offset[0] &&
+ (hsize_t)i<f_offset[0]+h_size[0] &&
+ (hssize_t)j>=f_offset[1] &&
+ (hsize_t)j<f_offset[1]+h_size[1]) {
assert (ps2->a == ps1->a);
assert (ps2->b == ps1->b);
assert (ps2->c == ps1->c);
@@ -496,8 +495,10 @@ STEP 10: Read middle third of hyperslab into middle third of memory array\n\
for (j=0; j<NY; j++) {
s1_t *ps1 = s1 + i*NY + j;
s5_t *ps5 = s5 + i*NY + j;
- if (i>=f_offset[0] && i<f_offset[0]+h_size[0] &&
- j>=f_offset[1] && j<f_offset[1]+h_size[1]) {
+ if ((hssize_t)i>=f_offset[0] &&
+ (hsize_t)i<f_offset[0]+h_size[0] &&
+ (hssize_t)j>=f_offset[1] &&
+ (hsize_t)j<f_offset[1]+h_size[1]) {
assert (ps5->pre == (unsigned)(-1));
assert (ps5->a == ps1->a);
assert (ps5->b == ps1->b);
@@ -532,11 +533,9 @@ STEP 11: Write an array back to the middle third of the dataset to\n\
fflush (stdout);
/* Create the memory array and initialize all fields to zero */
- f_temp_offset[0] = (int)(f_offset[0]);
- f_temp_offset[1] = (int)(f_offset[1]);
- ndims = H5Sget_hyperslab (s8_f_sid, f_temp_offset, h_size, h_sample);
+ ndims = H5Sget_hyperslab (s8_f_sid, f_offset, h_size, h_sample);
assert (ndims==2);
- s11 = malloc (h_size[0]*h_size[1]*sizeof(s4_t));
+ s11 = malloc ((size_t)h_size[0]*(size_t)h_size[1]*sizeof(s4_t));
assert (s11);
/* Initialize */
@@ -560,8 +559,10 @@ STEP 11: Write an array back to the middle third of the dataset to\n\
assert (ps1->a == 5*(i*NY+j)+0);
assert (ps1->c == 5*(i*NY+j)+2);
assert (ps1->e == 5*(i*NY+j)+4);
- if (i>=f_offset[0] && i<f_offset[0]+h_size[0] &&
- j>=f_offset[1] && j<f_offset[1]+h_size[1]) {
+ if ((hssize_t)i>=f_offset[0] &&
+ (hsize_t)i<f_offset[0]+h_size[0] &&
+ (hssize_t)j>=f_offset[1] &&
+ (hsize_t)j<f_offset[1]+h_size[1]) {
assert (ps1->b == (unsigned)(-1));
assert (ps1->d == (unsigned)(-1));
} else {
diff --git a/test/dsets.c b/test/dsets.c
index 6f294f2..bf4b75f 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -18,6 +18,9 @@
#ifndef HAVE_ATTRIBUTE
# undef __attribute__
# define __attribute__(X) /*void*/
+# define __unused__ /*void*/
+#else
+# define __unused__ __attribute__((unused))
#endif
#ifndef HAVE_FUNCTION
@@ -51,7 +54,7 @@
*-------------------------------------------------------------------------
*/
static herr_t
-display_error_cb (void *client_data __attribute__((unused)))
+display_error_cb (void __unused__ *client_data)
{
puts ("*FAILED*");
H5Eprint (stdout);
@@ -79,9 +82,9 @@ static herr_t
test_create(hid_t file)
{
hid_t dataset, space, create_parms;
- size_t dims[2];
+ hsize_t dims[2];
herr_t status;
- size_t csize[2];
+ hsize_t csize[2];
herr_t (*func)(void*) = NULL;
void *client_data = NULL;
@@ -195,7 +198,7 @@ test_simple_io(hid_t file)
herr_t status;
int points[100][200], check[100][200];
int i, j, n;
- size_t dims[2];
+ hsize_t dims[2];
void *tconv_buf = NULL;
printf("%-70s", "Testing simple I/O");
@@ -277,7 +280,7 @@ test_tconv(hid_t file)
{
char *out=NULL, *in=NULL;
int i;
- size_t dims[1];
+ hsize_t dims[1];
hid_t space, dataset, type;
herr_t status;
diff --git a/test/extend.c b/test/extend.c
index 7b6ba60..cbdf734 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -33,16 +33,16 @@
int
main (void)
{
- hid_t file, dataset, mem_space, file_space, cparms;
- herr_t status;
- int i, j, k, m;
- static int buf1[NY][NX], buf2[NX/2][NY/2];
- static const size_t dims[2] = {NX, NY};
- static const size_t half_dims[2] = {NX/2, NY/2};
- static const size_t chunk_dims[2] = {NX/2, NY/2};
- static size_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- static size_t size[2];
- int offset[2];
+ hid_t file, dataset, mem_space, file_space, cparms;
+ herr_t status;
+ int i, j, k, m;
+ static int buf1[NY][NX], buf2[NX/2][NY/2];
+ static const hsize_t dims[2] = {NX, NY};
+ static const hsize_t half_dims[2] = {NX/2, NY/2};
+ static const hsize_t chunk_dims[2] = {NX/2, NY/2};
+ static hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ static hsize_t size[2];
+ hssize_t offset[2];
/* Initialize buffer and space */
for (i=0; i<NX; i++) {
diff --git a/test/external.c b/test/external.c
index 7f0ff23..0694430 100644
--- a/test/external.c
+++ b/test/external.c
@@ -19,6 +19,9 @@
#ifndef HAVE_ATTRIBUTE
# undef __attribute__
# define __attribute__(X) /*void*/
+# define __unused__ /*void*/
+#else
+# define __unused__ __attribute__((unused))
#endif
static int nerrors_g = 0;
@@ -41,7 +44,7 @@ static int nerrors_g = 0;
*-------------------------------------------------------------------------
*/
static herr_t
-display_error_cb (void *client_data __attribute__((unused)))
+display_error_cb (void __unused__ *client_data)
{
puts ("*FAILED*");
H5Eprint (stdout);
@@ -117,7 +120,7 @@ test_1 (void)
{
hid_t file, plist, space, dset, grp;
herr_t status;
- size_t size[2], max_size[2];
+ hsize_t size[2], max_size[2];
herr_t (*func)(void*) = NULL;
void *client_data = NULL;
int n;
@@ -141,7 +144,7 @@ test_1 (void)
fflush (stdout);
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "ext1.data", 0, 400);
+ status = H5Pset_external (plist, "ext1.data", 0, (hsize_t)400);
assert (status>=0);
size[0] = max_size[0] = 100;
@@ -165,7 +168,7 @@ test_1 (void)
fflush (stdout);
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "ext1.data", 0, 399);
+ status = H5Pset_external (plist, "ext1.data", 0, (hsize_t)399);
assert (status>=0);
size[0] = max_size[0] = 100;
@@ -198,7 +201,7 @@ test_1 (void)
fflush (stdout);
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "ext1.data", 0, 800);
+ status = H5Pset_external (plist, "ext1.data", 0, (hsize_t)800);
assert (status>=0);
size[0] = 100;
@@ -225,7 +228,7 @@ test_1 (void)
fflush (stdout);
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "ext1.data", 0, 799);
+ status = H5Pset_external (plist, "ext1.data", 0, (hsize_t)799);
assert (status>=0);
size[0] = 100;
@@ -281,8 +284,8 @@ test_1 (void)
*/
do {
char name[256];
- size_t file_offset;
- size_t file_size;
+ off_t file_offset;
+ hsize_t file_size;
printf ("%-70s", "...opening a dataset and reading the storage info");
fflush (stdout);
@@ -328,8 +331,8 @@ test_1 (void)
*/
do {
char name[256];
- size_t file_offset;
- size_t file_size;
+ off_t file_offset;
+ hsize_t file_size;
printf ("%-70s", "...opening an unlimited dataset and reading the "
"storage info");
@@ -378,13 +381,13 @@ test_1 (void)
fflush (stdout);
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "ext1.data", 0, 100);
+ status = H5Pset_external (plist, "ext1.data", 0, (hsize_t)100);
assert (status>=0);
- status = H5Pset_external (plist, "ext2.data", 0, 100);
+ status = H5Pset_external (plist, "ext2.data", 0, (hsize_t)100);
assert (status>=0);
- status = H5Pset_external (plist, "ext3.data", 0, 100);
+ status = H5Pset_external (plist, "ext3.data", 0, (hsize_t)100);
assert (status>=0);
- status = H5Pset_external (plist, "ext4.data", 0, 100);
+ status = H5Pset_external (plist, "ext4.data", 0, (hsize_t)100);
assert (status>=0);
size[0] = max_size[0] = 100;
@@ -414,7 +417,7 @@ test_1 (void)
/* Next function should fail */
H5Eget_auto (&func, &client_data);
H5Eset_auto (NULL, NULL);
- status = H5Pset_external (plist, "ext2.data", 0, 100);
+ status = H5Pset_external (plist, "ext2.data", 0, (hsize_t)100);
H5Eset_auto (func, client_data);
if (status>=0) {
puts ("*FAILED*");
@@ -451,7 +454,7 @@ test_1 (void)
/* Next function should fail */
H5Eget_auto (&func, &client_data);
H5Eset_auto (NULL, NULL);
- status = H5Pset_external (plist, "ext2.data", 0, 100);
+ status = H5Pset_external (plist, "ext2.data", 0, (hsize_t)100);
H5Eset_auto (func, client_data);
if (status>=0) {
puts ("*FAILED*");
@@ -490,22 +493,22 @@ test_2 (void)
hid_t file, plist, space, dset, grp;
herr_t status;
int fd;
- unsigned i, j;
- ssize_t n;
+ hsize_t i, j;
+ hssize_t n;
char fname[64];
int part[25], whole[100];
- size_t size;
+ hsize_t size;
/* Write the data to external files */
for (i=0; i<4; i++) {
for (j=0; j<25; j++) {
- part[j] = i*25+j;
+ part[j] = (int)(i*25+j);
}
- sprintf (fname, "extern_%d.raw", i+1);
+ sprintf (fname, "extern_%lu.raw", (unsigned long)i+1);
fd = open (fname, O_RDWR|O_CREAT|O_TRUNC, 0666);
assert (fd>=0);
- n = lseek (fd, (ssize_t)(i*10), SEEK_SET);
+ n = lseek (fd, (off_t)(i*10), SEEK_SET);
assert (n>=0 && (size_t)n==i*10);
n = write (fd, part, sizeof(part));
assert (n==sizeof(part));
@@ -525,13 +528,17 @@ test_2 (void)
/* Create the external file list */
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "extern_1.raw", 0, sizeof(part));
+ status = H5Pset_external (plist, "extern_1.raw", 0,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_2.raw", 10, sizeof(part));
+ status = H5Pset_external (plist, "extern_2.raw", 10,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_3.raw", 20, sizeof(part));
+ status = H5Pset_external (plist, "extern_3.raw", 20,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_4.raw", 30, sizeof(part));
+ status = H5Pset_external (plist, "extern_4.raw", 30,
+ (hsize_t)sizeof(part));
assert (status>=0);
/* Create the data space */
@@ -577,8 +584,8 @@ test_2 (void)
*/
do {
hid_t hs_space;
- int hs_start = 30;
- size_t hs_count = 25;
+ hssize_t hs_start = 30;
+ hsize_t hs_count = 25;
/* Read from the dataset */
printf ("%-70s", "...reading partial dataset");
@@ -644,8 +651,9 @@ test_3 (void)
herr_t status;
unsigned i;
int fd;
- int part[25], whole[100], hs_start=100;
- size_t size=100, max_size=200, hs_count=100;
+ int part[25], whole[100];
+ hssize_t hs_start=100;
+ hsize_t size=100, max_size=200, hs_count=100;
/*
* Create another file
@@ -656,13 +664,17 @@ test_3 (void)
/* Create the external file list */
plist = H5Pcreate (H5P_DATASET_CREATE);
assert (plist>=0);
- status = H5Pset_external (plist, "extern_1b.raw", 0, sizeof(part));
+ status = H5Pset_external (plist, "extern_1b.raw", 0,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_2b.raw", 10, sizeof(part));
+ status = H5Pset_external (plist, "extern_2b.raw", 10,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_3b.raw", 20, sizeof(part));
+ status = H5Pset_external (plist, "extern_3b.raw", 20,
+ (hsize_t)sizeof(part));
assert (status>=0);
- status = H5Pset_external (plist, "extern_4b.raw", 30, H5F_UNLIMITED);
+ status = H5Pset_external (plist, "extern_4b.raw", 30,
+ H5F_UNLIMITED);
assert (status>=0);
/* Make sure the output files are fresh*/
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 01e4fa6..b1d3deb 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -149,9 +149,9 @@ test_fill(size_t nx, size_t ny, size_t nz,
size_t ddx, size_t ddy, size_t ddz)
{
uint8 *dst = NULL; /*destination array */
- size_t hs_size[3]; /*hyperslab size */
- size_t dst_size[3]; /*destination total size */
- size_t dst_offset[3]; /*offset of hyperslab in dest */
+ hsize_t hs_size[3]; /*hyperslab size */
+ hsize_t dst_size[3]; /*destination total size */
+ hssize_t dst_offset[3]; /*offset of hyperslab in dest */
uintn ref_value; /*reference value */
uintn acc; /*accumulator */
size_t i, j, k, dx, dy, dz; /*counters */
@@ -197,9 +197,9 @@ test_fill(size_t nx, size_t ny, size_t nz,
dst_size[0] = nx;
dst_size[1] = ny;
dst_size[2] = nz;
- dst_offset[0] = i;
- dst_offset[1] = j;
- dst_offset[2] = k;
+ dst_offset[0] = (hssize_t)i;
+ dst_offset[1] = (hssize_t)j;
+ dst_offset[2] = (hssize_t)k;
hs_size[0] = dx;
hs_size[1] = dy;
hs_size[2] = dz;
@@ -314,15 +314,15 @@ test_copy(int mode,
{
uint8 *src = NULL; /*source array */
uint8 *dst = NULL; /*destination array */
- size_t hs_size[3]; /*hyperslab size */
- size_t dst_size[3]; /*destination total size */
- size_t src_size[3]; /*source total size */
- size_t dst_offset[3]; /*offset of hyperslab in dest */
- size_t src_offset[3]; /*offset of hyperslab in source */
+ hsize_t hs_size[3]; /*hyperslab size */
+ hsize_t dst_size[3]; /*destination total size */
+ hsize_t src_size[3]; /*source total size */
+ hssize_t dst_offset[3]; /*offset of hyperslab in dest */
+ hssize_t src_offset[3]; /*offset of hyperslab in source */
uintn ref_value; /*reference value */
uintn acc; /*accumulator */
- size_t i, j, k, dx, dy, dz; /*counters */
- size_t u, v, w;
+ hsize_t i, j, k, dx, dy, dz; /*counters */
+ hsize_t u, v, w;
int ndims; /*hyperslab dimensionality */
char dim[64], s[256]; /*temp string */
const char *sub;
@@ -406,25 +406,25 @@ test_copy(int mode,
dst_offset[0] = 0;
dst_offset[1] = 0;
dst_offset[2] = 0;
- src_offset[0] = i;
- src_offset[1] = j;
- src_offset[2] = k;
+ src_offset[0] = (hssize_t)i;
+ src_offset[1] = (hssize_t)j;
+ src_offset[2] = (hssize_t)k;
break;
case VARIABLE_DST:
- dst_offset[0] = i;
- dst_offset[1] = j;
- dst_offset[2] = k;
+ dst_offset[0] = (hssize_t)i;
+ dst_offset[1] = (hssize_t)j;
+ dst_offset[2] = (hssize_t)k;
src_offset[0] = 0;
src_offset[1] = 0;
src_offset[2] = 0;
break;
case VARIABLE_BOTH:
- dst_offset[0] = i;
- dst_offset[1] = j;
- dst_offset[2] = k;
- src_offset[0] = i;
- src_offset[1] = j;
- src_offset[2] = k;
+ dst_offset[0] = (hssize_t)i;
+ dst_offset[1] = (hssize_t)j;
+ dst_offset[2] = (hssize_t)k;
+ src_offset[0] = (hssize_t)i;
+ src_offset[1] = (hssize_t)j;
+ src_offset[2] = (hssize_t)k;
break;
default:
abort();
@@ -492,9 +492,14 @@ test_copy(int mode,
*/
AT();
printf(" acc != ref_value\n");
- printf(" i=%d, j=%d, k=%d, "
- "dx=%d, dy=%d, dz=%d\n",
- i, j, k, dx, dy, dz);
+ printf(" i=%lu, j=%lu, k=%lu, "
+ "dx=%lu, dy=%lu, dz=%lu\n",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)k,
+ (unsigned long)dx,
+ (unsigned long)dy,
+ (unsigned long)dz);
print_ref(nx, ny, nz);
printf("\n Destination array is:\n");
print_array(dst, nx, ny, nz);
@@ -524,9 +529,14 @@ test_copy(int mode,
AT();
printf(" acc != ref_value + nx*ny*nz - "
"dx*dy*dz\n");
- printf(" i=%d, j=%d, k=%d, "
- "dx=%d, dy=%d, dz=%d\n",
- i, j, k, dx, dy, dz);
+ printf(" i=%lu, j=%lu, k=%lu, "
+ "dx=%lu, dy=%lu, dz=%lu\n",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)k,
+ (unsigned long)dx,
+ (unsigned long)dy,
+ (unsigned long)dz);
print_ref(nx, ny, nz);
printf("\n Destination array is:\n");
print_array(dst, nx, ny, nz);
@@ -573,10 +583,10 @@ test_copy(int mode,
static herr_t
test_multifill(size_t nx)
{
- size_t i, j;
- size_t size;
- ssize_t src_stride;
- ssize_t dst_stride;
+ hsize_t i, j;
+ hsize_t size;
+ hssize_t src_stride;
+ hssize_t dst_stride;
char s[64];
struct a_struct {
@@ -618,7 +628,7 @@ test_multifill(size_t nx)
* Copy the fill value into each element
*/
size = nx;
- H5V_stride_copy(1, sizeof(double), &size,
+ H5V_stride_copy(1, (hsize_t)sizeof(double), &size,
&dst_stride, &(dst[0].mid), &src_stride, &(fill.mid));
/*
@@ -627,11 +637,11 @@ test_multifill(size_t nx)
s[0] = '\0';
for (i = 0; i < nx; i++) {
if (dst[i].left != 3333333) {
- sprintf(s, "bad dst[%d].left", i);
+ sprintf(s, "bad dst[%lu].left", (unsigned long)i);
} else if (dst[i].mid != fill.mid) {
- sprintf(s, "bad dst[%d].mid", i);
+ sprintf(s, "bad dst[%lu].mid", (unsigned long)i);
} else if (dst[i].right != 4444444) {
- sprintf(s, "bad dst[%d].right", i);
+ sprintf(s, "bad dst[%lu].right", (unsigned long)i);
}
if (s[0]) {
puts("*FAILED*");
@@ -642,8 +652,9 @@ test_multifill(size_t nx)
for (j = 0; j < sizeof(fill); j++) {
printf(" %02x", ((uint8 *) &fill)[j]);
}
- printf("\n dst[%d]={%d,%g,%d}\n ",
- i, dst[i].left, dst[i].mid, dst[i].right);
+ printf("\n dst[%lu]={%d,%g,%d}\n ",
+ (unsigned long)i,
+ dst[i].left, dst[i].mid, dst[i].right);
for (j = 0; j < sizeof(dst[i]); j++) {
printf(" %02x", ((uint8 *) (dst + i))[j]);
}
@@ -687,10 +698,10 @@ test_endian(size_t nx)
{
uint8 *src = NULL; /*source array */
uint8 *dst = NULL; /*destination array */
- ssize_t src_stride[2]; /*source strides */
- ssize_t dst_stride[2]; /*destination strides */
- size_t size[2]; /*size vector */
- size_t i, j;
+ hssize_t src_stride[2]; /*source strides */
+ hssize_t dst_stride[2]; /*destination strides */
+ hsize_t size[2]; /*size vector */
+ hsize_t i, j;
printf("%-70s", "Testing endian conversion by stride");
fflush(stdout);
@@ -709,7 +720,7 @@ test_endian(size_t nx)
size[1] = 4;
/* Copy the array */
- H5V_stride_copy(2, 1, size, dst_stride, dst + 3, src_stride, src);
+ H5V_stride_copy(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src);
/* Compare */
for (i = 0; i < nx; i++) {
@@ -722,7 +733,8 @@ test_endian(size_t nx)
* to a terminal.
*/
AT();
- printf(" i=%d, j=%d\n", i, j);
+ printf(" i=%lu, j=%lu\n",
+ (unsigned long)i, (unsigned long)j);
printf(" Source array is:\n");
print_array(src, nx, 4, 1);
printf("\n Result is:\n");
@@ -766,9 +778,9 @@ test_transpose(size_t nx, size_t ny)
{
intn *src = NULL;
intn *dst = NULL;
- size_t i, j;
- ssize_t src_stride[2], dst_stride[2];
- size_t size[2];
+ hsize_t i, j;
+ hssize_t src_stride[2], dst_stride[2];
+ hsize_t size[2];
char s[256];
sprintf(s, "Testing 2d transpose by stride %4lux%-lud",
@@ -795,11 +807,11 @@ test_transpose(size_t nx, size_t ny)
/* Copy and transpose */
if (nx == ny) {
- H5V_stride_copy(2, sizeof(*src), size,
+ H5V_stride_copy(2, (hsize_t)sizeof(*src), size,
dst_stride, dst,
src_stride, src);
} else {
- H5V_stride_copy(2, sizeof(*src), size,
+ H5V_stride_copy(2, (hsize_t)sizeof(*src), size,
dst_stride, dst,
src_stride, src);
}
@@ -811,10 +823,11 @@ test_transpose(size_t nx, size_t ny)
puts("*FAILED*");
if (!isatty(1)) {
AT();
- printf(" diff at i=%d, j=%d\n", i, j);
+ printf(" diff at i=%lu, j=%lu\n",
+ (unsigned long)i, (unsigned long)j);
printf(" Source is:\n");
for (i = 0; i < nx; i++) {
- printf("%3d:", i);
+ printf("%3lu:", (unsigned long)i);
for (j = 0; j < ny; j++) {
printf(" %6d", src[i * ny + j]);
}
@@ -822,7 +835,7 @@ test_transpose(size_t nx, size_t ny)
}
printf("\n Destination is:\n");
for (i = 0; i < ny; i++) {
- printf("%3d:", i);
+ printf("%3lu:", (unsigned long)i);
for (j = 0; j < nx; j++) {
printf(" %6d", dst[i * nx + j]);
}
@@ -870,10 +883,10 @@ test_sub_super(size_t nx, size_t ny)
uint8 *full = NULL; /*original image */
uint8 *half = NULL; /*image at 1/2 resolution */
uint8 *twice = NULL; /*2x2 pixels */
- ssize_t src_stride[4]; /*source stride info */
- ssize_t dst_stride[4]; /*destination stride info */
- size_t size[4]; /*number of sample points */
- size_t i, j;
+ hssize_t src_stride[4]; /*source stride info */
+ hssize_t dst_stride[4]; /*destination stride info */
+ hsize_t size[4]; /*number of sample points */
+ hsize_t i, j;
char s[256];
sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ",
@@ -897,7 +910,7 @@ test_sub_super(size_t nx, size_t ny)
dst_stride[1] = 1;
/* Copy */
- H5V_stride_copy(2, sizeof(uint8), size,
+ H5V_stride_copy(2, (hsize_t)sizeof(uint8), size,
dst_stride, half, src_stride, full);
/* Check */
@@ -907,8 +920,11 @@ test_sub_super(size_t nx, size_t ny)
puts("*FAILED*");
if (!isatty(1)) {
AT();
- printf(" full[%d][%d] != half[%d][%d]\n",
- i*2, j*2, i, j);
+ printf(" full[%lu][%lu] != half[%lu][%lu]\n",
+ (unsigned long)i*2,
+ (unsigned long)j*2,
+ (unsigned long)i,
+ (unsigned long)j);
printf(" full is:\n");
print_array(full, 2 * nx, 2 * ny, 1);
printf("\n half is:\n");
@@ -945,7 +961,7 @@ test_sub_super(size_t nx, size_t ny)
dst_stride[3] = sizeof(uint8);
/* Copy */
- H5V_stride_copy(4, sizeof(uint8), size,
+ H5V_stride_copy(4, (hsize_t)sizeof(uint8), size,
dst_stride, twice, src_stride, half);
/* Check */
@@ -953,17 +969,29 @@ test_sub_super(size_t nx, size_t ny)
for (i = 0; i < nx; i++) {
for (j = 0; j < ny; j++) {
if (half[i*ny+j] != twice[4*i*ny + 2*j]) {
- sprintf(s, "half[%d][%d] != twice[%d][%d]",
- i, j, 2 * i, 2 * j);
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)i*2,
+ (unsigned long)j*2);
} else if (half[i*ny + j] != twice[4*i*ny + 2*j + 1]) {
- sprintf(s, "half[%d][%d] != twice[%d][%d]",
- i, j, 2 * i, 2 * j + 1);
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)i*2,
+ (unsigned long)j*2+1);
} else if (half[i*ny + j] != twice[(2*i +1)*2*ny + 2*j]) {
- sprintf(s, "half[%d][%d] != twice[%d][%d]",
- i, j, 2 * i + 1, 2 * j);
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)i*2+1,
+ (unsigned long)j*2);
} else if (half[i*ny + j] != twice[(2*i+1)*2*ny + 2*j+1]) {
- sprintf(s, "half[%d][%d] != twice[%d][%d]",
- i, j, 2 * i + 1, 2 * j + 1);
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)i*2+1,
+ (unsigned long)j*2+1);
}
if (s[0]) {
puts("*FAILED*");
diff --git a/test/iopipe.c b/test/iopipe.c
index 640b2d3..ced3807 100644
--- a/test/iopipe.c
+++ b/test/iopipe.c
@@ -133,7 +133,7 @@ synchronize (void)
int
main (void)
{
- static size_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
+ static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
static int nread=NREAD_REQUESTS, nwrite=NWRITE_REQUESTS;
unsigned char *the_data = NULL;
@@ -142,10 +142,10 @@ main (void)
struct rusage r_start, r_stop;
struct timeval t_start, t_stop;
int i, fd;
- ssize_t n;
+ hssize_t n;
off_t offset;
- int start[2];
- size_t count[2];
+ hssize_t start[2];
+ hsize_t count[2];
printf ("I/O request size is %1.1fMB\n",
((double)(size[0])*(double)(size[1]))/(1024.0*1024));
@@ -162,8 +162,9 @@ main (void)
assert (file_space>=0);
dset = H5Dcreate (file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT);
assert (dset>=0);
- the_data = malloc (size[0]*size[1]);
- memset (the_data, 0xAA, size[0]*size[1]); /*initial fill for lazy malloc*/
+ the_data = malloc ((size_t)(size[0]*size[1]));
+ /*initial fill for lazy malloc*/
+ memset (the_data, 0xAA, (size_t)(size[0]*size[1]));
/* Fill raw */
synchronize ();
@@ -173,14 +174,14 @@ main (void)
for (i=0; i<nwrite; i++) {
putc (PROGRESS, stderr);
fflush (stderr);
- memset (the_data, 0xAA, size[0]*size[1]);
+ memset (the_data, 0xAA, (size_t)(size[0]*size[1]));
}
getrusage (RUSAGE_SELF, &r_stop);
gettimeofday (&t_stop, NULL);
putc ('\n', stderr);
print_stats ("fill raw",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Fill hdf5 */
@@ -200,7 +201,7 @@ main (void)
putc ('\n', stderr);
print_stats ("fill hdf5",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Write the raw dataset */
synchronize ();
@@ -212,7 +213,7 @@ main (void)
fflush (stderr);
offset = lseek (fd, 0, SEEK_SET);
assert (0==offset);
- n = write (fd, the_data, size[0]*size[1]);
+ n = write (fd, the_data, (size_t)(size[0]*size[1]));
assert (n>=0 && (size_t)n==size[0]*size[1]);
}
getrusage (RUSAGE_SELF, &r_stop);
@@ -220,7 +221,7 @@ main (void)
putc ('\n', stderr);
print_stats ("out raw",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Write the hdf5 dataset */
synchronize ();
@@ -239,7 +240,7 @@ main (void)
putc ('\n', stderr);
print_stats ("out hdf5",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Read the raw dataset */
synchronize ();
@@ -251,7 +252,7 @@ main (void)
fflush (stderr);
offset = lseek (fd, 0, SEEK_SET);
assert (0==offset);
- n = read (fd, the_data, size[0]*size[1]);
+ n = read (fd, the_data, (size_t)(size[0]*size[1]));
assert (n>=0 && (size_t)n==size[0]*size[1]);
}
getrusage (RUSAGE_SELF, &r_stop);
@@ -259,7 +260,7 @@ main (void)
putc ('\n', stderr);
print_stats ("in raw",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Read the hdf5 dataset */
@@ -279,7 +280,7 @@ main (void)
putc ('\n', stderr);
print_stats ("in hdf5",
&r_start, &r_stop, &t_start, &t_stop,
- nread*size[0]*size[1]);
+ (size_t)(nread*size[0]*size[1]));
/* Read hyperslab */
assert (size[0]>20 && size[1]>20);
@@ -303,7 +304,7 @@ main (void)
putc ('\n', stderr);
print_stats ("in hdf5 partial",
&r_start, &r_stop, &t_start, &t_stop,
- nread*count[0]*count[1]);
+ (size_t)(nread*count[0]*count[1]));
diff --git a/test/istore.c b/test/istore.c
index 9a906cc..fa90b55 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -1,11 +1,11 @@
/*
* Copyright (C) 1997 NCSA
- * All rights reserved.
+ * All rights reserved.
*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Wednesday, October 15, 1997
*
- * Purpose: Tests various aspects of indexed raw data storage.
+ * Purpose: Tests various aspects of indexed raw data storage.
*/
#include <H5private.h>
#include <H5Iprivate.h>
@@ -17,41 +17,41 @@
#include <H5Vprivate.h>
#if 1
-# define FILETYPE H5F_LOW_DFLT
-# define FILENAME "istore.h5"
+# define FILETYPE H5F_LOW_DFLT
+# define FILENAME "istore.h5"
#elif 0
-# define FILETYPE H5F_LOW_FAM
-# define FILENAME "istore-%05d.h5"
-# define TEST_FAMILY 1
+# define FILETYPE H5F_LOW_FAM
+# define FILENAME "istore-%05d.h5"
+# define TEST_FAMILY 1
#else
-# define FILETYPE H5F_LOW_SPLIT
-# define FILENAME "istore-split"
+# define FILETYPE H5F_LOW_SPLIT
+# define FILENAME "istore-split"
#endif
-#define TEST_SMALL 0x0001
-#define TEST_MEDIUM 0x0002
-#define TEST_LARGE 0x0004
+#define TEST_SMALL 0x0001
+#define TEST_MEDIUM 0x0002
+#define TEST_LARGE 0x0004
#ifndef HAVE_FUNCTION
#undef __FUNCTION__
#define __FUNCTION__ ""
#endif
-#define AT() printf (" at %s:%d in %s()...\n", \
- __FILE__, __LINE__, __FUNCTION__);
+#define AT() printf (" at %s:%d in %s()...\n", \
+ __FILE__, __LINE__, __FUNCTION__);
-size_t align_g[3] = {50, 50, 50};
-size_t zero[H5O_LAYOUT_NDIMS];
+hsize_t align_g[3] = {50, 50, 50};
+hssize_t zero[H5O_LAYOUT_NDIMS];
/*-------------------------------------------------------------------------
- * Function: print_array
+ * Function: print_array
*
- * Purpose: Prints the values in an array
+ * Purpose: Prints the values in an array
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
* Modifications:
*
@@ -63,37 +63,37 @@ print_array(uint8 *array, size_t nx, size_t ny, size_t nz)
size_t i, j, k;
for (i = 0; i < nx; i++) {
- if (nz > 1) {
- printf("i=%d:\n", i);
- } else {
- printf("%03d:", i);
- }
-
- for (j = 0; j < ny; j++) {
- if (nz > 1)
- printf("%03d:", j);
- for (k = 0; k < nz; k++) {
- printf(" %3d", *array++);
- }
- if (nz > 1)
- printf("\n");
- }
- printf("\n");
+ if (nz > 1) {
+ printf("i=%d:\n", i);
+ } else {
+ printf("%03d:", i);
+ }
+
+ for (j = 0; j < ny; j++) {
+ if (nz > 1)
+ printf("%03d:", j);
+ for (k = 0; k < nz; k++) {
+ printf(" %3d", *array++);
+ }
+ if (nz > 1)
+ printf("\n");
+ }
+ printf("\n");
}
}
/*-------------------------------------------------------------------------
- * Function: new_object
+ * Function: new_object
*
- * Purpose: Creates a new object that refers to a indexed storage of raw
- * data. No raw data is stored.
+ * Purpose: Creates a new object that refers to a indexed storage of raw
+ * data. No raw data is stored.
*
- * Return: Success: Handle to a new open object.
+ * Return: Success: Handle to a new open object.
*
- * Failure: NULL, error message printed.
+ * Failure: NULL, error message printed.
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
*
@@ -102,45 +102,45 @@ print_array(uint8 *array, size_t nx, size_t ny, size_t nz)
static int
new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/)
{
- H5O_layout_t layout;
- intn i;
+ H5O_layout_t layout;
+ intn i;
/* Create the object header */
if (H5O_create(f, 64, ent)) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" H5O_create() = NULL\n");
- }
- return -1;
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" H5O_create() = NULL\n");
+ }
+ return -1;
}
/* create chunked storage */
layout.type = H5D_CHUNKED;
layout.ndims = ndims;
for (i = 0; i < ndims; i++) {
- if (i < (int)NELMTS(align_g)) {
- layout.dim[i] = align_g[i];
- } else {
- layout.dim[i] = 2;
- }
+ if (i < (int)NELMTS(align_g)) {
+ layout.dim[i] = align_g[i];
+ } else {
+ layout.dim[i] = 2;
+ }
}
H5F_arr_create(f, &layout/*in,out*/);
if (H5O_modify(ent, H5O_LAYOUT, H5O_NEW_MESG, 0, &layout) < 0) {
- printf("*FAILED*\n");
- if (!isatty(1)) {
- AT();
- printf(" H5O_modify istore message failure\n");
- }
- return -1;
+ printf("*FAILED*\n");
+ if (!isatty(1)) {
+ AT();
+ printf(" H5O_modify istore message failure\n");
+ }
+ return -1;
}
/* Give the object header a name */
if (H5G_insert(H5G_getcwg(f), name, ent) < 0) {
- printf("*FAILED*\n");
- if (!isatty(1)) {
- AT();
- printf(" H5G_insert(f, name=\"%s\", ent) failed\n", name);
- }
- return -1;
+ printf("*FAILED*\n");
+ if (!isatty(1)) {
+ AT();
+ printf(" H5G_insert(f, name=\"%s\", ent) failed\n", name);
+ }
+ return -1;
}
/* Close the header */
H5O_close(ent);
@@ -149,17 +149,17 @@ new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/)
}
/*-------------------------------------------------------------------------
- * Function: test_create
+ * Function: test_create
*
- * Purpose: Creates a named object that refers to indexed storage of raw
- * data. No raw data is stored.
+ * Purpose: Creates a named object that refers to indexed storage of raw
+ * data. No raw data is stored.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
*
@@ -168,16 +168,16 @@ new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/)
static herr_t
test_create(H5F_t *f, const char *prefix)
{
- H5G_entry_t handle;
- intn i;
- char name[256];
+ H5G_entry_t handle;
+ intn i;
+ char name[256];
printf("%-70s", "Testing istore create");
for (i = 1; i <= H5O_LAYOUT_NDIMS; i++) {
- sprintf(name, "%s_%02d", prefix, i);
- if (new_object(f, name, i, &handle) < 0)
- return FAIL;
+ sprintf(name, "%s_%02d", prefix, i);
+ if (new_object(f, name, i, &handle) < 0)
+ return FAIL;
}
puts(" PASSED");
@@ -185,18 +185,18 @@ test_create(H5F_t *f, const char *prefix)
}
/*-------------------------------------------------------------------------
- * Function: test_extend
+ * Function: test_extend
*
- * Purpose: Creates an empty object and then writes to it in such a way
- * as to always extend the object's domain without creating
- * holes and without causing the object to become concave.
+ * Purpose: Creates an empty object and then writes to it in such a way
+ * as to always extend the object's domain without creating
+ * holes and without causing the object to become concave.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
*
@@ -204,34 +204,34 @@ test_create(H5F_t *f, const char *prefix)
*/
static herr_t
test_extend(H5F_t *f, const char *prefix,
- size_t nx, size_t ny, size_t nz)
+ size_t nx, size_t ny, size_t nz)
{
- H5G_entry_t handle;
- size_t i, j, k, ctr;
+ H5G_entry_t handle;
+ hsize_t i, j, k, ctr;
int ndims;
- uint8 *buf = NULL, *check = NULL, *whole = NULL;
- char dims[64], s[256], name[256];
- size_t offset[3];
- size_t max_corner[3];
- size_t size[3];
- size_t whole_size[3];
- size_t nelmts;
- H5O_layout_t layout;
+ uint8 *buf = NULL, *check = NULL, *whole = NULL;
+ char dims[64], s[256], name[256];
+ hssize_t offset[3];
+ hssize_t max_corner[3];
+ hsize_t size[3];
+ hsize_t whole_size[3];
+ hsize_t nelmts;
+ H5O_layout_t layout;
if (!nz) {
- if (!ny) {
- ndims = 1;
- ny = nz = 1;
- sprintf(dims, "%lu", (unsigned long) nx);
- } else {
- ndims = 2;
- nz = 1;
- sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
- }
+ if (!ny) {
+ ndims = 1;
+ ny = nz = 1;
+ sprintf(dims, "%lu", (unsigned long) nx);
+ } else {
+ ndims = 2;
+ nz = 1;
+ sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ }
} else {
- ndims = 3;
- sprintf(dims, "%lux%lux%lu",
- (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
+ ndims = 3;
+ sprintf(dims, "%lux%lux%lu",
+ (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
}
sprintf(s, "Testing istore extend: %s", dims);
@@ -243,27 +243,27 @@ test_extend(H5F_t *f, const char *prefix,
/* Build the new empty object */
sprintf(name, "%s_%s", prefix, dims);
if (new_object(f, name, ndims, &handle) < 0) {
- if (!isatty(1)) {
- AT();
- printf(" Cannot create %d-d object `%s'\n", ndims, name);
- }
- goto error;
+ if (!isatty(1)) {
+ AT();
+ printf(" Cannot create %d-d object `%s'\n", ndims, name);
+ }
+ goto error;
}
if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout)) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Unable to read istore message\n");
- }
- goto error;
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Unable to read istore message\n");
+ }
+ goto error;
}
if (ndims != layout.ndims) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Header read error: istore.ndims != %d\n", ndims);
- }
- goto error;
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Header read error: istore.ndims != %d\n", ndims);
+ }
+ goto error;
}
whole_size[0] = nx;
whole_size[1] = ny;
@@ -272,124 +272,128 @@ test_extend(H5F_t *f, const char *prefix,
max_corner[1] = 0;
max_corner[2] = 0;
- for (ctr = 0; H5V_vector_lt(ndims, max_corner, whole_size); ctr++) {
-
- /* Size and location */
- if (0 == ctr) {
- offset[0] = offset[1] = offset[2] = 0;
- size[0] = size[1] = size[2] = 1;
- nelmts = 1;
- } else {
- for (i=0, nelmts=1; i<(size_t)ndims; i++) {
- if (ctr % ndims == i) {
- offset[i] = max_corner[i];
- size[i] = MIN(1, whole_size[i] - offset[i]);
- } else {
- offset[i] = 0;
- size[i] = max_corner[i];
- }
- nelmts *= size[i];
- }
- }
+ for (ctr = 0; H5V_vector_lt_s(ndims, max_corner, whole_size); ctr++) {
+
+ /* Size and location */
+ if (0 == ctr) {
+ offset[0] = offset[1] = offset[2] = 0;
+ size[0] = size[1] = size[2] = 1;
+ nelmts = 1;
+ } else {
+ for (i=0, nelmts=1; i<(size_t)ndims; i++) {
+ if (ctr % ndims == i) {
+ offset[i] = max_corner[i];
+ size[i] = MIN(1, whole_size[i] - offset[i]);
+ } else {
+ offset[i] = 0;
+ size[i] = max_corner[i];
+ }
+ nelmts *= size[i];
+ }
+ }
#if 0
- if (0 == ctr)
- printf("\n");
- printf(" Insert: ctr=%d, corner=(%d", ctr, offset[0]);
- if (ndims > 1)
- printf(",%d", offset[1]);
- if (ndims > 2)
- printf(",%d", offset[2]);
- printf("), size=(%d", size[0]);
- if (ndims > 1)
- printf(",%d", size[1]);
- if (ndims > 2)
- printf(",%d", size[2]);
- printf("), %d element%s", nelmts, 1 == nelmts ? "" : "s");
- if (0 == nelmts)
- printf(" *SKIPPED*");
- printf("\n");
+ if (0 == ctr)
+ printf("\n");
+ printf(" Insert: ctr=%d, corner=(%d", ctr, offset[0]);
+ if (ndims > 1)
+ printf(",%d", offset[1]);
+ if (ndims > 2)
+ printf(",%d", offset[2]);
+ printf("), size=(%d", size[0]);
+ if (ndims > 1)
+ printf(",%d", size[1]);
+ if (ndims > 2)
+ printf(",%d", size[2]);
+ printf("), %d element%s", nelmts, 1 == nelmts ? "" : "s");
+ if (0 == nelmts)
+ printf(" *SKIPPED*");
+ printf("\n");
#endif
- /* Fill the source array */
- if (0 == nelmts) continue;
- memset(buf, (signed)(128+ctr), nelmts);
-
- /* Write to disk */
- if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Write failed: ctr=%d\n", ctr);
- }
- goto error;
- }
- /* Read from disk */
- memset(check, 0xff, nelmts);
- if (H5F_arr_read(f, &layout, NULL, size, size, zero, offset,
+ /* Fill the source array */
+ if (0 == nelmts) continue;
+ memset(buf, (signed)(128+ctr), (size_t)nelmts);
+
+ /* Write to disk */
+ if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
+ }
+ goto error;
+ }
+ /* Read from disk */
+ memset(check, 0xff, (size_t)nelmts);
+ if (H5F_arr_read(f, &layout, NULL, size, size, zero, offset,
check)<0) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Read failed: ctr=%d\n", ctr);
- }
- goto error;
- }
- if (memcmp(buf, check, nelmts)) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Read check failed: ctr=%d\n", ctr);
- printf(" Wrote:\n");
- print_array(buf, size[0], size[1], size[2]);
- printf(" Read:\n");
- print_array(check, size[0], size[1], size[2]);
- }
- goto error;
- }
- /* Write to `whole' buffer for later checking */
- H5V_hyper_copy(ndims, size,
- whole_size, offset, whole, /*dst */
- size, H5V_ZERO, buf); /*src */
-
- /* Update max corner */
- for (i=0; i<(size_t)ndims; i++) {
- max_corner[i] = MAX(max_corner[i], offset[i] + size[i]);
- }
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Read failed: ctr=%lu\n", (unsigned long)ctr);
+ }
+ goto error;
+ }
+ if (memcmp(buf, check, (size_t)nelmts)) {
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Read check failed: ctr=%lu\n", (unsigned long)ctr);
+ printf(" Wrote:\n");
+ print_array(buf, (size_t)size[0], (size_t)size[1],
+ (size_t)size[2]);
+ printf(" Read:\n");
+ print_array(check, (size_t)size[0], (size_t)size[1],
+ (size_t)size[2]);
+ }
+ goto error;
+ }
+ /* Write to `whole' buffer for later checking */
+ H5V_hyper_copy(ndims, size,
+ whole_size, offset, whole, /*dst */
+ size, H5V_ZERO, buf); /*src */
+
+ /* Update max corner */
+ for (i=0; i<(size_t)ndims; i++) {
+ max_corner[i] = MAX(max_corner[i], offset[i]+(hssize_t)size[i]);
+ }
}
/* Now read the entire array back out and check it */
memset(buf, 0xff, nx * ny * nz);
if (H5F_arr_read(f, &layout, NULL, whole_size, whole_size, zero, zero,
buf)<0) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Read failed for whole array\n");
- }
- goto error;
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Read failed for whole array\n");
+ }
+ goto error;
}
for (i = 0; i < nx; i++) {
- for (j = 0; j < ny; j++) {
- for (k = 0; k < nz; k++) {
- if (whole[i * ny * nz + j * nz + k] != buf[i * ny * nz + j * nz + k]) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Check failed at i=%d", i);
- if (ndims > 1)
- printf(", j=%d", j);
- if (ndims > 2)
- printf(", k=%d", k);
- printf("\n Check array is:\n");
- print_array(whole, nx, ny, nz);
- printf(" Value read is:\n");
- print_array(buf, nx, ny, nz);
- }
- goto error;
- }
- }
- }
+ for (j = 0; j < ny; j++) {
+ for (k = 0; k < nz; k++) {
+ if (whole[i * ny * nz + j * nz + k] != buf[i * ny * nz + j * nz + k]) {
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Check failed at i=%lu", (unsigned long)i);
+ if (ndims > 1) {
+ printf(", j=%lu", (unsigned long)j);
+ }
+ if (ndims > 2) {
+ printf(", k=%lu", (unsigned long)k);
+ }
+ printf("\n Check array is:\n");
+ print_array(whole, nx, ny, nz);
+ printf(" Value read is:\n");
+ print_array(buf, nx, ny, nz);
+ }
+ goto error;
+ }
+ }
+ }
}
puts(" PASSED");
@@ -406,17 +410,17 @@ test_extend(H5F_t *f, const char *prefix,
}
/*-------------------------------------------------------------------------
- * Function: test_sparse
+ * Function: test_sparse
*
- * Purpose: Creates a sparse matrix consisting of NBLOCKS randomly placed
- * blocks each of size NX,NY,NZ.
+ * Purpose: Creates a sparse matrix consisting of NBLOCKS randomly placed
+ * blocks each of size NX,NY,NZ.
*
- * 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:
*
@@ -424,30 +428,31 @@ test_extend(H5F_t *f, const char *prefix,
*/
static herr_t
test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
- size_t nx, size_t ny, size_t nz)
+ size_t nx, size_t ny, size_t nz)
{
- intn ndims;
- size_t ctr;
- char dims[64], s[256], name[256];
- size_t offset[3], size[3], total = 0;
- H5G_entry_t handle;
- H5O_layout_t layout;
- uint8 *buf = NULL;
+ intn ndims;
+ hsize_t ctr;
+ char dims[64], s[256], name[256];
+ hssize_t offset[3];
+ hsize_t size[3], total = 0;
+ H5G_entry_t handle;
+ H5O_layout_t layout;
+ uint8 *buf = NULL;
if (!nz) {
- if (!ny) {
- ndims = 1;
- ny = nz = 1;
- sprintf(dims, "%lu", (unsigned long) nx);
- } else {
- ndims = 2;
- nz = 1;
- sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
- }
+ if (!ny) {
+ ndims = 1;
+ ny = nz = 1;
+ sprintf(dims, "%lu", (unsigned long) nx);
+ } else {
+ ndims = 2;
+ nz = 1;
+ sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ }
} else {
- ndims = 3;
- sprintf(dims, "%lux%lux%lu",
- (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
+ ndims = 3;
+ sprintf(dims, "%lux%lux%lu",
+ (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
}
sprintf(s, "Testing istore sparse: %s", dims);
@@ -457,55 +462,55 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
/* Build the new empty object */
sprintf(name, "%s_%s", prefix, dims);
if (new_object(f, name, ndims, &handle) < 0) {
- if (!isatty(1)) {
- AT();
- printf(" Cannot create %d-d object `%s'\n", ndims, name);
- }
- goto error;
+ if (!isatty(1)) {
+ AT();
+ printf(" Cannot create %d-d object `%s'\n", ndims, name);
+ }
+ goto error;
}
if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout)) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Unable to read istore message\n");
- }
- goto error;
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Unable to read istore message\n");
+ }
+ goto error;
}
for (ctr=0; ctr<nblocks; ctr++) {
- offset[0] = rand() % 1000000;
- offset[1] = rand() % 1000000;
- offset[2] = rand() % 1000000;
- size[0] = nx;
- size[1] = ny;
- size[2] = nz;
- memset(buf, (signed)(128+ctr), nx * ny * nz);
-
- /* write to disk */
- if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
- puts("*FAILED*");
- if (!isatty(1)) {
- AT();
- printf(" Write failed: ctr=%d\n", ctr);
- printf(" offset=(%lu", (unsigned long) (offset[0]));
- if (ndims > 1)
- printf(",%lu", (unsigned long) (offset[1]));
- if (ndims > 2)
- printf(",%lu", (unsigned long) (offset[2]));
- printf("), size=(%lu", (unsigned long) (size[0]));
- if (ndims > 1)
- printf(",%lu", (unsigned long) (size[1]));
- if (ndims > 2)
- printf(",%lu", (unsigned long) (size[2]));
- printf(")\n");
- }
- goto error;
- }
- total += nx * ny * nz;
+ offset[0] = rand() % 1000000;
+ offset[1] = rand() % 1000000;
+ offset[2] = rand() % 1000000;
+ size[0] = nx;
+ size[1] = ny;
+ size[2] = nz;
+ memset(buf, (signed)(128+ctr), nx * ny * nz);
+
+ /* write to disk */
+ if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
+ puts("*FAILED*");
+ if (!isatty(1)) {
+ AT();
+ printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
+ printf(" offset=(%lu", (unsigned long) (offset[0]));
+ if (ndims > 1)
+ printf(",%lu", (unsigned long) (offset[1]));
+ if (ndims > 2)
+ printf(",%lu", (unsigned long) (offset[2]));
+ printf("), size=(%lu", (unsigned long) (size[0]));
+ if (ndims > 1)
+ printf(",%lu", (unsigned long) (size[1]));
+ if (ndims > 2)
+ printf(",%lu", (unsigned long) (size[2]));
+ printf(")\n");
+ }
+ goto error;
+ }
+ total += nx * ny * nz;
#if 0
- printf("ctr: ctr=%d, total=%lu\n", ctr, (unsigned long) total);
+ printf("ctr: ctr=%d, total=%lu\n", ctr, (unsigned long) total);
#endif
- /* We don't test reading yet.... */
+ /* We don't test reading yet.... */
}
puts(" PASSED");
@@ -518,16 +523,16 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
}
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Tests indexed storage stuff.
+ * Purpose: Tests indexed storage stuff.
*
- * Return: Success: exit(0)
+ * Return: Success: exit(0)
*
- * Failure: exit(non-zero)
+ * Failure: exit(non-zero)
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
*
@@ -536,43 +541,43 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
int
main(int argc, char *argv[])
{
- H5F_t *f;
- herr_t status;
- int nerrors = 0;
- uintn size_of_test;
- hid_t template_id;
- H5F_create_t *creation_template = NULL;
- H5G_t *dir = NULL;
+ H5F_t *f;
+ herr_t status;
+ int nerrors = 0;
+ uintn size_of_test;
+ hid_t template_id;
+ H5F_create_t *creation_template = NULL;
+ H5G_t *dir = NULL;
setbuf(stdout, NULL);
/* Parse arguments or assume `small' */
if (1 == argc) {
- size_of_test = TEST_SMALL;
+ size_of_test = TEST_SMALL;
} else {
- intn i;
- for (i = 1, size_of_test = 0; i < argc; i++) {
- if (!strcmp(argv[i], "small")) {
- size_of_test |= TEST_SMALL;
- } else if (!strcmp(argv[i], "medium")) {
- size_of_test |= TEST_MEDIUM;
- } else if (!strcmp(argv[i], "large")) {
- size_of_test |= TEST_LARGE;
- } else {
- printf("unrecognized argument: %s\n", argv[i]);
+ intn i;
+ for (i = 1, size_of_test = 0; i < argc; i++) {
+ if (!strcmp(argv[i], "small")) {
+ size_of_test |= TEST_SMALL;
+ } else if (!strcmp(argv[i], "medium")) {
+ size_of_test |= TEST_MEDIUM;
+ } else if (!strcmp(argv[i], "large")) {
+ size_of_test |= TEST_LARGE;
+ } else {
+ printf("unrecognized argument: %s\n", argv[i]);
#if 0
- exit(1);
+ exit(1);
#endif
- }
- }
+ }
+ }
}
printf("Test sizes: ");
if (size_of_test & TEST_SMALL)
- printf(" SMALL");
+ printf(" SMALL");
if (size_of_test & TEST_MEDIUM)
- printf(" MEDIUM");
+ printf(" MEDIUM");
if (size_of_test & TEST_LARGE)
- printf(" LARGE");
+ printf(" LARGE");
printf("\n");
/*
@@ -584,21 +589,21 @@ main(int argc, char *argv[])
/* Create the test file */
if (NULL == (f = H5F_open(FILENAME,
- (H5F_ACC_CREAT | H5F_ACC_RDWR | H5F_ACC_TRUNC |
- H5F_ACC_DEBUG),
- creation_template, NULL))) {
- printf("Cannot create file %s; test aborted\n", FILENAME);
- exit(1);
+ (H5F_ACC_CREAT | H5F_ACC_RDWR | H5F_ACC_TRUNC |
+ H5F_ACC_DEBUG),
+ creation_template, NULL))) {
+ printf("Cannot create file %s; test aborted\n", FILENAME);
+ exit(1);
}
#ifdef TEST_FAMILY
{
- /*
- * For testing file families, fool the library into thinking it already
- * allocated a whole bunch of data.
- */
- haddr_t addr;
- addr.offset = 8 * ((uint64) 1 << 30); /*8 GB */
- H5F_low_seteof(f->shared->lf, &addr);
+ /*
+ * For testing file families, fool the library into thinking it already
+ * allocated a whole bunch of data.
+ */
+ haddr_t addr;
+ addr.offset = 8 * ((uint64) 1 << 30); /*8 GB */
+ H5F_low_seteof(f->shared->lf, &addr);
}
#endif
@@ -618,51 +623,51 @@ main(int argc, char *argv[])
nerrors += status < 0 ? 1 : 0;
if (size_of_test & TEST_SMALL) {
- status = test_extend(f, "extend", 10, 0, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_extend(f, "extend", 10, 10, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_extend(f, "extend", 10, 10, 10);
- nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 10, 0, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 10, 10, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 10, 10, 10);
+ nerrors += status < 0 ? 1 : 0;
}
if (size_of_test & TEST_MEDIUM) {
- status = test_extend(f, "extend", 10000, 0, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_extend(f, "extend", 2500, 10, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_extend(f, "extend", 10, 400, 10);
- nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 10000, 0, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 2500, 10, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_extend(f, "extend", 10, 400, 10);
+ nerrors += status < 0 ? 1 : 0;
}
if (size_of_test & TEST_SMALL) {
- status = test_sparse(f, "sparse", 100, 5, 0, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_sparse(f, "sparse", 100, 3, 4, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_sparse(f, "sparse", 100, 2, 3, 4);
- nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 100, 5, 0, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 100, 3, 4, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 100, 2, 3, 4);
+ nerrors += status < 0 ? 1 : 0;
}
if (size_of_test & TEST_MEDIUM) {
- status = test_sparse(f, "sparse", 1000, 30, 0, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_sparse(f, "sparse", 2000, 7, 3, 0);
- nerrors += status < 0 ? 1 : 0;
- status = test_sparse(f, "sparse", 2000, 4, 2, 3);
- nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 1000, 30, 0, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 2000, 7, 3, 0);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 2000, 4, 2, 3);
+ nerrors += status < 0 ? 1 : 0;
}
if (size_of_test & TEST_LARGE) {
- status = test_sparse(f, "sparse", 800, 50, 50, 50);
- nerrors += status < 0 ? 1 : 0;
+ status = test_sparse(f, "sparse", 800, 50, 50, 50);
+ nerrors += status < 0 ? 1 : 0;
}
/* Close the test file and exit */
H5F_close(f);
if (nerrors) {
- printf("***** %d I-STORE TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
- if (isatty(1)) {
- printf("(Redirect output to a pager or a file to see "
- "debug output)\n");
- }
- exit(1);
+ printf("***** %d I-STORE TEST%s FAILED! *****\n",
+ nerrors, 1 == nerrors ? "" : "S");
+ if (isatty(1)) {
+ printf("(Redirect output to a pager or a file to see "
+ "debug output)\n");
+ }
+ exit(1);
}
printf("All i-store tests passed.\n");
return 0;
diff --git a/test/shtype.c b/test/shtype.c
index 944941b..243ab5c 100644
--- a/test/shtype.c
+++ b/test/shtype.c
@@ -14,6 +14,9 @@
#ifndef HAVE_ATTRIBUTE
# undef __attribute__
# define __attribute__(X) /*void*/
+# define __unused__ /*void*/
+#else
+# define __unused__ __attribute__((unused))
#endif
@@ -34,7 +37,7 @@
*-------------------------------------------------------------------------
*/
static herr_t
-display_error_cb (void *client_data __attribute__((unused)))
+display_error_cb (void __unused__ *client_data)
{
puts ("*FAILED*");
H5Eprint (stdout);
@@ -64,7 +67,7 @@ static int
test_1 (void)
{
hid_t f, d1, d2, s1, t1, t2;
- size_t size[1] = {1};
+ hsize_t size[1] = {1};
printf ("%-70s", "...creating/quering datasets with shared type");
fflush (stdout);
@@ -121,7 +124,7 @@ static int
test_2 (void)
{
hid_t f1, f2, t1, t2, s1, d1, d2;
- size_t size[1] = {1};
+ hsize_t size[1] = {1};
char buf[32];
int i;
@@ -192,7 +195,7 @@ static int
test_3 (void)
{
hid_t f1, s1, t1, d1;
- size_t size[1] = {1};
+ hsize_t size[1] = {1};
herr_t status, (*ef)(void*)=NULL;
void *ed = NULL;
diff --git a/test/tfile.c b/test/tfile.c
index 7afc184..bfdf21f 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1,24 +1,24 @@
/****************************************************************************
- * 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. *
+ * *
****************************************************************************/
#ifdef RCSID
-static char RcsId[] = "$Revision$";
+static char RcsId[] = "$Revision$";
#endif
/* $Id$ */
/***********************************************************
*
-* Test program: tfile
+* Test program: tfile
*
* Test the low-level file I/O features.
*
@@ -30,26 +30,26 @@ static char RcsId[] = "$Revision$";
#include <H5Bprivate.h>
#include <H5Pprivate.h>
-#define F1_USERBLOCK_SIZE 0
-#define F1_OFFSET_SIZE sizeof(size_t)
-#define F1_LENGTH_SIZE sizeof(size_t)
-#define F1_SYM_LEAF_K 4
-#define F1_SYM_INTERN_K 16
-#define FILE1 "tfile1.h5"
-
-#define F2_USERBLOCK_SIZE 512
-#define F2_OFFSET_SIZE 8
-#define F2_LENGTH_SIZE 8
-#define F2_SYM_LEAF_K 8
-#define F2_SYM_INTERN_K 32
-#define FILE2 "tfile2.h5"
-
-#define F3_USERBLOCK_SIZE 0
-#define F3_OFFSET_SIZE F2_OFFSET_SIZE
-#define F3_LENGTH_SIZE F2_LENGTH_SIZE
-#define F3_SYM_LEAF_K F2_SYM_LEAF_K
-#define F3_SYM_INTERN_K F2_SYM_INTERN_K
-#define FILE3 "tfile3.h5"
+#define F1_USERBLOCK_SIZE (hsize_t)0
+#define F1_OFFSET_SIZE sizeof(hsize_t)
+#define F1_LENGTH_SIZE sizeof(hsize_t)
+#define F1_SYM_LEAF_K 4
+#define F1_SYM_INTERN_K 16
+#define FILE1 "tfile1.h5"
+
+#define F2_USERBLOCK_SIZE (hsize_t)512
+#define F2_OFFSET_SIZE 8
+#define F2_LENGTH_SIZE 8
+#define F2_SYM_LEAF_K 8
+#define F2_SYM_INTERN_K 32
+#define FILE2 "tfile2.h5"
+
+#define F3_USERBLOCK_SIZE (hsize_t)0
+#define F3_OFFSET_SIZE F2_OFFSET_SIZE
+#define F3_LENGTH_SIZE F2_LENGTH_SIZE
+#define F3_SYM_LEAF_K F2_SYM_LEAF_K
+#define F3_SYM_INTERN_K F2_SYM_INTERN_K
+#define FILE3 "tfile3.h5"
/****************************************************************
**
@@ -59,12 +59,13 @@ static char RcsId[] = "$Revision$";
static void
test_file_create(void)
{
- hid_t fid1, fid2, fid3; /* HDF5 File IDs */
- hid_t tmpl1, tmpl2; /* File creation templates */
- size_t parm; /* File-creation parameters */
- size_t parm2; /* File-creation parameters */
- int iparm, iparm2;
- herr_t ret; /* Generic return value */
+ hid_t fid1, fid2, fid3; /* HDF5 File IDs */
+ hid_t tmpl1, tmpl2; /*file creation templates */
+ hsize_t ublock; /*sizeof userblock */
+ size_t parm; /*file-creation parameters */
+ size_t parm2; /*file-creation parameters */
+ int iparm, iparm2;
+ herr_t ret; /*generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File Creation I/O\n"));
@@ -82,9 +83,9 @@ test_file_create(void)
CHECK(tmpl1, FAIL, "H5Fget_create_template");
/* Get the file-creation parameters */
- ret = H5Pget_userblock(tmpl1, &parm);
+ ret = H5Pget_userblock(tmpl1, &ublock);
CHECK(ret, FAIL, "H5Pget_userblock");
- VERIFY(parm, F1_USERBLOCK_SIZE, "H5Pget_userblock");
+ VERIFY(ublock, F1_USERBLOCK_SIZE, "H5Pget_userblock");
ret = H5Pget_sizes(tmpl1, &parm, &parm2);
CHECK(ret, FAIL, "H5Pget_sizes");
@@ -136,9 +137,9 @@ test_file_create(void)
CHECK(tmpl1, FAIL, "H5Fget_create_template");
/* Get the file-creation parameters */
- ret = H5Pget_userblock(tmpl1, &parm);
+ ret = H5Pget_userblock(tmpl1, &ublock);
CHECK(ret, FAIL, "H5Pget_userblock");
- VERIFY(parm, F2_USERBLOCK_SIZE, "H5Pget_userblock");
+ VERIFY(ublock, F2_USERBLOCK_SIZE, "H5Pget_userblock");
ret = H5Pget_sizes(tmpl1, &parm, &parm2);
CHECK(ret, FAIL, "H5Pget_sizes");
@@ -178,9 +179,9 @@ test_file_create(void)
CHECK(tmpl1, FAIL, "H5Fget_create_template");
/* Get the file-creation parameters */
- ret = H5Pget_userblock(tmpl1, &parm);
+ ret = H5Pget_userblock(tmpl1, &ublock);
CHECK(ret, FAIL, "H5Pget_userblock");
- VERIFY(parm, F3_USERBLOCK_SIZE, "H5Pget_userblock");
+ VERIFY(ublock, F3_USERBLOCK_SIZE, "H5Pget_userblock");
ret = H5Pget_sizes(tmpl1, &parm, &parm2);
CHECK(ret, FAIL, "H5Pget_sizes");
@@ -207,7 +208,7 @@ test_file_create(void)
/* Close third file */
ret = H5Fclose(fid3);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_file_create() */
+} /* test_file_create() */
/****************************************************************
**
@@ -217,12 +218,13 @@ test_file_create(void)
static void
test_file_open(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t tmpl1; /* File creation templates */
- size_t parm; /* File-creation parameters */
- size_t parm2; /* File-creation parameters */
- int iparm, iparm2;
- herr_t ret; /* Generic return value */
+ hid_t fid1; /*HDF5 File IDs */
+ hid_t tmpl1; /*file creation templates */
+ hsize_t ublock; /*sizeof user block */
+ size_t parm; /*file-creation parameters */
+ size_t parm2; /*file-creation parameters */
+ int iparm, iparm2;
+ herr_t ret; /*generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File Opening I/O\n"));
@@ -236,9 +238,9 @@ test_file_open(void)
CHECK(tmpl1, FAIL, "H5Fget_create_template");
/* Get the file-creation parameters */
- ret = H5Pget_userblock(tmpl1, &parm);
+ ret = H5Pget_userblock(tmpl1, &ublock);
CHECK(ret, FAIL, "H5Pget_userblock");
- VERIFY(parm, F2_USERBLOCK_SIZE, "H5Pget_userblock");
+ VERIFY(ublock, F2_USERBLOCK_SIZE, "H5Pget_userblock");
ret = H5Pget_sizes(tmpl1, &parm, &parm2);
CHECK(ret, FAIL, "H5Pget_sizes");
@@ -257,7 +259,7 @@ test_file_open(void)
/* Close first file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_file_open() */
+} /* test_file_open() */
/****************************************************************
**
@@ -270,6 +272,6 @@ test_file(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File I/O\n"));
- test_file_create(); /* Test file creation (also creation templates) */
- test_file_open(); /* Test file opening */
-} /* test_file() */
+ test_file_create(); /* Test file creation (also creation templates) */
+ test_file_open(); /* Test file opening */
+} /* test_file() */
diff --git a/test/th5s.c b/test/th5s.c
index 4431fef..9b2561b 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -1,24 +1,24 @@
/****************************************************************************
- * 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. *
+ * *
****************************************************************************/
#ifdef RCSID
-static char RcsId[] = "$Revision$";
+static char RcsId[] = "$Revision$";
#endif
/* $Id$ */
/***********************************************************
*
-* Test program: th5p
+* Test program: th5p
*
* Test the dataspace functionality
*
@@ -35,18 +35,18 @@ static char RcsId[] = "$Revision$";
/* 3-D dataset with fixed dimensions */
#define SPACE1_NAME "Space1"
-#define SPACE1_RANK 3
-#define SPACE1_DIM1 3
-#define SPACE1_DIM2 15
-#define SPACE1_DIM3 13
+#define SPACE1_RANK 3
+#define SPACE1_DIM1 3
+#define SPACE1_DIM2 15
+#define SPACE1_DIM3 13
/* 4-D dataset with one unlimited dimension */
#define SPACE2_NAME "Space2"
-#define SPACE2_RANK 4
-#define SPACE2_DIM1 0
-#define SPACE2_DIM2 15
-#define SPACE2_DIM3 13
-#define SPACE2_DIM4 23
+#define SPACE2_RANK 4
+#define SPACE2_DIM1 0
+#define SPACE2_DIM2 15
+#define SPACE2_DIM3 13
+#define SPACE2_DIM4 23
/****************************************************************
**
@@ -56,15 +56,15 @@ static char RcsId[] = "$Revision$";
static void
test_h5p_basic(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t sid1, sid2; /* Dataspace ID */
- uint32 rank; /* Logical rank of dataspace */
- size_t dims1[] =
- {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}, /* dataspace dim sizes */
- dims2[] =
- {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, SPACE2_DIM4}, tdims[4]; /* Dimension array to test with */
- size_t n; /* number of dataspace elements */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t sid1, sid2; /* Dataspace ID */
+ uint32 rank; /* Logical rank of dataspace */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3,
+ SPACE2_DIM4};
+ hsize_t tdims[4]; /* Dimension array to test with */
+ size_t n; /* Number of dataspace elements */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Datatype Manipulation\n"));
@@ -112,7 +112,7 @@ test_h5p_basic(void)
/* Close first file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_h5p_basic() */
+} /* test_h5p_basic() */
/****************************************************************
**
@@ -125,5 +125,5 @@ test_h5p(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspaces\n"));
- test_h5p_basic(); /* Test basic H5S code */
-} /* test_h5p() */
+ test_h5p_basic(); /* Test basic H5S code */
+} /* test_h5p() */