summaryrefslogtreecommitdiffstats
path: root/src/H5Tconv.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2013-09-05 20:44:14 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2013-09-05 20:44:14 (GMT)
commit5b876c929f79003c85585570827452f5d8052d01 (patch)
tree89a1fa7bb8221a8679f180868467464e331c18ce /src/H5Tconv.c
parenta1fe10691cf7ce1737aa420191efb996f7fe5657 (diff)
downloadhdf5-5b876c929f79003c85585570827452f5d8052d01.zip
hdf5-5b876c929f79003c85585570827452f5d8052d01.tar.gz
hdf5-5b876c929f79003c85585570827452f5d8052d01.tar.bz2
[svn-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 Tested on: Mac OSX 10.8.4 (amazon) w/gcc 4.8.1, C++ & FORTRAN (too minor to require h5committest)
Diffstat (limited to 'src/H5Tconv.c')
-rw-r--r--src/H5Tconv.c56
1 files changed, 55 insertions, 1 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 9ff0f00..bf686b8 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -8039,7 +8039,9 @@ H5T__conv_float_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, SCHAR, float, signed char, SCHAR_MIN, SCHAR_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8064,7 +8066,9 @@ H5T__conv_float_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, UCHAR, float, unsigned char, 0, UCHAR_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8089,7 +8093,9 @@ H5T__conv_double_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, SCHAR, double, signed char, SCHAR_MIN, SCHAR_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8114,7 +8120,9 @@ H5T__conv_double_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, UCHAR, double, unsigned char, 0, UCHAR_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8140,7 +8148,9 @@ H5T__conv_ldouble_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX);
+GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8167,7 +8177,9 @@ H5T__conv_ldouble_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX);
+GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8193,7 +8205,9 @@ H5T__conv_float_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, SHORT, float, short, SHRT_MIN, SHRT_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8218,7 +8232,9 @@ H5T__conv_float_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, USHORT, float, unsigned short, 0, USHRT_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8243,7 +8259,9 @@ H5T__conv_double_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, SHORT, double, short, SHRT_MIN, SHRT_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8268,7 +8286,9 @@ H5T__conv_double_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, USHORT, double, unsigned short, 0, USHRT_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8294,7 +8314,9 @@ H5T__conv_ldouble_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX);
+GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/
@@ -8321,7 +8343,9 @@ H5T__conv_ldouble_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX);
+GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8347,7 +8371,9 @@ H5T__conv_float_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, INT, float, int, INT_MIN, INT_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8372,7 +8398,9 @@ H5T__conv_float_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, UINT, float, unsigned int, 0, UINT_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8397,7 +8425,9 @@ H5T__conv_double_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, INT, double, int, INT_MIN, INT_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8422,7 +8452,9 @@ H5T__conv_double_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, UINT, double, unsigned int, 0, UINT_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8448,7 +8480,9 @@ H5T__conv_ldouble_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX);
+GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8475,7 +8509,9 @@ H5T__conv_ldouble_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX);
+GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_UINT */
@@ -8501,7 +8537,9 @@ H5T__conv_float_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, LONG, float, long, LONG_MIN, LONG_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8526,7 +8564,9 @@ H5T__conv_float_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, ULONG, float, unsigned long, 0, ULONG_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8551,7 +8591,9 @@ H5T__conv_double_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, LONG, double, long, LONG_MIN, LONG_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8576,7 +8618,9 @@ H5T__conv_double_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, ULONG, double, unsigned long, 0, ULONG_MAX);
+GCC_DIAG_ON(float-equal)
}
@@ -8602,7 +8646,9 @@ H5T__conv_ldouble_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX);
+GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/
@@ -8629,7 +8675,9 @@ H5T__conv_ldouble_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX);
+GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */
@@ -8656,7 +8704,9 @@ H5T__conv_float_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(FLOAT, LLONG, float, long long, LLONG_MIN, LLONG_MAX);
+GCC_DIAG_ON(float-equal)
}
#endif /* H5T_CONV_INTERNAL_FP_LLONG */
@@ -8710,7 +8760,9 @@ H5T__conv_double_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(DOUBLE, LLONG, double, long long, LLONG_MIN, LLONG_MAX);
+GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_FP_LLONG*/
@@ -8764,7 +8816,9 @@ H5T__conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
+GCC_DIAG_OFF(float-equal)
H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX);
+GCC_DIAG_ON(float-equal)
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/
@@ -8909,7 +8963,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* Allocate enough space for the buffer holding temporary
* converted value
*/
- buf_size = (size_t)HDpow((double)2.0, (double)src.u.f.esize) / 8 + 1;
+ buf_size = (size_t)HDpow((double)2.0f, (double)src.u.f.esize) / 8 + 1;
int_buf = (uint8_t*)H5MM_calloc(buf_size);
/* Get the plist structure. Do I need to close it? */