summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1999-07-28 18:25:43 (GMT)
committerRobb Matzke <matzke@llnl.gov>1999-07-28 18:25:43 (GMT)
commite4834c43ce6528308ebd5375bd4c7a0df88af427 (patch)
tree0039040d95cc92fdb197b2902436e32a020a7b6f /src
parent139688863f191366fe27fbab9654a52285e63c11 (diff)
downloadhdf5-e4834c43ce6528308ebd5375bd4c7a0df88af427.zip
hdf5-e4834c43ce6528308ebd5375bd4c7a0df88af427.tar.gz
hdf5-e4834c43ce6528308ebd5375bd4c7a0df88af427.tar.bz2
[svn-r1548] Changes since 19990727
---------------------- ./src/H5.c [1.3] ./src/H5AC.c [1.3] ./src/H5ACprivate.h [1.3] ./src/H5B.c [1.3] ./src/H5Bprivate.h [1.3] ./src/H5D.c [1.3] ./src/H5F.c [1.3] ./src/H5Farray.c [1.3] ./src/H5Fcore.c [1.3] ./src/H5Ffamily.c [1.3] ./src/H5Fistore.c [1.3] ./src/H5Flow.c [1.3] ./src/H5Fmpio.c [1.3] ./src/H5Fprivate.h [1.3] ./src/H5Fsec2.c [1.3] ./src/H5Fsplit.c [1.3] ./src/H5Fstdio.c [1.3] ./src/H5G.c [1.3] ./src/H5Gent.c [1.3] ./src/H5Gnode.c [1.3] ./src/H5Gprivate.h [1.3] ./src/H5Gstab.c [1.3] ./src/H5HG.c [1.3] ./src/H5HGprivate.h [1.3] ./src/H5HL.c [1.3] ./src/H5HLprivate.h [1.3] ./src/H5MF.c [1.3] ./src/H5MFprivate.h [1.3] ./src/H5O.c [1.3] ./src/H5Oattr.c [1.3] ./src/H5Ocont.c [1.3] ./src/H5Odtype.c [1.3] ./src/H5Oefl.c [1.3] ./src/H5Olayout.c [1.3] ./src/H5Oprivate.h [1.3] ./src/H5Oshared.c [1.3] ./src/H5Ostab.c [1.3] ./src/H5P.c [1.3] ./src/H5R.c [1.3] ./src/H5Smpio.c [1.3] ./src/H5T.c [1.3] ./src/H5Tvlen.c [1.3] ./src/H5private.h [1.3] ./test/dtypes.c [1.3] ./test/gheap.c [1.3] ./test/istore.c [1.3] ./test/lheap.c [1.3] ./test/ohdr.c [1.3] ./tools/h5debug.c [1.3] File addresses (the `haddr_t' type) are passed by value instead of by reference. The type is no longer a struct. This is one of the preliminary changes needed for the Virtual File Layer stuff. ./src/H5Fprivate.h [1.3] ./src/H5Flow.c [1.3] Some address functions were rewritten as macros.
Diffstat (limited to 'src')
-rw-r--r--src/H5.c23
-rw-r--r--src/H5AC.c138
-rw-r--r--src/H5ACprivate.h45
-rw-r--r--src/H5B.c350
-rw-r--r--src/H5Bprivate.h36
-rw-r--r--src/H5D.c23
-rw-r--r--src/H5Distore.c123
-rw-r--r--src/H5F.c243
-rw-r--r--src/H5Farray.c12
-rw-r--r--src/H5Fcore.c42
-rw-r--r--src/H5Ffamily.c95
-rw-r--r--src/H5Fistore.c123
-rw-r--r--src/H5Flow.c323
-rw-r--r--src/H5Fmpio.c47
-rw-r--r--src/H5Fprivate.h74
-rw-r--r--src/H5Fsec2.c52
-rw-r--r--src/H5Fsplit.c83
-rw-r--r--src/H5Fstdio.c49
-rw-r--r--src/H5G.c18
-rw-r--r--src/H5Gent.c76
-rw-r--r--src/H5Gnode.c137
-rw-r--r--src/H5Gprivate.h6
-rw-r--r--src/H5Gstab.c12
-rw-r--r--src/H5HG.c53
-rw-r--r--src/H5HGprivate.h4
-rw-r--r--src/H5HL.c97
-rw-r--r--src/H5HLprivate.h19
-rw-r--r--src/H5Iprivate.h8
-rw-r--r--src/H5MF.c67
-rw-r--r--src/H5MFprivate.h4
-rw-r--r--src/H5O.c234
-rw-r--r--src/H5Oattr.c3
-rw-r--r--src/H5Ocont.c22
-rw-r--r--src/H5Odtype.c6
-rw-r--r--src/H5Oefl.c72
-rw-r--r--src/H5Olayout.c24
-rw-r--r--src/H5Oprivate.h8
-rw-r--r--src/H5Oshared.c9
-rw-r--r--src/H5Ostab.c16
-rw-r--r--src/H5P.c2
-rw-r--r--src/H5R.c6
-rw-r--r--src/H5Smpio.c6
-rw-r--r--src/H5T.c6
-rw-r--r--src/H5Tvlen.c2
-rw-r--r--src/H5private.h6
45 files changed, 1361 insertions, 1443 deletions
diff --git a/src/H5.c b/src/H5.c
index d096a16..b2f12b2 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -519,10 +519,7 @@ HDvsnprintf(char *buf, size_t size, const char *fmt, va_list ap)
* prints an `hsize_t' value as a hex number right justified and
* zero filled in an 18-character field.
*
- * The conversion `a' refers to an `haddr_t*' type.
- *
- * Bugs: Return value will be incorrect if `%a' appears in the format
- * string.
+ * The conversion `a' refers to an `haddr_t' type.
*
* Return: Success: Number of characters printed
*
@@ -532,7 +529,9 @@ HDvsnprintf(char *buf, size_t size, const char *fmt, va_list ap)
* Thursday, April 9, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-27
+ * The `%a' format refers to an argument of `haddr_t' type
+ * instead of `haddr_t*' and the return value is correct.
*-------------------------------------------------------------------------
*/
int
@@ -732,8 +731,8 @@ HDfprintf (FILE *stream, const char *fmt, ...)
case 'a':
if (1) {
- haddr_t *x = va_arg (ap, haddr_t*);
- if (x && H5F_addr_defined(x)) {
+ haddr_t x = va_arg (ap, haddr_t);
+ if (H5F_addr_defined(x)) {
sprintf(template, "%%%s%s%s%s%s",
leftjust?"-":"", plussign?"+":"",
ldspace?" ":"", prefix?"#":"",
@@ -741,15 +740,15 @@ HDfprintf (FILE *stream, const char *fmt, ...)
if (fwidth>0) {
sprintf(template+HDstrlen(template), "%d", fwidth);
}
- if (sizeof(x->offset)==SIZEOF_INT) {
+ if (sizeof(x)==SIZEOF_INT) {
HDstrcat(template, "d");
- } else if (sizeof(x->offset)==SIZEOF_LONG) {
+ } else if (sizeof(x)==SIZEOF_LONG) {
HDstrcat(template, "ld");
- } else if (sizeof(x->offset)==SIZEOF_LONG_LONG) {
+ } else if (sizeof(x)==SIZEOF_LONG_LONG) {
HDstrcat(template, PRINTF_LL_WIDTH);
HDstrcat(template, "d");
}
- n = fprintf(stream, template, x->offset);
+ n = fprintf(stream, template, x);
} else {
HDstrcpy(template, "%");
if (leftjust) HDstrcat(template, "-");
@@ -757,7 +756,7 @@ HDfprintf (FILE *stream, const char *fmt, ...)
sprintf(template+HDstrlen(template), "%d", fwidth);
}
HDstrcat(template, "s");
- fprintf(stream, template, x?"UNDEF":"NULL");
+ fprintf(stream, template, "UNDEF");
}
}
break;
diff --git a/src/H5AC.c b/src/H5AC.c
index 862eb8c..22851d8 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -114,7 +114,7 @@ H5AC_dest(H5F_t *f)
assert(f->shared->cache);
cache = f->shared->cache;
- if (H5AC_flush(f, NULL, NULL, TRUE) < 0) {
+ if (H5AC_flush(f, NULL, H5F_ADDR_UNDEF, TRUE) < 0) {
HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
"unable to flush cache");
}
@@ -175,17 +175,19 @@ H5AC_dest(H5F_t *f)
* Keeps track of hits, misses, and flushes per object type so we have
* some cache performance diagnostics.
*
+ * Robb Matzke, 1999-07-27
+ * The ADDR argument is passed by value.
+ *
*-------------------------------------------------------------------------
*/
void *
-H5AC_find_f(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
- const void *udata1, void *udata2)
+H5AC_find_f(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
+ const void *udata1, void *udata2)
{
unsigned idx;
herr_t status;
void *thing = NULL;
- herr_t (*flush) (H5F_t *, hbool_t, const haddr_t *,
- void *) = NULL;
+ herr_t (*flush) (H5F_t *, hbool_t, haddr_t, void*) = NULL;
H5AC_slot_t *slot = NULL;
H5AC_t *cache = NULL;
@@ -196,7 +198,7 @@ H5AC_find_f(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
assert(type);
assert(type->load);
assert(type->flush);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
idx = H5AC_HASH(f, addr);
cache = f->shared->cache;
slot = cache->slot + idx;
@@ -204,7 +206,7 @@ H5AC_find_f(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
/*
* Return right away if the item is in the cache.
*/
- if (slot->type == type && H5F_addr_eq(&(slot->addr), addr)) {
+ if (slot->type == type && H5F_addr_eq(slot->addr, addr)) {
cache->diagnostics[type->id].nhits++;
HRETURN(slot->thing);
}
@@ -214,7 +216,7 @@ H5AC_find_f(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
* Fail if the item in the cache is at the correct address but is
* of the wrong type.
*/
- if (slot->type && slot->type != type && H5F_addr_eq(&(slot->addr), addr)) {
+ if (slot->type && slot->type != type && H5F_addr_eq(slot->addr, addr)) {
HRETURN_ERROR(H5E_CACHE, H5E_BADTYPE, NULL,
"internal error (correct address, wrong type)");
}
@@ -227,7 +229,7 @@ H5AC_find_f(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
{
intn i;
for (i = 0; i < slot->nprots; i++) {
- assert(H5F_addr_ne(addr, &(slot->prot[i].addr)));
+ assert(H5F_addr_ne(addr, slot->prot[i].addr));
}
}
#endif
@@ -236,7 +238,7 @@ H5AC_find_f(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
* Load a new thing. If it can't be loaded, then return an error
* without preempting anything.
*/
- if (NULL == (thing = (type->load) (f, addr, udata1, udata2))) {
+ if (NULL == (thing = (type->load)(f, addr, udata1, udata2))) {
HRETURN_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "unable to load object");
}
/*
@@ -244,13 +246,13 @@ H5AC_find_f(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
*/
if (slot->type) {
flush = slot->type->flush;
- status = (flush) (f, TRUE, &(slot->addr), slot->thing);
+ status = (flush)(f, TRUE, slot->addr, slot->thing);
if (status < 0) {
/*
* The old thing could not be removed from the stack.
* Release the new thing and fail.
*/
- if ((type->flush) (f, TRUE, addr, thing) < 0) {
+ if ((type->flush)(f, TRUE, addr, thing) < 0) {
HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL,
"unable to flush just-loaded object");
}
@@ -263,7 +265,7 @@ H5AC_find_f(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
* Make the cache point to the new thing.
*/
slot->type = type;
- slot->addr = *addr;
+ slot->addr = addr;
slot->thing = thing;
FUNC_LEAVE(thing);
@@ -318,8 +320,8 @@ H5AC_compare(const void *_a, const void *_b)
*
* Purpose: Flushes (and destroys if DESTROY is non-zero) the specified
* entry from the cache. If the entry TYPE is CACHE_FREE and
- * ADDR is the null pointer then all types of entries are
- * flushed. If TYPE is CACHE_FREE and ADDR is non-null, then
+ * ADDR is H5F_ADDR_UNDEF then all types of entries are
+ * flushed. If TYPE is CACHE_FREE and ADDR is defined then
* whatever is cached at ADDR is flushed. Otherwise the thing
* at ADDR is flushed if it is the correct type.
*
@@ -335,17 +337,16 @@ H5AC_compare(const void *_a, const void *_b)
* Jul 9 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-27
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_flush(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
- hbool_t destroy)
+H5AC_flush(H5F_t *f, const H5AC_class_t *type, haddr_t addr, hbool_t destroy)
{
uintn i;
herr_t status;
- herr_t (*flush) (H5F_t *, hbool_t, const haddr_t *,
- void *) = NULL;
+ herr_t (*flush)(H5F_t *, hbool_t, haddr_t, void*) = NULL;
H5AC_slot_t *slot;
intn *map = NULL;
uintn nslots;
@@ -357,7 +358,7 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
assert(f->shared->cache);
cache = f->shared->cache;
- if (!addr) {
+ if (!H5F_addr_defined(addr)) {
#ifdef H5AC_SORT_BY_ADDR
/*
@@ -378,8 +379,7 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
current_cache_g = NULL;
#ifdef NDEBUG
for (i = 1; i < nslots; i++) {
- assert(H5F_addr_lt(&(cache->slot[i - 1].addr),
- &(cache->slot[i].addr)));
+ assert(H5F_addr_lt(cache->slot[i - 1].addr, cache->slot[i].addr));
}
#endif
#else
@@ -399,7 +399,7 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
#endif
if (!type || type == slot->type) {
flush = slot->type->flush;
- status = (flush) (f, destroy, &(slot->addr), slot->thing);
+ status = (flush)(f, destroy, slot->addr, slot->thing);
if (status < 0) {
map = H5MM_xfree(map);
HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
@@ -423,13 +423,13 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
} else {
i = H5AC_HASH(f, addr);
if ((!type || cache->slot[i].type == type) &&
- H5F_addr_eq(&(cache->slot[i].addr), addr)) {
+ H5F_addr_eq(cache->slot[i].addr, addr)) {
/*
* Flush just this entry.
*/
flush = cache->slot[i].type->flush;
- status = (flush) (f, destroy, &(cache->slot[i].addr),
- cache->slot[i].thing);
+ status = (flush)(f, destroy, cache->slot[i].addr,
+ cache->slot[i].thing);
if (status < 0) {
HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
"unable to flush object");
@@ -460,16 +460,16 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
* Jul 9 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-27
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_set(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, void *thing)
+H5AC_set(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing)
{
herr_t status;
uintn idx;
- herr_t (*flush) (H5F_t *, hbool_t, const haddr_t *,
- void *) = NULL;
+ herr_t (*flush)(H5F_t *, hbool_t, haddr_t, void*) = NULL;
H5AC_slot_t *slot = NULL;
H5AC_t *cache = NULL;
@@ -479,7 +479,7 @@ H5AC_set(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, void *thing)
assert(f->shared->cache);
assert(type);
assert(type->flush);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(thing);
idx = H5AC_HASH(f, addr);
cache = f->shared->cache;
@@ -489,14 +489,14 @@ H5AC_set(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, void *thing)
{
intn i;
for (i = 0; i < slot->nprots; i++) {
- assert(H5F_addr_ne(addr, &(slot->prot[i].addr)));
+ assert(H5F_addr_ne(addr, slot->prot[i].addr));
}
}
#endif
if (slot->type) {
flush = slot->type->flush;
- status = (flush) (f, TRUE, &(slot->addr), slot->thing);
+ status = (flush)(f, TRUE, slot->addr, slot->thing);
if (status < 0) {
HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
"unable to flush object");
@@ -504,7 +504,7 @@ H5AC_set(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, void *thing)
cache->diagnostics[slot->type->id].nflushes++;
}
slot->type = type;
- slot->addr = *addr;
+ slot->addr = addr;
slot->thing = thing;
cache->diagnostics[type->id].ninits++;
@@ -528,16 +528,16 @@ H5AC_set(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, void *thing)
* Jul 9 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-27
+ * The OLD_ADDR and NEW_ADDR arguments are passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_rename(H5F_t *f, const H5AC_class_t *type,
- const haddr_t *old_addr, const haddr_t *new_addr)
+H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr,
+ haddr_t new_addr)
{
uintn old_idx, new_idx;
- herr_t (*flush) (H5F_t *, hbool_t, const haddr_t *,
- void *);
+ herr_t (*flush)(H5F_t *, hbool_t, haddr_t, void*);
herr_t status;
H5AC_t *cache = NULL;
@@ -546,8 +546,6 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type,
assert(f);
assert(f->shared->cache);
assert(type);
- assert(old_addr);
- assert(new_addr);
old_idx = H5AC_HASH(f, old_addr);
new_idx = H5AC_HASH(f, new_addr);
cache = f->shared->cache;
@@ -557,12 +555,10 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type,
int i;
for (i = 0; i < cache->slot[old_idx].nprots; i++) {
- assert(H5F_addr_ne(old_addr,
- &(cache->slot[old_idx].prot[i].addr)));
+ assert(H5F_addr_ne(old_addr, cache->slot[old_idx].prot[i].addr));
}
for (i = 0; i < cache->slot[new_idx].nprots; i++) {
- assert(H5F_addr_ne(new_addr,
- &(cache->slot[new_idx].prot[i].addr)));
+ assert(H5F_addr_ne(new_addr, cache->slot[new_idx].prot[i].addr));
}
}
#endif
@@ -572,11 +568,11 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type,
* new hash value is the same as the old one.
*/
if (cache->slot[old_idx].type != type ||
- H5F_addr_ne(&(cache->slot[old_idx].addr), old_addr)) {
+ H5F_addr_ne(cache->slot[old_idx].addr, old_addr)) {
HRETURN(SUCCEED);
}
if (old_idx == new_idx) {
- cache->slot[old_idx].addr = *new_addr;
+ cache->slot[old_idx].addr = new_addr;
HRETURN(SUCCEED);
}
/*
@@ -584,8 +580,8 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type,
*/
if (cache->slot[new_idx].type) {
flush = cache->slot[new_idx].type->flush;
- status = (flush) (f, TRUE, &(cache->slot[new_idx].addr),
- cache->slot[new_idx].thing);
+ status = (flush)(f, TRUE, cache->slot[new_idx].addr,
+ cache->slot[new_idx].thing);
if (status < 0) {
HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
"unable to flush object");
@@ -596,7 +592,7 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type,
* Move the source to the destination (it might not be cached)
*/
cache->slot[new_idx].type = cache->slot[old_idx].type;
- cache->slot[new_idx].addr = *new_addr;
+ cache->slot[new_idx].addr = new_addr;
cache->slot[new_idx].thing = cache->slot[old_idx].thing;
cache->slot[old_idx].type = NULL;
@@ -626,12 +622,13 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type,
* Sep 2 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-27
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
void *
-H5AC_protect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
- const void *udata1, void *udata2)
+H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
+ const void *udata1, void *udata2)
{
int idx;
void *thing = NULL;
@@ -657,22 +654,22 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
assert(type);
assert(type->load);
assert(type->flush);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
idx = H5AC_HASH(f, addr);
cache = f->shared->cache;
slot = cache->slot + idx;
- if (slot->type == type && H5F_addr_eq(&(slot->addr), addr)) {
+ if (slot->type == type && H5F_addr_eq(slot->addr, addr)) {
/*
* The object is already cached; simply remove it from the cache.
*/
cache->diagnostics[slot->type->id].nhits++;
thing = slot->thing;
slot->type = NULL;
- H5F_addr_undef(&(slot->addr));
+ slot->addr = H5F_ADDR_UNDEF;
slot->thing = NULL;
- } else if (slot->type && H5F_addr_eq(&(slot->addr), addr)) {
+ } else if (slot->type && H5F_addr_eq(slot->addr, addr)) {
/*
* Right address but wrong object type.
*/
@@ -688,7 +685,7 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
*/
intn i;
for (i = 0; i < slot->nprots; i++) {
- assert(H5F_addr_ne(addr, &(slot->prot[i].addr)));
+ assert(H5F_addr_ne(addr, slot->prot[i].addr));
}
#endif
@@ -697,7 +694,7 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
* without preempting anything.
*/
cache->diagnostics[type->id].nmisses++;
- if (NULL == (thing = (type->load) (f, addr, udata1, udata2))) {
+ if (NULL == (thing = (type->load)(f, addr, udata1, udata2))) {
HRETURN_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL,
"unable to load object");
}
@@ -720,7 +717,7 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
slot->prot = x;
}
slot->prot[slot->nprots].type = type;
- slot->prot[slot->nprots].addr = *addr;
+ slot->prot[slot->nprots].addr = addr;
slot->prot[slot->nprots].thing = thing;
slot->nprots += 1;
#endif
@@ -748,17 +745,16 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
* Sep 2 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-27
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
- void *thing)
+H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing)
{
herr_t status;
uintn idx;
- herr_t (*flush) (H5F_t *, hbool_t, const haddr_t *,
- void *) = NULL;
+ herr_t (*flush)(H5F_t*, hbool_t, haddr_t, void*) = NULL;
H5AC_t *cache = NULL;
H5AC_slot_t *slot = NULL;
@@ -769,7 +765,7 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
assert(f->shared->cache);
assert(type);
assert(type->flush);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(thing);
idx = H5AC_HASH(f, addr);
cache = f->shared->cache;
@@ -780,9 +776,9 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
* better not be another copy of the protected object.
*/
if (slot->type) {
- assert(H5F_addr_ne(&(slot->addr), addr));
+ assert(H5F_addr_ne(slot->addr, addr));
flush = slot->type->flush;
- status = (flush) (f, TRUE, &(slot->addr), slot->thing);
+ status = (flush)(f, TRUE, slot->addr, slot->thing);
if (status < 0) {
HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
"unable to flush object");
@@ -797,7 +793,7 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
{
int found, i;
for (i = 0, found = FALSE; i < slot->nprots && !found; i++) {
- if (H5F_addr_eq(addr, &(slot->prot[i].addr))) {
+ if (H5F_addr_eq(addr, slot->prot[i].addr)) {
assert(slot->prot[i].type == type);
HDmemmove(slot->prot + i, slot->prot + i + 1,
((slot->nprots - i) - 1) * sizeof(H5AC_prot_t));
@@ -813,7 +809,7 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
* Insert the object back into the cache; it is no longer protected.
*/
slot->type = type;
- slot->addr = *addr;
+ slot->addr = addr;
slot->thing = thing;
cache->nprots -= 1;
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 3a911a7..17d9e06 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -60,10 +60,10 @@ typedef enum H5AC_subid_t {
typedef struct H5AC_class_t {
H5AC_subid_t id;
- void *(*load)(H5F_t *, const haddr_t *addr,
- const void *udata1, void *udata2);
- herr_t (*flush)(H5F_t *, hbool_t dest,
- const haddr_t *addr, void *thing);
+ void *(*load)(H5F_t*, haddr_t addr, const void *udata1,
+ void *udata2);
+ herr_t (*flush)(H5F_t*, hbool_t dest, haddr_t addr,
+ void *thing);
} H5AC_class_t;
/*
@@ -72,7 +72,7 @@ typedef struct H5AC_class_t {
* own cache, an array of slots.
*/
#define H5AC_NSLOTS 10330 /*prime number tend to work best */
-#define H5AC_HASH(F,ADDR_P) H5F_addr_hash(ADDR_P,(F)->shared->cache->nslots)
+#define H5AC_HASH(F,ADDR) H5F_addr_hash(ADDR,(F)->shared->cache->nslots)
typedef struct H5AC_prot_t {
const H5AC_class_t *type; /*type of protected thing */
@@ -107,29 +107,26 @@ typedef struct H5AC_t {
* Library prototypes.
*/
__DLL__ herr_t H5AC_dest(H5F_t *f);
-__DLL__ void *H5AC_find_f(H5F_t *f, const H5AC_class_t *type,
- const haddr_t *addr, const void *udata1,
- void *udata2);
-__DLL__ void *H5AC_protect(H5F_t *f, const H5AC_class_t *type,
- const haddr_t *addr, const void *udata1,
- void *udata2);
-__DLL__ herr_t H5AC_unprotect(H5F_t *f, const H5AC_class_t *type,
- const haddr_t *addr, void *thing);
-__DLL__ herr_t H5AC_flush(H5F_t *f, const H5AC_class_t *type,
- const haddr_t *addr, hbool_t destroy);
+__DLL__ void *H5AC_find_f(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
+ const void *udata1, void *udata2);
+__DLL__ void *H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
+ const void *udata1, void *udata2);
+__DLL__ herr_t H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
+ void *thing);
+__DLL__ herr_t H5AC_flush(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
+ hbool_t destroy);
__DLL__ herr_t H5AC_create(H5F_t *f, intn size_hint);
__DLL__ herr_t H5AC_rename(H5F_t *f, const H5AC_class_t *type,
- const haddr_t *old_addr, const haddr_t *new_addr);
-__DLL__ herr_t H5AC_set(H5F_t *f, const H5AC_class_t *type,
- const haddr_t *addr, void *thing);
+ haddr_t old_addr, haddr_t new_addr);
+__DLL__ herr_t H5AC_set(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
+ void *thing);
__DLL__ herr_t H5AC_debug(H5F_t *f);
-#define H5AC_find(F,TYPE,ADDR_P,UDATA1,UDATA2) \
- (((F)->shared->cache->slot[H5AC_HASH(F,ADDR_P)].type==(TYPE) && \
- H5F_addr_eq (&((F)->shared->cache->slot[H5AC_HASH(F,ADDR_P)].addr), \
- ADDR_P)) ? \
+#define H5AC_find(F,TYPE,ADDR,UDATA1,UDATA2) \
+ (((F)->shared->cache->slot[H5AC_HASH(F,ADDR)].type==(TYPE) && \
+ (F)->shared->cache->slot[H5AC_HASH(F,ADDR)].addr==ADDR) ? \
((F)->shared->cache->diagnostics[(TYPE)->id].nhits++, \
- (F)->shared->cache->slot[H5AC_HASH(F,ADDR_P)].thing) : \
- H5AC_find_f (F, TYPE, ADDR_P, UDATA1, UDATA2))
+ (F)->shared->cache->slot[H5AC_HASH(F,ADDR)].thing) : \
+ H5AC_find_f(F, TYPE, ADDR, UDATA1, UDATA2))
#endif /* !_H5ACprivate_H */
diff --git a/src/H5B.c b/src/H5B.c
index 7ccbc61..5bb6a35 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -100,7 +100,7 @@
#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,
+static H5B_ins_t H5B_insert_helper(H5F_t *f, haddr_t addr,
const H5B_class_t *type,
const double split_ratios[],
uint8_t *lt_key,
@@ -110,31 +110,28 @@ static H5B_ins_t H5B_insert_helper(H5F_t *f, const haddr_t *addr,
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_t *bt, intn idx, 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_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5B_t *b);
+static H5B_t *H5B_load(H5F_t *f, 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, intn idx,
+static herr_t H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt,
+ haddr_t old_addr, intn idx,
const double split_ratios[], 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, 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,
+ (void *(*)(H5F_t*, haddr_t, const void*, void*))H5B_load,
+ (herr_t (*)(H5F_t*, hbool_t, haddr_t, void*))H5B_flush,
}};
/* Interface initialization? */
@@ -149,20 +146,25 @@ static intn interface_initialize_g = 0;
* passed as an argument to the sizeof_rkey() method for the
* B-tree.
*
- * Return: Non-negative on success (address of new node is returned
- * through the RETVAL argument.) /Negative on failure
+ * Return: Success: Non-negative, and the address of new node is
+ * returned through the ADDR_P argument.
+ *
+ * Failure: Negative
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Jun 23 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * Changed the name of the ADDR argument to ADDR_P to make it
+ * obvious that the address is passed by reference unlike most
+ * other functions that take addresses.
*-------------------------------------------------------------------------
*/
herr_t
H5B_create(H5F_t *f, const H5B_class_t *type, void *udata,
- haddr_t *addr/*out*/)
+ haddr_t *addr_p/*out*/)
{
H5B_t *bt = NULL;
size_t size, sizeof_rkey;
@@ -178,15 +180,15 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata,
*/
assert(f);
assert(type);
- assert(addr);
+ assert(addr_p);
/*
* Allocate file and memory data structures.
*/
sizeof_rkey = (type->get_sizeof_rkey) (f, udata);
size = H5B_nodesize(f, type, &total_native_keysize, sizeof_rkey);
- if (H5MF_alloc(f, H5MF_META, (hsize_t)size, addr/*out*/) < 0) {
- H5F_addr_undef (addr);
+ if (H5MF_alloc(f, H5MF_META, (hsize_t)size, addr_p/*out*/) < 0) {
+ H5F_addr_undef(addr_p);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"file allocation failed for B-tree root node");
}
@@ -236,18 +238,18 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata,
/*
* Cache the new B-tree node.
*/
- if (H5AC_set(f, H5AC_BT, addr, bt) < 0) {
+ if (H5AC_set(f, H5AC_BT, *addr_p, bt) < 0) {
HRETURN_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL,
"can't add B-tree root node to cache");
}
#ifdef H5B_DEBUG
- H5B_assert(f, addr, type, udata);
+ H5B_assert(f, *addr_p, type, udata);
#endif
ret_value = SUCCEED;
done:
if (ret_value<0) {
- H5MF_xfree (f, addr, (hsize_t)size);
+ H5MF_xfree (f, *addr_p, (hsize_t)size);
if (bt) {
H5MM_xfree (bt->page);
H5MM_xfree (bt->native);
@@ -275,11 +277,12 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata,
* Jun 23 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static H5B_t *
-H5B_load(H5F_t *f, const haddr_t *addr, const void *_type, void *udata)
+H5B_load(H5F_t *f, haddr_t addr, const void *_type, void *udata)
{
const H5B_class_t *type = (const H5B_class_t *) _type;
size_t size, total_nkey_size;
@@ -292,7 +295,7 @@ H5B_load(H5F_t *f, const haddr_t *addr, const void *_type, void *udata)
/* Check arguments */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(type);
assert(type->get_sizeof_rkey);
@@ -383,12 +386,15 @@ H5B_load(H5F_t *f, const haddr_t *addr, const void *_type, void *udata)
* Jun 23 1997
*
* Modifications:
- * rky 980828 Only p0 writes metadata to disk.
+ * rky 980828
+ * Only p0 writes metadata to disk.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5B_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt)
+H5B_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5B_t *bt)
{
intn i;
size_t size = 0;
@@ -400,7 +406,7 @@ H5B_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt)
* Check arguments.
*/
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(bt);
assert(bt->type);
assert(bt->type->encode);
@@ -421,8 +427,8 @@ H5B_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt)
UINT16ENCODE(p, bt->nchildren);
/* sibling pointers */
- H5F_addr_encode(f, &p, &(bt->left));
- H5F_addr_encode(f, &p, &(bt->right));
+ H5F_addr_encode(f, &p, bt->left);
+ H5F_addr_encode(f, &p, bt->right);
/* child keys and pointers */
for (i=0; i<=bt->nchildren; i++) {
@@ -443,7 +449,7 @@ H5B_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt)
/* encode the child address */
if (i < bt->ndirty) {
- H5F_addr_encode(f, &p, &(bt->child[i]));
+ H5F_addr_encode(f, &p, bt->child[i]);
} else {
p += H5F_SIZEOF_ADDR(f);
}
@@ -498,11 +504,12 @@ H5B_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt)
* Jun 23 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5B_find(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata)
+H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
{
H5B_t *bt = NULL;
intn idx = -1, lt = 0, rt, cmp = 1;
@@ -518,7 +525,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata)
assert(type->decode);
assert(type->cmp3);
assert(type->found);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
/*
* Perform a binary search to locate the child which contains
@@ -554,12 +561,12 @@ H5B_find(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata)
*/
assert(idx >= 0 && idx < bt->nchildren);
if (bt->level > 0) {
- if ((ret_value = H5B_find(f, type, bt->child + idx, udata)) < 0) {
+ if ((ret_value = H5B_find(f, type, bt->child[idx], udata)) < 0) {
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL,
"key not found in subtree");
}
} else {
- ret_value = (type->found) (f, bt->child + idx, bt->key[idx].nkey,
+ ret_value = (type->found) (f, bt->child[idx], bt->key[idx].nkey,
udata, bt->key[idx+1].nkey);
if (ret_value < 0) {
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL,
@@ -596,13 +603,15 @@ H5B_find(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata)
* Jul 3 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The OLD_ADDR argument is passed by value. The NEW_ADDR
+ * argument has been renamed to NEW_ADDR_P
*-------------------------------------------------------------------------
*/
static herr_t
-H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt,
- const haddr_t *old_addr, intn idx, const double split_ratios[],
- void *udata, haddr_t *new_addr/*out*/)
+H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr,
+ intn idx, const double split_ratios[], void *udata,
+ haddr_t *new_addr_p/*out*/)
{
H5B_t *new_bt = NULL, *tmp_bt = NULL;
herr_t ret_value = FAIL;
@@ -616,7 +625,7 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt,
*/
assert(f);
assert(type);
- assert(old_addr && H5F_addr_defined(old_addr));
+ assert(H5F_addr_defined(old_addr));
/*
* Initialize variables.
@@ -628,12 +637,12 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt,
#ifdef H5B_DEBUG
if (H5DEBUG(B)) {
const char *side;
- if (!H5F_addr_defined(&(old_bt->left)) &&
- !H5F_addr_defined(&(old_bt->right))) {
+ if (!H5F_addr_defined(old_bt->left) &&
+ !H5F_addr_defined(old_bt->right)) {
side = "ONLY";
- } else if (!H5F_addr_defined(&(old_bt->right))) {
+ } else if (!H5F_addr_defined(old_bt->right)) {
side = "RIGHT";
- } else if (!H5F_addr_defined(&(old_bt->left))) {
+ } else if (!H5F_addr_defined(old_bt->left)) {
side = "LEFT";
} else {
side = "MIDDLE";
@@ -647,9 +656,9 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt,
* Decide how to split the children of the old node among the old node
* and the new node.
*/
- if (!H5F_addr_defined(&(old_bt->right))) {
+ if (!H5F_addr_defined(old_bt->right)) {
nleft = 2 * k * split_ratios[2]; /*right*/
- } else if (!H5F_addr_defined(&(old_bt->left))) {
+ } else if (!H5F_addr_defined(old_bt->left)) {
nleft = 2 * k * split_ratios[0]; /*left*/
} else {
nleft = 2 * k * split_ratios[1]; /*middle*/
@@ -675,11 +684,11 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt,
/*
* Create the new B-tree node.
*/
- if (H5B_create(f, type, udata, new_addr /*out */ ) < 0) {
+ if (H5B_create(f, type, udata, new_addr_p/*out*/) < 0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL,
"unable to create B-tree");
}
- if (NULL == (new_bt = H5AC_protect(f, H5AC_BT, new_addr, type, udata))) {
+ if (NULL==(new_bt=H5AC_protect(f, H5AC_BT, *new_addr_p, type, udata))) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL,
"unable to protect B-tree");
}
@@ -718,25 +727,25 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt,
/*
* Update sibling pointers.
*/
- new_bt->left = *old_addr;
+ new_bt->left = old_addr;
new_bt->right = old_bt->right;
- if (H5F_addr_defined(&(old_bt->right))) {
- if (NULL == (tmp_bt = H5AC_find(f, H5AC_BT, &(old_bt->right), type,
+ if (H5F_addr_defined(old_bt->right)) {
+ if (NULL == (tmp_bt = H5AC_find(f, H5AC_BT, old_bt->right, type,
udata))) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL,
"unable to load right sibling");
}
tmp_bt->dirty = TRUE;
- tmp_bt->left = *new_addr;
+ tmp_bt->left = *new_addr_p;
}
- old_bt->right = *new_addr;
+ old_bt->right = *new_addr_p;
HGOTO_DONE(SUCCEED);
done:
{
- if (new_bt && H5AC_unprotect(f, H5AC_BT, new_addr, new_bt) < 0) {
+ if (new_bt && H5AC_unprotect(f, H5AC_BT, *new_addr_p, new_bt) < 0) {
HRETURN_ERROR(H5E_BTREE, H5E_PROTECT, FAIL,
"unable to release B-tree node");
}
@@ -822,7 +831,6 @@ H5B_decode_keys(H5F_t *f, H5B_t *bt, intn idx)
* Jun 23 1997
*
* Modifications:
- *
* Robb Matzke, 28 Sep 1998
* The optional SPLIT_RATIOS[] indicates what percent of the child
* pointers should go in the left node when a node splits. There are
@@ -833,10 +841,12 @@ H5B_decode_keys(H5F_t *f, H5B_t *bt, intn idx)
* When a node is an only node at its level then we use the right-most
* rule. If SPLIT_RATIOS is null then default values are used.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
+H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr,
const double split_ratios[], void *udata)
{
/*
@@ -864,7 +874,7 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
assert(f);
assert(type);
assert(type->sizeof_nkey <= sizeof _lt_key);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
if ((my_ins = H5B_insert_helper(f, addr, type, split_ratios, lt_key,
&lt_key_changed, md_key, udata, rt_key,
@@ -891,7 +901,7 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
}
/* the new node */
- if (NULL == (bt = H5AC_find(f, H5AC_BT, &child, type, udata))) {
+ if (NULL == (bt = H5AC_find(f, H5AC_BT, child, type, udata))) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL,
"unable to load new node");
}
@@ -926,17 +936,17 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, FAIL,
"unable to read B-tree root node");
}
- if (H5F_block_write(f, &old_root, (hsize_t)size, &H5F_xfer_dflt, buf)<0) {
+ if (H5F_block_write(f, old_root, (hsize_t)size, &H5F_xfer_dflt, buf)<0) {
HGOTO_ERROR(H5E_BTREE, H5E_WRITEERROR, FAIL,
"unable to move B-tree root node");
}
- if (H5AC_rename(f, H5AC_BT, addr, &old_root) < 0) {
+ if (H5AC_rename(f, H5AC_BT, addr, old_root) < 0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL,
"unable to move B-tree root node");
}
/* update the new child's left pointer */
- if (NULL == (bt = H5AC_find(f, H5AC_BT, &child, type, udata))) {
+ if (NULL == (bt = H5AC_find(f, H5AC_BT, child, type, udata))) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL,
"unable to load new child");
}
@@ -1002,20 +1012,19 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
* Jul 8 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The CHILD argument is passed by value.
*-------------------------------------------------------------------------
*/
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)
+ intn idx, haddr_t child, H5B_ins_t anchor, void *md_key)
{
size_t recsize;
intn i;
FUNC_ENTER(H5B_insert_child, FAIL);
assert(bt);
- assert(child);
assert(bt->nchildren<2*H5B_K(f, type));
bt->dirty = TRUE;
@@ -1078,7 +1087,7 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt,
bt->child + idx,
(bt->nchildren - idx) * sizeof(haddr_t));
- bt->child[idx] = *child;
+ bt->child[idx] = child;
bt->nchildren += 1;
bt->ndirty = bt->nchildren;
@@ -1102,7 +1111,7 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt,
*
* Return: Success: A B-tree operation. The address of the new
* node, if the node splits, is returned through
- * the NEW_NODE argument. The new node is always
+ * the NEW_NODE_P argument. The new node is always
* to the right of the previous node. This
* function is called recursively and the return
* value influences the behavior of the caller.
@@ -1126,14 +1135,17 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt,
* When a node is an only node at its level then we use the right-most
* rule. If SPLIT_RATIOS is null then default values are used.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value. The NEW_NODE argument is
+ * renamed NEW_NODE_P
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
+H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type,
const double split_ratios[], uint8_t *lt_key,
hbool_t *lt_key_changed, uint8_t *md_key, void *udata,
uint8_t *rt_key, hbool_t *rt_key_changed,
- haddr_t *new_node/*out*/)
+ haddr_t *new_node_p/*out*/)
{
H5B_t *bt = NULL, *twin = NULL, *tmp_bt = NULL;
intn lt = 0, idx = -1, rt, cmp = -1;
@@ -1147,7 +1159,7 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
* Check arguments
*/
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(type);
assert(type->decode);
assert(type->cmp3);
@@ -1156,7 +1168,7 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
assert(lt_key_changed);
assert(rt_key);
assert(rt_key_changed);
- assert(new_node);
+ assert(new_node_p);
*lt_key_changed = FALSE;
*rt_key_changed = FALSE;
@@ -1194,8 +1206,8 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
assert(0 == bt->level);
bt->key[0].nkey = bt->native;
bt->key[1].nkey = bt->native + type->sizeof_nkey;
- if ((type->new_node) (f, H5B_INS_FIRST, bt->key[0].nkey, udata,
- bt->key[1].nkey, bt->child + 0/*out*/) < 0) {
+ if ((type->new_node)(f, H5B_INS_FIRST, bt->key[0].nkey, udata,
+ bt->key[1].nkey, bt->child + 0/*out*/) < 0) {
bt->key[0].nkey = bt->key[1].nkey = NULL;
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR,
"unable to create leaf node");
@@ -1208,10 +1220,10 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
idx = 0;
if (type->follow_min) {
- if ((my_ins = (type->insert) (f, bt->child+idx, bt->key[idx].nkey,
- lt_key_changed, md_key, udata,
- bt->key[idx+1].nkey, rt_key_changed,
- &child_addr/*out*/)) < 0) {
+ if ((my_ins = (type->insert)(f, bt->child[idx], bt->key[idx].nkey,
+ lt_key_changed, md_key, udata,
+ bt->key[idx+1].nkey, rt_key_changed,
+ &child_addr/*out*/)) < 0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR,
"unable to insert first leaf node");
}
@@ -1229,7 +1241,7 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR,
"unable to decode key");
}
- if ((my_ins = H5B_insert_helper(f, bt->child+idx, type, split_ratios,
+ if ((my_ins = H5B_insert_helper(f, bt->child[idx], type, split_ratios,
bt->key[idx].nkey, lt_key_changed,
md_key, udata, bt->key[idx+1].nkey,
rt_key_changed,
@@ -1248,10 +1260,10 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR,
"unable to decode key");
}
- if ((my_ins = (type->insert) (f, bt->child+idx, bt->key[idx].nkey,
- lt_key_changed, md_key, udata,
- bt->key[idx+1].nkey, rt_key_changed,
- &child_addr/*out*/)) < 0) {
+ if ((my_ins = (type->insert)(f, bt->child[idx], bt->key[idx].nkey,
+ lt_key_changed, md_key, udata,
+ bt->key[idx+1].nkey, rt_key_changed,
+ &child_addr/*out*/)) < 0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR,
"can't insert minimum leaf node");
}
@@ -1268,8 +1280,8 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
}
my_ins = H5B_INS_LEFT;
HDmemcpy(md_key, bt->key[idx].nkey, type->sizeof_nkey);
- if ((type->new_node) (f, H5B_INS_LEFT, bt->key[idx].nkey, udata,
- md_key, &child_addr/*out*/) < 0) {
+ if ((type->new_node)(f, H5B_INS_LEFT, bt->key[idx].nkey, udata,
+ md_key, &child_addr/*out*/) < 0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR,
"can't insert minimum leaf node");
}
@@ -1285,7 +1297,7 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR,
"unable to decode key");
}
- if ((my_ins = H5B_insert_helper(f, bt->child+idx, type, split_ratios,
+ if ((my_ins = H5B_insert_helper(f, bt->child[idx], type, split_ratios,
bt->key[idx].nkey, lt_key_changed,
md_key, udata, bt->key[idx+1].nkey,
rt_key_changed,
@@ -1304,10 +1316,10 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR,
"unable to decode key");
}
- if ((my_ins = (type->insert) (f, bt->child+idx, bt->key[idx].nkey,
- lt_key_changed, md_key, udata,
- bt->key[idx+1].nkey, rt_key_changed,
- &child_addr/*out*/)) < 0) {
+ if ((my_ins = (type->insert)(f, bt->child[idx], bt->key[idx].nkey,
+ lt_key_changed, md_key, udata,
+ bt->key[idx+1].nkey, rt_key_changed,
+ &child_addr/*out*/)) < 0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR,
"can't insert maximum leaf node");
}
@@ -1324,8 +1336,8 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
}
my_ins = H5B_INS_RIGHT;
HDmemcpy(md_key, bt->key[idx+1].nkey, type->sizeof_nkey);
- if ((type->new_node) (f, H5B_INS_RIGHT, md_key, udata,
- bt->key[idx+1].nkey, &child_addr/*out*/) < 0) {
+ if ((type->new_node)(f, H5B_INS_RIGHT, md_key, udata,
+ bt->key[idx+1].nkey, &child_addr/*out*/) < 0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR,
"can't insert maximum leaf node");
}
@@ -1344,7 +1356,7 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
* Follow a branch out of this node to another subtree.
*/
assert(idx >= 0 && idx < bt->nchildren);
- if ((my_ins = H5B_insert_helper(f, bt->child+idx, type, split_ratios,
+ if ((my_ins = H5B_insert_helper(f, bt->child[idx], type, split_ratios,
bt->key[idx].nkey, lt_key_changed,
md_key, udata,
bt->key[idx+1].nkey, rt_key_changed,
@@ -1357,7 +1369,7 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
* Follow a branch out of this node to a leaf node of some other type.
*/
assert(idx >= 0 && idx < bt->nchildren);
- if ((my_ins = (type->insert) (f, bt->child+idx, bt->key[idx].nkey,
+ if ((my_ins = (type->insert)(f, bt->child[idx], bt->key[idx].nkey,
lt_key_changed, md_key, udata,
bt->key[idx+1].nkey, rt_key_changed,
&child_addr/*out*/)) < 0) {
@@ -1403,11 +1415,11 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
*/
if (bt->nchildren == 2 * H5B_K(f, type)) {
if (H5B_split(f, type, bt, addr, idx, split_ratios, udata,
- new_node/*out*/)<0) {
+ new_node_p/*out*/)<0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR,
"unable to split node");
}
- if (NULL == (twin = H5AC_protect(f, H5AC_BT, new_node, type,
+ if (NULL == (twin = H5AC_protect(f, H5AC_BT, *new_node_p, type,
udata))) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR,
"unable to load node");
@@ -1423,7 +1435,7 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
}
/* Insert the child */
- if (H5B_insert_child(f, type, tmp_bt, idx, &child_addr, my_ins,
+ if (H5B_insert_child(f, type, tmp_bt, idx, child_addr, my_ins,
md_key) < 0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR,
"can't insert child");
@@ -1461,7 +1473,7 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
done:
{
herr_t e1 = (bt && H5AC_unprotect(f, H5AC_BT, addr, bt) < 0);
- herr_t e2 = (twin && H5AC_unprotect(f, H5AC_BT, new_node, twin) < 0);
+ herr_t e2 = (twin && H5AC_unprotect(f, H5AC_BT, *new_node_p, twin)<0);
if (e1 || e2) { /*use vars to prevent short-circuit of side effects */
HRETURN_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR,
"unable to release node(s)");
@@ -1487,15 +1499,16 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
* Robb Matzke, 1999-04-21
* The key values are passed to the function which is called.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
- void *udata)
+H5B_iterate (H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
{
H5B_t *bt = NULL;
haddr_t next_addr;
- const haddr_t *cur_addr = NULL;
+ haddr_t cur_addr = H5F_ADDR_UNDEF;
haddr_t *child = NULL;
uint8_t *key = NULL;
intn i, nchildren;
@@ -1509,7 +1522,7 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
assert(f);
assert(type);
assert(type->list);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(udata);
if (NULL == (bt=H5AC_find(f, H5AC_BT, addr, type, udata))) {
@@ -1518,7 +1531,7 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
}
if (bt->level > 0) {
/* Keep following the left-most child until we reach a leaf node. */
- if ((ret_value=H5B_iterate(f, type, bt->child+0, udata))<0) {
+ if ((ret_value=H5B_iterate(f, type, bt->child[0], udata))<0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL,
"unable to list B-tree node");
}
@@ -1534,7 +1547,7 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
}
for (cur_addr=addr, ret_value=0;
H5F_addr_defined(cur_addr);
- cur_addr=&next_addr) {
+ cur_addr=next_addr) {
/*
* Save all the child addresses and native keys since we can't
@@ -1562,7 +1575,7 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
*/
for (i=0, ret_value=0; i<nchildren && !ret_value; i++) {
ret_value = (type->list)(f, key+i*type->sizeof_nkey,
- child+i, key+(i+1)*type->sizeof_nkey,
+ child[i], key+(i+1)*type->sizeof_nkey,
udata);
if (ret_value<0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL,
@@ -1602,11 +1615,12 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
* Wednesday, September 16, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5B_remove_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
+H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type,
intn level, uint8_t *lt_key/*out*/,
hbool_t *lt_key_changed/*out*/, void *udata,
uint8_t *rt_key/*out*/, hbool_t *rt_key_changed/*out*/)
@@ -1618,7 +1632,7 @@ H5B_remove_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
FUNC_ENTER(H5B_remove_helper, H5B_INS_ERROR);
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(type);
assert(type->decode);
assert(type->cmp3);
@@ -1662,7 +1676,7 @@ H5B_remove_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
if (bt->level>0) {
/* We're at an internal node -- call recursively */
if ((ret_value=H5B_remove_helper(f,
- bt->child+idx,
+ bt->child[idx],
type,
level+1,
bt->key[idx].nkey/*out*/,
@@ -1680,7 +1694,7 @@ H5B_remove_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
* object and let it decide how to progress.
*/
if ((ret_value=(type->remove)(f,
- bt->child+idx,
+ bt->child[idx],
bt->key[idx].nkey,
lt_key_changed,
udata,
@@ -1742,8 +1756,8 @@ H5B_remove_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
bt->nchildren = 0;
bt->ndirty = 0;
if (level>0) {
- if (H5F_addr_defined(&(bt->left))) {
- if (NULL==(sibling=H5AC_find(f, H5AC_BT, &(bt->left), type,
+ if (H5F_addr_defined(bt->left)) {
+ if (NULL==(sibling=H5AC_find(f, H5AC_BT, bt->left, type,
udata))) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR,
"unable to unlink node from tree");
@@ -1751,8 +1765,8 @@ H5B_remove_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
sibling->right = bt->right;
sibling->dirty = TRUE;
}
- if (H5F_addr_defined(&(bt->right))) {
- if (NULL==(sibling=H5AC_find(f, H5AC_BT, &(bt->right), type,
+ if (H5F_addr_defined(bt->right)) {
+ if (NULL==(sibling=H5AC_find(f, H5AC_BT, bt->right, type,
udata))) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR,
"unable to unlink node from tree");
@@ -1883,12 +1897,12 @@ H5B_remove_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
* Wednesday, September 16, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5B_remove(H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
- void *udata)
+H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
{
/* These are defined this way to satisfy alignment constraints */
uint64_t _lt_key[128], _rt_key[128];
@@ -1905,7 +1919,7 @@ H5B_remove(H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
assert(f);
assert(type);
assert(type->sizeof_nkey <= sizeof _lt_key);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
/* The actual removal */
if (H5B_remove_helper(f, addr, type, 0, lt_key, &lt_key_changed,
@@ -2002,12 +2016,13 @@ H5B_nodesize(H5F_t *f, const H5B_class_t *type,
* Aug 4 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5B_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
- intn fwidth, const H5B_class_t *type, void *udata)
+H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, intn indent, intn fwidth,
+ const H5B_class_t *type, void *udata)
{
H5B_t *bt = NULL;
int i;
@@ -2018,7 +2033,7 @@ H5B_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
* Check arguments.
*/
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(stream);
assert(indent >= 0);
assert(fwidth >= 0);
@@ -2034,46 +2049,42 @@ H5B_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
/*
* Print the values.
*/
- fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
- "Tree type ID:",
- (int) (bt->type->id));
- fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
- "Size of raw (disk) key:",
- (unsigned long) (bt->sizeof_rkey));
- fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Dirty flag:",
- bt->dirty ? "True" : "False");
- fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
- "Number of initial dirty children:",
- (int) (bt->ndirty));
- fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
- "Level:",
- (int) (bt->level));
-
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Address of left sibling:");
- H5F_addr_print(stream, &(bt->left));
- fprintf(stream, "\n");
-
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Address of right sibling:");
- H5F_addr_print(stream, &(bt->right));
- fprintf(stream, "\n");
-
- fprintf(stream, "%*s%-*s %d (%d)\n", indent, "", fwidth,
- "Number of children (max):",
- (int) (bt->nchildren),
- (int) (2 * H5B_K(f, type)));
+ HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
+ "Tree type ID:",
+ (int) (bt->type->id));
+ HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
+ "Size of raw (disk) key:",
+ (unsigned long) (bt->sizeof_rkey));
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Dirty flag:",
+ bt->dirty ? "True" : "False");
+ HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
+ "Number of initial dirty children:",
+ (int) (bt->ndirty));
+ HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
+ "Level:",
+ (int) (bt->level));
+
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Address of left sibling:",
+ bt->left);
+
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Address of right sibling:",
+ bt->right);
+
+ HDfprintf(stream, "%*s%-*s %d (%d)\n", indent, "", fwidth,
+ "Number of children (max):",
+ (int) (bt->nchildren),
+ (int) (2 * H5B_K(f, type)));
/*
* Print the child addresses
*/
for (i = 0; i < bt->nchildren; i++) {
- fprintf(stream, "%*sChild %d...\n", indent, "", i);
- fprintf(stream, "%*s%-*s ", indent + 3, "", MAX(0, fwidth - 3),
- "Address:");
- H5F_addr_print(stream, bt->child + i);
- fprintf(stream, "\n");
+ HDfprintf(stream, "%*sChild %d...\n", indent, "", i);
+ HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
+ "Address:", bt->child[i]);
H5B_decode_key(f, bt, i);
if (type->debug_key) {
@@ -2084,6 +2095,7 @@ H5B_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5B_assert
@@ -2098,13 +2110,13 @@ H5B_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
* Tuesday, November 4, 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
#ifdef H5B_DEBUG
static herr_t
-H5B_assert(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
- void *udata)
+H5B_assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata)
{
H5B_t *bt = NULL;
intn i, ncell, cmp;
@@ -2131,7 +2143,7 @@ H5B_assert(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
assert(bt);
cur = H5MM_calloc(sizeof(struct child_t));
assert (cur);
- cur->addr = *addr;
+ cur->addr = addr;
cur->level = bt->level;
head = tail = cur;
@@ -2142,21 +2154,21 @@ H5B_assert(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
* test.
*/
for (ncell = 0; cur; ncell++) {
- bt = H5AC_protect(f, H5AC_BT, &(cur->addr), type, udata);
+ bt = H5AC_protect(f, H5AC_BT, cur->addr, type, udata);
assert(bt);
/* Check node header */
assert(bt->ndirty >= 0 && bt->ndirty <= bt->nchildren);
assert(bt->level == cur->level);
if (cur->next && cur->next->level == bt->level) {
- assert(H5F_addr_eq(&(bt->right), &(cur->next->addr)));
+ assert(H5F_addr_eq(bt->right, cur->next->addr));
} else {
- assert(!H5F_addr_defined(&(bt->right)));
+ assert(!H5F_addr_defined(bt->right));
}
if (prev && prev->level == bt->level) {
- assert(H5F_addr_eq(&(bt->left), &(prev->addr)));
+ assert(H5F_addr_eq(bt->left, prev->addr));
} else {
- assert(!H5F_addr_defined(&(bt->left)));
+ assert(!H5F_addr_defined(bt->left));
}
if (cur->level > 0) {
@@ -2167,7 +2179,7 @@ H5B_assert(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
* have then the tree has a cycle.
*/
for (tmp = head; tmp; tmp = tmp->next) {
- assert(H5F_addr_ne(&(tmp->addr), bt->child + i));
+ assert(H5F_addr_ne(tmp->addr, bt->child[i]));
}
/* Add the child node to the end of the queue */
@@ -2187,7 +2199,7 @@ H5B_assert(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
}
}
/* Release node */
- status = H5AC_unprotect(f, H5AC_BT, &(cur->addr), bt);
+ status = H5AC_unprotect(f, H5AC_BT, cur->addr, bt);
assert(status >= 0);
/* Advance current location in queue */
diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h
index 8dcbaea..8ba0321 100644
--- a/src/H5Bprivate.h
+++ b/src/H5Bprivate.h
@@ -70,26 +70,25 @@ 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 */
- herr_t (*new_node) (H5F_t*, H5B_ins_t, void*, void*, void*, haddr_t*);
+ 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*);
+ herr_t (*found)(H5F_t*, 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*, 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;
/* remove existing data */
- H5B_ins_t (*remove)(H5F_t*, const haddr_t*, void*, hbool_t*,
- void*, void*, hbool_t*);
+ H5B_ins_t (*remove)(H5F_t*, haddr_t, void*, hbool_t*, void*, void*,
+ hbool_t*);
/* iterate through the leaf nodes */
- herr_t (*list)(H5F_t*, void*, const haddr_t*, void*, void*);
+ herr_t (*list)(H5F_t*, void*, haddr_t, void*, void*);
/* encode, decode, debug key values */
herr_t (*decode)(H5F_t*, struct H5B_t*, uint8_t*, void*);
@@ -124,18 +123,17 @@ typedef struct H5B_t {
/*
* Library prototypes.
*/
-__DLL__ herr_t H5B_debug (H5F_t *f, const haddr_t *addr, FILE * stream,
+__DLL__ herr_t H5B_debug (H5F_t *f, haddr_t addr, FILE * stream,
intn indent, intn fwidth, const H5B_class_t *type,
void *udata);
__DLL__ herr_t H5B_create (H5F_t *f, const H5B_class_t *type, void *udata,
- haddr_t *);
-__DLL__ herr_t H5B_find (H5F_t *f, const H5B_class_t *type,
- const haddr_t *addr, void *udata);
-__DLL__ herr_t H5B_insert (H5F_t *f, const H5B_class_t *type,
- const haddr_t *addr, const double split_ratios[],
- void *udata);
-__DLL__ herr_t H5B_remove(H5F_t *f, const H5B_class_t *type,
- const haddr_t *addr, void *udata);
-__DLL__ herr_t H5B_iterate (H5F_t *f, const H5B_class_t *type,
- const haddr_t *addr, void *udata);
+ haddr_t *addr_p/*out*/);
+__DLL__ herr_t H5B_find (H5F_t *f, const H5B_class_t *type, haddr_t addr,
+ void *udata);
+__DLL__ herr_t H5B_insert (H5F_t *f, const H5B_class_t *type, haddr_t addr,
+ const double split_ratios[], void *udata);
+__DLL__ herr_t H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr,
+ void *udata);
+__DLL__ herr_t H5B_iterate (H5F_t *f, const H5B_class_t *type, haddr_t addr,
+ void *udata);
#endif
diff --git a/src/H5D.c b/src/H5D.c
index 63eac24..b2fe696 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1055,8 +1055,8 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
for (i=0; i<efl->nused; i++) {
heap_size += H5HL_ALIGN (HDstrlen (efl->slot[i].name)+1);
}
- if (H5HL_create (f, heap_size, &(efl->heap_addr))<0 ||
- (size_t)(-1)==H5HL_insert (f, &(efl->heap_addr), 1, "")) {
+ if (H5HL_create (f, heap_size, &(efl->heap_addr)/*out*/)<0 ||
+ (size_t)(-1)==H5HL_insert(f, efl->heap_addr, 1, "")) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unable to create external file list name heap");
}
@@ -1088,7 +1088,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
H5P_close (H5P_DATASET_CREATE, new_dset->create_parms);
new_dset->create_parms = NULL;
}
- if (H5F_addr_defined(&(new_dset->ent.header))) {
+ if (H5F_addr_defined(new_dset->ent.header)) {
H5O_close(&(new_dset->ent));
}
new_dset->ent.file = NULL;
@@ -1314,7 +1314,7 @@ H5D_open_oid(H5G_entry_t *ent)
/* Get the external file list message, which might not exist */
if (NULL==H5O_read (&(dataset->ent), H5O_EFL, 0,
&(dataset->create_parms->efl)) &&
- !H5F_addr_defined (&(dataset->layout.addr))) {
+ !H5F_addr_defined (dataset->layout.addr)) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"storage address is undefined an no external file list");
}
@@ -1338,7 +1338,7 @@ H5D_open_oid(H5G_entry_t *ent)
done:
if (space) H5S_close(space);
if (ret_value==NULL && dataset) {
- if (H5F_addr_defined(&(dataset->ent.header))) {
+ if (H5F_addr_defined(dataset->ent.header)) {
H5O_close(&(dataset->ent));
}
if (dataset->type) {
@@ -2453,12 +2453,12 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
if (dset->create_parms->efl.nused) {
if (H5O_efl_write(dset->ent.file,
&(dset->create_parms->efl),
- &addr, size, buf)<0) {
+ addr, size, buf)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to write fill value to dataset");
}
} else {
- if (H5F_block_write(dset->ent.file, &addr, size,
+ if (H5F_block_write(dset->ent.file, addr, size,
&H5F_xfer_dflt, buf)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to write fill value to dataset");
@@ -2578,7 +2578,7 @@ H5D_get_storage_size(H5D_t *dset)
if (H5D_CHUNKED==dset->layout.type) {
size = H5F_istore_allocated(dset->ent.file, dset->layout.ndims,
- &(dset->layout.addr));
+ dset->layout.addr);
} else {
for (i=0, size=1; i<dset->layout.ndims; i++) {
size *= dset->layout.dim[i];
@@ -2719,7 +2719,8 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf)
}
/* Call H5Diterate with args, etc. */
- ret_value=H5Diterate(buf,type_id,space_id,H5T_vlen_reclaim,(void *)xfer_parms);
+ ret_value=H5Diterate(buf,type_id,space_id,H5T_vlen_reclaim,
+ (void*)xfer_parms);
FUNC_LEAVE(ret_value);
} /* end H5Dvlen_reclaim() */
@@ -2759,10 +2760,10 @@ H5Ddebug(hid_t dset_id, unsigned UNUSED flags)
/* Print B-tree information */
if (H5D_CHUNKED==dset->layout.type) {
H5F_istore_dump_btree(dset->ent.file, stdout, dset->layout.ndims,
- &(dset->layout.addr));
+ dset->layout.addr);
} else if (H5D_CONTIGUOUS==dset->layout.type) {
HDfprintf(stdout, " %-10s %a\n", "Address:",
- &(dset->layout.addr));
+ dset->layout.addr);
}
FUNC_LEAVE(SUCCEED);
diff --git a/src/H5Distore.c b/src/H5Distore.c
index 5e60943..e8bc974 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -95,31 +95,31 @@ typedef struct H5F_rdcc_ent_t {
/* Private prototypes */
static size_t H5F_istore_sizeof_rkey(H5F_t *f, const void *_udata);
static herr_t H5F_istore_new_node(H5F_t *f, H5B_ins_t, void *_lt_key,
- void *_udata, void *_rt_key, haddr_t *);
+ void *_udata, void *_rt_key,
+ haddr_t*/*out*/);
static intn 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);
-static herr_t H5F_istore_found(H5F_t *f, const haddr_t *addr,
- const void *_lt_key, void *_udata,
- const void *_rt_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,
+static herr_t H5F_istore_found(H5F_t *f, haddr_t addr, const void *_lt_key,
+ void *_udata, const void *_rt_key);
+static H5B_ins_t H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key,
+ hbool_t *lt_key_changed, void *_md_key,
+ void *_udata, void *_rt_key,
+ hbool_t *rt_key_changed,
haddr_t *new_node/*out*/);
-static herr_t H5F_istore_iterate (H5F_t *f, void *left_key,
- const haddr_t *addr, void *right_key,
- void *_udata);
+static herr_t H5F_istore_iterate(H5F_t *f, void *left_key, haddr_t addr,
+ void *right_key, void *_udata);
static herr_t H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
void *_key);
static herr_t H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
void *_key);
-static herr_t H5F_istore_debug_key (FILE *stream, intn indent, intn fwidth,
- const void *key, const void *udata);
+static herr_t H5F_istore_debug_key(FILE *stream, intn indent, intn fwidth,
+ const void *key, const void *udata);
#ifdef HAVE_PARALLEL
-static herr_t H5F_istore_get_addr (H5F_t *f, const H5O_layout_t *layout,
- const hssize_t offset[], void *_udata/*out*/);
+static herr_t H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout,
+ const hssize_t offset[],
+ void *_udata/*out*/);
#endif
/*
@@ -463,7 +463,7 @@ H5F_istore_cmp3(H5F_t UNUSED *f, void *_lt_key, void *_udata,
static herr_t
H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
void *_lt_key, void *_udata, void *_rt_key,
- haddr_t *addr/*out*/)
+ haddr_t *addr_p/*out*/)
{
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
H5F_istore_key_t *rt_key = (H5F_istore_key_t *) _rt_key;
@@ -480,18 +480,18 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
assert(rt_key);
assert(udata);
assert(udata->mesg.ndims > 0 && udata->mesg.ndims < H5O_LAYOUT_NDIMS);
- assert(addr);
+ assert(addr_p);
/* Allocate new storage */
assert (udata->key.nbytes > 0);
#ifdef AKC
printf("calling H5MF_alloc for new chunk\n");
#endif
- if (H5MF_alloc(f, H5MF_RAW, udata->key.nbytes, addr /*out */ ) < 0) {
+ if (H5MF_alloc(f, H5MF_RAW, udata->key.nbytes, addr_p/*out*/) < 0) {
HRETURN_ERROR(H5E_IO, H5E_CANTINIT, FAIL,
"couldn't allocate new file storage");
}
- udata->addr = *addr;
+ udata->addr = *addr_p;
/*
* The left key describes the storage of the UDATA chunk being
@@ -546,13 +546,13 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
* Thursday, October 9, 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_found(H5F_t UNUSED *f, const haddr_t *addr,
- const void *_lt_key, void *_udata,
- const void UNUSED *_rt_key)
+H5F_istore_found(H5F_t UNUSED *f, 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;
@@ -562,7 +562,7 @@ H5F_istore_found(H5F_t UNUSED *f, const haddr_t *addr,
/* Check arguments */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(udata);
assert(lt_key);
@@ -575,7 +575,7 @@ H5F_istore_found(H5F_t UNUSED *f, const haddr_t *addr,
}
/* Initialize return values */
- udata->addr = *addr;
+ udata->addr = addr;
udata->key.nbytes = lt_key->nbytes;
udata->key.filter_mask = lt_key->filter_mask;
assert (lt_key->nbytes>0);
@@ -614,15 +614,17 @@ H5F_istore_found(H5F_t UNUSED *f, const haddr_t *addr,
* Thursday, October 9, 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value. The NEW_NODE argument
+ * is renamed NEW_NODE_P.
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
+H5F_istore_insert(H5F_t *f, 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*/)
+ haddr_t *new_node_p/*out*/)
{
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
H5F_istore_key_t *md_key = (H5F_istore_key_t *) _md_key;
@@ -638,14 +640,14 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
/* check args */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(lt_key);
assert(lt_key_changed);
assert(md_key);
assert(udata);
assert(rt_key);
assert(rt_key_changed);
- assert(new_node);
+ assert(new_node_p);
cmp = H5F_istore_cmp3(f, lt_key, udata, rt_key);
assert(cmp <= 0);
@@ -668,17 +670,17 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
printf("calling H5MF_realloc for new chunk\n");
#endif
if (H5MF_realloc (f, H5MF_RAW, lt_key->nbytes, addr,
- udata->key.nbytes, new_node/*out*/)<0) {
+ udata->key.nbytes, new_node_p/*out*/)<0) {
HRETURN_ERROR (H5E_STORAGE, H5E_WRITEERROR, H5B_INS_ERROR,
"unable to reallocate chunk storage");
}
lt_key->nbytes = udata->key.nbytes;
lt_key->filter_mask = udata->key.filter_mask;
*lt_key_changed = TRUE;
- udata->addr = *new_node;
+ udata->addr = *new_node_p;
ret_value = H5B_INS_CHANGE;
} else {
- udata->addr = *addr;
+ udata->addr = addr;
ret_value = H5B_INS_NOOP;
}
@@ -705,11 +707,11 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
#ifdef AKC
printf("calling H5MF_alloc for new chunk\n");
#endif
- if (H5MF_alloc(f, H5MF_RAW, udata->key.nbytes, new_node/*out*/)<0) {
+ if (H5MF_alloc(f, H5MF_RAW, udata->key.nbytes, new_node_p/*out*/)<0) {
HRETURN_ERROR(H5E_IO, H5E_CANTINIT, H5B_INS_ERROR,
"file allocation failed");
}
- udata->addr = *new_node;
+ udata->addr = *new_node_p;
ret_value = H5B_INS_RIGHT;
} else {
@@ -737,12 +739,12 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
* Wednesday, April 21, 1999
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_iterate (H5F_t UNUSED *f, void *_lt_key,
- const haddr_t UNUSED *addr,
+H5F_istore_iterate (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr,
void UNUSED *_rt_key, void *_udata)
{
H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata;
@@ -889,12 +891,12 @@ H5F_istore_flush_entry (H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset)
* Create the chunk it if it doesn't exist, or reallocate the chunk if
* its size changed. Then write the data into the file.
*/
- if (H5B_insert(f, H5B_ISTORE, &(ent->layout->addr), ent->split_ratios,
+ if (H5B_insert(f, H5B_ISTORE, ent->layout->addr, ent->split_ratios,
&udata)<0) {
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
"unable to allocate chunk");
}
- if (H5F_block_write (f, &(udata.addr), udata.key.nbytes,
+ if (H5F_block_write (f, udata.addr, udata.key.nbytes,
&H5F_xfer_dflt, buf)<0) {
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
"unable to write raw data to file");
@@ -1238,7 +1240,7 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
if (rdcc->nslots>0) {
/* We don't care about loss of precision in the following statement. */
- idx = (uintn)(layout->addr.offset);
+ idx = (uintn)(layout->addr);
H5F_MIXUP(idx);
for (i=0; i<layout->ndims; i++) {
idx += offset[i];
@@ -1249,7 +1251,7 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
if (ent &&
layout->ndims==ent->layout->ndims &&
- H5F_addr_eq(&(layout->addr), &(ent->layout->addr))) {
+ H5F_addr_eq(layout->addr, ent->layout->addr)) {
for (i=0, found=TRUE; i<ent->layout->ndims; i++) {
if (offset[i]!=ent->offset[i]) {
found = FALSE;
@@ -1298,17 +1300,17 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
chunk_alloc = chunk_size;
udata.mesg = *layout;
H5F_addr_undef (&(udata.addr));
- status = H5B_find (f, H5B_ISTORE, &(layout->addr), &udata);
+ status = H5B_find (f, H5B_ISTORE, layout->addr, &udata);
H5E_clear ();
if (NULL==(chunk = H5MM_malloc (chunk_alloc))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed for raw data chunk");
}
- if (status>=0 && H5F_addr_defined (&(udata.addr))) {
+ if (status>=0 && H5F_addr_defined(udata.addr)) {
/*
* The chunk exists on disk.
*/
- if (H5F_block_read (f, &(udata.addr), udata.key.nbytes,
+ if (H5F_block_read(f, udata.addr, udata.key.nbytes,
&H5F_xfer_dflt, chunk)<0) {
HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL,
"unable to read raw data chunk");
@@ -1356,11 +1358,11 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
#endif
#if 0
HDfprintf(stderr, "\ncollision %3d %10a {",
- idx, &(ent->layout->addr));
+ idx, ent->layout->addr);
for (i=0; i<layout->ndims; i++) {
HDfprintf(stderr, "%s%Zu", i?",":"", ent->offset[i]);
}
- HDfprintf(stderr, "}\n %10a {", &(layout->addr));
+ HDfprintf(stderr, "}\n %10a {", layout->addr);
for (i=0; i<layout->ndims; i++) {
HDfprintf(stderr, "%s%Zu", i?",":"", offset[i]);
}
@@ -1593,7 +1595,7 @@ H5F_istore_read(H5F_t *f, const H5F_xfer_t *xfer, const H5O_layout_t *layout,
assert (f);
assert (layout && H5D_CHUNKED==layout->type);
assert (layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS);
- assert (H5F_addr_defined(&(layout->addr)));
+ assert (H5F_addr_defined(layout->addr));
assert (offset_f);
assert (size);
assert (buf);
@@ -1764,7 +1766,7 @@ H5F_istore_write(H5F_t *f, const H5F_xfer_t *xfer, const H5O_layout_t *layout,
assert(f);
assert(layout && H5D_CHUNKED==layout->type);
assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS);
- assert(H5F_addr_defined(&(layout->addr)));
+ assert(H5F_addr_defined(layout->addr));
assert(offset_f);
assert(size);
assert(buf);
@@ -1965,11 +1967,12 @@ H5F_istore_create(H5F_t *f, H5O_layout_t *layout /*out */ )
* Wednesday, April 21, 1999
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
hsize_t
-H5F_istore_allocated(H5F_t *f, int ndims, haddr_t *addr)
+H5F_istore_allocated(H5F_t *f, int ndims, haddr_t addr)
{
H5F_istore_ud1_t udata;
@@ -1998,11 +2001,12 @@ H5F_istore_allocated(H5F_t *f, int ndims, haddr_t *addr)
* Wednesday, April 28, 1999
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, haddr_t *addr)
+H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, haddr_t addr)
{
H5F_istore_ud1_t udata;
@@ -2090,11 +2094,12 @@ H5F_istore_stats (H5F_t *f, hbool_t headers)
* Thursday, April 16, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5F_istore_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
+H5F_istore_debug(H5F_t *f, haddr_t addr, FILE * stream, intn indent,
intn fwidth, int ndims)
{
H5F_istore_ud1_t udata;
@@ -2147,9 +2152,9 @@ H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout,
}
udata->mesg = *layout;
H5F_addr_undef (&(udata->addr));
- status = H5B_find (f, H5B_ISTORE, &(layout->addr), udata);
+ status = H5B_find (f, H5B_ISTORE, layout->addr, udata);
H5E_clear ();
- if (status>=0 && H5F_addr_defined (&(udata->addr)))
+ if (status>=0 && H5F_addr_defined(udata->addr))
HRETURN(SUCCEED);
FUNC_LEAVE (FAIL);
@@ -2211,7 +2216,7 @@ H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout,
assert(pline);
assert(layout && H5D_CHUNKED==layout->type);
assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS);
- assert(H5F_addr_defined(&(layout->addr)));
+ assert(H5F_addr_defined(layout->addr));
/*
* Setup indice to go through all chunks. (Future improvement
@@ -2281,7 +2286,7 @@ H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout,
} else {
#ifdef AKC
printf("NO need for allocation\n");
- printf("udata.addr.offset=%d\n", udata.addr.offset);
+ HDfprintf(stdout, "udata.addr=%a\n", udata.addr);
#endif
}
#endif
diff --git a/src/H5F.c b/src/H5F.c
index 3becbd0..631afe7 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -110,7 +110,7 @@ static herr_t H5F_dest(H5F_t *f);
static herr_t H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate);
static herr_t H5F_locate_signature(H5F_low_t *f_handle,
const H5F_access_t *access_parms,
- haddr_t *addr/*out*/);
+ haddr_t *addr_p/*out*/);
static intn H5F_flush_all_cb(H5F_t *f, const void *_invalidate);
@@ -216,7 +216,7 @@ H5F_init_interface(void)
H5F_access_dflt.u.mpio.info = MPI_INFO_NULL;
H5F_access_dflt.u.mpio.btype = MPI_DATATYPE_NULL;
H5F_access_dflt.u.mpio.ftype = MPI_DATATYPE_NULL;
- H5F_addr_reset( &(H5F_access_dflt.u.mpio.disp) );
+ H5F_addr_reset(&(H5F_access_dflt.u.mpio.disp));
H5F_access_dflt.u.mpio.use_types = 0;
H5F_access_dflt.u.mpio.old_use_types = 0;
#elif (H5F_LOW_DFLT == H5F_LOW_SPLIT)
@@ -544,7 +544,7 @@ H5F_compare_files(void * _obj, const void * _key)
*/
static herr_t
H5F_locate_signature(H5F_low_t *f_handle, const H5F_access_t *access_parms,
- haddr_t *addr/*out*/)
+ haddr_t *addr_p/*out*/)
{
herr_t ret_value=FAIL;
haddr_t max_addr;
@@ -554,9 +554,9 @@ H5F_locate_signature(H5F_low_t *f_handle, const H5F_access_t *access_parms,
FUNC_ENTER(H5F_locate_signature, FAIL);
H5F_low_size(f_handle, &max_addr);
- H5F_addr_reset(addr);
- while (H5F_addr_lt(addr, &max_addr)) {
- if (H5F_low_read(f_handle, access_parms, &H5F_xfer_dflt, addr,
+ H5F_addr_reset(addr_p);
+ while (H5F_addr_lt(*addr_p, max_addr)) {
+ if (H5F_low_read(f_handle, access_parms, &H5F_xfer_dflt, *addr_p,
H5F_SIGNATURE_LEN, buf) < 0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read file");
}
@@ -564,7 +564,7 @@ H5F_locate_signature(H5F_low_t *f_handle, const H5F_access_t *access_parms,
ret_value=SUCCEED;
break;
}
- H5F_addr_pow2(n++, addr);
+ H5F_addr_pow2(n++, addr_p);
}
FUNC_LEAVE(ret_value);
@@ -619,7 +619,7 @@ H5Fis_hdf5(const char *filename)
HGOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL,
"low-level file open failure");
}
- if (H5F_locate_signature(f_handle, &H5F_access_dflt, &addr) >= 0) {
+ if (H5F_locate_signature(f_handle, &H5F_access_dflt, &addr/*out*/)>=0) {
ret_value = TRUE;
}
@@ -1106,12 +1106,12 @@ H5F_open(const char *name, uintn flags,
/* For existing files we must read the boot block. */
if (H5F_locate_signature(f->shared->lf,
f->shared->access_parms,
- &(f->shared->boot_addr)) < 0) {
+ &(f->shared->boot_addr)/*out*/) < 0) {
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, NULL,
"unable to find signature");
}
if (H5F_low_read(f->shared->lf, access_parms, &H5F_xfer_dflt,
- &(f->shared->boot_addr), fixed_size, buf) < 0) {
+ f->shared->boot_addr, fixed_size, buf) < 0) {
HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL,
"unable to read boot block");
}
@@ -1190,22 +1190,22 @@ 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, (hsize_t)fixed_size);
+ H5F_addr_inc(&addr1/*in,out*/, (hsize_t)fixed_size);
if (H5F_low_read(f->shared->lf, access_parms, &H5F_xfer_dflt,
- &addr1, variable_size, buf) < 0) {
+ addr1, variable_size, buf) < 0) {
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, NULL,
"unable to read boot block");
}
p = buf;
- H5F_addr_decode(f, &p, &(f->shared->base_addr));
- H5F_addr_decode(f, &p, &(f->shared->freespace_addr));
- H5F_addr_decode(f, &p, &(f->shared->hdf5_eof));
- H5F_addr_decode(f, &p, &reserved_addr);
- if (H5G_ent_decode(f, &p, &root_ent) < 0) {
+ H5F_addr_decode(f, &p, &(f->shared->base_addr)/*out*/);
+ H5F_addr_decode(f, &p, &(f->shared->freespace_addr)/*out*/);
+ H5F_addr_decode(f, &p, &(f->shared->hdf5_eof)/*out*/);
+ H5F_addr_decode(f, &p, &reserved_addr/*out*/);
+ if (H5G_ent_decode(f, &p, &root_ent/*out*/) < 0) {
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL,
"unable to read root symbol entry");
}
- if (H5G_mkroot (f, &root_ent)<0) {
+ if (H5G_mkroot(f, &root_ent)<0) {
HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL,
"unable to read root group");
}
@@ -1214,24 +1214,24 @@ H5F_open(const char *name, uintn flags,
* The userdefined data is the area of the file before the base
* address.
*/
- f->shared->create_parms->userblock_size = f->shared->base_addr.offset;
+ f->shared->create_parms->userblock_size = f->shared->base_addr;
}
/*
* What is the current size of the file? The max_addr field is a relative
* address while H5F_low_size() returns an absolute address.
*/
- H5F_low_size(f->shared->lf, &addr1);
+ H5F_low_size(f->shared->lf, &addr1/*out*/);
addr2 = f->shared->hdf5_eof;
- H5F_addr_add(&addr2, &(f->shared->base_addr));
- if (H5F_addr_lt(&addr1, &addr2)) {
+ H5F_addr_add(&addr2/*in,out*/, f->shared->base_addr);
+ if (H5F_addr_lt(addr1, addr2)) {
/*
* Truncated file? This might happen if one tries to open the first
* member of a file family.
*/
HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, NULL, "truncated file");
- } else if (H5F_addr_gt(&addr1, &addr2)) {
+ } else if (H5F_addr_gt(addr1, addr2)) {
/*
* The file is larger than the hdf5 data. It either has extra junk at
* the end, or a wrapper. In either case, make the file think it's
@@ -1243,10 +1243,10 @@ H5F_open(const char *name, uintn flags,
#ifdef H5F_DEBUG
if (H5DEBUG(F)) {
HDfprintf(H5DEBUG(F), "H5F: resetting EOF from %a to %a (abs)\n",
- &addr1, &addr2);
+ addr1, addr2);
}
#endif
- H5F_low_seteof(f->shared->lf, &addr2);
+ H5F_low_seteof(f->shared->lf, addr2);
}
/* Create and/or open the root group if we haven't already done so */
@@ -1648,7 +1648,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate)
}
/* flush (and invalidate) the entire meta data cache */
- if (H5AC_flush(f, NULL, 0, invalidate) < 0) {
+ if (H5AC_flush(f, NULL, H5F_ADDR_UNDEF, invalidate) < 0) {
HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
"unable to flush meta data cache");
}
@@ -1670,15 +1670,15 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate)
UINT16ENCODE(p, f->shared->create_parms->sym_leaf_k);
UINT16ENCODE(p, f->shared->create_parms->btree_k[H5B_SNODE_ID]);
UINT32ENCODE(p, f->shared->consist_flags);
- H5F_addr_encode(f, &p, &(f->shared->base_addr));
- H5F_addr_encode(f, &p, &(f->shared->freespace_addr));
- H5F_addr_encode(f, &p, &(f->shared->hdf5_eof));
+ H5F_addr_encode(f, &p, f->shared->base_addr);
+ H5F_addr_encode(f, &p, f->shared->freespace_addr);
+ H5F_addr_encode(f, &p, f->shared->hdf5_eof);
H5F_addr_undef(&reserved_addr);
- H5F_addr_encode(f, &p, &reserved_addr);
+ H5F_addr_encode(f, &p, reserved_addr);
H5G_ent_encode(f, &p, H5G_entof(f->shared->root_grp));
/* update file length if necessary */
- if (!H5F_addr_defined(&(f->shared->hdf5_eof))) {
+ if (!H5F_addr_defined(f->shared->hdf5_eof)) {
haddr_t t_addr; /*temporary address */
/* Set the HDF5 file size */
@@ -1687,8 +1687,8 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate)
/* Set the logical file size, including the userblock data */
t_addr = f->shared->hdf5_eof;
- H5F_addr_add(&t_addr, &(f->shared->base_addr));
- H5F_low_seteof(f->shared->lf, &t_addr);
+ H5F_addr_add(&t_addr/*in,out*/, f->shared->base_addr);
+ H5F_low_seteof(f->shared->lf, t_addr);
/* Indicate that the boot block needs to be flushed out */
firsttime_bootblock=1;
@@ -1699,9 +1699,11 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate)
#ifdef HAVE_PARALLEL
H5F_mpio_tas_allsame(f->shared->lf, TRUE); /* only p0 will write */
#endif
- if (H5F_low_write(f->shared->lf, f->shared->access_parms, &H5F_xfer_dflt,
- &(f->shared->boot_addr), (size_t)(p-buf), buf)<0) {
- HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write header");
+ if (H5F_low_write(f->shared->lf, f->shared->access_parms,
+ &H5F_xfer_dflt, f->shared->boot_addr,
+ (size_t)(p-buf), buf)<0) {
+ HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
+ "unable to write header");
}
/* Flush file buffers to disk */
@@ -1974,7 +1976,7 @@ H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child,
while (lt<rt && cmp) {
md = (lt+rt)/2;
ent = H5G_entof(parent->mtab.child[md].group);
- cmp = H5F_addr_cmp(&(mp_ent->header), &(ent->header));
+ cmp = H5F_addr_cmp(mp_ent->header, ent->header);
if (cmp<0) {
rt = md;
} else if (cmp>0) {
@@ -2071,7 +2073,7 @@ H5F_unmount(H5G_entry_t *loc, const char *name)
ent = H5G_entof(child->shared->root_grp);
if (child->mtab.parent &&
- H5F_addr_eq(&(mnt_ent->header), &(ent->header))) {
+ H5F_addr_eq(mnt_ent->header, ent->header)) {
/*
* We've been given the root group of the child. We do a reverse
* lookup in the parent's mount table to find the correct entry.
@@ -2105,7 +2107,7 @@ H5F_unmount(H5G_entry_t *loc, const char *name)
while (lt<rt && cmp) {
md = (lt+rt)/2;
ent = H5G_entof(parent->mtab.child[md].group);
- cmp = H5F_addr_cmp(&(mnt_ent->header), &(ent->header));
+ cmp = H5F_addr_cmp(mnt_ent->header, ent->header);
if (cmp<0) {
rt = md;
} else {
@@ -2173,7 +2175,7 @@ H5F_mountpoint(H5G_entry_t *find/*in,out*/)
while (lt<rt && cmp) {
md = (lt+rt)/2;
ent = H5G_entof(parent->mtab.child[md].group);
- cmp = H5F_addr_cmp(&(find->header), &(ent->header));
+ cmp = H5F_addr_cmp(find->header, ent->header);
if (cmp<0) {
rt = md;
} else {
@@ -2362,13 +2364,15 @@ H5Freopen(hid_t file_id)
* Jul 10 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size,
+H5F_block_read(H5F_t *f, haddr_t addr, hsize_t size,
const H5F_xfer_t *xfer_parms, void *buf)
{
haddr_t abs_addr;
@@ -2379,11 +2383,11 @@ H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size,
/* convert the relative address to an absolute address */
abs_addr = f->shared->base_addr;
- H5F_addr_add(&abs_addr, addr);
+ H5F_addr_add(&abs_addr/*in,out*/, addr);
/* Read the data */
if (H5F_low_read(f->shared->lf, f->shared->access_parms, xfer_parms,
- &abs_addr, (size_t)size, buf) < 0) {
+ abs_addr, (size_t)size, buf) < 0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "low-level read failed");
}
FUNC_LEAVE(SUCCEED);
@@ -2407,13 +2411,15 @@ H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size,
* Jul 10 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5F_block_write(H5F_t *f, const haddr_t *addr, hsize_t size,
+H5F_block_write(H5F_t *f, haddr_t addr, hsize_t size,
const H5F_xfer_t *xfer_parms, const void *buf)
{
haddr_t abs_addr;
@@ -2428,11 +2434,11 @@ H5F_block_write(H5F_t *f, const haddr_t *addr, hsize_t size,
/* Convert the relative address to an absolute address */
abs_addr = f->shared->base_addr;
- H5F_addr_add(&abs_addr, addr);
+ H5F_addr_add(&abs_addr/*in,out*/, addr);
/* Write the data */
if (H5F_low_write(f->shared->lf, f->shared->access_parms, xfer_parms,
- &abs_addr, (size_t)size, buf)) {
+ abs_addr, (size_t)size, buf)) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low-level write failed");
}
@@ -2455,92 +2461,85 @@ H5F_block_write(H5F_t *f, const haddr_t *addr, hsize_t size,
* Aug 1 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5F_debug(H5F_t *f, const haddr_t UNUSED *addr, FILE * stream,
- intn indent, intn fwidth)
+H5F_debug(H5F_t *f, haddr_t UNUSED addr, FILE * stream, intn indent,
+ intn fwidth)
{
FUNC_ENTER(H5F_debug, FAIL);
/* check args */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(stream);
assert(indent >= 0);
assert(fwidth >= 0);
/* debug */
- fprintf(stream, "%*sFile Boot Block...\n", indent, "");
-
- fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "File name:",
- f->name);
- fprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth,
- "Flags",
- (unsigned) (f->shared->flags));
- fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Reference count:",
- (unsigned) (f->shared->nrefs));
- fprintf(stream, "%*s%-*s 0x%08lx\n", indent, "", fwidth,
- "Consistency flags:",
- (unsigned long) (f->shared->consist_flags));
-
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Address of boot block:");
- H5F_addr_print(stream, &(f->shared->boot_addr));
- fprintf(stream, " (abs)\n");
-
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Base address:");
- H5F_addr_print(stream, &(f->shared->base_addr));
- fprintf(stream, " (abs)\n");
-
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Free list address:");
- H5F_addr_print(stream, &(f->shared->freespace_addr));
- fprintf(stream, " (rel)\n");
-
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Total size of hdf5 data:");
- H5F_addr_print(stream, &(f->shared->hdf5_eof));
- fprintf(stream, " bytes\n");
-
- fprintf(stream, "%*s%-*s %lu bytes\n", indent, "", fwidth,
- "Size of user block:",
- (unsigned long) (f->shared->create_parms->userblock_size));
- fprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth,
- "Size of file size_t type:",
- (unsigned) (f->shared->create_parms->sizeof_size));
- fprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth,
- "Size of file haddr_t type:",
- (unsigned) (f->shared->create_parms->sizeof_addr));
- fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Symbol table leaf node 1/2 rank:",
- (unsigned) (f->shared->create_parms->sym_leaf_k));
- fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Symbol table internal node 1/2 rank:",
- (unsigned) (f->shared->create_parms->btree_k[H5B_SNODE_ID]));
- fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Boot block version number:",
- (unsigned) (f->shared->create_parms->bootblock_ver));
- fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Free list version number:",
- (unsigned) (f->shared->create_parms->freespace_ver));
- fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Object directory version number:",
- (unsigned) (f->shared->create_parms->objectdir_ver));
- fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Shared header version number:",
- (unsigned) (f->shared->create_parms->sharedheader_ver));
-
- fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Root group symbol table entry:",
- f->shared->root_grp ? "" : "(none)");
+ HDfprintf(stream, "%*sFile Boot Block...\n", indent, "");
+
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "File name:",
+ f->name);
+ HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth,
+ "Flags",
+ (unsigned) (f->shared->flags));
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Reference count:",
+ (unsigned) (f->shared->nrefs));
+ HDfprintf(stream, "%*s%-*s 0x%08lx\n", indent, "", fwidth,
+ "Consistency flags:",
+ (unsigned long) (f->shared->consist_flags));
+
+ HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth,
+ "Address of boot block:", f->shared->boot_addr);
+
+ HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth,
+ "Base address:", f->shared->base_addr);
+
+ HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
+ "Free list address:", f->shared->freespace_addr);
+
+ HDfprintf(stream, "%*s%-*s %a bytes\n", indent, "", fwidth,
+ "Total size of hdf5 data:", f->shared->hdf5_eof);
+
+ HDfprintf(stream, "%*s%-*s %lu bytes\n", indent, "", fwidth,
+ "Size of user block:",
+ (unsigned long) (f->shared->create_parms->userblock_size));
+ HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth,
+ "Size of file size_t type:",
+ (unsigned) (f->shared->create_parms->sizeof_size));
+ HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth,
+ "Size of file haddr_t type:",
+ (unsigned) (f->shared->create_parms->sizeof_addr));
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Symbol table leaf node 1/2 rank:",
+ (unsigned) (f->shared->create_parms->sym_leaf_k));
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Symbol table internal node 1/2 rank:",
+ (unsigned) (f->shared->create_parms->btree_k[H5B_SNODE_ID]));
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Boot block version number:",
+ (unsigned) (f->shared->create_parms->bootblock_ver));
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Free list version number:",
+ (unsigned) (f->shared->create_parms->freespace_ver));
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Object directory version number:",
+ (unsigned) (f->shared->create_parms->objectdir_ver));
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Shared header version number:",
+ (unsigned) (f->shared->create_parms->sharedheader_ver));
+
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Root group symbol table entry:",
+ f->shared->root_grp ? "" : "(none)");
if (f->shared->root_grp) {
- H5G_ent_debug(f, H5G_entof (f->shared->root_grp), stream,
- indent+3, MAX(0, fwidth-3), NULL);
+ H5G_ent_debug(f, H5G_entof(f->shared->root_grp), stream,
+ indent+3, MAX(0, fwidth-3), H5F_ADDR_UNDEF);
}
FUNC_LEAVE(SUCCEED);
}
diff --git a/src/H5Farray.c b/src/H5Farray.c
index 00446b6..b2c9551 100644
--- a/src/H5Farray.c
+++ b/src/H5Farray.c
@@ -51,7 +51,7 @@ H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/)
/* check args */
assert (f);
assert (layout);
- H5F_addr_undef (&(layout->addr)); /*just in case we fail*/
+ H5F_addr_undef(&(layout->addr)); /*just in case we fail*/
switch (layout->type) {
case H5D_CONTIGUOUS:
@@ -250,11 +250,11 @@ H5F_arr_read (H5F_t *f, const H5F_xfer_t *xfer,
/* Read from file */
if (efl && efl->nused>0) {
- if (H5O_efl_read (f, efl, &addr, elmt_size, buf)<0) {
+ if (H5O_efl_read (f, efl, addr, elmt_size, buf)<0) {
HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL,
"external data read failed");
}
- } else if (H5F_block_read (f, &addr, elmt_size, xfer, buf)<0) {
+ } else if (H5F_block_read (f, addr, elmt_size, xfer, buf)<0) {
HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL,
"block read failed");
}
@@ -262,7 +262,7 @@ H5F_arr_read (H5F_t *f, const H5F_xfer_t *xfer,
/* Decrement indices and advance pointers */
for (j=ndims-1, carray=TRUE; j>=0 && carray; --j) {
- H5F_addr_adj (&addr, file_stride[j]);
+ H5F_addr_adj(&addr, file_stride[j]);
buf += mem_stride[j];
if (--idx[j]) carray = FALSE;
@@ -477,11 +477,11 @@ H5F_arr_write (H5F_t *f, const H5F_xfer_t *xfer,
/* Write to file */
if (efl && efl->nused>0) {
- if (H5O_efl_write (f, efl, &addr, elmt_size, buf)<0) {
+ if (H5O_efl_write (f, efl, addr, elmt_size, buf)<0) {
HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL,
"external data write failed");
}
- } else if (H5F_block_write(f, &addr, elmt_size, xfer, buf)<0) {
+ } else if (H5F_block_write(f, addr, elmt_size, xfer, buf)<0) {
HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
"block write failed");
}
diff --git a/src/H5Fcore.c b/src/H5Fcore.c
index 85378b2..021490c 100644
--- a/src/H5Fcore.c
+++ b/src/H5Fcore.c
@@ -33,10 +33,10 @@ static H5F_low_t *H5F_core_open(const char *name,
H5F_search_t *key/*out*/);
static herr_t 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,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, uint8_t *buf);
static herr_t H5F_core_write(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, const uint8_t *buf);
const H5F_low_class_t H5F_LOW_CORE_g[1] = {{
@@ -176,14 +176,16 @@ H5F_core_close(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms)
* Wednesday, October 22, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_core_read(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
- const H5F_xfer_t UNUSED *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t UNUSED *xfer_parms, haddr_t addr,
size_t size, uint8_t *buf)
{
size_t n;
@@ -192,16 +194,16 @@ H5F_core_read(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
FUNC_ENTER(H5F_core_read, FAIL);
assert(lf);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(buf);
- eof = MIN(lf->eof.offset, lf->u.core.size);
+ eof = MIN(lf->eof, lf->u.core.size);
- if (addr->offset >= eof) {
+ if (addr >= eof) {
HDmemset(buf, 0, size);
} else {
- n = MIN(size, eof-addr->offset);
- HDmemcpy(buf, lf->u.core.mem + addr->offset, n);
+ n = MIN(size, eof-addr);
+ HDmemcpy(buf, lf->u.core.mem + addr, n);
HDmemset(buf+n, 0, size-n);
}
@@ -224,14 +226,16 @@ H5F_core_read(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
* Wednesday, October 22, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_core_write(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t UNUSED *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t UNUSED *xfer_parms, haddr_t addr,
size_t size, const uint8_t *buf)
{
size_t need_more, na;
@@ -241,7 +245,7 @@ H5F_core_write(H5F_low_t *lf, const H5F_access_t *access_parms,
FUNC_ENTER(H5F_core_write, FAIL);
assert(lf);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(buf);
assert (!access_parms || H5F_LOW_CORE==access_parms->driver);
@@ -250,9 +254,9 @@ H5F_core_write(H5F_low_t *lf, const H5F_access_t *access_parms,
* size, which is either defined in the file access property list or
* which defaults to one.
*/
- if (addr->offset + size > lf->u.core.alloc) {
+ if (addr + size > lf->u.core.alloc) {
if (access_parms) increment = access_parms->u.core.increment;
- need_more = addr->offset+size - lf->u.core.alloc;
+ need_more = addr+size - lf->u.core.alloc;
need_more = increment*((need_more+increment-1)/increment);
na = lf->u.core.alloc + need_more;
@@ -265,12 +269,12 @@ H5F_core_write(H5F_low_t *lf, const H5F_access_t *access_parms,
}
/* Move the physical EOF marker */
- if (addr->offset + size > lf->u.core.size) {
- lf->u.core.size = addr->offset + size;
+ if (addr + size > lf->u.core.size) {
+ lf->u.core.size = addr + size;
}
/* Copy data */
- HDmemcpy(lf->u.core.mem+addr->offset, buf, size);
+ HDmemcpy(lf->u.core.mem+addr, buf, size);
FUNC_LEAVE(SUCCEED);
}
diff --git a/src/H5Ffamily.c b/src/H5Ffamily.c
index f2fa689..d871e69 100644
--- a/src/H5Ffamily.c
+++ b/src/H5Ffamily.c
@@ -30,10 +30,8 @@
static intn interface_initialize_g = 0;
#define INTERFACE_INIT NULL
-#define H5F_FAM_OFFSET(LF,ADDR) ((off_t)((ADDR)->offset % \
- (LF)->u.fam.memb_size.offset))
-#define H5F_FAM_MEMBNO(LF,ADDR) ((intn)((ADDR)->offset / \
- (LF)->u.fam.memb_size.offset))
+#define H5F_FAM_OFFSET(LF,ADDR) ((off_t)((ADDR) % (LF)->u.fam.memb_size))
+#define H5F_FAM_MEMBNO(LF,ADDR) ((intn)((ADDR) / (LF)->u.fam.memb_size))
static htri_t H5F_fam_access(const char *name,
const H5F_access_t *access_parms, int mode,
@@ -43,10 +41,10 @@ static H5F_low_t *H5F_fam_open(const char *name,
H5F_search_t *key/*out*/);
static herr_t H5F_fam_close(H5F_low_t *lf, const H5F_access_t *access_parms);
static herr_t H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, uint8_t *buf);
static herr_t H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, const uint8_t *buf);
static herr_t H5F_fam_flush(H5F_low_t *lf, const H5F_access_t *access_parms);
@@ -167,9 +165,9 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
member = NULL;
}
- H5F_low_size (lf->u.fam.memb[0], &tmp_addr);
+ H5F_low_size (lf->u.fam.memb[0], &tmp_addr/*out*/);
if (1==lf->u.fam.nmemb &&
- H5F_addr_gt (&tmp_addr, &(access_parms->u.fam.memb_size))) {
+ H5F_addr_gt (tmp_addr, access_parms->u.fam.memb_size)) {
/*
* If there's only one member and the member is larger than the
* specified member size, then adjust the specified member size to be
@@ -179,10 +177,10 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
if (H5DEBUG(F)) {
HDfprintf (H5DEBUG(F), "H5F: family member size has been "
"increased from %a to %a\n",
- &(access_parms->u.fam.memb_size), &tmp_addr);
+ access_parms->u.fam.memb_size, tmp_addr);
}
#endif
- if (tmp_addr.offset<1024) tmp_addr.offset = 1024;
+ if (tmp_addr<1024) tmp_addr = 1024;
lf->u.fam.memb_size = tmp_addr;
} else if (1==lf->u.fam.nmemb) {
@@ -193,7 +191,7 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
lf->u.fam.memb_size = access_parms->u.fam.memb_size;
} else if (lf->u.fam.nmemb>1 &&
- H5F_addr_ne (&tmp_addr, &(access_parms->u.fam.memb_size))) {
+ H5F_addr_ne(tmp_addr, access_parms->u.fam.memb_size)) {
/*
* If there are more than one member then use the size of the first
* member as the member size.
@@ -201,14 +199,13 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
#ifdef H5F_DEBUG
if (H5DEBUG(F)) {
HDfprintf (H5DEBUG(F), "H5F: family member size adjusted from "
- "%a to %a\n", &(access_parms->u.fam.memb_size),
- &tmp_addr);
+ "%a to %a\n", access_parms->u.fam.memb_size, tmp_addr);
}
#endif
lf->u.fam.memb_size = tmp_addr;
for (membno=1; membno<lf->u.fam.nmemb; membno++) {
- H5F_low_size (lf->u.fam.memb[membno], &tmp_addr);
- if (H5F_addr_gt (&tmp_addr, &(lf->u.fam.memb_size))) {
+ H5F_low_size(lf->u.fam.memb[membno], &tmp_addr/*out*/);
+ if (H5F_addr_gt(tmp_addr, lf->u.fam.memb_size)) {
HGOTO_ERROR (H5E_IO, H5E_CANTINIT, NULL, "family contains "
"member(s) larger than first member");
}
@@ -226,9 +223,9 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
* file on a 32-bit machine is 2^32-1.
*/
if (H5DEBUG(F) &&
- lf->u.fam.memb_size.offset == ((size_t)1<<(sizeof(off_t)-1))) {
+ lf->u.fam.memb_size == ((size_t)1<<(sizeof(off_t)-1))) {
HDfprintf(H5DEBUG(F), "H5F: family member size may be too large: %a\n",
- &(lf->u.fam.memb_size));
+ lf->u.fam.memb_size);
}
#endif
@@ -237,8 +234,8 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
*/
assert(lf->u.fam.nmemb >= 1);
lf->eof = lf->u.fam.memb_size;
- lf->eof.offset *= (lf->u.fam.nmemb-1);
- lf->eof.offset += lf->u.fam.memb[lf->u.fam.nmemb-1]->eof.offset;
+ lf->eof *= (lf->u.fam.nmemb-1);
+ lf->eof += lf->u.fam.memb[lf->u.fam.nmemb-1]->eof;
HRETURN(lf);
@@ -305,15 +302,17 @@ H5F_fam_close(H5F_low_t *lf, const H5F_access_t *access_parms)
* Monday, November 10, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
- size_t size, uint8_t *buf)
+ const H5F_xfer_t *xfer_parms, haddr_t addr, size_t size,
+ uint8_t *buf)
{
size_t nbytes;
haddr_t cur_addr;
@@ -323,25 +322,25 @@ H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms,
FUNC_ENTER(H5F_fam_read, FAIL);
assert(lf);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(buf);
member_size = lf->u.fam.memb_size;
membno = H5F_FAM_MEMBNO(lf, addr);
H5F_addr_reset (&offset);
- offset.offset = H5F_FAM_OFFSET(lf, addr);
- cur_addr = *addr;
+ offset = H5F_FAM_OFFSET(lf, addr);
+ cur_addr = addr;
while (size > 0) {
if (membno >= lf->u.fam.nmemb) {
HDmemset(buf, 0, size);
break;
} else {
- nbytes = MIN(size, member_size.offset-offset.offset);
+ nbytes = MIN(size, member_size-offset);
cur_addr = offset;
if (H5F_low_read(lf->u.fam.memb[membno],
access_parms->u.fam.memb_access, xfer_parms,
- &cur_addr, nbytes, buf) < 0) {
+ cur_addr, nbytes, buf) < 0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"can't read from family member");
}
@@ -370,15 +369,17 @@ H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms,
* Monday, November 10, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
- size_t size, const uint8_t *buf)
+ const H5F_xfer_t *xfer_parms, haddr_t addr, size_t size,
+ const uint8_t *buf)
{
size_t nbytes;
haddr_t cur_addr, max_addr;
@@ -393,7 +394,7 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms,
/* Check args */
assert(lf);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(buf);
assert (access_parms);
assert (H5F_LOW_FAMILY==access_parms->driver);
@@ -404,11 +405,11 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms,
member_size = lf->u.fam.memb_size;
membno = H5F_FAM_MEMBNO(lf, addr);
H5F_addr_reset (&offset);
- offset.offset = H5F_FAM_OFFSET(lf, addr);
- cur_addr = *addr;
+ offset = H5F_FAM_OFFSET(lf, addr);
+ cur_addr = addr;
while (size > 0) {
- nbytes = MIN(size, member_size.offset - offset.offset);
+ nbytes = MIN(size, member_size-offset);
cur_addr = offset;
if (membno >= lf->u.fam.nmemb) {
@@ -444,8 +445,8 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms,
*/
if (i < membno) {
H5F_addr_reset(&max_addr);
- H5F_addr_inc(&max_addr, member_size.offset);
- H5F_low_seteof(member, &max_addr);
+ H5F_addr_inc(&max_addr, member_size);
+ H5F_low_seteof(member, max_addr);
}
lf->u.fam.memb[lf->u.fam.nmemb++] = member;
}
@@ -457,14 +458,14 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms,
*/
max_addr = cur_addr;
H5F_addr_inc(&max_addr, (hsize_t)nbytes);
- if (H5F_addr_gt(&max_addr, &(lf->u.fam.memb[membno]->eof))) {
- H5F_low_seteof(lf->u.fam.memb[membno], &max_addr);
+ if (H5F_addr_gt(max_addr, lf->u.fam.memb[membno]->eof)) {
+ H5F_low_seteof(lf->u.fam.memb[membno], max_addr);
}
/* Write the data to the member */
if (H5F_low_write(lf->u.fam.memb[membno],
access_parms->u.fam.memb_access, xfer_parms,
- &cur_addr, nbytes, buf) < 0) {
+ cur_addr, nbytes, buf) < 0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"can't write to family member");
}
@@ -512,24 +513,24 @@ H5F_fam_flush(H5F_low_t *lf, const H5F_access_t *access_parms)
* byte from the member (which defaults to zero if we're reading past the
* end of the member) and then writing it back.
*/
- max_offset = lf->u.fam.memb_size.offset - 1;
+ max_offset = lf->u.fam.memb_size - 1;
H5F_addr_reset(&addr1);
H5F_addr_inc(&addr1, max_offset);
- H5F_low_size(lf->u.fam.memb[0], &addr2); /*remember logical eof */
+ H5F_low_size(lf->u.fam.memb[0], &addr2/*out*/);/*remember logical eof */
addr3 = addr1;
H5F_addr_inc(&addr3, (hsize_t)1);
- H5F_low_seteof(lf->u.fam.memb[0], &addr3); /*prevent a warning */
+ 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,
- &H5F_xfer_dflt, &addr1, 1, buf) < 0) {
+ &H5F_xfer_dflt, addr1, 1, buf) < 0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"can't read from first family member");
}
if (H5F_low_write(lf->u.fam.memb[0], access_parms->u.fam.memb_access,
- &H5F_xfer_dflt, &addr1, 1, buf) < 0) {
+ &H5F_xfer_dflt, addr1, 1, buf) < 0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"can't write to first family member");
}
- H5F_low_seteof(lf->u.fam.memb[0], &addr2); /*reset old eof */
+ H5F_low_seteof(lf->u.fam.memb[0], addr2); /*reset old eof */
/*
* Flush each member file. Don't return an error status until we've
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index 5e60943..e8bc974 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -95,31 +95,31 @@ typedef struct H5F_rdcc_ent_t {
/* Private prototypes */
static size_t H5F_istore_sizeof_rkey(H5F_t *f, const void *_udata);
static herr_t H5F_istore_new_node(H5F_t *f, H5B_ins_t, void *_lt_key,
- void *_udata, void *_rt_key, haddr_t *);
+ void *_udata, void *_rt_key,
+ haddr_t*/*out*/);
static intn 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);
-static herr_t H5F_istore_found(H5F_t *f, const haddr_t *addr,
- const void *_lt_key, void *_udata,
- const void *_rt_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,
+static herr_t H5F_istore_found(H5F_t *f, haddr_t addr, const void *_lt_key,
+ void *_udata, const void *_rt_key);
+static H5B_ins_t H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key,
+ hbool_t *lt_key_changed, void *_md_key,
+ void *_udata, void *_rt_key,
+ hbool_t *rt_key_changed,
haddr_t *new_node/*out*/);
-static herr_t H5F_istore_iterate (H5F_t *f, void *left_key,
- const haddr_t *addr, void *right_key,
- void *_udata);
+static herr_t H5F_istore_iterate(H5F_t *f, void *left_key, haddr_t addr,
+ void *right_key, void *_udata);
static herr_t H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
void *_key);
static herr_t H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
void *_key);
-static herr_t H5F_istore_debug_key (FILE *stream, intn indent, intn fwidth,
- const void *key, const void *udata);
+static herr_t H5F_istore_debug_key(FILE *stream, intn indent, intn fwidth,
+ const void *key, const void *udata);
#ifdef HAVE_PARALLEL
-static herr_t H5F_istore_get_addr (H5F_t *f, const H5O_layout_t *layout,
- const hssize_t offset[], void *_udata/*out*/);
+static herr_t H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout,
+ const hssize_t offset[],
+ void *_udata/*out*/);
#endif
/*
@@ -463,7 +463,7 @@ H5F_istore_cmp3(H5F_t UNUSED *f, void *_lt_key, void *_udata,
static herr_t
H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
void *_lt_key, void *_udata, void *_rt_key,
- haddr_t *addr/*out*/)
+ haddr_t *addr_p/*out*/)
{
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
H5F_istore_key_t *rt_key = (H5F_istore_key_t *) _rt_key;
@@ -480,18 +480,18 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
assert(rt_key);
assert(udata);
assert(udata->mesg.ndims > 0 && udata->mesg.ndims < H5O_LAYOUT_NDIMS);
- assert(addr);
+ assert(addr_p);
/* Allocate new storage */
assert (udata->key.nbytes > 0);
#ifdef AKC
printf("calling H5MF_alloc for new chunk\n");
#endif
- if (H5MF_alloc(f, H5MF_RAW, udata->key.nbytes, addr /*out */ ) < 0) {
+ if (H5MF_alloc(f, H5MF_RAW, udata->key.nbytes, addr_p/*out*/) < 0) {
HRETURN_ERROR(H5E_IO, H5E_CANTINIT, FAIL,
"couldn't allocate new file storage");
}
- udata->addr = *addr;
+ udata->addr = *addr_p;
/*
* The left key describes the storage of the UDATA chunk being
@@ -546,13 +546,13 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op,
* Thursday, October 9, 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_found(H5F_t UNUSED *f, const haddr_t *addr,
- const void *_lt_key, void *_udata,
- const void UNUSED *_rt_key)
+H5F_istore_found(H5F_t UNUSED *f, 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;
@@ -562,7 +562,7 @@ H5F_istore_found(H5F_t UNUSED *f, const haddr_t *addr,
/* Check arguments */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(udata);
assert(lt_key);
@@ -575,7 +575,7 @@ H5F_istore_found(H5F_t UNUSED *f, const haddr_t *addr,
}
/* Initialize return values */
- udata->addr = *addr;
+ udata->addr = addr;
udata->key.nbytes = lt_key->nbytes;
udata->key.filter_mask = lt_key->filter_mask;
assert (lt_key->nbytes>0);
@@ -614,15 +614,17 @@ H5F_istore_found(H5F_t UNUSED *f, const haddr_t *addr,
* Thursday, October 9, 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value. The NEW_NODE argument
+ * is renamed NEW_NODE_P.
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
+H5F_istore_insert(H5F_t *f, 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*/)
+ haddr_t *new_node_p/*out*/)
{
H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key;
H5F_istore_key_t *md_key = (H5F_istore_key_t *) _md_key;
@@ -638,14 +640,14 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
/* check args */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(lt_key);
assert(lt_key_changed);
assert(md_key);
assert(udata);
assert(rt_key);
assert(rt_key_changed);
- assert(new_node);
+ assert(new_node_p);
cmp = H5F_istore_cmp3(f, lt_key, udata, rt_key);
assert(cmp <= 0);
@@ -668,17 +670,17 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
printf("calling H5MF_realloc for new chunk\n");
#endif
if (H5MF_realloc (f, H5MF_RAW, lt_key->nbytes, addr,
- udata->key.nbytes, new_node/*out*/)<0) {
+ udata->key.nbytes, new_node_p/*out*/)<0) {
HRETURN_ERROR (H5E_STORAGE, H5E_WRITEERROR, H5B_INS_ERROR,
"unable to reallocate chunk storage");
}
lt_key->nbytes = udata->key.nbytes;
lt_key->filter_mask = udata->key.filter_mask;
*lt_key_changed = TRUE;
- udata->addr = *new_node;
+ udata->addr = *new_node_p;
ret_value = H5B_INS_CHANGE;
} else {
- udata->addr = *addr;
+ udata->addr = addr;
ret_value = H5B_INS_NOOP;
}
@@ -705,11 +707,11 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
#ifdef AKC
printf("calling H5MF_alloc for new chunk\n");
#endif
- if (H5MF_alloc(f, H5MF_RAW, udata->key.nbytes, new_node/*out*/)<0) {
+ if (H5MF_alloc(f, H5MF_RAW, udata->key.nbytes, new_node_p/*out*/)<0) {
HRETURN_ERROR(H5E_IO, H5E_CANTINIT, H5B_INS_ERROR,
"file allocation failed");
}
- udata->addr = *new_node;
+ udata->addr = *new_node_p;
ret_value = H5B_INS_RIGHT;
} else {
@@ -737,12 +739,12 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key,
* Wednesday, April 21, 1999
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_iterate (H5F_t UNUSED *f, void *_lt_key,
- const haddr_t UNUSED *addr,
+H5F_istore_iterate (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr,
void UNUSED *_rt_key, void *_udata)
{
H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata;
@@ -889,12 +891,12 @@ H5F_istore_flush_entry (H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset)
* Create the chunk it if it doesn't exist, or reallocate the chunk if
* its size changed. Then write the data into the file.
*/
- if (H5B_insert(f, H5B_ISTORE, &(ent->layout->addr), ent->split_ratios,
+ if (H5B_insert(f, H5B_ISTORE, ent->layout->addr, ent->split_ratios,
&udata)<0) {
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
"unable to allocate chunk");
}
- if (H5F_block_write (f, &(udata.addr), udata.key.nbytes,
+ if (H5F_block_write (f, udata.addr, udata.key.nbytes,
&H5F_xfer_dflt, buf)<0) {
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
"unable to write raw data to file");
@@ -1238,7 +1240,7 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
if (rdcc->nslots>0) {
/* We don't care about loss of precision in the following statement. */
- idx = (uintn)(layout->addr.offset);
+ idx = (uintn)(layout->addr);
H5F_MIXUP(idx);
for (i=0; i<layout->ndims; i++) {
idx += offset[i];
@@ -1249,7 +1251,7 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
if (ent &&
layout->ndims==ent->layout->ndims &&
- H5F_addr_eq(&(layout->addr), &(ent->layout->addr))) {
+ H5F_addr_eq(layout->addr, ent->layout->addr)) {
for (i=0, found=TRUE; i<ent->layout->ndims; i++) {
if (offset[i]!=ent->offset[i]) {
found = FALSE;
@@ -1298,17 +1300,17 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
chunk_alloc = chunk_size;
udata.mesg = *layout;
H5F_addr_undef (&(udata.addr));
- status = H5B_find (f, H5B_ISTORE, &(layout->addr), &udata);
+ status = H5B_find (f, H5B_ISTORE, layout->addr, &udata);
H5E_clear ();
if (NULL==(chunk = H5MM_malloc (chunk_alloc))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed for raw data chunk");
}
- if (status>=0 && H5F_addr_defined (&(udata.addr))) {
+ if (status>=0 && H5F_addr_defined(udata.addr)) {
/*
* The chunk exists on disk.
*/
- if (H5F_block_read (f, &(udata.addr), udata.key.nbytes,
+ if (H5F_block_read(f, udata.addr, udata.key.nbytes,
&H5F_xfer_dflt, chunk)<0) {
HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL,
"unable to read raw data chunk");
@@ -1356,11 +1358,11 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
#endif
#if 0
HDfprintf(stderr, "\ncollision %3d %10a {",
- idx, &(ent->layout->addr));
+ idx, ent->layout->addr);
for (i=0; i<layout->ndims; i++) {
HDfprintf(stderr, "%s%Zu", i?",":"", ent->offset[i]);
}
- HDfprintf(stderr, "}\n %10a {", &(layout->addr));
+ HDfprintf(stderr, "}\n %10a {", layout->addr);
for (i=0; i<layout->ndims; i++) {
HDfprintf(stderr, "%s%Zu", i?",":"", offset[i]);
}
@@ -1593,7 +1595,7 @@ H5F_istore_read(H5F_t *f, const H5F_xfer_t *xfer, const H5O_layout_t *layout,
assert (f);
assert (layout && H5D_CHUNKED==layout->type);
assert (layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS);
- assert (H5F_addr_defined(&(layout->addr)));
+ assert (H5F_addr_defined(layout->addr));
assert (offset_f);
assert (size);
assert (buf);
@@ -1764,7 +1766,7 @@ H5F_istore_write(H5F_t *f, const H5F_xfer_t *xfer, const H5O_layout_t *layout,
assert(f);
assert(layout && H5D_CHUNKED==layout->type);
assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS);
- assert(H5F_addr_defined(&(layout->addr)));
+ assert(H5F_addr_defined(layout->addr));
assert(offset_f);
assert(size);
assert(buf);
@@ -1965,11 +1967,12 @@ H5F_istore_create(H5F_t *f, H5O_layout_t *layout /*out */ )
* Wednesday, April 21, 1999
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
hsize_t
-H5F_istore_allocated(H5F_t *f, int ndims, haddr_t *addr)
+H5F_istore_allocated(H5F_t *f, int ndims, haddr_t addr)
{
H5F_istore_ud1_t udata;
@@ -1998,11 +2001,12 @@ H5F_istore_allocated(H5F_t *f, int ndims, haddr_t *addr)
* Wednesday, April 28, 1999
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, haddr_t *addr)
+H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, haddr_t addr)
{
H5F_istore_ud1_t udata;
@@ -2090,11 +2094,12 @@ H5F_istore_stats (H5F_t *f, hbool_t headers)
* Thursday, April 16, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5F_istore_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
+H5F_istore_debug(H5F_t *f, haddr_t addr, FILE * stream, intn indent,
intn fwidth, int ndims)
{
H5F_istore_ud1_t udata;
@@ -2147,9 +2152,9 @@ H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout,
}
udata->mesg = *layout;
H5F_addr_undef (&(udata->addr));
- status = H5B_find (f, H5B_ISTORE, &(layout->addr), udata);
+ status = H5B_find (f, H5B_ISTORE, layout->addr, udata);
H5E_clear ();
- if (status>=0 && H5F_addr_defined (&(udata->addr)))
+ if (status>=0 && H5F_addr_defined(udata->addr))
HRETURN(SUCCEED);
FUNC_LEAVE (FAIL);
@@ -2211,7 +2216,7 @@ H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout,
assert(pline);
assert(layout && H5D_CHUNKED==layout->type);
assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS);
- assert(H5F_addr_defined(&(layout->addr)));
+ assert(H5F_addr_defined(layout->addr));
/*
* Setup indice to go through all chunks. (Future improvement
@@ -2281,7 +2286,7 @@ H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout,
} else {
#ifdef AKC
printf("NO need for allocation\n");
- printf("udata.addr.offset=%d\n", udata.addr.offset);
+ HDfprintf(stdout, "udata.addr=%a\n", udata.addr);
#endif
}
#endif
diff --git a/src/H5Flow.c b/src/H5Flow.c
index 3ac4cf1..c54f845 100644
--- a/src/H5Flow.c
+++ b/src/H5Flow.c
@@ -15,8 +15,6 @@
#include <H5Fprivate.h>
#include <H5MMprivate.h>
-#define addr_defined(X) (((uint64_t)(-1)!=(X)->offset) ? TRUE : FALSE)
-
#define PABLO_MASK H5Flow_mask
static intn interface_initialize_g = 0;
#define INTERFACE_INIT NULL
@@ -209,22 +207,24 @@ H5F_low_close(H5F_low_t *lf, const H5F_access_t *access_parms)
* Wednesday, October 22, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
- size_t size, uint8_t *buf/*out*/)
+ const H5F_xfer_t *xfer_parms, haddr_t addr, size_t size,
+ uint8_t *buf/*out*/)
{
herr_t ret_value = FAIL;
FUNC_ENTER(H5F_low_read, FAIL);
assert(lf && lf->type);
- assert(addr && addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(buf);
if (lf->type->read) {
@@ -259,20 +259,23 @@ H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms,
* Wednesday, October 22, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
- * rky 980816
+ * rky, 1998-08-16
* Accommodate fancy MPI derived datatype writes.
*
- * rky 980902
+ * rky, 1998-09-02
* For non-block parallel writes, don't change value of lf->eof.
+ *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
- size_t size, const uint8_t *buf)
+ const H5F_xfer_t *xfer_parms, haddr_t addr, size_t size,
+ const uint8_t *buf)
{
herr_t ret_value = FAIL;
haddr_t tmp_addr;
@@ -280,17 +283,17 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms,
FUNC_ENTER(H5F_low_write, FAIL);
assert(lf && lf->type);
- assert(addr && addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(buf);
/* check for writing past the end of file marker */
- tmp_addr = *addr;
+ tmp_addr = addr;
H5F_addr_inc(&tmp_addr, (hsize_t)size);
- if (H5F_addr_gt(&tmp_addr, &(lf->eof)))
+ if (H5F_addr_gt(tmp_addr, lf->eof))
HRETURN_ERROR(H5E_IO, H5E_OVERFLOW, ret_value, "write past end of logical file");
/* Check if the last byte of the logical file has been written */
- if (!lf->eof_written && H5F_addr_eq(&tmp_addr, &(lf->eof)))
+ if (!lf->eof_written && H5F_addr_eq(tmp_addr, lf->eof))
lf->eof_written=1;
/* Write the data */
@@ -342,15 +345,16 @@ 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 (!lf->eof_written && addr_defined(&(lf->eof)) && H5F_addr_gt(&(lf->eof), &last_byte)) {
+ if (!lf->eof_written && H5F_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, &H5F_xfer_dflt, &last_byte,
+ last_byte -= 1;
+ if (H5F_low_read(lf, access_parms, &H5F_xfer_dflt, last_byte,
1, buf) >= 0) {
#ifdef HAVE_PARALLEL
H5F_mpio_tas_allsame( lf, TRUE ); /* only p0 will write */
#endif /* HAVE_PARALLEL */
- H5F_low_write(lf, access_parms, &H5F_xfer_dflt, &last_byte,
+ H5F_low_write(lf, access_parms, &H5F_xfer_dflt, last_byte,
1, buf);
}
else
@@ -401,17 +405,17 @@ H5F_low_flush(H5F_low_t *lf, const H5F_access_t *access_parms)
*-------------------------------------------------------------------------
*/
hsize_t
-H5F_low_size(H5F_low_t *lf, haddr_t *eof/*out*/)
+H5F_low_size(H5F_low_t *lf, haddr_t *eof_p/*out*/)
{
hsize_t size = (hsize_t)(-1); /*max possible size */
FUNC_ENTER(H5F_low_size, 0);
assert(lf && lf->type);
- assert(eof);
+ assert(eof_p);
- *eof = lf->eof;
- if (eof->offset < size) size = eof->offset;
+ *eof_p = lf->eof;
+ if (*eof_p < size) size = *eof_p;
FUNC_LEAVE(size);
}
@@ -516,7 +520,7 @@ H5F_low_access(const H5F_low_class_t *type, const char *name,
* providing its own allocation method.
*
* Return: Success: Non-negative. The address of the old
- * end-of-file is returned through the ADDR
+ * end-of-file is returned through the ADDR_P
* argument and the logical size of the file has
* been extended by SIZE bytes.
*
@@ -531,24 +535,24 @@ 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,
- hsize_t size, haddr_t *addr/*out*/)
+ hsize_t size, haddr_t *addr_p/*out*/)
{
FUNC_ENTER(H5F_low_alloc, FAIL);
assert(lf);
assert(size > 0);
- assert(addr);
+ assert(addr_p);
/* Reset the EOF written flag */
lf->eof_written=0;
if (lf->type->extend) {
- if ((lf->type->extend) (lf, access_parms, op, size, addr/*out*/) < 0) {
+ if ((lf->type->extend) (lf, access_parms, op, size, addr_p/*out*/)<0) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"unable to extend file");
}
} else {
- *addr = lf->eof;
+ *addr_p = lf->eof;
H5F_addr_inc(&(lf->eof), size);
}
@@ -572,7 +576,8 @@ H5F_low_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op,
* ADDR will be the address within the free
* block where the request can be satisfied.
*
- * Failure: Negative with the output value of ADDR undefined.
+ * Failure: Negative with the output value of ADDR_P
+ * undefined.
*
* Programmer: Robb Matzke
* Tuesday, June 9, 1998
@@ -583,7 +588,7 @@ H5F_low_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op,
*/
intn
H5F_low_alloc (H5F_low_t *lf, intn op, hsize_t alignment, hsize_t threshold,
- hsize_t size, H5MF_free_t *blk, haddr_t *addr/*out*/)
+ hsize_t size, H5MF_free_t *blk, haddr_t *addr_p/*out*/)
{
intn ret_value = FAIL;
hsize_t wasted;
@@ -593,25 +598,25 @@ H5F_low_alloc (H5F_low_t *lf, intn op, hsize_t alignment, hsize_t threshold,
assert (alignment>0);
assert (size>0);
assert (blk);
- assert (addr);
+ assert (addr_p);
if (lf->type->alloc) {
ret_value = (lf->type->alloc)(lf, op, alignment, threshold, size, blk,
- addr/*out*/);
+ addr_p/*out*/);
} else {
if (size>=threshold) {
- wasted = blk->addr.offset % alignment;
+ wasted = blk->addr % alignment;
} else {
wasted = 0;
}
if (0==wasted && size==blk->size) {
/* exact match */
- *addr = blk->addr;
+ *addr_p = blk->addr;
ret_value = 1;
} else if (blk->size>wasted && blk->size-wasted>=size) {
/* over-satisfied */
- *addr = blk->addr;
- H5F_addr_inc (addr, wasted);
+ *addr_p = blk->addr;
+ H5F_addr_inc (addr_p, wasted);
ret_value = 0;
}
}
@@ -631,18 +636,19 @@ H5F_low_alloc (H5F_low_t *lf, intn op, hsize_t alignment, hsize_t threshold,
* Thursday, November 13, 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5F_low_seteof(H5F_low_t *lf, const haddr_t *addr)
+H5F_low_seteof(H5F_low_t *lf, haddr_t addr)
{
FUNC_ENTER(H5F_low_seteof, FAIL);
assert(lf);
- assert(addr && addr_defined(addr));
+ assert(H5F_addr_defined(addr));
- lf->eof = *addr;
+ lf->eof = addr;
FUNC_LEAVE(SUCCEED);
}
@@ -662,113 +668,24 @@ H5F_low_seteof(H5F_low_t *lf, const haddr_t *addr)
* Friday, November 7, 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The A1 and A2 arguments are passed by value.
*-------------------------------------------------------------------------
*/
intn
-H5F_addr_cmp(const haddr_t *a1, const haddr_t *a2)
+H5F_addr_cmp(haddr_t a1, haddr_t a2)
{
FUNC_ENTER(H5F_addr_cmp, FAIL);
- assert(a1 && addr_defined(a1));
- assert(a2 && addr_defined(a2));
+ assert(H5F_addr_defined(a1));
+ assert(H5F_addr_defined(a2));
- if (a1->offset < a2->offset)
- HRETURN(-1);
- if (a1->offset > a2->offset)
- HRETURN(1);
+ if (a1 < a2) HRETURN(-1);
+ if (a1 > a2) HRETURN(1);
FUNC_LEAVE(0);
}
-
-/*-------------------------------------------------------------------------
- * Function: H5F_addr_undef
- *
- * Purpose: Cause an address to become undefined.
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-void
-H5F_addr_undef(haddr_t *addr/*out*/)
-{
- assert(addr);
- addr->offset = (uint64_t)(-1);
-}
-
-/*-------------------------------------------------------------------------
- * Function: H5F_addr_defined
- *
- * Purpose: Determines if an address has a defined value.
- *
- * Return: Success: TRUE or FALSE
- *
- * Failure: FAIL
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5F_addr_defined(const haddr_t *addr)
-{
- FUNC_ENTER(H5F_addr_defined, FAIL);
- FUNC_LEAVE(addr_defined(addr));
-}
-
-/*-------------------------------------------------------------------------
- * Function: H5F_addr_reset
- *
- * Purpose: Reset the address to zero.
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-void
-H5F_addr_reset(haddr_t *addr/*out*/)
-{
- assert(addr);
- addr->offset = 0;
-}
-
-/*-------------------------------------------------------------------------
- * Function: H5F_addr_zerop
- *
- * Purpose: Determines if an address is zero.
- *
- * Return: Success: TRUE or FALSE
- *
- * Failure: FAIL
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5F_addr_zerop(const haddr_t *addr)
-{
- FUNC_ENTER(H5F_addr_zerop, FAIL);
- FUNC_LEAVE(0 == addr->offset ? TRUE : FALSE);
-}
/*-------------------------------------------------------------------------
* Function: H5F_addr_encode
@@ -783,26 +700,26 @@ H5F_addr_zerop(const haddr_t *addr)
* Friday, November 7, 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
void
-H5F_addr_encode(H5F_t *f, uint8_t **pp, const haddr_t *addr)
+H5F_addr_encode(H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr)
{
uintn i;
haddr_t tmp;
assert(f);
assert(pp && *pp);
- assert(addr);
- if (addr_defined(addr)) {
- tmp = *addr;
+ if (H5F_addr_defined(addr)) {
+ tmp = addr;
for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
- *(*pp)++ = (uint8_t)(tmp.offset & 0xff);
- tmp.offset >>= 8;
+ *(*pp)++ = (uint8_t)(tmp & 0xff);
+ tmp >>= 8;
}
- assert("overflow" && 0 == tmp.offset);
+ assert("overflow" && 0 == tmp);
} else {
for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
@@ -810,6 +727,7 @@ H5F_addr_encode(H5F_t *f, uint8_t **pp, const haddr_t *addr)
}
}
}
+
/*-------------------------------------------------------------------------
* Function: H5F_addr_decode
@@ -831,7 +749,7 @@ H5F_addr_encode(H5F_t *f, uint8_t **pp, const haddr_t *addr)
*-------------------------------------------------------------------------
*/
void
-H5F_addr_decode(H5F_t *f, const uint8_t **pp, haddr_t *addr/*out*/)
+H5F_addr_decode(H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*out*/)
{
uintn i;
haddr_t tmp;
@@ -840,46 +758,23 @@ H5F_addr_decode(H5F_t *f, const uint8_t **pp, haddr_t *addr/*out*/)
assert(f);
assert(pp && *pp);
- assert(addr);
+ assert(addr_p);
- addr->offset = 0;
+ *addr_p = 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;
+ if (i<sizeof(*addr_p)) {
+ tmp = c;
+ tmp <<= i * 8; /*use tmp to get casting right */
+ *addr_p |= tmp;
} else if (!all_zero) {
assert(0 == **pp); /*overflow */
}
}
- if (all_zero) H5F_addr_undef(addr);
-}
-
-/*-------------------------------------------------------------------------
- * Function: H5F_addr_print
- *
- * Purpose: Print an address
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-void
-H5F_addr_print(FILE *stream, const haddr_t *addr)
-{
- assert(stream);
- assert(addr);
-
- HDfprintf(stream, "%a", addr);
+ if (all_zero) H5F_addr_undef(addr_p);
}
@@ -898,14 +793,15 @@ H5F_addr_print(FILE *stream, const haddr_t *addr)
*-------------------------------------------------------------------------
*/
void
-H5F_addr_pow2(uintn n, haddr_t *addr /*out */ )
+H5F_addr_pow2(uintn n, haddr_t *addr_p/*out*/)
{
- assert(addr);
- assert(n < 8 * sizeof(addr->offset));
+ assert(addr_p);
+ assert(n < 8*sizeof(haddr_t));
- addr->offset = 1;
- addr->offset <<= n;
+ *addr_p = 1;
+ *addr_p <<= n;
}
+
/*-------------------------------------------------------------------------
* Function: H5F_addr_inc
@@ -922,12 +818,12 @@ H5F_addr_pow2(uintn n, haddr_t *addr /*out */ )
*-------------------------------------------------------------------------
*/
void
-H5F_addr_inc(haddr_t *addr/*in,out*/, hsize_t inc)
+H5F_addr_inc(haddr_t *addr_p/*in,out*/, hsize_t inc)
{
- assert(addr && addr_defined(addr));
- assert(addr->offset <= addr->offset + inc);
+ assert(addr_p && H5F_addr_defined(*addr_p));
+ assert(*addr_p <= *addr_p + inc);
- addr->offset += inc;
+ *addr_p += inc;
}
@@ -946,18 +842,18 @@ H5F_addr_inc(haddr_t *addr/*in,out*/, hsize_t inc)
*-------------------------------------------------------------------------
*/
void
-H5F_addr_adj(haddr_t *addr/*in,out */, hssize_t adj)
+H5F_addr_adj(haddr_t *addr_p/*in,out */, hssize_t adj)
{
#ifndef NDEBUG
- assert(addr && addr_defined(addr));
+ assert(addr_p && H5F_addr_defined(*addr_p));
if (adj>=0) {
- assert(addr->offset <= addr->offset + adj);
+ assert(*addr_p <= *addr_p + adj);
} else {
- assert (addr->offset > addr->offset + adj);
+ assert (*addr_p > *addr_p + adj);
}
#endif
- addr->offset += adj;
+ *addr_p += adj;
}
@@ -972,42 +868,18 @@ H5F_addr_adj(haddr_t *addr/*in,out */, hssize_t adj)
* Friday, November 7, 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The A2 argument is passed by value.
*-------------------------------------------------------------------------
*/
void
-H5F_addr_add(haddr_t *a1 /*in,out */ , const haddr_t *a2)
+H5F_addr_add(haddr_t *a1/*in,out*/, haddr_t a2)
{
- assert(a1 && addr_defined(a1));
- assert(a2 && addr_defined(a2));
- a1->offset += a2->offset;
+ assert(a1 && H5F_addr_defined(*a1));
+ assert(H5F_addr_defined(a2));
+ *a1 += a2;
}
-
-/*-------------------------------------------------------------------------
- * Function: H5F_addr_hash
- *
- * Purpose: Computes a hash value of an address between 0 and MOD-1,
- * inclusive.
- *
- * Return: Success: The hash value
- *
- * Failure: never fails
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-uintn
-H5F_addr_hash(const haddr_t *addr, uintn mod)
-{
- assert(addr && addr_defined(addr));
- assert(mod > 0);
- return (unsigned)(addr->offset % mod); /*ignore file number */
-}
/*-------------------------------------------------------------------------
* Function: H5F_addr_pack
@@ -1028,15 +900,16 @@ H5F_addr_hash(const haddr_t *addr, uintn mod)
*-------------------------------------------------------------------------
*/
herr_t
-H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr, const unsigned long objno[2])
+H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr_p/*out*/,
+ const unsigned long objno[2])
{
assert(f);
assert(objno);
- assert(addr);
+ assert(addr_p);
- addr->offset = objno[0];
+ *addr_p = objno[0];
#if SIZEOF_LONG<SIZEOF_UINT64_T
- addr->offset |= ((uint64_t)objno[1]) << (8*sizeof(long));
+ *addr_p |= ((uint64_t)objno[1]) << (8*sizeof(long));
#endif
return(SUCCEED);
diff --git a/src/H5Fmpio.c b/src/H5Fmpio.c
index b5f3858..11f8da5 100644
--- a/src/H5Fmpio.c
+++ b/src/H5Fmpio.c
@@ -104,16 +104,15 @@ static H5F_low_t *H5F_mpio_open(const char *name,
H5F_search_t *key/*out*/);
static herr_t H5F_mpio_close(H5F_low_t *lf, const H5F_access_t *access_parms);
static herr_t H5F_mpio_read(H5F_low_t *lf, H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, uint8_t *buf/*out*/);
htri_t H5F_mpio_tas_allsame(H5F_low_t *lf, hbool_t newval );
static herr_t H5F_mpio_write(H5F_low_t *lf, H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, const uint8_t *buf);
static herr_t H5F_mpio_flush(H5F_low_t *lf, const H5F_access_t *access_parms);
-static herr_t H5F_MPIOff_to_haddr(MPI_Offset mpi_off, haddr_t *addr/*out*/);
-static herr_t H5F_haddr_to_MPIOff(const haddr_t *addr,
- MPI_Offset *mpi_off/*out*/);
+static herr_t H5F_MPIOff_to_haddr(MPI_Offset mpi_off, haddr_t *addr_p/*out*/);
+static herr_t H5F_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/);
const H5F_low_class_t H5F_LOW_MPIO_g[1] = {{
H5F_mpio_access, /*access method */
@@ -125,8 +124,8 @@ const H5F_low_class_t H5F_LOW_MPIO_g[1] = {{
* in the parameter list of the write function in H5F_low_class_t
* would propagate to a lot of functions that don't change that param */
(int(*)(struct H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
- size_t size, uint8_t *buf))
+ const H5F_xfer_t *xfer_parms, haddr_t addr, size_t size,
+ uint8_t *buf))
H5F_mpio_read, /*read method */
/* rky 980816
@@ -134,8 +133,8 @@ const H5F_low_class_t H5F_LOW_MPIO_g[1] = {{
* in the parameter list of the write function in H5F_low_class_t
* would propagate to a lot of functions that don't change that param */
(int(*)(struct H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
- size_t size, const uint8_t *buf))
+ const H5F_xfer_t *xfer_parms, haddr_t addr, size_t size,
+ const uint8_t *buf))
H5F_mpio_write, /*write method */
H5F_mpio_flush, /*flush method */
@@ -509,15 +508,17 @@ H5F_mpio_close(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms)
* The guts of H5F_mpio_read and H5F_mpio_write
* should be replaced by a single dual-purpose routine.
*
- * Robb Matzke, 19990421
+ * Robb Matzke, 1999-04-21
* Changed xfer_mode to xfer_parms for all H5F_*_read() callbacks.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_mpio_read(H5F_low_t *lf, H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms,
- const haddr_t *addr, size_t size, uint8_t *buf/*out*/)
+ const H5F_xfer_t *xfer_parms, haddr_t addr, size_t size,
+ uint8_t *buf/*out*/)
{
MPI_Offset mpi_off, mpi_disp;
MPI_Status mpi_stat;
@@ -761,15 +762,17 @@ H5F_mpio_tas_allsame(H5F_low_t *lf, hbool_t newval )
* rky, 980828
* Added allsame parameter to make all but proc 0 skip the actual write.
*
- * Robb Matzke, 19990421
- * Changed xfer_mode to xfer_parms for all H5F_*_write() callbacks.
+ * Robb Matzke, 1999-04-21
+ * Changed XFER_MODE to XFER_PARMS for all H5F_*_write() callbacks.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_mpio_write(H5F_low_t *lf, H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms,
- const haddr_t *addr, size_t size, const uint8_t *buf)
+ const H5F_xfer_t *xfer_parms, haddr_t addr, size_t size,
+ const uint8_t *buf)
{
MPI_Offset mpi_off, mpi_disp;
MPI_Status mpi_stat;
@@ -989,11 +992,11 @@ H5F_mpio_flush(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms)
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_MPIOff_to_haddr(MPI_Offset mpi_off, haddr_t *addr/*out*/)
+H5F_MPIOff_to_haddr(MPI_Offset mpi_off, haddr_t *addr_p/*out*/)
{
FUNC_ENTER(H5F_MPIOff_to_haddr, FAIL);
- if (addr) addr->offset = (uint64_t) mpi_off;
+ if (addr_p) *addr_p = (uint64_t) mpi_off;
if (mpi_off != (MPI_Offset)(uint64_t)mpi_off) {
HRETURN_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "bad MPI address");
}
@@ -1020,15 +1023,17 @@ H5F_MPIOff_to_haddr(MPI_Offset mpi_off, haddr_t *addr/*out*/)
* An error is reported for address overflows. The ADDR output
* argument is optional.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_haddr_to_MPIOff(const haddr_t *addr, MPI_Offset *mpi_off/*out*/)
+H5F_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/)
{
FUNC_ENTER(H5F_haddr_to_MPIOff, FAIL);
- if (mpi_off) *mpi_off = (MPI_Offset)addr->offset;
- if (addr->offset != (uint64_t)(MPI_Offset)(addr->offset)) {
+ if (mpi_off) *mpi_off = (MPI_Offset)addr;
+ if (addr != (uint64_t)(MPI_Offset)(addr)) {
HRETURN_ERROR(H5E_IO, H5E_OVERFLOW, FAIL,
"hdf5 address overflows MPI address");
}
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index ae0d0a6..ab5b748 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -361,11 +361,11 @@ typedef struct H5F_low_class_t {
herr_t (*close)(struct H5F_low_t *lf,
const H5F_access_t *access_parms);
herr_t (*read)(struct H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, uint8_t *buf);
herr_t (*write)(struct H5F_low_t *lf,
const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, const uint8_t *buf);
herr_t (*flush)(struct H5F_low_t *lf,
const H5F_access_t *access_parms);
@@ -611,9 +611,9 @@ __DLL__ H5F_t *H5F_open(const char *name, uintn flags,
__DLL__ herr_t H5F_close(H5F_t *f);
__DLL__ herr_t H5F_close_all(void);
__DLL__ herr_t H5F_flush_all(hbool_t invalidate);
-__DLL__ herr_t H5F_debug(H5F_t *f, const haddr_t *addr, FILE * stream,
+__DLL__ herr_t H5F_debug(H5F_t *f, haddr_t addr, FILE * stream,
intn indent, intn fwidth);
-__DLL__ herr_t H5F_istore_debug(H5F_t *f, const haddr_t *addr, FILE * stream,
+__DLL__ herr_t H5F_istore_debug(H5F_t *f, haddr_t addr, FILE * stream,
intn indent, intn fwidth, int ndims);
__DLL__ herr_t H5F_mountpoint(struct H5G_entry_t *find/*in,out*/);
@@ -643,7 +643,7 @@ __DLL__ herr_t H5F_arr_write (H5F_t *f, const struct H5F_xfer_t *xfer,
__DLL__ herr_t H5F_istore_init (H5F_t *f);
__DLL__ herr_t H5F_istore_flush (H5F_t *f, hbool_t preempt);
__DLL__ herr_t H5F_istore_dest (H5F_t *f);
-__DLL__ hsize_t H5F_istore_allocated(H5F_t *f, int ndims, haddr_t *addr);
+__DLL__ hsize_t H5F_istore_allocated(H5F_t *f, int ndims, haddr_t addr);
__DLL__ herr_t H5F_istore_stats (H5F_t *f, hbool_t headers);
__DLL__ herr_t H5F_istore_create(H5F_t *f,
struct H5O_layout_t *layout/*in,out*/);
@@ -666,19 +666,19 @@ __DLL__ herr_t H5F_istore_allocate (H5F_t *f,
const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill);
__DLL__ herr_t H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims,
- haddr_t *addr);
+ haddr_t addr);
/* Functions that operate on contiguous storage wrt boot block */
-__DLL__ herr_t H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size,
+__DLL__ herr_t H5F_block_read(H5F_t *f, haddr_t addr, hsize_t size,
const H5F_xfer_t *xfer_parms, void *buf);
-__DLL__ herr_t H5F_block_write(H5F_t *f, const haddr_t *addr, hsize_t size,
+__DLL__ herr_t H5F_block_write(H5F_t *f, haddr_t addr, hsize_t size,
const H5F_xfer_t *xfer_parms, const void *buf);
/* Functions that operate directly on low-level files */
__DLL__ const H5F_low_class_t *H5F_low_class (H5F_driver_t driver);
__DLL__ herr_t H5F_low_extend(H5F_low_t *lf, const H5F_access_t *access_parms,
intn op, hsize_t size, haddr_t *addr/*out*/);
-__DLL__ herr_t H5F_low_seteof(H5F_low_t *lf, const haddr_t *addr);
+__DLL__ herr_t H5F_low_seteof(H5F_low_t *lf, haddr_t addr);
__DLL__ intn H5F_low_alloc (H5F_low_t *lf, intn op, hsize_t alignment,
hsize_t threshold, hsize_t size, H5MF_free_t *blk,
haddr_t *addr/*out*/);
@@ -692,35 +692,45 @@ __DLL__ H5F_low_t *H5F_low_close(H5F_low_t *lf,
const H5F_access_t *access_parms);
__DLL__ hsize_t H5F_low_size(H5F_low_t *lf, haddr_t *addr);
__DLL__ herr_t H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, uint8_t *buf);
__DLL__ herr_t H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, const uint8_t *buf);
__DLL__ herr_t H5F_low_flush(H5F_low_t *lf, const H5F_access_t *access_parms);
-/* Functions that operate on addresses */
-#define H5F_addr_eq(A1,A2) (H5F_addr_cmp(A1,A2)==0)
-#define H5F_addr_ne(A1,A2) (H5F_addr_cmp(A1,A2)!=0)
-#define H5F_addr_lt(A1,A2) (H5F_addr_cmp(A1,A2)<0)
-#define H5F_addr_le(A1,A2) (H5F_addr_cmp(A1,A2)<=0)
-#define H5F_addr_gt(A1,A2) (H5F_addr_cmp(A1,A2)>0)
-#define H5F_addr_ge(A1,A2) (H5F_addr_cmp(A1,A2)>=0)
-
-__DLL__ intn H5F_addr_cmp(const haddr_t *, const haddr_t *);
-__DLL__ htri_t H5F_addr_defined(const haddr_t *);
-__DLL__ void H5F_addr_undef(haddr_t *);
-__DLL__ void H5F_addr_reset(haddr_t *);
-__DLL__ htri_t H5F_addr_zerop(const haddr_t *);
-__DLL__ void H5F_addr_encode(H5F_t *, uint8_t **, const haddr_t *);
-__DLL__ void H5F_addr_decode(H5F_t *, const uint8_t **, haddr_t *);
-__DLL__ void H5F_addr_print(FILE *, const haddr_t *);
-__DLL__ void H5F_addr_pow2(uintn, haddr_t *);
+/* Address-related macros and functions */
+#define H5F_ADDR_UNDEF ((uint64_t)(-1L))
+#define H5F_addr_defined(X) (X!=H5F_ADDR_UNDEF)
+#define H5F_addr_hash(X,M) ((unsigned)((X)%(M)))
+#define H5F_addr_eq(X,Y) ((X)!=H5F_ADDR_UNDEF && \
+ (Y)!=H5F_ADDR_UNDEF && \
+ (X)==(Y))
+#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y)))
+#define H5F_addr_lt(X,Y) ((X)!=H5F_ADDR_UNDEF && \
+ (Y)!=H5F_ADDR_UNDEF && \
+ (X)<(Y))
+#define H5F_addr_le(X,Y) ((X)!=H5F_ADDR_UNDEF && \
+ (Y)!=H5F_ADDR_UNDEF && \
+ (X)<=(Y))
+#define H5F_addr_gt(X,Y) ((X)!=H5F_ADDR_UNDEF && \
+ (Y)!=H5F_ADDR_UNDEF && \
+ (X)>(Y))
+#define H5F_addr_ge(X,Y) ((X)!=H5F_ADDR_UNDEF && \
+ (Y)!=H5F_ADDR_UNDEF && \
+ (X)>=(Y))
+#define H5F_addr_undef(XP) (*(XP)=H5F_ADDR_UNDEF)
+#define H5F_addr_reset(XP) (*(XP)=0)
+#define H5F_addr_zerop(X) ((X)==0)
__DLL__ void H5F_addr_inc(haddr_t *addr/*in,out*/, hsize_t inc);
-__DLL__ void H5F_addr_adj(haddr_t *addr/*in,out*/, hssize_t adj);
-__DLL__ void H5F_addr_add(haddr_t *, const haddr_t *);
-__DLL__ uintn H5F_addr_hash(const haddr_t *, uintn mod);
-__DLL__ herr_t H5F_addr_pack(H5F_t *f, haddr_t *addr,
+__DLL__ void H5F_addr_encode(H5F_t *, uint8_t**/*in,out*/, haddr_t);
+__DLL__ void H5F_addr_decode(H5F_t *, const uint8_t**/*in,out*/,
+ haddr_t*/*out*/);
+__DLL__ void H5F_addr_pow2(uintn n, haddr_t *addr/*out*/);
+__DLL__ void H5F_addr_add(haddr_t *a1/*in,out*/, haddr_t a2);
+__DLL__ intn H5F_addr_cmp(haddr_t a1, haddr_t a2);
+__DLL__ void H5F_addr_adj(haddr_t *addr/*in,out */, hssize_t adj);
+__DLL__ herr_t H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr_p/*out*/,
const unsigned long objno[2]);
/* Functions for MPI-IO */
diff --git a/src/H5Fsec2.c b/src/H5Fsec2.c
index add8e1f..cacbff2 100644
--- a/src/H5Fsec2.c
+++ b/src/H5Fsec2.c
@@ -28,10 +28,10 @@ static H5F_low_t *H5F_sec2_open(const char *name,
H5F_search_t *key/*out*/);
static herr_t 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,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, uint8_t *buf/*out*/);
static herr_t H5F_sec2_write(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, const uint8_t *buf);
const H5F_low_class_t H5F_LOW_SEC2_g[1] = {{
@@ -93,7 +93,7 @@ H5F_sec2_open(const char *name, const H5F_access_t UNUSED *access_parms,
lf->u.sec2.op = H5F_OP_SEEK;
lf->u.sec2.cur = 0;
HDfstat(fd, &sb);
- lf->eof.offset = sb.st_size;
+ lf->eof = sb.st_size;
if (key) {
#if WIN32
@@ -179,15 +179,17 @@ H5F_sec2_close(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms)
* Wednesday, October 22, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_sec2_read(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
- const H5F_xfer_t UNUSED *xfer_parms, const haddr_t *addr,
- size_t size, uint8_t *buf)
+ const H5F_xfer_t UNUSED *xfer_parms, haddr_t addr, size_t size,
+ uint8_t *buf)
{
ssize_t n;
uint64_t mask;
@@ -201,20 +203,20 @@ H5F_sec2_read(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
/* Check for overflow */
mask = (uint64_t)1 << (8*sizeof(offset)-1);
- if (addr->offset >= mask ||
- addr->offset+size < addr->offset ||
- addr->offset+size >= mask) {
+ if (addr >= mask ||
+ addr+size < addr ||
+ addr+size >= mask) {
HRETURN_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed");
}
#ifdef HAVE_LSEEK64
- offset = (off64_t)(addr->offset); /*checked for overflow above*/
+ offset = (off64_t)(addr); /*checked for overflow above*/
#else
- offset = (off_t)(addr->offset); /*checked for overflow above*/
+ offset = (off_t)(addr); /*checked for overflow above*/
#endif
/* Check easy cases */
if (0 == size) HRETURN(SUCCEED);
- if ((uint64_t)offset >= lf->eof.offset) {
+ if ((uint64_t)offset >= lf->eof) {
HDmemset(buf, 0, size);
HRETURN(SUCCEED);
}
@@ -241,8 +243,8 @@ H5F_sec2_read(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
/*
* Read zeros past the logical end of file (physical is handled below)
*/
- if ((size_t) offset + size > lf->eof.offset) {
- size_t nbytes = (size_t)offset + size - lf->eof.offset;
+ if ((size_t) offset + size > lf->eof) {
+ size_t nbytes = (size_t)offset + size - lf->eof;
HDmemset(buf + size - nbytes, 0, nbytes);
size -= nbytes;
}
@@ -284,15 +286,17 @@ H5F_sec2_read(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
* Wednesday, October 22, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_sec2_write(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
- const H5F_xfer_t UNUSED *xfer_parms, const haddr_t *addr,
- size_t size, const uint8_t *buf)
+ const H5F_xfer_t UNUSED *xfer_parms, haddr_t addr, size_t size,
+ const uint8_t *buf)
{
uint64_t mask;
ssize_t n;
@@ -306,16 +310,16 @@ H5F_sec2_write(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
/* Check for overflow */
mask = (uint64_t)1 << (8*sizeof(offset)-1);
- if (addr->offset >= mask ||
- addr->offset+size < addr->offset ||
- addr->offset+size >= mask) {
+ if (addr >= mask ||
+ addr+size < addr ||
+ addr+size >= mask) {
HRETURN_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed");
}
#ifdef HAVE_LSEEK64
- offset = (off64_t)(addr->offset); /*checked for overflow*/
+ offset = (off64_t)(addr); /*checked for overflow*/
n = (off64_t)size; /*checked for overflow*/
#else
- offset = (off_t)(addr->offset); /*checked for overflow*/
+ offset = (off_t)(addr); /*checked for overflow*/
n = (off_t)size; /*checked for overflow*/
#endif
diff --git a/src/H5Fsplit.c b/src/H5Fsplit.c
index 13dcc06..8d3a8f9 100644
--- a/src/H5Fsplit.c
+++ b/src/H5Fsplit.c
@@ -33,12 +33,11 @@ static H5F_low_t *H5F_split_open(const char *name,
H5F_search_t *key/*out*/);
static herr_t H5F_split_close(H5F_low_t *lf, const H5F_access_t *access_parms);
static herr_t H5F_split_read(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, uint8_t *buf/*out*/);
static herr_t H5F_split_write(H5F_low_t *lf, const H5F_access_t *access_parms,
const H5F_xfer_t *xfer_parms,
- const haddr_t *addr, size_t size,
- const uint8_t *buf);
+ haddr_t addr, size_t size, const uint8_t *buf);
static herr_t H5F_split_flush(H5F_low_t *lf, const H5F_access_t *access_parms);
static herr_t H5F_split_extend(H5F_low_t *lf, const H5F_access_t *access_parms,
intn op, hsize_t size, haddr_t *addr/*out*/);
@@ -148,7 +147,7 @@ H5F_split_open(const char *name, const H5F_access_t *access_parms,
/* Initialize the file size */
H5F_low_size(lf->u.split.raw, &(lf->eof));
- lf->eof.offset |= lf->u.split.mask;
+ lf->eof |= lf->u.split.mask;
HRETURN(lf);
@@ -204,15 +203,17 @@ H5F_split_close(H5F_low_t *lf, const H5F_access_t *access_parms)
* Monday, November 13, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_split_read(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
- size_t size, uint8_t *buf/*out*/)
+ const H5F_xfer_t *xfer_parms, haddr_t addr, size_t size,
+ uint8_t *buf/*out*/)
{
haddr_t tmp_addr;
H5F_low_t *sub = NULL;
@@ -222,24 +223,24 @@ H5F_split_read(H5F_low_t *lf, const H5F_access_t *access_parms,
FUNC_ENTER(H5F_split_read, FAIL);
assert(lf);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(buf);
/* no collective support */
assert(xfer_parms->xfer_mode != H5D_XFER_COLLECTIVE);
/* Which file to we actually read from? */
- if (addr->offset & lf->u.split.mask) {
+ if (addr & lf->u.split.mask) {
sub = lf->u.split.raw;
sub_parms = access_parms->u.split.raw_access;
- tmp_addr.offset = addr->offset & (lf->u.split.mask - 1);
+ tmp_addr = addr & (lf->u.split.mask - 1);
} else {
sub = lf->u.split.meta;
sub_parms = access_parms->u.split.meta_access;
- tmp_addr = *addr;
+ tmp_addr = addr;
}
/* Read the data */
- status = H5F_low_read(sub, sub_parms, xfer_parms, &tmp_addr, size,
+ status = H5F_low_read(sub, sub_parms, xfer_parms, tmp_addr, size,
buf/*out*/);
FUNC_LEAVE(status);
}
@@ -256,15 +257,17 @@ H5F_split_read(H5F_low_t *lf, const H5F_access_t *access_parms,
* Monday, November 13, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_split_write(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
- size_t size, const uint8_t *buf)
+ const H5F_xfer_t *xfer_parms, haddr_t addr, size_t size,
+ const uint8_t *buf)
{
haddr_t tmp_addr;
H5F_low_t *sub = NULL;
@@ -274,24 +277,24 @@ H5F_split_write(H5F_low_t *lf, const H5F_access_t *access_parms,
FUNC_ENTER(H5F_split_write, FAIL);
assert(lf);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(buf);
/* no collective support */
assert(xfer_parms->xfer_mode != H5D_XFER_COLLECTIVE);
/* Which file to we actually write to? */
- if (addr->offset & lf->u.split.mask) {
+ if (addr & lf->u.split.mask) {
sub = lf->u.split.raw;
sub_parms = access_parms->u.split.raw_access;
- tmp_addr.offset = addr->offset & (lf->u.split.mask - 1);
+ tmp_addr = addr & (lf->u.split.mask - 1);
} else {
sub = lf->u.split.meta;
sub_parms = access_parms->u.split.meta_access;
- tmp_addr = *addr;
+ tmp_addr = addr;
}
/* Write the data */
- status = H5F_low_write(sub, sub_parms, xfer_parms, &tmp_addr, size, buf);
+ status = H5F_low_write(sub, sub_parms, xfer_parms, tmp_addr, size, buf);
FUNC_LEAVE(status);
}
@@ -408,7 +411,7 @@ H5F_split_access(const char *name, const H5F_access_t *access_parms,
* data file.
*
* Return: Non-negative on success (with the address of the allocated
- * memory returned through the ADDR argument.) /Negative
+ * memory returned through the ADDR_P argument.) /Negative
* on failure
*
* Programmer: Robb Matzke
@@ -420,33 +423,33 @@ H5F_split_access(const char *name, const H5F_access_t *access_parms,
*/
static herr_t
H5F_split_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op,
- hsize_t size, haddr_t *addr/*out*/)
+ hsize_t size, haddr_t *addr_p/*out*/)
{
FUNC_ENTER(H5F_split_extend, FAIL);
assert(lf);
assert(H5MF_META == op || H5MF_RAW == op);
assert(size > 0);
- assert(addr);
+ assert(addr_p);
if (H5MF_META == op) {
if (H5F_low_extend(lf->u.split.meta, access_parms->u.split.meta_access,
- op, size, addr/*out*/)<0) {
+ op, size, addr_p/*out*/)<0) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"meta data allocation failed");
}
- if (addr->offset + size > lf->eof.offset) {
- lf->eof.offset = addr->offset + size;
+ if (*addr_p + size > lf->eof) {
+ lf->eof = *addr_p + size;
}
} else {
if (H5F_low_extend(lf->u.split.raw, access_parms->u.split.raw_access,
- op, size, addr/*out*/)<0) {
+ op, size, addr_p/*out*/)<0) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"raw data allocation failed");
}
- addr->offset |= lf->u.split.mask;
+ *addr_p |= lf->u.split.mask;
lf->eof = lf->u.split.raw->eof;
- lf->eof.offset |= lf->u.split.mask;
+ lf->eof |= lf->u.split.mask;
}
FUNC_LEAVE(SUCCEED);
@@ -465,7 +468,7 @@ H5F_split_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op,
*
* Return: Success: Positive if the free block satisfies the
* request exactly, zero if the free block
- * over-satisfies the request. The ADDR will
+ * over-satisfies the request. The ADDR_P will
* contain the address within the free block
* where the request starts.
*
@@ -480,7 +483,7 @@ H5F_split_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op,
*/
static intn
H5F_split_alloc (H5F_low_t *lf, intn op, hsize_t alignment, hsize_t threshold,
- hsize_t size, H5MF_free_t *blk, haddr_t *addr/*out*/)
+ hsize_t size, H5MF_free_t *blk, haddr_t *addr_p/*out*/)
{
intn ret_value = FAIL;
hsize_t wasted;
@@ -490,30 +493,30 @@ H5F_split_alloc (H5F_low_t *lf, intn op, hsize_t alignment, hsize_t threshold,
assert (alignment>0);
assert (size>0);
assert (blk);
- assert (addr);
+ assert (addr_p);
switch (op) {
case H5MF_META:
- if (blk->addr.offset & lf->u.split.mask) HRETURN(FAIL);
+ if (blk->addr & lf->u.split.mask) HRETURN(FAIL);
break;
case H5MF_RAW:
- if (0==(blk->addr.offset & lf->u.split.mask)) HRETURN(FAIL);
+ if (0==(blk->addr & lf->u.split.mask)) HRETURN(FAIL);
break;
}
if (size>=threshold) {
- wasted = blk->addr.offset % alignment;
+ wasted = blk->addr % alignment;
} else {
wasted = 0;
}
if (0==wasted && size==blk->size) {
/* exact match */
- *addr = blk->addr;
+ *addr_p = blk->addr;
ret_value = 1;
} else if (blk->size>wasted && blk->size-wasted>=size) {
/* over-satisfied */
- *addr = blk->addr;
- H5F_addr_inc (addr, wasted);
+ *addr_p = blk->addr;
+ H5F_addr_inc (addr_p, wasted);
ret_value = 0;
}
diff --git a/src/H5Fstdio.c b/src/H5Fstdio.c
index 6f3e059..5804a92 100644
--- a/src/H5Fstdio.c
+++ b/src/H5Fstdio.c
@@ -22,12 +22,11 @@ static H5F_low_t *H5F_stdio_open(const char *name,
H5F_search_t *key/*out*/);
static herr_t 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,
- const H5F_xfer_t *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
size_t size, uint8_t *buf/*out*/);
static herr_t H5F_stdio_write(H5F_low_t *lf, const H5F_access_t *access_parms,
- const H5F_xfer_t *xfer_parms,
- const haddr_t *addr, size_t size,
- const uint8_t *buf);
+ const H5F_xfer_t *xfer_parms, haddr_t addr,
+ size_t size, const uint8_t *buf);
static herr_t H5F_stdio_flush(H5F_low_t *lf, const H5F_access_t *access_parms);
const H5F_low_class_t H5F_LOW_STDIO_g[1] = {{
@@ -175,14 +174,16 @@ H5F_stdio_close(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms)
* Wednesday, October 22, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_stdio_read(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
- const H5F_xfer_t UNUSED *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t UNUSED *xfer_parms, haddr_t addr,
size_t size, uint8_t *buf/*out*/)
{
size_t n;
@@ -197,20 +198,20 @@ H5F_stdio_read(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
/* Check for overflow */
mask = (uint64_t)1 << (8*sizeof(offset)-1);
- if (addr->offset >= mask ||
- addr->offset + size < addr->offset ||
- addr->offset+size >= mask) {
+ if (addr >= mask ||
+ addr + size < addr ||
+ addr+size >= mask) {
HRETURN_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed");
}
#ifdef HAVE_FSEEK64
- offset = (int64_t)(addr->offset); /*checked for overflow*/
+ offset = (int64_t)(addr); /*checked for overflow*/
#else
- offset = (long)(addr->offset); /*checked for overflow*/
+ offset = (long)(addr); /*checked for overflow*/
#endif
/* Check easy cases */
if (0 == size) HRETURN(SUCCEED);
- if ((uint64_t)offset >= lf->eof.offset) {
+ if ((uint64_t)offset >= lf->eof) {
HDmemset(buf, 0, size);
HRETURN(SUCCEED);
}
@@ -236,8 +237,8 @@ H5F_stdio_read(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
/*
* Read zeros past the logical end of file (physical is handled below)
*/
- if ((size_t) offset + size > lf->eof.offset) {
- size_t nbytes = (size_t) offset + size - lf->eof.offset;
+ if ((size_t) offset + size > lf->eof) {
+ size_t nbytes = (size_t) offset + size - lf->eof;
HDmemset(buf + size - nbytes, 0, nbytes);
size -= nbytes;
}
@@ -284,14 +285,16 @@ H5F_stdio_read(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
* Wednesday, October 22, 1997
*
* Modifications:
- * June 2, 1998 Albert Cheng
- * Added xfer_mode argument
+ * Albert Cheng, 1998-06-02
+ * Added XFER_MODE argument.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
H5F_stdio_write(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
- const H5F_xfer_t UNUSED *xfer_parms, const haddr_t *addr,
+ const H5F_xfer_t UNUSED *xfer_parms, haddr_t addr,
size_t size, const uint8_t *buf)
{
uint64_t mask;
@@ -307,16 +310,16 @@ H5F_stdio_write(H5F_low_t *lf, const H5F_access_t UNUSED *access_parms,
/* Check for overflow */
mask = (uint64_t)1 << (8*sizeof(offset)-1);
- if (addr->offset >= mask ||
- addr->offset+size < addr->offset ||
- addr->offset+size >= mask) {
+ if (addr >= mask ||
+ addr+size < addr ||
+ addr+size >= mask) {
HRETURN_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed");
}
#ifdef HAVE_FSEEK64
- offset = (int64_t)(addr->offset); /*checked for overflow*/
+ offset = (int64_t)(addr); /*checked for overflow*/
n = size; /*checked for overflow*/
#else
- offset = (long)(addr->offset); /*checked for overflow*/
+ offset = (long)(addr); /*checked for overflow*/
n = size; /*checked for overflow*/
#endif
diff --git a/src/H5G.c b/src/H5G.c
index 8e488d9..f868161 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -318,7 +318,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx,
/* Iterate over the group members */
if ((ret_value = H5B_iterate (H5G_fileof(udata.group), H5B_SNODE,
- &(udata.group->ent.cache.stab.btree_addr),
+ udata.group->ent.cache.stab.btree_addr,
&udata))<0) {
HERROR (H5E_SYM, H5E_CANTINIT, "iteration operator failed");
}
@@ -1124,7 +1124,7 @@ H5G_traverse_slink (H5G_entry_t *grp_ent/*in,out*/,
HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL,
"unable to determine local heap address");
}
- if (NULL==(clv=H5HL_peek (grp_ent->file, &(stab_mesg.heap_addr),
+ if (NULL==(clv=H5HL_peek (grp_ent->file, stab_mesg.heap_addr,
obj_ent->cache.slink.lval_offset))) {
HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL,
"unable to read symbolic link value");
@@ -1268,7 +1268,7 @@ H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint)
HRETURN_ERROR(H5E_SYM, H5E_EXISTS, NULL, "already exists");
}
H5E_clear(); /*it's OK that we didn't find it */
- assert(H5F_addr_defined(&(grp_ent.header)));
+ assert(H5F_addr_defined(grp_ent.header));
/* should be one null-terminated component left */
rest = H5G_component(rest, &nchars);
@@ -1913,7 +1913,7 @@ H5G_link (H5G_entry_t *loc, H5G_link_t type, const char *cur_name,
"unable to determine local heap address");
}
if ((size_t)(-1)==(offset=H5HL_insert (grp_ent.file,
- &(stab_mesg.heap_addr),
+ stab_mesg.heap_addr,
HDstrlen(cur_name)+1,
cur_name))) {
HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL,
@@ -2053,7 +2053,7 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link,
if (H5G_CACHED_SLINK==obj_ent.type) {
/* Named object is a symbolic link */
if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg) ||
- NULL==(s=H5HL_peek (grp_ent.file, &(stab_mesg.heap_addr),
+ NULL==(s=H5HL_peek (grp_ent.file, stab_mesg.heap_addr,
obj_ent.cache.slink.lval_offset))) {
HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL,
"unable to read symbolic link value");
@@ -2066,9 +2066,9 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link,
} else {
/* Some other type of object */
- statbuf->objno[0] = (unsigned long)(obj_ent.header.offset);
+ statbuf->objno[0] = (unsigned long)(obj_ent.header);
#if SIZEOF_UINT64_T>SIZEOF_LONG
- statbuf->objno[1] = (unsigned long)(obj_ent.header.offset >>
+ statbuf->objno[1] = (unsigned long)(obj_ent.header >>
8*sizeof(long));
#else
statbuf->objno[1] = 0;
@@ -2139,7 +2139,7 @@ H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/)
HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL,
"unable to determine local heap address");
}
- if (NULL==(s=H5HL_peek (grp_ent.file, &(stab_mesg.heap_addr),
+ if (NULL==(s=H5HL_peek (grp_ent.file, stab_mesg.heap_addr,
obj_ent.cache.slink.lval_offset))) {
HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL,
"unable to read symbolic link value");
@@ -2277,7 +2277,7 @@ H5G_unlink(H5G_entry_t *loc, const char *name)
H5G_TARGET_SLINK|H5G_TARGET_MOUNT, NULL)<0) {
HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found");
}
- if (!H5F_addr_defined(&(grp_ent.header))) {
+ if (!H5F_addr_defined(grp_ent.header)) {
HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL,
"no containing group specified");
}
diff --git a/src/H5Gent.c b/src/H5Gent.c
index f46e8a3..06ebe24 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -274,7 +274,7 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
if (ent) {
/* encode header */
H5F_encode_length(f, *pp, ent->name_off);
- H5F_addr_encode(f, pp, &(ent->header));
+ H5F_addr_encode(f, pp, ent->header);
UINT32ENCODE(*pp, ent->type);
UINT32ENCODE(*pp, 0); /*reserved*/
@@ -285,8 +285,8 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
case H5G_CACHED_STAB:
assert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH);
- H5F_addr_encode(f, pp, &(ent->cache.stab.btree_addr));
- H5F_addr_encode(f, pp, &(ent->cache.stab.heap_addr));
+ H5F_addr_encode(f, pp, ent->cache.stab.btree_addr);
+ H5F_addr_encode(f, pp, ent->cache.stab.heap_addr);
break;
case H5G_CACHED_SLINK:
@@ -297,19 +297,16 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
HDabort();
}
} else {
- haddr_t undef;
H5F_encode_length(f, *pp, 0);
- H5F_addr_undef(&undef);
- H5F_addr_encode(f, pp, &undef);
+ H5F_addr_encode(f, pp, H5F_ADDR_UNDEF);
UINT32ENCODE(*pp, H5G_NOTHING_CACHED);
UINT32ENCODE(*pp, 0); /*reserved*/
}
/* fill with zero */
- while (*pp < p_ret)
- *(*pp)++ = 0;
-
+ while (*pp < p_ret) *(*pp)++ = 0;
*pp = p_ret;
+
FUNC_LEAVE(SUCCEED);
}
@@ -327,65 +324,60 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
* Aug 29 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The HEAP argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE * stream,
- intn indent, intn fwidth, const haddr_t *heap)
+ intn indent, intn fwidth, haddr_t heap)
{
const char *lval = NULL;
FUNC_ENTER(H5G_ent_debug, FAIL);
- fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
- "Name offset into private heap:",
- (unsigned long) (ent->name_off));
+ HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
+ "Name offset into private heap:",
+ (unsigned long) (ent->name_off));
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Object header address:");
- H5F_addr_print(stream, &(ent->header));
- fprintf(stream, "\n");
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Object header address:", ent->header);
- fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Dirty:",
- ent->dirty ? "Yes" : "No");
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Symbol type:");
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Dirty:",
+ ent->dirty ? "Yes" : "No");
+ HDfprintf(stream, "%*s%-*s ", indent, "", fwidth,
+ "Symbol type:");
switch (ent->type) {
case H5G_NOTHING_CACHED:
- fprintf(stream, "Nothing Cached\n");
+ HDfprintf(stream, "Nothing Cached\n");
break;
case H5G_CACHED_STAB:
- fprintf(stream, "Symbol Table\n");
+ HDfprintf(stream, "Symbol Table\n");
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "B-tree address:");
- H5F_addr_print(stream, &(ent->cache.stab.btree_addr));
- fprintf(stream, "\n");
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "B-tree address:", ent->cache.stab.btree_addr);
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Heap address:");
- H5F_addr_print(stream, &(ent->cache.stab.heap_addr));
- fprintf(stream, "\n");
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Heap address:", ent->cache.stab.heap_addr);
break;
case H5G_CACHED_SLINK:
- fprintf (stream, "Symbolic Link\n");
- fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
- "Link value offset:",
- (unsigned long)(ent->cache.slink.lval_offset));
- if (heap && H5F_addr_defined (heap)) {
+ HDfprintf (stream, "Symbolic Link\n");
+ HDfprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
+ "Link value offset:",
+ (unsigned long)(ent->cache.slink.lval_offset));
+ if (H5F_addr_defined(heap)) {
lval = H5HL_peek (ent->file, heap, ent->cache.slink.lval_offset);
- fprintf (stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Link value:",
- lval);
+ HDfprintf (stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Link value:",
+ lval);
}
break;
default:
- fprintf(stream, "*** Unknown symbol type %d\n", ent->type);
+ HDfprintf(stream, "*** Unknown symbol type %d\n", ent->type);
break;
}
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 091dfe3..e28ecb3 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -41,35 +41,34 @@ static herr_t H5G_node_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
static size_t 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,
- haddr_t *addr/*out*/);
-static herr_t H5G_node_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr,
+ haddr_t *addr_p/*out*/);
+static herr_t H5G_node_flush(H5F_t *f, hbool_t destroy, haddr_t addr,
H5G_node_t *sym);
-static H5G_node_t *H5G_node_load(H5F_t *f, const haddr_t *addr,
- const void *_udata1, void *_udata2);
+static H5G_node_t *H5G_node_load(H5F_t *f, haddr_t addr, const void *_udata1,
+ void *_udata2);
static intn H5G_node_cmp2(H5F_t *f, void *_lt_key, void *_udata,
void *_rt_key);
static intn 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);
-static H5B_ins_t H5G_node_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,
- haddr_t *new_node/*out*/);
-static H5B_ins_t H5G_node_remove(H5F_t *f, const haddr_t *addr, void *lt_key,
+static herr_t H5G_node_found(H5F_t *f, haddr_t addr, const void *_lt_key,
+ void *_udata, const void *_rt_key);
+static H5B_ins_t H5G_node_insert(H5F_t *f, haddr_t addr, void *_lt_key,
+ hbool_t *lt_key_changed, void *_md_key,
+ void *_udata, void *_rt_key,
+ hbool_t *rt_key_changed,
+ haddr_t *new_node_p/*out*/);
+static H5B_ins_t H5G_node_remove(H5F_t *f, haddr_t addr, void *lt_key,
hbool_t *lt_key_changed, void *udata,
void *rt_key, hbool_t *rt_key_changed);
-static herr_t H5G_node_iterate(H5F_t *f, void *_lt_key, const haddr_t *addr,
+static herr_t H5G_node_iterate(H5F_t *f, void *_lt_key, haddr_t addr,
void *_rt_key, void *_udata);
static size_t H5G_node_sizeof_rkey(H5F_t *f, const void *_udata);
/* H5G inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_SNODE[1] = {{
H5AC_SNODE_ID,
- (void *(*)(H5F_t*, const haddr_t*, const void*, void*))H5G_node_load,
- (herr_t (*)(H5F_t*, hbool_t, const haddr_t*, void*))H5G_node_flush,
+ (void *(*)(H5F_t*, haddr_t, const void*, void*))H5G_node_load,
+ (herr_t (*)(H5F_t*, hbool_t, haddr_t, void*))H5G_node_flush,
}};
/* H5G inherits B-tree like properties from H5B */
@@ -218,8 +217,8 @@ H5G_node_size(H5F_t *f)
* is also called internally to split a symbol node with LT_KEY
* and RT_KEY null pointers.
*
- * Return: Success: Non-negative. The address of symbol table node is
- * returned through the ADDR argument.
+ * Return: Success: Non-negative. The address of symbol table
+ * node is returned through the ADDR_P argument.
*
* Failure: Negative
*
@@ -233,7 +232,7 @@ H5G_node_size(H5F_t *f)
*/
static herr_t
H5G_node_create(H5F_t *f, H5B_ins_t UNUSED op, void *_lt_key,
- void UNUSED *_udata, void *_rt_key, haddr_t *addr/*out*/)
+ void UNUSED *_udata, void *_rt_key, haddr_t *addr_p/*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;
@@ -253,7 +252,7 @@ H5G_node_create(H5F_t *f, H5B_ins_t UNUSED op, void *_lt_key,
"memory allocation failed");
}
size = H5G_node_size(f);
- if (H5MF_alloc(f, H5MF_META, size, addr/*out*/) < 0) {
+ if (H5MF_alloc(f, H5MF_META, size, addr_p/*out*/) < 0) {
H5MM_xfree(sym);
HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
"unable to allocate file space");
@@ -265,7 +264,7 @@ H5G_node_create(H5F_t *f, H5B_ins_t UNUSED op, void *_lt_key,
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
- if (H5AC_set(f, H5AC_SNODE, addr, sym) < 0) {
+ if (H5AC_set(f, H5AC_SNODE, *addr_p, sym) < 0) {
H5MM_xfree(sym->entry);
H5MM_xfree(sym);
HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
@@ -296,13 +295,15 @@ H5G_node_create(H5F_t *f, H5B_ins_t UNUSED op, void *_lt_key,
* Jun 23 1997
*
* Modifications:
- * rky 980828 Only p0 writes metadata to disk.
+ * rky, 1998-08-28
+ * Only p0 writes metadata to disk.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr,
- H5G_node_t *sym)
+H5G_node_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5G_node_t *sym)
{
uint8_t *buf = NULL, *p = NULL;
size_t size;
@@ -315,7 +316,7 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr,
* Check arguments.
*/
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(sym);
/*
@@ -387,11 +388,12 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr,
* Jun 23 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static H5G_node_t *
-H5G_node_load(H5F_t *f, const haddr_t *addr, const void UNUSED *_udata1,
+H5G_node_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1,
void UNUSED *_udata2)
{
H5G_node_t *sym = NULL;
@@ -406,7 +408,7 @@ H5G_node_load(H5F_t *f, const haddr_t *addr, const void UNUSED *_udata1,
* Check arguments.
*/
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(!_udata1);
assert(NULL == _udata2);
@@ -504,11 +506,11 @@ H5G_node_cmp2(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
assert(lt_key);
assert(rt_key);
- if (NULL == (s1 = H5HL_peek(f, &(udata->heap_addr), lt_key->offset))) {
+ if (NULL == (s1 = H5HL_peek(f, udata->heap_addr, lt_key->offset))) {
HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL,
"unable to read symbol name");
}
- if (NULL == (s2 = H5HL_peek(f, &(udata->heap_addr), rt_key->offset))) {
+ if (NULL == (s2 = H5HL_peek(f, udata->heap_addr, rt_key->offset))) {
HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL,
"unable to read symbol name");
}
@@ -556,7 +558,7 @@ H5G_node_cmp3(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
FUNC_ENTER(H5G_node_cmp3, FAIL);
/* left side */
- if (NULL == (s = H5HL_peek(f, &(udata->heap_addr), lt_key->offset))) {
+ if (NULL == (s = H5HL_peek(f, udata->heap_addr, lt_key->offset))) {
HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL,
"unable to read symbol name");
}
@@ -564,7 +566,7 @@ H5G_node_cmp3(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
HRETURN(-1);
/* right side */
- if (NULL == (s = H5HL_peek(f, &(udata->heap_addr), rt_key->offset))) {
+ if (NULL == (s = H5HL_peek(f, udata->heap_addr, rt_key->offset))) {
HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL,
"unable to read symbol name");
}
@@ -600,11 +602,12 @@ H5G_node_cmp3(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
* Jun 23 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_found(H5F_t *f, const haddr_t *addr, const void UNUSED *_lt_key,
+H5G_node_found(H5F_t *f, 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;
@@ -619,7 +622,7 @@ H5G_node_found(H5F_t *f, const haddr_t *addr, const void UNUSED *_lt_key,
* Check arguments.
*/
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(bt_udata);
/*
@@ -636,7 +639,7 @@ H5G_node_found(H5F_t *f, const haddr_t *addr, const void UNUSED *_lt_key,
rt = sn->nsyms;
while (lt < rt && cmp) {
idx = (lt + rt) / 2;
- if (NULL == (s = H5HL_peek(f, &(bt_udata->heap_addr),
+ if (NULL == (s = H5HL_peek(f, bt_udata->heap_addr,
sn->entry[idx].name_off))) {
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL,
"unable to read symbol name");
@@ -696,11 +699,11 @@ H5G_node_found(H5F_t *f, const haddr_t *addr, const void UNUSED *_lt_key,
* Return: Success: An insertion command for the caller, one of
* the H5B_INS_* constants. The address of the
* new node, if any, is returned through the
- * NEW_NODE argument. NEW_NODE might not be
+ * NEW_NODE_P argument. NEW_NODE_P might not be
* initialized if the return value is
* H5B_INS_NOOP.
*
- * Failure: H5B_INS_ERROR, NEW_NODE might not be
+ * Failure: H5B_INS_ERROR, NEW_NODE_P might not be
* initialized.
*
* Programmer: Robb Matzke
@@ -708,14 +711,15 @@ H5G_node_found(H5F_t *f, const haddr_t *addr, const void UNUSED *_lt_key,
* Jun 24 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5G_node_insert(H5F_t *f, const haddr_t *addr, void UNUSED *_lt_key,
+H5G_node_insert(H5F_t *f, 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)
+ void *_udata, void *_rt_key, hbool_t UNUSED *rt_key_changed,
+ haddr_t *new_node_p)
{
H5G_node_key_t *md_key = (H5G_node_key_t *) _md_key;
H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key;
@@ -735,11 +739,11 @@ H5G_node_insert(H5F_t *f, const haddr_t *addr, void UNUSED *_lt_key,
* Check arguments.
*/
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(md_key);
assert(rt_key);
assert(bt_udata);
- assert(new_node);
+ assert(new_node_p);
/*
* Load the symbol node.
@@ -755,7 +759,7 @@ H5G_node_insert(H5F_t *f, const haddr_t *addr, void UNUSED *_lt_key,
rt = sn->nsyms;
while (lt < rt) {
idx = (lt + rt) / 2;
- if (NULL == (s = H5HL_peek(f, &(bt_udata->heap_addr),
+ if (NULL == (s = H5HL_peek(f, bt_udata->heap_addr,
sn->entry[idx].name_off))) {
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR,
"unable to read symbol name");
@@ -776,7 +780,7 @@ H5G_node_insert(H5F_t *f, const haddr_t *addr, void UNUSED *_lt_key,
/*
* Add the new name to the heap.
*/
- offset = H5HL_insert(f, &(bt_udata->heap_addr), HDstrlen(bt_udata->name)+1,
+ offset = H5HL_insert(f, bt_udata->heap_addr, HDstrlen(bt_udata->name)+1,
bt_udata->name);
bt_udata->ent.name_off = offset;
if (0==offset || (size_t)(-1)==offset) {
@@ -793,11 +797,11 @@ H5G_node_insert(H5F_t *f, const haddr_t *addr, void UNUSED *_lt_key,
/* The right node */
if (H5G_node_create(f, H5B_INS_FIRST, NULL, NULL, NULL,
- new_node/*out*/)<0) {
+ new_node_p/*out*/)<0) {
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR,
"unable to split symbol table node");
}
- if (NULL == (snrt = H5AC_find(f, H5AC_SNODE, new_node, NULL, NULL))) {
+ if (NULL==(snrt=H5AC_find(f, H5AC_SNODE, *new_node_p, NULL, NULL))) {
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR,
"unable to split symbol table node");
}
@@ -876,11 +880,12 @@ H5G_node_insert(H5F_t *f, const haddr_t *addr, void UNUSED *_lt_key,
* Thursday, September 24, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5G_node_remove(H5F_t *f, const haddr_t *addr, void *_lt_key/*in,out*/,
+H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/,
hbool_t UNUSED *lt_key_changed/*out*/,
void *_udata/*in,out*/, void *_rt_key/*in,out*/,
hbool_t *rt_key_changed/*out*/)
@@ -897,7 +902,7 @@ H5G_node_remove(H5F_t *f, const haddr_t *addr, void *_lt_key/*in,out*/,
/* Check arguments */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(lt_key);
assert(rt_key);
assert(bt_udata);
@@ -912,7 +917,7 @@ H5G_node_remove(H5F_t *f, const haddr_t *addr, void *_lt_key/*in,out*/,
rt = sn->nsyms;
while (lt<rt && cmp) {
idx = (lt+rt)/2;
- if (NULL==(s=H5HL_peek(f, &(bt_udata->heap_addr),
+ if (NULL==(s=H5HL_peek(f, bt_udata->heap_addr,
sn->entry[idx].name_off))) {
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR,
"unable to read symbol name");
@@ -928,16 +933,16 @@ H5G_node_remove(H5F_t *f, const haddr_t *addr, void *_lt_key/*in,out*/,
if (H5G_CACHED_SLINK==sn->entry[idx].type) {
/* Remove the symbolic link value */
- if ((s=H5HL_peek(f, &(bt_udata->heap_addr),
+ if ((s=H5HL_peek(f, bt_udata->heap_addr,
sn->entry[idx].cache.slink.lval_offset))) {
- H5HL_remove(f, &(bt_udata->heap_addr),
+ H5HL_remove(f, bt_udata->heap_addr,
sn->entry[idx].cache.slink.lval_offset,
HDstrlen(s)+1);
}
H5E_clear(); /*no big deal*/
} else {
/* Decrement the reference count */
- assert(H5F_addr_defined(&(sn->entry[idx].header)));
+ assert(H5F_addr_defined(sn->entry[idx].header));
if (H5O_link(sn->entry+idx, -1)<0) {
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR,
"unable to decrement object link count");
@@ -945,8 +950,8 @@ H5G_node_remove(H5F_t *f, const haddr_t *addr, void *_lt_key/*in,out*/,
}
/* Remove the name from the local heap */
- if ((s=H5HL_peek(f, &(bt_udata->heap_addr), sn->entry[idx].name_off))) {
- H5HL_remove(f, &(bt_udata->heap_addr), sn->entry[idx].name_off,
+ if ((s=H5HL_peek(f, bt_udata->heap_addr, sn->entry[idx].name_off))) {
+ H5HL_remove(f, bt_udata->heap_addr, sn->entry[idx].name_off,
HDstrlen(s)+1);
}
H5E_clear(); /*no big deal*/
@@ -1031,11 +1036,12 @@ H5G_node_remove(H5F_t *f, const haddr_t *addr, void *_lt_key/*in,out*/,
* Jun 24 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_iterate (H5F_t *f, void UNUSED *_lt_key, const haddr_t *addr,
+H5G_node_iterate (H5F_t *f, void UNUSED *_lt_key, haddr_t addr,
void UNUSED *_rt_key, void *_udata)
{
H5G_bt_ud2_t *bt_udata = (H5G_bt_ud2_t *)_udata;
@@ -1052,7 +1058,7 @@ H5G_node_iterate (H5F_t *f, void UNUSED *_lt_key, const haddr_t *addr,
* Check arguments.
*/
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(bt_udata);
/*
@@ -1078,7 +1084,7 @@ H5G_node_iterate (H5F_t *f, void UNUSED *_lt_key, const haddr_t *addr,
if (bt_udata->skip>0) {
--bt_udata->skip;
} else {
- name = H5HL_peek (f, &(bt_udata->group->ent.cache.stab.heap_addr),
+ name = H5HL_peek (f, bt_udata->group->ent.cache.stab.heap_addr,
name_off[i]);
assert (name);
n = HDstrlen (name);
@@ -1119,12 +1125,13 @@ H5G_node_iterate (H5F_t *f, void UNUSED *_lt_key, const haddr_t *addr,
* Aug 4 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR and HEAP arguments are passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5G_node_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
- intn fwidth, const haddr_t *heap)
+H5G_node_debug(H5F_t *f, haddr_t addr, FILE * stream, intn indent,
+ intn fwidth, haddr_t heap)
{
int i;
H5G_node_t *sn = NULL;
@@ -1137,7 +1144,7 @@ H5G_node_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
* Check arguments.
*/
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(stream);
assert(indent >= 0);
assert(fwidth >= 0);
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 3920d55..d777c79 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -155,8 +155,8 @@ __DLL__ herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp,
/*
* These functions operate on symbol table nodes.
*/
-__DLL__ herr_t H5G_node_debug(H5F_t *f, const haddr_t *addr, FILE * stream,
- intn indent, intn fwidth, const haddr_t *heap);
+__DLL__ herr_t H5G_node_debug(H5F_t *f, haddr_t addr, FILE *stream,
+ intn indent, intn fwidth, haddr_t heap);
/*
* These functions operate on symbol table entries. They're used primarily
@@ -166,5 +166,5 @@ __DLL__ herr_t H5G_node_debug(H5F_t *f, const haddr_t *addr, FILE * stream,
__DLL__ H5G_cache_t *H5G_ent_cache(H5G_entry_t *ent, H5G_type_t *cache_type);
__DLL__ herr_t H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type);
__DLL__ herr_t H5G_ent_debug(H5F_t *f, const H5G_entry_t *ent, FILE * stream,
- intn indent, intn fwidth, const haddr_t *heap);
+ intn indent, intn fwidth, haddr_t heap);
#endif
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 773c564..2b48712 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -63,7 +63,7 @@ H5G_stab_create(H5F_t *f, size_t init, H5G_entry_t *self/*out*/)
if (H5HL_create(f, init, &(stab.heap_addr)/*out*/)<0) {
HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap");
}
- name = H5HL_insert(f, &(stab.heap_addr), 1, "");
+ name = H5HL_insert(f, stab.heap_addr, 1, "");
if ((size_t)(-1)==name) {
HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't initialize heap");
}
@@ -75,7 +75,7 @@ H5G_stab_create(H5F_t *f, size_t init, H5G_entry_t *self/*out*/)
assert(0 == name);
/* Create the B-tree */
- if (H5B_create(f, H5B_SNODE, NULL, &(stab.btree_addr) /*out */ ) < 0) {
+ if (H5B_create(f, H5B_SNODE, NULL, &(stab.btree_addr)/*out*/) < 0) {
HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree");
}
@@ -84,7 +84,7 @@ H5G_stab_create(H5F_t *f, size_t init, H5G_entry_t *self/*out*/)
* since nothing refers to it yet. The link count will be
* incremented if the object is added to the group directed graph.
*/
- if (H5O_create(f, 4 + 2 * H5F_SIZEOF_ADDR(f), self /*out */ ) < 0) {
+ if (H5O_create(f, 4 + 2 * H5F_SIZEOF_ADDR(f), self/*out*/) < 0) {
HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header");
}
@@ -146,7 +146,7 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
udata.heap_addr = stab.heap_addr;
/* search the B-tree */
- if (H5B_find(grp_ent->file, H5B_SNODE, &(stab.btree_addr), &udata) < 0) {
+ if (H5B_find(grp_ent->file, H5B_SNODE, stab.btree_addr, &udata) < 0) {
HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found");
}
if (obj_ent) *obj_ent = udata.ent;
@@ -200,7 +200,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent)
udata.ent = *obj_ent;
/* insert */
- if (H5B_insert(grp_ent->file, H5B_SNODE, &(stab.btree_addr), split_ratios,
+ if (H5B_insert(grp_ent->file, H5B_SNODE, stab.btree_addr, split_ratios,
&udata) < 0) {
HRETURN_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry");
}
@@ -245,7 +245,7 @@ H5G_stab_remove(H5G_entry_t *grp_ent, const char *name)
HDmemset(&(udata.ent), 0, sizeof(udata.ent));
/* remove */
- if (H5B_remove(grp_ent->file, H5B_SNODE, &(stab.btree_addr), &udata)<0) {
+ if (H5B_remove(grp_ent->file, H5B_SNODE, stab.btree_addr, &udata)<0) {
HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to remove entry");
}
diff --git a/src/H5HG.c b/src/H5HG.c
index afd6230..bfafd46 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -49,9 +49,9 @@ struct H5HG_heap_t {
};
/* PRIVATE PROTOTYPES */
-static H5HG_heap_t *H5HG_load(H5F_t *f, const haddr_t *addr,
- const void *udata1, void *udata2);
-static herr_t H5HG_flush(H5F_t *f, hbool_t dest, const haddr_t *addr,
+static H5HG_heap_t *H5HG_load(H5F_t *f, haddr_t addr, const void *udata1,
+ void *udata2);
+static herr_t H5HG_flush(H5F_t *f, hbool_t dest, haddr_t addr,
H5HG_heap_t *heap);
/*
@@ -59,8 +59,8 @@ static herr_t H5HG_flush(H5F_t *f, hbool_t dest, const haddr_t *addr,
*/
static const H5AC_class_t H5AC_GHEAP[1] = {{
H5AC_GHEAP_ID,
- (void *(*)(H5F_t*, const haddr_t*, const void*, void*))H5HG_load,
- (herr_t (*)(H5F_t*, hbool_t, const haddr_t*, void*))H5HG_flush,
+ (void *(*)(H5F_t*, haddr_t, const void*, void*))H5HG_load,
+ (herr_t (*)(H5F_t*, hbool_t, haddr_t, void*))H5HG_flush,
}};
/* Interface initialization */
@@ -156,7 +156,7 @@ H5HG_create (H5F_t *f, size_t size)
HDmemset (p, 0, (size_t)((heap->chunk+heap->size) - p));
/* Add the heap to the cache */
- if (H5AC_set (f, H5AC_GHEAP, &addr, heap)<0) {
+ if (H5AC_set (f, H5AC_GHEAP, addr, heap)<0) {
HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, NULL,
"unable to cache global heap collection");
}
@@ -202,11 +202,12 @@ H5HG_create (H5F_t *f, size_t size)
* Friday, March 27, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static H5HG_heap_t *
-H5HG_load (H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
+H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1,
void UNUSED *udata2)
{
H5HG_heap_t *heap = NULL;
@@ -219,7 +220,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
/* check arguments */
assert (f);
- assert (addr && H5F_addr_defined (addr));
+ assert (H5F_addr_defined (addr));
assert (!udata1);
assert (!udata2);
@@ -228,7 +229,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
- heap->addr = *addr;
+ heap->addr = addr;
if (NULL==(heap->chunk = H5MM_malloc (H5HG_MINSIZE))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
@@ -264,13 +265,13 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
* collection now.
*/
if (heap->size > H5HG_MINSIZE) {
- haddr_t next_addr = *addr;
+ haddr_t next_addr = addr;
H5F_addr_inc (&next_addr, (hsize_t)H5HG_MINSIZE);
if (NULL==(heap->chunk = H5MM_realloc (heap->chunk, heap->size))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
- if (H5F_block_read (f, &next_addr, (hsize_t)(heap->size-H5HG_MINSIZE),
+ if (H5F_block_read (f, next_addr, (hsize_t)(heap->size-H5HG_MINSIZE),
&H5F_xfer_dflt, heap->chunk+H5HG_MINSIZE)<0) {
HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL,
"unable to read global heap collection");
@@ -377,11 +378,12 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
* Friday, March 27, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5HG_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HG_heap_t *heap)
+H5HG_flush (H5F_t *f, hbool_t destroy, haddr_t addr, H5HG_heap_t *heap)
{
int i;
@@ -389,8 +391,8 @@ H5HG_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HG_heap_t *heap)
/* Check arguments */
assert (f);
- assert (addr && H5F_addr_defined (addr));
- assert (H5F_addr_eq (addr, &(heap->addr)));
+ assert (H5F_addr_defined (addr));
+ assert (H5F_addr_eq (addr, heap->addr));
assert (heap);
if (heap->dirty) {
@@ -643,7 +645,7 @@ H5HG_peek (H5F_t *f, H5HG_t *hobj)
assert (hobj);
/* Load the heap and return a pointer to the object */
- if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, &(hobj->addr), NULL, NULL))) {
+ if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) {
HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
}
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
@@ -704,7 +706,7 @@ H5HG_read (H5F_t *f, H5HG_t *hobj, void *object/*out*/)
assert (hobj);
/* Load the heap */
- if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, &(hobj->addr), NULL, NULL))) {
+ if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) {
HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
}
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
@@ -773,7 +775,7 @@ H5HG_link (H5F_t *f, H5HG_t *hobj, intn adjust)
}
/* Load the heap */
- if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, &(hobj->addr), NULL, NULL))) {
+ if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) {
HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
}
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
@@ -826,7 +828,7 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
}
/* Load the heap */
- if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, &(hobj->addr), NULL, NULL))) {
+ if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) {
HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
}
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
@@ -868,8 +870,8 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
* to the file free list.
*/
heap->dirty = FALSE;
- H5MF_xfree (f, &(heap->addr), (hsize_t)(heap->size));
- H5AC_flush (f, H5AC_GHEAP, &(heap->addr), TRUE);
+ H5MF_xfree (f, heap->addr, (hsize_t)(heap->size));
+ H5AC_flush (f, H5AC_GHEAP, heap->addr, TRUE);
heap = NULL;
} else {
/*
@@ -908,11 +910,12 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
* Mar 27, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5HG_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
+H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, intn indent,
intn fwidth)
{
int i, nused, maxobj;
@@ -926,7 +929,7 @@ H5HG_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
/* check arguments */
assert(f);
- assert(addr && H5F_addr_defined (addr));
+ assert(H5F_addr_defined (addr));
assert(stream);
assert(indent >= 0);
assert(fwidth >= 0);
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index feeedd2..c46000e 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -104,7 +104,7 @@ __DLL__ void *H5HG_peek(H5F_t *f, H5HG_t *hobj);
__DLL__ void *H5HG_read(H5F_t *f, H5HG_t *hobj, void *object);
__DLL__ intn H5HG_link(H5F_t *f, H5HG_t *hobj, intn adjust);
__DLL__ herr_t H5HG_remove(H5F_t *f, H5HG_t *hobj);
-__DLL__ herr_t H5HG_debug(H5F_t *f, const haddr_t *addr, FILE *stream,
- intn indent, intn fwidth);
+__DLL__ herr_t H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, intn indent,
+ intn fwidth);
#endif
diff --git a/src/H5HL.c b/src/H5HL.c
index 5d29678..01f0a13 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -46,18 +46,17 @@ typedef struct H5HL_t {
} H5HL_t;
/* PRIVATE PROTOTYPES */
-static H5HL_t *H5HL_load(H5F_t *f, const haddr_t *addr, const void *udata1,
+static H5HL_t *H5HL_load(H5F_t *f, haddr_t addr, const void *udata1,
void *udata2);
-static herr_t H5HL_flush(H5F_t *f, hbool_t dest, const haddr_t *addr,
- H5HL_t *heap);
+static herr_t H5HL_flush(H5F_t *f, hbool_t dest, haddr_t addr, H5HL_t *heap);
/*
* H5HL inherits cache-like properties from H5AC
*/
static const H5AC_class_t H5AC_LHEAP[1] = {{
H5AC_LHEAP_ID,
- (void *(*)(H5F_t*, const haddr_t*, const void*, void*))H5HL_load,
- (herr_t (*)(H5F_t*, hbool_t, const haddr_t*, void*))H5HL_flush,
+ (void *(*)(H5F_t*, haddr_t, const void*, void*))H5HL_load,
+ (herr_t (*)(H5F_t*, hbool_t, haddr_t, void*))H5HL_flush,
}};
/* Interface initialization */
@@ -93,7 +92,7 @@ static intn interface_initialize_g = 0;
*-------------------------------------------------------------------------
*/
herr_t
-H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr/*out*/)
+H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/)
{
H5HL_t *heap = NULL;
size_t total_size; /*total heap size on disk */
@@ -103,7 +102,7 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr/*out*/)
/* check arguments */
assert(f);
- assert(addr);
+ assert(addr_p);
if (size_hint && size_hint < H5HL_SIZEOF_FREE(f)) {
size_hint = H5HL_SIZEOF_FREE(f);
@@ -112,8 +111,8 @@ 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, (hsize_t)total_size, addr/*out*/) < 0) {
- H5F_addr_undef (addr);
+ if (H5MF_alloc(f, H5MF_META, (hsize_t)total_size, addr_p/*out*/) < 0) {
+ H5F_addr_undef(addr_p);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"unable to allocate file memory");
}
@@ -123,7 +122,7 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr/*out*/)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
- heap->addr = *addr;
+ heap->addr = *addr_p;
H5F_addr_inc(&(heap->addr), (hsize_t)H5HL_SIZEOF_HDR(f));
heap->disk_alloc = size_hint;
heap->mem_alloc = size_hint;
@@ -147,7 +146,7 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr/*out*/)
/* add to cache */
heap->dirty = 1;
- if (H5AC_set(f, H5AC_LHEAP, addr, heap) < 0) {
+ if (H5AC_set(f, H5AC_LHEAP, *addr_p, heap) < 0) {
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL,
"unable to cache heap");
}
@@ -155,8 +154,8 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr/*out*/)
done:
if (ret_value<0) {
- if (H5F_addr_defined (addr)) {
- H5MF_xfree (f, addr, total_size);
+ if (H5F_addr_defined(*addr_p)) {
+ H5MF_xfree (f, *addr_p, total_size);
}
if (heap) {
H5MM_xfree (heap->chunk);
@@ -181,11 +180,12 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr/*out*/)
* Jul 17 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static H5HL_t *
-H5HL_load(H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
+H5HL_load(H5F_t *f, haddr_t addr, const void UNUSED *udata1,
void UNUSED *udata2)
{
uint8_t hdr[52];
@@ -199,7 +199,7 @@ H5HL_load(H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
/* check arguments */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(H5HL_SIZEOF_HDR(f) <= sizeof hdr);
assert(!udata1);
assert(!udata2);
@@ -244,7 +244,7 @@ H5HL_load(H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
"memory allocation failed");
}
if (heap->disk_alloc &&
- H5F_block_read(f, &(heap->addr), (hsize_t)(heap->disk_alloc),
+ H5F_block_read(f, heap->addr, (hsize_t)(heap->disk_alloc),
&H5F_xfer_dflt, heap->chunk + H5HL_SIZEOF_HDR(f)) < 0) {
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL,
"unable to read heap data");
@@ -304,12 +304,15 @@ H5HL_load(H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
* Jul 17 1997
*
* Modifications:
- * rky 980828 Only p0 writes metadata to disk.
+ * rky, 1998-08-28
+ * Only p0 writes metadata to disk.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5HL_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HL_t *heap)
+H5HL_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5HL_t *heap)
{
uint8_t *p = heap->chunk;
H5HL_free_t *fl = heap->freelist;
@@ -319,7 +322,7 @@ H5HL_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HL_t *heap)
/* check arguments */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(heap);
if (heap->dirty) {
@@ -336,7 +339,7 @@ H5HL_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HL_t *heap)
"unable to allocate file space for heap");
}
heap->addr = new_addr;
- H5MF_xfree(f, &old_addr, (hsize_t)(heap->disk_alloc));
+ H5MF_xfree(f, old_addr, (hsize_t)(heap->disk_alloc));
H5E_clear(); /*don't really care if the free failed */
heap->disk_alloc = heap->mem_alloc;
}
@@ -352,7 +355,7 @@ H5HL_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HL_t *heap)
*p++ = 0; /*reserved*/
H5F_encode_length(f, p, heap->mem_alloc);
H5F_encode_length(f, p, fl ? fl->offset : H5HL_FREE_NULL);
- H5F_addr_encode(f, &p, &(heap->addr));
+ H5F_addr_encode(f, &p, heap->addr);
/*
* Write the free list.
@@ -372,9 +375,9 @@ H5HL_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HL_t *heap)
/*
* Copy buffer to disk.
*/
- hdr_end_addr = *addr;
+ hdr_end_addr = addr;
H5F_addr_inc(&hdr_end_addr, (hsize_t)H5HL_SIZEOF_HDR(f));
- if (H5F_addr_eq(&(heap->addr), &hdr_end_addr)) {
+ if (H5F_addr_eq(heap->addr, hdr_end_addr)) {
/* The header and data are contiguous */
#ifdef HAVE_PARALLEL
H5F_mpio_tas_allsame( f->shared->lf, TRUE ); /* only p0 writes */
@@ -397,7 +400,7 @@ H5HL_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HL_t *heap)
#ifdef HAVE_PARALLEL
H5F_mpio_tas_allsame( f->shared->lf, TRUE ); /* only p0 writes */
#endif /* HAVE_PARALLEL */
- if (H5F_block_write(f, &(heap->addr), (hsize_t)(heap->disk_alloc),
+ if (H5F_block_write(f, heap->addr, (hsize_t)(heap->disk_alloc),
&H5F_xfer_dflt,
heap->chunk + H5HL_SIZEOF_HDR(f)) < 0) {
HRETURN_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL,
@@ -446,11 +449,12 @@ H5HL_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HL_t *heap)
* Jul 16 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
void *
-H5HL_read(H5F_t *f, const haddr_t *addr, size_t offset, size_t size, void *buf)
+H5HL_read(H5F_t *f, haddr_t addr, size_t offset, size_t size, void *buf)
{
H5HL_t *heap = NULL;
@@ -458,7 +462,7 @@ H5HL_read(H5F_t *f, const haddr_t *addr, size_t offset, size_t size, void *buf)
/* check arguments */
assert(f);
- assert (addr && H5F_addr_defined(addr));
+ assert (H5F_addr_defined(addr));
if (NULL == (heap = H5AC_find(f, H5AC_LHEAP, addr, NULL, NULL))) {
HRETURN_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL,
@@ -503,11 +507,12 @@ H5HL_read(H5F_t *f, const haddr_t *addr, size_t offset, size_t size, void *buf)
* Jul 16 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
const void *
-H5HL_peek(H5F_t *f, const haddr_t *addr, size_t offset)
+H5HL_peek(H5F_t *f, haddr_t addr, size_t offset)
{
H5HL_t *heap = NULL;
const void *retval = NULL;
@@ -516,7 +521,7 @@ H5HL_peek(H5F_t *f, const haddr_t *addr, size_t offset)
/* check arguments */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
if (NULL == (heap = H5AC_find(f, H5AC_LHEAP, addr, NULL, NULL))) {
HRETURN_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
@@ -567,11 +572,12 @@ H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl)
* Jul 17 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
size_t
-H5HL_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf)
+H5HL_insert(H5F_t *f, haddr_t addr, size_t buf_size, const void *buf)
{
H5HL_t *heap = NULL;
H5HL_free_t *fl = NULL, *max_fl = NULL;
@@ -583,7 +589,7 @@ H5HL_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf)
/* check arguments */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(buf_size > 0);
assert(buf);
if (0==(f->intent & H5F_ACC_RDWR)) {
@@ -732,12 +738,12 @@ H5HL_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf)
* Jul 16 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5HL_write(H5F_t *f, const haddr_t *addr, size_t offset, size_t size,
- const void *buf)
+H5HL_write(H5F_t *f, haddr_t addr, size_t offset, size_t size, const void *buf)
{
H5HL_t *heap = NULL;
@@ -745,7 +751,7 @@ H5HL_write(H5F_t *f, const haddr_t *addr, size_t offset, size_t size,
/* check arguments */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(buf);
assert (offset==H5HL_ALIGN (offset));
if (0==(f->intent & H5F_ACC_RDWR)) {
@@ -789,11 +795,12 @@ H5HL_write(H5F_t *f, const haddr_t *addr, size_t offset, size_t size,
* Jul 16 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5HL_remove(H5F_t *f, const haddr_t *addr, size_t offset, size_t size)
+H5HL_remove(H5F_t *f, haddr_t addr, size_t offset, size_t size)
{
H5HL_t *heap = NULL;
H5HL_free_t *fl = NULL, *fl2 = NULL;
@@ -802,7 +809,7 @@ H5HL_remove(H5F_t *f, const haddr_t *addr, size_t offset, size_t size)
/* check arguments */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(size > 0);
assert (offset==H5HL_ALIGN (offset));
if (0==(f->intent & H5F_ACC_RDWR)) {
@@ -909,12 +916,12 @@ H5HL_remove(H5F_t *f, const haddr_t *addr, size_t offset, size_t size)
* Aug 1 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5HL_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
- intn fwidth)
+H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, intn indent, intn fwidth)
{
H5HL_t *h = NULL;
int i, j, overlap;
@@ -927,7 +934,7 @@ H5HL_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
/* check arguments */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(stream);
assert(indent >= 0);
assert(fwidth >= 0);
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index afb3523..915b248 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -51,15 +51,14 @@
* Library prototypes...
*/
__DLL__ herr_t H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr/*out*/);
-__DLL__ void *H5HL_read(H5F_t *f, const haddr_t *addr, size_t offset,
- size_t size, void *buf);
-__DLL__ const void *H5HL_peek(H5F_t *f, const haddr_t *addr, size_t offset);
-__DLL__ size_t H5HL_insert(H5F_t *f, const haddr_t *addr, size_t size,
+__DLL__ void *H5HL_read(H5F_t *f, haddr_t addr, size_t offset, size_t size,
+ void *buf);
+__DLL__ const void *H5HL_peek(H5F_t *f, haddr_t addr, size_t offset);
+__DLL__ size_t H5HL_insert(H5F_t *f, haddr_t addr, size_t size,
const void *buf);
-__DLL__ herr_t H5HL_write(H5F_t *f, const haddr_t *addr, size_t offset,
- size_t size, const void *buf);
-__DLL__ herr_t H5HL_remove(H5F_t *f, const haddr_t *addr, size_t offset,
- size_t size);
-__DLL__ herr_t H5HL_debug(H5F_t *f, const haddr_t *addr, FILE * stream,
- intn indent, intn fwidth);
+__DLL__ herr_t H5HL_write(H5F_t *f, haddr_t addr, size_t offset, size_t size,
+ const void *buf);
+__DLL__ herr_t H5HL_remove(H5F_t *f, haddr_t addr, size_t offset, size_t size);
+__DLL__ herr_t H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, intn indent,
+ intn fwidth);
#endif
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index dbe5078..0ac2a8d 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -33,10 +33,10 @@
#define H5I_DATASETID_HASHSIZE 64
#define H5I_OID_HASHSIZE 64
#define H5I_GROUPID_HASHSIZE 64
-#define H5I_ATTRID_HASHSIZE 64
-#define H5I_TEMPBUFID_HASHSIZE 64
-#define H5I_RAGGED_HASHSIZE 64
-#define H5I_REFID_HASHSIZE 64
+#define H5I_ATTRID_HASHSIZE 64
+#define H5I_TEMPBUFID_HASHSIZE 64
+#define H5I_RAGGED_HASHSIZE 64
+#define H5I_REFID_HASHSIZE 64
/*
* Function for freeing objects. This function will be called with an object
diff --git a/src/H5MF.c b/src/H5MF.c
index 9a12970..d78521f 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -55,7 +55,7 @@ static intn interface_initialize_g = 0;
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
+H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr_p/*out*/)
{
haddr_t tmp_addr;
intn i, found, status=-1;
@@ -70,7 +70,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
assert(f);
assert(H5MF_META == op || H5MF_RAW == op);
assert(size > 0);
- assert(addr);
+ assert(addr_p);
/* Fail if we don't have write access */
if (0==(f->intent & H5F_ACC_RDWR)) {
@@ -84,7 +84,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
*/
for (i=0, found=-1; i<f->shared->fl_nfree; i++) {
if ((status=H5F_low_alloc(f->shared->lf, op, align, thresh, size,
- f->shared->fl_free+i, addr/*out*/))>0) {
+ f->shared->fl_free+i, addr_p/*out*/))>0) {
/* Exact match found */
found = i;
break;
@@ -96,7 +96,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
if (found>=0 &&
(status=H5F_low_alloc (f->shared->lf, op, align, thresh, size,
- f->shared->fl_free+found, addr/*out*/))>0) {
+ f->shared->fl_free+found, addr_p/*out*/))>0) {
/*
* We found an exact match. Remove that block from the free list and
* use it to satisfy the request.
@@ -114,11 +114,11 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
--f->shared->fl_nfree;
HDmemmove (f->shared->fl_free+found, f->shared->fl_free+found+1,
(f->shared->fl_nfree-found) * sizeof(H5MF_free_t));
- if (H5F_addr_gt (addr, &(blk.addr))) {
+ if (H5F_addr_gt (*addr_p, blk.addr)) {
/* Free the first part of the free block */
- n = addr->offset - blk.addr.offset;
- H5MF_xfree (f, &(blk.addr), n);
- blk.addr = *addr;
+ n = *addr_p - blk.addr;
+ H5MF_xfree (f, blk.addr, n);
+ blk.addr = *addr_p;
blk.size -= n;
}
@@ -126,7 +126,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
/* Free the second part of the free block */
H5F_addr_inc (&(blk.addr), size);
blk.size -= size;
- H5MF_xfree (f, &(blk.addr), blk.size);
+ H5MF_xfree (f, blk.addr, blk.size);
}
} else {
@@ -147,30 +147,30 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
}
/* Convert from absolute to relative */
- blk.addr.offset -= f->shared->base_addr.offset;
+ blk.addr -= f->shared->base_addr;
/* Did we extend the size of the hdf5 data? */
tmp_addr = blk.addr;
H5F_addr_inc(&tmp_addr, blk.size);
- if (H5F_addr_gt(&tmp_addr, &(f->shared->hdf5_eof))) {
+ if (H5F_addr_gt(tmp_addr, f->shared->hdf5_eof)) {
f->shared->hdf5_eof = tmp_addr;
}
if ((status=H5F_low_alloc (f->shared->lf, op, align, thresh, size,
- &blk, addr/*out*/))>0) {
+ &blk, addr_p/*out*/))>0) {
/* Exact match */
} else if (0==status) {
/* Partial match */
- if (H5F_addr_gt (addr, &(blk.addr))) {
- n = addr->offset - blk.addr.offset;
- H5MF_xfree (f, &(blk.addr), n);
- blk.addr = *addr;
+ if (H5F_addr_gt (*addr_p, blk.addr)) {
+ n = *addr_p - blk.addr;
+ H5MF_xfree (f, blk.addr, n);
+ blk.addr = *addr_p;
blk.size -= n;
}
if (blk.size > size) {
H5F_addr_inc (&(blk.addr), size);
blk.size -= size;
- H5MF_xfree (f, &(blk.addr), blk.size);
+ H5MF_xfree (f, blk.addr, blk.size);
}
}
}
@@ -193,11 +193,12 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
* Jul 17 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_xfree(H5F_t *f, const haddr_t *addr, hsize_t size)
+H5MF_xfree(H5F_t *f, haddr_t addr, hsize_t size)
{
int i;
@@ -205,7 +206,7 @@ H5MF_xfree(H5F_t *f, const haddr_t *addr, hsize_t size)
/* check arguments */
assert(f);
- if (!addr || !H5F_addr_defined(addr) || 0 == size) {
+ if (!H5F_addr_defined(addr) || 0 == size) {
HRETURN(SUCCEED);
}
assert(!H5F_addr_zerop(addr));
@@ -225,14 +226,14 @@ H5MF_xfree(H5F_t *f, const haddr_t *addr, hsize_t size)
(unsigned long) f->shared->fl_free[i].size);
}
#endif
- f->shared->fl_free[i].addr = *addr;
+ f->shared->fl_free[i].addr = addr;
f->shared->fl_free[i].size = size;
break;
}
}
} else {
i = f->shared->fl_nfree++;
- f->shared->fl_free[i].addr = *addr;
+ f->shared->fl_free[i].addr = addr;
f->shared->fl_free[i].size = size;
}
FUNC_LEAVE(SUCCEED);
@@ -246,9 +247,9 @@ H5MF_xfree(H5F_t *f, const haddr_t *addr, hsize_t size)
* a new address. The chunk to change is at address ORIG_ADDR
* and is exactly ORIG_SIZE bytes (if these are zero and undef
* then this function acts like H5MF_alloc). The new size will
- * be NEW_SIZE and its address is returned though NEW_ADDR (if
+ * be NEW_SIZE and its address is returned though NEW_ADDR_P (if
* NEW_SIZE is zero then this function acts like H5MF_free and
- * an undefined address is returned for NEW_ADDR).
+ * an undefined address is returned for NEW_ADDR_P).
*
* If the new size is less than the old size then the new
* address will be the same as the old address (except for the
@@ -264,12 +265,14 @@ H5MF_xfree(H5F_t *f, const haddr_t *addr, hsize_t size)
* Thursday, April 16, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ORIG_ADDR is passed by value. The name of NEW_ADDR has
+ * been changed to NEW_ADDR_P
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_realloc (H5F_t *f, intn op, hsize_t orig_size, const haddr_t *orig_addr,
- hsize_t new_size, haddr_t *new_addr/*out*/)
+H5MF_realloc (H5F_t *f, intn op, hsize_t orig_size, haddr_t orig_addr,
+ hsize_t new_size, haddr_t *new_addr_p/*out*/)
{
FUNC_ENTER (H5MF_realloc, FAIL);
@@ -277,12 +280,12 @@ H5MF_realloc (H5F_t *f, intn op, hsize_t orig_size, const haddr_t *orig_addr,
/* Degenerate to H5MF_alloc() */
assert (!H5F_addr_defined (orig_addr));
if (new_size>0) {
- if (H5MF_alloc (f, op, new_size, new_addr/*out*/)<0) {
+ if (H5MF_alloc (f, op, new_size, new_addr_p/*out*/)<0) {
HRETURN_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL,
"unable to allocate new file memory");
}
} else {
- H5F_addr_undef (new_addr);
+ H5F_addr_undef (new_addr_p);
}
} else if (0==new_size) {
@@ -292,11 +295,11 @@ H5MF_realloc (H5F_t *f, intn op, hsize_t orig_size, const haddr_t *orig_addr,
HRETURN_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL,
"unable to free old file memory");
}
- H5F_addr_undef (new_addr);
+ H5F_addr_undef (new_addr_p);
} else if (new_size > orig_size) {
/* Size is getting larger */
- if (H5MF_alloc (f, op, new_size, new_addr/*out*/)<0) {
+ if (H5MF_alloc (f, op, new_size, new_addr_p/*out*/)<0) {
HRETURN_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL,
"unable to allocate new file memory");
}
@@ -313,7 +316,7 @@ H5MF_realloc (H5F_t *f, intn op, hsize_t orig_size, const haddr_t *orig_addr,
orig_size-new_size);
}
#endif
- *new_addr = *orig_addr;
+ *new_addr_p = orig_addr;
}
FUNC_LEAVE (SUCCEED);
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index e264121..1030dcd 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -38,9 +38,9 @@
* Library prototypes...
*/
__DLL__ herr_t H5MF_alloc(H5F_t *f, intn, hsize_t size, haddr_t *addr/*out*/);
-__DLL__ herr_t H5MF_xfree(H5F_t *f, const haddr_t *addr, hsize_t size);
+__DLL__ herr_t H5MF_xfree(H5F_t *f, haddr_t addr, hsize_t size);
__DLL__ herr_t H5MF_realloc(H5F_t *f, intn op, hsize_t orig_size,
- const haddr_t *orig_addr, hsize_t new_size,
+ haddr_t orig_addr, hsize_t new_size,
haddr_t *new_addr/*out*/);
#endif
diff --git a/src/H5O.c b/src/H5O.c
index 3001634..e65221e 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -26,11 +26,10 @@
#define PABLO_MASK H5O_mask
/* PRIVATE PROTOTYPES */
-static herr_t H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr,
- H5O_t *oh);
-static H5O_t *H5O_load(H5F_t *f, const haddr_t *addr, const void *_udata1,
+static herr_t H5O_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5O_t *oh);
+static H5O_t *H5O_load(H5F_t *f, haddr_t addr, const void *_udata1,
void *_udata2);
-static intn H5O_find_in_ohdr(H5F_t *f, const haddr_t *addr,
+static intn H5O_find_in_ohdr(H5F_t *f, haddr_t addr,
const H5O_class_t **type_p, intn sequence);
static intn H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type,
size_t size);
@@ -41,8 +40,8 @@ static herr_t H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force);
/* H5O inherits cache-like properties from H5AC */
static const H5AC_class_t H5AC_OHDR[1] = {{
H5AC_OHDR_ID,
- (void *(*)(H5F_t *, const haddr_t *, const void *, void *)) H5O_load,
- (herr_t (*)(H5F_t *, hbool_t, const haddr_t *, void *)) H5O_flush,
+ (void *(*)(H5F_t *, haddr_t, const void *, void *)) H5O_load,
+ (herr_t (*)(H5F_t *, hbool_t, haddr_t, void *)) H5O_flush,
}};
/* Interface initialization */
@@ -195,7 +194,7 @@ H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/)
oh->mesg[0].chunkno = 0;
/* cache it */
- if (H5AC_set(f, H5AC_OHDR, &(ent->header), oh) < 0) {
+ if (H5AC_set(f, H5AC_OHDR, ent->header, oh) < 0) {
H5MM_xfree(oh);
HRETURN_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL,
"unable to cache object header");
@@ -236,7 +235,7 @@ H5O_open(H5G_entry_t *obj_ent)
#ifdef H5O_DEBUG
if (H5DEBUG(O)) {
- HDfprintf(H5DEBUG(O), "> %a\n", &(obj_ent->header));
+ HDfprintf(H5DEBUG(O), "> %a\n", obj_ent->header);
}
#endif
@@ -277,10 +276,10 @@ H5O_close(H5G_entry_t *obj_ent)
if (H5DEBUG(O)) {
if (obj_ent->file->closing && 1==obj_ent->file->shared->nrefs) {
HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n",
- &(obj_ent->header),
+ obj_ent->header,
(unsigned long)(obj_ent->file->nopen_objs));
} else {
- HDfprintf(H5DEBUG(O), "< %a\n", &(obj_ent->header));
+ HDfprintf(H5DEBUG(O), "< %a\n", obj_ent->header);
}
}
#endif
@@ -313,16 +312,18 @@ H5O_close(H5G_entry_t *obj_ent)
*
* Modifications:
*
- * Robb Matzke, 30 Aug 1997
+ * Robb Matzke, 1997-08-30
* Plugged memory leaks that occur during error handling.
*
- * Robb Matzke, 7 Jan 1998
+ * Robb Matzke, 1998-01-07
* Able to distinguish between constant and variable messages.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static H5O_t *
-H5O_load(H5F_t *f, const haddr_t *addr, const void UNUSED *_udata1,
+H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1,
void UNUSED *_udata2)
{
H5O_t *oh = NULL;
@@ -340,7 +341,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void UNUSED *_udata1,
/* check args */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(!_udata1);
assert(!_udata2);
@@ -375,7 +376,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void UNUSED *_udata1,
UINT32DECODE(p, oh->nlink);
/* decode first chunk info */
- chunk_addr = *addr;
+ chunk_addr = addr;
H5F_addr_inc(&chunk_addr, (hsize_t)H5O_SIZEOF_HDR(f));
UINT32DECODE(p, chunk_size);
@@ -387,7 +388,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void UNUSED *_udata1,
}
/* read each chunk from disk */
- while (H5F_addr_defined(&chunk_addr)) {
+ while (H5F_addr_defined(chunk_addr)) {
/* increase chunk array size */
if (oh->nchunks >= oh->alloc_nchunks) {
@@ -410,7 +411,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void UNUSED *_udata1,
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
- if (H5F_block_read(f, &chunk_addr, (hsize_t)chunk_size, &H5F_xfer_dflt,
+ if (H5F_block_read(f, chunk_addr, (hsize_t)chunk_size, &H5F_xfer_dflt,
oh->chunk[chunkno].image) < 0) {
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL,
"unable to read object header data");
@@ -460,7 +461,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void UNUSED *_udata1,
/* decode next object header continuation message */
for (H5F_addr_undef(&chunk_addr);
- !H5F_addr_defined(&chunk_addr) && curmesg < oh->nmesgs;
+ !H5F_addr_defined(chunk_addr) && curmesg < oh->nmesgs;
curmesg++) {
if (H5O_CONT_ID == oh->mesg[curmesg].type->id) {
uint8_t *p2 = oh->mesg[curmesg].raw;
@@ -504,15 +505,18 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void UNUSED *_udata1,
*
* Modifications:
*
- * Robb Matzke, 7 Jan 1998
+ * Robb Matzke, 1998-01-07
* Handles constant vs non-constant messages.
*
- * rky 980828 Only p0 writes metadata to disk.
+ * rky, 1998-08-28
+ * Only p0 writes metadata to disk.
*
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
+H5O_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5O_t *oh)
{
uint8_t buf[16], *p;
intn i, id;
@@ -523,7 +527,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
/* check args */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(oh);
/* flush */
@@ -577,12 +581,12 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
/* allocate file space for chunks that have none yet */
if (H5O_CONT_ID == oh->mesg[i].type->id &&
- !H5F_addr_defined(&(((H5O_cont_t *)
- (oh->mesg[i].native))->addr))) {
+ !H5F_addr_defined(((H5O_cont_t *)(oh->mesg[i].native))
+ ->addr)) {
cont = (H5O_cont_t *) (oh->mesg[i].native);
assert(cont->chunkno >= 0);
assert(cont->chunkno < oh->nchunks);
- assert(!H5F_addr_defined(&(oh->chunk[cont->chunkno].addr)));
+ assert(!H5F_addr_defined(oh->chunk[cont->chunkno].addr));
cont->size = oh->chunk[cont->chunkno].size;
if (H5MF_alloc(f, H5MF_META, (hsize_t)(cont->size),
&(cont->addr)/*out*/) < 0) {
@@ -623,11 +627,11 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
/* write each chunk to disk */
for (i = 0; i < oh->nchunks; i++) {
if (oh->chunk[i].dirty) {
- assert(H5F_addr_defined(&(oh->chunk[i].addr)));
+ assert(H5F_addr_defined(oh->chunk[i].addr));
#ifdef HAVE_PARALLEL
H5F_mpio_tas_allsame( f->shared->lf, TRUE ); /* only p0 write */
#endif /* HAVE_PARALLEL */
- if (H5F_block_write(f, &(oh->chunk[i].addr),
+ if (H5F_block_write(f, oh->chunk[i].addr,
(hsize_t)(oh->chunk[i].size),
&H5F_xfer_dflt, oh->chunk[i].image) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL,
@@ -810,14 +814,14 @@ H5O_link(H5G_entry_t *ent, intn adjust)
/* check args */
assert(ent);
assert(ent->file);
- assert(H5F_addr_defined(&(ent->header)));
+ assert(H5F_addr_defined(ent->header));
if (adjust!=0 && 0==(ent->file->intent & H5F_ACC_RDWR)) {
HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL,
"no write intent on file");
}
/* get header */
- if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, &(ent->header),
+ if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, ent->header,
NULL, NULL))) {
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL,
"unable to load object header");
@@ -838,7 +842,7 @@ H5O_link(H5G_entry_t *ent, intn adjust)
ret_value = oh->nlink;
done:
- if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, &(ent->header), oh) < 0) {
+ if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_PROTECT, FAIL,
"unable to release object header");
}
@@ -874,12 +878,11 @@ H5O_count (H5G_entry_t *ent, const H5O_class_t *type)
/* Check args */
assert (ent);
assert (ent->file);
- assert (H5F_addr_defined (&(ent->header)));
+ assert (H5F_addr_defined(ent->header));
assert (type);
/* Load the object header */
- if (NULL==(oh=H5AC_find (ent->file, H5AC_OHDR, &(ent->header),
- NULL, NULL))) {
+ if (NULL==(oh=H5AC_find (ent->file, H5AC_OHDR, ent->header, NULL, NULL))) {
HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL,
"unable to load object header");
}
@@ -925,8 +928,7 @@ H5O_exists(H5G_entry_t *ent, const H5O_class_t *type, intn sequence)
assert(sequence>=0);
/* Load the object header */
- if (NULL==(oh=H5AC_find(ent->file, H5AC_OHDR, &(ent->header),
- NULL, NULL))) {
+ if (NULL==(oh=H5AC_find(ent->file, H5AC_OHDR, ent->header, NULL, NULL))) {
HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL,
"unable to load object header");
}
@@ -980,7 +982,7 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, intn sequence, void *mesg)
/* check args */
assert(ent);
assert(ent->file);
- assert(H5F_addr_defined(&(ent->header)));
+ assert(H5F_addr_defined(ent->header));
assert(type);
assert(sequence >= 0);
@@ -994,14 +996,14 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, intn sequence, void *mesg)
}
/* can we get it from the object header? */
- if ((idx = H5O_find_in_ohdr(ent->file, &(ent->header), &type,
+ if ((idx = H5O_find_in_ohdr(ent->file, ent->header, &type,
sequence)) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL,
"unable to find message in object header");
}
/* copy the message to the user-supplied buffer */
- if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, &(ent->header),
+ if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, ent->header,
NULL, NULL))) {
HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL,
"unable to load object header");
@@ -1056,7 +1058,7 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, intn sequence, void *mesg)
}
done:
- if (H5AC_unprotect(ent->file, H5AC_OHDR, &(ent->header), oh) < 0) {
+ if (H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_PROTECT, NULL,
"unable to release object header");
}
@@ -1080,11 +1082,12 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, intn sequence, void *mesg)
* Aug 6 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static intn
-H5O_find_in_ohdr(H5F_t *f, const haddr_t *addr, const H5O_class_t **type_p,
+H5O_find_in_ohdr(H5F_t *f, haddr_t addr, const H5O_class_t **type_p,
intn sequence)
{
H5O_t *oh = NULL;
@@ -1095,7 +1098,7 @@ H5O_find_in_ohdr(H5F_t *f, const haddr_t *addr, const H5O_class_t **type_p,
/* Check args */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(type_p);
/* Load the object header */
@@ -1193,7 +1196,7 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, intn overwrite,
/* check args */
assert(ent);
assert(ent->file);
- assert(H5F_addr_defined(&(ent->header)));
+ assert(H5F_addr_defined(ent->header));
assert(type);
assert(mesg);
assert (0==(flags & ~H5O_FLAG_BITS));
@@ -1202,7 +1205,7 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, intn overwrite,
"no write intent on file");
}
- if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, &(ent->header),
+ if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, ent->header,
NULL, NULL))) {
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL,
"unable to load object header");
@@ -1320,7 +1323,7 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, intn overwrite,
done:
H5MM_xfree(sh_mesg);
- if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, &(ent->header), oh) < 0) {
+ if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_PROTECT, FAIL,
"unable to release object header");
}
@@ -1416,14 +1419,14 @@ H5O_touch(H5G_entry_t *ent, hbool_t force)
/* check args */
assert(ent);
assert(ent->file);
- assert(H5F_addr_defined(&(ent->header)));
+ assert(H5F_addr_defined(ent->header));
if (0==(ent->file->intent & H5F_ACC_RDWR)) {
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL,
"no write intent on file");
}
/* Get the object header */
- if (NULL==(oh=H5AC_protect(ent->file, H5AC_OHDR, &(ent->header),
+ if (NULL==(oh=H5AC_protect(ent->file, H5AC_OHDR, ent->header,
NULL, NULL))) {
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL,
"unable to load object header");
@@ -1437,7 +1440,7 @@ H5O_touch(H5G_entry_t *ent, hbool_t force)
ret_value = SUCCEED;
done:
- if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, &(ent->header), oh)<0) {
+ if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh)<0) {
HRETURN_ERROR(H5E_OHDR, H5E_PROTECT, FAIL,
"unable to release object header");
}
@@ -1483,7 +1486,7 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, intn sequence)
/* check args */
assert(ent);
assert(ent->file);
- assert(H5F_addr_defined(&(ent->header)));
+ assert(H5F_addr_defined(ent->header));
assert(type);
if (0==(ent->file->intent & H5F_ACC_RDWR)) {
HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL,
@@ -1491,7 +1494,7 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, intn sequence)
}
/* load the object header */
- if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, &(ent->header),
+ if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, ent->header,
NULL, NULL))) {
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL,
"unable to load object header");
@@ -1551,7 +1554,7 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, intn sequence)
ret_value = SUCCEED;
done:
- if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, &(ent->header), oh) < 0) {
+ if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_PROTECT, FAIL,
"unable to release object header");
}
@@ -1598,7 +1601,7 @@ H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size)
assert(size > 0);
assert (size==H5O_ALIGN (size));
- if (H5F_addr_defined(&(oh->chunk[chunkno].addr))) {
+ if (H5F_addr_defined(oh->chunk[chunkno].addr)) {
HRETURN_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "chunk is on disk");
}
@@ -2061,12 +2064,12 @@ H5O_share (H5F_t *f, const H5O_class_t *type, const void *mesg,
* Aug 6 1997
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
- intn fwidth)
+H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, intn indent, intn fwidth)
{
H5O_t *oh = NULL;
intn i, chunkno;
@@ -2081,7 +2084,7 @@ H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
/* check args */
assert(f);
- assert(addr && H5F_addr_defined(addr));
+ assert(H5F_addr_defined(addr));
assert(stream);
assert(indent >= 0);
assert(fwidth >= 0);
@@ -2092,46 +2095,44 @@ H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
}
/* debug */
- fprintf(stream, "%*sObject Header...\n", indent, "");
-
- fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
- "Dirty:",
- (int) (oh->dirty));
- fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
- "Version:",
- (int) (oh->version));
- fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
- "Number of links:",
- (int) (oh->nlink));
- fprintf(stream, "%*s%-*s %d (%d)\n", indent, "", fwidth,
- "Number of messages (allocated):",
- (int) (oh->nmesgs), (int) (oh->alloc_nmesgs));
- fprintf(stream, "%*s%-*s %d (%d)\n", indent, "", fwidth,
- "Number of chunks (allocated):",
- (int) (oh->nchunks), (int) (oh->alloc_nchunks));
+ HDfprintf(stream, "%*sObject Header...\n", indent, "");
+
+ HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
+ "Dirty:",
+ (int) (oh->dirty));
+ HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
+ "Version:",
+ (int) (oh->version));
+ HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
+ "Number of links:",
+ (int) (oh->nlink));
+ HDfprintf(stream, "%*s%-*s %d (%d)\n", indent, "", fwidth,
+ "Number of messages (allocated):",
+ (int) (oh->nmesgs), (int) (oh->alloc_nmesgs));
+ HDfprintf(stream, "%*s%-*s %d (%d)\n", indent, "", fwidth,
+ "Number of chunks (allocated):",
+ (int) (oh->nchunks), (int) (oh->alloc_nchunks));
/* debug each chunk */
for (i=0, chunk_total=0; i<oh->nchunks; i++) {
chunk_total += oh->chunk[i].size;
- fprintf(stream, "%*sChunk %d...\n", indent, "", i);
+ HDfprintf(stream, "%*sChunk %d...\n", indent, "", i);
- fprintf(stream, "%*s%-*s %d\n", indent + 3, "", MAX(0, fwidth - 3),
- "Dirty:",
- (int) (oh->chunk[i].dirty));
+ HDfprintf(stream, "%*s%-*s %d\n", indent + 3, "", MAX(0, fwidth - 3),
+ "Dirty:",
+ (int) (oh->chunk[i].dirty));
- fprintf(stream, "%*s%-*s ", indent + 3, "", MAX(0, fwidth - 3),
- "Address:");
- H5F_addr_print(stream, &(oh->chunk[i].addr));
- fprintf(stream, "\n");
+ HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
+ "Address:", oh->chunk[i].addr);
- tmp_addr = *addr;
+ tmp_addr = addr;
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");
+ if (0 == i && H5F_addr_ne(oh->chunk[i].addr, tmp_addr)) {
+ HDfprintf(stream, "*** WRONG ADDRESS!\n");
}
- fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3),
- "Size in bytes:",
- (unsigned long) (oh->chunk[i].size));
+ HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3),
+ "Size in bytes:",
+ (unsigned long) (oh->chunk[i].size));
}
/* debug each message */
@@ -2141,50 +2142,50 @@ H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
}
for (i=0, mesg_total=0; i<oh->nmesgs; i++) {
mesg_total += H5O_SIZEOF_MSGHDR(f) + oh->mesg[i].raw_size;
- fprintf(stream, "%*sMessage %d...\n", indent, "", i);
+ HDfprintf(stream, "%*sMessage %d...\n", indent, "", i);
/* check for bad message id */
if (oh->mesg[i].type->id < 0 ||
oh->mesg[i].type->id >= (intn)NELMTS(message_type_g)) {
- fprintf(stream, "*** BAD MESSAGE ID 0x%04x\n",
- oh->mesg[i].type->id);
+ HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n",
+ oh->mesg[i].type->id);
continue;
}
/* message name and size */
- fprintf(stream, "%*s%-*s 0x%04x %s(%d)\n",
- indent + 3, "", MAX(0, fwidth - 3),
- "Message ID:",
- (unsigned) (oh->mesg[i].type->id),
- oh->mesg[i].type->name,
- sequence[oh->mesg[i].type->id]++);
- fprintf (stream, "%*s%-*s %s\n", indent+3, "", MAX (0, fwidth-3),
- "Shared message:",
- (oh->mesg[i].flags & H5O_FLAG_SHARED) ? "Yes" : "No");
- fprintf(stream, "%*s%-*s %s\n", indent + 3, "", MAX(0, fwidth - 3),
- "Constant:",
- (oh->mesg[i].flags & H5O_FLAG_CONSTANT) ? "Yes" : "No");
+ HDfprintf(stream, "%*s%-*s 0x%04x %s(%d)\n",
+ indent + 3, "", MAX(0, fwidth - 3),
+ "Message ID:",
+ (unsigned) (oh->mesg[i].type->id),
+ oh->mesg[i].type->name,
+ sequence[oh->mesg[i].type->id]++);
+ HDfprintf (stream, "%*s%-*s %s\n", indent+3, "", MAX (0, fwidth-3),
+ "Shared message:",
+ (oh->mesg[i].flags & H5O_FLAG_SHARED) ? "Yes" : "No");
+ HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", MAX(0, fwidth - 3),
+ "Constant:",
+ (oh->mesg[i].flags & H5O_FLAG_CONSTANT) ? "Yes" : "No");
if (oh->mesg[i].flags & ~H5O_FLAG_BITS) {
- fprintf (stream, "%*s%-*s 0x%02x\n", indent+3,"",MAX(0,fwidth-3),
- "*** ADDITIONAL UNKNOWN FLAGS --->",
- oh->mesg[i].flags & ~H5O_FLAG_BITS);
+ HDfprintf (stream, "%*s%-*s 0x%02x\n", indent+3,"",MAX(0,fwidth-3),
+ "*** ADDITIONAL UNKNOWN FLAGS --->",
+ oh->mesg[i].flags & ~H5O_FLAG_BITS);
}
- fprintf(stream, "%*s%-*s %lu bytes\n", indent+3, "", MAX(0,fwidth-3),
- "Raw size in obj header:",
- (unsigned long) (oh->mesg[i].raw_size));
- fprintf(stream, "%*s%-*s %d\n", indent + 3, "", MAX(0, fwidth - 3),
- "Chunk number:",
- (int) (oh->mesg[i].chunkno));
+ HDfprintf(stream, "%*s%-*s %lu bytes\n", indent+3, "", MAX(0,fwidth-3),
+ "Raw size in obj header:",
+ (unsigned long) (oh->mesg[i].raw_size));
+ HDfprintf(stream, "%*s%-*s %d\n", indent + 3, "", MAX(0, fwidth - 3),
+ "Chunk number:",
+ (int) (oh->mesg[i].chunkno));
chunkno = oh->mesg[i].chunkno;
if (chunkno < 0 || chunkno >= oh->nchunks) {
- fprintf(stream, "*** BAD CHUNK NUMBER\n");
+ HDfprintf(stream, "*** BAD CHUNK NUMBER\n");
}
/* check the size */
if ((oh->mesg[i].raw + oh->mesg[i].raw_size >
oh->chunk[chunkno].image + oh->chunk[chunkno].size) ||
(oh->mesg[i].raw < oh->chunk[chunkno].image)) {
- fprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n");
+ HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n");
}
/* decode the message */
@@ -2206,7 +2207,8 @@ H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
if (debug) {
(debug)(f, oh->mesg[i].native, stream, indent+3, MAX(0, fwidth-3));
} else {
- fprintf(stream, "%*sNo info for this message.\n", indent + 3, "");
+ HDfprintf(stream, "%*sNo info for this message.\n",
+ indent + 3, "");
}
/* If the message is shared then also print the pointed-to message */
@@ -2230,11 +2232,11 @@ H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
sequence = H5MM_xfree(sequence);
if (mesg_total != chunk_total) {
- fprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n");
+ HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n");
}
ret_value = SUCCEED;
- done:
+ done:
if (oh && H5AC_unprotect(f, H5AC_OHDR, addr, oh) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_PROTECT, FAIL,
"unable to release object header");
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 3d2cabf..52bc29f 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -415,7 +415,8 @@ H5O_attr_debug(H5F_t *f, const void *_mesg, FILE * stream, intn indent,
"Opened:",
(unsigned int)mesg->ent_opened);
fprintf(stream, "%*sSymbol table entry...\n", indent, "");
- H5G_ent_debug(f, &(mesg->ent), stream, indent+3, MAX(0, fwidth-3), NULL);
+ H5G_ent_debug(f, &(mesg->ent), stream, indent+3, MAX(0, fwidth-3),
+ H5F_ADDR_UNDEF);
fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Data type size:",
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index 722a0f9..997ea0d 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -117,7 +117,7 @@ H5O_cont_encode(H5F_t *f, uint8_t *p, const void *_mesg)
assert(cont);
/* encode */
- H5F_addr_encode(f, &p, &(cont->addr));
+ H5F_addr_encode(f, &p, cont->addr);
H5F_encode_length(f, p, cont->size);
FUNC_LEAVE(SUCCEED);
@@ -153,17 +153,15 @@ H5O_cont_debug(H5F_t UNUSED *f, const void *_mesg, FILE * stream,
assert(indent >= 0);
assert(fwidth >= 0);
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Continuation address:");
- H5F_addr_print(stream, &(cont->addr));
- fprintf(stream, "\n");
-
- fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
- "Continuation size in bytes:",
- (unsigned long) (cont->size));
- fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
- "Points to chunk number:",
- (int) (cont->chunkno));
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Continuation address:", cont->addr);
+
+ HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
+ "Continuation size in bytes:",
+ (unsigned long) (cont->size));
+ HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
+ "Points to chunk number:",
+ (int) (cont->chunkno));
FUNC_LEAVE(SUCCEED);
}
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 72253a7..a3d99b5 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -898,8 +898,8 @@ H5O_dtype_reset(void *_mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_dtype_get_share (H5F_t UNUSED *f, const void *_mesg,
- H5O_shared_t *sh/*out*/)
+H5O_dtype_get_share(H5F_t UNUSED *f, const void *_mesg,
+ H5O_shared_t *sh/*out*/)
{
const H5T_t *dt = (const H5T_t *)_mesg;
@@ -907,7 +907,7 @@ H5O_dtype_get_share (H5F_t UNUSED *f, const void *_mesg,
assert (dt);
assert (sh);
- if (H5F_addr_defined (&(dt->ent.header))) {
+ if (H5F_addr_defined (dt->ent.header)) {
assert (H5T_STATE_NAMED==dt->state || H5T_STATE_OPEN==dt->state);
sh->in_gh = FALSE;
sh->u.ent = dt->ent;
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 79d4058..baf0857 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -101,8 +101,8 @@ H5O_efl_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
/* Heap address */
H5F_addr_decode(f, &p, &(mesg->heap_addr));
#ifndef NDEBUG
- assert (H5F_addr_defined (&(mesg->heap_addr)));
- s = H5HL_peek (f, &(mesg->heap_addr), 0);
+ assert (H5F_addr_defined(mesg->heap_addr));
+ s = H5HL_peek (f, mesg->heap_addr, 0);
assert (s && !*s);
#endif
@@ -116,7 +116,7 @@ H5O_efl_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
for (i=0; i<mesg->nused; i++) {
/* Name */
H5F_decode_length (f, p, mesg->slot[i].name_offset);
- s = H5HL_peek (f, &(mesg->heap_addr), mesg->slot[i].name_offset);
+ s = H5HL_peek(f, mesg->heap_addr, mesg->slot[i].name_offset);
assert (s && *s);
mesg->slot[i].name = H5MM_xstrdup (s);
@@ -177,8 +177,8 @@ H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg)
UINT16ENCODE(p, mesg->nused);
/* Heap address */
- assert (H5F_addr_defined (&(mesg->heap_addr)));
- H5F_addr_encode(f, &p, &(mesg->heap_addr));
+ assert (H5F_addr_defined(mesg->heap_addr));
+ H5F_addr_encode(f, &p, mesg->heap_addr);
/* Encode file list */
for (i=0; i<mesg->nused; i++) {
@@ -186,7 +186,7 @@ H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg)
* If the name has not been added to the heap yet then do so now.
*/
if (0==mesg->slot[i].name_offset) {
- offset = H5HL_insert (f, &(mesg->heap_addr),
+ offset = H5HL_insert (f, mesg->heap_addr,
HDstrlen (mesg->slot[i].name)+1,
mesg->slot[i].name);
if ((size_t)(-1)==offset) {
@@ -401,11 +401,12 @@ H5O_efl_total_size (H5O_efl_t *efl)
* Wednesday, March 4, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5O_efl_read (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t *addr,
+H5O_efl_read (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t addr,
hsize_t size, uint8_t *buf)
{
int i, fd=-1;
@@ -417,15 +418,15 @@ H5O_efl_read (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t *addr,
/* Check args */
assert (efl && efl->nused>0);
- assert (addr && H5F_addr_defined (addr));
+ assert (H5F_addr_defined (addr));
assert (size < SIZET_MAX);
assert (buf || 0==size);
/* Find the first efl member from which to read */
for (i=0, cur=0; i<efl->nused; i++) {
if (H5O_EFL_UNLIMITED==efl->slot[i].size ||
- addr->offset < cur+efl->slot[i].size) {
- skip = addr->offset - cur;
+ addr < cur+efl->slot[i].size) {
+ skip = addr - cur;
break;
}
cur += efl->slot[i].size;
@@ -485,11 +486,12 @@ H5O_efl_read (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t *addr,
* Wednesday, March 4, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5O_efl_write (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t *addr,
+H5O_efl_write (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t addr,
hsize_t size, const uint8_t *buf)
{
int i, fd=-1;
@@ -500,15 +502,15 @@ H5O_efl_write (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t *addr,
/* Check args */
assert (efl && efl->nused>0);
- assert (addr && H5F_addr_defined (addr));
+ assert (H5F_addr_defined (addr));
assert (size < SIZET_MAX);
assert (buf || 0==size);
/* Find the first efl member in which to write */
for (i=0, cur=0; i<efl->nused; i++) {
if (H5O_EFL_UNLIMITED==efl->slot[i].size ||
- addr->offset < cur+efl->slot[i].size) {
- skip = addr->offset - cur;
+ addr < cur+efl->slot[i].size) {
+ skip = addr - cur;
break;
}
cur += efl->slot[i].size;
@@ -588,34 +590,32 @@ H5O_efl_debug(H5F_t UNUSED *f, const void *_mesg, FILE * stream,
assert(indent >= 0);
assert(fwidth >= 0);
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Heap address:");
- H5F_addr_print(stream, &(mesg->heap_addr));
- fprintf(stream, "\n");
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Heap address:", mesg->heap_addr);
- fprintf(stream, "%*s%-*s %u/%u\n", indent, "", fwidth,
- "Slots used/allocated:",
- mesg->nused, mesg->nalloc);
+ HDfprintf(stream, "%*s%-*s %u/%u\n", indent, "", fwidth,
+ "Slots used/allocated:",
+ mesg->nused, mesg->nalloc);
for (i = 0; i < mesg->nused; i++) {
sprintf (buf, "File %d", i);
- fprintf (stream, "%*s%s:\n", indent, "", buf);
+ HDfprintf (stream, "%*s%s:\n", indent, "", buf);
- fprintf(stream, "%*s%-*s \"%s\"\n", indent+3, "", MAX (fwidth-3, 0),
- "Name:",
- mesg->slot[i].name);
+ HDfprintf(stream, "%*s%-*s \"%s\"\n", indent+3, "", MAX (fwidth-3, 0),
+ "Name:",
+ mesg->slot[i].name);
- fprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0),
- "Name offset:",
- (unsigned long)(mesg->slot[i].name_offset));
+ HDfprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0),
+ "Name offset:",
+ (unsigned long)(mesg->slot[i].name_offset));
- fprintf (stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0),
- "Offset of data in file:",
- (unsigned long)(mesg->slot[i].offset));
+ HDfprintf (stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0),
+ "Offset of data in file:",
+ (unsigned long)(mesg->slot[i].offset));
- fprintf (stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0),
- "Bytes reserved for data:",
- (unsigned long)(mesg->slot[i].size));
+ HDfprintf (stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0),
+ "Bytes reserved for data:",
+ (unsigned long)(mesg->slot[i].size));
}
FUNC_LEAVE(SUCCEED);
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 6a266a3..69043d3 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -158,7 +158,7 @@ H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg)
for (i=0; i<5; i++) *p++ = 0;
/* data or B-tree address */
- H5F_addr_encode(f, &p, &(mesg->addr));
+ H5F_addr_encode(f, &p, mesg->addr);
/* dimension size */
for (i = 0; i < mesg->ndims; i++) {
@@ -276,23 +276,21 @@ H5O_layout_debug(H5F_t UNUSED *f, const void *_mesg, FILE * stream,
assert(indent >= 0);
assert(fwidth >= 0);
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- H5D_CHUNKED == mesg->type ? "B-tree address:" : "Data address:");
- H5F_addr_print(stream, &(mesg->addr));
- fprintf(stream, "\n");
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ H5D_CHUNKED == mesg->type ? "B-tree address:" : "Data address:",
+ mesg->addr);
- fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
- "Number of dimensions:",
- (unsigned long) (mesg->ndims));
+ HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
+ "Number of dimensions:",
+ (unsigned long) (mesg->ndims));
/* Size */
- fprintf(stream, "%*s%-*s {", indent, "", fwidth,
- "Size:");
+ HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Size:");
for (i = 0; i < mesg->ndims; i++) {
- fprintf(stream, "%s%lu", i ? ", " : "",
- (unsigned long) (mesg->dim[i]));
+ HDfprintf(stream, "%s%lu", i ? ", " : "",
+ (unsigned long) (mesg->dim[i]));
}
- fprintf(stream, "}\n");
+ HDfprintf(stream, "}\n");
FUNC_LEAVE(SUCCEED);
}
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 07181e0..0577a35 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -288,14 +288,14 @@ __DLL__ void *H5O_free(const H5O_class_t *type, void *mesg);
__DLL__ void *H5O_copy(const H5O_class_t *type, const void *mesg, void *dst);
__DLL__ herr_t H5O_share(H5F_t *f, const H5O_class_t *type, const void *mesg,
H5HG_t *hobj/*out*/);
-__DLL__ herr_t H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream,
- intn indent, intn fwidth);
+__DLL__ herr_t H5O_debug(H5F_t *f, haddr_t addr, FILE * stream, intn indent,
+ intn fwidth);
/* EFL operators */
__DLL__ hsize_t H5O_efl_total_size(H5O_efl_t *efl);
-__DLL__ herr_t H5O_efl_read(H5F_t *f, const H5O_efl_t *efl, haddr_t *addr,
+__DLL__ herr_t H5O_efl_read(H5F_t *f, const H5O_efl_t *efl, haddr_t addr,
hsize_t size, uint8_t *buf);
-__DLL__ herr_t H5O_efl_write(H5F_t *f, const H5O_efl_t *efl, haddr_t *addr,
+__DLL__ herr_t H5O_efl_write(H5F_t *f, const H5O_efl_t *efl, haddr_t addr,
hsize_t size, const uint8_t *buf);
/* Fill value operators */
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 5c2b0e6..da526dc 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -149,7 +149,7 @@ H5O_shared_encode (H5F_t *f, uint8_t *buf/*out*/, const void *_mesg)
*buf++ = 0; /*reserved 6*/
if (mesg->in_gh) {
- H5F_addr_encode (f, &buf, &(mesg->u.gh.addr));
+ H5F_addr_encode (f, &buf, mesg->u.gh.addr);
INT32ENCODE (buf, mesg->u.gh.idx);
} else {
H5G_ent_encode (f, &buf, &(mesg->u.ent));
@@ -225,8 +225,8 @@ H5O_shared_debug (H5F_t UNUSED *f, const void *_mesg,
"Sharing method",
"Global heap");
HDfprintf (stream, "%*s%-*s %a\n", indent, "", fwidth,
- "Collection address:",
- &(mesg->u.gh.addr));
+ "Collection address:",
+ mesg->u.gh.addr);
HDfprintf (stream, "%*s%-*s %d\n", indent, "", fwidth,
"Object ID within collection:",
mesg->u.gh.idx);
@@ -234,7 +234,8 @@ H5O_shared_debug (H5F_t UNUSED *f, const void *_mesg,
HDfprintf (stream, "%*s%-*s %s\n", indent, "", fwidth,
"Sharing method",
"Obj Hdr");
- H5G_ent_debug (f, &(mesg->u.ent), stream, indent, fwidth, NULL);
+ H5G_ent_debug (f, &(mesg->u.ent), stream, indent, fwidth,
+ H5F_ADDR_UNDEF);
}
FUNC_LEAVE (SUCCEED);
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 345e429..2d5559d 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -118,8 +118,8 @@ H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg)
assert(stab);
/* encode */
- H5F_addr_encode(f, &p, &(stab->btree_addr));
- H5F_addr_encode(f, &p, &(stab->heap_addr));
+ H5F_addr_encode(f, &p, stab->btree_addr);
+ H5F_addr_encode(f, &p, stab->heap_addr);
FUNC_LEAVE(SUCCEED);
}
@@ -262,15 +262,11 @@ H5O_stab_debug(H5F_t UNUSED *f, const void *_mesg, FILE * stream,
assert(indent >= 0);
assert(fwidth >= 0);
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "B-tree address:");
- H5F_addr_print(stream, &(stab->btree_addr));
- fprintf(stream, "\n");
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "B-tree address:", stab->btree_addr);
- fprintf(stream, "%*s%-*s ", indent, "", fwidth,
- "Name heap address:");
- H5F_addr_print(stream, &(stab->heap_addr));
- fprintf(stream, "\n");
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Name heap address:", stab->heap_addr);
FUNC_LEAVE(SUCCEED);
}
diff --git a/src/H5P.c b/src/H5P.c
index 435536a..66db566 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -1833,7 +1833,7 @@ H5Pget_family(hid_t plist_id, hsize_t *memb_size/*out*/,
/* Output args */
if (memb_size) {
- *memb_size = plist->u.fam.memb_size.offset;
+ *memb_size = plist->u.fam.memb_size;
}
if (memb_plist_id) {
assert (plist->u.fam.memb_access);
diff --git a/src/H5R.c b/src/H5R.c
index 924cef3..f8aeac7 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -159,7 +159,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
/* Set information for reference */
p=(uint8_t *)ref->oid;
H5F_addr_pack(loc->file,&addr,&sb.objno[0]);
- H5F_addr_encode(loc->file,&p,&addr);
+ H5F_addr_encode(loc->file,&p,addr);
break;
}
@@ -210,7 +210,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
/* Serialize information for dataset OID */
p=(uint8_t *)buf;
H5F_addr_pack(loc->file,&addr,&sb.objno[0]);
- H5F_addr_encode(loc->file,&p,&addr);
+ H5F_addr_encode(loc->file,&p,addr);
/* Serialize the selection */
if (H5S_select_serialize(space,p) < 0)
@@ -224,7 +224,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
/* Serialize the heap ID and index for storage in the file */
p=(uint8_t *)ref->heapid;
- H5F_addr_encode(loc->file,&p,&hobjid.addr);
+ H5F_addr_encode(loc->file,&p,hobjid.addr);
INT32ENCODE(p,hobjid.idx);
/* Free the buffer we serialized data in */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index fd18f7c..e186959 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -572,7 +572,7 @@ H5S_mpio_spaces_xfer (H5F_t *f, const struct H5O_layout_t *layout,
/* calculate the absolute base addr (i.e., the file view disp) */
disp = f->shared->base_addr;
- H5F_addr_add( &disp, &(layout->addr) );
+ H5F_addr_add(&disp, layout->addr);
f->shared->access_parms->u.mpio.disp = disp;
#ifdef H5Smpi_DEBUG
fprintf(stdout, "spaces_xfer: disp=%Hu\n", disp.offset );
@@ -590,13 +590,13 @@ H5S_mpio_spaces_xfer (H5F_t *f, const struct H5O_layout_t *layout,
HRETURN_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"transfer size overflows size_t");
if (do_write) {
err = H5F_low_write( f->shared->lf, f->shared->access_parms,
- xfer_parms, &addr, mpi_count, buf );
+ xfer_parms, addr, mpi_count, buf );
if (err) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,"MPI write failed");
}
} else {
err = H5F_low_read ( f->shared->lf, f->shared->access_parms,
- xfer_parms, &addr, mpi_count, buf );
+ xfer_parms, addr, mpi_count, buf );
if (err) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,"MPI read failed");
}
diff --git a/src/H5T.c b/src/H5T.c
index cd32e6f..de7e4b3 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -4781,7 +4781,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
* Return a transient type (locked or unlocked) or an opened named
* type.
*/
- if (H5F_addr_defined (&(new_dt->ent.header))) {
+ if (H5F_addr_defined(new_dt->ent.header)) {
if (H5O_open (&(new_dt->ent))<0) {
H5MM_xfree (new_dt);
HRETURN_ERROR (H5E_DATATYPE, H5E_CANTOPENOBJ, NULL,
@@ -4939,7 +4939,7 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type)
done:
if (ret_value<0) {
- if (H5F_addr_defined (&(type->ent.header))) {
+ if (H5F_addr_defined(type->ent.header)) {
H5O_close(&(type->ent));
H5F_addr_undef (&(type->ent.header));
}
@@ -5023,7 +5023,7 @@ H5T_close(H5T_t *dt)
* If a named type is being closed then close the object header also.
*/
if (H5T_STATE_OPEN==dt->state) {
- assert (H5F_addr_defined (&(dt->ent.header)));
+ assert (H5F_addr_defined(dt->ent.header));
if (H5O_close(&(dt->ent))<0) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to close data type object header");
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index ce4b342..446b1fb 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -316,7 +316,7 @@ herr_t H5T_vlen_disk_write(const H5F_xfer_t UNUSED *xfer_parms, H5F_t *f, void *
HRETURN_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to write VL information");
/* Get the heap information */
- H5F_addr_encode(f,&vl,&hobjid.addr);
+ H5F_addr_encode(f,&vl,hobjid.addr);
INT32ENCODE(vl,hobjid.idx);
FUNC_LEAVE (SUCCEED);
diff --git a/src/H5private.h b/src/H5private.h
index df0b852..9117c2e 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -396,11 +396,7 @@ typedef unsigned uintn;
/*
* File addresses.
*/
-typedef struct {
- uint64_t offset; /*offset within an HDF5 file */
-} haddr_t;
-
-#define H5F_ADDR_UNDEF {((uint64_t)(-1L))}
+typedef uint64_t haddr_t;
/*
* Maximum and minimum values. These should be defined in <limits.h> for the