diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDfamily.c | 18 | ||||
-rw-r--r-- | src/H5FDmulti.c | 2 | ||||
-rw-r--r-- | src/H5Fint.c | 4 | ||||
-rw-r--r-- | src/H5PLpath.c | 2 | ||||
-rw-r--r-- | src/H5Pint.c | 2 | ||||
-rw-r--r-- | src/H5system.c | 4 |
6 files changed, 25 insertions, 7 deletions
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index c8893f9..bc00403 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -613,6 +613,14 @@ done: * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * memb_name & temp 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 H5FD_t * H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) @@ -763,6 +771,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_family_open() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- @@ -942,6 +951,14 @@ H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() call with + * memb_name 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 herr_t H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) { @@ -1008,6 +1025,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index b1d3430..acd128c 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*)((void *)x); + ap = (haddr_t*)((void *)x); /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ UNIQUE_MEMBERS(map, mt) { memb_addr[_unmapped] = *ap++; memb_eoa[_unmapped] = *ap++; diff --git a/src/H5Fint.c b/src/H5Fint.c index 6879d46..758900b 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 + 4))) + if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2 + 2))) /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate filename buffer") /* Compose the full file name */ - HDsnprintf(*full_name, (prefix_len + fname_len + 4), "%s%s%s", prefix, + HDsnprintf(*full_name, (prefix_len + fname_len + 2 + 2), "%s%s%s", prefix, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ ((prefix_len == 0 || H5_CHECK_DELIMITER(prefix[prefix_len - 1])) ? "" : H5_DIR_SEPS), file_name); done: diff --git a/src/H5PLpath.c b/src/H5PLpath.c index 5125839..44d9cb9 100644 --- a/src/H5PLpath.c +++ b/src/H5PLpath.c @@ -673,7 +673,7 @@ 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) + 5 /*\0*/; + len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 1 /*\0*/ + 4; /* Extra "+4" to quiet GCC warning - 2019/07/05, QAK */ if (NULL == (path = (char *)H5MM_calloc(len))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") diff --git a/src/H5Pint.c b/src/H5Pint.c index 911a126..a9dc363 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) + HDstrlen(pclass->name) + 3 + 1; + ret_str_len = HDstrlen(par_path) + HDstrlen(pclass->name) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */ if(NULL == (ret_value = (char *)H5MM_malloc(ret_str_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name") diff --git a/src/H5system.c b/src/H5system.c index bd5f9c5..1d47d13 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 + 4))) + if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2 + 2))) /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") /* Compose the full file name */ - HDsnprintf(*full_name, (path1_len + path2_len + 4), "%s%s%s", path1, + HDsnprintf(*full_name, (path1_len + path2_len + 2 + 2), "%s%s%s", path1, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ (H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2); } /* end else */ |