diff options
Diffstat (limited to 'src/H5Z.c')
-rw-r--r-- | src/H5Z.c | 130 |
1 files changed, 69 insertions, 61 deletions
@@ -43,10 +43,10 @@ typedef struct H5Z_stats_t { #endif /* H5Z_DEBUG */ typedef struct H5Z_object_t { - H5Z_filter_t filter_id; /* ID of the filter we're looking for */ - htri_t found; /* Whether we find an object using the filter */ + H5Z_filter_t filter_id; /* ID of the filter we're looking for */ + htri_t found; /* Whether we find an object using the filter */ #ifdef H5_HAVE_PARALLEL - hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */ + hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */ #endif /* H5_HAVE_PARALLEL */ } H5Z_object_t; @@ -339,12 +339,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Zunregister + * Function: H5Zunregister * - * Purpose: This function unregisters a filter. + * Purpose: This function unregisters a filter. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -371,13 +371,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__unregister + * Function: H5Z__unregister * - * Purpose: Same as the public version except this one allows filters - * to be unset for predefined method numbers <H5Z_FILTER_RESERVED + * Purpose: Same as the public version except this one allows filters + * to be unset for predefined method numbers <H5Z_FILTER_RESERVED + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -387,9 +387,9 @@ H5Z__unregister(H5Z_filter_t filter_id) H5Z_object_t object; /* Object to pass to callbacks */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE - HDassert(filter_id>=0 && filter_id<=H5Z_FILTER_MAX); + HDassert(filter_id >= 0 && filter_id <= H5Z_FILTER_MAX); /* Is the filter already registered? */ for (filter_index = 0; filter_index < H5Z_table_used_g; filter_index++) @@ -401,10 +401,10 @@ H5Z__unregister(H5Z_filter_t filter_id) HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter is not registered") /* Initialize the structure object for iteration */ - object.filter_id = filter_id; - object.found = FALSE; + object.filter_id = filter_id; + object.found = FALSE; #ifdef H5_HAVE_PARALLEL - object.sanity_checked = FALSE; + object.sanity_checked = FALSE; #endif /* H5_HAVE_PARALLEL */ /* Iterate through all opened datasets, returns a failure if any of them uses the filter */ @@ -434,17 +434,19 @@ H5Z__unregister(H5Z_filter_t filter_id) H5Z_table_used_g--; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__unregister() */ /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister + * Function: H5Z__check_unregister * - * Purpose: Check if an object uses the filter to be unregistered. + * Purpose: Check if an object uses the filter to be unregistered. + * + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * - * Return: TRUE if the object uses the filter. - * FALSE if not, NEGATIVE on error. *------------------------------------------------------------------------- */ static htri_t @@ -469,15 +471,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister_group_cb + * Function: H5Z__check_unregister_group_cb + * + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened objects. If the object is a dataset + * or a group and it uses the filter to be unregistered, the + * function returns TRUE. * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened objects. If the object is a dataset - * or a group and it uses the filter to be unregistered, the - * function returns TRUE. + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * - * Return: TRUE if the object uses the filter. - * FALSE otherwise. *------------------------------------------------------------------------- */ static int @@ -506,7 +510,7 @@ H5Z__check_unregister_group_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void if (filter_in_pline) { object->found = TRUE; ret_value = TRUE; - } /* end if */ + } done: if (ocpl_id > 0) @@ -518,15 +522,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister_dset_cb + * Function: H5Z__check_unregister_dset_cb + * + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened objects. If the object is a dataset + * or a group and it uses the filter to be unregistered, the + * function returns TRUE. * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened objects. If the object is a dataset - * or a group and it uses the filter to be unregistered, the - * function returns TRUE. + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * - * Return: TRUE if the object uses the filter. - * FALSE otherwise. *------------------------------------------------------------------------- */ static int @@ -555,7 +561,7 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void * if (filter_in_pline) { object->found = TRUE; ret_value = TRUE; - } /* end if */ + } done: if (ocpl_id > 0) @@ -567,27 +573,29 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__flush_file_cb + * Function: H5Z__flush_file_cb * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened files and flush them. + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened files and flush them. * - * Return: FALSE if finishes flushing and moves on - * FAIL if there is an error + * Return: NON-NEGATIVE if finishes flushing and moves on + * NEGATIVE if there is an error *------------------------------------------------------------------------- */ static int H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) { - H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ - H5Z_object_t *object = (H5Z_object_t *)key; - int ret_value = FALSE; /* Return value */ + H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ +#ifdef H5_HAVE_PARALLEL + H5Z_object_t *object = (H5Z_object_t *)key; +#endif /* H5_HAVE_PARALLEL */ + int ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC /* Sanity checks */ - HDassert(f); - HDassert(object); + HDassert(obj_ptr); + HDassert(key); /* Do a global flush if the file is opened for write */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { @@ -689,11 +697,11 @@ H5Z_filter_avail(H5Z_filter_t id) HGOTO_DONE(TRUE) key.id = (int)id; - if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) { - if (H5Z_register(filter_info) < 0) + if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) { + if(H5Z_register(filter_info) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter") HGOTO_DONE(TRUE) - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -817,11 +825,11 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get dataset creation property list object */ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") /* Peek at the layout information */ if (H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, dcpl_layout) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") /* Check if the dataset is chunked */ if (H5D_CHUNKED == dcpl_layout->type) { @@ -829,7 +837,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get I/O pipeline information */ if (H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") /* Check if the chunks have filters */ if (dcpl_pline.nused > 0) { @@ -846,12 +854,12 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get ID for dataspace to pass to filter routines */ if ((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) { (void)H5S_close(space); - HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") } /* Make the callbacks */ if (H5Z_prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") } } } @@ -1281,7 +1289,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, /* Try loading the filter */ key.id = (int)(pline->filter[idx].id); - if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) { + if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) { /* Register the filter we loaded */ if(H5Z_register(filter_info) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") @@ -1519,13 +1527,13 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) /* if the pipeline has no filters, just return */ if (pline->nused == 0) - HGOTO_DONE (SUCCEED) + HGOTO_DONE(SUCCEED) /* Delete all filters */ if (H5Z_FILTER_ALL == filter) { if (H5O_msg_reset(H5O_PLINE_ID, pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFREE, FAIL, "can't release pipeline info") - } /* end if */ + } /* Delete filter */ else { size_t idx; /* Index of filter in pipeline */ @@ -1568,7 +1576,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) pline->nused--; /* Reset information for previous last filter in pipeline */ - HDmemset (&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); + HDmemset(&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); } /* end else */ done: @@ -1596,7 +1604,7 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags) /* Get the filter info */ if (H5Z_get_filter_info(filter, filter_config_flags) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") done: FUNC_LEAVE_API(ret_value) |