diff options
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: |