diff options
author | Quincey Koziol <koziol@koziol.gov> | 2019-07-03 04:43:45 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@koziol.gov> | 2019-07-03 04:43:45 (GMT) |
commit | 3b594992d6b062cf350d3f03e4b5c5d27b83a245 (patch) | |
tree | 42392ac76ff26413e3aee3989d60658189e2b57b /src | |
parent | d0bc570c2cdc4cbbb42cc1d4dac61aba67e20892 (diff) | |
download | hdf5-3b594992d6b062cf350d3f03e4b5c5d27b83a245.zip hdf5-3b594992d6b062cf350d3f03e4b5c5d27b83a245.tar.gz hdf5-3b594992d6b062cf350d3f03e4b5c5d27b83a245.tar.bz2 |
Add support for GCC9, update warnhist script, and clean up warnings.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Adense.c | 5 | ||||
-rw-r--r-- | src/H5Dchunk.c | 8 | ||||
-rw-r--r-- | src/H5Dint.c | 5 | ||||
-rw-r--r-- | src/H5FDmulti.c | 14 | ||||
-rw-r--r-- | src/H5Fint.c | 11 | ||||
-rw-r--r-- | src/H5Fpkg.h | 16 | ||||
-rw-r--r-- | src/H5Fsuper.c | 1 | ||||
-rw-r--r-- | src/H5I.c | 90 | ||||
-rw-r--r-- | src/H5Opline.c | 4 | ||||
-rw-r--r-- | src/H5Osdspace.c | 4 | ||||
-rw-r--r-- | src/H5PLpath.c | 4 | ||||
-rw-r--r-- | src/H5Pint.c | 2 | ||||
-rw-r--r-- | src/H5T.c | 4 | ||||
-rw-r--r-- | src/H5Toh.c | 1 | ||||
-rw-r--r-- | src/H5system.c | 4 |
15 files changed, 93 insertions, 80 deletions
diff --git a/src/H5Adense.c b/src/H5Adense.c index bddfe31..7491dd2 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -299,7 +299,7 @@ done: static herr_t H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) { - H5A_t const **user_attr = (H5A_t const **)_user_attr; /* User data from v2 B-tree attribute lookup */ + const H5A_t **user_attr = (const H5A_t **)_user_attr; /* User data from v2 B-tree attribute lookup */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -308,6 +308,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) HDassert(attr); HDassert(user_attr); HDassert(took_ownership); + /* * If there is an attribute already stored in "user_attr", * we need to free the dynamially allocated spaces for the @@ -324,7 +325,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) * allocated spaces for the intermediate decoded attribute. */ if(*user_attr != NULL) { - H5A_t *old_attr = *user_attr; + H5A_t *old_attr = *(H5A_t **)_user_attr; /* Free any dynamically allocated items */ if(old_attr->shared) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 6fdea92..7a07225 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -265,7 +265,7 @@ static int H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void * static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims, const hsize_t *max_dims); static void *H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline); -static void *H5D__chunk_mem_xfree(void *chk, const H5O_pline_t *pline); +static void *H5D__chunk_mem_xfree(void *chk, const void *pline); static void *H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline); static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last); @@ -1354,7 +1354,7 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline) /*------------------------------------------------------------------------- * Function: H5D__chunk_mem_xfree * - * Purpose: Free space for a chunk in memory. This routine allocates + * Purpose: Free space for a chunk in memory. This routine releases * memory space for non-filtered chunks from a block free list * and uses malloc()/free() for filtered chunks. * @@ -1366,8 +1366,10 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline) *------------------------------------------------------------------------- */ static void * -H5D__chunk_mem_xfree(void *chk, const H5O_pline_t *pline) +H5D__chunk_mem_xfree(void *chk, const void *_pline) { + const H5O_pline_t *pline = (const H5O_pline_t *)_pline; + FUNC_ENTER_STATIC_NOERR if(chk) { diff --git a/src/H5Dint.c b/src/H5Dint.c index 2824dcd..1e9c6ff 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -50,7 +50,7 @@ /* General stuff */ static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); -static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type); +static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id); @@ -522,7 +522,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type) +H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) { htri_t relocatable; /* Flag whether the type is relocatable */ htri_t immutable; /* Flag whether the type is immutable */ @@ -1199,6 +1199,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Get the dataset's datatype */ if(NULL == (dt = (H5T_t *)H5I_object(type_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + /* If this is a named datatype, get the pointer via the VOL plugin */ type = H5T_get_actual_type(dt); diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 6cfef55..b1d3430 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -771,7 +771,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) buf += nseen*2*8; if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen*2, x, NULL, H5P_DEFAULT)<0) H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) - ap = (haddr_t*)x; + ap = (haddr_t*)((void *)x); UNIQUE_MEMBERS(map, mt) { memb_addr[_unmapped] = *ap++; memb_eoa[_unmapped] = *ap++; @@ -1955,6 +1955,14 @@ compute_next(H5FD_multi_t *file) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() call with + * tmp in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static int open_members(H5FD_multi_t *file) { @@ -1972,7 +1980,8 @@ open_members(H5FD_multi_t *file) /* Note: This truncates the user's filename down to only sizeof(tmp) * characters. -QK & JK, 2013/01/17 */ - sprintf(tmp, file->fa.memb_name[mt], file->name); + snprintf(tmp, sizeof(tmp), file->fa.memb_name[mt], file->name); + tmp[sizeof(tmp) - 1] = '\0'; H5E_BEGIN_TRY { file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); @@ -1987,6 +1996,7 @@ open_members(H5FD_multi_t *file) return 0; } +#pragma GCC diagnostic pop #ifdef _H5private_H diff --git a/src/H5Fint.c b/src/H5Fint.c index 4021e41..6879d46 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -572,11 +572,11 @@ H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out fname_len = HDstrlen(file_name); /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ - if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2))) + if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 4))) HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate filename buffer") /* Compose the full file name */ - HDsnprintf(*full_name, (prefix_len + fname_len + 2), "%s%s%s", prefix, + HDsnprintf(*full_name, (prefix_len + fname_len + 4), "%s%s%s", prefix, ((prefix_len == 0 || H5_CHECK_DELIMITER(prefix[prefix_len - 1])) ? "" : H5_DIR_SEPS), file_name); done: @@ -2840,8 +2840,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) /* test to see if a buffer was provided -- if not, we are done */ if(buf_ptr != NULL) { size_t space_needed; /* size of file image */ - hsize_t tmp; - size_t tmp_size; + unsigned tmp, tmp_size; /* Check for buffer too small */ if((haddr_t)buf_len < eoa) @@ -2856,12 +2855,12 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) /* Offset to "status_flags" in the superblock */ tmp = H5F_SUPER_STATUS_FLAGS_OFF(file->shared->sblock->super_vers); + /* Size of "status_flags" depends on the superblock version */ tmp_size = H5F_SUPER_STATUS_FLAGS_SIZE(file->shared->sblock->super_vers); /* Clear "status_flags" */ - HDmemset((uint8_t *)(buf_ptr) + tmp, 0, tmp_size); - + HDmemset((uint8_t *)buf_ptr + tmp, 0, tmp_size); } /* end if */ done: diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 5f25ddc..1dd07c1 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -140,14 +140,14 @@ /* For superblock version 0 & 1: Offset to the file consistency flags (status_flags) in the superblock (excluding H5F_SUPERBLOCK_FIXED_SIZE) */ -#define H5F_SUPER_STATUS_OFF_V01 \ - (2 /* freespace, and root group versions */ \ - + 1 /* reserved */ \ - + 3 /* shared header vers, size of address, size of lengths */ \ - + 1 /* reserved */ \ - + 4) /* group leaf k, group internal k */ - -#define H5F_SUPER_STATUS_OFF(v) (v >= 2 ? 2 : H5F_SUPER_STATUS_OFF_V01) +#define H5F_SUPER_STATUS_OFF_V01 \ + (unsigned)(2 /* freespace, and root group versions */ \ + + 1 /* reserved */ \ + + 3 /* shared header vers, size of address, size of lengths */ \ + + 1 /* reserved */ \ + + 4) /* group leaf k, group internal k */ + +#define H5F_SUPER_STATUS_OFF(v) (v >= 2 ? (unsigned)2 : H5F_SUPER_STATUS_OFF_V01) /* Offset to the file consistency flags (status_flags) in the superblock */ #define H5F_SUPER_STATUS_FLAGS_OFF(v) (H5F_SUPERBLOCK_FIXED_SIZE + H5F_SUPER_STATUS_OFF(v)) diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 4fcc164..5334c51 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -54,7 +54,6 @@ /********************/ static herr_t H5F__super_ext_create(H5F_t *f, H5O_loc_t *ext_ptr); static herr_t H5F__update_super_ext_driver_msg(H5F_t *f); -static herr_t H5F__fsinfo_set_version(const H5F_t *f, H5O_fsinfo_t *fsinfo); /*********************/ @@ -117,7 +117,7 @@ static H5I_id_type_t *H5I_id_type_list_g[H5I_MAX_NUM_TYPES]; /* Starts at 1 instead of 0 because it makes trace output look nicer. If more */ /* types (or IDs within a type) are needed, adjust TYPE_BITS in H5Ipkg.h */ /* and/or increase size of hid_t */ -static H5I_type_t H5I_next_type = (H5I_type_t) H5I_NTYPES; +static int H5I_next_type = (int)H5I_NTYPES; /* Declare a free list to manage the H5I_id_info_t struct */ H5FL_DEFINE_STATIC(H5I_id_info_t); @@ -168,16 +168,16 @@ H5I_term_package(void) if(H5_PKG_INIT_VAR) { H5I_id_type_t *type_ptr; /* Pointer to ID type */ - H5I_type_t type; /* Type of ID */ + int type; /* Type of ID */ /* How many types are still being used? */ - for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t, type)) + for(type = 0; type < H5I_next_type; type++) if((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids) n++; /* If no types are used then clean up */ if(0 == n) { - for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t,type)) { + for(type = 0; type < H5I_next_type; type++) { type_ptr = H5I_id_type_list_g[type]; if(type_ptr) { HDassert(NULL == type_ptr->ids); @@ -226,10 +226,10 @@ H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) /* Generate a new H5I_type_t value */ - /* Increment the number of types*/ + /* Increment the number of types */ if(H5I_next_type < H5I_MAX_NUM_TYPES) { - new_type = H5I_next_type; - H5_INC_ENUM(H5I_type_t, H5I_next_type); + new_type = (H5I_type_t)H5I_next_type; + H5I_next_type++; } /* end if */ else { hbool_t done; /* Indicate that search was successful */ @@ -247,7 +247,7 @@ H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) /* Verify that we found a type to give out */ if(done == FALSE) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded.") + HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded") } /* end else */ /* Allocate new ID class */ @@ -298,7 +298,7 @@ H5I_register_type(const H5I_class_t *cls) /* Sanity check */ HDassert(cls); - HDassert(cls->type_id > 0 && cls->type_id < H5I_MAX_NUM_TYPES); + HDassert(cls->type_id > 0 && (int)cls->type_id < H5I_MAX_NUM_TYPES); /* Initialize the type */ if(NULL == H5I_id_type_list_g[cls->type_id]) { @@ -355,13 +355,13 @@ H5Itype_exists(H5I_type_t type) FUNC_ENTER_API(FAIL) H5TRACE1("t", "It", type); + /* Validate parameter */ if(H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") - - if (type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if (NULL == H5I_id_type_list_g[type]) + if(NULL == H5I_id_type_list_g[type]) ret_value = FALSE; done: @@ -400,7 +400,7 @@ H5Inmembers(H5I_type_t type, hsize_t *num_members) * the private interface handle it, because the public interface throws * an error when the supplied type does not exist. */ - if(type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") if(NULL == H5I_id_type_list_g[type]) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist") @@ -442,7 +442,8 @@ H5I_nmembers(H5I_type_t type) FUNC_ENTER_NOAPI(FAIL) - if(type <= H5I_BADID || type >= H5I_next_type) + /* Validate parameter */ + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") if(NULL == (type_ptr = H5I_id_type_list_g[type]) || type_ptr->init_count <= 0) HGOTO_DONE(0); @@ -553,7 +554,8 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) FUNC_ENTER_NOAPI(FAIL) - if(type <= H5I_BADID || type >= H5I_next_type) + /* Validate parameters */ + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") udata.type_ptr = H5I_id_type_list_g[type]; @@ -696,7 +698,8 @@ H5I__destroy_type(H5I_type_t type) FUNC_ENTER_STATIC - if(type <= H5I_BADID || type >= H5I_next_type) + /* Validate parameter */ + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; @@ -779,7 +782,7 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - if (type <= H5I_BADID || type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") type_ptr = H5I_id_type_list_g[type]; if ((NULL == type_ptr) || (type_ptr->init_count <= 0)) @@ -846,7 +849,7 @@ H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, h HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use") /* Make sure type number is valid */ - if(type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") /* Get type pointer from list of types */ @@ -967,10 +970,10 @@ H5Iobject_verify(hid_t id, H5I_type_t id_type) FUNC_ENTER_API(NULL) H5TRACE2("*x", "iIt", id, id_type); + /* Validate parameters */ if(H5I_IS_LIB_TYPE(id_type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") - - if(id_type < 1 || id_type >= H5I_next_type) + if(id_type < 1 || (int)id_type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "identifier has invalid type") ret_value = H5I_object_verify(id, id_type); @@ -1003,7 +1006,7 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) FUNC_ENTER_NOAPI_NOERR - HDassert(id_type >= 1 && id_type < H5I_next_type); + HDassert(id_type >= 1 && (int)id_type < H5I_next_type); /* Verify that the type of the ID is correct & lookup the ID */ if(id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) { @@ -1043,7 +1046,7 @@ H5I_get_type(hid_t id) if(id > 0) ret_value = H5I_TYPE(id); - HDassert(ret_value >= H5I_BADID && ret_value < H5I_next_type); + HDassert(ret_value >= H5I_BADID && (int)ret_value < H5I_next_type); FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_type() */ @@ -1074,7 +1077,7 @@ H5Iget_type(hid_t id) ret_value = H5I_get_type(id); - if(ret_value <= H5I_BADID || ret_value >= H5I_next_type || NULL == H5I_object(id)) + if(ret_value <= H5I_BADID || (int)ret_value >= H5I_next_type || NULL == H5I_object(id)) HGOTO_DONE(H5I_BADID); done: @@ -1218,7 +1221,7 @@ H5I_remove(hid_t id) /* Check arguments */ type = H5I_TYPE(id); - if(type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; if(type_ptr == NULL || type_ptr->init_count <= 0) @@ -1581,14 +1584,13 @@ H5Iinc_type_ref(H5I_type_t type) H5TRACE1("Is", "It", type); /* Check arguments */ - if (type <= 0 || type >= H5I_next_type) + if(type <= 0 || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") - - if (H5I_IS_LIB_TYPE(type)) + if(H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") /* Do actual increment operation */ - if ((ret_value = H5I__inc_type_ref(type)) < 0) + if((ret_value = H5I__inc_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, (-1), "can't increment ID type ref count") done: @@ -1615,11 +1617,11 @@ H5I__inc_type_ref(H5I_type_t type) FUNC_ENTER_STATIC /* Sanity check */ - HDassert(type > 0 && type < H5I_next_type); + HDassert(type > 0 && (int)type < H5I_next_type); /* Check arguments */ type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr) + if(NULL == type_ptr) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type") /* Set return value */ @@ -1699,11 +1701,11 @@ H5I_dec_type_ref(H5I_type_t type) FUNC_ENTER_NOAPI((-1)) - if (type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->init_count <= 0) + if(type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type") /* Decrement the number of users of the atomic type. If this is the @@ -1711,14 +1713,14 @@ H5I_dec_type_ref(H5I_type_t type) * free all memory it used. The free function is invoked for each atom * being freed. */ - if (1 == type_ptr->init_count) { + if(1 == type_ptr->init_count) { H5I__destroy_type(type); ret_value = 0; - } + } /* end if */ else { --(type_ptr->init_count); ret_value = (herr_t)type_ptr->init_count; - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1744,14 +1746,13 @@ H5Iget_type_ref(H5I_type_t type) H5TRACE1("Is", "It", type); /* Check arguments */ - if (type <= 0 || type >= H5I_next_type) + if(type <= 0 || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") - - if (H5I_IS_LIB_TYPE(type)) + if(H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") /* Do actual retrieve operation */ - if ((ret_value = H5I__get_type_ref(type)) < 0) + if((ret_value = H5I__get_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get ID type ref count") done: @@ -2079,12 +2080,12 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - if (type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; /* Only iterate through ID list if it is initialized and there are IDs in type */ - if (type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { + if(type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ herr_t iter_status; /* Iteration status */ @@ -2095,7 +2096,7 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re iter_udata.obj_type = type; /* Iterate over IDs */ - if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) + if((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") } /* end if */ @@ -2127,11 +2128,10 @@ H5I__find_id(hid_t id) /* Check arguments */ type = H5I_TYPE(id); - if (type <= H5I_BADID || type >= H5I_next_type) + if(type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_DONE(NULL) - type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr || type_ptr->init_count <= 0) + if(!type_ptr || type_ptr->init_count <= 0) HGOTO_DONE(NULL) /* Locate the ID node for the ID */ diff --git a/src/H5Opline.c b/src/H5Opline.c index 609f2eb..eae7cd6 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -459,9 +459,9 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Message header */ - ret_value = 1 + /*version */ + ret_value = (size_t)(1 + /*version */ 1 + /*number of filters */ - (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0); /*reserved */ + (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0)); /*reserved */ /* Calculate size of each filter in pipeline */ for(i = 0; i < pline->nused; i++) { diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index b7f70d1..b4f00ea 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -355,11 +355,11 @@ H5O_sdspace_size(const H5F_t *f, const void *_mesg) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Basic information for all dataspace messages */ - ret_value = 1 + /* Version */ + ret_value = (size_t)(1 + /* Version */ 1 + /* Rank */ 1 + /* Flags */ 1 + /* Dataspace type/reserved */ - ((space->version > H5O_SDSPACE_VERSION_1) ? 0 : 4); /* Eliminated/reserved */ + ((space->version > H5O_SDSPACE_VERSION_1) ? 0 : 4)); /* Eliminated/reserved */ /* Add in the dimension sizes */ ret_value += space->rank * H5F_SIZEOF_SIZE(f); diff --git a/src/H5PLpath.c b/src/H5PLpath.c index 04248b5..5125839 100644 --- a/src/H5PLpath.c +++ b/src/H5PLpath.c @@ -673,12 +673,12 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo size_t len; /* Allocate & initialize the path name */ - len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 1 /*\0*/; + len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 5 /*\0*/; if (NULL == (path = (char *)H5MM_calloc(len))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") - HDsnprintf(path, len, "%s/%s", dir, dp->d_name); + HDsnprintf(path, len, "%s%s%s", dir, H5PL_PATH_SEPARATOR, dp->d_name); /* Get info for directory entry */ if (HDstat(path, &my_stat) == -1) diff --git a/src/H5Pint.c b/src/H5Pint.c index 0670adc..911a126 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -5235,7 +5235,7 @@ H5P__get_class_path(H5P_genclass_t *pclass) /* Allocate enough space for the parent class's path, plus the '/' * separator, this class's name and the string terminator */ - ret_str_len = HDstrlen(par_path) + 1 + HDstrlen(pclass->name) + 1; + ret_str_len = HDstrlen(par_path) + HDstrlen(pclass->name) + 3 + 1; if(NULL == (ret_value = (char *)H5MM_malloc(ret_str_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name") @@ -4732,14 +4732,14 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if(H5T_g.soft[i].conv.is_app) { if((H5T_g.soft[i].conv.u.app_func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { HDmemset(&(path->cdata), 0, sizeof(H5T_cdata_t)); - H5E_clear_stack(H5E_DEFAULT); /*ignore the error*/ + H5E_clear_stack(NULL); /*ignore the error*/ path_init_error = TRUE; } /* end if */ } /* end if */ else if((H5T_g.soft[i].conv.u.lib_func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { HDmemset(&(path->cdata), 0, sizeof(H5T_cdata_t)); - H5E_clear_stack(H5E_DEFAULT); /*ignore the error*/ + H5E_clear_stack(NULL); /*ignore the error*/ path_init_error = TRUE; } /* end if */ diff --git a/src/H5Toh.c b/src/H5Toh.c index b21ce72..ab6c09f 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -221,6 +221,7 @@ H5O__dtype_get_oloc(hid_t obj_id) /* Get the datatype */ if(NULL == (dt = (H5T_t *)H5I_object(obj_id))) HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") + /* If this is a named datatype, get the VOL driver pointer to the datatype */ type = (H5T_t *)H5T_get_actual_type(dt); diff --git a/src/H5system.c b/src/H5system.c index 5d2663e..bd5f9c5 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -1301,11 +1301,11 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/) * Allocate a buffer to hold path1 + path2 + possibly the delimiter * + terminating null byte */ - if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2))) + if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 4))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") /* Compose the full file name */ - HDsnprintf(*full_name, (path1_len + path2_len + 2), "%s%s%s", path1, + HDsnprintf(*full_name, (path1_len + path2_len + 4), "%s%s%s", path1, (H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2); } /* end else */ |