summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-08-10 17:08:27 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-08-10 17:08:27 (GMT)
commit9d27b9765ad7d5ec04762895752bc77b8ac1ec3d (patch)
treea0e442dbb7b27f963a9ba8240db1605ca6de6615
parent61c693615a1f4f90f7654f639170eed2f3c85262 (diff)
downloadhdf5-9d27b9765ad7d5ec04762895752bc77b8ac1ec3d.zip
hdf5-9d27b9765ad7d5ec04762895752bc77b8ac1ec3d.tar.gz
hdf5-9d27b9765ad7d5ec04762895752bc77b8ac1ec3d.tar.bz2
[svn-r17313] Description:
Bring back various minor code cleanups from the file free space branch Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.8 (amazon) in debug mode Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
-rw-r--r--src/H5Apkg.h2
-rw-r--r--src/H5Bcache.c73
-rw-r--r--src/H5Dbtree.c1
-rw-r--r--src/H5Dchunk.c2
-rw-r--r--src/H5E.c2
-rw-r--r--src/H5EAdbg.c2
-rw-r--r--src/H5EAhdr.c2
-rw-r--r--src/H5Eint.c4
-rw-r--r--src/H5FD.c1
-rw-r--r--src/H5FDpublic.h19
-rw-r--r--src/H5FO.c10
-rw-r--r--src/H5FOprivate.h2
-rw-r--r--src/H5FSsection.c11
-rw-r--r--src/H5Faccum.c2
-rw-r--r--src/H5Fprivate.h1
-rw-r--r--src/H5Fpublic.h18
-rw-r--r--src/H5Gcache.c2
-rw-r--r--src/H5Gcompact.c2
-rw-r--r--src/H5Glink.c2
-rw-r--r--src/H5Gnode.c46
-rw-r--r--src/H5HFdblock.c1
-rw-r--r--src/H5HFhdr.c5
-rw-r--r--src/H5HFhuge.c10
-rw-r--r--src/H5HFiblock.c1
-rw-r--r--src/H5HFpkg.h15
-rw-r--r--src/H5HG.c14
-rw-r--r--src/H5HGcache.c3
-rw-r--r--src/H5HP.c30
-rw-r--r--src/H5Lexternal.c2
-rw-r--r--src/H5MF.c1
-rw-r--r--src/H5MFaggr.c35
-rw-r--r--src/H5MFsection.c1
-rw-r--r--src/H5O.c13
-rw-r--r--src/H5Oalloc.c8
-rw-r--r--src/H5Ocache.c2
-rw-r--r--src/H5Ocopy.c2
-rw-r--r--src/H5Odtype.c4
-rw-r--r--src/H5Pfcpl.c16
-rw-r--r--test/freespace.c1
-rw-r--r--test/mf.c19
-rw-r--r--tools/h5dump/h5dump.c26
-rw-r--r--tools/h5repack/h5repack_copy.c8
-rw-r--r--tools/h5repack/h5repack_main.c5
-rw-r--r--tools/h5repack/h5repacktst.c3
-rw-r--r--tools/h5stat/h5stat.c91
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-F.ddl1
-rw-r--r--tools/h5stat/testfiles/h5stat_filters.ddl1
-rw-r--r--tools/h5stat/testfiles/h5stat_help1.ddl7
-rw-r--r--tools/h5stat/testfiles/h5stat_help2.ddl7
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat.ddl1
-rw-r--r--tools/h5stat/testfiles/h5stat_tsohm.ddl1
51 files changed, 261 insertions, 277 deletions
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index 4216fa3..de57e79 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -74,7 +74,7 @@
/****************************/
/* Define the shared attribute structure */
typedef struct H5A_shared_t {
- unsigned version; /* Version to encode attribute with */
+ uint8_t version; /* Version to encode attribute with */
char *name; /* Attribute's name */
H5T_cset_t encoding; /* Character encoding of attribute name */
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index 99930e6..a3b49e9 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -109,7 +109,7 @@ H5B_serialize(const H5F_t *f, const H5B_t *bt)
HDassert(f);
HDassert(bt);
HDassert(bt->rc_shared);
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
p = shared->page;
@@ -131,10 +131,10 @@ H5B_serialize(const H5F_t *f, const H5B_t *bt)
H5F_addr_encode(f, &p, bt->right);
/* child keys and pointers */
- native=bt->native;
- for (u = 0; u < bt->nchildren; ++u) {
+ native = bt->native;
+ for(u = 0; u < bt->nchildren; ++u) {
/* encode the key */
- if (shared->type->encode(f, bt, p, native) < 0)
+ if(shared->type->encode(f, bt, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key")
p += shared->sizeof_rkey;
native += shared->type->sizeof_nkey;
@@ -142,9 +142,9 @@ H5B_serialize(const H5F_t *f, const H5B_t *bt)
/* encode the child address */
H5F_addr_encode(f, &p, bt->child[u]);
} /* end for */
- if(bt->nchildren>0) {
+ if(bt->nchildren > 0) {
/* Encode the final key */
- if (shared->type->encode(f, bt, p, native) < 0)
+ if(shared->type->encode(f, bt, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key")
} /* end if */
@@ -187,29 +187,29 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
HDassert(type);
HDassert(type->get_shared);
- if (NULL==(bt = H5FL_MALLOC(H5B_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(NULL == (bt = H5FL_MALLOC(H5B_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t));
- if((bt->rc_shared=(type->get_shared)(f, udata))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "can't retrieve B-tree node buffer")
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
+ if(NULL == (bt->rc_shared=(type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't retrieve B-tree node buffer")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
- if (NULL==(bt->native=H5FL_BLK_MALLOC(native_block,shared->sizeof_keys)) ||
- NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)shared->two_k)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) ||
+ NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if (H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page)<0)
+ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page)<0)
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree node")
p = shared->page;
/* magic number */
- if (HDmemcmp(p, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree signature")
p += 4;
/* node type and level */
- if (*p++ != (uint8_t)type->id)
+ if(*p++ != (uint8_t)type->id)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type")
bt->level = *p++;
@@ -221,22 +221,22 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
H5F_addr_decode(f, (const uint8_t **) &p, &(bt->right));
/* the child/key pairs */
- native=bt->native;
- for (u = 0; u < bt->nchildren; u++) {
+ native = bt->native;
+ for(u = 0; u < bt->nchildren; u++) {
/* Decode native key value */
- if ((type->decode) (f, bt, p, native) < 0)
+ if((type->decode)(f, bt, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key")
p += shared->sizeof_rkey;
native += type->sizeof_nkey;
/* Decode address value */
H5F_addr_decode(f, (const uint8_t **) &p, bt->child + u);
- }
+ } /* end for */
/* Decode final key */
- if(bt->nchildren>0) {
+ if(bt->nchildren > 0) {
/* Decode native key value */
- if ((type->decode) (f, bt, p, native) < 0)
+ if((type->decode)(f, bt, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key")
} /* end if */
@@ -244,8 +244,8 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
ret_value = bt;
done:
- if (!ret_value && bt)
- (void)H5B_dest(f,bt);
+ if(!ret_value && bt)
+ (void)H5B_dest(f, bt);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_load() */ /*lint !e818 Can't make udata a pointer to const */
@@ -286,8 +286,8 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt, uns
HDassert(shared->type);
HDassert(shared->type->encode);
- if (bt->cache_info.is_dirty) {
- if (H5B_serialize(f, bt) < 0)
+ if(bt->cache_info.is_dirty) {
+ if(H5B_serialize(f, bt) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSERIALIZE, FAIL, "unable to serialize B-tree")
/*
@@ -295,14 +295,14 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt, uns
* bother writing data for the child entries that don't exist or
* for the final unchanged children.
*/
- if (H5F_block_write(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page) < 0)
+ if(H5F_block_write(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree node to disk")
bt->cache_info.is_dirty = FALSE;
} /* end if */
- if (destroy)
- if (H5B_dest(f,bt) < 0)
+ if(destroy)
+ if(H5B_dest(f,bt) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
done:
@@ -356,9 +356,9 @@ H5B_dest(H5F_t *f, H5B_t *bt)
/* Release resources for B-tree node */
H5FL_SEQ_FREE(haddr_t, bt->child);
- (void)H5FL_BLK_FREE(native_block, bt->native);
+ bt->native = H5FL_BLK_FREE(native_block, bt->native);
H5RC_DEC(bt->rc_shared);
- (void)H5FL_FREE(H5B_t, bt);
+ bt = H5FL_FREE(H5B_t, bt);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -393,8 +393,8 @@ H5B_clear(H5F_t *f, H5B_t *bt, hbool_t destroy)
/* Reset the dirty flag. */
bt->cache_info.is_dirty = FALSE;
- if (destroy)
- if (H5B_dest(f, bt) < 0)
+ if(destroy)
+ if(H5B_dest(f, bt) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
done:
@@ -417,7 +417,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr)
+H5B_compute_size(const H5F_t UNUSED *f, const H5B_t *bt, size_t *size_ptr)
{
H5B_shared_t *shared; /* Pointer to shared B-tree info */
@@ -427,7 +427,7 @@ H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr)
HDassert(f);
HDassert(bt);
HDassert(bt->rc_shared);
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
HDassert(shared->type);
HDassert(size_ptr);
@@ -437,3 +437,4 @@ H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B_compute_size() */
+
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index 7dfc288..c9561f2 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -1464,6 +1464,7 @@ H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent
/* Reset "fake" storage info */
HDmemset(&storage, 0, sizeof(storage));
+ storage.idx_type = H5D_CHUNK_BTREE;
/* Allocate the shared structure */
if(H5D_btree_shared_create(f, &storage, ndims) < 0)
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index fa96aac..b22a097 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -374,7 +374,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_chunk_construct(H5F_t *f, H5D_t *dset)
+H5D_chunk_construct(H5F_t UNUSED *f, H5D_t *dset)
{
const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */
hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */
diff --git a/src/H5E.c b/src/H5E.c
index fa9bf58..5a80787 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -336,7 +336,7 @@ H5E_get_stack(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_get_stack)
- estack = pthread_getspecific(H5TS_errstk_key_g);
+ estack = (H5E_t *)pthread_getspecific(H5TS_errstk_key_g);
if(!estack) {
/* no associated value with current thread - create one */
diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c
index d9d0a4c..0ac4807 100644
--- a/src/H5EAdbg.c
+++ b/src/H5EAdbg.c
@@ -183,7 +183,7 @@ END_FUNC(PKG) /* end H5EA__hdr_debug() */
*/
BEGIN_FUNC(PKG, ERR,
herr_t, SUCCEED, FAIL,
-H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
+H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int indent,
int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr))
/* Local variables */
diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c
index 1e01601..f821476 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -50,8 +50,10 @@
/* Local Macros */
/****************/
+#ifndef NDEBUG
/* Max. # of bits for max. nelmts index */
#define H5EA_MAX_NELMTS_IDX_MAX 64
+#endif /* NDEBUG */
/* # of elements in a data block for a particular super block */
#define H5EA_SBLK_DBLK_NELMTS(s, m) \
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 52f8aac..831d51b 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -275,7 +275,7 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
fprintf(stream, "thread 0");
} /* end block */
#elif defined(H5_HAVE_THREADSAFE)
- fprintf(stream, "thread %lu", HDpthread_self_ulong());
+ fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong());
#else
fprintf(stream, "thread 0");
#endif
@@ -392,7 +392,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
fprintf(stream, "thread 0");
} /* end block */
#elif defined(H5_HAVE_THREADSAFE)
- fprintf(stream, "thread %lu", HDpthread_self_ulong());
+ fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong());
#else
fprintf(stream, "thread 0");
#endif
diff --git a/src/H5FD.c b/src/H5FD.c
index 4c316d1..f3b96d2 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -1717,7 +1717,6 @@ H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map)
FUNC_ENTER_NOAPI(H5FD_get_fs_type_map, FAIL)
/* Sanity check */
- HDassert(file);
HDassert(file && file->cls);
HDassert(type_map);
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index 52d7eb9..fde8556 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -26,23 +26,8 @@
#define H5_HAVE_VFL 1 /*define a convenient app feature test*/
#define H5FD_VFD_DEFAULT 0 /* Default VFL driver value */
-/*
- * Types of allocation requests. The values larger than H5FD_MEM_DEFAULT
- * should not change other than adding new types to the end. These numbers
- * might appear in files.
- */
-typedef enum H5FD_mem_t {
- H5FD_MEM_NOLIST = -1, /*must be negative*/
- H5FD_MEM_DEFAULT = 0, /*must be zero*/
- H5FD_MEM_SUPER = 1,
- H5FD_MEM_BTREE = 2,
- H5FD_MEM_DRAW = 3,
- H5FD_MEM_GHEAP = 4,
- H5FD_MEM_LHEAP = 5,
- H5FD_MEM_OHDR = 6,
-
- H5FD_MEM_NTYPES /*must be last*/
-} H5FD_mem_t;
+/* Types of allocation requests: see H5Fpublic.h */
+typedef enum H5F_mem_t H5FD_mem_t;
/* Map "fractal heap" header blocks to 'ohdr' type file memory, since its
* a fair amount of work to add a new kind of file memory and they are similar
diff --git a/src/H5FO.c b/src/H5FO.c
index 33241f0..6982e36 100644
--- a/src/H5FO.c
+++ b/src/H5FO.c
@@ -290,12 +290,12 @@ H5FO_mark(const H5F_t *f, haddr_t addr, hbool_t deleted)
PURPOSE
Check if an object is marked to be deleted when it is closed
USAGE
- htri_t H5FO_marked(f,addr)
+ hbool_t H5FO_marked(f,addr)
const H5F_t *f; IN: File opened object is in
haddr_t addr; IN: Address of object to delete
RETURNS
- Returns a TRUE/FALSE on success, negative on failure
+ Returns a TRUE/FALSE on success
DESCRIPTION
Checks if the object is currently in the "opened objects" tree and
whether its marks for deletion from the file when it is closed.
@@ -304,11 +304,11 @@ H5FO_mark(const H5F_t *f, haddr_t addr, hbool_t deleted)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+hbool_t
H5FO_marked(const H5F_t *f, haddr_t addr)
{
H5FO_open_obj_t *open_obj; /* Information about open object */
- htri_t ret_value = FAIL; /* Return value */
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_NOFUNC(H5FO_marked)
@@ -320,7 +320,7 @@ H5FO_marked(const H5F_t *f, haddr_t addr)
/* Get the object node from the container */
if(NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs, &addr)))
- ret_value = open_obj->deleted;
+ ret_value = (htri_t)open_obj->deleted;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FO_marked() */
diff --git a/src/H5FOprivate.h b/src/H5FOprivate.h
index 9458a56..4648f02 100644
--- a/src/H5FOprivate.h
+++ b/src/H5FOprivate.h
@@ -41,7 +41,7 @@ H5_DLL void *H5FO_opened(const H5F_t *f, haddr_t addr);
H5_DLL herr_t H5FO_insert(const H5F_t *f, haddr_t addr, void *obj, hbool_t delete_flag);
H5_DLL herr_t H5FO_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
H5_DLL herr_t H5FO_mark(const H5F_t *f, haddr_t addr, hbool_t deleted);
-H5_DLL htri_t H5FO_marked(const H5F_t *f, haddr_t addr);
+H5_DLL hbool_t H5FO_marked(const H5F_t *f, haddr_t addr);
H5_DLL herr_t H5FO_dest(const H5F_t *f);
H5_DLL herr_t H5FO_top_create(H5F_t *f);
H5_DLL herr_t H5FO_top_incr(const H5F_t *f, haddr_t addr);
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 9ad6c70..51229cb 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -27,6 +27,7 @@
#define H5FS_PACKAGE /*suppress error about including H5FSpkg */
+
/***********/
/* Headers */
/***********/
@@ -36,15 +37,11 @@
#include "H5MFprivate.h" /* File memory management */
#include "H5Vprivate.h" /* Vectors and arrays */
+
/****************/
/* Local Macros */
/****************/
-/* #define QAK */
-
-/* Default starting size of section buffer */
-#define H5FS_SINFO_SIZE_DEFAULT 64
-
/******************/
/* Local Typedefs */
@@ -87,6 +84,7 @@ static herr_t H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect,
static htri_t H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node);
static herr_t H5FS_sect_serialize_size(H5FS_t *fspace);
+
/*********************/
/* Package Variables */
/*********************/
@@ -178,8 +176,9 @@ done:
/* Release bins for skip lists */
if(sinfo->bins)
sinfo->bins = H5FL_SEQ_FREE(H5FS_bin_t, sinfo->bins);
+
/* Release free space section info */
- H5FL_FREE(H5FS_sinfo_t, sinfo);
+ sinfo = H5FL_FREE(H5FS_sinfo_t, sinfo);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index 9529e0c..d4e142b 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -597,7 +597,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
+H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
hsize_t size)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 512d1b13..2323936 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -498,6 +498,7 @@ H5_DLL hbool_t H5F_use_latest_format(const H5F_t *f);
H5_DLL H5F_close_degree_t H5F_get_fc_degree(const H5F_t *f);
H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f);
H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr);
+H5_DLL hbool_t H5F_use_tmp_space(const H5F_t *f);
/* Functions that retrieve values from VFD layer */
H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature);
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 287e9b5..e23ad2d 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -111,6 +111,24 @@ typedef struct H5F_info_t {
} sohm;
} H5F_info_t;
+/*
+ * Types of allocation requests. The values larger than H5FD_MEM_DEFAULT
+ * should not change other than adding new types to the end. These numbers
+ * might appear in files.
+ */
+typedef enum H5F_mem_t {
+ H5FD_MEM_NOLIST = -1, /*must be negative*/
+ H5FD_MEM_DEFAULT = 0, /*must be zero*/
+ H5FD_MEM_SUPER = 1,
+ H5FD_MEM_BTREE = 2,
+ H5FD_MEM_DRAW = 3,
+ H5FD_MEM_GHEAP = 4,
+ H5FD_MEM_LHEAP = 5,
+ H5FD_MEM_OHDR = 6,
+
+ H5FD_MEM_NTYPES /*must be last*/
+} H5F_mem_t;
+
/* Library's file format versions */
typedef enum H5F_libver_t {
H5F_LIBVER_EARLIEST, /* Use the earliest possible format for storing objects */
diff --git a/src/H5Gcache.c b/src/H5Gcache.c
index c17c97f..6d497b6 100644
--- a/src/H5Gcache.c
+++ b/src/H5Gcache.c
@@ -312,7 +312,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_
/* entries */
if(H5G_ent_encode_vec(f, &p, sym->entry, sym->nsyms) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize")
- HDmemset(p, 0, size - (p - node));
+ HDmemset(p, 0, size - (size_t)(p - node));
/* Write the serialized symbol table node. */
if(H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, node) < 0)
diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c
index 9ecd6c1..26773cb 100644
--- a/src/H5Gcompact.c
+++ b/src/H5Gcompact.c
@@ -523,7 +523,7 @@ H5G_compact_lookup(H5O_loc_t *oloc, const char *name, H5O_link_t *lnk,
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
/* Determine if we found the link we were looking for */
- ret_value = udata.found;
+ ret_value = (htri_t)udata.found;
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Glink.c b/src/H5Glink.c
index 7051453..37a0ede 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -377,7 +377,7 @@ H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *info)
if((cb_ret = (link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, NULL, (size_t)0)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query buffer size callback returned failure")
- info->u.val_size = cb_ret;
+ info->u.val_size = (size_t)cb_ret;
} /* end if */
else
info->u.val_size = 0;
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index fe381fd..a58c66a 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -299,31 +299,31 @@ static herr_t
H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
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;
- H5G_node_t *sym = NULL;
- hsize_t size = 0;
- herr_t ret_value=SUCCEED; /* Return value */
+ H5G_node_key_t *lt_key = (H5G_node_key_t *)_lt_key;
+ H5G_node_key_t *rt_key = (H5G_node_key_t *)_rt_key;
+ H5G_node_t *sym = NULL;
+ hsize_t size = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_node_create);
/*
* Check arguments.
*/
- assert(f);
- assert(H5B_INS_FIRST == op);
+ HDassert(f);
+ HDassert(H5B_INS_FIRST == op);
if(NULL == (sym = H5FL_CALLOC(H5G_node_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
size = H5G_node_size_real(f);
if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space")
sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)));
- if(NULL==sym->entry)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ if(NULL == sym->entry)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node")
/*
* The left and right symbols in an empty tree are both the
* empty string stored at offset zero by the H5G functions. This
@@ -339,13 +339,13 @@ done:
if(ret_value < 0) {
if(sym != NULL) {
if(sym->entry != NULL)
- H5FL_SEQ_FREE(H5G_entry_t, sym->entry);
- (void)H5FL_FREE(H5G_node_t, sym);
+ sym->entry = H5FL_SEQ_FREE(H5G_entry_t, sym->entry);
+ sym = H5FL_FREE(H5G_node_t, sym);
} /* end if */
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_node_create() */
/*-------------------------------------------------------------------------
@@ -636,7 +636,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
*/
rt = sn->nsyms;
while(lt < rt) {
- idx = (lt + rt) / 2;
+ idx = (int)((lt + rt) / 2);
s = base + sn->entry[idx].name_off;
/* Check if symbol is already present */
@@ -644,9 +644,9 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "symbol is already present in symbol table")
if (cmp < 0)
- rt = idx;
+ rt = (unsigned)idx;
else
- lt = idx + 1;
+ lt = (unsigned)(idx + 1);
} /* end while */
idx += cmp > 0 ? 1 : 0;
@@ -689,15 +689,17 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
insert_into = sn;
if(idx == (int)H5F_SYM_LEAF_K(f))
md_key->offset = ent.name_off;
- } else {
+ } /* end if */
+ else {
idx -= H5F_SYM_LEAF_K(f);
insert_into = snrt;
- if(idx == (int)H5F_SYM_LEAF_K (f)) {
+ if(idx == (int)H5F_SYM_LEAF_K(f)) {
rt_key->offset = ent.name_off;
*rt_key_changed = TRUE;
} /* end if */
} /* end else */
- } else {
+ } /* end if */
+ else {
/* Where to insert the new entry? */
ret_value = H5B_INS_NOOP;
sn_flags |= H5AC__DIRTIED_FLAG;
diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c
index 3a911d6..e0a1069 100644
--- a/src/H5HFdblock.c
+++ b/src/H5HFdblock.c
@@ -35,6 +35,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
#include "H5HFpkg.h" /* Fractal heaps */
#include "H5MFprivate.h" /* File memory management */
#include "H5Vprivate.h" /* Vectors and arrays */
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 4fd527d..d1f2675 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -43,6 +43,7 @@
/* Local Macros */
/****************/
+#ifndef NDEBUG
/* Limit on the size of the max. direct block size */
/* (This is limited to 32-bits currently, because I think it's unlikely to
* need to be larger, the 32-bit limit for H5V_log2_of2(n), and
@@ -55,6 +56,8 @@
* need to be larger, and its encoded with a maxiumum of 16-bits - QAK)
*/
#define H5HF_WIDTH_LIMIT (64 * 1024)
+#endif /* NDEBUG */
+
/******************/
/* Local Typedefs */
@@ -219,7 +222,7 @@ H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr)
HDassert(hdr);
/* Compute/cache some values */
- hdr->heap_off_size = H5HF_SIZEOF_OFFSET_BITS(hdr->man_dtable.cparam.max_index);
+ hdr->heap_off_size = (uint8_t)H5HF_SIZEOF_OFFSET_BITS(hdr->man_dtable.cparam.max_index);
if(H5HF_dtable_init(&hdr->man_dtable) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize doubling table info")
diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c
index 60c6c9f..792a865 100644
--- a/src/H5HFhuge.c
+++ b/src/H5HFhuge.c
@@ -68,20 +68,12 @@
/* Local v2 B-tree operations */
static herr_t H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id);
-/* v2 B-tree function callbacks (in H5HFbtree2.c) */
-H5_DLL herr_t H5HF_huge_bt2_indir_found(const void *nrecord, void *op_data);
-H5_DLL herr_t H5HF_huge_bt2_indir_remove(const void *nrecord, void *op_data);
-H5_DLL herr_t H5HF_huge_bt2_filt_indir_found(const void *nrecord, void *op_data);
-H5_DLL herr_t H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *op_data);
-H5_DLL herr_t H5HF_huge_bt2_dir_remove(const void *nrecord, void *op_data);
-H5_DLL herr_t H5HF_huge_bt2_filt_dir_found(const void *nrecord, void *op_data);
-H5_DLL herr_t H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *op_data);
-
/* Local 'huge' object support routines */
static hsize_t H5HF_huge_new_id(H5HF_hdr_t *hdr);
static herr_t H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id,
const uint8_t *id, hbool_t is_read, H5HF_operator_t op, void *op_data);
+
/*********************/
/* Package Variables */
/*********************/
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index c0fa1e4..8969aae 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -35,6 +35,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
#include "H5HFpkg.h" /* Fractal heaps */
#include "H5MFprivate.h" /* File memory management */
#include "H5Vprivate.h" /* Vectors and arrays */
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index 2997b3a..3fe3ad2 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -351,9 +351,9 @@ typedef struct H5HF_hdr_t {
hbool_t huge_ids_direct; /* Flag to indicate that 'huge' object's offset & length are stored directly in heap ID */
size_t tiny_max_len; /* Max. size of tiny objects for this heap */
hbool_t tiny_len_extended; /* Flag to indicate that 'tiny' object's length is stored in extended form (i.e. w/extra byte) */
- unsigned char huge_id_size; /* Size of 'huge' heap IDs (in bytes) */
- unsigned char heap_off_size; /* Size of heap offsets (in bytes) */
- unsigned char heap_len_size; /* Size of heap ID lengths (in bytes) */
+ uint8_t huge_id_size; /* Size of 'huge' heap IDs (in bytes) */
+ uint8_t heap_off_size; /* Size of heap offsets (in bytes) */
+ uint8_t heap_len_size; /* Size of heap ID lengths (in bytes) */
} H5HF_hdr_t;
/* Common indirect block doubling table entry */
@@ -640,6 +640,15 @@ H5_DLL herr_t H5HF_huge_remove(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id)
H5_DLL herr_t H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id);
H5_DLL herr_t H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id);
+/* 'Huge' object v2 B-tree function callbacks */
+H5_DLL herr_t H5HF_huge_bt2_indir_found(const void *nrecord, void *op_data);
+H5_DLL herr_t H5HF_huge_bt2_indir_remove(const void *nrecord, void *op_data);
+H5_DLL herr_t H5HF_huge_bt2_filt_indir_found(const void *nrecord, void *op_data);
+H5_DLL herr_t H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *op_data);
+H5_DLL herr_t H5HF_huge_bt2_dir_remove(const void *nrecord, void *op_data);
+H5_DLL herr_t H5HF_huge_bt2_filt_dir_found(const void *nrecord, void *op_data);
+H5_DLL herr_t H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *op_data);
+
/* 'Tiny' object routines */
H5_DLL herr_t H5HF_tiny_init(H5HF_hdr_t *hdr);
H5_DLL herr_t H5HF_tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj,
diff --git a/src/H5HG.c b/src/H5HG.c
index ba3e968..1846ead 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -186,20 +186,18 @@ H5HG_create (H5F_t *f, hid_t dxpl_id, size_t size)
heap->addr = addr;
heap->size = size;
- if (NULL==(heap->chunk = H5FL_BLK_MALLOC (gheap_chunk,size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, \
- "memory allocation failed");
+ if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
#ifdef H5_CLEAR_MEMORY
HDmemset(heap->chunk, 0, size);
#endif /* H5_CLEAR_MEMORY */
- heap->nalloc = H5HG_NOBJS (f, size);
+ heap->nalloc = H5HG_NOBJS(f, size);
heap->nused = 1; /* account for index 0, which is used for the free object */
- if (NULL==(heap->obj = H5FL_SEQ_MALLOC (H5HG_obj_t,heap->nalloc)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, \
- "memory allocation failed");
+ if(NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t, heap->nalloc)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
/* Initialize the header */
- HDmemcpy (heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ HDmemcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC);
p = heap->chunk + H5_SIZEOF_MAGIC;
*p++ = H5HG_VERSION;
*p++ = 0; /*reserved*/
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index 22374ce..f3d0f3a 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -173,7 +173,8 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
nalloc = H5HG_NOBJS(f, heap->size);
if(NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t, nalloc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- heap->obj[0].size = heap->obj[0].nrefs = 0;
+ heap->obj[0].nrefs = 0;
+ heap->obj[0].size = 0;
heap->obj[0].begin = NULL;
heap->nalloc = nalloc;
diff --git a/src/H5HP.c b/src/H5HP.c
index 2b1fe89..ad76817 100644
--- a/src/H5HP.c
+++ b/src/H5HP.c
@@ -378,11 +378,11 @@ H5HP_create(H5HP_type_t heap_type)
done:
/* Error cleanup */
- if(ret_value==NULL) {
- if(new_heap!=NULL) {
- if(new_heap->heap!=NULL)
- H5FL_SEQ_FREE(H5HP_ent_t,new_heap->heap);
- (void)H5FL_FREE(H5HP_t,new_heap);
+ if(NULL ==ret_value) {
+ if(NULL != new_heap) {
+ if(NULL != new_heap->heap)
+ new_heap->heap = H5FL_SEQ_FREE(H5HP_ent_t, new_heap->heap);
+ new_heap = H5FL_FREE(H5HP_t, new_heap);
} /* end if */
} /* end if */
@@ -772,20 +772,20 @@ H5HP_incr(H5HP_t *heap, unsigned amt, void *_obj)
assert(heap->heap[0].obj==NULL);
/* Get the location of the object in the heap */
- obj_loc=obj->heap_loc;
- assert(obj_loc>0 && obj_loc<=heap->nobjs);
+ obj_loc = obj->heap_loc;
+ assert(obj_loc > 0 && obj_loc <= heap->nobjs);
/* Change the heap object's priority */
- heap->heap[obj_loc].val+=amt;
+ heap->heap[obj_loc].val += (int)amt;
/* Restore heap condition */
- if(heap->type==H5HP_MAX_HEAP) {
- if(H5HP_swim_max(heap,obj_loc)<0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition");
+ if(H5HP_MAX_HEAP == heap->type) {
+ if(H5HP_swim_max(heap, obj_loc) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition")
} /* end if */
else {
- if(H5HP_sink_min(heap,obj_loc)<0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition");
+ if(H5HP_sink_min(heap, obj_loc) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition")
} /* end else */
done:
@@ -910,10 +910,10 @@ H5HP_close(H5HP_t *heap)
HDassert(NULL == heap->heap[0].obj);
/* Free internal structures for heap */
- H5FL_SEQ_FREE(H5HP_ent_t, heap->heap);
+ heap->heap = H5FL_SEQ_FREE(H5HP_ent_t, heap->heap);
/* Free actual heap object */
- (void)H5FL_FREE(H5HP_t, heap);
+ heap = H5FL_FREE(H5HP_t, heap);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HP_close() */
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 8637429..57414c7 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -482,7 +482,7 @@ H5L_extern_query(const char UNUSED * link_name, const void *_udata, size_t udata
} /* end if */
/* Set return value */
- ret_value = udata_size;
+ ret_value = (ssize_t)udata_size;
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5MF.c b/src/H5MF.c
index 2cf52b0..637151e 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -394,6 +394,7 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value,
#ifdef H5MF_ALLOC_DEBUG_DUMP
H5MF_sects_dump(f, dxpl_id, stderr);
#endif /* H5MF_ALLOC_DEBUG_DUMP */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_alloc() */
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index 0f8a374..fa5014bc 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -86,10 +86,6 @@
* Programmer: Quincey Koziol
* Thursday, December 13, 2007
*
- * Modifications:
- * Vailin Choi, July 29th, 2008
- * The whole routine is modified to handle alignment
- *
*-------------------------------------------------------------------------
*/
haddr_t
@@ -133,13 +129,13 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
#endif /* H5MF_AGGR_DEBUG */
alignment = f->shared->alignment;
- if (!((alignment > 1) && (size >= f->shared->threshold)))
+ if(!((alignment > 1) && (size >= f->shared->threshold)))
alignment = 0; /* no alignment */
- if (alignment && aggr->addr > 0 && aggr->size > 0 && (mis_align = aggr->addr % alignment)) {
+ if(alignment && aggr->addr > 0 && aggr->size > 0 && (mis_align = aggr->addr % alignment)) {
frag_addr = aggr->addr;
frag_size = alignment - mis_align;
- }
+ } /* end if */
alloc_type = aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW;
other_alloc_type = other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW;
@@ -155,7 +151,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
- if ((aggr->addr > 0) && (extended=H5FD_try_extend(f->shared->lf, alloc_type, aggr->addr + aggr->size, ext_size)) < 0)
+ if ((aggr->addr > 0) && (extended = H5FD_try_extend(f->shared->lf, alloc_type, aggr->addr + aggr->size, ext_size)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
else if (extended) {
/* aggr->size is unchanged */
@@ -176,7 +172,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
other_aggr->addr = 0;
other_aggr->tot_size = 0;
other_aggr->size = 0;
- }
+ } /* end if */
if(HADDR_UNDEF == (new_space = H5FD_alloc(f->shared->lf, dxpl_id, type, size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block")
@@ -193,14 +189,14 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
HDfprintf(stderr, "%s: Allocating block\n", FUNC);
#endif /* H5MF_AGGR_DEBUG */
- if (frag_size > (ext_size - size))
+ if(frag_size > (ext_size - size))
ext_size += (frag_size - (ext_size - size));
/* Check for overlapping into file's temporary allocation space */
if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
- if ((aggr->addr > 0) && (extended = H5FD_try_extend(f->shared->lf, alloc_type, aggr->addr + aggr->size, ext_size)) < 0)
+ if((aggr->addr > 0) && (extended = H5FD_try_extend(f->shared->lf, alloc_type, aggr->addr + aggr->size, ext_size)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
else if (extended) {
aggr->addr += frag_size;
@@ -211,7 +207,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
if(H5F_addr_gt((eoa + aggr->alloc_size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
- if ((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
+ if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
if(H5FD_free(f->shared->lf, dxpl_id, other_alloc_type, other_aggr->addr, other_aggr->size) < 0)
@@ -219,7 +215,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
other_aggr->addr = 0;
other_aggr->tot_size = 0;
other_aggr->size = 0;
- }
+ } /* end if */
if(HADDR_UNDEF == (new_space = H5FD_alloc(f->shared->lf, dxpl_id, alloc_type, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block")
@@ -233,7 +229,6 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
aggr->addr = new_space;
aggr->size = aggr->alloc_size;
aggr->tot_size = aggr->alloc_size;
-
} /* end else */
/* Allocate space out of the metadata block */
@@ -243,12 +238,12 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
} /* end else */
/* freeing any possible fragment due to file allocation */
- if (eoa_frag_size)
+ if(eoa_frag_size)
if(H5MF_xfree(f, type, dxpl_id, eoa_frag_addr, eoa_frag_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
/* freeing any possible fragment due to alignment in the block after extension */
- if (extended && frag_size)
+ if(extended && frag_size)
if(H5MF_xfree(f, type, dxpl_id, frag_addr, frag_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment")
} /* end if */
@@ -262,7 +257,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
if (frag_size)
if(H5MF_xfree(f, type, dxpl_id, frag_addr, frag_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment")
- }
+ } /* end else */
} /* end if */
else {
/* Check for overlapping into file's temporary allocation space */
@@ -272,7 +267,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
/* Allocate data from the file */
if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, dxpl_id, type, size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space")
- if (eoa_frag_size)
+ if(eoa_frag_size)
if(H5MF_xfree(f, type, dxpl_id, eoa_frag_addr, eoa_frag_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
} /* end else */
@@ -426,7 +421,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect,
+H5MF_aggr_absorb(const H5F_t UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect,
hbool_t allow_sect_absorb)
{
FUNC_ENTER_NOAPI_NOFUNC(H5MF_aggr_absorb)
@@ -549,7 +544,7 @@ herr_t
H5MF_aggr_reset(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr)
{
H5FD_mem_t alloc_type; /* Type of file memory to work with */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5MF_aggr_reset, FAIL)
diff --git a/src/H5MFsection.c b/src/H5MFsection.c
index 200195a..0dc43c3 100644
--- a/src/H5MFsection.c
+++ b/src/H5MFsection.c
@@ -528,4 +528,3 @@ done:
FUNC_LEAVE_NOAPI((H5FS_section_info_t *)ret_value)
} /* end H5MF_sect_simple_split() */
-
diff --git a/src/H5O.c b/src/H5O.c
index 2017e1c..64d0b9b 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1449,11 +1449,12 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
*oh_flags = H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
} /* end else */
} /* end if */
- } else {
+ } /* end if */
+ else {
/* A new object, or one that will be deleted */
- if(oh->nlink == 0) {
- /* Check if the object is current open, but marked for deletion */
- if(H5FO_marked(f, addr) > 0) {
+ if(0 == oh->nlink) {
+ /* Check if the object is currently open, but marked for deletion */
+ if(H5FO_marked(f, addr)) {
/* Remove "delete me" flag on the object */
if(H5FO_mark(f, addr, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
@@ -1496,7 +1497,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
} /* end if */
/* Set return value */
- ret_value = oh->nlink;
+ ret_value = (int)oh->nlink;
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -2934,5 +2935,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_visit() */
-
-
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index b2d38da..6c8c931 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -163,7 +163,7 @@ H5O_add_gap(H5O_t *oh, unsigned chunkno, unsigned idx,
/* Check if we need to extend message table to hold the new null message */
if(oh->nmesgs >= oh->alloc_nmesgs)
if(H5O_alloc_msgs(oh, (size_t)1) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "can't allocate more space for messages")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Increment new gap size */
oh->chunk[chunkno].gap += new_gap_size;
@@ -329,7 +329,7 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type,
/* Add the gap to the chunk */
if(H5O_add_gap(oh, alloc_msg->chunkno, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, UFAIL, "can't insert gap in chunk")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
} /* end if */
else {
size_t new_mesg_size = new_size + H5O_SIZEOF_MSGHDR_OH(oh); /* Total size of newly allocated message */
@@ -338,7 +338,7 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type,
/* Check if we need to extend message table to hold the new null message */
if(oh->nmesgs >= oh->alloc_nmesgs) {
if(H5O_alloc_msgs(oh, (size_t)1) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "can't allocate more space for messages")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* "Retarget" 'alloc_msg' pointer into newly re-allocated array of messages */
alloc_msg = &oh->mesg[null_idx];
@@ -361,7 +361,7 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type,
if(H5O_eliminate_gap(oh, null_msg,
((oh->chunk[null_chunkno].image + oh->chunk[null_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[null_chunkno].gap)),
oh->chunk[null_chunkno].gap) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, UFAIL, "can't eliminate gap in chunk")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
/* Set the gap size to zero for the chunk */
oh->chunk[null_chunkno].gap = 0;
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index d396896..c0c1bfa 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -509,7 +509,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
HDassert(nullcnt == 0);
/* Set gap information for chunk */
- oh->chunk[chunkno].gap = (eom_ptr - p);
+ oh->chunk[chunkno].gap = (size_t)(eom_ptr - p);
/* Increment location in chunk */
p += oh->chunk[chunkno].gap;
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 2926c6b..807d147 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -543,7 +543,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
/* Check if the chunk's data portion is too small */
dst_oh_gap = dst_oh_null = 0;
if(dst_oh_size < H5O_MIN_SIZE) {
- size_t delta = (H5O_MIN_SIZE - dst_oh_size); /* Delta in chunk size needed */
+ size_t delta = (size_t)(H5O_MIN_SIZE - dst_oh_size); /* Delta in chunk size needed */
/* Sanity check */
HDassert((oh_dst->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_1);
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 83dbabc..a9812690 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -579,8 +579,8 @@ done:
if(ret_value < 0) {
if(dt != NULL) {
if(dt->shared != NULL)
- H5FL_FREE(H5T_shared_t, dt->shared);
- H5FL_FREE(H5T_t, dt);
+ dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
+ dt = H5FL_FREE(H5T_t, dt);
} /* end if */
} /* end if */
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index a7956e7..4d576c6 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -758,15 +758,15 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_
/* Check arguments */
if(mesg_type_flags > H5O_SHMESG_ALL_FLAG)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unrecognized flags in mesg_type_flags");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unrecognized flags in mesg_type_flags")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Read the current number of indexes */
if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes")
/* Range check */
if(index_num >= nindexes)
@@ -784,9 +784,9 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_
/* Write arrays back to plist */
if(H5P_set(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set index type flags");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set index type flags")
if(H5P_set(plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set min mesg sizes");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set min mesg sizes")
done:
FUNC_LEAVE_API(ret_value)
@@ -845,7 +845,7 @@ H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type
done:
FUNC_LEAVE_API(ret_value);
-}
+} /* end H5Pset_shared_mesg_index() */
/*-------------------------------------------------------------------------
@@ -905,7 +905,7 @@ H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_
done:
FUNC_LEAVE_API(ret_value);
-}
+} /* end H5Pset_shared_mesg_phase_change() */
/*-------------------------------------------------------------------------
@@ -946,5 +946,5 @@ H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *mi
done:
FUNC_LEAVE_API(ret_value);
-}
+} /* end H5Pget_shared_mesg_phase_change() */
diff --git a/test/freespace.c b/test/freespace.c
index 79a0864..29a1dc2 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -2791,3 +2791,4 @@ error:
} H5E_END_TRY;
return (1);
} /* main() */
+
diff --git a/test/mf.c b/test/mf.c
index 5c05848..05b37ea 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -2824,8 +2824,9 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- /* Allocate first block from meta_aggr */
type = H5FD_MEM_SUPER;
+
+ /* Allocate first block from meta_aggr */
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -5798,11 +5799,11 @@ error:
int
main(void)
{
- hid_t fapl = -1; /* File access property list for data files */
- hid_t new_fapl = -1; /* File access property list for alignment & aggr setting */
- unsigned nerrors = 0; /* Cumulative error count */
- test_type_t curr_test;
- const char *env_h5_drvr; /* File Driver value from environment */
+ hid_t fapl = -1; /* File access property list for data files */
+ hid_t new_fapl = -1; /* File access property list for alignment & aggr setting */
+ unsigned nerrors = 0; /* Cumulative error count */
+ test_type_t curr_test; /* Current test being worked on */
+ const char *env_h5_drvr; /* File Driver value from environment */
/* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
@@ -5849,10 +5850,7 @@ main(void)
nerrors += test_mf_aggr_extend(env_h5_drvr, fapl);
nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl);
- /*
- * tests for alignment
- */
-
+ /* Tests for alignment */
for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) {
switch(curr_test) {
@@ -5869,6 +5867,7 @@ main(void)
default:
TEST_ERROR;
+ break;
} /* end switch */
nerrors += test_mf_align_eoa(env_h5_drvr, fapl, new_fapl);
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index a8b6832..beacdbb 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -731,10 +731,11 @@ table_list_add(hid_t oid, unsigned long file_no)
{
size_t idx; /* Index of table to use */
find_objs_t info;
- void *tmp_ptr;
/* Allocate space if necessary */
if(table_list.nused == table_list.nalloc) {
+ void *tmp_ptr;
+
table_list.nalloc = MAX(1, table_list.nalloc * 2);
if(NULL == (tmp_ptr = HDrealloc(table_list.tables, table_list.nalloc * sizeof(table_list.tables[0]))))
return -1;
@@ -1441,7 +1442,7 @@ dump_selected_attr(hid_t loc_id, const char *name)
int j;
j = (int)HDstrlen(name) - 1;
- obj_name = HDmalloc((size_t)j + 2);
+ obj_name = (char *)HDmalloc((size_t)j + 2);
/* find the last / */
while(name[j] != '/' && j >= 0)
@@ -1533,7 +1534,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
herr_t ret = SUCCEED;
/* Build the object's path name */
- obj_path = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDassert(obj_path);
HDstrcpy(obj_path, prefix);
HDstrcat(obj_path, "/");
@@ -1692,7 +1693,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
switch(linfo->type) {
case H5L_TYPE_SOFT:
indentation(indent);
- targbuf = HDmalloc(linfo->u.val_size);
+ targbuf = (char *)HDmalloc(linfo->u.val_size);
HDassert(targbuf);
if(!doxml) {
@@ -1722,7 +1723,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
char *t_link_path;
int res;
- t_link_path = HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
+ t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
if(targbuf[0] == '/')
HDstrcpy(t_link_path, targbuf);
else {
@@ -1785,7 +1786,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
break;
case H5L_TYPE_EXTERNAL:
- targbuf = HDmalloc(linfo->u.val_size);
+ targbuf = (char *)HDmalloc(linfo->u.val_size);
HDassert(targbuf);
indentation(indent);
@@ -2057,7 +2058,7 @@ dump_group(hid_t gid, const char *name)
}
- tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
indentation(indent);
begin_obj(dump_header_format->groupbegin, name, dump_header_format->groupblockbegin);
@@ -2714,9 +2715,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
hsize_t dims[H5S_MAX_RANK];
int ndims = H5Sget_simple_extent_dims( sid, dims, NULL);
hsize_t nelmts = 1;
- hsize_t size;
double ratio = 0;
- hssize_t a, b;
int ok = 0;
/* only print the compression ratio for these filters */
@@ -2739,19 +2738,18 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
if (ndims && ok )
{
+ hsize_t uncomp_size;
for (i = 0; i < ndims; i++)
{
nelmts *= dims[i];
}
- size = nelmts * datum_size;
-
- a = size; b = storage_size;
+ uncomp_size = nelmts * datum_size;
/* compression ratio = uncompressed size / compressed size */
- if (b!=0)
- ratio = (double) a / (double) b;
+ if (storage_size != 0)
+ ratio = (double) uncomp_size / (double) storage_size;
HDfprintf(stdout, "SIZE %Hu (%.3f:1 COMPRESSION)\n ", storage_size, ratio);
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 73f57e3..0fb8fc8 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -930,16 +930,12 @@ int do_copy_objects(hid_t fidin,
/* only print the compression ration if there was a filter request */
if (apply_s && apply_f && req_filter)
{
- hssize_t a, b;
-
/* get the storage size of the output dataset */
dsize_out=H5Dget_storage_size(dset_out);
/* compression ratio = uncompressed size / compressed size */
-
- a = dsize_in; b = dsize_out;
- if (b!=0)
- ratio = (double) a / (double) b;
+ if (dsize_out!=0)
+ ratio = (double) dsize_in / (double) dsize_out;
print_dataset_info(dcpl_out,travt->objs[i].name,ratio,1);
}
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index f55bd2e..d9ec7ad 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -411,13 +411,12 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
case 'b':
- options->ublock_size = atol( opt_arg );
+ options->ublock_size = (hsize_t)atol( opt_arg );
break;
case 't':
- options->threshold = atol( opt_arg );
-
+ options->threshold = (hsize_t)atol( opt_arg );
break;
case 'a':
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index b36afde..d28750c 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -1507,7 +1507,6 @@ int main (void)
SKIPPED();
#endif
-
/*-------------------------------------------------------------------------
* test file with userblock
*-------------------------------------------------------------------------
@@ -1529,8 +1528,6 @@ int main (void)
PASSED();
-
-
/*-------------------------------------------------------------------------
* clean temporary test files
*-------------------------------------------------------------------------
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index 315c558..75481ff 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -51,7 +51,7 @@ typedef struct iter_t {
unsigned long uniq_groups; /* Number of unique groups */
unsigned long uniq_dsets; /* Number of unique datasets */
- unsigned long uniq_types; /* Number of unique named datatypes */
+ unsigned long uniq_dtypes; /* Number of unique named datatypes */
unsigned long uniq_links; /* Number of unique links */
unsigned long uniq_others; /* Number of other unique objects */
@@ -64,11 +64,11 @@ typedef struct iter_t {
hsize_t max_attrs; /* Maximum attributes from a group */
unsigned long num_small_attrs[SIZE_SMALL_ATTRS]; /* Size of small attributes tracked */
- unsigned attr_nbins;
- unsigned long *attr_bins;
+ unsigned attr_nbins; /* Number of bins for attribute counts */
+ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */
- unsigned long max_dset_rank; /* Maximum rank of dataset */
- unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */
+ unsigned max_dset_rank; /* Maximum rank of dataset */
+ unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */
hsize_t max_dset_dims; /* Maximum dimension size of dataset */
unsigned long small_dset_dims[SIZE_SMALL_DSETS]; /* Size of dimensions of small datasets tracked */
unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */
@@ -79,6 +79,7 @@ typedef struct iter_t {
unsigned long *dset_dim_bins; /* Pointer to array of bins for dataset dimensions */
ohdr_info_t dset_ohdr_info; /* Object header information for datasets */
hsize_t dset_storage_size; /* Size of raw data for datasets */
+ ohdr_info_t dtype_ohdr_info; /* Object header information for datatypes */
hsize_t groups_btree_storage_size; /* btree size for group */
hsize_t groups_heap_storage_size; /* heap size for group */
hsize_t attrs_btree_storage_size; /* btree size for attributes (1.8) */
@@ -110,7 +111,7 @@ struct handler_t {
};
-static const char *s_opts ="AFfhGgDdTO:V";
+static const char *s_opts ="ADdFfhGgTO:V";
static struct long_options l_opts[] = {
{"help", no_arg, 'h'},
{"hel", no_arg, 'h'},
@@ -192,13 +193,6 @@ leave(int ret)
static void usage(const char *prog)
{
fflush(stdout);
- fprintf(stdout, "\n");
- fprintf(stdout, "This tool is under development. For detailed information\n");
- fprintf(stdout, "please see the specification document at\n");
- fprintf(stdout, "http://hdf.ncsa.uiuc.edu/RFC/h5stat/h5stat-spec.pdf\n");
- fprintf(stdout, "\n");
- fprintf(stdout, "Please send your comments and questions to help@hdfgroup.org\n");
- fprintf(stdout, "\n");
fprintf(stdout, "Usage: %s [OPTIONS] file\n", prog);
fprintf(stdout, "\n");
fprintf(stdout, " OPTIONS\n");
@@ -277,7 +271,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi)
/* Add attribute count to proper bin */
bin = ceil_log10((unsigned long)oi->num_attrs);
if((bin + 1) > iter->attr_nbins) {
- iter->attr_bins = realloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long));
+ iter->attr_bins = (unsigned long *)realloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long));
assert(iter->attr_bins);
/* Initialize counts for intermediate bins */
@@ -349,7 +343,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
bin = ceil_log10((unsigned long)ginfo.nlinks);
if((bin + 1) > iter->group_nbins) {
/* Allocate more storage for info about dataset's datatype */
- iter->group_bins = realloc(iter->group_bins, (bin + 1) * sizeof(unsigned long));
+ iter->group_bins = (unsigned long *)realloc(iter->group_bins, (bin + 1) * sizeof(unsigned long));
assert(iter->group_bins);
/* Initialize counts for intermediate bins */
@@ -451,7 +445,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
/* Check for larger rank of dataset */
if((unsigned)ndims > iter->max_dset_rank)
- iter->max_dset_rank = ndims;
+ iter->max_dset_rank = (unsigned)ndims;
/* Track the number of datasets with each rank */
(iter->dset_rank_count[ndims])++;
@@ -466,7 +460,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
bin = ceil_log10((unsigned long)dims[0]);
if((bin + 1) > iter->dset_dim_nbins) {
/* Allocate more storage for info about dataset's datatype */
- iter->dset_dim_bins = realloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long));
+ iter->dset_dim_bins = (unsigned long *)realloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long));
assert(iter->dset_dim_bins);
/* Initialize counts for intermediate bins */
@@ -503,7 +497,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->dset_ntypes++;
/* Allocate more storage for info about dataset's datatype */
- iter->dset_type_info = realloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t));
+ iter->dset_type_info = (dtype_info_t *)realloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t));
assert(iter->dset_type_info);
/* Initialize information about datatype */
@@ -537,7 +531,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
assert (num_ext >= 0);
if(num_ext)
- iter->nexternal = iter->nexternal + num_ext;
+ iter->nexternal += (unsigned long)num_ext;
/* Track different filters */
if((nfltr = H5Pget_nfilters(dcpl)) >= 0) {
@@ -561,6 +555,31 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
return 0;
} /* end dataset_stats() */
+/*-------------------------------------------------------------------------
+ * Function: datatype_stats
+ *
+ * Purpose: Gather statistics about the datatype
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Vailin Choi; July 7th, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+datatype_stats(iter_t *iter, const H5O_info_t *oi)
+{
+ /* Gather statistics about this type of object */
+ iter->uniq_dtypes++;
+
+ /* Get object header information */
+ iter->dtype_ohdr_info.total_size += oi->hdr.space.total;
+ iter->dtype_ohdr_info.free_size += oi->hdr.space.free;
+
+ return 0;
+} /* end datatype_stats() */
+
/*-------------------------------------------------------------------------
* Function: obj_stats
@@ -598,8 +617,7 @@ obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
break;
case H5O_TYPE_NAMED_DATATYPE:
- /* Gather statistics about this type of object */
- iter->uniq_types++;
+ datatype_stats(iter, oi);
break;
default:
@@ -661,10 +679,6 @@ lnk_stats(const char UNUSED *path, const H5L_info_t *li, void *_iter)
* Programmer: Elena Pourmal
* Saturday, August 12, 2006
*
- * Modifications:
- * Vailin Choi 12 July 2007
- * Added 'A' option to display attribute info
- *
*-------------------------------------------------------------------------
*/
static struct handler_t *
@@ -674,7 +688,7 @@ parse_command_line(int argc, const char *argv[])
struct handler_t *hand;
/* Allocate space to hold the command line info */
- hand = calloc((size_t)argc, sizeof(struct handler_t));
+ hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t));
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
@@ -801,7 +815,7 @@ print_file_info(const iter_t *iter)
printf("File information\n");
printf("\t# of unique groups: %lu\n", iter->uniq_groups);
printf("\t# of unique datasets: %lu\n", iter->uniq_dsets);
- printf("\t# of unique named dataypes: %lu\n", iter->uniq_types);
+ printf("\t# of unique named dataypes: %lu\n", iter->uniq_dtypes);
printf("\t# of unique links: %lu\n", iter->uniq_links);
printf("\t# of unique other: %lu\n", iter->uniq_others);
printf("\tMax. # of links to object: %lu\n", iter->max_links);
@@ -823,14 +837,6 @@ print_file_info(const iter_t *iter)
* Programmer: Elena Pourmal
* Saturday, August 12, 2006
*
- * Modifications:
- * Vailin Choi 12 July 2007
- * Print storage info for:
- * 1. btree/heap storage for groups and attributes
- * 2. btree storage for chunked dataset
- * 3. hdr/btree/list/heap storage for SOHM table
- * 4. superblock extension size
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -841,6 +847,8 @@ print_file_metadata(const iter_t *iter)
iter->group_ohdr_info.free_size);
HDfprintf(stdout, "\tDatasets: %Hu/%Hu\n", iter->dset_ohdr_info.total_size,
iter->dset_ohdr_info.free_size);
+ HDfprintf(stdout, "\tDatatypes: %Hu/%Hu\n", iter->dtype_ohdr_info.total_size,
+ iter->dtype_ohdr_info.free_size);
printf("Storage information:\n");
HDfprintf(stdout, "\tGroups:\n");
@@ -999,7 +1007,7 @@ print_dataset_info(const iter_t *iter)
if(iter->uniq_dsets > 0) {
printf("Dataset dimension information:\n");
- printf("\tMax. rank of datasets: %lu\n", iter->max_dset_rank);
+ printf("\tMax. rank of datasets: %u\n", iter->max_dset_rank);
printf("\tDataset ranks:\n");
for(u = 0; u < H5S_MAX_RANK; u++)
if(iter->dset_rank_count[u] > 0)
@@ -1091,8 +1099,6 @@ print_dataset_info(const iter_t *iter)
* Programmer: Elena Pourmal
* Saturday, August 12, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -1163,15 +1169,6 @@ print_statistics(const char *name, const iter_t *iter)
print_file_statistics(iter);
}
-/*-------------------------------------------------------------------------
- *
- * Modifications:
- * bug #1253; Oct 6th 2008; Vailin Choi
- * Call print_statistics() when objects/links are successfully traversed.
- * Otherwise, return warning message.
- *
- *-------------------------------------------------------------------------
- */
int
main(int argc, const char *argv[])
diff --git a/tools/h5stat/testfiles/h5stat_filters-F.ddl b/tools/h5stat/testfiles/h5stat_filters-F.ddl
index 544d0c7..6bc6cc2 100644
--- a/tools/h5stat/testfiles/h5stat_filters-F.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-F.ddl
@@ -5,6 +5,7 @@ Filename: h5stat_filters.h5
Object header size: (total/unused)
Groups: 48/8
Datasets: 4936/1344
+ Datatypes: 80/0
Storage information:
Groups:
B-tree/List: 1200
diff --git a/tools/h5stat/testfiles/h5stat_filters.ddl b/tools/h5stat/testfiles/h5stat_filters.ddl
index 8afdf82..8243a23 100644
--- a/tools/h5stat/testfiles/h5stat_filters.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters.ddl
@@ -13,6 +13,7 @@ File information
Object header size: (total/unused)
Groups: 48/8
Datasets: 4936/1344
+ Datatypes: 80/0
Storage information:
Groups:
B-tree/List: 1200
diff --git a/tools/h5stat/testfiles/h5stat_help1.ddl b/tools/h5stat/testfiles/h5stat_help1.ddl
index 0841572..0a86b4c 100644
--- a/tools/h5stat/testfiles/h5stat_help1.ddl
+++ b/tools/h5stat/testfiles/h5stat_help1.ddl
@@ -1,13 +1,6 @@
#############################
Expected output for 'h5stat -h'
#############################
-
-This tool is under development. For detailed information
-please see the specification document at
-http://hdf.ncsa.uiuc.edu/RFC/h5stat/h5stat-spec.pdf
-
-Please send your comments and questions to help@hdfgroup.org
-
Usage: h5stat [OPTIONS] file
OPTIONS
diff --git a/tools/h5stat/testfiles/h5stat_help2.ddl b/tools/h5stat/testfiles/h5stat_help2.ddl
index 1e6295b..e41eb9e 100644
--- a/tools/h5stat/testfiles/h5stat_help2.ddl
+++ b/tools/h5stat/testfiles/h5stat_help2.ddl
@@ -1,13 +1,6 @@
#############################
Expected output for 'h5stat --help'
#############################
-
-This tool is under development. For detailed information
-please see the specification document at
-http://hdf.ncsa.uiuc.edu/RFC/h5stat/h5stat-spec.pdf
-
-Please send your comments and questions to help@hdfgroup.org
-
Usage: h5stat [OPTIONS] file
OPTIONS
diff --git a/tools/h5stat/testfiles/h5stat_newgrat.ddl b/tools/h5stat/testfiles/h5stat_newgrat.ddl
index 5ba2e7f..f87f297 100644
--- a/tools/h5stat/testfiles/h5stat_newgrat.ddl
+++ b/tools/h5stat/testfiles/h5stat_newgrat.ddl
@@ -13,6 +13,7 @@ File information
Object header size: (total/unused)
Groups: 5145147/3220092
Datasets: 414/312
+ Datatypes: 0/0
Storage information:
Groups:
B-tree/List: 470054
diff --git a/tools/h5stat/testfiles/h5stat_tsohm.ddl b/tools/h5stat/testfiles/h5stat_tsohm.ddl
index 56524e1..577dfdd 100644
--- a/tools/h5stat/testfiles/h5stat_tsohm.ddl
+++ b/tools/h5stat/testfiles/h5stat_tsohm.ddl
@@ -13,6 +13,7 @@ File information
Object header size: (total/unused)
Groups: 51/2
Datasets: 852/447
+ Datatypes: 0/0
Storage information:
Groups:
B-tree/List: 872