summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-03-10 19:00:39 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-03-10 19:00:39 (GMT)
commitb4ff3e6e79a46fb474eb1786a11a7d2451455111 (patch)
treeb73756af2d3eaee487c4087d55fbb04e1eba62b5 /src
parentda5058310c324dcce93dc9328ef2bd53bf1fed02 (diff)
downloadhdf5-b4ff3e6e79a46fb474eb1786a11a7d2451455111.zip
hdf5-b4ff3e6e79a46fb474eb1786a11a7d2451455111.tar.gz
hdf5-b4ff3e6e79a46fb474eb1786a11a7d2451455111.tar.bz2
[svn-r16560] Description:
Remove another call to H5E_clear_stack() from within the library. Clean up lots of compiler warnings. Tested on: Mac OS X/32 10.5.6 (amazon) (followup on other platforms forthcoming)
Diffstat (limited to 'src')
-rw-r--r--src/H5AC.c4
-rw-r--r--src/H5Aint.c2
-rw-r--r--src/H5C.c6
-rw-r--r--src/H5D.c3
-rw-r--r--src/H5Dio.c10
-rw-r--r--src/H5Dmpio.c29
-rw-r--r--src/H5FDdirect.c5
-rw-r--r--src/H5FDmpio.c2
-rw-r--r--src/H5FDmpiposix.c2
-rw-r--r--src/H5FDstdio.c2
-rw-r--r--src/H5FDwindows.c2
-rw-r--r--src/H5FLprivate.h16
-rw-r--r--src/H5Gloc.c12
-rw-r--r--src/H5Gname.c2
-rw-r--r--src/H5Gnode.c4
-rw-r--r--src/H5HFbtree2.c9
-rw-r--r--src/H5HFhuge.c14
-rw-r--r--src/H5HFsection.c17
-rw-r--r--src/H5HGdbg.c2
-rw-r--r--src/H5Oainfo.c4
-rw-r--r--src/H5Odtype.c12
-rw-r--r--src/H5RC.c16
-rw-r--r--src/H5RS.c106
-rw-r--r--src/H5ST.c169
-rw-r--r--src/H5Smpio.c336
-rw-r--r--src/H5Z.c14
26 files changed, 384 insertions, 416 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 950615a..ccdd493 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -2288,10 +2288,10 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
{
herr_t result;
herr_t ret_value=SUCCEED; /* Return value */
- hbool_t size_changed = FALSE;
hbool_t dirtied;
size_t new_size = 0;
#ifdef H5_HAVE_PARALLEL
+ hbool_t size_changed = FALSE;
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
#if H5AC__TRACE_FILE_ENABLED
@@ -2345,7 +2345,9 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
if ( ((H5AC_info_t *)thing)->size != new_size ) {
+#ifdef H5_HAVE_PARALLEL
size_changed = TRUE;
+#endif /* H5_HAVE_PARALLEL */
flags = flags | H5AC__SIZE_CHANGED_FLAG;
#if H5AC__TRACE_FILE_ENABLED
trace_flags = flags;
diff --git a/src/H5Aint.c b/src/H5Aint.c
index c7013a2..2ac17fa 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -716,7 +716,7 @@ H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo)
/* Retrieve # of records in "name" B-tree */
/* (should be same # of records in all indices) */
if(H5B2_get_nrec(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, &ainfo->nattrs) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't retrieve # of records in index")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve # of records in index")
} /* end if */
else
/* Retrieve # of attributes from object header */
diff --git a/src/H5C.c b/src/H5C.c
index 7d2d4ea..49e7921 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -9874,8 +9874,6 @@ H5C_flush_invalidate_cache(H5F_t * f,
herr_t ret_value = SUCCEED;
hbool_t done = FALSE;
hbool_t first_flush = TRUE;
- hbool_t first_pass = TRUE;
- hbool_t have_pinned_entries;
int32_t protected_entries = 0;
int32_t i;
int32_t cur_pel_len;
@@ -9952,10 +9950,6 @@ H5C_flush_invalidate_cache(H5F_t * f,
while ( ! done )
{
- first_pass = FALSE;
-
- have_pinned_entries = ( cur_pel_len > 0 );
-
/* first, try to flush-destroy any dirty entries. Do this by
* making a scan through the slist. Note that new dirty entries
* may be created by the flush call backs. Thus it is possible
diff --git a/src/H5D.c b/src/H5D.c
index 4dad2aa..bb5e772 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -368,14 +368,13 @@ done:
herr_t
H5Dclose(hid_t dset_id)
{
- H5D_t *dset; /* Dataset object to release */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Dclose, FAIL)
H5TRACE1("e", "i", dset_id);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if(NULL == H5I_object_verify(dset_id, H5I_DATASET))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
/*
diff --git a/src/H5Dio.c b/src/H5Dio.c
index c1d57fd..cc75981 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -66,8 +66,7 @@ static herr_t H5D_typeinfo_init(const H5D_t *dset, const H5D_dxpl_cache_t *dxpl_
H5D_type_info_t *type_info);
#ifdef H5_HAVE_PARALLEL
static herr_t H5D_ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
- const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
- const H5S_t *file_space, const H5S_t *mem_space,
+ hid_t dxpl_id, const H5S_t *file_space, const H5S_t *mem_space,
const H5D_type_info_t *type_info, const H5D_chunk_map_t *fm);
static herr_t H5D_ioinfo_term(H5D_io_info_t *io_info);
#endif /* H5_HAVE_PARALLEL */
@@ -396,7 +395,7 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
#ifdef H5_HAVE_PARALLEL
/* Adjust I/O info for any parallel I/O */
- if(H5D_ioinfo_adjust(&io_info, dataset, dxpl_cache, dxpl_id, file_space, mem_space, &type_info, &fm) < 0)
+ if(H5D_ioinfo_adjust(&io_info, dataset, dxpl_id, file_space, mem_space, &type_info, &fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to adjust I/O info for parallel I/O")
#endif /*H5_HAVE_PARALLEL*/
@@ -570,7 +569,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
#ifdef H5_HAVE_PARALLEL
/* Adjust I/O info for any parallel I/O */
- if(H5D_ioinfo_adjust(&io_info, dataset, dxpl_cache, dxpl_id, file_space, mem_space, &type_info, &fm) < 0)
+ if(H5D_ioinfo_adjust(&io_info, dataset, dxpl_id, file_space, mem_space, &type_info, &fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to adjust I/O info for parallel I/O")
#endif /*H5_HAVE_PARALLEL*/
@@ -845,8 +844,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
- const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
+H5D_ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, hid_t dxpl_id,
const H5S_t *file_space, const H5S_t *mem_space,
const H5D_type_info_t *type_info, const H5D_chunk_map_t *fm)
{
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index e4dd8b5..6693348 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -117,8 +117,10 @@ static herr_t H5D_inter_collective_io(H5D_io_info_t *io_info,
static herr_t H5D_final_collective_io(H5D_io_info_t *io_info,
const H5D_type_info_t *type_info, size_t nelmts, MPI_Datatype *mpi_file_type,
MPI_Datatype *mpi_buf_type);
+#ifdef H5_MPI_COMPLEX_DERIVED_DATATYPE_WORKS
static herr_t H5D_sort_chunk(H5D_io_info_t *io_info, const H5D_chunk_map_t *fm,
H5D_chunk_addr_info_t chunk_addr_info_array[], int many_chunk_opt);
+#endif /* H5_MPI_COMPLEX_DERIVED_DATATYPE_WORKS */
static herr_t H5D_obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm,
H5P_genplist_t *dx_plist, uint8_t assign_io_mode[], haddr_t chunk_addr[]);
static herr_t H5D_ioinfo_xfer_mode(H5D_io_info_t *io_info, H5P_genplist_t *dx_plist,
@@ -1074,7 +1076,6 @@ static herr_t
H5D_multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
H5D_chunk_map_t *fm, H5P_genplist_t *dx_plist)
{
- H5D_t *dataset = io_info->dset;/* Local pointer to dataset info */
H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
H5D_io_info_t cpt_io_info; /* Compact I/O info object */
@@ -1347,7 +1348,6 @@ static herr_t
H5D_multi_chunk_collective_io_no_opt(H5D_io_info_t *io_info,
const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, H5P_genplist_t *dx_plist)
{
- H5D_t *dataset = io_info->dset;/* Local pointer to dataset info */
H5SL_node_t *chunk_node; /* Current node in chunk skip list */
H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
@@ -1366,7 +1366,7 @@ if(H5DEBUG(D)) {
int mpi_rank;
mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file);
- HDfprintf(H5DEBUG(D), "coming to multi_chunk_collective_io_no_opt\n");
+ HDfprintf(H5DEBUG(D), "Rank %d: coming to multi_chunk_collective_io_no_opt\n", mpi_rank);
}
#endif
@@ -1614,7 +1614,6 @@ static herr_t
H5D_final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
size_t mpi_buf_count, MPI_Datatype *mpi_file_type, MPI_Datatype *mpi_buf_type)
{
- int mpi_code; /* MPI return code */
hbool_t plist_is_setup = FALSE; /* Whether the dxpl has been customized */
herr_t ret_value = SUCCEED;
@@ -1626,13 +1625,11 @@ H5D_final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info
plist_is_setup = TRUE;
if(io_info->op_type == H5D_IO_OP_WRITE) {
- if((io_info->io_ops.single_write)(io_info, type_info,
- (hsize_t)mpi_buf_count, NULL, NULL) < 0)
+ if((io_info->io_ops.single_write)(io_info, type_info, (hsize_t)mpi_buf_count, NULL, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "optimized write failed")
} /* end if */
else {
- if((io_info->io_ops.single_read)(io_info, type_info,
- (hsize_t)mpi_buf_count, NULL, NULL) < 0)
+ if((io_info->io_ops.single_read)(io_info, type_info, (hsize_t)mpi_buf_count, NULL, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "optimized read failed")
} /* end else */
@@ -1649,6 +1646,7 @@ if(H5DEBUG(D))
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_final_collective_io */
+#ifdef H5_MPI_COMPLEX_DERIVED_DATATYPE_WORKS
/*-------------------------------------------------------------------------
* Function: H5D_sort_chunk
@@ -1790,6 +1788,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_sort_chunk() */
+#endif /* H5_MPI_COMPLEX_DERIVED_DATATYPE_WORKS */
/*-------------------------------------------------------------------------
@@ -1833,17 +1832,19 @@ H5D_obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
H5P_genplist_t *dx_plist, uint8_t assign_io_mode[], haddr_t chunk_addr[])
{
int total_chunks;
- unsigned percent_nproc_per_chunk,threshold_nproc_per_chunk;
+ unsigned percent_nproc_per_chunk, threshold_nproc_per_chunk;
+#if defined(H5_MPI_COMPLEX_DERIVED_DATATYPE_WORKS) && defined(H5_MPI_SPECIAL_COLLECTIVE_IO_WORKS)
H5FD_mpio_chunk_opt_t chunk_opt_mode;
- uint8_t* io_mode_info=NULL;
- uint8_t* recv_io_mode_info=NULL;
- uint8_t* mergebuf=NULL;
+#endif
+ uint8_t* io_mode_info = NULL;
+ uint8_t* recv_io_mode_info = NULL;
+ uint8_t* mergebuf = NULL;
uint8_t* tempbuf;
H5SL_node_t* chunk_node;
H5D_chunk_info_t* chunk_info;
- int mpi_size,mpi_rank;
+ int mpi_size, mpi_rank;
MPI_Comm comm;
- int ic,root;
+ int ic, root;
int mpi_code;
int mem_cleanup = 0;
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 61eb318..fff31f3 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -1081,7 +1081,8 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
hbool_t _must_align = TRUE;
herr_t ret_value=SUCCEED; /* Return value */
size_t alloc_size;
- void *copy_buf, *p1, *p3;
+ void *copy_buf, *p1;
+ const void *p3;
size_t _boundary;
size_t _fbsize;
size_t _cbsize;
@@ -1187,7 +1188,7 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
HDmemcpy(p1, p3, copy_size);
}else if(size >= _cbsize && copy_size > (alloc_size-(size_t)(copy_addr%_fbsize))) {
HDmemcpy(p1, p3, (alloc_size - (size_t)(copy_addr % _fbsize)));
- p3 = (unsigned char*)p3 + (alloc_size - (size_t)(copy_addr % _fbsize));
+ p3 = (const unsigned char *)p3 + (alloc_size - (size_t)(copy_addr % _fbsize));
}
/*look for the aligned position for writing the data*/
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 57da069..5e5349d 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -1913,7 +1913,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t closing)
+H5FD_mpio_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing)
{
H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
herr_t ret_value = SUCCEED;
diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c
index 245fc3e..ff5b118 100644
--- a/src/H5FDmpiposix.c
+++ b/src/H5FDmpiposix.c
@@ -1215,7 +1215,9 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
size_t size, const void *buf)
{
H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
+#if 0 /* JRM */
int mpi_code; /* MPI return code */
+#endif /* JRM */
ssize_t nbytes; /* Number of bytes written each I/O call */
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* Return value */
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 59e5b1e..0ae09a6 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -563,7 +563,9 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp
{
H5FD_stdio_t *file = (H5FD_stdio_t*)_file;
haddr_t addr;
+#ifndef H5_HAVE_FSEEKO
static const char *func = "H5FD_stdio_alloc"; /* Function Name for error reporting */
+#endif
haddr_t ret_value; /* Return value */
/* Shut compiler up */
diff --git a/src/H5FDwindows.c b/src/H5FDwindows.c
index ef26fec..37228d7 100644
--- a/src/H5FDwindows.c
+++ b/src/H5FDwindows.c
@@ -1008,7 +1008,7 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5FD_windows_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t closing)
+H5FD_windows_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing)
{
H5FD_windows_t *file = (H5FD_windows_t*)_file;
#ifndef WINDOWS_USE_STDIO
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h
index 446c852..a799dc4 100644
--- a/src/H5FLprivate.h
+++ b/src/H5FLprivate.h
@@ -118,7 +118,7 @@ typedef struct H5FL_reg_head_t {
#define H5FL_DEFINE(t) H5_DLL H5FL_DEFINE_COMMON(t)
/* Reference a free list for type 't' defined in another file */
-#define H5FL_EXTERN(t) extern H5_DLL H5FL_reg_head_t H5FL_REG_NAME(t)
+#define H5FL_EXTERN(t) H5_DLLVAR H5FL_reg_head_t H5FL_REG_NAME(t)
/* Declare a static free list to manage objects of type 't' */
#define H5FL_DEFINE_STATIC(t) static H5FL_DEFINE_COMMON(t)
@@ -142,7 +142,7 @@ typedef struct H5FL_reg_head_t {
#define H5FL_DEFINE_COMMON(t) int UNUSED H5FL_REG_NAME(t)
#define H5FL_DEFINE(t) H5_DLL H5FL_DEFINE_COMMON(t)
-#define H5FL_EXTERN(t) extern H5_DLL H5FL_DEFINE_COMMON(t)
+#define H5FL_EXTERN(t) H5_DLLVAR H5FL_DEFINE_COMMON(t)
#define H5FL_DEFINE_STATIC(t) static H5FL_DEFINE_COMMON(t)
#define H5FL_MALLOC(t) (t *)H5MM_malloc(sizeof(t))
#define H5FL_CALLOC(t) (t *)H5MM_calloc(sizeof(t))
@@ -187,7 +187,7 @@ typedef struct H5FL_blk_head_t {
#define H5FL_BLK_DEFINE(t) H5_DLL H5FL_BLK_DEFINE_COMMON(t)
/* Reference a free list for type 't' defined in another file */
-#define H5FL_BLK_EXTERN(t) extern H5_DLL H5FL_blk_head_t H5FL_BLK_NAME(t)
+#define H5FL_BLK_EXTERN(t) H5_DLLVAR H5FL_blk_head_t H5FL_BLK_NAME(t)
/* Declare a static free list to manage objects of type 't' */
#define H5FL_BLK_DEFINE_STATIC(t) static H5FL_BLK_DEFINE_COMMON(t)
@@ -212,7 +212,7 @@ typedef struct H5FL_blk_head_t {
#define H5FL_BLK_DEFINE_COMMON(t) int UNUSED H5FL_BLK_NAME(t)
#define H5FL_BLK_DEFINE(t) H5_DLL H5FL_BLK_DEFINE_COMMON(t)
-#define H5FL_BLK_EXTERN(t) extern H5_DLL H5FL_BLK_DEFINE_COMMON(t)
+#define H5FL_BLK_EXTERN(t) H5_DLLVAR H5FL_BLK_DEFINE_COMMON(t)
#define H5FL_BLK_DEFINE_STATIC(t) static H5FL_BLK_DEFINE_COMMON(t)
#define H5FL_BLK_MALLOC(t,size) (uint8_t *)H5MM_malloc(size)
#define H5FL_BLK_CALLOC(t,size) (uint8_t *)H5MM_calloc(size)
@@ -263,7 +263,7 @@ typedef struct H5FL_arr_head_t {
#define H5FL_BARR_DEFINE(b,t,m) H5_DLL H5FL_ARR_DEFINE_COMMON(sizeof(b),t,m)
/* Reference a free list for arrays of type 't' defined in another file */
-#define H5FL_ARR_EXTERN(t) extern H5_DLL H5FL_arr_head_t H5FL_ARR_NAME(t)
+#define H5FL_ARR_EXTERN(t) H5_DLLVAR H5FL_arr_head_t H5FL_ARR_NAME(t)
/* Declare a static free list to manage arrays of type 't' */
#define H5FL_ARR_DEFINE_STATIC(t,m) static H5FL_ARR_DEFINE_COMMON(0,t,m)
@@ -289,7 +289,7 @@ typedef struct H5FL_arr_head_t {
#define H5FL_ARR_DEFINE(t,m) H5_DLL H5FL_ARR_DEFINE_COMMON(t,m) = 0
#define H5FL_BARR_DEFINE(b,t,m) H5_DLL H5FL_ARR_DEFINE_COMMON(t,m) = sizeof(b)
-#define H5FL_ARR_EXTERN(t) extern H5_DLL H5FL_ARR_DEFINE_COMMON(t,m)
+#define H5FL_ARR_EXTERN(t) H5_DLLVAR H5FL_ARR_DEFINE_COMMON(t,m)
#define H5FL_ARR_DEFINE_STATIC(t,m) static H5FL_ARR_DEFINE_COMMON(t,m) = 0
#define H5FL_BARR_DEFINE_STATIC(b,t,m) static H5FL_ARR_DEFINE_COMMON(t,m) = sizeof(b)
#define H5FL_ARR_MALLOC(t,elem) H5MM_malloc(H5FL_ARR_NAME(t) + ((elem)*sizeof(t)))
@@ -319,7 +319,7 @@ typedef struct H5FL_seq_head_t {
#define H5FL_SEQ_DEFINE(t) H5_DLL H5FL_SEQ_DEFINE_COMMON(t)
/* Reference a free list for sequences of type 't' defined in another file */
-#define H5FL_SEQ_EXTERN(t) extern H5_DLL H5FL_seq_head_t H5FL_SEQ_NAME(t)
+#define H5FL_SEQ_EXTERN(t) H5_DLLVAR H5FL_seq_head_t H5FL_SEQ_NAME(t)
/* Declare a static free list to manage sequences of type 't' */
#define H5FL_SEQ_DEFINE_STATIC(t) static H5FL_SEQ_DEFINE_COMMON(t)
@@ -341,7 +341,7 @@ typedef struct H5FL_seq_head_t {
#define H5FL_SEQ_DEFINE_COMMON(t) int UNUSED H5FL_SEQ_NAME(t)
#define H5FL_SEQ_DEFINE(t) H5_DLL H5FL_SEQ_DEFINE_COMMON(t)
-#define H5FL_SEQ_EXTERN(t) extern H5_DLL H5FL_SEQ_DEFINE_COMMON(t)
+#define H5FL_SEQ_EXTERN(t) H5_DLLVAR H5FL_SEQ_DEFINE_COMMON(t)
#define H5FL_SEQ_DEFINE_STATIC(t) static H5FL_SEQ_DEFINE_COMMON(t)
#define H5FL_SEQ_MALLOC(t,elem) (t *)H5MM_malloc((elem)*sizeof(t))
#define H5FL_SEQ_CALLOC(t,elem) (t *)H5MM_calloc((elem)*sizeof(t))
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 908c9a3..b6a3a17 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -727,6 +727,7 @@ H5G_loc_set_comment_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
{
H5G_loc_sc_t *udata = (H5G_loc_sc_t *)_udata; /* User data passed in */
H5O_name_t comment; /* Object header "comment" message */
+ htri_t exists; /* Whether a "comment" message already exists */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_loc_set_comment_cb)
@@ -735,9 +736,14 @@ H5G_loc_set_comment_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
if(obj_loc == NULL)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
+ /* Check for existing comment message */
+ if((exists = H5O_msg_exists(obj_loc->oloc, H5O_NAME_ID, udata->dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header")
+
/* Remove the previous comment message if any */
- if(H5O_msg_remove(obj_loc->oloc, H5O_NAME_ID, 0, TRUE, udata->dxpl_id) < 0)
- H5E_clear_stack(NULL);
+ if(exists)
+ if(H5O_msg_remove(obj_loc->oloc, H5O_NAME_ID, 0, TRUE, udata->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete existing comment object header message")
/* Add the new message */
if(udata->comment && *udata->comment) {
@@ -830,7 +836,7 @@ H5G_loc_get_comment_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
} else {
if(udata->comment && udata->bufsize)
HDstrncpy(udata->comment, comment.s, udata->bufsize);
- udata->comment_size = HDstrlen(comment.s);
+ udata->comment_size = (ssize_t)HDstrlen(comment.s);
H5O_msg_reset(H5O_NAME_ID, &comment);
} /* end else */
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 205f2a2..581b649 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -578,7 +578,6 @@ H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char
if(full_suffix_len < path_len) {
const char *dst_suffix; /* Destination suffix that changes */
const char *src_suffix; /* Source suffix that changes */
- const char *path_prefix; /* Prefix for path */
size_t path_prefix_len; /* Length of path prefix */
const char *path_prefix2; /* 2nd prefix for path */
size_t path_prefix2_len; /* Length of 2nd path prefix */
@@ -589,7 +588,6 @@ H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char
/* Compute path prefix before full suffix*/
- path_prefix = path;
path_prefix_len = path_len - full_suffix_len;
/* Determine the common prefix for src & dst paths */
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 6b16544..fe381fd 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -815,7 +815,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* Get a pointer to the name of the link */
if(NULL == (lnk.name = (char *)H5HL_offset_into(f, udata->common.heap, sn->entry[idx].name_off)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link name")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name")
/* Set up rest of link structure */
lnk.corder_valid = FALSE;
@@ -833,7 +833,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* Replace any object names */
if(H5G_link_name_replace(f, dxpl_id, udata->grp_full_path_r, &lnk) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object type")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get object type")
/* Decrement the ref. count for hard links */
if(lnk.type == H5L_TYPE_HARD) {
diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c
index eabb740..b750822 100644
--- a/src/H5HFbtree2.c
+++ b/src/H5HFbtree2.c
@@ -59,15 +59,6 @@
/* Local Prototypes */
/********************/
-/* v2 B-tree function callbacks */
-herr_t H5HF_huge_bt2_indir_found(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_indir_remove(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_filt_indir_found(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_dir_remove(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_filt_dir_found(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *op_data);
-
/* v2 B-tree driver callbacks */
static herr_t H5HF_huge_btree2_indir_store(void *native, const void *udata);
static herr_t H5HF_huge_btree2_indir_retrieve(void *udata, const void *native);
diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c
index db9f7a1..60c6c9f 100644
--- a/src/H5HFhuge.c
+++ b/src/H5HFhuge.c
@@ -69,13 +69,13 @@
static herr_t H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id);
/* v2 B-tree function callbacks (in H5HFbtree2.c) */
-herr_t H5HF_huge_bt2_indir_found(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_indir_remove(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_filt_indir_found(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_dir_remove(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_filt_dir_found(const void *nrecord, void *op_data);
-herr_t H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *op_data);
+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);
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index 81b353f..91031be 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -3105,7 +3105,6 @@ H5HF_sect_indirect_reduce_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_
unsigned start_col; /* Start column in indirect block */
unsigned end_entry; /* Entry for last block covered */
unsigned end_row; /* End row in indirect block */
- unsigned end_col; /* End column in indirect block */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_reduce_row)
@@ -3132,7 +3131,6 @@ HDfprintf(stderr, "%s: row_start_entry = %u, row_end_entry = %u\n", FUNC, row_st
start_entry = (start_row * hdr->man_dtable.cparam.width) + start_col;
end_entry = (start_entry + sect->u.indirect.num_entries) - 1;
end_row = end_entry / hdr->man_dtable.cparam.width;
- end_col = end_entry % hdr->man_dtable.cparam.width;
/* Additional sanity check */
HDassert(sect->u.indirect.span_size > 0);
@@ -3144,7 +3142,7 @@ HDfprintf(stderr, "%s: row_start_entry = %u, row_end_entry = %u\n", FUNC, row_st
HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
HDfprintf(stderr, "%s: sect->u.indirect.parent = %p, sect->u.indirect.par_entry = %u\n", FUNC, sect->u.indirect.parent, sect->u.indirect.par_entry);
HDfprintf(stderr, "%s: start_entry = %u, start_row = %u, start_col = %u\n", FUNC, start_entry, start_row, start_col);
-HDfprintf(stderr, "%s: end_entry = %u, end_row = %u, end_col = %u\n", FUNC, end_entry, end_row, end_col);
+HDfprintf(stderr, "%s: end_entry = %u, end_row = %u\n", FUNC, end_entry, end_row);
#endif /* QAK */
/* Check if we should allocate from end of indirect section */
@@ -3400,7 +3398,6 @@ H5HF_sect_indirect_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s
unsigned start_col; /* Start column in indirect block */
unsigned end_entry; /* Entry for last block covered */
unsigned end_row; /* End row in indirect block */
- unsigned end_col; /* End column in indirect block */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_reduce)
@@ -3422,12 +3419,11 @@ HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry);
start_entry = (start_row * hdr->man_dtable.cparam.width) + start_col;
end_entry = (start_entry + sect->u.indirect.num_entries) - 1;
end_row = end_entry / hdr->man_dtable.cparam.width;
- end_col = end_entry % hdr->man_dtable.cparam.width;
#ifdef QAK
HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
HDfprintf(stderr, "%s: sect->u.indirect.parent = %p, sect->u.indirect.par_entry = %u\n", FUNC, sect->u.indirect.parent, sect->u.indirect.par_entry);
HDfprintf(stderr, "%s: start_entry = %u, start_row = %u, start_col = %u\n", FUNC, start_entry, start_row, start_col);
-HDfprintf(stderr, "%s: end_entry = %u, end_row = %u, end_col = %u\n", FUNC, end_entry, end_row, end_col);
+HDfprintf(stderr, "%s: end_entry = %u, end_row = %u\n", FUNC, end_entry, end_row);
#endif /* QAK */
/* Check how to adjust section for allocated entry */
@@ -3780,9 +3776,7 @@ H5HF_sect_indirect_merge_row(H5HF_hdr_t *hdr, hid_t dxpl_id,
unsigned start_row1, start_col1; /* Starting row & column for section #1 */
unsigned end_entry1; /* End entry for section #1 */
unsigned end_row1; /* Ending row for section #1 */
- unsigned start_entry2; /* Start entry for section #2 */
- unsigned start_row2, start_col2; /* Starting row & column for section #2 */
- unsigned end_entry2; /* End entry for section #2 */
+ unsigned start_row2; /* Starting row for section #2 */
hbool_t merged_rows; /* Flag to indicate that rows was merged together */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3831,12 +3825,9 @@ HDfprintf(stderr, "%s: sect1->u.indirect.num_entries = %u\n", FUNC, sect1->u.ind
HDfprintf(stderr, "%s: end_row1 = %u, end_entry1 = %u\n", FUNC, end_row1, end_entry1);
#endif /* QAK */
start_row2 = sect2->u.indirect.row;
- start_col2 = sect2->u.indirect.col;
- start_entry2 = (start_row2 * hdr->man_dtable.cparam.width) + start_col2;
- end_entry2 = (start_entry2 + sect2->u.indirect.num_entries) - 1;
#ifdef QAK
HDfprintf(stderr, "%s: sect2->u.indirect.dir_nrows = %u\n", FUNC, sect2->u.indirect.dir_nrows);
-HDfprintf(stderr, "%s: start_row2 = %u, start_col2 = %u, start_entry2 = %u\n", FUNC, start_row2, start_col2, start_entry2);
+HDfprintf(stderr, "%s: start_row2 = %u\n", FUNC, start_row2);
HDfprintf(stderr, "%s: sect2->u.indirect.num_entries = %u\n", FUNC, sect2->u.indirect.num_entries);
#endif /* QAK */
diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c
index 43c1ed0..7030da5 100644
--- a/src/H5HGdbg.c
+++ b/src/H5HGdbg.c
@@ -113,7 +113,7 @@ H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
(unsigned long)H5HG_ALIGN(h->obj[u].size));
p = h->obj[u].begin + H5HG_SIZEOF_OBJHDR (f);
for (j=0; j<h->obj[u].size; j+=16) {
- fprintf (stream, "%*s%04d: ", indent+6, "", j);
+ fprintf (stream, "%*s%04u: ", indent+6, "", j);
for (k=0; k<16; k++) {
if (8==k) fprintf (stream, " ");
if (j+k<h->obj[u].size) {
diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c
index 667f28c..e61d899 100644
--- a/src/H5Oainfo.c
+++ b/src/H5Oainfo.c
@@ -403,7 +403,7 @@ H5O_ainfo_pre_copy_file(H5F_t UNUSED *file_src, const void UNUSED *native_src,
*/
static void *
H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
- hbool_t *recompute_size, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id)
+ hbool_t *recompute_size, H5O_copy_t *cpy_info, void UNUSED *udata, hid_t dxpl_id)
{
H5O_ainfo_t *ainfo_src = (H5O_ainfo_t *)mesg_src;
H5O_ainfo_t *ainfo_dst = NULL;
@@ -467,7 +467,7 @@ static herr_t
H5O_ainfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src,
H5O_loc_t *dst_oloc, void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
{
- H5O_ainfo_t *ainfo_src = (const H5O_ainfo_t *)mesg_src;
+ const H5O_ainfo_t *ainfo_src = (const H5O_ainfo_t *)mesg_src;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_ainfo_post_copy_file)
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 24e443c..60f77d9 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -1580,11 +1580,11 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream,
"Version:", dt->shared->version);
if (H5T_COMPOUND == dt->shared->type) {
- fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
+ fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Number of members:",
dt->shared->u.compnd.nmembs);
for(i = 0; i < dt->shared->u.compnd.nmembs; i++) {
- sprintf(buf, "Member %d:", i);
+ sprintf(buf, "Member %u:", i);
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
buf,
dt->shared->u.compnd.memb[i].name);
@@ -1597,11 +1597,11 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream,
} else if(H5T_ENUM == dt->shared->type) {
fprintf(stream, "%*s%s\n", indent, "", "Base type:");
H5O_dtype_debug(f, dxpl_id, dt->shared->parent, stream, indent+3, MAX(0, fwidth-3));
- fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
+ fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Number of members:",
dt->shared->u.enumer.nmembs);
for(i = 0; i < dt->shared->u.enumer.nmembs; i++) {
- sprintf(buf, "Member %d:", i);
+ sprintf(buf, "Member %u:", i);
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
buf,
dt->shared->u.enumer.name[i]);
@@ -1678,7 +1678,7 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream,
s = "disk";
break;
default:
- sprintf(buf, "H5T_LOC_%d", dt->shared->u.vlen.loc);
+ sprintf(buf, "H5T_LOC_%d", (int)dt->shared->u.vlen.loc);
s = buf;
break;
} /* end switch */
@@ -1723,7 +1723,7 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream,
s);
} /* end if */
} else if(H5T_ARRAY == dt->shared->type) {
- fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
+ fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Rank:",
dt->shared->u.array.ndims);
fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:");
diff --git a/src/H5RC.c b/src/H5RC.c
index 49e26a8..d9f62c3 100644
--- a/src/H5RC.c
+++ b/src/H5RC.c
@@ -55,25 +55,25 @@ H5FL_DEFINE_STATIC(H5RC_t);
H5RC_t *
H5RC_create(void *o, H5RC_free_func_t free_func)
{
- H5RC_t *ret_value=NULL; /* Return value */
+ H5RC_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5RC_create,NULL);
+ FUNC_ENTER_NOAPI(H5RC_create, NULL)
/* Sanity check */
HDassert(o);
HDassert(free_func);
/* Allocate ref-counted string structure */
- if((ret_value=H5FL_MALLOC(H5RC_t))==NULL)
- HGOTO_ERROR(H5E_RS,H5E_NOSPACE,NULL,"memory allocation failed");
+ if(NULL == (ret_value = H5FL_MALLOC(H5RC_t)))
+ HGOTO_ERROR(H5E_RS,H5E_NOSPACE,NULL,"memory allocation failed")
/* Set the internal fields */
- ret_value->o=o;
- ret_value->n=1;
- ret_value->free_func=free_func;
+ ret_value->o = o;
+ ret_value->n = 1;
+ ret_value->free_func = free_func;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5RC_create() */
diff --git a/src/H5RS.c b/src/H5RS.c
index 0142c1f..6456ac8 100644
--- a/src/H5RS.c
+++ b/src/H5RS.c
@@ -63,7 +63,7 @@ H5RS_xstrdup(const char *s)
{
char *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5RS_xstrdup)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5RS_xstrdup)
if(s) {
ret_value = (char *)H5FL_BLK_MALLOC(str_buf, HDstrlen(s) + 1);
@@ -99,21 +99,21 @@ H5RS_xstrdup(const char *s)
H5RS_str_t *
H5RS_create(const char *s)
{
- H5RS_str_t *ret_value=NULL; /* Return value */
+ H5RS_str_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5RS_create,NULL);
+ FUNC_ENTER_NOAPI(H5RS_create, NULL)
/* Allocate ref-counted string structure */
- if((ret_value=H5FL_MALLOC(H5RS_str_t))==NULL)
- HGOTO_ERROR(H5E_RS,H5E_NOSPACE,NULL,"memory allocation failed");
+ if(NULL == (ret_value = H5FL_MALLOC(H5RS_str_t)))
+ HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set the internal fields */
- ret_value->s=H5RS_xstrdup(s);
- ret_value->wrapped=0;
- ret_value->n=1;
+ ret_value->s = H5RS_xstrdup(s);
+ ret_value->wrapped = 0;
+ ret_value->n = 1;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5RS_create() */
@@ -139,21 +139,21 @@ done:
H5RS_str_t *
H5RS_wrap(const char *s)
{
- H5RS_str_t *ret_value=NULL; /* Return value */
+ H5RS_str_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5RS_wrap,NULL);
+ FUNC_ENTER_NOAPI(H5RS_wrap, NULL)
/* Allocate ref-counted string structure */
- if((ret_value=H5FL_MALLOC(H5RS_str_t))==NULL)
- HGOTO_ERROR(H5E_RS,H5E_NOSPACE,NULL,"memory allocation failed");
+ if(NULL == (ret_value = H5FL_MALLOC(H5RS_str_t)))
+ HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set the internal fields */
- ret_value->s=(char*)s; /* (Cast away const OK - QAK) */
- ret_value->wrapped=1;
- ret_value->n=1;
+ ret_value->s = (char*)s; /* (Cast away const OK - QAK) */
+ ret_value->wrapped = 1;
+ ret_value->n = 1;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5RS_wrap() */
@@ -181,21 +181,21 @@ done:
H5RS_str_t *
H5RS_own(char *s)
{
- H5RS_str_t *ret_value=NULL; /* Return value */
+ H5RS_str_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5RS_own,NULL);
+ FUNC_ENTER_NOAPI(H5RS_own, NULL)
/* Allocate ref-counted string structure */
- if((ret_value=H5FL_MALLOC(H5RS_str_t))==NULL)
- HGOTO_ERROR(H5E_RS,H5E_NOSPACE,NULL,"memory allocation failed");
+ if(NULL == (ret_value = H5FL_MALLOC(H5RS_str_t)))
+ HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set the internal fields */
- ret_value->s=s;
- ret_value->wrapped=0;
- ret_value->n=1;
+ ret_value->s = s;
+ ret_value->wrapped = 0;
+ ret_value->n = 1;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5RS_own() */
@@ -259,25 +259,25 @@ H5RS_decr(H5RS_str_t *rs)
herr_t
H5RS_incr(H5RS_str_t *rs)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5RS_incr);
+ FUNC_ENTER_NOAPI_NOFUNC(H5RS_incr)
/* Sanity check */
- assert(rs);
- assert(rs->n > 0);
+ HDassert(rs);
+ HDassert(rs->n > 0);
/* If the ref-counted string started life as a wrapper around an existing
* string, duplicate the string now, so that the wrapped string can go out
* scope appropriately.
*/
if(rs->wrapped) {
- rs->s=H5RS_xstrdup(rs->s);
- rs->wrapped=0;
+ rs->s = H5RS_xstrdup(rs->s);
+ rs->wrapped = 0;
} /* end if */
/* Increment reference count for string */
rs->n++;
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5RS_incr() */
@@ -303,14 +303,14 @@ H5RS_incr(H5RS_str_t *rs)
H5RS_str_t *
H5RS_dup(H5RS_str_t *ret_value)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5RS_dup);
+ FUNC_ENTER_NOAPI_NOFUNC(H5RS_dup)
/* Check for valid reference counted string */
- if(ret_value!=NULL)
+ if(ret_value != NULL)
/* Increment reference count for string */
ret_value->n++;
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5RS_dup() */
@@ -335,7 +335,7 @@ H5RS_dup(H5RS_str_t *ret_value)
H5RS_str_t *
H5RS_dup_str(const char *s)
{
- char *new_str = NULL; /* Duplicate of string */
+ char *new_str; /* Duplicate of string */
size_t path_len; /* Length of the path */
H5RS_str_t *ret_value;
@@ -387,15 +387,15 @@ int
H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2)
{
/* Can't return invalid value from this function */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5RS_cmp);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5RS_cmp)
/* Sanity check */
- assert(rs1);
- assert(rs1->s);
- assert(rs2);
- assert(rs2->s);
+ HDassert(rs1);
+ HDassert(rs1->s);
+ HDassert(rs2);
+ HDassert(rs2->s);
- FUNC_LEAVE_NOAPI(HDstrcmp(rs1->s,rs2->s));
+ FUNC_LEAVE_NOAPI(HDstrcmp(rs1->s, rs2->s))
} /* end H5RS_cmp() */
@@ -420,13 +420,13 @@ H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2)
ssize_t
H5RS_len(const H5RS_str_t *rs)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5RS_len);
+ FUNC_ENTER_NOAPI_NOFUNC(H5RS_len)
/* Sanity check */
- assert(rs);
- assert(rs->s);
+ HDassert(rs);
+ HDassert(rs->s);
- FUNC_LEAVE_NOAPI((ssize_t)HDstrlen(rs->s));
+ FUNC_LEAVE_NOAPI((ssize_t)HDstrlen(rs->s))
} /* end H5RS_len() */
@@ -454,13 +454,13 @@ H5RS_len(const H5RS_str_t *rs)
char *
H5RS_get_str(const H5RS_str_t *rs)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5RS_get_str);
+ FUNC_ENTER_NOAPI_NOFUNC(H5RS_get_str)
/* Sanity check */
- assert(rs);
- assert(rs->s);
+ HDassert(rs);
+ HDassert(rs->s);
- FUNC_LEAVE_NOAPI(rs->s);
+ FUNC_LEAVE_NOAPI(rs->s)
} /* end H5RS_get_str() */
@@ -486,12 +486,12 @@ H5RS_get_str(const H5RS_str_t *rs)
unsigned
H5RS_get_count(const H5RS_str_t *rs)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5RS_get_count);
+ FUNC_ENTER_NOAPI_NOFUNC(H5RS_get_count)
/* Sanity check */
- assert(rs);
- assert(rs->n>0);
+ HDassert(rs);
+ HDassert(rs->n > 0);
- FUNC_LEAVE_NOAPI(rs->n);
+ FUNC_LEAVE_NOAPI(rs->n)
} /* end H5RS_get_count() */
diff --git a/src/H5ST.c b/src/H5ST.c
index 7dee73f..6d14115 100644
--- a/src/H5ST.c
+++ b/src/H5ST.c
@@ -50,19 +50,19 @@ H5FL_DEFINE_STATIC(H5ST_tree_t);
H5ST_tree_t *
H5ST_create(void)
{
- H5ST_tree_t *ret_value=NULL; /* Return value */
+ H5ST_tree_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5ST_create,NULL);
+ FUNC_ENTER_NOAPI(H5ST_create, NULL)
/* Allocate wrapper for TST */
- if((ret_value=H5FL_MALLOC(H5ST_tree_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,NULL,"memory allocation failed");
+ if(NULL == (ret_value = H5FL_MALLOC(H5ST_tree_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set the internal fields */
- ret_value->root=NULL;
+ ret_value->root = NULL;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ST_create() */
@@ -178,16 +178,16 @@ H5ST_insert(H5ST_tree_t *tree, const char *s, void *obj)
p = &tree->root;
while((pp = *p)) {
/* If this node matches the character in the key, then drop down to the lower tree */
- if ((d = *s - pp->splitchar) == 0) {
- if (*s++ == 0)
- HGOTO_ERROR(H5E_TST,H5E_EXISTS,FAIL,"key already in tree");
+ if(0 == (d = *s - pp->splitchar)) {
+ if(*s++ == 0)
+ HGOTO_ERROR(H5E_TST, H5E_EXISTS, FAIL, "key already in tree")
up=pp;
p = &(pp->eqkid);
} /* end if */
else {
/* Walk through the current tree, searching for the matching character */
- parent=pp;
- if (d < 0)
+ parent = pp;
+ if(d < 0)
p = &(pp->lokid);
else
p = &(pp->hikid);
@@ -196,8 +196,8 @@ H5ST_insert(H5ST_tree_t *tree, const char *s, void *obj)
/* Finish walking through the key string, adding nodes until the end */
for (;;) {
- if((*p = H5FL_MALLOC(H5ST_node_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed");
+ if(NULL == (*p = H5FL_MALLOC(H5ST_node_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
pp = *p;
pp->splitchar = *s;
pp->up = up;
@@ -205,19 +205,19 @@ H5ST_insert(H5ST_tree_t *tree, const char *s, void *obj)
pp->lokid = pp->eqkid = pp->hikid = NULL;
/* If this is the end of the key string, break out */
- if (*s++ == 0) {
- pp->eqkid = (H5ST_ptr_t) obj;
+ if(*s++ == 0) {
+ pp->eqkid = (H5ST_ptr_t)obj;
break;
} /* end if */
/* Continue to next character */
- parent=NULL;
- up=pp;
+ parent = NULL;
+ up = pp;
p = &(pp->eqkid);
} /* end for */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ST_insert() */
@@ -247,7 +247,7 @@ H5ST_search(H5ST_tree_t *tree, const char *s)
H5ST_ptr_t p; /* Temporary pointer to TST node */
htri_t ret_value=FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOFUNC(H5ST_search);
+ FUNC_ENTER_NOAPI_NOFUNC(H5ST_search)
p = tree->root;
while (p) {
@@ -262,7 +262,7 @@ H5ST_search(H5ST_tree_t *tree, const char *s)
} /* end while */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ST_search() */
@@ -289,9 +289,9 @@ done:
static H5ST_ptr_t
H5ST_find_internal(H5ST_ptr_t p, const char *s)
{
- H5ST_ptr_t ret_value=NULL; /* Return value */
+ H5ST_ptr_t ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_find_internal);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_find_internal)
while (p) {
if (*s < p->splitchar)
@@ -305,7 +305,7 @@ H5ST_find_internal(H5ST_ptr_t p, const char *s)
} /* end while */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ST_find_internal() */
@@ -332,15 +332,15 @@ done:
H5ST_ptr_t
H5ST_find(H5ST_tree_t *tree, const char *s)
{
- H5ST_ptr_t ret_value=NULL; /* Return value */
+ H5ST_ptr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5ST_find,NULL);
+ FUNC_ENTER_NOAPI(H5ST_find, NULL)
- if((ret_value=H5ST_find_internal(tree->root,s))==NULL)
- HGOTO_ERROR(H5E_TST,H5E_NOTFOUND,NULL,"key not found in TST");
+ if(NULL == (ret_value = H5ST_find_internal(tree->root, s)))
+ HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ST_find() */
@@ -369,17 +369,17 @@ H5ST_locate(H5ST_tree_t *tree, const char *s)
H5ST_ptr_t node; /* Pointer to node located */
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5ST_locate,NULL);
+ FUNC_ENTER_NOAPI(H5ST_locate, NULL)
/* Locate the node to remove */
- if((node=H5ST_find_internal(tree->root,s))==NULL)
- HGOTO_ERROR(H5E_TST,H5E_NOTFOUND,NULL,"key not found in TST");
+ if(NULL == (node = H5ST_find_internal(tree->root, s)))
+ HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST")
/* Get the pointer to the object to return */
- ret_value=node->eqkid;
+ ret_value = node->eqkid;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5ST_locate() */
@@ -404,28 +404,28 @@ done:
static H5ST_ptr_t
H5ST_findfirst_internal(H5ST_ptr_t p)
{
- H5ST_ptr_t ret_value=NULL; /* Return value */
+ H5ST_ptr_t ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_findfirst_internal);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_findfirst_internal)
while(p) {
/* Find least node in current tree */
while(p->lokid)
- p=p->lokid;
+ p = p->lokid;
/* Is least node '\0'? */
- if(p->splitchar=='\0') {
+ if(p->splitchar == '\0') {
/* Return it */
HGOTO_DONE(p);
} /* end if */
else {
/* Go down to next level of tree */
- p=p->eqkid;
+ p = p->eqkid;
} /* end else */
} /* end while */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ST_findfirst_internal() */
@@ -452,13 +452,13 @@ H5ST_findfirst(H5ST_tree_t *tree)
{
H5ST_ptr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5ST_findfirst,NULL);
+ FUNC_ENTER_NOAPI(H5ST_findfirst, NULL)
- if((ret_value=H5ST_findfirst_internal(tree->root))==NULL)
+ if(NULL == (ret_value = H5ST_findfirst_internal(tree->root)))
HGOTO_ERROR(H5E_TST,H5E_NOTFOUND,NULL,"no nodes in TST");
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ST_findfirst() */
@@ -483,40 +483,40 @@ done:
static H5ST_ptr_t
H5ST_getnext(H5ST_ptr_t p)
{
- H5ST_ptr_t ret_value=NULL; /* Return value */
+ H5ST_ptr_t ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_getnext);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_getnext)
/* If the node to continue from has higher-valued nodes attached */
if(p->hikid) {
/* Go to first higher-valued node */
- p=p->hikid;
+ p = p->hikid;
/* Find least node from here */
while(p->lokid)
- p=p->lokid;
+ p = p->lokid;
HGOTO_DONE(p);
} /* end if */
else {
H5ST_ptr_t q; /* Temporary TST node pointer */
/* Go up one level in current tree */
- q=p->parent;
- if(q==NULL)
+ q = p->parent;
+ if(q == NULL)
HGOTO_DONE(NULL);
/* While the previous node was the higher-valued node, keep backing up the tree */
- while(q->hikid==p) {
- p=q;
- q=p->parent;
- if(q==NULL)
+ while(q->hikid == p) {
+ p = q;
+ q = p->parent;
+ if(NULL == q)
HGOTO_DONE(NULL);
} /* end while */
HGOTO_DONE(q);
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ST_getnext() */
@@ -542,22 +542,22 @@ H5ST_ptr_t
H5ST_findnext(H5ST_ptr_t p)
{
H5ST_ptr_t q; /* Temporary pointer to TST node */
- H5ST_ptr_t ret_value=NULL; /* Return value */
+ H5ST_ptr_t ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOFUNC(H5ST_findnext);
+ FUNC_ENTER_NOAPI_NOFUNC(H5ST_findnext)
/* Find the next node at the current level, or go back up the tree */
do {
- q=H5ST_getnext(p);
+ q = H5ST_getnext(p);
if(q) {
HGOTO_DONE(H5ST_findfirst_internal(q->eqkid));
} /* end if */
else
- p=p->up;
+ p = p->up;
} while(p);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ST_findnext() */
@@ -661,15 +661,15 @@ H5ST_delete_internal(H5ST_ptr_t *root, H5ST_ptr_t p)
herr_t
H5ST_delete(H5ST_tree_t *tree, H5ST_ptr_t p)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5ST_delete,FAIL);
+ FUNC_ENTER_NOAPI(H5ST_delete, FAIL)
- if(H5ST_delete_internal(&tree->root,p)<0)
- HGOTO_ERROR(H5E_TST,H5E_CANTDELETE,FAIL,"can't delete node from TST");
+ if(H5ST_delete_internal(&tree->root, p) < 0)
+ HGOTO_ERROR(H5E_TST, H5E_CANTDELETE, FAIL, "can't delete node from TST")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ST_delete() */
@@ -698,21 +698,21 @@ H5ST_remove(H5ST_tree_t *tree, const char *s)
H5ST_ptr_t node; /* Pointer to node to remove */
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5ST_remove,NULL);
+ FUNC_ENTER_NOAPI(H5ST_remove, NULL)
/* Locate the node to remove */
- if((node=H5ST_find_internal(tree->root,s))==NULL)
- HGOTO_ERROR(H5E_TST,H5E_NOTFOUND,NULL,"key not found in TST");
+ if(NULL == (node = H5ST_find_internal(tree->root, s)))
+ HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST")
/* Get the pointer to the object to return */
- ret_value=node->eqkid;
+ ret_value = node->eqkid;
/* Remove the node from the TST */
- if(H5ST_delete_internal(&tree->root,node)<0)
- HGOTO_ERROR(H5E_TST,H5E_CANTDELETE,NULL,"can't delete node from TST");
+ if(H5ST_delete_internal(&tree->root, node) < 0)
+ HGOTO_ERROR(H5E_TST, H5E_CANTDELETE, NULL, "can't delete node from TST")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5ST_remove() */
#ifdef H5ST_DEBUG
@@ -738,26 +738,26 @@ done:
herr_t
H5ST_dump_internal(H5ST_ptr_t p)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_dump_internal);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_dump_internal)
- if (p) {
- printf("p=%p\n",p);
- printf("\tp->up=%p\n",p->up);
- printf("\tp->parent=%p\n",p->parent);
- printf("\tp->lokid=%p\n",p->lokid);
- printf("\tp->hikid=%p\n",p->hikid);
- printf("\tp->eqkid=%p\n",p->eqkid);
- printf("\tp->splitchar=%c\n",p->splitchar);
+ if(p) {
+ printf("p=%p\n", p);
+ printf("\tp->up=%p\n", p->up);
+ printf("\tp->parent=%p\n", p->parent);
+ printf("\tp->lokid=%p\n", p->lokid);
+ printf("\tp->hikid=%p\n", p->hikid);
+ printf("\tp->eqkid=%p\n", p->eqkid);
+ printf("\tp->splitchar=%c\n", p->splitchar);
H5ST_dump_internal(p->lokid);
- if (p->splitchar)
+ if(p->splitchar)
H5ST_dump_internal(p->eqkid);
else
- printf("%s\n", (char *) p->eqkid);
+ printf("%s\n", (char *)p->eqkid);
H5ST_dump_internal(p->hikid);
} /* end if */
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5ST_dump_internal() */
@@ -782,11 +782,12 @@ H5ST_dump_internal(H5ST_ptr_t p)
herr_t
H5ST_dump(H5ST_tree_t *tree)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5ST_dump,NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5ST_dump, NULL)
/* Dump the tree */
H5ST_dump_internal(tree->root);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5ST_dump() */
#endif /* H5ST_DEBUG */
+
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 1f69706..72d61e6 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -107,17 +107,17 @@ H5S_mpio_all_type( const H5S_t *space, size_t elmt_size,
hsize_t nelmts; /*total number of elmts */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT(H5S_mpio_all_type);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_mpio_all_type)
/* Check args */
- assert (space);
+ HDassert(space);
/* Just treat the entire extent as a block of bytes */
- if((snelmts = H5S_GET_EXTENT_NPOINTS(space))<0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
- H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
+ if((snelmts = H5S_GET_EXTENT_NPOINTS(space)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
+ H5_ASSIGN_OVERFLOW(nelmts, snelmts, hssize_t, hsize_t);
- total_bytes = (hsize_t)elmt_size*nelmts;
+ total_bytes = (hsize_t)elmt_size * nelmts;
/* fill in the return values */
*new_type = MPI_BYTE;
@@ -126,7 +126,7 @@ H5S_mpio_all_type( const H5S_t *space, size_t elmt_size,
*is_derived_type = FALSE;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_mpio_all_type() */
@@ -210,7 +210,7 @@ H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size,
hbool_t *is_derived_type )
{
H5S_sel_iter_t sel_iter; /* Selection iteration info */
- hbool_t sel_iter_init=0; /* Selection iteration info has been initialized */
+ hbool_t sel_iter_init = FALSE; /* Selection iteration info has been initialized */
struct dim { /* less hassle than malloc/free & ilk */
hssize_t start;
@@ -234,27 +234,27 @@ H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size,
FUNC_ENTER_NOAPI_NOINIT(H5S_mpio_hyper_type);
/* Check args */
- assert (space);
- assert(sizeof(MPI_Aint) >= sizeof(elmt_size));
- if (0==elmt_size)
+ HDassert(space);
+ HDassert(sizeof(MPI_Aint) >= sizeof(elmt_size));
+ if(0 == elmt_size)
goto empty;
/* Initialize selection iterator */
- if (H5S_select_iter_init(&sel_iter, space, elmt_size)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator");
- sel_iter_init=1; /* Selection iteration info has been initialized */
+ if(H5S_select_iter_init(&sel_iter, space, elmt_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
+ sel_iter_init = 1; /* Selection iteration info has been initialized */
/* Abbreviate args */
- diminfo=sel_iter.u.hyp.diminfo;
- assert (diminfo);
+ diminfo = sel_iter.u.hyp.diminfo;
+ HDassert(diminfo);
/* make a local copy of the dimension info so we can operate with them */
/* Check if this is a "flattened" regular hyperslab selection */
if(sel_iter.u.hyp.iter_rank!=0 && sel_iter.u.hyp.iter_rank<space->extent.rank) {
/* Flattened selection */
- rank=sel_iter.u.hyp.iter_rank;
- assert (rank >= 0 && rank<=H5S_MAX_RANK); /* within array bounds */
+ rank = sel_iter.u.hyp.iter_rank;
+ HDassert(rank >= 0 && rank <= H5S_MAX_RANK); /* within array bounds */
if (0==rank)
goto empty;
#ifdef H5S_DEBUG
@@ -288,7 +288,7 @@ H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size,
else {
/* Non-flattened selection */
rank = space->extent.rank;
- assert (rank >= 0 && rank<=H5S_MAX_RANK); /* within array bounds */
+ HDassert(rank >= 0 && rank<=H5S_MAX_RANK); /* within array bounds */
if (0==rank)
goto empty;
#ifdef H5S_DEBUG
@@ -509,47 +509,39 @@ H5S_mpio_span_hyper_type( const H5S_t *space,
MPI_Datatype *new_type,/* out: */
size_t *count,
hsize_t *extra_offset,
- hbool_t *is_derived_type ){
-
- MPI_Datatype span_type;
- H5S_hyper_span_t *ospan;
- H5S_hyper_span_info_t *odown;
- hsize_t *size;
- int rank;
- int mpi_code;
- herr_t ret_value = SUCCEED;
- MPI_Aint extent,lb;
-
-
- FUNC_ENTER_NOAPI_NOINIT(H5S_mpio_span_hyper_type);
-
- /* Check args */
- assert (space);
+ hbool_t *is_derived_type )
+{
- /* assert(sizeof(MPI_Aint) >= sizeof(elmt_size)); not sure the reason*/
+ MPI_Datatype span_type;
+ H5S_hyper_span_t *ospan;
+ H5S_hyper_span_info_t *odown;
+ hsize_t *size;
+ int mpi_code;
+ herr_t ret_value = SUCCEED;
+ FUNC_ENTER_NOAPI_NOINIT(H5S_mpio_span_hyper_type)
- rank = space->extent.rank;
+ /* Check args */
+ HDassert(space);
- /* size = HDcalloc((size_t)rank,sizeof(hsize_t)); */
- if (0==elmt_size)
+ if(0 == elmt_size)
goto empty;
size = space->extent.size;
- if(size == 0)
+ if(0 == size)
goto empty;
odown = space->select.sel_info.hslab->span_lst;
- if(odown == NULL)
- goto empty;
+ if(NULL == odown)
+ goto empty;
ospan = odown->head;
- if(ospan == NULL)
- goto empty;
+ if(NULL == ospan)
+ goto empty;
/* obtain derived data type */
- if(FAIL == H5S_obtain_datatype(space->extent.size,ospan,&span_type,elmt_size,rank))
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't obtain MPI derived data type");
+ if(FAIL == H5S_obtain_datatype(space->extent.size, ospan, &span_type, elmt_size, space->extent.rank))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't obtain MPI derived data type")
- if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&span_type)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&span_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code);
*new_type = span_type;
@@ -558,7 +550,7 @@ H5S_mpio_span_hyper_type( const H5S_t *space,
*extra_offset = 0;
*is_derived_type = TRUE;
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
empty:
/* special case: empty hyperslab */
@@ -568,8 +560,8 @@ empty:
*is_derived_type = FALSE;
done:
- FUNC_LEAVE_NOAPI(ret_value);
- }
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_mpio_span_hyper_type() */
/*-------------------------------------------------------------------------
@@ -585,173 +577,162 @@ done:
* Programmer: kyang
*
*/
-static herr_t H5S_obtain_datatype(const hsize_t size[],
+static herr_t
+H5S_obtain_datatype(const hsize_t size[],
H5S_hyper_span_t* span,
MPI_Datatype *span_type,
size_t elmt_size,
int dimindex)
{
-
- int innercount,outercount;
- MPI_Datatype bas_type;
- MPI_Datatype temp_type;
- MPI_Datatype tempinner_type;
- MPI_Datatype *inner_type;
- int *blocklen;
- MPI_Aint *disp;
- MPI_Aint stride;
- MPI_Aint extent,lb;
- H5S_hyper_span_info_t *down;
- H5S_hyper_span_t *tspan;
- int mpi_code;
- herr_t ret_value = SUCCEED;
-
+ int innercount, outercount;
+ MPI_Datatype bas_type;
+ MPI_Datatype temp_type;
+ MPI_Datatype tempinner_type;
+ MPI_Datatype *inner_type;
+ int *blocklen;
+ MPI_Aint *disp;
+ MPI_Aint stride;
+ H5S_hyper_span_info_t *down;
+ H5S_hyper_span_t *tspan;
#ifdef H5_HAVE_MPI2
- MPI_Aint sizeaint,sizedtype;
+ MPI_Aint sizeaint, sizedtype;
#endif /* H5_HAVE_MPI2 */
- hsize_t total_lowd,total_lowd1;
- int i;
- int ret;
-
- FUNC_ENTER_NOAPI_NOINIT(H5S_obtain_datatype);
- assert(span);
-
- inner_type = NULL;
- down = NULL;
- tspan = NULL;
- down = span->down;
- tspan = span;
-
- outercount = 0;
-
-/* obtain the number of span tree for this dimension */
- while(tspan) {
- tspan = tspan->next;
- outercount ++;
- }
-
- if(outercount == 0) {
- span_type = NULL;
- return 0;
- }
+ hsize_t total_lowd, total_lowd1;
+ int i;
+ int mpi_code;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT(H5S_obtain_datatype)
+
+ HDassert(span);
+
+ inner_type = NULL;
+ down = NULL;
+ tspan = NULL;
+ down = span->down;
+ tspan = span;
+
+ /* obtain the number of span tree for this dimension */
+ outercount = 0;
+ while(tspan) {
+ tspan = tspan->next;
+ outercount++;
+ } /* end while */
+ if(outercount == 0)
+ HGOTO_DONE(SUCCEED)
/* MPI2 hasn't been widely acccepted, adding H5_HAVE_MPI2 for the future use */
#ifdef H5_HAVE_MPI2
- MPI_Type_extent(MPI_Aint,&sizeaint);
- MPI_Type_extent(MPI_Datatype,&sizedtype);
+ MPI_Type_extent(MPI_Aint, &sizeaint);
+ MPI_Type_extent(MPI_Datatype, &sizedtype);
- blocklen = (int *)HDcalloc((size_t)outercount,sizeof(int));
- disp = (MPI_Aint *)HDcalloc((size_t)outercount,sizeaint);
- inner_type = (MPI_Datatype *)HDcalloc((size_t)outercount,sizedtype);
+ blocklen = (int *)HDcalloc((size_t)outercount, sizeof(int));
+ disp = (MPI_Aint *)HDcalloc((size_t)outercount, sizeaint);
+ inner_type = (MPI_Datatype *)HDcalloc((size_t)outercount, sizedtype);
#else
- blocklen = (int *)HDcalloc((size_t)outercount,sizeof(int));
- disp = (MPI_Aint *)HDcalloc((size_t)outercount,sizeof(MPI_Aint));
- inner_type = (MPI_Datatype *)HDcalloc((size_t)outercount,sizeof(MPI_Datatype));
+ blocklen = (int *)HDcalloc((size_t)outercount, sizeof(int));
+ disp = (MPI_Aint *)HDcalloc((size_t)outercount, sizeof(MPI_Aint));
+ inner_type = (MPI_Datatype *)HDcalloc((size_t)outercount, sizeof(MPI_Datatype));
#endif
- tspan = span;
- outercount = 0;
+ tspan = span;
+ outercount = 0;
- /* if this is the fastest changing dimension, it is the base case for derived datatype. */
- if(down == NULL){
+ /* if this is the fastest changing dimension, it is the base case for derived datatype. */
+ if(down == NULL){
- assert(dimindex <= 1);
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE,&bas_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code);
+ HDassert(dimindex <= 1);
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&bas_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code);
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE,&bas_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code);
- while(tspan){
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&bas_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code);
- disp[outercount] = (MPI_Aint)elmt_size * tspan->low;
- blocklen[outercount] = tspan->nelem;
- tspan = tspan->next;
- outercount ++;
- }
+ while(tspan) {
+ disp[outercount] = (MPI_Aint)elmt_size * tspan->low;
+ blocklen[outercount] = tspan->nelem;
+ tspan = tspan->next;
+ outercount++;
+ } /* end while */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_hindexed(outercount,blocklen,
- disp,bas_type,span_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_hindexed failed", mpi_code);
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_hindexed(outercount, blocklen, disp, bas_type, span_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_hindexed failed", mpi_code);
+ } /* end if */
+ else {/* dimindex is the rank of the dimension */
- }
- else {/* dimindex is the rank of the dimension */
+ HDassert(dimindex > 1);
- assert(dimindex >1);
- /* Calculate the total bytes of the lower dimension */
- total_lowd = 1; /* one dimension down */
- total_lowd1 = 1; /* two dimensions down */
+ /* Calculate the total bytes of the lower dimension */
+ total_lowd = 1; /* one dimension down */
+ total_lowd1 = 1; /* two dimensions down */
- for ( i = dimindex-1; i > 0; i--)
- total_lowd = total_lowd * size[i];
+ for ( i = dimindex-1; i > 0; i--)
+ total_lowd = total_lowd * size[i];
- for ( i = dimindex-1; i > 1; i--)
- total_lowd1 = total_lowd1 * size[i];
+ for ( i = dimindex-1; i > 1; i--)
+ total_lowd1 = total_lowd1 * size[i];
- while(tspan){
+ while(tspan) {
- /* Displacement should be in byte and should have dimension information */
- /* First using MPI Type vector to build derived data type for this span only */
- /* Need to calculate the disp in byte for this dimension. */
- /* Calculate the total bytes of the lower dimension */
+ /* Displacement should be in byte and should have dimension information */
+ /* First using MPI Type vector to build derived data type for this span only */
+ /* Need to calculate the disp in byte for this dimension. */
+ /* Calculate the total bytes of the lower dimension */
- disp[outercount] = tspan->low*total_lowd*elmt_size;
- blocklen[outercount] = 1;
+ disp[outercount] = tspan->low*total_lowd*elmt_size;
+ blocklen[outercount] = 1;
- /* generating inner derived datatype by using MPI_Type_hvector */
- if(FAIL == H5S_obtain_datatype(size,tspan->down->head,&temp_type,elmt_size,dimindex-1))
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't obtain MPI derived data type");
+ /* generating inner derived datatype by using MPI_Type_hvector */
+ if(FAIL == H5S_obtain_datatype(size,tspan->down->head,&temp_type,elmt_size,dimindex-1))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't obtain MPI derived data type")
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&temp_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code);
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&temp_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code);
- /* building the inner vector datatype */
- stride = total_lowd*elmt_size;
- innercount = tspan->nelem;
+ /* building the inner vector datatype */
+ stride = total_lowd*elmt_size;
+ innercount = tspan->nelem;
- if(MPI_SUCCESS != (mpi_code = MPI_Type_hvector(innercount,1,stride,temp_type,&tempinner_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_hvector failed", mpi_code);
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_hvector(innercount,1,stride,temp_type,&tempinner_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_hvector failed", mpi_code);
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&tempinner_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code);
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&tempinner_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code);
- if(MPI_SUCCESS != (mpi_code =MPI_Type_free(&temp_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed",mpi_code);
- inner_type[outercount] = tempinner_type;
- outercount ++;
- tspan = tspan->next;
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&temp_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code);
- }
+ inner_type[outercount] = tempinner_type;
+ outercount ++;
+ tspan = tspan->next;
+ } /* end while */
- /* building the whole vector datatype */
- if(MPI_SUCCESS != (mpi_code =
- MPI_Type_struct(outercount,blocklen,disp,inner_type,span_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_struct failed", mpi_code);
-
- }
+ /* building the whole vector datatype */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_struct(outercount, blocklen, disp, inner_type, span_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_struct failed", mpi_code);
+ } /* end else */
- if(inner_type != NULL){
- if(down != NULL) {
- for(i=0;i<outercount;i++)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&inner_type[i])))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed",mpi_code);
- }
- }
+ if(inner_type != NULL && down != NULL) {
+ for(i = 0; i < outercount; i++)
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&inner_type[i])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code);
+ } /* end if */
- if(inner_type != NULL)
- HDfree(inner_type);
- if(blocklen != NULL)
- HDfree(blocklen);
- if(disp != NULL)
- HDfree(disp);
+ if(inner_type != NULL)
+ HDfree(inner_type);
+ if(blocklen != NULL)
+ HDfree(blocklen);
+ if(disp != NULL)
+ HDfree(disp);
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_obtain_datatype() */
@@ -791,7 +772,7 @@ H5S_mpio_space_type( const H5S_t *space, size_t elmt_size,
FUNC_ENTER_NOAPI_NOINIT(H5S_mpio_space_type);
/* Check args */
- assert (space);
+ HDassert(space);
/* Creat MPI type based on the kind of selection */
switch (H5S_GET_EXTENT_TYPE(space)) {
@@ -830,13 +811,13 @@ H5S_mpio_space_type( const H5S_t *space, size_t elmt_size,
break;
default:
- assert("unknown selection type" && 0);
+ HDassert("unknown selection type" && 0);
break;
} /* end switch */
break;
default:
- assert("unknown data space type" && 0);
+ HDassert("unknown data space type" && 0);
break;
}
@@ -845,3 +826,4 @@ done:
}
#endif /* H5_HAVE_PARALLEL */
+
diff --git a/src/H5Z.c b/src/H5Z.c
index 6ca352f..4df6abd 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -271,17 +271,17 @@ done:
herr_t
H5Z_register (const H5Z_class_t *cls)
{
- size_t i;
- herr_t ret_value=SUCCEED; /* Return value */
+ size_t i;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5Z_register, FAIL)
- assert (cls);
- assert (cls->id>=0 && cls->id<=H5Z_FILTER_MAX);
+ HDassert(cls);
+ HDassert(cls->id >= 0 && cls->id <= H5Z_FILTER_MAX);
/* Is the filter already registered? */
- for (i=0; i<H5Z_table_used_g; i++)
- if (H5Z_table_g[i].id==cls->id)
+ for(i = 0; i < H5Z_table_used_g; i++)
+ if(H5Z_table_g[i].id == cls->id)
break;
/* Filter not already registered */
@@ -572,7 +572,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty
break;
default:
- assert("invalid prelude type" && 0);
+ HDassert("invalid prelude type" && 0);
} /* end switch */
} /* end else */
} /* end for */