From dd51aae3ca540fc43ca398beaed9f6643b880265 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 4 Jun 2002 16:29:05 -0500 Subject: [svn-r5530] Purpose: Code Cleanup Description: Removed some compiler warnings. Solution: In a few cases, NULL was being returned when a FAIL was supposed to be returned instead. There were some header files which needed to be included in a few of the sources. A couple of if-then statements had assignments in the conditional part. The compiler warned that they should have extra "()"s around them. Made the code check the values instead. Platforms tested: Linux (parallel) Modi4 (parallel) --- src/H5D.c | 18 ++++++++++++------ src/H5Distore.c | 2 +- src/H5Dseq.c | 4 ++-- src/H5FDmpio.c | 8 +++++--- src/H5Farray.c | 4 ++-- src/H5Fistore.c | 2 +- src/H5Fseq.c | 4 ++-- src/H5Smpio.c | 3 +++ src/H5Spkg.h | 3 +++ src/H5Sprivate.h | 9 ++++++++- 10 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index 9700bc7..9bb4b8c 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -12,10 +12,14 @@ /* $Id$ */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include "H5private.h" /* Generic Functions */ #include "H5Iprivate.h" /* IDs */ #include "H5Dprivate.h" /* Dataset functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Fprivate.h" /* Files */ #include "H5FDprivate.h" /* File drivers */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Gprivate.h" /* Group headers */ @@ -2274,10 +2278,11 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Collect Parallel I/O information for possible later use */ if (H5FD_MPIO==H5P_peek_hid_t(dx_plist,H5D_XFER_VFL_ID_NAME)) { doing_mpio++; - if (dx=H5P_peek_voidp(dx_plist,H5D_XFER_VFL_INFO_NAME)) - xfer_mode = dx->xfer_mode; - else + if (NULL == (dx=H5P_peek_voidp(dx_plist,H5D_XFER_VFL_INFO_NAME))) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to retrieve data xfer info"); + } else { + xfer_mode = dx->xfer_mode; + } } /* end if */ /* Collective access is not permissible without the MPIO driver */ if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE && @@ -2708,10 +2713,11 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Collect Parallel I/O information for possible later use */ if (H5FD_MPIO==H5P_peek_hid_t(dx_plist,H5D_XFER_VFL_ID_NAME)) { doing_mpio++; - if (dx=H5P_peek_voidp(dx_plist,H5D_XFER_VFL_INFO_NAME)) - xfer_mode = dx->xfer_mode; - else + if (NULL==(dx=H5P_peek_voidp(dx_plist,H5D_XFER_VFL_INFO_NAME))) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to retrieve data xfer info"); + } else { + xfer_mode = dx->xfer_mode; + } } /* end if */ /* Collective access is not permissible without the MPIO driver */ if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE && diff --git a/src/H5Distore.c b/src/H5Distore.c index 38d7a1f..d966edd 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -2465,7 +2465,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get data pipeline"); if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve fill time"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill time"); /* Get necessary properties from dataset transfer property list */ if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER) || NULL == (dx_plist = H5I_object(dxpl_id))) diff --git a/src/H5Dseq.c b/src/H5Dseq.c index 191748f..6ea4d53 100644 --- a/src/H5Dseq.c +++ b/src/H5Dseq.c @@ -188,7 +188,7 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the plist structure */ if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get the driver ID */ if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) @@ -570,7 +570,7 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the plist structure */ if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get the driver ID */ if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 501ce17..69e2b49 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -439,7 +439,7 @@ H5FD_mpio_communicator(H5FD_t *_file) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - FUNC_ENTER_NOAPI(H5FD_mpio_communicator, NULL); + FUNC_ENTER_NOAPI(H5FD_mpio_communicator, MPI_COMM_NULL); assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -1627,10 +1627,12 @@ H5FD_mpio_flush(H5FD_t *_file, unsigned closing) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; int mpi_code; /* mpi return code */ - uint8_t byte=0; - MPI_Status mpi_stat = {0}; MPI_Offset mpi_off; herr_t ret_value=SUCCEED; +#ifdef OLD_WAY + uint8_t byte=0; + MPI_Status mpi_stat = {0}; +#endif /* OLD_WAY */ FUNC_ENTER_NOAPI(H5FD_mpio_flush, FAIL); diff --git a/src/H5Farray.c b/src/H5Farray.c index 211ccaa..859f7ae 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -180,7 +180,7 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the plist structure */ if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get the driver ID */ if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) @@ -430,7 +430,7 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the plist structure */ if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get the driver ID */ if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 38d7a1f..d966edd 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -2465,7 +2465,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get data pipeline"); if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve fill time"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill time"); /* Get necessary properties from dataset transfer property list */ if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER) || NULL == (dx_plist = H5I_object(dxpl_id))) diff --git a/src/H5Fseq.c b/src/H5Fseq.c index 191748f..6ea4d53 100644 --- a/src/H5Fseq.c +++ b/src/H5Fseq.c @@ -188,7 +188,7 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the plist structure */ if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get the driver ID */ if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) @@ -570,7 +570,7 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the plist structure */ if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get the driver ID */ if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 22d38a8..c8acc41 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -17,6 +17,7 @@ #include "H5Eprivate.h" #include "H5Fpkg.h" /* Ugly, but necessary for the MPIO I/O accesses */ #include "H5FDprivate.h" /* Necessary for the H5FD_write & H5FD_read prototypes.. */ +#include "H5Iprivate.h" /* Object IDs */ #include "H5Pprivate.h" /* Property Lists */ #include "H5Spkg.h" @@ -562,7 +563,9 @@ H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, MPI_Datatype mpi_buf_type, mpi_file_type; hbool_t mbt_is_derived=0, mft_is_derived=0; +#if 0 H5P_genplist_t *plist; /* Property list pointer */ +#endif /* 0 */ FUNC_ENTER_NOINIT(H5S_mpio_spaces_xfer); diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 1ab7dd6..aaa1bd3 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -159,8 +159,11 @@ __DLL__ herr_t H5S_all_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op, void *operator_data); __DLL__ herr_t H5S_all_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *buf); +#if 0 + /* declared in H5Sprivate.h */ __DLL__ htri_t H5S_all_opt_possible(const H5S_t *mem_space, const H5S_t *file_space, const unsigned flags); +#endif /* 0 */ /* Hyperslab selection functions */ __DLL__ herr_t H5S_hyper_release(H5S_t *space); diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 1fe6081..bfae660 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -228,7 +228,8 @@ __DLL__ herr_t H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, const hssiz #ifdef H5_HAVE_PARALLEL -/* MPI-IO function to check whether its possible to transfer directly from app buffer to file */ +/* MPI-IO function to check whether its possible to transfer directly + * from app buffer to file */ __DLL__ htri_t H5S_all_opt_possible(const H5S_t *mem_space, const H5S_t *file_space, const unsigned flags); @@ -247,6 +248,12 @@ __DLL__ herr_t H5S_mpio_spaces_write(H5F_t *f, size_t elmt_size, const H5S_t *file_space, const H5S_t *mem_space, hid_t dxpl_id, const void *buf); + +/* MPI-IO function to check if a direct I/O transfer is possible between + * memory and the file */ +__DLL__ htri_t H5S_mpio_opt_possible(const H5S_t *mem_space, + const H5S_t *file_space, const unsigned flags); + #ifndef _H5S_IN_H5S_C /* Global var whose value comes from environment variable */ __DLLVAR__ hbool_t H5_mpi_opt_types_g; -- cgit v0.12