summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-07 15:34:16 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-07 15:34:16 (GMT)
commit68fa66bf8130d6a6e607e233da8cc61a154bf172 (patch)
treeb5a0e0120492c7bb9f935ab74f4cef97d6bbcbee /src
parent92571bbe1d77c74ddefeeba6ac0b2097593c058d (diff)
downloadhdf5-68fa66bf8130d6a6e607e233da8cc61a154bf172.zip
hdf5-68fa66bf8130d6a6e607e233da8cc61a154bf172.tar.gz
hdf5-68fa66bf8130d6a6e607e233da8cc61a154bf172.tar.bz2
[svn-r337] Changes since 19980403
---------------------- ./configure.in Moved setting of compiler warning switches earlier in the file. Turned on more warning switches to gcc. ./config/linux Prints a warning if the gcc version is less than 2.8.1 since that version has problems with register allocation for `long long'. ./html/Datatypes.html Documented sharing of data types between datasets. ./src/H5G.c ./src/H5Gpublic.h Implemented H5Gmove(), H5Glink() and H5Gunlink() for hard links. Still have soft links to do. ./src/H5AC.c ./src/H5ACprivate.h ./src/H5D.c ./src/H5E.c ./src/H5Eprivate.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/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5HG.c ./src/H5HL.c ./src/H5HLprivate.h ./src/H5I.c ./src/H5Iprivate.h ./src/H5MM.c ./src/H5MMprivate.h ./src/H5O.c ./src/H5Oefl.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5P.c ./src/H5S.c ./src/H5Ssimp.c ./src/H5T.c ./src/H5Tconv.c ./src/H5Tprivate.h ./src/H5Tpublic.h ./src/H5V.c ./src/H5Vprivate.h ./src/H5detect.c ./src/h5ls.c ./test/cmpd_dset.c ./test/dsets.c ./test/external.c ./test/hyperslab.c ./test/iopipe.c ./test/istore.c ./test/shtype.c ./test/tstab.c Fixed comparisons between signed and unsigned values. Fixed warnings about unused function arguments.
Diffstat (limited to 'src')
-rw-r--r--src/H5AC.c8
-rw-r--r--src/H5ACprivate.h2
-rw-r--r--src/H5D.c2
-rw-r--r--src/H5Distore.c10
-rw-r--r--src/H5E.c4
-rw-r--r--src/H5Eprivate.h2
-rw-r--r--src/H5F.c10
-rw-r--r--src/H5Farray.c4
-rw-r--r--src/H5Fcore.c15
-rw-r--r--src/H5Ffamily.c4
-rw-r--r--src/H5Fistore.c10
-rw-r--r--src/H5Flow.c54
-rw-r--r--src/H5Fprivate.h9
-rw-r--r--src/H5Fpublic.h10
-rw-r--r--src/H5Fsec2.c20
-rw-r--r--src/H5Fstdio.c38
-rw-r--r--src/H5G.c180
-rw-r--r--src/H5Gent.c7
-rw-r--r--src/H5Gnode.c31
-rw-r--r--src/H5Gpkg.h2
-rw-r--r--src/H5Gprivate.h9
-rw-r--r--src/H5Gpublic.h10
-rw-r--r--src/H5HG.c7
-rw-r--r--src/H5HL.c10
-rw-r--r--src/H5HLprivate.h2
-rw-r--r--src/H5I.c9
-rw-r--r--src/H5Iprivate.h6
-rw-r--r--src/H5MM.c15
-rw-r--r--src/H5MMprivate.h2
-rw-r--r--src/H5O.c2
-rw-r--r--src/H5Odtype.c2
-rw-r--r--src/H5Oefl.c12
-rw-r--r--src/H5Oprivate.h12
-rw-r--r--src/H5Osdspace.c8
-rw-r--r--src/H5Oshared.c2
-rw-r--r--src/H5Ostab.c2
-rw-r--r--src/H5P.c11
-rw-r--r--src/H5S.c8
-rw-r--r--src/H5Ssimp.c2
-rw-r--r--src/H5T.c4
-rw-r--r--src/H5Tconv.c13
-rw-r--r--src/H5Tprivate.h2
-rw-r--r--src/H5Tpublic.h6
-rw-r--r--src/H5V.c43
-rw-r--r--src/H5Vprivate.h39
-rw-r--r--src/H5detect.c10
-rw-r--r--src/h5ls.c7
47 files changed, 473 insertions, 204 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 41e9a28..0b76288 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -75,7 +75,7 @@ H5AC_create(H5F_t *f, intn size_hint)
f->shared->cache = cache = H5MM_xcalloc(1, sizeof(H5AC_t));
cache->nslots = size_hint;
- cache->slot = H5MM_xcalloc(cache->nslots, sizeof(H5AC_slot_t));
+ cache->slot = H5MM_xcalloc((intn)(cache->nslots), sizeof(H5AC_slot_t));
FUNC_LEAVE(SUCCEED);
}
@@ -115,8 +115,8 @@ H5AC_dest(H5F_t *f)
}
#ifdef H5AC_DEBUG
{
- intn i;
- for (i = 0; i < cache->nslots; i++) {
+ uintn i;
+ for (i=0; i<cache->nslots; i++) {
cache->slot[i].prot = H5MM_xfree(cache->slot[i].prot);
cache->slot[i].aprots = 0;
cache->slot[i].nprots = 0;
@@ -345,7 +345,7 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
void *) = NULL;
H5AC_slot_t *slot;
intn *map = NULL;
- intn nslots;
+ uintn nslots;
H5AC_t *cache = NULL;
FUNC_ENTER(H5AC_flush, FAIL);
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index b17bf33..ec17bd4e 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -92,7 +92,7 @@ typedef struct H5AC_slot_t {
} H5AC_slot_t;
typedef struct H5AC_t {
- intn nslots; /*number of cache slots */
+ uintn nslots; /*number of cache slots */
H5AC_slot_t *slot; /*the cache slots */
intn nprots; /*number of protected objects */
struct {
diff --git a/src/H5D.c b/src/H5D.c
index 8df99c0..8d29685 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -749,7 +749,7 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space,
/* Total raw data size */
new_dset->layout.type = new_dset->create_parms->layout;
new_dset->layout.ndims = H5S_get_ndims(space) + 1;
- assert(new_dset->layout.ndims <= NELMTS(new_dset->layout.dim));
+ assert((unsigned)(new_dset->layout.ndims) <= NELMTS(new_dset->layout.dim));
new_dset->layout.dim[new_dset->layout.ndims - 1] = H5T_get_size(type);
switch (new_dset->create_parms->layout) {
diff --git a/src/H5Distore.c b/src/H5Distore.c
index c75a3b7..c737d9d 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -119,7 +119,7 @@ H5B_class_t H5B_ISTORE[1] = {{
*-------------------------------------------------------------------------
*/
static size_t
-H5F_istore_sizeof_rkey(H5F_t *f, const void *_udata)
+H5F_istore_sizeof_rkey(H5F_t *f __attribute__((unused)), const void *_udata)
{
const H5F_istore_ud1_t *udata = (const H5F_istore_ud1_t *) _udata;
size_t nbytes;
@@ -245,7 +245,8 @@ H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
*-------------------------------------------------------------------------
*/
static intn
-H5F_istore_cmp2(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
+H5F_istore_cmp2(H5F_t *f __attribute__((unused)), 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;
@@ -296,7 +297,8 @@ H5F_istore_cmp2(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
*-------------------------------------------------------------------------
*/
static intn
-H5F_istore_cmp3(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
+H5F_istore_cmp3(H5F_t *f __attribute__((unused)),
+ 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;
@@ -422,7 +424,7 @@ 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)
+ void *_udata, const void *_rt_key __attribute__((unused)))
{
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata;
const H5F_istore_key_t *lt_key = (const H5F_istore_key_t *) _lt_key;
diff --git a/src/H5E.c b/src/H5E.c
index d8952fd..afe031a 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -374,7 +374,7 @@ H5Ewalk_cb(int n, H5E_error_t *err_desc, void *client_data)
const char *
H5Eget_major (H5E_major_t n)
{
- int i;
+ uintn i;
/*
* WARNING: Do not call the FUNC_ENTER() or FUNC_LEAVE() macros since
@@ -413,7 +413,7 @@ H5Eget_major (H5E_major_t n)
const char *
H5Eget_minor (H5E_minor_t n)
{
- int i;
+ uintn i;
/*
* WARNING: Do not call the FUNC_ENTER() or FUNC_LEAVE() macros since
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index 885ad44..819a401 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -96,7 +96,7 @@ typedef struct H5E_minor_mesg_t {
/* An error stack */
typedef struct H5E_t {
- uintn nused; /*num slots currently used in stack */
+ intn nused; /*num slots currently used in stack */
H5E_error_t slot[H5E_NSLOTS]; /*array of error records */
} H5E_t;
diff --git a/src/H5F.c b/src/H5F.c
index ae9254c..e6d649a 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -213,10 +213,10 @@ H5F_encode_length_unusual(const H5F_t *f, uint8 **p, uint8 *l)
/*
* For non-little-endian platforms, encode each byte in memory backwards.
*/
- for (; i >= 0; i--, (*p)++) *(*p) = *(l + i);
+ for (/*void*/; i>=0; i--, (*p)++)*(*p) = *(l+i);
#else
/* platform has little-endian integers */
- HDmemcpy(*p,l,i+1);
+ HDmemcpy(*p,l,(size_t)(i+1));
*p+=(i+1);
#endif
@@ -914,7 +914,7 @@ H5F_open(const char *name, uintn flags,
/* nothing to check for consistency flags */
- assert(p - buf == fixed_size);
+ assert((size_t)(p-buf) == fixed_size);
/* Read the variable length part of the boot block... */
variable_size = H5F_SIZEOF_ADDR(f) + /*base address */
@@ -1275,13 +1275,13 @@ 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), p - buf);
+ H5F_addr_inc(&(f->shared->hdf5_eof), (size_t)(p-buf));
H5F_low_seteof(f->shared->lf, &(f->shared->hdf5_eof));
}
/* write the boot block to disk */
if (H5F_low_write(f->shared->lf, &(f->shared->access_parms),
- &(f->shared->boot_addr), p-buf, buf)<0) {
+ &(f->shared->boot_addr), (size_t)(p-buf), buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't write header");
}
diff --git a/src/H5Farray.c b/src/H5Farray.c
index eb7d7b1..08aeac4 100644
--- a/src/H5Farray.c
+++ b/src/H5Farray.c
@@ -195,7 +195,7 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
/* Decrement indices and advance pointers */
for (j=ndims-1, carray=TRUE; j>=0 && carray; --j) {
- H5F_addr_inc (&addr, file_stride[j]);
+ H5F_addr_adj (&addr, file_stride[j]);
buf += mem_stride[j];
if (--idx[j]) carray = FALSE;
@@ -346,7 +346,7 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
/* Decrement indices and advance pointers */
for (j=ndims-1, carray=TRUE; j>=0 && carray; --j) {
- H5F_addr_inc (&addr, file_stride[j]);
+ H5F_addr_adj (&addr, file_stride[j]);
buf += mem_stride[j];
if (--idx[j]) carray = FALSE;
diff --git a/src/H5Fcore.c b/src/H5Fcore.c
index d274422..9ff3c44 100644
--- a/src/H5Fcore.c
+++ b/src/H5Fcore.c
@@ -69,8 +69,10 @@ const H5F_low_class_t H5F_LOW_CORE_g[1] = {{
*-------------------------------------------------------------------------
*/
static hbool_t
-H5F_core_access(const char *name, const H5F_access_t *access_parms,
- int mode, H5F_search_t *key/*out*/)
+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)))
{
FUNC_ENTER(H5F_core_access, FAIL);
FUNC_LEAVE(FALSE);
@@ -99,7 +101,8 @@ H5F_core_access(const char *name, const H5F_access_t *access_parms,
*-------------------------------------------------------------------------
*/
static H5F_low_t *
-H5F_core_open(const char *name, const H5F_access_t *access_parms,
+H5F_core_open(const char *name __attribute__((unused)),
+ const H5F_access_t *access_parms __attribute__((unused)),
uintn flags, H5F_search_t *key/*out*/)
{
H5F_low_t *lf = NULL;
@@ -146,7 +149,8 @@ H5F_core_open(const char *name, const H5F_access_t *access_parms,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_core_close(H5F_low_t *lf, const H5F_access_t *access_parms)
+H5F_core_close(H5F_low_t *lf,
+ const H5F_access_t *access_parms __attribute__((unused)))
{
FUNC_ENTER(H5F_core_close, FAIL);
@@ -179,7 +183,8 @@ H5F_core_close(H5F_low_t *lf, const H5F_access_t *access_parms)
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_core_read(H5F_low_t *lf, const H5F_access_t *access_parms,
+H5F_core_read(H5F_low_t *lf,
+ const H5F_access_t *access_parms __attribute__((unused)),
const haddr_t *addr, size_t size, uint8 *buf)
{
size_t n;
diff --git a/src/H5Ffamily.c b/src/H5Ffamily.c
index e9596b8..0458d38 100644
--- a/src/H5Ffamily.c
+++ b/src/H5Ffamily.c
@@ -298,7 +298,7 @@ H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms,
{
size_t nbytes;
haddr_t cur_addr;
- uintn membno;
+ intn membno;
off_t offset;
size_t member_size;
@@ -361,7 +361,7 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms,
{
size_t nbytes;
haddr_t cur_addr, max_addr;
- uintn membno;
+ intn membno;
off_t offset;
H5F_low_t *member = NULL;
char member_name[4096];
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index c75a3b7..c737d9d 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -119,7 +119,7 @@ H5B_class_t H5B_ISTORE[1] = {{
*-------------------------------------------------------------------------
*/
static size_t
-H5F_istore_sizeof_rkey(H5F_t *f, const void *_udata)
+H5F_istore_sizeof_rkey(H5F_t *f __attribute__((unused)), const void *_udata)
{
const H5F_istore_ud1_t *udata = (const H5F_istore_ud1_t *) _udata;
size_t nbytes;
@@ -245,7 +245,8 @@ H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
*-------------------------------------------------------------------------
*/
static intn
-H5F_istore_cmp2(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
+H5F_istore_cmp2(H5F_t *f __attribute__((unused)), 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;
@@ -296,7 +297,8 @@ H5F_istore_cmp2(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
*-------------------------------------------------------------------------
*/
static intn
-H5F_istore_cmp3(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
+H5F_istore_cmp3(H5F_t *f __attribute__((unused)),
+ 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;
@@ -422,7 +424,7 @@ 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)
+ void *_udata, const void *_rt_key __attribute__((unused)))
{
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata;
const H5F_istore_key_t *lt_key = (const H5F_istore_key_t *) _lt_key;
diff --git a/src/H5Flow.c b/src/H5Flow.c
index 545659a..f29b7d3 100644
--- a/src/H5Flow.c
+++ b/src/H5Flow.c
@@ -587,7 +587,7 @@ H5F_addr_undef(haddr_t *addr /*out */ )
{
assert(addr);
- addr->offset = -1;
+ addr->offset = (uint64)(-1);
}
/*-------------------------------------------------------------------------
@@ -676,7 +676,7 @@ H5F_addr_zerop(const haddr_t *addr)
void
H5F_addr_encode(H5F_t *f, uint8 **pp, const haddr_t *addr)
{
- int i;
+ uint i;
haddr_t tmp;
assert(f);
@@ -685,14 +685,14 @@ H5F_addr_encode(H5F_t *f, uint8 **pp, const haddr_t *addr)
if (addr_defined(addr)) {
tmp = *addr;
- for (i = 0; i < H5F_SIZEOF_ADDR(f); i++) {
+ 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++) {
+ for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
*(*pp)++ = 0xff;
}
}
@@ -720,7 +720,7 @@ 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*/)
{
- int i;
+ uint i;
haddr_t tmp;
uint8 c;
hbool_t all_zero = TRUE;
@@ -731,12 +731,11 @@ 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++) {
+ for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
c = *(*pp)++;
- if (c != 0xff)
- all_zero = FALSE;
+ if (c != 0xff) all_zero = FALSE;
- if (i < sizeof(addr->offset)) {
+ if (i<sizeof(addr->offset)) {
tmp.offset = c;
tmp.offset <<= i * 8; /*use tmp to get casting right */
addr->offset |= tmp.offset;
@@ -744,8 +743,7 @@ H5F_addr_decode(H5F_t *f, const uint8 **pp, haddr_t *addr/*out*/)
assert(0 == **pp); /*overflow */
}
}
- if (all_zero)
- H5F_addr_undef(addr);
+ if (all_zero) H5F_addr_undef(addr);
}
/*-------------------------------------------------------------------------
@@ -830,12 +828,44 @@ H5F_addr_pow2(uintn n, haddr_t *addr /*out */ )
*-------------------------------------------------------------------------
*/
void
-H5F_addr_inc(haddr_t *addr /*in,out */ , size_t inc)
+H5F_addr_inc(haddr_t *addr/*in,out */, size_t inc)
{
assert(addr && addr_defined(addr));
assert(addr->offset <= addr->offset + inc);
+
addr->offset += inc;
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_addr_adj
+ *
+ * Purpose: Adjusts an address by adding or subtracting some amount.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Monday, April 6, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5F_addr_adj(haddr_t *addr/*in,out */, ssize_t adj)
+{
+#ifndef NDEBUG
+ assert(addr && addr_defined(addr));
+ if (adj>=0) {
+ assert(addr->offset <= addr->offset + adj);
+ } else {
+ assert (addr->offset > addr->offset + adj);
+ }
+#endif
+
+ addr->offset += adj;
+}
+
/*-------------------------------------------------------------------------
* Function: H5F_addr_add
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index c4e1fc0..23046b0 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -55,9 +55,9 @@
/*
* Private file open flags.
*/
-#define H5F_ACC_PUBLIC_FLAGS 0x00ff
+#define H5F_ACC_PUBLIC_FLAGS 0x00ffu
-#define H5F_ACC_CREAT 0x0100 /* Create non-existing files */
+#define H5F_ACC_CREAT 0x0100u /* Create non-existing files */
/*
* Encode and decode macros for file meta-data.
@@ -351,7 +351,7 @@ typedef struct H5F_low_t {
#ifdef HAVE_FSEEK64
int64 cur; /* Current file position */
#else
- off_t cur; /* Current file position */
+ long cur; /* Current file position */
#endif
} stdio;
@@ -537,7 +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 *, size_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_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 1fb72af..f0fb3f2 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -25,11 +25,11 @@
* H5Fcreate() and H5Fopen(). Use the bit-wise OR operator (|) to combine
* them as needed.
*/
-#define H5F_ACC_RDONLY 0x0000 /*absence of write implies read only */
-#define H5F_ACC_RDWR 0x0001 /*open file for reading and writing */
-#define H5F_ACC_TRUNC 0x0002 /*overwrite existing files during create*/
-#define H5F_ACC_EXCL 0x0004 /*create fails if file already exists */
-#define H5F_ACC_DEBUG 0x0008 /*print debug info */
+#define H5F_ACC_RDONLY 0x0000u /*absence of write implies read only */
+#define H5F_ACC_RDWR 0x0001u /*open file for reading and writing */
+#define H5F_ACC_TRUNC 0x0002u /*overwrite existing files during create*/
+#define H5F_ACC_EXCL 0x0004u /*create fails if file already exists */
+#define H5F_ACC_DEBUG 0x0008u /*print debug info */
#ifdef LATER
diff --git a/src/H5Fsec2.c b/src/H5Fsec2.c
index 57dd7a6..16395dd 100644
--- a/src/H5Fsec2.c
+++ b/src/H5Fsec2.c
@@ -69,10 +69,11 @@ 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, uintn flags,
- H5F_search_t *key/*out*/)
+H5F_sec2_open(const char *name,
+ const H5F_access_t *access_parms __attribute__((unused)),
+ uintn flags, H5F_search_t *key/*out*/)
{
- uintn oflags;
+ intn oflags;
H5F_low_t *lf = NULL;
int fd;
struct stat sb;
@@ -121,7 +122,8 @@ H5F_sec2_open(const char *name, const H5F_access_t *access_parms, uintn flags,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_sec2_close(H5F_low_t *lf, const H5F_access_t *access_parms)
+H5F_sec2_close(H5F_low_t *lf,
+ const H5F_access_t *access_parms __attribute__((unused)))
{
FUNC_ENTER(H5F_sec2_close, FAIL);
@@ -156,7 +158,8 @@ H5F_sec2_close(H5F_low_t *lf, const H5F_access_t *access_parms)
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_sec2_read(H5F_low_t *lf, const H5F_access_t *access_parms,
+H5F_sec2_read(H5F_low_t *lf,
+ const H5F_access_t *access_parms __attribute__((unused)),
const haddr_t *addr, size_t size, uint8 *buf)
{
ssize_t n;
@@ -184,7 +187,7 @@ H5F_sec2_read(H5F_low_t *lf, const H5F_access_t *access_parms,
/* Check easy cases */
if (0 == size) HRETURN(SUCCEED);
- if (offset >= lf->eof.offset) {
+ if ((uint64)offset >= lf->eof.offset) {
HDmemset(buf, 0, size);
HRETURN(SUCCEED);
}
@@ -224,7 +227,7 @@ H5F_sec2_read(H5F_low_t *lf, const H5F_access_t *access_parms,
if ((n = read(lf->u.sec2.fd, buf, size)) < 0) {
lf->u.sec2.op = H5F_OP_UNKNOWN;
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "read failed");
- } else if (n < size) {
+ } else if ((size_t)n < size) {
HDmemset(buf + n, 0, size - n);
}
@@ -260,7 +263,8 @@ H5F_sec2_read(H5F_low_t *lf, const H5F_access_t *access_parms,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_sec2_write(H5F_low_t *lf, const H5F_access_t *access_parms,
+H5F_sec2_write(H5F_low_t *lf,
+ const H5F_access_t *access_parms __attribute__((unused)),
const haddr_t *addr, size_t size, const uint8 *buf)
{
uint64 mask;
diff --git a/src/H5Fstdio.c b/src/H5Fstdio.c
index 6224dd6..7e45878 100644
--- a/src/H5Fstdio.c
+++ b/src/H5Fstdio.c
@@ -70,7 +70,8 @@ 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,
+H5F_stdio_open(const char *name,
+ const H5F_access_t *access_parms __attribute__((unused)),
uintn flags, H5F_search_t *key/*out*/)
{
H5F_low_t *lf = NULL;
@@ -112,7 +113,9 @@ H5F_stdio_open(const char *name, const H5F_access_t *access_parms,
if (fseek(lf->u.stdio.f, 0, SEEK_END) < 0) {
lf->u.stdio.op = H5F_OP_UNKNOWN;
} else {
- H5F_addr_inc(&(lf->eof), ftell(lf->u.stdio.f));
+ ssize_t x = ftell (lf->u.stdio.f);
+ assert (x>=0);
+ H5F_addr_inc(&(lf->eof), (size_t)x);
}
/* The unique key */
@@ -144,7 +147,8 @@ H5F_stdio_open(const char *name, const H5F_access_t *access_parms,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_stdio_close(H5F_low_t *lf, const H5F_access_t *access_parms)
+H5F_stdio_close(H5F_low_t *lf,
+ const H5F_access_t *access_parms __attribute__((unused)))
{
FUNC_ENTER(H5F_stdio_close, FAIL);
@@ -179,7 +183,8 @@ H5F_stdio_close(H5F_low_t *lf, const H5F_access_t *access_parms)
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_stdio_read(H5F_low_t *lf, const H5F_access_t *access_parms,
+H5F_stdio_read(H5F_low_t *lf,
+ const H5F_access_t *access_parms __attribute__((unused)),
const haddr_t *addr, size_t size, uint8 *buf/*out*/)
{
size_t n;
@@ -187,7 +192,7 @@ H5F_stdio_read(H5F_low_t *lf, const H5F_access_t *access_parms,
#ifdef HAVE_FSEEK64
int64 offset;
#else
- off_t offset;
+ long offset;
#endif
FUNC_ENTER(H5F_stdio_read, FAIL);
@@ -202,12 +207,12 @@ H5F_stdio_read(H5F_low_t *lf, const H5F_access_t *access_parms,
#ifdef HAVE_FSEEK64
offset = (int64)(addr->offset); /*checked for overflow*/
#else
- offset = (off_t)(addr->offset); /*checked for overflow*/
+ offset = (long)(addr->offset); /*checked for overflow*/
#endif
/* Check easy cases */
if (0 == size) HRETURN(SUCCEED);
- if (offset >= lf->eof.offset) {
+ if ((uint64)offset >= lf->eof.offset) {
HDmemset(buf, 0, size);
HRETURN(SUCCEED);
}
@@ -287,16 +292,18 @@ H5F_stdio_read(H5F_low_t *lf, const H5F_access_t *access_parms,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_stdio_write(H5F_low_t *lf, const H5F_access_t *access_parms,
+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)
{
- ssize_t n;
uint64 mask;
#ifdef HAVE_FSEEK64
int64 offset;
+ uint64 n;
#else
- off_t offset;
+ long offset;
+ size_t n;
#endif
FUNC_ENTER(H5F_stdio_write, FAIL);
@@ -310,10 +317,10 @@ H5F_stdio_write(H5F_low_t *lf, const H5F_access_t *access_parms,
}
#ifdef HAVE_FSEEK64
offset = (int64)(addr->offset); /*checked for overflow*/
- n = (int64)size; /*checked for overflow*/
+ n = size; /*checked for overflow*/
#else
offset = (long)(addr->offset); /*checked for overflow*/
- n = (off_t)size; /*checked for overflow*/
+ n = size; /*checked for overflow*/
#endif
/*
@@ -333,6 +340,7 @@ H5F_stdio_write(H5F_low_t *lf, const H5F_access_t *access_parms,
#endif
lf->u.stdio.cur = offset;
}
+
/*
* Write the buffer. On successful return, the file position will be
* advanced by the number of bytes read. Otherwise nobody knows where it
@@ -342,11 +350,12 @@ H5F_stdio_write(H5F_low_t *lf, const H5F_access_t *access_parms,
lf->u.stdio.op = H5F_OP_UNKNOWN;
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "fwrite failed");
}
+
/*
* Update seek optimizing data.
*/
lf->u.stdio.op = H5F_OP_WRITE;
- lf->u.stdio.cur = offset + n;
+ lf->u.stdio.cur = offset + (int64)n;
FUNC_LEAVE(SUCCEED);
}
@@ -371,7 +380,8 @@ H5F_stdio_write(H5F_low_t *lf, const H5F_access_t *access_parms,
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_stdio_flush(H5F_low_t *lf, const H5F_access_t *access_parms)
+H5F_stdio_flush(H5F_low_t *lf,
+ const H5F_access_t *access_parms __attribute__((unused)))
{
FUNC_ENTER(H5F_stdio_flush, FAIL);
diff --git a/src/H5G.c b/src/H5G.c
index 293e3ab..d93cb8e 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -492,6 +492,131 @@ H5Giterate (hid_t loc_id, const char *name, int *idx,
FUNC_LEAVE (ret_value);
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5Gmove
+ *
+ * Purpose: Renames an object within an HDF5 file. The original name SRC
+ * is unlinked from the group graph and the new name DST is
+ * inserted as an atomic operation. Both names are interpreted
+ * relative to LOC_ID which is either a file ID or a group ID.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Monday, April 6, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Gmove (hid_t loc_id __attribute__((unused)),
+ const char *src __attribute__((unused)),
+ const char *dst __attribute__((unused)))
+{
+ FUNC_ENTER (H5Gmove, FAIL);
+
+ HRETURN_ERROR (H5E_SYM, H5E_UNSUPPORTED, FAIL,
+ "unable to rename object (not implemented yet)");
+
+ FUNC_LEAVE (SUCCEED);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Glink
+ *
+ * Purpose: Creates a link of the specified type from NEW_NAME to
+ * CUR_NAME.
+ *
+ * If TYPE is H5G_LINK_HARD then CUR_NAME must name an existing
+ * object and both names are interpreted relative to LOC_ID
+ * which is either a file ID or a group ID.
+ *
+ * If TYPE is H5G_LINK_SOFT then CUR_NAME can be anything and is
+ * interpreted at lookup time relative to the group which
+ * contains the final component of NEW_NAME. For instance, if
+ * CUR_NAME is `./foo' and NEW_NAME is `./x/y/bar' and a request
+ * is made for `./x/y/bar' then the actual object looked up is
+ * `./x/y/./foo'.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Monday, April 6, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Glink (hid_t loc_id, H5G_link_t type, const char *cur_name,
+ const char *new_name)
+{
+ H5G_t *loc = NULL;
+
+ FUNC_ENTER (H5Glink, FAIL);
+
+ if (NULL==(loc=H5G_loc (loc_id))) {
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
+ }
+ if (type!=H5G_LINK_HARD && type!=H5G_LINK_SOFT) {
+ HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "unrecognized link type");
+ }
+ if (!cur_name || !*cur_name) {
+ HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
+ "no current name specified");
+ }
+ if (!new_name || !*new_name) {
+ HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
+ "no new name specified");
+ }
+ if (H5G_link (loc, type, cur_name, new_name)<0) {
+ HRETURN_ERROR (H5E_SYM, H5E_LINK, FAIL, "unable to create link");
+ }
+
+ FUNC_LEAVE (SUCCEED);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Gunlink
+ *
+ * Purpose: Removes the specified NAME from the group graph and
+ * decrements the link count for the object to which NAME
+ * points. If the link count reaches zero then all file-space
+ * associated with the object will be reclaimed (but if the
+ * object is open, then the reclamation of the file space is
+ * delayed until all handles to the object are closed).
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Monday, April 6, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Gunlink (hid_t loc_id __attribute__((unused)),
+ const char *name __attribute__((unused)))
+{
+ FUNC_ENTER (H5Gunlink, FAIL);
+
+ HRETURN_ERROR (H5E_SYM, H5E_UNSUPPORTED, FAIL,
+ "unable to unlink name (not implemented yet)");
+
+ FUNC_LEAVE (SUCCEED);
+}
+
/*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
@@ -1385,3 +1510,58 @@ H5G_loc (hid_t loc_id)
FUNC_LEAVE (ret_value);
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_link
+ *
+ * Purpose: Creates a link from NEW_NAME to CUR_NAME. See H5Glink() for
+ * full documentation.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Monday, April 6, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_link (H5G_t *loc, H5G_type_t type, const char *cur_name,
+ const char *new_name)
+{
+ H5G_entry_t cur_obj;
+
+ FUNC_ENTER (H5G_link, FAIL);
+
+ /* Check args */
+ assert (loc);
+ assert (cur_name && *cur_name);
+ assert (new_name && *new_name);
+
+ switch (type) {
+ case H5G_LINK_SOFT:
+ HRETURN_ERROR (H5E_SYM, H5E_UNSUPPORTED, FAIL,
+ "unable to create soft link (not implemented yet)");
+
+ case H5G_LINK_HARD:
+ if (H5G_find (loc, cur_name, NULL, &cur_obj)<0) {
+ HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL,
+ "source object not found");
+ }
+ if (H5G_insert (loc, new_name, &cur_obj)<0) {
+ HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL,
+ "unable to create new name/link for object");
+ }
+ break;
+
+ default:
+ HRETURN_ERROR (H5E_SYM, H5E_BADVALUE, FAIL,
+ "unrecognized link type");
+ }
+
+ FUNC_LEAVE (SUCCEED);
+}
diff --git a/src/H5Gent.c b/src/H5Gent.c
index 8c67810..2a95778 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -102,8 +102,7 @@ H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type)
{
FUNC_ENTER(H5G_ent_modified, FAIL);
assert(ent);
- if (H5G_NO_CHANGE != ent->type)
- ent->type = cache_type;
+ if (H5G_NO_CHANGE != ent->type) ent->type = cache_type;
ent->dirty = TRUE;
FUNC_LEAVE(SUCCEED);
}
@@ -350,8 +349,8 @@ H5G_ent_encode(H5F_t *f, uint8 **pp, H5G_entry_t *ent)
*-------------------------------------------------------------------------
*/
herr_t
-H5G_ent_debug(H5F_t *f, H5G_entry_t *ent, FILE * stream, intn indent,
- intn fwidth)
+H5G_ent_debug(H5F_t *f __attribute__((unused)), 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 e447742..5292607 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -132,7 +132,8 @@ 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, uint8 *raw, void *_key)
+H5G_node_decode_key(H5F_t *f, H5B_t *bt __attribute__((unused)), uint8 *raw,
+ void *_key)
{
H5G_node_key_t *key = (H5G_node_key_t *) _key;
@@ -166,7 +167,8 @@ H5G_node_decode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_encode_key(H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
+H5G_node_encode_key(H5F_t *f, H5B_t *bt __attribute__((unused)),
+ uint8 *raw, void *_key)
{
H5G_node_key_t *key = (H5G_node_key_t *) _key;
@@ -230,7 +232,8 @@ H5G_node_size(H5F_t *f)
*/
static herr_t
H5G_node_create(H5F_t *f, H5B_ins_t op,
- void *_lt_key, void *_udata, void *_rt_key,
+ void *_lt_key, void *_udata __attribute__((unused)),
+ void *_rt_key,
haddr_t *addr/*out*/)
{
H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key;
@@ -254,7 +257,7 @@ H5G_node_create(H5F_t *f, H5B_ins_t op,
"unable to allocate file space");
}
sym->dirty = TRUE;
- sym->entry = H5MM_xcalloc(2 * H5G_NODE_K(f), sizeof(H5G_entry_t));
+ sym->entry = H5MM_xcalloc((intn)(2*H5G_NODE_K(f)), sizeof(H5G_entry_t));
if (H5AC_set(f, H5AC_SNODE, addr, sym) < 0) {
H5MM_xfree(sym->entry);
H5MM_xfree(sym);
@@ -403,7 +406,7 @@ H5G_node_load(H5F_t *f, const haddr_t *addr, const void *_udata1,
size = H5G_node_size(f);
p = buf = H5MM_xmalloc(size);
sym = H5MM_xcalloc(1, sizeof(H5G_node_t));
- sym->entry = H5MM_xcalloc(2 * H5G_NODE_K(f), sizeof(H5G_entry_t));
+ sym->entry = H5MM_xcalloc((intn)(2*H5G_NODE_K(f)), sizeof(H5G_entry_t));
if (H5F_block_read(f, addr, size, buf) < 0) {
HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL,
@@ -586,8 +589,9 @@ 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,
- void *_udata, const void *_rt_key)
+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_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata;
H5G_node_t *sn = NULL;
@@ -696,9 +700,10 @@ H5G_node_found(H5F_t *f, const haddr_t *addr, const void *_lt_key,
*/
static H5B_ins_t
H5G_node_insert(H5F_t *f, const haddr_t *addr,
- void *_lt_key, hbool_t *lt_key_changed,
+ 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,
+ void *_rt_key, hbool_t *rt_key_changed __attribute__((unused)),
haddr_t *new_node)
{
H5G_node_key_t *md_key = (H5G_node_key_t *) _md_key;
@@ -767,7 +772,7 @@ H5G_node_insert(H5F_t *f, const haddr_t *addr,
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR,
"unable to insert symbol name into heap");
}
- if (sn->nsyms >= 2 * H5G_NODE_K(f)) {
+ if ((size_t)(sn->nsyms) >= 2*H5G_NODE_K(f)) {
/*
* The node is full. Split it into a left and right
* node and return the address of the new right node (the
@@ -800,14 +805,14 @@ H5G_node_insert(H5F_t *f, const haddr_t *addr,
md_key->offset = sn->entry[sn->nsyms - 1].name_off;
/* Where to insert the new entry? */
- if (idx <= H5G_NODE_K(f)) {
+ if (idx <= (intn)H5G_NODE_K(f)) {
insert_into = sn;
- if (idx == H5G_NODE_K(f))
+ if (idx == (intn)H5G_NODE_K(f))
md_key->offset = offset;
} else {
idx -= H5G_NODE_K(f);
insert_into = snrt;
- if (idx == H5G_NODE_K (f)) {
+ if (idx == (intn)H5G_NODE_K (f)) {
rt_key->offset = offset;
*rt_key_changed = TRUE;
}
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index f78071a..3b449fd 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -21,7 +21,7 @@
#define H5G_NODE_VERS 1 /*symbol table node version number */
#define H5G_SIZE_HINT 1024 /*default root grp size hint */
-#define H5G_NODE_K(F) ((F)->shared->create_parms.sym_leaf_k)
+#define H5G_NODE_K(F) ((unsigned)((F)->shared->create_parms.sym_leaf_k))
#define H5G_NODE_SIZEOF_HDR(F) (H5G_NODE_SIZEOF_MAGIC + 4)
#define H5G_DEFAULT_ROOT_SIZE 32
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index b79d1e2..2d49e99 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -51,10 +51,11 @@
* symbol table entry.
*/
typedef enum H5G_type_t {
- H5G_NOTHING_CACHED = 0, /*nothing is cached, must be 0 */
- H5G_CACHED_STAB = 1, /*symbol table, `stab' */
+ H5G_CACHED_ERROR = -1, /*force enum to be signed */
+ H5G_NOTHING_CACHED = 0, /*nothing is cached, must be 0 */
+ H5G_CACHED_STAB = 1, /*symbol table, `stab' */
- H5G_NCACHED = 2 /*THIS MUST BE LAST */
+ H5G_NCACHED = 2 /*THIS MUST BE LAST */
} H5G_type_t;
/*
@@ -103,6 +104,8 @@ herr_t H5G_set (H5G_t *grp);
herr_t H5G_push (H5G_t *grp);
herr_t H5G_pop (H5F_t *f);
H5G_t *H5G_getcwg(H5F_t *f);
+herr_t H5G_link (H5G_t *loc, H5G_type_t type, const char *cur_name,
+ const char *new_name);
herr_t H5G_insert (H5G_t *cwg, const char *name, H5G_entry_t *ent);
herr_t H5G_find (H5G_t *cwg, const char *name, H5G_entry_t *grp_ent/*out*/,
H5G_entry_t *ent/*out*/);
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 435d384..8c6e7c6 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -27,6 +27,12 @@
extern "C" {
#endif
+typedef enum H5G_link_t {
+ H5G_LINK_ERROR = -1,
+ H5G_LINK_HARD = 0,
+ H5G_LINK_SOFT = 1
+} H5G_link_t;
+
typedef herr_t (*H5G_iterate_t)(hid_t group, const char *group_name,
void *op_data);
@@ -38,6 +44,10 @@ herr_t H5Gpush (hid_t file, const char *name);
herr_t H5Gpop (hid_t file);
herr_t H5Giterate (hid_t file, const char *name, int *idx, H5G_iterate_t op,
void *op_data);
+herr_t H5Gmove (hid_t loc_id, const char *src, const char *dst);
+herr_t H5Glink (hid_t loc_id, H5G_link_t type, const char *cur_name,
+ const char *new_name);
+herr_t H5Gunlink (hid_t loc_id, const char *name);
#ifdef __cplusplus
}
diff --git a/src/H5HG.c b/src/H5HG.c
index 176c687..f457839 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -131,7 +131,7 @@ H5HG_create (H5F_t *f, size_t size)
UINT16ENCODE (p, 0); /*object ID*/
UINT16ENCODE (p, 0); /*reference count*/
H5F_encode_length (f, p, heap->obj[0].size);
- HDmemset (p, 0, (heap->chunk+heap->nalloc) - p);
+ HDmemset (p, 0, (size_t)((heap->chunk+heap->nalloc) - p));
/* Add the heap to the cache */
if (H5AC_set (f, H5AC_GHEAP, &addr, heap)<0) {
@@ -845,7 +845,8 @@ herr_t
H5HG_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
intn fwidth)
{
- int i, j, k, nused, maxobj;
+ int i, nused, maxobj;
+ uintn j, k;
H5HG_heap_t *h = NULL;
char buf[64];
size_t size;
@@ -855,7 +856,7 @@ H5HG_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
/* check arguments */
assert(f);
- if (addr && H5F_addr_defined (addr));
+ assert(addr && H5F_addr_defined (addr));
assert(stream);
assert(indent >= 0);
assert(fwidth >= 0);
diff --git a/src/H5HL.c b/src/H5HL.c
index d7f83c0..82cfd31 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -889,7 +889,7 @@ H5HL_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
* the heap and that no two free blocks point to the same region of
* the heap.
*/
- marker = H5MM_xcalloc(h->mem_alloc, 1);
+ marker = H5MM_xcalloc(1, h->mem_alloc);
for (freelist = h->freelist; freelist; freelist = freelist->next) {
fprintf(stream, "%*s%-*s %8lu, %8lu\n", indent, "", fwidth,
"Free Block (offset,size):",
@@ -898,7 +898,7 @@ H5HL_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
if (freelist->offset + freelist->size > h->mem_alloc) {
fprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n");
} else {
- for (i = overlap = 0; i < freelist->size; i++) {
+ for (i=overlap=0; i<(intn)(freelist->size); i++) {
if (marker[freelist->offset + i])
overlap++;
marker[freelist->offset + i] = 1;
@@ -923,10 +923,10 @@ H5HL_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
*/
fprintf(stream, "%*sData follows (`__' indicates free region)...\n",
indent, "");
- for (i = 0; i < h->disk_alloc; i += 16) {
+ for (i=0; i<(intn)(h->disk_alloc); i+=16) {
fprintf(stream, "%*s %8d: ", indent, "", i);
for (j = 0; j < 16; j++) {
- if (i + j < h->disk_alloc) {
+ if (i+j<(intn)(h->disk_alloc)) {
if (marker[i + j]) {
fprintf(stream, "__ ");
} else {
@@ -941,7 +941,7 @@ H5HL_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
}
for (j = 0; j < 16; j++) {
- if (i + j < h->disk_alloc) {
+ if (i+j < (intn)(h->disk_alloc)) {
if (marker[i + j]) {
HDfputc(' ', stream);
} else {
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index b1af51a..da8c257 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -34,7 +34,7 @@
#define H5HL_MAGIC "HEAP" /*heap magic number */
#define H5HL_SIZEOF_MAGIC 4
-#define H5HL_ALIGN(X) (((X)+7)&~0x07) /*align on 8-byte boundary */
+#define H5HL_ALIGN(X) (((X)+7)&(unsigned)(~0x07)) /*align on 8-byte boundary */
#define H5HL_SIZEOF_HDR(F) \
H5HL_ALIGN(H5HL_SIZEOF_MAGIC + /*heap signature */ \
diff --git a/src/H5I.c b/src/H5I.c
index b958a3e..6b9383c 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -133,7 +133,7 @@ H5I_init_interface(void)
******************************************************************************/
intn
H5I_init_group(H5I_group_t grp, /* IN: Group to initialize */
- intn hash_size, /* IN: Minimum hash table size to use for group */
+ size_t hash_size, /* IN: Minimum hash table size to use for group */
uintn reserved, /* IN: Number of hash table entries to reserve */
herr_t (*free_func) (void *) /* IN: Function to call when releasing ref counted objects */
)
@@ -183,7 +183,8 @@ H5I_init_group(H5I_group_t grp, /* IN: Group to initialize */
grp_ptr->ids = 0;
grp_ptr->nextid = reserved;
grp_ptr->free_func = free_func;
- grp_ptr->id_list = H5MM_xcalloc(hash_size, sizeof(H5I_id_info_t *));
+ grp_ptr->id_list = H5MM_xcalloc((intn)hash_size,
+ sizeof(H5I_id_info_t *));
}
/* Increment the count of the times this group has been initialized */
@@ -232,7 +233,7 @@ H5I_destroy_group(H5I_group_t grp)
H5I_id_group_t *grp_ptr = NULL; /* ptr to the atomic group */
H5I_id_info_t *cur=NULL, *next=NULL;
intn ret_value = SUCCEED;
- intn i;
+ uintn i;
FUNC_ENTER(H5I_destroy_group, FAIL);
@@ -674,7 +675,7 @@ H5I_search(H5I_group_t grp, /* IN: Group to search for the object in */
{
H5I_id_group_t *grp_ptr = NULL; /* ptr to the group */
H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID */
- intn i; /* local counting variable */
+ uintn i; /* local counting variable */
void * ret_value = NULL;
FUNC_ENTER(H5I_search, NULL);
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index 45f9e85..25fe0c7 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -49,7 +49,7 @@
* Map an ID to a hash location (assumes s is a power of 2 and smaller
* than the ID_MASK constant).
*/
-# define ID_TO_LOC(a,s) ((hid_t)(a)&((s)-1))
+# define ID_TO_LOC(a,s) ((hid_t)((size_t)(a)&((s)-1)))
#else
/*
@@ -81,7 +81,7 @@ typedef struct {
uintn count; /*# of times this group has been initialized */
uintn reserved; /*# of IDs to reserve for constant IDs */
uintn wrapped; /*whether the id count has wrapped around */
- intn hash_size; /*sizeof the hash table to store the IDs in*/
+ size_t hash_size; /*sizeof the hash table to store the IDs in*/
uintn ids; /*current number of IDs held */
uintn nextid; /*ID to use for the next atom */
herr_t (*free_func)(void*);/*func to call to release object */
@@ -92,7 +92,7 @@ typedef struct {
typedef intn (*H5I_search_func_t) (void * obj, const void * key);
/* Private Functions in H5I.c */
-intn H5I_init_group (H5I_group_t grp, intn hash_size, uintn reserved,
+intn H5I_init_group (H5I_group_t grp, size_t hash_size, uintn reserved,
herr_t (*free_func)(void *));
herr_t H5I_destroy_group (H5I_group_t grp);
hid_t H5I_register (H5I_group_t grp, void *object);
diff --git a/src/H5MM.c b/src/H5MM.c
index 3a1d392..2182a2d 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -59,11 +59,18 @@ H5MM_xmalloc(size_t size)
*
*-------------------------------------------------------------------------
*/
-void *
-H5MM_xcalloc(size_t n, size_t size)
+void *
+H5MM_xcalloc(intn n, size_t size)
{
- void *mem = HDcalloc(n, size);
- assert(mem);
+ void *mem = NULL;
+
+ assert (n>=0);
+
+ if (n>0) {
+ mem = HDcalloc((size_t)n, size);
+ assert(mem);
+ }
+
return mem;
}
diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h
index 1b9975c..3fef16b 100644
--- a/src/H5MMprivate.h
+++ b/src/H5MMprivate.h
@@ -26,7 +26,7 @@
* Library prototypes...
*/
void *H5MM_xmalloc (size_t size);
-void *H5MM_xcalloc (size_t n, size_t size);
+void *H5MM_xcalloc (intn n, size_t size);
void *H5MM_xrealloc (void *mem, size_t size);
char *H5MM_xstrdup (const char *s);
void *H5MM_xfree (const void *mem);
diff --git a/src/H5O.c b/src/H5O.c
index e7a51fa..7049288 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1714,7 +1714,7 @@ H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
/* check for bad message id */
if (oh->mesg[i].type->id < 0 ||
- oh->mesg[i].type->id >= NELMTS(message_type_g)) {
+ oh->mesg[i].type->id >= (intn)NELMTS(message_type_g)) {
fprintf(stream, "*** BAD MESSAGE ID 0x%04x\n",
oh->mesg[i].type->id);
continue;
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index c3b46cd..31c1c4e 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -157,7 +157,7 @@ H5O_dtype_decode_helper(const uint8 **pp, H5T_t *dt)
assert(dt->u.compnd.nmembs > 0);
dt->u.compnd.nalloc = dt->u.compnd.nmembs;
dt->u.compnd.memb = H5MM_xcalloc(dt->u.compnd.nalloc,
- sizeof(H5T_member_t));
+ sizeof(H5T_member_t));
for (i = 0; i < dt->u.compnd.nmembs; i++) {
dt->u.compnd.memb[i].name = H5MM_xstrdup((const char *)*pp);
*pp += ((HDstrlen((const char *)*pp) + 8) / 8) * 8; /*multiple of 8 w/ null terminator */
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 18dd40d..948435a 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -369,8 +369,8 @@ 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)
+H5O_efl_read (H5F_t *f __attribute__((unused)), const H5O_efl_t *efl,
+ haddr_t *addr, size_t size, uint8 *buf)
{
int i, fd=-1;
size_t to_read, cur, skip=0;
@@ -416,7 +416,7 @@ H5O_efl_read (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr, size_t size,
if ((n=read (fd, buf, to_read))<0) {
HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL,
"read error in external raw data file");
- } else if (n<to_read) {
+ } else if ((size_t)n<to_read) {
HDmemset (buf+n, 0, to_read-n);
}
close (fd);
@@ -454,8 +454,8 @@ H5O_efl_read (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr, size_t size,
*-------------------------------------------------------------------------
*/
herr_t
-H5O_efl_write (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr, size_t size,
- const uint8 *buf)
+H5O_efl_write (H5F_t *f __attribute__((unused)), const H5O_efl_t *efl,
+ haddr_t *addr, size_t size, const uint8 *buf)
{
int i, fd=-1;
size_t to_write, cur, skip=0;
@@ -502,7 +502,7 @@ H5O_efl_write (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr, size_t size,
"unable to seek in external raw data file");
}
to_write = MIN(efl->slot[i].size-skip, size);
- if (write (fd, buf, to_write)!=to_write) {
+ if ((size_t)write (fd, buf, to_write)!=to_write) {
HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL,
"write error in external raw data file");
}
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 90317fc..de86366 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -42,9 +42,9 @@
#define H5O_ALL (-1) /*delete all messages of type */
/* Flags which are part of a message */
-#define H5O_FLAG_CONSTANT 0x01
-#define H5O_FLAG_SHARED 0x02
-#define H5O_FLAG_BITS 0x03
+#define H5O_FLAG_CONSTANT 0x01u
+#define H5O_FLAG_SHARED 0x02u
+#define H5O_FLAG_BITS 0x03u
#define H5O_VERSION 1
/*
@@ -146,8 +146,8 @@ typedef struct H5O_efl_entry_t {
typedef struct H5O_efl_t {
haddr_t heap_addr; /*address of name heap */
- uintn nalloc; /*number of slots allocated */
- uintn nused; /*number of slots used */
+ intn nalloc; /*number of slots allocated */
+ intn nused; /*number of slots used */
H5O_efl_entry_t *slot; /*array of external file entries */
} H5O_efl_t;
@@ -161,7 +161,7 @@ extern const H5O_class_t H5O_LAYOUT[1];
typedef struct H5O_layout_t {
int type; /*type of layout, H5D_layout_t */
haddr_t addr; /*file address of data or B-tree */
- uintn ndims; /*num dimensions in stored data */
+ intn ndims; /*num dimensions in stored data */
size_t dim[H5O_LAYOUT_NDIMS]; /*size of data or chunk */
} H5O_layout_t;
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 21d8f3c..16c1c71 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -72,7 +72,7 @@ static void *
H5O_sdspace_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
{
H5S_simple_t *sdim = NULL;/* New simple dimensionality structure */
- uintn u; /* local counting variable */
+ intn u; /* local counting variable */
uintn flags;
FUNC_ENTER(H5O_sdspace_decode, NULL);
@@ -134,7 +134,7 @@ static herr_t
H5O_sdspace_encode(H5F_t *f, uint8 *p, const void *mesg)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
- uintn u; /* Local counting variable */
+ intn u; /* Local counting variable */
uintn flags = 0;
FUNC_ENTER(H5O_sdspace_encode, FAIL);
@@ -230,7 +230,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, const void *mesg)
+H5O_sdspace_size(H5F_t *f __attribute__((unused)), 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) */
@@ -267,7 +267,7 @@ H5O_sdspace_debug(H5F_t *f, const void *mesg, FILE * stream,
intn indent, intn fwidth)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
- uintn u; /* local counting variable */
+ intn u; /* local counting variable */
FUNC_ENTER(H5O_sdspace_debug, FAIL);
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index a62a562..0616425 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -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)
+H5O_shared_size (H5F_t *f, const void *_mesg __attribute__((unused)))
{
FUNC_ENTER (H5O_shared_size, 0);
FUNC_LEAVE (H5F_SIZEOF_ADDR(f)+4);
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index a5b0dc7..5c29942 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -218,7 +218,7 @@ H5O_stab_copy(const void *_mesg, void *_dest)
*-------------------------------------------------------------------------
*/
static size_t
-H5O_stab_size(H5F_t *f, const void *_mesg)
+H5O_stab_size(H5F_t *f, const void *_mesg __attribute__((unused)))
{
FUNC_ENTER(H5O_stab_size, 0);
FUNC_LEAVE(2 * H5F_SIZEOF_ADDR(f));
diff --git a/src/H5P.c b/src/H5P.c
index 04020a5..0d30037 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -460,12 +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 * sizeof(int); i++) {
- uintn p2 = 8 == i ? 0 : 1 << i;
- if (size == p2)
- break;
+ for (i=8; i<8*(intn)sizeof(int); i++) {
+ uintn p2 = 8 == i ? 0 : 1 << i;
+ if (size == p2) break;
}
- if (i >= 8 * sizeof(int)) {
+ if (i>=8*(intn)sizeof(int)) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"userblock size is not valid");
}
@@ -888,7 +887,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 > NELMTS(tmpl->chunk_size)) {
+ if (ndims > (intn)NELMTS(tmpl->chunk_size)) {
HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL,
"chunk dimensionality is too large");
}
diff --git a/src/H5S.c b/src/H5S.c
index 91c8b83..8d854ea 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1122,7 +1122,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 || start[u]>=space->u.simple.size[u]) {
+ if (start[u]<0 || (size_t)(start[u])>=space->u.simple.size[u]) {
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,
"hyperslab bounds out of range");
}
@@ -1135,9 +1135,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(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));
}
/* Build hyperslab */
diff --git a/src/H5Ssimp.c b/src/H5Ssimp.c
index a785b35..a7580c3 100644
--- a/src/H5Ssimp.c
+++ b/src/H5Ssimp.c
@@ -383,7 +383,7 @@ H5S_simp_mgath (const void *buf, size_t elmt_size,
/* 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,
+ HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
"unable to retrieve hyperslab parameters");
}
for (i=0; i<space_ndims; i++) {
diff --git a/src/H5T.c b/src/H5T.c
index c45003d..c13441b 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2080,7 +2080,7 @@ H5Tget_member_type(hid_t type_id, int membno)
*-------------------------------------------------------------------------
*/
herr_t
-H5Tinsert(hid_t parent_id, const char *name, off_t offset, hid_t member_id)
+H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id)
{
H5T_t *parent = NULL; /*the compound parent data type */
H5T_t *member = NULL; /*the atomic member type */
@@ -2935,7 +2935,7 @@ H5T_get_size(const H5T_t *dt)
*-------------------------------------------------------------------------
*/
herr_t
-H5T_insert(H5T_t *parent, const char *name, off_t offset, const H5T_t *member)
+H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
{
intn i;
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 0b4e86f..7a6d2e5 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -45,8 +45,12 @@ static intn interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
herr_t
-H5T_conv_noop(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
- void *buf, void *background)
+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)))
{
FUNC_ENTER(H5T_conv_noop, FAIL);
@@ -98,7 +102,7 @@ H5T_conv_noop(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
*/
herr_t
H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
- void *_buf, void *background)
+ void *_buf, void *background __attribute__((unused)))
{
uint8 *buf = (uint8 *) _buf;
uint8 tmp;
@@ -344,7 +348,8 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5T_member_t *dst_memb = NULL; /*destination struct memb desc. */
size_t offset; /*byte offset wrt struct */
size_t src_delta, dst_delta; /*source & destination stride */
- intn elmtno, i; /*counters */
+ uintn elmtno;
+ intn i; /*counters */
H5T_conv_struct_t *priv = (H5T_conv_struct_t *)(cdata->priv);
FUNC_ENTER (H5T_conv_struct, FAIL);
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index ea80fcb..388c20a 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -38,7 +38,7 @@ intn H5T_invalidate_cb (void *obj, const void *call_data);
size_t H5T_get_size (const H5T_t *dt);
intn H5T_cmp (const H5T_t *dt1, const H5T_t *dt2);
hbool_t H5T_is_atomic (const H5T_t *dt);
-herr_t H5T_insert (H5T_t *parent, const char *name, off_t offset,
+herr_t H5T_insert (H5T_t *parent, const char *name, size_t offset,
const H5T_t *member);
herr_t H5T_sort_by_offset (H5T_t *dt);
herr_t H5T_pack (H5T_t *dt);
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index 60a0311..c17ac3a 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -20,8 +20,8 @@
#include <H5public.h>
#include <H5Ipublic.h>
-#define HOFFSET(S,M) ((const char*)&S.M-(const char*)&S)
-#define HPOFFSET(P,M) ((const char*)&(P->M)-(const char*)P)
+#define HOFFSET(S,M) ((size_t)((const char*)&S.M-(const char*)&S))
+#define HPOFFSET(P,M) ((size_t)((const char*)&(P->M)-(const char*)P))
/* These are the various classes of data types */
typedef enum H5T_class_t {
@@ -188,7 +188,7 @@ herr_t H5Tshare (hid_t location_id, hid_t type_id);
hbool_t H5Tis_shared (hid_t location_id, hid_t type_id);
/* Operations defined on compound data types */
-herr_t H5Tinsert (hid_t parent_id, const char *name, off_t offset,
+herr_t H5Tinsert (hid_t parent_id, const char *name, size_t offset,
hid_t member_id);
herr_t H5Tpack (hid_t type_id);
diff --git a/src/H5V.c b/src/H5V.c
index c9f3de2..bd686c2f 100644
--- a/src/H5V.c
+++ b/src/H5V.c
@@ -40,9 +40,11 @@ static hbool_t interface_initialize_g = TRUE;
*-------------------------------------------------------------------------
*/
herr_t
-H5V_stride_optimize1(intn *np, size_t *elmt_size, size_t *size,
- ssize_t *stride1)
+H5V_stride_optimize1(intn *np/*in,out*/, size_t *_elmt_size/*in,out*/,
+ size_t *size, ssize_t *stride1)
{
+ ssize_t *elmt_size = (ssize_t *)_elmt_size;
+
FUNC_ENTER(H5V_stride_optimize1, FAIL);
/*
@@ -50,6 +52,7 @@ H5V_stride_optimize1(intn *np, size_t *elmt_size, size_t *size,
* zero we still must make one reference.
*/
assert(1 == H5V_vector_reduce_product(0, NULL));
+ assert (*elmt_size>0);
/*
* Combine adjacent memory accesses
@@ -87,9 +90,11 @@ H5V_stride_optimize1(intn *np, size_t *elmt_size, size_t *size,
*-------------------------------------------------------------------------
*/
herr_t
-H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size,
- ssize_t *stride1, ssize_t *stride2)
+H5V_stride_optimize2(intn *np/*in,out*/, size_t *_elmt_size/*in,out*/,
+ size_t *size, ssize_t *stride1, ssize_t *stride2)
{
+ ssize_t *elmt_size = (ssize_t *)_elmt_size;
+
FUNC_ENTER(H5V_stride_optimize2, FAIL);
/*
@@ -97,6 +102,7 @@ H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size,
* zero we still must make one reference.
*/
assert(1 == H5V_vector_reduce_product(0, NULL));
+ assert (*elmt_size>0);
/*
* Combine adjacent memory accesses
@@ -286,7 +292,7 @@ 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,
- uint8 fill_value)
+ uintn fill_value)
{
uint8 *dst = (uint8 *) _dst; /*cast for ptr arithmetic */
size_t size[H5V_HYPER_NDIMS]; /*a modifiable copy of _size */
@@ -436,25 +442,26 @@ 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, uint8 fill_value)
+ const ssize_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 */
- intn i, j; /*counters */
+ uintn i; /*counter */
+ intn j; /*counter */
hbool_t carry; /*subtraction carray value */
FUNC_ENTER(H5V_stride_fill, FAIL);
H5V_vector_cpy(n, idx, size);
nelmts = H5V_vector_reduce_product(n, size);
- for (i = 0; i < nelmts; i++) {
+ for (i=0; i<nelmts; i++) {
/* Copy an element */
- HDmemset(dst, fill_value, elmt_size);
+ HDmemset(dst, (signed)fill_value, elmt_size);
/* Decrement indices and advance pointer */
- for (j = n - 1, carry = TRUE; j >= 0 && carry; --j) {
+ for (j=n-1, carry=TRUE; j>=0 && carry; --j) {
dst += stride[j];
if (--idx[j]) carry = FALSE;
@@ -497,7 +504,8 @@ H5V_stride_copy(intn n, size_t elmt_size, const size_t *size,
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 */
- intn i, j; /*counters */
+ uintn i; /*counter */
+ intn j; /*counters */
hbool_t carry; /*carray for subtraction*/
FUNC_ENTER(H5V_stride_copy, FAIL);
@@ -506,13 +514,13 @@ H5V_stride_copy(intn n, size_t elmt_size, const size_t *size,
if (n) {
H5V_vector_cpy(n, idx, size);
nelmts = H5V_vector_reduce_product(n, size);
- for (i = 0; i < nelmts; i++) {
+ for (i=0; i<nelmts; i++) {
/* Copy an element */
HDmemcpy(dst, src, elmt_size);
/* Decrement indices and advance pointers */
- for (j = n - 1, carry = TRUE; j >= 0 && carry; --j) {
+ for (j=n-1, carry=TRUE; j>=0 && carry; --j) {
src += src_stride[j];
dst += dst_stride[j];
@@ -563,7 +571,8 @@ H5V_stride_copy2(size_t nelmts, size_t elmt_size,
const uint8 *src = (const uint8 *) _src;
size_t dst_idx[H5V_HYPER_NDIMS];
size_t src_idx[H5V_HYPER_NDIMS];
- intn i, j;
+ uintn i;
+ intn j;
hbool_t carry;
FUNC_ENTER(H5V_stride_copy2, FAIL);
@@ -571,18 +580,18 @@ H5V_stride_copy2(size_t nelmts, size_t elmt_size,
H5V_vector_cpy(dst_n, dst_idx, dst_size);
H5V_vector_cpy(src_n, src_idx, src_size);
- for (i = 0; i < nelmts; i++) {
+ for (i=0; i<nelmts; i++) {
/* Copy an element */
HDmemcpy(dst, src, elmt_size);
/* Decrement indices and advance pointers */
- for (j = dst_n - 1, carry = TRUE; j >= 0 && carry; --j) {
+ for (j=dst_n-1, carry=TRUE; j>=0 && carry; --j) {
dst += dst_stride[j];
if (--dst_idx[j]) carry = FALSE;
else dst_idx[j] = dst_size[j];
}
- for (j = src_n - 1, carry = TRUE; j >= 0 && carry; --j) {
+ for (j=src_n-1, carry=TRUE; j>=0 && carry; --j) {
src += src_stride[j];
if (--src_idx[j]) carry = FALSE;
else src_idx[j] = src_size[j];
diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h
index 863fd2e..76c638f 100644
--- a/src/H5Vprivate.h
+++ b/src/H5Vprivate.h
@@ -36,13 +36,13 @@ hbool_t H5V_hyper_disjointp(intn n, const size_t *offset1,
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, uint8 val);
+ 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, uint8 fill_value);
+ 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);
@@ -77,7 +77,7 @@ herr_t H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size,
*/
static inline size_t
__attribute__((unused))
-H5V_vector_reduce_product(size_t n, const size_t *v)
+H5V_vector_reduce_product(intn n, const size_t *v)
{
size_t ans = 1;
@@ -105,13 +105,12 @@ H5V_vector_reduce_product(size_t n, const size_t *v)
*/
static inline hbool_t
__attribute__((unused))
-H5V_vector_zerop(size_t n, const size_t *v)
+H5V_vector_zerop(intn n, const size_t *v)
{
- if (!v)
- return TRUE;
- while (n--)
- if (*v++)
- return FALSE;
+ if (!v) return TRUE;
+ while (n--) {
+ if (*v++) return FALSE;
+ }
return TRUE;
}
@@ -136,19 +135,14 @@ H5V_vector_zerop(size_t n, const size_t *v)
*/
static inline intn
__attribute__((unused))
-H5V_vector_cmp(size_t n, const size_t *v1, const size_t *v2)
+H5V_vector_cmp(intn n, const size_t *v1, const size_t *v2)
{
- if (v1 == v2)
- return 0;
+ 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++;
+ 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;
}
@@ -169,10 +163,9 @@ H5V_vector_cmp(size_t n, const size_t *v1, const size_t *v2)
*/
static inline void
__attribute__((unused))
-H5V_vector_inc(size_t n, size_t *v1, const size_t *v2)
+H5V_vector_inc(intn n, size_t *v1, const size_t *v2)
{
- while (n--)
- *v1++ += *v2++;
+ while (n--) *v1++ += *v2++;
}
#endif
diff --git a/src/H5detect.c b/src/H5detect.c
index 93343fd..3f7c251 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -29,7 +29,6 @@ static const char *FileHeader = "\n\
*
*-------------------------------------------------------------------------
*/
-
#include <assert.h>
#include <math.h>
#include <pwd.h>
@@ -163,7 +162,7 @@ static detected_t Known[] =
INFO.varname = #VAR; \
INFO.size = sizeof(TYPE); \
for (_i=sizeof(TYPE),_v=0; _i>0; --_i) _v = (_v<<8) + _i; \
- for (_i=0,_x=(unsigned char *)&_v; _i<sizeof(TYPE); _i++) { \
+ for (_i=0,_x=(unsigned char *)&_v; _i<(signed)sizeof(TYPE); _i++) { \
_j = (*_x++)-1; \
assert (_j<(signed)sizeof(TYPE)); \
INFO.perm[_i] = _j; \
@@ -209,7 +208,7 @@ static detected_t Known[] =
INFO.padding = 0; \
\
/* Byte Order */ \
- for (_i=0,_v1=0.0,_v2=1.0; _i<sizeof(TYPE); _i++) { \
+ for (_i=0,_v1=0.0,_v2=1.0; _i<(signed)sizeof(TYPE); _i++) { \
_v3 = _v1; _v1 += _v2; _v2 /= 256.0; \
if ((_j=byte_cmp(sizeof(TYPE), &_v3, &_v1))>=0) { \
if (0==_i || INFO.perm[_i-1]!=_j) { \
@@ -870,7 +869,7 @@ bit.\n";
char *comma;
if ((pwd = getpwuid(getuid()))) {
if ((comma = strchr(pwd->pw_gecos, ','))) {
- n = MIN(sizeof(real_name) - 1, comma - pwd->pw_gecos);
+ n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos));
strncpy(real_name, pwd->pw_gecos, n);
real_name[n] = '\0';
} else {
@@ -953,9 +952,8 @@ bit.\n";
*-------------------------------------------------------------------------
*/
int
-main(int argc, char *argv[])
+main(void)
{
-
detected_t d[MAXDETECT];
int nd = 0;
diff --git a/src/h5ls.c b/src/h5ls.c
index e8ac70c..07bdd74 100644
--- a/src/h5ls.c
+++ b/src/h5ls.c
@@ -10,6 +10,11 @@
#include <stdio.h>
#include <stdlib.h>
+#include <H5config.h>
+#ifndef HAVE_ATTRIBUTE
+# undef __attribute__
+# define __attribute__(X) /*void*/
+#endif
/*-------------------------------------------------------------------------
@@ -29,7 +34,7 @@
*-------------------------------------------------------------------------
*/
static herr_t
-list (hid_t group, const char *name, void *op_data)
+list (hid_t group, const char *name, void *op_data __attribute__((unused)))
{
hid_t obj;
hid_t (*func)(void*);