From 55ac27633ba1984d4296159bf06f562d0adaec61 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 28 Jan 1998 15:24:49 -0500 Subject: [svn-r188] Changed hbool_t from an enum to 'int' and removed BTRUE/BFALSE/BFAIL from code. Changed interface to the H5P..hyperslab functions to 'int' instead of 'size_t'. Cleaned up lots of warnings on IRIX 6.2 platform. Minor other tweaks to get to a mostly clean build on the SGI. It still whines about 'long long' being non-standard and some "pointless comparison of unsigned with 0" but those aren't big problems. --- src/H5A.c | 22 +++++++++++----------- src/H5AC.c | 2 +- src/H5Aprivate.h | 4 ++-- src/H5Apublic.h | 2 +- src/H5B.c | 2 +- src/H5C.c | 8 ++++---- src/H5D.c | 2 +- src/H5Distore.c | 16 ++++++++-------- src/H5F.c | 16 ++++++++-------- src/H5Farray.c | 3 --- src/H5Ffamily.c | 2 +- src/H5Fistore.c | 16 ++++++++-------- src/H5Flow.c | 8 ++++---- src/H5G.c | 4 ++-- src/H5Gent.c | 4 +++- src/H5Gnode.c | 9 ++++----- src/H5H.c | 9 ++------- src/H5Odtype.c | 8 ++++---- src/H5P.c | 30 +++++++++++++++--------------- src/H5Pprivate.h | 4 ++-- src/H5Ppublic.h | 8 ++++---- src/H5T.c | 16 ++++++++-------- src/H5private.h | 6 +++--- src/H5public.h | 8 +------- src/debug.c | 2 +- 25 files changed, 99 insertions(+), 112 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index ee8a9f9..bc8858f 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -71,7 +71,7 @@ static char RcsId[] = "@(#)$Revision$"; /* Array of pointers to atomic groups */ static hid_t atom_id_cache[ATOM_CACHE_SIZE] = {-1, -1, -1, -1}; -static VOIDP atom_obj_cache[ATOM_CACHE_SIZE] = +static void * atom_obj_cache[ATOM_CACHE_SIZE] = {NULL}; #endif @@ -272,7 +272,7 @@ H5A_destroy_group(group_t grp /* IN: Group to destroy */ *******************************************************************************/ hid_t H5A_register(group_t grp, /* IN: Group to register the object in */ - const void *object /* IN: Object to attach to atom */ + void *object /* IN: Object to attach to atom */ ) { atom_group_t *grp_ptr = NULL; /* ptr to the atomic group */ @@ -395,7 +395,7 @@ H5A_inc_ref(hid_t atm) Returns object ptr if successful and NULL otherwise *******************************************************************************/ -VOIDP +void * H5A_object(hid_t atm /* IN: Atom to retrieve object for */ ) { @@ -403,7 +403,7 @@ H5A_object(hid_t atm /* IN: Atom to retrieve object for */ uintn i; /* local counter */ #endif /* ATOMS_ARE_CACHED */ atom_info_t *atm_ptr = NULL; /* ptr to the new atom */ - VOIDP ret_value = NULL; + void * ret_value = NULL; FUNC_ENTER(H5A_object, NULL); @@ -414,7 +414,7 @@ H5A_object(hid_t atm /* IN: Atom to retrieve object for */ ret_value = atom_obj_cache[i]; if (i > 0) { /* Implement a simple "move forward" caching scheme */ hid_t t_atom = atom_id_cache[i - 1]; - VOIDP t_obj = atom_obj_cache[i - 1]; + void * t_obj = atom_obj_cache[i - 1]; atom_id_cache[i - 1] = atom_id_cache[i]; atom_obj_cache[i - 1] = atom_obj_cache[i]; @@ -458,7 +458,7 @@ H5A_group(hid_t atm /* IN: Atom to retrieve group for */ { group_t ret_value = BADGROUP; - FUNC_ENTER(H5A_group, FAIL); + FUNC_ENTER(H5A_group, BADGROUP); ret_value = ATOM_TO_GROUP(atm); if (ret_value <= BADGROUP || ret_value >= MAXGROUP) @@ -483,7 +483,7 @@ H5A_group(hid_t atm /* IN: Atom to retrieve group for */ Returns atom's object if successful and NULL otherwise *******************************************************************************/ -VOIDP +void * H5A_remove(hid_t atm /* IN: Atom to remove */ ) { @@ -495,7 +495,7 @@ H5A_remove(hid_t atm /* IN: Atom to remove */ #ifdef ATOMS_ARE_CACHED uintn i; /* local counting variable */ #endif /* ATOMS_ARE_CACHED */ - VOIDP ret_value = NULL; + void * ret_value = NULL; FUNC_ENTER(H5A_remove, NULL); @@ -574,7 +574,7 @@ H5A_dec_ref(hid_t atm) group_t grp = ATOM_TO_GROUP(atm); /* Group the object is in */ atom_group_t *grp_ptr = NULL; /* ptr to the atomic group */ atom_info_t *atm_ptr = NULL; /* ptr to the new atom */ - VOIDP obj; /* object to call 'free' function with */ + const void * obj; /* object to call 'free' function with */ intn ret_value = FAIL; FUNC_ENTER(H5A_dec_ref, FAIL); @@ -591,7 +591,7 @@ H5A_dec_ref(hid_t atm) /* If the reference count is zero, remove the object from the group */ if (0 == atm_ptr->count && (obj = H5A_remove(atm)) != NULL) { /* call the user's 'free' function for the atom's information */ - (*grp_ptr->free_func) (obj); + (*grp_ptr->free_func) ((void *)obj); } ret_value = SUCCEED; } @@ -621,7 +621,7 @@ H5A_search(group_t grp, /* IN: Group to search for the object in */ atom_group_t *grp_ptr = NULL; /* ptr to the atomic group */ atom_info_t *atm_ptr = NULL; /* ptr to the new atom */ intn i; /* local counting variable */ - VOIDP ret_value = NULL; + void * ret_value = NULL; FUNC_ENTER(H5A_search, NULL); diff --git a/src/H5AC.c b/src/H5AC.c index 247ae62..2897e6d 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -842,7 +842,7 @@ H5AC_debug(H5F_t *f) fprintf(stderr, " %18s %8s %8s %8s %8s+%-8s\n", "", "Hits", "Misses", "MissRate", "Inits", "Flushes"); - for (i = 0; i < H5AC_NTYPES; i++) { + for (i = H5AC_BT_ID; i < H5AC_NTYPES; i++) { switch (i) { case H5AC_BT_ID: diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h index 01e3ffe..8d4e6d2 100644 --- a/src/H5Aprivate.h +++ b/src/H5Aprivate.h @@ -73,7 +73,7 @@ typedef struct atom_info_struct_tag { hid_t id; /*atom ID for this info */ uintn count; /*ref. count for this atom */ - VOIDP *obj_ptr; /*pointer associated with the atom */ + void * *obj_ptr; /*pointer associated with the atom */ struct atom_info_struct_tag *next;/*link to next atom (in case of hash-clash)*/ } atom_info_t; @@ -93,7 +93,7 @@ typedef struct atom_group_struct_tag { intn H5A_init_group (group_t grp, intn hash_size, uintn reserved, herr_t (*free_func)(void *)); intn H5A_destroy_group (group_t grp); -hid_t H5A_register (group_t grp, const void *object); +hid_t H5A_register (group_t grp, void *object); void *H5A_object (hid_t atm); group_t H5A_group (hid_t atm); void *H5A_remove (hid_t atm); diff --git a/src/H5Apublic.h b/src/H5Apublic.h index f34d2ee..9e9966e 100644 --- a/src/H5Apublic.h +++ b/src/H5Apublic.h @@ -48,7 +48,7 @@ typedef enum { typedef int32 hid_t; /* Type of the function to compare objects & keys */ -typedef intn (*H5Asearch_func_t) (const VOIDP obj, const VOIDP key); +typedef intn (*H5Asearch_func_t) (const void * obj, const void * key); /* # of bits to use for Group ID in each atom (change if MAXGROUP>16) */ #define GROUP_BITS 8 diff --git a/src/H5B.c b/src/H5B.c index 063ed3f..d6edfbc 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -138,7 +138,7 @@ static const H5AC_class_t H5AC_BT[1] = { /* Interface initialization? */ #define INTERFACE_INIT NULL -static interface_initialize_g = FALSE; +static hbool_t interface_initialize_g = FALSE; /*------------------------------------------------------------------------- * Function: H5B_create diff --git a/src/H5C.c b/src/H5C.c index 436ecea..d67fbdd 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -66,7 +66,7 @@ H5C_init_interface(void) * atom groups aren't. */ for (i = 0; i < H5C_NCLASSES; i++) { - status = H5A_init_group(H5_TEMPLATE_0 + i, H5A_TEMPID_HASHSIZE, 0, NULL); + status = H5A_init_group((group_t)(H5_TEMPLATE_0 +i), H5A_TEMPID_HASHSIZE, 0, NULL); if (status < 0) ret_value = FAIL; } @@ -107,7 +107,7 @@ H5C_term_interface(void) intn i; for (i = 0; i < H5C_NCLASSES; i++) { - H5A_destroy_group(H5_TEMPLATE_0 + i); + H5A_destroy_group((group_t)(H5_TEMPLATE_0 + i)); } } @@ -202,7 +202,7 @@ H5C_create(H5C_class_t type, void *tmpl) assert(tmpl); /* Atomize the new template */ - if ((ret_value = H5A_register(H5_TEMPLATE_0 + type, tmpl)) < 0) { + if ((ret_value = H5A_register((group_t)(H5_TEMPLATE_0 + type), tmpl)) < 0) { HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "can't register template"); } @@ -269,7 +269,7 @@ H5Cget_class(hid_t tid) group < H5_TEMPLATE_0) { HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, H5C_NO_CLASS, "not a template"); } - ret_value = group - H5_TEMPLATE_0; + ret_value = (H5C_class_t)(group - H5_TEMPLATE_0); FUNC_LEAVE(ret_value); } diff --git a/src/H5D.c b/src/H5D.c index 8b88622..4433ab7 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -824,7 +824,7 @@ H5D_open(H5F_t *f, const char *name) herr_t H5D_close(H5D_t *dataset) { - hbool_t free_failed; + uintn free_failed; FUNC_ENTER(H5D_close, FAIL); diff --git a/src/H5Distore.c b/src/H5Distore.c index 10f9eae..c188b95 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -53,7 +53,7 @@ static herr_t H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t * const size_t offset_f[], const size_t size[], const size_t offset_m[], - const size_t size_m[], void *buf); + const size_t size_m[], const void *buf); /* * B-tree key. A key contains the minimum logical N-dimensional address and @@ -355,7 +355,7 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op, assert(lt_key); assert(rt_key); assert(udata); - assert(udata->mesg.ndims >= 0 && udata->mesg.ndims < H5O_LAYOUT_NDIMS); + assert(udata->mesg.ndims > 0 && udata->mesg.ndims < H5O_LAYOUT_NDIMS); assert(addr); /* Allocate new storage */ @@ -490,7 +490,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, H5B_ins_t ret_value = H5B_INS_ERROR; size_t nbytes; - FUNC_ENTER(H5F_istore_insert, FAIL); + FUNC_ENTER(H5F_istore_insert, H5B_INS_ERROR); /* check args */ assert(f); @@ -509,7 +509,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, if (cmp < 0) { /* Negative indices not supported yet */ assert("HDF5 INTERNAL ERROR -- see rpm" && 0); - HRETURN_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, FAIL, "internal error"); + HRETURN_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error"); } else if (H5V_hyper_eq(udata->mesg.ndims, udata->key.offset, udata->key.size, @@ -545,7 +545,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, * Allocate storage for the new chunk */ if (H5MF_alloc(f, H5MF_RAW, nbytes, new_node /*out */ ) < 0) { - HRETURN_ERROR(H5E_IO, H5E_CANTINIT, FAIL, + HRETURN_ERROR(H5E_IO, H5E_CANTINIT, H5B_INS_ERROR, "file allocation failed"); } udata->addr = *new_node; @@ -554,7 +554,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, } else { assert("HDF5 INTERNAL ERROR -- see rpm" && 0); - HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "internal error"); + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error"); } FUNC_LEAVE(ret_value); @@ -596,7 +596,7 @@ static herr_t H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op, const size_t offset_f[], const size_t size[], const size_t offset_m[], const size_t size_m[], - void *buf) + const void *buf) { intn i, carry; size_t idx_cur[H5O_LAYOUT_NDIMS]; @@ -714,7 +714,7 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op, } } else { H5V_hyper_copy(layout->ndims, sub_size, - size_m, sub_offset_m, buf, + size_m, sub_offset_m, (void *)buf, udata.key.size, offset_wrt_chunk, chunk); } diff --git a/src/H5F.c b/src/H5F.c index 4abe299..1c09c01 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -258,8 +258,8 @@ H5Fget_create_template(hid_t fid) H5F_compare_files -- compare file objects for the atom API USAGE intn HPcompare_filename(obj, key) - const VOIDP obj; IN: pointer to the file record - const VOIDP key; IN: pointer to the search key + const void * obj; IN: pointer to the file record + const void * key; IN: pointer to the search key ERRORS @@ -270,7 +270,7 @@ H5Fget_create_template(hid_t fid) keys. --------------------------------------------------------------------------*/ static intn -H5F_compare_files(const VOIDP _obj, const VOIDP _key) +H5F_compare_files(const void * _obj, const void * _key) { const H5F_t *obj = (const H5F_t *) _obj; const H5F_search_t *key = (const H5F_search_t *) _key; @@ -356,22 +356,22 @@ H5Fis_hdf5(const char *filename) { H5F_low_t *f_handle = NULL; /* file handle */ haddr_t addr; /* Address of file signature & header */ - hbool_t ret_value = BFALSE; + hbool_t ret_value = FALSE; - FUNC_ENTER(H5Fis_hdf5, BFAIL); + FUNC_ENTER(H5Fis_hdf5, FAIL); /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if (filename == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, BFAIL, "no filename specified"); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no filename specified"); /* Open the file */ if (NULL == (f_handle = H5F_low_open(H5F_LOW_DFLT, filename, 0, NULL))) { - HGOTO_ERROR(H5E_FILE, H5E_BADFILE, BFAIL, + HGOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "low-level file open failure"); } if (H5F_locate_signature(f_handle, &addr) >= 0) { - ret_value = BTRUE; + ret_value = TRUE; } done: H5F_low_close(f_handle); /* close the file we opened */ diff --git a/src/H5Farray.c b/src/H5Farray.c index 0bbb355..c0e6ad6 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -78,7 +78,6 @@ H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/) assert ("not implemented yet" && 0); HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout"); - break; } FUNC_LEAVE (SUCCEED); @@ -213,7 +212,6 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, assert ("not implemented yet" && 0); HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout"); - break; } FUNC_LEAVE (SUCCEED); @@ -351,7 +349,6 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, assert ("not implemented yet" && 0); HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout"); - break; } FUNC_LEAVE (SUCCEED); diff --git a/src/H5Ffamily.c b/src/H5Ffamily.c index b85ca71..a72f6bf 100644 --- a/src/H5Ffamily.c +++ b/src/H5Ffamily.c @@ -513,7 +513,7 @@ H5F_fam_access(const char *name, int mode, H5F_search_t *key /*out */ ) * of the family. As long as we found the first member(s) the * family exists. */ - HRETURN(membno > 0); + HRETURN(membno > 0 ? TRUE : FALSE); } else if (H5F_low_access(H5F_LOW_DFLT, member_name, F_OK, NULL)) { /* * The file exists but didn't have the write access permissions. diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 10f9eae..c188b95 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -53,7 +53,7 @@ static herr_t H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t * const size_t offset_f[], const size_t size[], const size_t offset_m[], - const size_t size_m[], void *buf); + const size_t size_m[], const void *buf); /* * B-tree key. A key contains the minimum logical N-dimensional address and @@ -355,7 +355,7 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op, assert(lt_key); assert(rt_key); assert(udata); - assert(udata->mesg.ndims >= 0 && udata->mesg.ndims < H5O_LAYOUT_NDIMS); + assert(udata->mesg.ndims > 0 && udata->mesg.ndims < H5O_LAYOUT_NDIMS); assert(addr); /* Allocate new storage */ @@ -490,7 +490,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, H5B_ins_t ret_value = H5B_INS_ERROR; size_t nbytes; - FUNC_ENTER(H5F_istore_insert, FAIL); + FUNC_ENTER(H5F_istore_insert, H5B_INS_ERROR); /* check args */ assert(f); @@ -509,7 +509,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, if (cmp < 0) { /* Negative indices not supported yet */ assert("HDF5 INTERNAL ERROR -- see rpm" && 0); - HRETURN_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, FAIL, "internal error"); + HRETURN_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error"); } else if (H5V_hyper_eq(udata->mesg.ndims, udata->key.offset, udata->key.size, @@ -545,7 +545,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, * Allocate storage for the new chunk */ if (H5MF_alloc(f, H5MF_RAW, nbytes, new_node /*out */ ) < 0) { - HRETURN_ERROR(H5E_IO, H5E_CANTINIT, FAIL, + HRETURN_ERROR(H5E_IO, H5E_CANTINIT, H5B_INS_ERROR, "file allocation failed"); } udata->addr = *new_node; @@ -554,7 +554,7 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, } else { assert("HDF5 INTERNAL ERROR -- see rpm" && 0); - HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "internal error"); + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error"); } FUNC_LEAVE(ret_value); @@ -596,7 +596,7 @@ static herr_t H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op, const size_t offset_f[], const size_t size[], const size_t offset_m[], const size_t size_m[], - void *buf) + const void *buf) { intn i, carry; size_t idx_cur[H5O_LAYOUT_NDIMS]; @@ -714,7 +714,7 @@ H5F_istore_copy_hyperslab(H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op, } } else { H5V_hyper_copy(layout->ndims, sub_size, - size_m, sub_offset_m, buf, + size_m, sub_offset_m, (void *)buf, udata.key.size, offset_wrt_chunk, chunk); } diff --git a/src/H5Flow.c b/src/H5Flow.c index e61d087..bf3a182 100644 --- a/src/H5Flow.c +++ b/src/H5Flow.c @@ -18,7 +18,7 @@ #include #include -#define addr_defined(X) (-1!=(X)->offset && (X)->offset>=0) +#define addr_defined(X) ((-1!=(X)->offset && (X)->offset>=0) ? TRUE : FALSE) #define PABLO_MASK H5F_low static hbool_t interface_initialize_g = FALSE; @@ -378,14 +378,14 @@ H5F_low_access(const H5F_low_class_t *type, const char *name, int mode, hbool_t ret_value; struct stat sb; - FUNC_ENTER(H5F_low_size, 0); + FUNC_ENTER(H5F_low_size, FAIL); assert(type); if (type->access) { ret_value = (type->access) (name, mode, key /*out */ ); } else { - ret_value = (0 == access(name, mode)); + ret_value = (0 == access(name, mode) ? TRUE : FALSE); if (key) { stat(name, &sb); key->dev = sb.st_dev; @@ -588,7 +588,7 @@ hbool_t H5F_addr_zerop(const haddr_t *addr) { FUNC_ENTER(H5F_addr_zerop, FAIL); - FUNC_LEAVE(0 == addr->offset); + FUNC_LEAVE(0 == addr->offset ? TRUE : FALSE); } /*------------------------------------------------------------------------- diff --git a/src/H5G.c b/src/H5G.c index d8726c0..7e470ae 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -1215,13 +1215,13 @@ H5G_insert(const char *name, H5G_entry_t *ent) * Make sure the root group exists. Ignore the failure if it's * because the group already exists. */ - update_grp = H5F_addr_eq(&(grp.header), + update_grp = (hbool_t)H5F_addr_eq(&(grp.header), &(ent->file->shared->root_ent->header)); if ((status = H5G_mkroot(ent->file, H5G_SIZE_HINT)) < 0 && -2 != status) { HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create root group"); } H5ECLEAR; - if (update_grp) + if (update_grp==TRUE) grp = *(ent->file->shared->root_ent); /* diff --git a/src/H5Gent.c b/src/H5Gent.c index c3afb3d..8c67810 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -177,6 +177,7 @@ herr_t H5G_ent_decode(H5F_t *f, const uint8 **pp, H5G_entry_t *ent) { const uint8 *p_ret = *pp; + uint32 tmp; FUNC_ENTER(H5G_ent_decode, FAIL); @@ -190,7 +191,8 @@ H5G_ent_decode(H5F_t *f, const uint8 **pp, H5G_entry_t *ent) /* decode header */ H5F_decode_length(f, *pp, ent->name_off); H5F_addr_decode(f, pp, &(ent->header)); - UINT32DECODE(*pp, ent->type); + UINT32DECODE(*pp, tmp); + ent->type=(H5G_type_t)tmp; /* decode scratch-pad */ switch (ent->type) { diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 5e6c862..851510e 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -313,8 +313,8 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, * Look for dirty entries and set the node dirty flag. */ for (i = 0; i < sym->nsyms; i++) { - if (sym->entry[i].dirty) - sym->dirty = TRUE; + if (sym->entry[i].dirty) + sym->dirty = TRUE; } /* @@ -639,9 +639,8 @@ H5G_node_found(H5F_t *f, const haddr_t *addr, const void *_lt_key, break; default: - HRETURN_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, - "internal erorr (unknown symbol find operation)"); - break; + HRETURN_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, + "internal erorr (unknown symbol find operation)"); } ret_value = SUCCEED; diff --git a/src/H5H.c b/src/H5H.c index 65e26c3..5911330 100644 --- a/src/H5H.c +++ b/src/H5H.c @@ -111,7 +111,6 @@ H5H_create(H5F_t *f, H5H_type_t heap_type, size_t size_hint, "heap\n"); #endif } - size_hint = MAX(0, size_hint); if (size_hint && size_hint < H5H_SIZEOF_FREE(f)) { size_hint = H5H_SIZEOF_FREE(f); } @@ -416,7 +415,6 @@ H5H_read(H5F_t *f, const haddr_t *addr, size_t offset, size_t size, void *buf) if (!addr) addr = &(f->shared->smallobj_addr); assert(H5F_addr_defined(addr)); - assert(offset >= 0); if (NULL == (heap = H5AC_find(f, H5AC_HEAP, addr, NULL, NULL))) { HRETURN_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, @@ -478,7 +476,6 @@ H5H_peek(H5F_t *f, const haddr_t *addr, size_t offset) if (!addr) addr = &(f->shared->smallobj_addr); assert(H5F_addr_defined(addr)); - assert(offset >= 0); if (NULL == (heap = H5AC_find(f, H5AC_HEAP, addr, NULL, NULL))) { HRETURN_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, @@ -548,7 +545,7 @@ H5H_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf) size_t need_size, old_size, need_more; hbool_t found; #ifndef NDEBUG - static nmessages = 0; + static int nmessages = 0; #endif FUNC_ENTER(H5H_insert, (size_t)(-1)); @@ -604,7 +601,7 @@ H5H_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf) * can extend that free chunk. Otherwise we'll have to make another * free chunk. If the heap must expand, we double its size. */ - if (!found) { + if (found==FALSE) { need_more = MAX3(need_size, heap->mem_alloc, H5H_SIZEOF_FREE(f)); @@ -719,7 +716,6 @@ H5H_write(H5F_t *f, const haddr_t *addr, size_t offset, size_t size, if (!addr) addr = &(f->shared->smallobj_addr); assert(H5F_addr_defined(addr)); - assert(offset >= 0); assert(buf); if (NULL == (heap = H5AC_find(f, H5AC_HEAP, addr, NULL, NULL))) { @@ -782,7 +778,6 @@ H5H_remove(H5F_t *f, const haddr_t *addr, size_t offset, size_t size) if (!addr) addr = &(f->shared->smallobj_addr); assert(H5F_addr_defined(addr)); - assert(offset >= 0); assert(size > 0); if (NULL == (heap = H5AC_find(f, H5AC_HEAP, addr, NULL, NULL))) { diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 4315717..3e23374 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -86,7 +86,7 @@ H5O_dtype_decode_helper(const uint8 **pp, H5T_t *dt) /* decode */ UINT32DECODE(*pp, flags); - dt->type = flags & 0xff; + dt->type = (H5T_class_t)(flags & 0xff); flags >>= 8; UINT32DECODE(*pp, dt->size); @@ -147,8 +147,8 @@ H5O_dtype_decode_helper(const uint8 **pp, H5T_t *dt) dt->u.compnd.memb = H5MM_xcalloc(dt->u.compnd.nalloc, sizeof(H5T_member_t)); for (i = 0; i < dt->u.compnd.nmembs; i++) { - dt->u.compnd.memb[i].name = H5MM_xstrdup(*pp); - *pp += ((strlen(*pp) + 8) / 8) * 8; /*multiple of 8 w/ null terminator */ + dt->u.compnd.memb[i].name = H5MM_xstrdup((const char *)*pp); + *pp += ((HDstrlen((const char *)*pp) + 8) / 8) * 8; /*multiple of 8 w/ null terminator */ UINT32DECODE(*pp, dt->u.compnd.memb[i].offset); dt->u.compnd.memb[i].ndims = *(*pp)++; assert(dt->u.compnd.memb[i].ndims <= 4); @@ -204,7 +204,7 @@ H5O_dtype_encode_helper(uint8 **pp, const H5T_t *dt) { uintn flags = 0; uintn perm_word; - char *hdr = *pp; + char *hdr = (char *)*pp; intn i, j, n; FUNC_ENTER(H5O_dtype_encode_helper, FAIL); diff --git a/src/H5P.c b/src/H5P.c index 49e2881..6a4e5dc 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -822,7 +822,7 @@ H5P_cmp(const H5P_t *ds1, const H5P_t *ds2) hbool_t H5P_is_simple(sdim) H5P_t *sdim; IN: Pointer to dataspace object to query RETURNS - BTRUE/BFALSE/BFAIL + TRUE/FALSE/FAIL DESCRIPTION This function determines the if a dataspace is "simple". ie. if it has orthogonal, evenly spaced dimensions. @@ -830,15 +830,15 @@ H5P_cmp(const H5P_t *ds1, const H5P_t *ds2) hbool_t H5P_is_simple(const H5P_t *sdim) { - hbool_t ret_value = BFAIL; + hbool_t ret_value = FAIL; - FUNC_ENTER(H5P_is_simple, UFAIL); + FUNC_ENTER(H5P_is_simple, FAIL); /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; assert(sdim); - ret_value = sdim->type == H5P_SIMPLE ? BTRUE : BFALSE; /* Currently all dataspaces are simple, but check anyway */ + ret_value = sdim->type == H5P_SIMPLE ? TRUE : FALSE; /* Currently all dataspaces are simple, but check anyway */ FUNC_LEAVE(ret_value); } @@ -853,7 +853,7 @@ H5P_is_simple(const H5P_t *sdim) hbool_t H5Pis_simple(sid) hid_t sid; IN: ID of dataspace object to query RETURNS - BTRUE/BFALSE/BFAIL + TRUE/FALSE/FAIL DESCRIPTION This function determines the if a dataspace is "simple". ie. if it has orthogonal, evenly spaced dimensions. @@ -862,9 +862,9 @@ hbool_t H5Pis_simple(hid_t sid) { H5P_t *space = NULL; /* dataspace to modify */ - hbool_t ret_value = BFAIL; + hbool_t ret_value = FAIL; - FUNC_ENTER(H5Pis_simple, BFAIL); + FUNC_ENTER(H5Pis_simple, FAIL); /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; @@ -875,7 +875,7 @@ H5Pis_simple(hid_t sid) ret_value = H5P_is_simple(space); done: - if (ret_value == BFAIL) { /* Error condition cleanup */ + if (ret_value == FAIL) { /* Error condition cleanup */ } /* end if */ /* Normal function cleanup */ @@ -1026,10 +1026,10 @@ H5Pset_space(hid_t sid, int rank, const size_t *dims) datasets which extend in arbitrary directions. --------------------------------------------------------------------------*/ herr_t -H5Pset_hyperslab(hid_t sid, const size_t *start, const size_t *count, const size_t *stride) +H5Pset_hyperslab(hid_t sid, const intn *start, const intn *count, const intn *stride) { H5P_t *space = NULL; /* dataspace to modify */ - size_t *tmp_stride=NULL; /* temp. copy of stride */ + intn *tmp_stride=NULL; /* temp. copy of stride */ intn u; /* local counting variable */ herr_t ret_value = SUCCEED; @@ -1049,7 +1049,7 @@ H5Pset_hyperslab(hid_t sid, const size_t *start, const size_t *count, const size HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL,"unknown dataspace type"); /* Set up stride values for later use */ - tmp_stride= H5MM_xmalloc(space->u.simple.rank*sizeof(size_t)); + tmp_stride= H5MM_xmalloc(space->u.simple.rank*sizeof(intn)); for (u=0; uu.simple.rank; u++) { tmp_stride[u] = stride ? stride[u] : 1; } @@ -1109,8 +1109,8 @@ done: *------------------------------------------------------------------------- */ int -H5Pget_hyperslab (hid_t sid, size_t offset[]/*out*/, size_t size[]/*out*/, - size_t stride[]/*out*/) +H5Pget_hyperslab (hid_t sid, int offset[]/*out*/, int size[]/*out*/, + int stride[]/*out*/) { const H5P_t *ds = NULL; intn ret_value = FAIL; @@ -1151,8 +1151,8 @@ H5Pget_hyperslab (hid_t sid, size_t offset[]/*out*/, size_t size[]/*out*/, *------------------------------------------------------------------------- */ intn -H5P_get_hyperslab (const H5P_t *ds, size_t offset[]/*out*/, - size_t size[]/*out*/, size_t stride[]/*out*/) +H5P_get_hyperslab (const H5P_t *ds, int offset[]/*out*/, + int size[]/*out*/, int stride[]/*out*/) { intn i; intn ret_value = FAIL; diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 63d2c6c..a42ec8f 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -102,8 +102,8 @@ intn H5P_cmp (const H5P_t *ds1, const H5P_t *ds2); hbool_t H5P_is_simple (const H5P_t *sdim); uintn H5P_nelem (const H5P_t *space); const H5P_conv_t *H5P_find (const H5P_t *mem_space, const H5P_t *file_space); -intn H5P_get_hyperslab (const H5P_t *ds, size_t offset[]/*out*/, - size_t size[]/*out*/, size_t stride[]/*out*/); +intn H5P_get_hyperslab (const H5P_t *ds, int offset[]/*out*/, + int size[]/*out*/, int stride[]/*out*/); /* Conversion functions for simple data spaces */ size_t H5P_simp_init (const struct H5O_layout_t *layout, diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 7c4a850..9d78784 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -46,10 +46,10 @@ int H5Pget_ndims (hid_t space_id); int H5Pget_dims (hid_t space_id, size_t dims[]); hbool_t H5Pis_simple (hid_t space_id); herr_t H5Pset_space (hid_t space_id, int rank, const size_t *dims); -herr_t H5Pset_hyperslab(hid_t sid, const size_t *start, const size_t *count, - const size_t *stride); -int H5Pget_hyperslab (hid_t sid, size_t offset[]/*out*/, - size_t size[]/*out*/, size_t stride[]/*out*/); +herr_t H5Pset_hyperslab(hid_t sid, const int *start, const int *count, + const int *stride); +int H5Pget_hyperslab (hid_t sid, int offset[]/*out*/, + int size[]/*out*/, int stride[]/*out*/); #ifdef __cplusplus } diff --git a/src/H5T.c b/src/H5T.c index 29d4df8..df1bd0f 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -440,7 +440,7 @@ H5Tequal(hid_t type1_id, hid_t type2_id) NULL == (dt2 = H5A_object(type2_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } - ret_value = (0 == H5T_cmp(dt1, dt2)); + ret_value = (0 == H5T_cmp(dt1, dt2)) ? TRUE : FALSE; FUNC_LEAVE(ret_value); } @@ -1044,9 +1044,9 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out */ , H5T_pad_t *msb /*out */ ) } /* Get values */ if (lsb) - *lsb = dt->u.atomic.lsb_pad; + *lsb = (H5T_pad_t)dt->u.atomic.lsb_pad; if (msb) - *msb = dt->u.atomic.msb_pad; + *msb = (H5T_pad_t)dt->u.atomic.msb_pad; FUNC_LEAVE(SUCCEED); } @@ -1267,15 +1267,15 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize, if (dt->locked) { HRETURN_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only"); } - if (epos < 0 || epos + esize > dt->u.atomic.prec) { + if (epos + esize > dt->u.atomic.prec) { HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent bit field size/location is invalid"); } - if (mpos < 0 || mpos + msize > dt->u.atomic.prec) { + if (mpos + msize > dt->u.atomic.prec) { HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mantissa bit field size/location is invalid"); } - if (spos < 0 || spos >= dt->u.atomic.prec) { + if (spos >= dt->u.atomic.prec) { HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign location is not valid"); } @@ -1498,7 +1498,7 @@ H5Tget_inpad(hid_t type_id) "not a floating-point data type"); } /* pad */ - pad = dt->u.atomic.u.f.pad; + pad = (H5T_pad_t)dt->u.atomic.u.f.pad; FUNC_LEAVE(pad); } @@ -2722,7 +2722,7 @@ H5T_sort_by_offset(H5T_t *dt) H5T_member_t tmp = dt->u.compnd.memb[j]; dt->u.compnd.memb[j] = dt->u.compnd.memb[j+1]; dt->u.compnd.memb[j+1] = tmp; - swapped = 1; + swapped = TRUE; } } } diff --git a/src/H5private.h b/src/H5private.h index 8f0dba0..9fa402e 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -431,7 +431,7 @@ extern hbool_t thread_initialize_g; /*don't decl interface_initialize_g */ PABLO_TRACE_ON (PABLO_MASK, pablo_func_id); \ \ if (!library_initialize_g) { \ - library_initialize_g = TRUE; \ + library_initialize_g = TRUE; \ if (H5_init_library()<0) { \ HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ "library initialization failed"); \ @@ -439,7 +439,7 @@ extern hbool_t thread_initialize_g; /*don't decl interface_initialize_g */ } \ \ if (!thread_initialize_g) { \ - thread_initialize_g = TRUE; \ + thread_initialize_g = TRUE; \ if (H5_init_thread()<0) { \ HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ "thread initialization failed"); \ @@ -447,7 +447,7 @@ extern hbool_t thread_initialize_g; /*don't decl interface_initialize_g */ } \ \ if (!interface_initialize_g) { \ - interface_initialize_g = TRUE; \ + interface_initialize_g = TRUE; \ if (interface_init_func && \ ((herr_t(*)(void))interface_init_func)()<0) { \ HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ diff --git a/src/H5public.h b/src/H5public.h index 8fa0cc4..336c624 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -22,8 +22,6 @@ /* * Data types */ -typedef void VOID; -typedef void *VOIDP; typedef char char8; typedef signed char int8; typedef unsigned char uchar8, uint8; @@ -99,11 +97,7 @@ typedef intn herr_t; /* * Boolean type. */ -typedef enum { - BFAIL = (-1), /*error value */ - BFALSE = 0, - BTRUE = 1 -} hbool_t; +typedef int hbool_t; #ifdef __cplusplus extern "C" { diff --git a/src/debug.c b/src/debug.c index fb2b311..1dbcb17 100644 --- a/src/debug.c +++ b/src/debug.c @@ -110,7 +110,7 @@ main(int argc, char *argv[]) * subclass. The subclass identifier is the byte immediately * after the B-tree signature. */ - H5B_subid_t subtype = sig[H5B_SIZEOF_MAGIC]; + H5B_subid_t subtype = (H5B_subid_t)sig[H5B_SIZEOF_MAGIC]; switch (subtype) { case H5B_SNODE_ID: status = H5G_node_debug(f, &addr, stdout, 0, VCOL, &extra); -- cgit v0.12