summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-01-23 07:00:00 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-01-23 07:00:00 (GMT)
commitbb25c85e794449d3bf59d8811e53288569161790 (patch)
treee6c37cf6f8bba9323540ddddb70300b43351d88f /tools/lib
parentfcc03a356b4dd5e58cc88b692b3d05d75b8ae5d0 (diff)
downloadhdf5-bb25c85e794449d3bf59d8811e53288569161790.zip
hdf5-bb25c85e794449d3bf59d8811e53288569161790.tar.gz
hdf5-bb25c85e794449d3bf59d8811e53288569161790.tar.bz2
[svn-r18159] Description:
Bring Coverity fixes from 1/22/10 session to trunk: r18137: 219: Initialized hid_t to -1 and added close to error block. 189-191: Initialized line to NULL and added free line, and close fp to error block. r18138: 19: Moved code block for printing that the number of enums is empty to the error block. (Would never have been executed otherwise) r18139: Fix coverity item 58. Moved code related to displaying the parent of a repeated group to the else(isRoot) section, as the root group has no parent. r18140: 218: Initialized ret_value variable to -1. Because of throw Exception in default case of switch, the coverity problem would not have executed anyway. Good pratice is to initialize variables. r18141: Fix coverity item 92. Added code to H5E_register_class to free cls in case of an error. r18142: Fix coverity item 91. Added code to H5E_create_msg to free msg in case of an error. r18143: fixed issue 14, took away "if" and used #ifndef_xxx. r18144: Fix coverity item 110. Added code to H5Eget_minor to free msg_str in case of an error. r18145: fixed coverity #18 removed "aligned", it is always NULL. r18146: Fix coverity item 109. Added code to H5Eget_major to free msg_str in case of an error. r18147: Fixed coverity #81 and #82, Check for bad pointer(s), but can't issue error, just leave r18148: Fix coverity item 97. Added code to H5FD_fapl_open to free copied_driver_info in case of an error. r18149: Fix coverity item 96. Added code to H5FD_dxpl_open to free copied_driver_info in case of an error. r18150: Fix Coverity issue #29: Protected cache_ptr dereferences with "if(pass)" block r18151: Fix coverity item 93. Added code to H5FL_fac_init to free factory and new_node in case of an error. r18152: Fix coverity items 98 and 99. Added code free allocated space in case of error. r18155: 124: Freed head pointer before jumping to done. There was no error handling block and normal exit used same path out. 120-123: Freed list of lists in error handling block. r18156: Fix coverity issues 179, 180, 181, 182, 183, 184, 186, 320, 407. These were resource leak issues where allocated memory was not freed, generally in the case of tests that failed. Tested on: Mac OS X/32 10.6.2 (amazon) debug & production
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5tools_filters.c120
1 files changed, 30 insertions, 90 deletions
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index 325023d..341a5c9 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -49,31 +49,6 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
int nfilters; /* number of filters */
H5Z_filter_t filtn; /* filter identification number */
int i; /* index */
- int have_deflate=0; /* assume initially we do not have filters */
- int have_szip=0;
- int have_shuffle=0;
- int have_fletcher=0;
- int have_nbit=0;
- int have_scaleoffset=0;
-
-#ifdef H5_HAVE_FILTER_DEFLATE
- have_deflate=1;
-#endif
-#ifdef H5_HAVE_FILTER_SZIP
- have_szip=1;
-#endif
-#ifdef H5_HAVE_FILTER_SHUFFLE
- have_shuffle=1;
-#endif
-#ifdef H5_HAVE_FILTER_FLETCHER32
- have_fletcher=1;
-#endif
-#ifdef H5_HAVE_FILTER_NBIT
- have_nbit=1;
-#endif
-#ifdef H5_HAVE_FILTER_SCALEOFFSET
- have_scaleoffset=1;
-#endif
/* get information about filters */
@@ -106,72 +81,66 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_DEFLATE:
- if (!have_deflate)
- {
+#ifndef H5_HAVE_FILTER_DEFLATE
if (name)
print_warning(name,"deflate");
return 0;
- }
+#endif
break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_SZIP 4 , szip compression
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_SZIP:
- if (!have_szip)
- {
+#ifndef H5_HAVE_FILTER_SZIP
if (name)
print_warning(name,"SZIP");
return 0;
- }
+#endif
break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_SHUFFLE 2 , shuffle the data
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_SHUFFLE:
- if (!have_shuffle)
- {
+#ifndef H5_HAVE_FILTER_SHUFFLE
if (name)
print_warning(name,"shuffle");
return 0;
- }
+#endif
break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_FLETCHER32:
- if (!have_fletcher)
- {
+#ifndef H5_HAVE_FILTER_FLETCHER32
if (name)
print_warning(name,"fletcher32");
return 0;
- }
+#endif
break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_NBIT
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_NBIT:
- if (!have_nbit)
- {
+#ifndef H5_HAVE_FILTER_NBIT
if (name)
print_warning(name,"nbit");
return 0;
- }
+#endif
break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_SCALEOFFSET
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_SCALEOFFSET:
- if (!have_scaleoffset)
- {
+#ifndef H5_HAVE_FILTER_SCALEOFFSET
if (name)
print_warning(name,"scaleoffset");
return 0;
- }
+#endif
break;
}/*switch*/
}/*for*/
@@ -197,34 +166,6 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
*/
int h5tools_can_encode( H5Z_filter_t filtn)
{
-
- int have_deflate=0; /* assume initially we do not have filters */
- int have_szip=0;
- int have_shuffle=0;
- int have_fletcher=0;
- int have_nbit=0;
- int have_scaleoffset=0;
- unsigned int filter_config_flags;
-
-#ifdef H5_HAVE_FILTER_DEFLATE
- have_deflate=1;
-#endif
-#ifdef H5_HAVE_FILTER_SZIP
- have_szip=1;
-#endif
-#ifdef H5_HAVE_FILTER_SHUFFLE
- have_shuffle=1;
-#endif
-#ifdef H5_HAVE_FILTER_FLETCHER32
- have_fletcher=1;
-#endif
-#ifdef H5_HAVE_FILTER_NBIT
- have_nbit=1;
-#endif
-#ifdef H5_HAVE_FILTER_SCALEOFFSET
- have_scaleoffset=1;
-#endif
-
switch (filtn)
{
/* user defined filter */
@@ -232,16 +173,17 @@ int h5tools_can_encode( H5Z_filter_t filtn)
return 0;
case H5Z_FILTER_DEFLATE:
- if (!have_deflate)
- {
- return 0;
- }
+#ifndef H5_HAVE_FILTER_DEFLATE
+ return 0;
+#endif
break;
case H5Z_FILTER_SZIP:
- if (!have_szip)
+#ifndef H5_HAVE_FILTER_SZIP
+ return 0;
+#else
{
- return 0;
- }
+ unsigned int filter_config_flags;
+
if(H5Zget_filter_info(filtn, &filter_config_flags)<0)
return -1;
if ((filter_config_flags &
@@ -263,30 +205,28 @@ int h5tools_can_encode( H5Z_filter_t filtn)
(H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
return 1;
}
+ }
+#endif
break;
case H5Z_FILTER_SHUFFLE:
- if (!have_shuffle)
- {
+#ifndef H5_HAVE_FILTER_SHUFFLE
return 0;
- }
+#endif
break;
case H5Z_FILTER_FLETCHER32:
- if (!have_fletcher)
- {
+#ifndef H5_HAVE_FILTER_FLETCHER32
return 0;
- }
+#endif
break;
case H5Z_FILTER_NBIT:
- if (!have_nbit)
- {
+#ifndef H5_HAVE_FILTER_NBIT
return 0;
- }
+#endif
break;
case H5Z_FILTER_SCALEOFFSET:
- if (!have_scaleoffset)
- {
+#ifndef H5_HAVE_FILTER_SCALEOFFSET
return 0;
- }
+#endif
break;
}/*switch*/