From af6276f6543d06c9f18939cc8b810f57397b7a67 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 18 Apr 2005 16:21:35 -0500 Subject: [svn-r10628] Purpose: Code cleanup Description: Clean up various warnings reported by the Windows team. Platforms tested: FreeBSD 4.11 (sleipnir) Too minor to require h5committest --- c++/src/H5DataType.cpp | 14 +++++++------- c++/src/H5DataType.h | 2 +- hl/src/H5TB.c | 4 ---- src/H5B2.c | 7 ++++--- src/H5B2test.c | 2 +- src/H5Dmpio.c | 4 +--- src/H5FD.c | 4 ++-- src/H5FDcore.c | 12 ++++++------ src/H5FDfamily.c | 12 ++++++------ src/H5FDfphdf5.c | 16 ++++++++-------- src/H5FDfphdf5.h | 2 +- src/H5FDlog.c | 12 ++++++------ src/H5FDmpio.c | 12 ++++++------ src/H5FDmpiposix.c | 12 ++++++------ src/H5FDmulti.c | 31 ++++++++++++++----------------- src/H5FDprivate.h | 4 ++-- src/H5FDpublic.h | 4 ++-- src/H5FDsec2.c | 12 ++++++------ src/H5FDstdio.c | 12 ++++++------ src/H5FDstream.c | 12 ++++++------ src/H5FPclient.c | 2 +- src/H5FPprivate.h | 2 +- src/H5Pdcpl.c | 1 - src/H5S.c | 6 ++++-- src/H5SL.c | 2 +- src/H5Zshuffle.c | 5 ++++- test/dt_atomic.c | 12 ++++++------ test/hyperslab.c | 6 +++--- tools/lib/h5diff.c | 4 +++- 29 files changed, 114 insertions(+), 116 deletions(-) diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index e370531..c6e7560 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -95,13 +95,13 @@ DataType::DataType(const DataType& original) : H5Object(original) ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 // Modification -// Replaced resetIdComponent with decRefCount to use new ID -// reference counting mechanisms by Quincey Koziol, June 1, 2004 +// Replaced resetIdComponent with decRefCount to use C library +// ID reference counting mechanism - BMR, Feb 20, 2005 //-------------------------------------------------------------------------- void DataType::copy( const DataType& like_type ) { - // reset the identifier of this instance, H5Tclose will be called - // if needed + // reset the identifier of this instance, H5Tclose will be called + // if needed if( is_predtype == false ) { try { decRefCount(); @@ -249,7 +249,7 @@ H5T_conv_t DataType::find( const DataType& dest, H5T_cdata_t **pcdata ) const ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataType::convert( const DataType& dest, hsize_t nelmts, void *buf, void *background, PropList& plist ) const +void DataType::convert( const DataType& dest, size_t nelmts, void *buf, void *background, PropList& plist ) const { // Get identifiers for C API hid_t dest_id = dest.getId(); @@ -625,8 +625,8 @@ void DataType::close() ///\brief Properly terminates access to this datatype. // Programmer Binh-Minh Ribler - 2000 // Modification -// Replaced resetIdComponent with decRefCount to use new ID -// reference counting mechanisms by Quincey Koziol, June 1, 2004 +// Replaced resetIdComponent with decRefCount to use C library +// ID reference counting mechanism - BMR, Feb 20, 2005 //-------------------------------------------------------------------------- DataType::~DataType() { diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 54e9cc9..f6a30ff 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -51,7 +51,7 @@ class H5_DLLCPP DataType : public H5Object { H5T_conv_t find( const DataType& dest, H5T_cdata_t **pcdata ) const; // Converts data from between specified datatypes. - void convert( const DataType& dest, hsize_t nelmts, void *buf, void *background, PropList& plist ) const; + void convert( const DataType& dest, size_t nelmts, void *buf, void *background, PropList& plist ) const; // Assignment operator DataType& operator=( const DataType& rhs ); diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index d006176..59642da 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -305,12 +305,8 @@ herr_t H5TBappend_records( hid_t loc_id, hid_t did; hid_t tid=-1; hid_t mem_type_id=-1; - hsize_t count[1]; - hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; - hsize_t dims[1]; - hsize_t mem_dims[1]; hsize_t nrecords_orig; hsize_t nfields; diff --git a/src/H5B2.c b/src/H5B2.c index 34eb96b..0692b90 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -320,7 +320,8 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, bt2->cache_info.is_dirty = TRUE; bt2->depth = 0; bt2->root.addr = HADDR_UNDEF; - bt2->root.node_nrec = bt2->root.all_nrec = 0; + bt2->root.node_nrec = 0; + bt2->root.all_nrec = 0; /* Initialize shared B-tree info */ if(H5B2_shared_init(f, bt2, type, node_size, rrec_size, split_percent, merge_percent)<0) @@ -532,8 +533,8 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared) /* Determine total number of records in new child nodes */ if(bt2->depth>0) { unsigned u; /* Local index variable */ - unsigned new_left_all_nrec; /* New total number of records in left child */ - unsigned new_right_all_nrec; /* New total number of records in right child */ + hsize_t new_left_all_nrec; /* New total number of records in left child */ + hsize_t new_right_all_nrec; /* New total number of records in right child */ /* Compute total of all records in each child node */ new_left_all_nrec = new_root->node_ptrs[0].node_nrec; diff --git a/src/H5B2test.c b/src/H5B2test.c index fa847af..cac5e30 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -125,7 +125,7 @@ H5B2_test_compare(const void *rec1, const void *rec2) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_compare) - FUNC_LEAVE_NOAPI(*(const hssize_t *)rec1-*(const hssize_t *)rec2); + FUNC_LEAVE_NOAPI((herr_t)(*(const hssize_t *)rec1-*(const hssize_t *)rec2)); } /* H5B2_test_compare() */ diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index ec2da95..e216d85 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -578,7 +578,7 @@ H5D_mpio_spaces_write(H5D_io_info_t *io_info, * Function: H5D_mpio_spaces_span_read * * Purpose: MPI-IO function to read directly from app buffer to file for - span-tree + span-tree * * Return: non-negative on success, negative on failure. * @@ -641,9 +641,7 @@ H5D_mpio_spaces_span_write(H5D_io_info_t *io_info, FUNC_ENTER_NOAPI_NOFUNC(H5D_mpio_spaces_span_write); - fflush(stdout); /*OKAY: CAST DISCARDS CONST QUALIFIER*/ - ret_value = H5D_mpio_spaces_span_xfer(io_info, elmt_size, file_space, mem_space, (void*)buf, 1/*write*/); diff --git a/src/H5FD.c b/src/H5FD.c index d2f95d6..1abe23a 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -2883,7 +2883,7 @@ done: *------------------------------------------------------------------------- */ haddr_t -H5FD_get_eoa(H5FD_t *file) +H5FD_get_eoa(const H5FD_t *file) { haddr_t ret_value; @@ -3048,7 +3048,7 @@ done: *------------------------------------------------------------------------- */ haddr_t -H5FD_get_eof(H5FD_t *file) +H5FD_get_eof(const H5FD_t *file) { haddr_t ret_value; diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 11d5cd3..b72887c 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -89,9 +89,9 @@ static H5FD_t *H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); static herr_t H5FD_core_close(H5FD_t *_file); static int H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static haddr_t H5FD_core_get_eoa(H5FD_t *_file); +static haddr_t H5FD_core_get_eoa(const H5FD_t *_file); static herr_t H5FD_core_set_eoa(H5FD_t *_file, haddr_t addr); -static haddr_t H5FD_core_get_eof(H5FD_t *_file); +static haddr_t H5FD_core_get_eof(const H5FD_t *_file); static herr_t H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); @@ -531,11 +531,11 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_core_get_eoa(H5FD_t *_file) +H5FD_core_get_eoa(const H5FD_t *_file) { haddr_t ret_value; /* Return value */ - H5FD_core_t *file = (H5FD_core_t*)_file; + const H5FD_core_t *file = (const H5FD_core_t*)_file; FUNC_ENTER_NOAPI(H5FD_core_get_eoa, HADDR_UNDEF) @@ -604,11 +604,11 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_core_get_eof(H5FD_t *_file) +H5FD_core_get_eof(const H5FD_t *_file) { haddr_t ret_value; /* Return value */ - H5FD_core_t *file = (H5FD_core_t*)_file; + const H5FD_core_t *file = (const H5FD_core_t*)_file; FUNC_ENTER_NOAPI(H5FD_core_get_eof, HADDR_UNDEF) diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 9ee9d2e..83e6c75 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -89,9 +89,9 @@ static H5FD_t *H5FD_family_open(const char *name, unsigned flags, static herr_t H5FD_family_close(H5FD_t *_file); static int H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_family_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_family_get_eoa(H5FD_t *_file); +static haddr_t H5FD_family_get_eoa(const H5FD_t *_file); static herr_t H5FD_family_set_eoa(H5FD_t *_file, haddr_t eoa); -static haddr_t H5FD_family_get_eof(H5FD_t *_file); +static haddr_t H5FD_family_get_eof(const H5FD_t *_file); static herr_t H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *_buf/*out*/); @@ -862,9 +862,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_family_get_eoa(H5FD_t *_file) +H5FD_family_get_eoa(const H5FD_t *_file) { - H5FD_family_t *file = (H5FD_family_t*)_file; + const H5FD_family_t *file = (const H5FD_family_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_family_get_eoa, HADDR_UNDEF) @@ -970,9 +970,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_family_get_eof(H5FD_t *_file) +H5FD_family_get_eof(const H5FD_t *_file) { - H5FD_family_t *file = (H5FD_family_t*)_file; + const H5FD_family_t *file = (const H5FD_family_t*)_file; haddr_t eof=0; int i; /* Local index variable */ haddr_t ret_value; /* Return value */ diff --git a/src/H5FDfphdf5.c b/src/H5FDfphdf5.c index c2ea3d1..de25c33 100644 --- a/src/H5FDfphdf5.c +++ b/src/H5FDfphdf5.c @@ -51,9 +51,9 @@ static H5FD_t *H5FD_fphdf5_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); static herr_t H5FD_fphdf5_close(H5FD_t *_file); static herr_t H5FD_fphdf5_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_fphdf5_get_eoa(H5FD_t *_file); +static haddr_t H5FD_fphdf5_get_eoa(const H5FD_t *_file); static herr_t H5FD_fphdf5_set_eoa(H5FD_t *_file, haddr_t addr); -static haddr_t H5FD_fphdf5_get_eof(H5FD_t *_file); +static haddr_t H5FD_fphdf5_get_eof(const H5FD_t *_file); static herr_t H5FD_fphdf5_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle); static herr_t H5FD_fphdf5_read(H5FD_t *_file, H5FD_mem_t mem_type, hid_t dxpl_id, @@ -359,9 +359,9 @@ done: *------------------------------------------------------------------------- */ hbool_t -H5FD_fphdf5_is_sap(H5FD_t *_file) +H5FD_fphdf5_is_sap(const H5FD_t *_file) { - H5FD_fphdf5_t *file = (H5FD_fphdf5_t*)_file; + const H5FD_fphdf5_t *file = (const H5FD_fphdf5_t*)_file; hbool_t ret_value = FALSE; FUNC_ENTER_NOAPI(H5FD_fphdf5_is_sap, FALSE) @@ -834,9 +834,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_fphdf5_get_eoa(H5FD_t *_file) +H5FD_fphdf5_get_eoa(const H5FD_t *_file) { - H5FD_fphdf5_t *file = (H5FD_fphdf5_t *)_file; + const H5FD_fphdf5_t *file = (const H5FD_fphdf5_t *)_file; unsigned req_id = 0; H5FP_status_t status = H5FP_STATUS_OK; haddr_t ret_value; @@ -921,9 +921,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_fphdf5_get_eof(H5FD_t *_file) +H5FD_fphdf5_get_eof(const H5FD_t *_file) { - H5FD_fphdf5_t *file = (H5FD_fphdf5_t*)_file; + const H5FD_fphdf5_t *file = (const H5FD_fphdf5_t*)_file; haddr_t ret_value; FUNC_ENTER_NOAPI(H5FD_fphdf5_get_eof, HADDR_UNDEF) diff --git a/src/H5FDfphdf5.h b/src/H5FDfphdf5.h index 6605b92..c2bbd0b 100644 --- a/src/H5FDfphdf5.h +++ b/src/H5FDfphdf5.h @@ -104,7 +104,7 @@ struct H5P_genplist_t; H5_DLL hid_t H5FD_fphdf5_init(void); H5_DLL void H5FD_fphdf5_term(void); H5_DLL unsigned H5FD_fphdf5_file_id(H5FD_t *_file); -H5_DLL hbool_t H5FD_fphdf5_is_sap(H5FD_t *_file); +H5_DLL hbool_t H5FD_fphdf5_is_sap(const H5FD_t *_file); H5_DLL hbool_t H5FD_fphdf5_is_captain(H5FD_t *_file); H5_DLL hbool_t H5FD_is_fphdf5_driver(H5FD_t *_file); diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 38dcf4f..75c3c20 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -181,9 +181,9 @@ static herr_t H5FD_log_close(H5FD_t *_file); static int H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_log_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); -static haddr_t H5FD_log_get_eoa(H5FD_t *_file); +static haddr_t H5FD_log_get_eoa(const H5FD_t *_file); static herr_t H5FD_log_set_eoa(H5FD_t *_file, haddr_t addr); -static haddr_t H5FD_log_get_eof(H5FD_t *_file); +static haddr_t H5FD_log_get_eof(const H5FD_t *_file); static herr_t H5FD_log_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); @@ -890,9 +890,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_log_get_eoa(H5FD_t *_file) +H5FD_log_get_eoa(const H5FD_t *_file) { - H5FD_log_t *file = (H5FD_log_t*)_file; + const H5FD_log_t *file = (const H5FD_log_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_log_get_eoa, HADDR_UNDEF) @@ -959,9 +959,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_log_get_eof(H5FD_t *_file) +H5FD_log_get_eof(const H5FD_t *_file) { - H5FD_log_t *file = (H5FD_log_t*)_file; + const H5FD_log_t *file = (const H5FD_log_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_log_get_eof, HADDR_UNDEF) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index f46bf9e..920d1e2 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -72,9 +72,9 @@ static H5FD_t *H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); static herr_t H5FD_mpio_close(H5FD_t *_file); static herr_t H5FD_mpio_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_mpio_get_eoa(H5FD_t *_file); +static haddr_t H5FD_mpio_get_eoa(const H5FD_t *_file); static herr_t H5FD_mpio_set_eoa(H5FD_t *_file, haddr_t addr); -static haddr_t H5FD_mpio_get_eof(H5FD_t *_file); +static haddr_t H5FD_mpio_get_eof(const H5FD_t *_file); static herr_t H5FD_mpio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf); @@ -983,9 +983,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_mpio_get_eoa(H5FD_t *_file) +H5FD_mpio_get_eoa(const H5FD_t *_file) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpio_get_eoa, HADDR_UNDEF) @@ -1067,9 +1067,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_mpio_get_eof(H5FD_t *_file) +H5FD_mpio_get_eof(const H5FD_t *_file) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpio_get_eof, HADDR_UNDEF) diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index d1b766f..b6bfa80 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -180,9 +180,9 @@ static H5FD_t *H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_i static herr_t H5FD_mpiposix_close(H5FD_t *_file); static int H5FD_mpiposix_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_mpiposix_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_mpiposix_get_eoa(H5FD_t *_file); +static haddr_t H5FD_mpiposix_get_eoa(const H5FD_t *_file); static herr_t H5FD_mpiposix_set_eoa(H5FD_t *_file, haddr_t addr); -static haddr_t H5FD_mpiposix_get_eof(H5FD_t *_file); +static haddr_t H5FD_mpiposix_get_eof(const H5FD_t *_file); static herr_t H5FD_mpiposix_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); @@ -952,9 +952,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_mpiposix_get_eoa(H5FD_t *_file) +H5FD_mpiposix_get_eoa(const H5FD_t *_file) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + const H5FD_mpiposix_t *file = (const H5FD_mpiposix_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_get_eoa, HADDR_UNDEF) @@ -1028,9 +1028,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_mpiposix_get_eof(H5FD_t *_file) +H5FD_mpiposix_get_eof(const H5FD_t *_file) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + const H5FD_mpiposix_t *file = (const H5FD_mpiposix_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_get_eof, HADDR_UNDEF) diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 1830bf3..eae6488 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -137,9 +137,9 @@ static H5FD_t *H5FD_multi_open(const char *name, unsigned flags, static herr_t H5FD_multi_close(H5FD_t *_file); static int H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_multi_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_multi_get_eoa(H5FD_t *_file); +static haddr_t H5FD_multi_get_eoa(const H5FD_t *_file); static herr_t H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa); -static haddr_t H5FD_multi_get_eof(H5FD_t *_file); +static haddr_t H5FD_multi_get_eof(const H5FD_t *_file); static herr_t H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static haddr_t H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); static herr_t H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, @@ -292,7 +292,7 @@ herr_t H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const char *raw_ext, hid_t raw_plist_id) { - H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; const char *memb_name[H5FD_MEM_NTYPES]; char meta_name[1024], raw_name[1024]; @@ -304,12 +304,12 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, H5Eclear_stack(H5E_DEFAULT); /* Initialize */ - for (mt=H5FD_MEM_DEFAULT; mtmemb[mt] && f2->memb[mt]) break; if (!cmp) { if (f1->memb[mt]) cmp = -1; else if (f2->memb[mt]) cmp = 1; } } END_MEMBERS; - assert(cmp || mt=H5FD_MEM_NTYPES) return cmp; + assert(cmp || out_mt=H5FD_MEM_NTYPES) return cmp; - return H5FDcmp(f1->memb[mt], f2->memb[mt]); + return H5FDcmp(f1->memb[out_mt], f2->memb[out_mt]); } @@ -1442,9 +1439,9 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) *------------------------------------------------------------------------- */ static haddr_t -H5FD_multi_get_eoa(H5FD_t *_file) +H5FD_multi_get_eoa(const H5FD_t *_file) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; + const H5FD_multi_t *file = (const H5FD_multi_t*)_file; /* Clear the error stack */ H5Eclear_stack(H5E_DEFAULT); @@ -1530,9 +1527,9 @@ H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa) *------------------------------------------------------------------------- */ static haddr_t -H5FD_multi_get_eof(H5FD_t *_file) +H5FD_multi_get_eof(const H5FD_t *_file) { - H5FD_multi_t *file = (H5FD_multi_t*)_file; + const H5FD_multi_t *file = (const H5FD_multi_t*)_file; haddr_t eof=0, tmp; static const char *func="H5FD_multi_eof"; /* Function Name for error reporting */ diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index afca51a..6660e49 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -59,9 +59,9 @@ H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t H5_DLL herr_t H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); H5_DLL haddr_t H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsize_t old_size, hsize_t new_size); -H5_DLL haddr_t H5FD_get_eoa(H5FD_t *file); +H5_DLL haddr_t H5FD_get_eoa(const H5FD_t *file); H5_DLL herr_t H5FD_set_eoa(H5FD_t *file, haddr_t addr); -H5_DLL haddr_t H5FD_get_eof(H5FD_t *file); +H5_DLL haddr_t H5FD_get_eof(const H5FD_t *file); H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 444627f..94e215b 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -168,9 +168,9 @@ typedef struct H5FD_class_t { haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); herr_t (*free)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); - haddr_t (*get_eoa)(H5FD_t *file); + haddr_t (*get_eoa)(const H5FD_t *file); herr_t (*set_eoa)(H5FD_t *file, haddr_t addr); - haddr_t (*get_eof)(H5FD_t *file); + haddr_t (*get_eof)(const H5FD_t *file); herr_t (*get_handle)(H5FD_t *file, hid_t fapl, void**file_handle); herr_t (*read)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, void *buffer); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 2229853..a83761f 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -145,9 +145,9 @@ static H5FD_t *H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, static herr_t H5FD_sec2_close(H5FD_t *_file); static int H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_sec2_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_sec2_get_eoa(H5FD_t *_file); +static haddr_t H5FD_sec2_get_eoa(const H5FD_t *_file); static herr_t H5FD_sec2_set_eoa(H5FD_t *_file, haddr_t addr); -static haddr_t H5FD_sec2_get_eof(H5FD_t *_file); +static haddr_t H5FD_sec2_get_eof(const H5FD_t *_file); static herr_t H5FD_sec2_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); @@ -546,9 +546,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_sec2_get_eoa(H5FD_t *_file) +H5FD_sec2_get_eoa(const H5FD_t *_file) { - H5FD_sec2_t *file = (H5FD_sec2_t*)_file; + const H5FD_sec2_t *file = (const H5FD_sec2_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_sec2_get_eoa, HADDR_UNDEF) @@ -615,9 +615,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_sec2_get_eof(H5FD_t *_file) +H5FD_sec2_get_eof(const H5FD_t *_file) { - H5FD_sec2_t *file = (H5FD_sec2_t*)_file; + const H5FD_sec2_t *file = (const H5FD_sec2_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_sec2_get_eof, HADDR_UNDEF) diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 0dd2901..99aae42 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -152,9 +152,9 @@ static H5FD_t *H5FD_stdio_open(const char *name, unsigned flags, static herr_t H5FD_stdio_close(H5FD_t *lf); static int H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_stdio_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_stdio_get_eoa(H5FD_t *_file); +static haddr_t H5FD_stdio_get_eoa(const H5FD_t *_file); static herr_t H5FD_stdio_set_eoa(H5FD_t *_file, haddr_t addr); -static haddr_t H5FD_stdio_get_eof(H5FD_t *_file); +static haddr_t H5FD_stdio_get_eof(const H5FD_t *_file); static herr_t H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_stdio_read(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); @@ -543,9 +543,9 @@ H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */) *------------------------------------------------------------------------- */ static haddr_t -H5FD_stdio_get_eoa(H5FD_t *_file) +H5FD_stdio_get_eoa(const H5FD_t *_file) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; /* Clear the error stack */ H5Eclear_stack(H5E_DEFAULT); @@ -609,9 +609,9 @@ H5FD_stdio_set_eoa(H5FD_t *_file, haddr_t addr) *------------------------------------------------------------------------- */ static haddr_t -H5FD_stdio_get_eof(H5FD_t *_file) +H5FD_stdio_get_eof(const H5FD_t *_file) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; /* Clear the error stack */ H5Eclear_stack(H5E_DEFAULT); diff --git a/src/H5FDstream.c b/src/H5FDstream.c index 455b3ff..d23db5b 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -157,9 +157,9 @@ static H5FD_t *H5FD_stream_open (const char *name, unsigned flags, static herr_t H5FD_stream_flush (H5FD_t *_stream, hid_t dxpl_id, unsigned closing); static herr_t H5FD_stream_close (H5FD_t *_stream); static herr_t H5FD_stream_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_stream_get_eoa (H5FD_t *_stream); +static haddr_t H5FD_stream_get_eoa (const H5FD_t *_stream); static herr_t H5FD_stream_set_eoa (H5FD_t *_stream, haddr_t addr); -static haddr_t H5FD_stream_get_eof (H5FD_t *_stream); +static haddr_t H5FD_stream_get_eof (const H5FD_t *_stream); static herr_t H5FD_stream_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_stream_read (H5FD_t *_stream, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -887,9 +887,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_stream_get_eoa (H5FD_t *_stream) +H5FD_stream_get_eoa (const H5FD_t *_stream) { - H5FD_stream_t *stream = (H5FD_stream_t *) _stream; + const H5FD_stream_t *stream = (const H5FD_stream_t *) _stream; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_stream_get_eoa, HADDR_UNDEF) @@ -957,9 +957,9 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_stream_get_eof (H5FD_t *_stream) +H5FD_stream_get_eof (const H5FD_t *_stream) { - H5FD_stream_t *stream = (H5FD_stream_t *) _stream; + const H5FD_stream_t *stream = (const H5FD_stream_t *) _stream; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_stream_get_eof, HADDR_UNDEF) diff --git a/src/H5FPclient.c b/src/H5FPclient.c index bc81ff1..a01bfaf 100644 --- a/src/H5FPclient.c +++ b/src/H5FPclient.c @@ -887,7 +887,7 @@ done: * Modifications: */ herr_t -H5FP_request_get_eoa(H5FD_t *file, haddr_t *eoa, unsigned *req_id, H5FP_status_t *status) +H5FP_request_get_eoa(const H5FD_t *file, haddr_t *eoa, unsigned *req_id, H5FP_status_t *status) { H5FP_eoa_t sap_eoa; H5FP_request_t req; diff --git a/src/H5FPprivate.h b/src/H5FPprivate.h index 2c2f8b1..e309982 100644 --- a/src/H5FPprivate.h +++ b/src/H5FPprivate.h @@ -329,7 +329,7 @@ extern haddr_t H5FP_client_alloc(H5FD_t *file, H5FD_mem_t type, extern herr_t H5FP_request_free(H5FD_t *file, H5FD_mem_t mem_type, haddr_t addr, hsize_t size, unsigned *req_id, H5FP_status_t *status); -extern herr_t H5FP_request_get_eoa(H5FD_t *file, haddr_t *eoa, unsigned *req_id, +extern herr_t H5FP_request_get_eoa(const H5FD_t *file, haddr_t *eoa, unsigned *req_id, H5FP_status_t *status); extern herr_t H5FP_request_set_eoa(H5FD_t *file, haddr_t eoa, unsigned *req_id, H5FP_status_t *status); diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 0334c65..fde63f7 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -1283,7 +1283,6 @@ H5Pset_scaleoffset(hid_t plist_id, unsigned min_bits) H5O_pline_t pline; H5P_genplist_t *plist; /* Property list pointer */ unsigned cd_values[1]; /* Filter parameters */ - unsigned int config_flags; herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_scaleoffset, FAIL); diff --git a/src/H5S.c b/src/H5S.c index 04900f4..de7da2e 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -1730,7 +1730,8 @@ static herr_t H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc) { size_t extent_size; - hssize_t select_size; + hssize_t sselect_size; + size_t select_size; H5F_t f; /* fake file structure*/ herr_t ret_value = SUCCEED; @@ -1744,8 +1745,9 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc) if((extent_size=H5O_raw_size(H5O_SDSPACE_ID, &f, obj))==0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size"); - if((select_size=H5S_SELECT_SERIAL_SIZE(obj))<0) + if((sselect_size=H5S_SELECT_SERIAL_SIZE(obj))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size"); + H5_ASSIGN_OVERFLOW(select_size,sselect_size,hssize_t,size_t); /* Verify the size of buffer. If it's not big enough, simply return the * right size without filling the buffer. */ diff --git a/src/H5SL.c b/src/H5SL.c index 3748644..582bd1a 100644 --- a/src/H5SL.c +++ b/src/H5SL.c @@ -573,7 +573,7 @@ H5SL_create(H5SL_type_t type, double p, size_t max_level) /* Set the static internal fields */ new_slist->type=type; new_slist->p=p; - new_slist->p1=p*RAND_MAX; + new_slist->p1=(int)(p*RAND_MAX); new_slist->max_level=max_level; /* Set the dynamic internal fields */ diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index 202e15b..301aafd 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -126,7 +126,10 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], unsigned char *_dest=NULL; /* Alias for destination buffer */ unsigned bytesoftype; /* Number of bytes per element */ size_t numofelements; /* Number of elements in buffer */ - size_t i,j; /* Local index variables */ + size_t i; /* Local index variables */ +#ifdef NO_DUFFS_DEVICE + size_t j; /* Local index variable */ +#endif /* NO_DUFFS_DEVICE */ size_t leftover; /* Extra bytes at end of buffer */ size_t ret_value; /* Return value */ diff --git a/test/dt_atomic.c b/test/dt_atomic.c index db8234e..7348a9f 100644 --- a/test/dt_atomic.c +++ b/test/dt_atomic.c @@ -1331,7 +1331,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) size_t src_size, dst_size; /*type sizes */ unsigned char *buf=NULL; /*buffer for conversion */ unsigned char *saved=NULL; /*original values */ - size_t i, j, k; /*counters */ + size_t j, k; /*counters */ unsigned char *hw=NULL; /*hardware conv result */ unsigned char src_bits[32]; /*src value in LE order */ unsigned char dst_bits[32]; /*dest value in LE order*/ @@ -2066,7 +2066,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) /* Print errors */ if (0==fails_this_test++) H5_FAILED(); - printf(" test %u elmt %u\n", (unsigned)i+1, (unsigned)j); + printf(" elmt %u\n", (unsigned)j); printf(" src = "); for (k=0; k