diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2012-08-08 23:01:20 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2012-08-08 23:01:20 (GMT) |
commit | 88a94bbe7ffa3c0bb7779d1b16989b385d9eadd2 (patch) | |
tree | be52b18015cf8df4af976ab5cfdc912748783b22 /src/H5Pfapl.c | |
parent | 79b2eb993e29cf0382db07b322fa3ca5cb00fc65 (diff) | |
download | hdf5-88a94bbe7ffa3c0bb7779d1b16989b385d9eadd2.zip hdf5-88a94bbe7ffa3c0bb7779d1b16989b385d9eadd2.tar.gz hdf5-88a94bbe7ffa3c0bb7779d1b16989b385d9eadd2.tar.bz2 |
[svn-r22646] Description:
Changes resulting from Klocwork static analysis tool, from Mark Miller
@ LLNL (miller86@llnl.gov).
Tested on:
Mac OS X/64 10.7.4 (amazon) w/debug, C++ & FORTRAN, using gcc 4.7.x
(too minor to require h5committest)
Diffstat (limited to 'src/H5Pfapl.c')
-rw-r--r-- | src/H5Pfapl.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index f2af61b..9b5d1b0 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -2494,12 +2494,13 @@ done: herr_t H5P_file_image_info_copy(const char UNUSED *name, size_t UNUSED size, void *value) { - H5FD_file_image_info_t *info; /* Image info struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT if(value) { + H5FD_file_image_info_t *info; /* Image info struct */ + info = (H5FD_file_image_info_t *)value; /* verify file image field consistancy */ @@ -2533,16 +2534,17 @@ H5P_file_image_info_copy(const char UNUSED *name, size_t UNUSED size, void *valu else HDmemcpy(info->buffer, old_buffer, info->size); } /* end if */ - } /* end if */ - /* Copy udata if it exists */ - if(info->callbacks.udata) { - void *old_udata = info->callbacks.udata; + /* Copy udata if it exists */ + if(info->callbacks.udata) { + void *old_udata = info->callbacks.udata; + + if(NULL == info->callbacks.udata_copy) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_copy not defined") - if(NULL == info->callbacks.udata_copy) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_copy not defined") + info->callbacks.udata = info->callbacks.udata_copy(old_udata); + } /* end if */ - info->callbacks.udata = info->callbacks.udata_copy(old_udata); } /* end if */ done: @@ -2567,32 +2569,33 @@ done: herr_t H5P_file_image_info_close(const char UNUSED *name, size_t UNUSED size, void *value) { - H5FD_file_image_info_t info; /* Image info struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT if(value) { - info = *(H5FD_file_image_info_t *)value; + H5FD_file_image_info_t *info; /* Image info struct */ + + info = (H5FD_file_image_info_t *)value; - if(info.buffer != NULL && info.size > 0) { + if(info->buffer != NULL && info->size > 0) { /* Free buffer */ - if(info.callbacks.image_free) { - if(info.callbacks.image_free(info.buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, - info.callbacks.udata) < 0) + if(info->callbacks.image_free) { + if(info->callbacks.image_free(info->buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, + info->callbacks.udata) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "image_free callback failed") } /* end if */ else - H5MM_xfree(info.buffer); + H5MM_xfree(info->buffer); } /* end if */ - } /* end if */ - /* Free udata if it exists */ - if(info.callbacks.udata) { - if(NULL == info.callbacks.udata_free) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_free not defined") - if(info.callbacks.udata_free(info.callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") + /* Free udata if it exists */ + if(info->callbacks.udata) { + if(NULL == info->callbacks.udata_free) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_free not defined") + if(info->callbacks.udata_free(info->callbacks.udata) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") + } /* end if */ } /* end if */ done: |