summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2013-09-06 19:09:07 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2013-09-06 19:09:07 (GMT)
commit38e0563a6e2bf77c860abb0ec61aa6a9da4204af (patch)
treeac2b12c47f4d66885efa0c5ae76ea0f0609b9078 /src/H5T.c
parentad7d03103deb0da4c12db131079088cb3446756d (diff)
downloadhdf5-38e0563a6e2bf77c860abb0ec61aa6a9da4204af.zip
hdf5-38e0563a6e2bf77c860abb0ec61aa6a9da4204af.tar.gz
hdf5-38e0563a6e2bf77c860abb0ec61aa6a9da4204af.tar.bz2
[svn-r24112] Description:
Bring r24101 & 24111 from trunk to 1.8 branch: r24101: ======= Description: Clean up warnings, enable new compiler warning flag(s) and bring back changes from Coverity branch: r20813: Remove the dead code as listed for coverity bug #1722. h5committested. r20814: Issue 69: Check return value and throw error if negative return. Also free datatype id on error r20815: Use HDstrncpy. --gh r20816: Replaced one last HDstrcat call with HDstrncat to resolve coverity issue 832. r20817: Use HDstrncpy and HDstrncat. --gh r20818: Purpose: Fix valgrind issues with h5jam Description: Modified h5jam to free strings strdup'd in parse_command_line before exit. Note that they may still not be freed in case of error, due to the widespread use of exit(). r20819: Issue 80: change loop to use int as loop index. r20820: Maintenance: Fixed the bug found by coverity CID 788 There were two problems with this function: 1) it tried to unnecessary free NULL pointer 2) it tried to allocate c_name buffer that is done by H5Pget_class_name r24111: ======= Description: Restrict GCC diagnostic pragmas to only gcc 4.6+ Tested on: Mac OSX 10.8.4 (amazon) w/gcc 4.8.1, C++ & FORTRAN (too minor to require h5committest)
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/H5T.c b/src/H5T.c
index c480a47..d73d270 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -496,10 +496,10 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0;
/* Useful floating-point values for conversion routines */
/* (+/- Inf for all floating-point types) */
-float H5T_NATIVE_FLOAT_POS_INF_g = 0.0;
-float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0;
-double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0;
-double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0;
+float H5T_NATIVE_FLOAT_POS_INF_g = 0.0f;
+float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0f;
+double H5T_NATIVE_DOUBLE_POS_INF_g = (double)0.0f;
+double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f;
/* Declare the free list for H5T_t's and H5T_shared_t's */
H5FL_DEFINE(H5T_t);
@@ -2399,7 +2399,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
if(NULL == (new_path = H5FL_CALLOC(H5T_path_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
HDstrncpy(new_path->name, name, (size_t)H5T_NAMELEN);
- new_path->name[H5T_NAMELEN-1] = '\0';
+ new_path->name[H5T_NAMELEN - 1] = '\0';
if(NULL == (new_path->src = H5T_copy(old_path->src, H5T_COPY_ALL)) ||
NULL == (new_path->dst=H5T_copy(old_path->dst, H5T_COPY_ALL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy data types")
@@ -4519,7 +4519,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
H5E_clear_stack(H5E_DEFAULT); /*ignore the error*/
} /* end if */
else {
- HDstrcpy(path->name, H5T_g.soft[i].name);
+ HDstrncpy(path->name, H5T_g.soft[i].name, (size_t)H5T_NAMELEN);
+ path->name[H5T_NAMELEN - 1] = '\0';
path->func = H5T_g.soft[i].func;
path->is_hard = FALSE;
} /* end else */