summaryrefslogtreecommitdiffstats
path: root/src/H5Ztrans.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-12-03 19:11:29 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-12-03 19:11:29 (GMT)
commitfb1059e507cab041e2fd6bf294b12843a1ddf1c7 (patch)
tree571d12885e0199485aac0298f6c1a1bcad964d23 /src/H5Ztrans.c
parent94a17b86622b85bcea8b5a1c6419dd971a0b2427 (diff)
downloadhdf5-fb1059e507cab041e2fd6bf294b12843a1ddf1c7.zip
hdf5-fb1059e507cab041e2fd6bf294b12843a1ddf1c7.tar.gz
hdf5-fb1059e507cab041e2fd6bf294b12843a1ddf1c7.tar.bz2
[svn-r17953] Description:
Bring Coverity changes into the trunk: r17877: Error 266: Uninitialized memspace set to -1. Changed malloc and free to HDmalloc and HDfree. Removed unused dtype var. r17878: Error 265: Uninitialized mem_space set to -1. Changed malloc and free to HDmalloc and HDfree. Error 267: Uninitialized smspace set to -1. Changed malloc and free to HDmalloc and HDfree. r17879: Error 242: Uninitialized aid set to -1. Error 243: Uninitialized sid set to -1. Uninitialized tid set to -1 for consistency r17880: Error 242: reinitialized aid to -1 after close to be ready for reuse. Error 243: reinitialized sid to -1 after close to be ready for reuse. reinitialized tid to -1 for consistency after close to be ready for reuse. r17881: use valgrind to check there is a memory leak. The fix is to free ptrstr in line 5838 at xml_dump_group() of h5dump.c after it is used. run the valgrind after the fix, no memory leak for that part of the code. r17882: Fix Coverity items 256 and 269. r17883: Error 222-230: initialized hid_t vars to -1 after close to be ready for reuse. Also added H5Tclose for tid in gent_bigdims r17884: Bug fix (Coverity run2, view 23, dead code) (this is pair-program done by Albert, Elena and Larry). Confirmed and fixed the deadcode in hyperslab read branch of function diff_datasetid. (Discovered other bad code that diff_datasetid() should be recoded. Bug 1693 is entered for this.) r17906: Fix Coverity item 260. r17907: 262: Initialized hid_t's dtype, dtype_tmp and file to -1. Initialized H5T_t * dt to NULL. r17908: Fix Coverity item 261. r17909: Fix Coverity item 248. r17910: Revise fix for Coverity item 248. r17911: Resolved coverity issues #s 263, 162, 163, 164. All issues in dsets.c. Initialized fid and did hid_t's. filter_corrupt function was returning in the middle of an if statement, bypassing free calls. Updated error handling to free buffers and hid_t's appropriately. r17912: (done by Larry and Albert) Cleanup Coverity view warnings (#231-241) about using uninitialized variables. Initialized all of them. r17913: Resolved issue 251 and 264. Initialized tid2 to -1 and initialized buffers that were freed in case of an error. r17914: Resolved coverity issues 66, 220, and 221: 66: Negative Return assignment ignored 220,221: Initialized hid_t's. r17915: Fix Coverity item 247. r17916: Fix Coverity item 246. r17917: Fix Coverity item 245. r17918: Fix Coverity item 244. r17919: Coverity Issue #84: Moved asserts in H5T_cmp to the top of the function, and converted them to HDassert. Coverity complaining about using potentially NULL pointer without checking it. Want to see if Coverity will accept Assertions as acceptable checking before using the value. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.2 (amazon) in debug mode Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src/H5Ztrans.c')
-rw-r--r--src/H5Ztrans.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 2b35786..1a6988f 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -335,29 +335,29 @@ H5Z_unget_token(H5Z_token *current)
/*-------------------------------------------------------------------------
* Function: H5Z_get_token
+ *
* Purpose: Determine what the next valid H5Z_token is in the expression
* string. The current position within the H5Z_token string is
* kept internal to the H5Z_token and handled by this and the
* unget_H5Z_token function.
+ *
* Return: Succeess: The passed in H5Z_token with a valid tok_type
* field.
* Failure: The passed in H5Z_token but with the tok_type
* field set to ERROR.
+ *
* Programmer: Bill Wendling
* 26. August 2003
- * Modifications:
- * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs
+ *
*-------------------------------------------------------------------------
*/
static H5Z_token *
H5Z_get_token(H5Z_token *current)
{
-
- void* ret_value=current;
+ void *ret_value = current;
FUNC_ENTER_NOAPI(H5Z_get_token, NULL)
-
/* check args */
assert(current);
@@ -463,11 +463,11 @@ H5Z_get_token(H5Z_token *current)
if (current->tok_begin[0] == '\0')
current->tok_type = H5Z_XFORM_END;
- HGOTO_DONE(current);
+ /* Set return value */
+ ret_value = (void *)current;
done:
FUNC_LEAVE_NOAPI(ret_value)
-
}
@@ -498,17 +498,17 @@ H5Z_xform_destroy_parse_tree(H5Z_node *tree)
FUNC_LEAVE_NOAPI_VOID
}
-
/*-------------------------------------------------------------------------
* Function: H5Z_parse
+ *
* Purpose: Entry function for parsing the expression string.
+ *
* Return: Success: Valid H5Z_node ptr to an expression tree.
* NULLure: NULL
+ *
* Programmer: Bill Wendling
* 26. August 2003
- * Modifications:
- * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs
*
*-------------------------------------------------------------------------
*/
@@ -518,11 +518,10 @@ H5Z_xform_parse(const char *expression, H5Z_datval_ptrs* dat_val_pointers)
H5Z_token tok;
void* ret_value;
- FUNC_ENTER_NOAPI_NOFUNC(H5Z_xform_parse)
-
- if (!expression)
- HGOTO_DONE(NULL)
+ FUNC_ENTER_NOAPI(H5Z_xform_parse, NULL)
+ if(!expression)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "No expression provided?")
/* Set up the initial H5Z_token for parsing */
tok.tok_expr = tok.tok_begin = tok.tok_end = expression;
@@ -573,7 +572,7 @@ H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
if (!new_node) {
H5Z_xform_destroy_parse_tree(expr);
- HGOTO_DONE(expr)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
}
new_node->lchild = expr;
@@ -592,7 +591,7 @@ H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
if (!new_node) {
H5Z_xform_destroy_parse_tree(expr);
- HGOTO_DONE(expr)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
}
new_node->lchild = expr;
@@ -643,7 +642,7 @@ static H5Z_node *
H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
{
H5Z_node *term = NULL;
- void* ret_value;
+ H5Z_node *ret_value;
FUNC_ENTER_NOAPI(H5Z_parse_term, NULL);
term = H5Z_parse_factor(current, dat_val_pointers);
@@ -659,7 +658,7 @@ H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
if (!new_node) {
H5Z_xform_destroy_parse_tree(term);
- HGOTO_DONE(term)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
}
new_node->lchild = term;
@@ -678,7 +677,7 @@ H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
if (!new_node) {
H5Z_xform_destroy_parse_tree(term);
- HGOTO_DONE(term)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
}
new_node->lchild = term;
@@ -744,7 +743,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
factor = H5Z_new_node(H5Z_XFORM_INTEGER);
if (!factor)
- HGOTO_DONE(factor)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
sscanf(current->tok_begin, "%ld", &factor->value.int_val);
break;
@@ -752,7 +751,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
factor = H5Z_new_node(H5Z_XFORM_FLOAT);
if (!factor)
- HGOTO_DONE(factor)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
sscanf(current->tok_begin, "%lf", &factor->value.float_val);
break;
@@ -760,7 +759,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
factor = H5Z_new_node(H5Z_XFORM_SYMBOL);
if (!factor)
- HGOTO_DONE(factor)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]);
dat_val_pointers->num_ptrs++;
@@ -770,7 +769,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
factor = H5Z_parse_expression(current, dat_val_pointers);
if (!factor)
- HGOTO_DONE(factor)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
current = H5Z_get_token(current);