summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2011-04-12 16:59:33 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2011-04-12 16:59:33 (GMT)
commite4c6ef2f06a9e85ab7485eaab6b4b5fad699c8e3 (patch)
tree51db953096306b494651d0c794e5110a98d96259
parent9af7a65b4fb46cb61df85eeff49a3ba0f018d863 (diff)
downloadhdf5-e4c6ef2f06a9e85ab7485eaab6b4b5fad699c8e3.zip
hdf5-e4c6ef2f06a9e85ab7485eaab6b4b5fad699c8e3.tar.gz
hdf5-e4c6ef2f06a9e85ab7485eaab6b4b5fad699c8e3.tar.bz2
[svn-r20480] Description:
Remove global variable for the path name in the group traversal code. Also clean up a bunch of compiler warnings. Tested on: Mac OS X/32 10.6.7 (amazon) w/debug & production FreeBSD/32 6.3 (duty) w/debug FreeBSD/64 6.3 (liberty) w/debug Solaris/32 2.7 (linew) w/debug
-rw-r--r--src/H5B2cache.c2
-rw-r--r--src/H5EAtest.c2
-rw-r--r--src/H5G.c3
-rw-r--r--src/H5Gpkg.h1
-rw-r--r--src/H5Gtraverse.c74
-rw-r--r--src/H5Pdcpl.c2
-rw-r--r--src/H5detect.c2
-rw-r--r--test/dsets.c8
-rw-r--r--test/gen_filespace.c2
-rw-r--r--tools/lib/h5tools.c14
10 files changed, 44 insertions, 66 deletions
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 6a3b5da..f47bb9f 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -833,7 +833,7 @@ H5B2_cache_internal_size(const H5F_t UNUSED *f, const H5B2_internal_t *internal,
*-------------------------------------------------------------------------
*/
static H5B2_leaf_t *
-H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
+H5B2_cache_leaf_load(H5F_t UNUSED *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
H5B2_leaf_cache_ud_t *udata = (H5B2_leaf_cache_ud_t *)_udata;
H5B2_leaf_t *leaf = NULL; /* Pointer to lead node loaded */
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index 1b5e100..0153a1e 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -284,7 +284,9 @@ herr_t, SUCCEED, -,
H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx))
/* Local variables */
+#ifndef NDEBUG
H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
+#endif /* NDEBUG */
uint64_t *elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */
const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
diff --git a/src/H5G.c b/src/H5G.c
index 2093329..5c7741c 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -843,9 +843,6 @@ H5G_term_interface(void)
/* Destroy the group object id group */
H5I_dec_type_ref(H5I_GROUP);
- /* Free the global component buffer */
- H5G_traverse_term_interface();
-
/* Mark closed */
H5_interface_initialize_g = 0;
n = 1; /*H5I*/
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 78e66d0..dfaf112 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -391,7 +391,6 @@ H5_DLL herr_t H5G_iterate(hid_t loc_id, const char *group_name,
/*
* Group hierarchy traversal routines
*/
-H5_DLL herr_t H5G_traverse_term_interface(void);
H5_DLL herr_t H5G_traverse_special(const H5G_loc_t *grp_loc,
const H5O_link_t *lnk, unsigned target, size_t *nlinks, hbool_t last_comp,
H5G_loc_t *obj_loc, hbool_t *obj_exists, hid_t lapl_id, hid_t dxpl_id);
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index bb8e590..50a2894 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -38,6 +38,7 @@
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppublic.h" /* Property Lists */
+#include "H5WBprivate.h" /* Wrapped Buffers */
/* Private typedefs */
@@ -54,8 +55,6 @@ typedef struct {
/* Private macros */
/* Local variables */
-static char *H5G_comp_g = NULL; /*component buffer */
-static size_t H5G_comp_alloc_g = 0; /*sizeof component buffer */
/* PRIVATE PROTOTYPES */
static herr_t H5G_traverse_slink_cb(H5G_loc_t *grp_loc, const char *name,
@@ -74,34 +73,6 @@ static herr_t H5G_traverse_real(const H5G_loc_t *loc, const char *name,
/*-------------------------------------------------------------------------
- * Function: H5G_traverse_term_interface
- *
- * Purpose: Terminates part of the H5G interface - free the global
- * component buffer.
- *
- * Return: Success: Non-negative.
- *
- * Failure: Negative.
- *
- * Programmer: Quincey Koziol
- * Monday, September 26, 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G_traverse_term_interface(void)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_traverse_term_interface)
-
- /* Free the global component buffer */
- H5G_comp_g = (char *)H5MM_xfree(H5G_comp_g);
- H5G_comp_alloc_g = 0;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5G_traverse_term_interface() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_traverse_slink_cb
*
* Purpose: Callback for soft link traversal. This routine sets the
@@ -570,8 +541,11 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
H5O_link_t lnk; /* Link information for object */
hbool_t link_valid = FALSE; /* Flag to indicate that the link information is valid */
hbool_t obj_loc_valid = FALSE; /* Flag to indicate that the object location is valid */
- H5G_own_loc_t own_loc=H5G_OWN_NONE; /* Enum to indicate whether callback took ownership of locations*/
+ H5G_own_loc_t own_loc = H5G_OWN_NONE; /* Enum to indicate whether callback took ownership of locations*/
hbool_t group_copy = FALSE; /* Flag to indicate that the group entry is copied */
+ char comp_buf[1024]; /* Temporary buffer for path components */
+ char *comp; /* Pointer to buffer for path components */
+ H5WB_t *wb = NULL; /* Wrapped buffer for temporary buffer */
hbool_t last_comp = FALSE; /* Flag to indicate that a component is the last component in the name */
herr_t ret_value = SUCCEED; /* Return value */
@@ -596,8 +570,8 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
HDassert(root_grp);
/* Set the location entry to the root group's info */
- loc.oloc=&(root_grp->oloc);
- loc.path=&(root_grp->path);
+ loc.oloc = &(root_grp->oloc);
+ loc.path = &(root_grp->path);
} /* end if */
else {
loc.oloc = _loc->oloc;
@@ -625,17 +599,13 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
if(H5G_loc_reset(&obj_loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to reset location")
- /* Check for needing a larger buffer for the individual path name components */
- if((HDstrlen(name) + 1) > H5G_comp_alloc_g) {
- char *new_comp; /* New component buffer */
- size_t new_alloc; /* New component buffer size */
+ /* Wrap the local buffer for serialized header info */
+ if(NULL == (wb = H5WB_wrap(comp_buf, sizeof(comp_buf))))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wrap buffer")
- new_alloc = MAX3(1024, (2 * H5G_comp_alloc_g), (HDstrlen(name) + 1));
- if(NULL == (new_comp = (char *)H5MM_realloc(H5G_comp_g, new_alloc)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "unable to allocate component buffer")
- H5G_comp_g = new_comp;
- H5G_comp_alloc_g = new_alloc;
- } /* end if */
+ /* Get a pointer to a buffer that's large enough */
+ if(NULL == (comp = (uint8_t *)H5WB_actual(wb, (HDstrlen(name) + 1))))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Traverse the path */
while((name = H5G_component(name, &nchars)) && *name) {
@@ -647,13 +617,13 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
* Copy the component name into a null-terminated buffer so
* we can pass it down to the other symbol table functions.
*/
- HDmemcpy(H5G_comp_g, name, nchars);
- H5G_comp_g[nchars] = '\0';
+ HDmemcpy(comp, name, nchars);
+ comp[nchars] = '\0';
/*
* The special name `.' is a no-op.
*/
- if('.' == H5G_comp_g[0] && !H5G_comp_g[1]) {
+ if('.' == comp[0] && !comp[1]) {
name += nchars;
continue;
} /* end if */
@@ -669,7 +639,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
} /* end if */
/* Get information for object in current group */
- if((lookup_status = H5G_obj_lookup(grp_loc.oloc, H5G_comp_g, &lnk/*out*/, dxpl_id)) < 0)
+ if((lookup_status = H5G_obj_lookup(grp_loc.oloc, comp, &lnk/*out*/, dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't look up component")
obj_exists = FALSE;
@@ -677,7 +647,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
if(lookup_status) {
/* Sanity check link and indicate it's valid */
HDassert(lnk.type >= H5L_TYPE_HARD);
- HDassert(!HDstrcmp(H5G_comp_g, lnk.name));
+ HDassert(!HDstrcmp(comp, lnk.name));
link_valid = TRUE;
/* Build object location from the link */
@@ -714,7 +684,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
} /* end else */
/* Call 'operator' routine */
- if((op)(&grp_loc, H5G_comp_g, cb_lnk, cb_loc, op_data, &own_loc) < 0)
+ if((op)(&grp_loc, comp, cb_lnk, cb_loc, op_data, &own_loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CALLBACK, FAIL, "traversal operator failed")
HGOTO_DONE(SUCCEED)
@@ -796,7 +766,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
/* Insert new group into current group's symbol table */
- if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc, H5O_TYPE_GROUP, &gcrt_info, dxpl_id) < 0)
+ if(H5G_loc_insert(&grp_loc, comp, &obj_loc, H5O_TYPE_GROUP, &gcrt_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group")
/* Decrement refcount on intermediate group's object header in memory */
@@ -877,6 +847,10 @@ done:
if(H5O_msg_reset(H5O_LINK_ID, &lnk) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link message")
+ /* Release temporary component buffer */
+ if(wb && H5WB_unwrap(wb) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't release wrapped buffer")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_traverse_real() */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 6e20aed..8680edb 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -52,7 +52,7 @@
/* Define default layout information */
#define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL}
#define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0}
-#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_BTREE, HADDR_UNDEF, NULL, {{NULL}}}
+#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_BTREE, HADDR_UNDEF, NULL, {{HADDR_UNDEF, NULL}}}
#define H5D_DEF_LAYOUT_CHUNK_INIT {(unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (uint32_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}
#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER
#define H5D_DEF_STORAGE_COMPACT {H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT }}
diff --git a/src/H5detect.c b/src/H5detect.c
index 29955a1..0461cfd 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -739,7 +739,7 @@ H5TN_init_interface(void)\n\
done:\n\
if(ret_value < 0) {\n\
if(dt != NULL) {\n\
- H5FL_FREE(H5T_shared_t, dt->shared);\n\
+ dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);\n\
dt = H5FL_FREE(H5T_t, dt);\n\
} /* end if */\n\
} /* end if */\n\
diff --git a/test/dsets.c b/test/dsets.c
index b2b2521..c1cac47 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -4076,7 +4076,7 @@ test_nbit_int_size(hid_t file)
*/
if((precision = H5Tget_precision(datatype)) == 0) {
H5_FAILED();
- printf(" Line %d: wrong precision size: %d\n",__LINE__, precision);
+ printf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
goto error;
} /* end if */
@@ -4086,7 +4086,7 @@ test_nbit_int_size(hid_t file)
if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) ||
dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) {
H5_FAILED();
- printf(" Line %d: wrong dataset size: %d\n",__LINE__, dset_size);
+ HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size);
goto error;
} /* end if */
@@ -4283,7 +4283,7 @@ test_nbit_flt_size(hid_t file)
*/
if((precision = H5Tget_precision(datatype)) == 0) {
H5_FAILED();
- printf(" Line %d: wrong precision size: %d\n",__LINE__, precision);
+ printf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
goto error;
} /* end if */
@@ -4293,7 +4293,7 @@ test_nbit_flt_size(hid_t file)
if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) ||
dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) {
H5_FAILED();
- printf(" Line %d: wrong dataset size: %d\n",__LINE__, dset_size);
+ HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size);
goto error;
} /* end if */
diff --git a/test/gen_filespace.c b/test/gen_filespace.c
index 293e3df..7ee2a7a 100644
--- a/test/gen_filespace.c
+++ b/test/gen_filespace.c
@@ -45,7 +45,7 @@ static void gen_file(void)
unsigned i, j; /* Local index variable */
H5F_file_space_type_t fs_type; /* File space handling strategy */
- for(j = 0, fs_type = H5F_FILE_SPACE_ALL_PERSIST; j < NELMTS(FILENAMES); j++, (H5F_file_space_type_t)(fs_type)++) {
+ for(j = 0, fs_type = H5F_FILE_SPACE_ALL_PERSIST; j < NELMTS(FILENAMES); j++, fs_type = (H5F_file_space_type_t)(fs_type + 1)) {
/* Get a copy of the default file creation property */
fcpl = H5Pcreate(H5P_FILE_CREATE);
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 7389351..93a7390 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -2078,6 +2078,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
size_t p_type_nbytes; /* size of memory type */
hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
hsize_t sm_nbytes; /* bytes per stripmine */
+ hssize_t ssm_nelmts; /* elements per stripmine*/
hsize_t sm_nelmts; /* elements per stripmine*/
unsigned char *sm_buf = NULL; /* buffer for raw data */
hid_t sm_space = -1; /* stripmine data space */
@@ -2120,8 +2121,9 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
- if((sm_nelmts = H5Sget_select_npoints(f_space)) < 0)
+ if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed");
+ sm_nelmts = (hsize_t)ssm_nelmts;
if (sm_nelmts > 0) {
/*
@@ -2855,8 +2857,9 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
HERR_INIT(int, SUCCEED)
char *mname;
hid_t mtype, str_type;
+ int snmembers;
unsigned nmembers;
- unsigned ndims;
+ int sndims;
unsigned i;
size_t size = 0;
hsize_t dims[H5TOOLS_DUMP_MAX_RANK];
@@ -3200,8 +3203,9 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
break;
case H5T_COMPOUND:
- if((nmembers = H5Tget_nmembers(type)) < 0)
+ if((snmembers = H5Tget_nmembers(type)) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed");
+ nmembers = (unsigned)snmembers;
h5tools_str_append(buffer, "H5T_COMPOUND %s\n", h5tools_dump_header_format->structblockbegin);
@@ -3277,7 +3281,9 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
h5tools_str_append(buffer, "H5T_ARRAY { ");
/* Get array information */
- if((ndims = H5Tget_array_ndims(type)) >= 0) {
+ if((sndims = H5Tget_array_ndims(type)) >= 0) {
+ unsigned ndims = (unsigned)sndims;
+
if(H5Tget_array_dims2(type, dims) >= 0) {
/* Print array dimensions */
for (i = 0; i < ndims; i++)