From 06f27f99b04f332565b55ec601a4aacc28858c37 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 9 Jul 2003 14:16:17 -0500 Subject: [svn-r7192] Purpose: Code cleanup Description: Clean up various minor warnings in the library. Platforms tested: FreeBSD 4.8 (sleipnir) too small to need h5committest --- fortran/src/H5Pf.c | 2 +- src/H5Dcontig.c | 8 -------- src/H5Distore.c | 8 -------- src/H5Fcontig.c | 8 -------- src/H5Fistore.c | 8 -------- src/H5G.c | 18 +++++++++--------- src/H5Gpkg.h | 2 +- src/H5Gprivate.h | 2 +- src/H5R.c | 8 ++++---- tools/h5ls/h5ls.c | 2 +- 10 files changed, 17 insertions(+), 49 deletions(-) diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 98d88cb..f647a95 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -1556,7 +1556,7 @@ nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, int_f* offset, h hid_t c_prp_id; herr_t ret; hsize_t c_bytes; - const char* c_name; + char* c_name; int c_namelen; off_t c_offset; c_bytes = (hsize_t) *bytes; diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 6445d19..5427875 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -138,7 +138,6 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, #ifdef H5_HAVE_PARALLEL MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */ int mpi_rank=(-1); /* This process's rank */ - int mpi_size=(-1); /* Total # of processes */ int mpi_code; /* MPI return code */ unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */ unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */ @@ -168,8 +167,6 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpio_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpio_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -182,8 +179,6 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpiposix_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpiposix_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -198,9 +193,6 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, if ((mpi_rank = H5FD_fphdf5_mpi_rank(f->shared->lf)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size = H5FD_fphdf5_mpi_size(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); - /* Set the MPI-capable file driver flag */ using_mpi = 1; } /* end if */ diff --git a/src/H5Distore.c b/src/H5Distore.c index c3bda60..06e5d70 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -2158,7 +2158,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, #ifdef H5_HAVE_PARALLEL MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */ int mpi_rank=(-1); /* This process's rank */ - int mpi_size=(-1); /* Total # of processes */ int mpi_code; /* MPI return code */ unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */ unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */ @@ -2210,8 +2209,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpio_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpio_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -2224,8 +2221,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpiposix_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpiposix_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -2240,9 +2235,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, if ((mpi_rank = H5FD_fphdf5_mpi_rank(f->shared->lf)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size = H5FD_fphdf5_mpi_size(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); - /* Set the MPI-capable file driver flag */ using_mpi = 1; } /* end if */ diff --git a/src/H5Fcontig.c b/src/H5Fcontig.c index 6445d19..5427875 100644 --- a/src/H5Fcontig.c +++ b/src/H5Fcontig.c @@ -138,7 +138,6 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, #ifdef H5_HAVE_PARALLEL MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */ int mpi_rank=(-1); /* This process's rank */ - int mpi_size=(-1); /* Total # of processes */ int mpi_code; /* MPI return code */ unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */ unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */ @@ -168,8 +167,6 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpio_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpio_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -182,8 +179,6 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpiposix_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpiposix_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -198,9 +193,6 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, if ((mpi_rank = H5FD_fphdf5_mpi_rank(f->shared->lf)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size = H5FD_fphdf5_mpi_size(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); - /* Set the MPI-capable file driver flag */ using_mpi = 1; } /* end if */ diff --git a/src/H5Fistore.c b/src/H5Fistore.c index c3bda60..06e5d70 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -2158,7 +2158,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, #ifdef H5_HAVE_PARALLEL MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */ int mpi_rank=(-1); /* This process's rank */ - int mpi_size=(-1); /* Total # of processes */ int mpi_code; /* MPI return code */ unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */ unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */ @@ -2210,8 +2209,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpio_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpio_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -2224,8 +2221,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpiposix_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpiposix_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -2240,9 +2235,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, if ((mpi_rank = H5FD_fphdf5_mpi_rank(f->shared->lf)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size = H5FD_fphdf5_mpi_size(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); - /* Set the MPI-capable file driver flag */ using_mpi = 1; } /* end if */ diff --git a/src/H5G.c b/src/H5G.c index c3ecbaf..8fda486 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -148,7 +148,7 @@ typedef enum { * is allocated dynamically. */ typedef struct H5G_typeinfo_t { - int type; /*one of the public H5G_* types */ + H5G_obj_t type; /*one of the public H5G_* types */ htri_t (*isa)(H5G_entry_t*, hid_t); /*function to determine type */ char *desc; /*description of object type */ } H5G_typeinfo_t; @@ -182,7 +182,7 @@ static herr_t H5G_move(H5G_entry_t *src_loc, const char *src_name, static herr_t H5G_unlink(H5G_entry_t *loc, const char *name, hid_t dxpl_id); static herr_t H5G_get_num_objs(H5G_t *grp, hsize_t *num_objs, hid_t dxpl_id); static ssize_t H5G_get_objname_by_idx(H5G_t *grp, hsize_t idx, char* name, size_t size, hid_t dxpl_id); -static int H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx, hid_t dxpl_id); +static H5G_obj_t H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx, hid_t dxpl_id); static int H5G_replace_ent(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5G_traverse_slink(H5G_entry_t *grp_ent/*in,out*/, H5G_entry_t *obj_ent/*in,out*/, int *nlinks/*in,out*/, hid_t dxpl_id); @@ -190,7 +190,7 @@ static herr_t H5G_set_comment(H5G_entry_t *loc, const char *name, const char *buf, hid_t dxpl_id); static int H5G_get_comment(H5G_entry_t *loc, const char *name, size_t bufsize, char *buf, hid_t dxpl_id); -static herr_t H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t), +static herr_t H5G_register_type(H5G_obj_t type, htri_t(*isa)(H5G_entry_t*, hid_t), const char *desc); static H5G_t *H5G_rootof(H5F_t *f); @@ -1039,7 +1039,7 @@ H5G_term_interface(void) *------------------------------------------------------------------------- */ static herr_t -H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t), const char *_desc) +H5G_register_type(H5G_obj_t type, htri_t(*isa)(H5G_entry_t*, hid_t), const char *_desc) { char *desc = NULL; size_t i; @@ -2343,12 +2343,12 @@ done: * *------------------------------------------------------------------------- */ -int +H5G_obj_t H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id) { htri_t isa; size_t i; - int ret_value=H5G_UNKNOWN; /* Return value */ + H5G_obj_t ret_value=H5G_UNKNOWN; /* Return value */ FUNC_ENTER_NOAPI(H5G_get_type, H5G_UNKNOWN); @@ -2566,11 +2566,11 @@ done: * *------------------------------------------------------------------------- */ -static int +static H5G_obj_t H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx, hid_t dxpl_id) { - int ret_value = H5G_UNKNOWN; - H5G_bt_ud3_t udata; + H5G_bt_ud3_t udata; /* User data for B-tree callback */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ FUNC_ENTER_NOAPI(H5G_get_objtype_by_idx, FAIL); diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 9443a54..f1cd427 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -108,7 +108,7 @@ typedef struct H5G_bt_ud3_t { hsize_t idx; /*index of group member to be querried */ char *name; /*member name to be returned */ hsize_t num_objs; /*the number of objects having been traversed*/ - int type; /*member type to be returned */ + H5G_obj_t type; /*member type to be returned */ } H5G_bt_ud3_t; /* diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index a256ee1..2bf2c3f 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -142,7 +142,7 @@ H5_DLL H5F_t *H5G_fileof(H5G_t *grp); H5_DLL H5G_t *H5G_open(H5G_entry_t *loc, const char *name, hid_t dxpl_id); H5_DLL H5G_t *H5G_open_oid(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5G_close(H5G_t *grp); -H5_DLL int H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id); +H5_DLL H5G_obj_t H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5G_get_objinfo(H5G_entry_t *loc, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/, hid_t dxpl_id); diff --git a/src/H5R.c b/src/H5R.c index 66b22ef..43d1c80 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -40,7 +40,7 @@ static herr_t H5R_create(void *ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id); static hid_t H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref); static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref); -static int H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref); +static H5G_obj_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref); /*-------------------------------------------------------------------------- @@ -631,7 +631,7 @@ done: PURPOSE Retrieves the type of object that an object reference points to USAGE - int H5R_get_obj_type(file, ref_type, ref) + H5G_obj_t H5R_get_obj_type(file, ref_type, ref) H5F_t *file; IN: File the object being dereferenced is within H5R_type_t ref_type; IN: Type of reference to query void *ref; IN: Reference to query. @@ -647,12 +647,12 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static int +static H5G_obj_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref) { H5G_entry_t ent; /* Symbol table entry */ uint8_t *p; /* Pointer to OID to store */ - int ret_value; + H5G_obj_t ret_value; /* Return value */ FUNC_ENTER_NOINIT(H5R_get_obj_type); diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index d604c93..1d3064a 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1755,7 +1755,7 @@ list (hid_t group, const char *name, void *_iter) return 0; } else if (sb.type<0 || sb.type>=H5G_NTYPES) { printf("Unknown type(%d)", sb.type); - sb.type = -1; + sb.type = H5G_UNKNOWN; } if (sb.type>=0 && dispatch_g[sb.type].name) { fputs(dispatch_g[sb.type].name, stdout); -- cgit v0.12