diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5PL.c | 43 | ||||
-rw-r--r-- | src/H5Z.c | 1008 |
2 files changed, 544 insertions, 507 deletions
@@ -881,7 +881,6 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, const void **pl_info) } /* end if */ else { const H5Z_class2_t *plugin_info; - H5Z_class2_t *plugin_copy = NULL; /* Invoke H5PLget_plugin_info to verify this is the right library we are looking for. * Move on if it isn't. @@ -911,22 +910,8 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, const void **pl_info) (H5PL_table_g[H5PL_table_used_g]).pl_id = plugin_info->id; H5PL_table_used_g++; - /* allocate local copy of plugin info */ - if (NULL == (plugin_copy = (H5Z_class2_t *)H5MM_calloc(sizeof(H5Z_class2_t)))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for plugin info") /* Set the plugin info to return */ - *pl_info = (const void *)plugin_copy; - - plugin_copy->version = plugin_info->version; - plugin_copy->id = plugin_info->id; - plugin_copy->encoder_present = plugin_info->encoder_present; - plugin_copy->decoder_present = plugin_info->decoder_present; - plugin_copy->can_apply = plugin_info->can_apply; - plugin_copy->set_local = plugin_info->set_local; - plugin_copy->filter = plugin_info->filter; - /* copy the user's string into the property */ - if(NULL == (plugin_copy->name = (char *)H5MM_xstrdup(plugin_info->name))) - HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "can't allocate memory for plugin info name") + *pl_info = (const void *)plugin_info; /* Indicate success */ ret_value = TRUE; @@ -938,10 +923,6 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, const void **pl_info) } /* end else */ done: - /* unallocate local copy of plugin info on failure */ - if (FAIL == ret_value && *pl_info) { - *pl_info = (H5Z_class2_t *)H5MM_xfree(*pl_info); - } FUNC_LEAVE_NOAPI(ret_value) } /* end H5PL__open() */ @@ -976,7 +957,6 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **info) if((plugin_type == (H5PL_table_g[i]).pl_type) && (type_id == (H5PL_table_g[i]).pl_id)) { H5PL_get_plugin_info_t get_plugin_info; const H5Z_class2_t *plugin_info; - H5Z_class2_t *plugin_copy = NULL; if(NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC((H5PL_table_g[i]).handle, "H5PLget_plugin_info"))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info") @@ -984,32 +964,13 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **info) if(NULL == (plugin_info = (const H5Z_class2_t *)(*get_plugin_info)())) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info") - if (NULL == (plugin_copy = (H5Z_class2_t *)H5MM_calloc(sizeof(H5Z_class2_t)))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for plugin info") - /* Set the plugin info to return */ - *info = (const void *)plugin_copy; - - plugin_copy->version = plugin_info->version; - plugin_copy->id = plugin_info->id; - plugin_copy->encoder_present = plugin_info->encoder_present; - plugin_copy->decoder_present = plugin_info->decoder_present; - plugin_copy->can_apply = plugin_info->can_apply; - plugin_copy->set_local = plugin_info->set_local; - plugin_copy->filter = plugin_info->filter; - /* copy the user's string into the property */ - if(NULL == (plugin_copy->name = (char *)H5MM_xstrdup(plugin_info->name))) - HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "can't allocate memory for plugin info name") - + *info = plugin_info; HGOTO_DONE(TRUE) } /* end if */ } /* end for */ } /* end if */ done: - /* unallocate local copy of plugin info on failure */ - if (FAIL == ret_value && *info) { - *info = (H5Z_class2_t *)H5MM_xfree(*info); - } FUNC_LEAVE_NOAPI(ret_value) } /* end H5PL__search_table() */ @@ -122,8 +122,8 @@ done: int H5Z_term_interface(void) { - size_t i; #ifdef H5Z_DEBUG + size_t i; int dir; int nprint = 0; char comment[16]; @@ -178,12 +178,6 @@ H5Z_term_interface(void) } } #endif /* H5Z_DEBUG */ - for (i = 0; i < H5Z_table_used_g; i++) { - H5Z_class2_t *cls = (H5Z_class2_t *)(H5Z_table_g+i); - /* deallocate plugin info name */ - if (cls->name) - cls->name = (char *)H5MM_xfree(cls->name); - } /* Free the table of filters */ H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g); #ifdef H5Z_DEBUG @@ -217,7 +211,7 @@ H5Zregister(const void *cls) /* Check args */ if (cls_real==NULL) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class") /* Check H5Z_class_t version number; this is where a function to convert * from an outdated version should be called. @@ -249,20 +243,20 @@ H5Zregister(const void *cls) #else /* H5_NO_DEPRECATED_SYMBOLS */ /* Deprecated symbols not allowed, throw an error */ - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5Z_class_t version number"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5Z_class_t version number"); #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end if */ if (cls_real->id < 0 || cls_real->id > H5Z_FILTER_MAX) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") if (cls_real->id < H5Z_FILTER_RESERVED) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters") if (cls_real->filter == NULL) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no filter function specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no filter function specified") /* Do it */ if (H5Z_register (cls_real) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") done: FUNC_LEAVE_API(ret_value) @@ -308,7 +302,7 @@ H5Z_register (const H5Z_class2_t *cls) H5Z_table_g = table; #ifdef H5Z_DEBUG if (!stat_table) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter statistics table") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter statistics table") H5Z_stat_table_g = stat_table; #endif /* H5Z_DEBUG */ H5Z_table_alloc_g = n; @@ -317,20 +311,14 @@ H5Z_register (const H5Z_class2_t *cls) /* Initialize */ i = H5Z_table_used_g++; HDmemcpy (H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); - H5Z_table_g[i].name = (char *)H5MM_xstrdup(cls->name); #ifdef H5Z_DEBUG HDmemset (H5Z_stat_table_g+i, 0, sizeof(H5Z_stats_t)); #endif /* H5Z_DEBUG */ } /* end if */ /* Filter already registered */ else { - H5Z_class2_t *old_cls = (H5Z_class2_t *)(H5Z_table_g+i); - /* deallocate plugin info name */ - if (old_cls->name) - old_cls->name = (char *)H5MM_xfree(old_cls->name); /* Replace old contents */ HDmemcpy (old_cls, cls, sizeof(H5Z_class2_t)); - old_cls->name = (char *)H5MM_xstrdup(cls->name); } /* end else */ done: @@ -386,7 +374,6 @@ H5Z_unregister(H5Z_filter_t filter_id) size_t filter_index; /* Local index variable for filter */ H5Z_object_t object; herr_t ret_value = SUCCEED; /* Return value */ - H5Z_class2_t *old_cls = NULL; FUNC_ENTER_NOAPI(FAIL) @@ -423,10 +410,6 @@ H5Z_unregister(H5Z_filter_t filter_id) if (H5I_iterate(H5I_FILE, H5Z__flush_file_cb, NULL, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed") - /* deallocate plugin info name */ - old_cls = (H5Z_class2_t *)(H5Z_table_g+filter_index); - if (old_cls->name) - old_cls->name = (char *)H5MM_xfree(old_cls->name); /* Remove filter from table */ /* Don't worry about shrinking table size (for now) */ HDmemmove (&H5Z_table_g[filter_index], &H5Z_table_g[filter_index+1], sizeof(H5Z_class2_t)*((H5Z_table_used_g-1)-filter_index)); @@ -459,11 +442,11 @@ H5Z__check_unregister(hid_t ocpl_id, H5Z_filter_t filter_id) /* Get the plist structure of object creation */ if (NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR (H5E_PLINE, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_PLINE, H5E_BADATOM, FAIL, "can't find object for ID") /* Check if the object creation property list uses the filter */ if ((ret_value = H5P_filter_in_pline(plist, filter_id)) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") done: FUNC_LEAVE_NOAPI(ret_value) @@ -471,15 +454,19 @@ 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 otherwise. + * + * Programmer: Raymond Lu + * 6 May 2013 * - * Return: TRUE if the object uses the filter. - * FALSE otherwise. *------------------------------------------------------------------------- */ static int @@ -495,40 +482,44 @@ H5Z__check_unregister_group_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void HDassert(obj_ptr); /* Get the group creation property */ - if ((ocpl_id = H5G_get_create_plist((H5G_t *)obj_ptr)) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't get group creation property list") + if((ocpl_id = H5G_get_create_plist((H5G_t *)obj_ptr)) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get group creation property list") /* Check if the filter is in the group creation property list */ - if ((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") + if((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") /* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and * let H5Z_unregister return failure. - */ - if (filter_in_pline) { + */ + if(filter_in_pline) { object->found = TRUE; ret_value = TRUE; } /* end if */ done: - if (ocpl_id > 0) - if (H5I_dec_app_ref(ocpl_id) < 0) - HDONE_ERROR (H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist") + if(ocpl_id > 0) + if(H5I_dec_app_ref(ocpl_id) < 0) + HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist") FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__check_unregister_group_cb() */ /*------------------------------------------------------------------------- - * 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 otherwise. + * + * Programmer: Raymond Lu + * 6 May 2013 * - * Return: TRUE if the object uses the filter. - * FALSE otherwise. *------------------------------------------------------------------------- */ static int @@ -541,57 +532,61 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void * FUNC_ENTER_STATIC - HDassert (obj_ptr); + HDassert(obj_ptr); /* Get the dataset creation property */ - if ((ocpl_id = H5D_get_create_plist((H5D_t *)obj_ptr)) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't get dataset creation property list") + if((ocpl_id = H5D_get_create_plist((H5D_t *)obj_ptr)) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get dataset creation property list") /* Check if the filter is in the dataset creation property list */ - if ((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") + if((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") /* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and * let H5Z_unregister return failure. - */ - if (filter_in_pline) { + */ + if(filter_in_pline) { object->found = TRUE; ret_value = TRUE; } /* end if */ done: - if (ocpl_id > 0) - if (H5I_dec_app_ref(ocpl_id) < 0) - HDONE_ERROR (H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist") + if(ocpl_id > 0) + if(H5I_dec_app_ref(ocpl_id) < 0) + HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist") FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__check_unregister_dset_cb() */ /*------------------------------------------------------------------------- - * 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 + * + * Programmer: Raymond Lu + * 6 May 2013 * - * Return: FALSE if finishes flushing and moves on - * FAIL if there is an error *------------------------------------------------------------------------- */ static int H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_UNUSED *key) { - int ret_value = FALSE; /* Return value */ + int ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC - HDassert (obj_ptr); + HDassert(obj_ptr); - /* Call the flush routine for mounted file hierarchies. Do a global flush + /* Call the flush routine for mounted file hierarchies. Do a global flush * if the file is opened for write */ - if (H5F_ACC_RDWR & H5F_INTENT((H5F_t *)obj_ptr)) { - if (H5F_flush_mounts((H5F_t *)obj_ptr, H5AC_dxpl_id) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy") + if(H5F_ACC_RDWR & H5F_INTENT((H5F_t *)obj_ptr)) { + if(H5F_flush_mounts((H5F_t *)obj_ptr, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy") } /* end if */ done: @@ -600,27 +595,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5Zfilter_avail + * Function: H5Zfilter_avail + * + * Purpose: Check if a filter is available * - * Purpose: Check if a filter is available + * Return: Non-negative (TRUE/FALSE) on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, November 14, 2002 + * + * Modifications: * - * Return: Non-negative (TRUE/FALSE) on success/Negative on failure *------------------------------------------------------------------------- */ htri_t H5Zfilter_avail(H5Z_filter_t id) { - htri_t ret_value = FALSE; /* Return value */ + htri_t ret_value=FALSE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "Zf", id); /* Check args */ - if (id < 0 || id > H5Z_FILTER_MAX) + if(id<0 || id>H5Z_FILTER_MAX) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") - if ((ret_value = H5Z_filter_avail(id)) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "unable to check the availability of the filter") + if((ret_value = H5Z_filter_avail(id)) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "unable to check the availability of the filter") done: FUNC_LEAVE_API(ret_value) @@ -628,35 +629,35 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_filter_avail + * Function: H5Z_filter_avail + * + * Purpose: Private function to check if a filter is available * - * Purpose: Private function to check if a filter is available + * Return: Non-negative (TRUE/FALSE) on success/Negative on failure + * + * Programmer: Raymond Lu + * 13 February 2013 * - * Return: Non-negative (TRUE/FALSE) on success/Negative on failure *------------------------------------------------------------------------- */ htri_t H5Z_filter_avail(H5Z_filter_t id) { - size_t i; /* Local index variable */ - H5Z_class2_t *filter_info; - htri_t ret_value = FALSE; /* Return value */ + size_t i; /* Local index variable */ + const H5Z_class2_t *filter_info; + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Is the filter already registered? */ - for (i = 0; i < H5Z_table_used_g; i++) - if (H5Z_table_g[i].id == id) - HGOTO_DONE (TRUE) + for(i = 0; i < H5Z_table_used_g; i++) + if(H5Z_table_g[i].id == id) + HGOTO_DONE(TRUE) if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)id))) { - herr_t status = H5Z_register(filter_info); - if (filter_info->name) - filter_info->name = (char *)H5MM_xfree(filter_info->name); - filter_info = (H5Z_class2_t *)H5MM_xfree(filter_info); - if (status < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter") - HGOTO_DONE (TRUE) + if (H5Z_register(filter_info) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter") + HGOTO_DONE(TRUE) } done: FUNC_LEAVE_NOAPI(ret_value) @@ -664,16 +665,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_prelude_callback + * Function: H5Z_prelude_callback * - * Purpose: Makes a dataset creation "prelude" callback for the "can_apply" - * or "set_local" routines. + * Purpose: Makes a dataset creation "prelude" callback for the "can_apply" + * or "set_local" routines. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, April 4, 2003 + * + * Notes: + * The chunk dimensions are used to create a dataspace, instead + * of passing in the dataset's dataspace, since the chunk + * dimensions are what the I/O filter will actually see * - * Notes: The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ static herr_t @@ -682,59 +688,59 @@ H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, { H5Z_class2_t *fclass; /* Individual filter information */ size_t u; /* Local index variable */ - htri_t ret_value = TRUE; /* Return value */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT HDassert(pline->nused > 0); /* Iterate over filters */ - for (u = 0; u < pline->nused; u++) { + for(u = 0; u < pline->nused; u++) { /* Get filter information */ - if (NULL == (fclass = H5Z_find(pline->filter[u].id))) { + if(NULL == (fclass = H5Z_find(pline->filter[u].id))) { /* Ignore errors from optional filters */ - if (pline->filter[u].flags & H5Z_FLAG_OPTIONAL) - H5E_clear_stack (NULL); + if(pline->filter[u].flags & H5Z_FLAG_OPTIONAL) + H5E_clear_stack(NULL); else - HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located") + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located") } /* end if */ else { /* Make correct callback */ - switch (prelude_type) { + switch(prelude_type) { case H5Z_PRELUDE_CAN_APPLY: /* Check if filter is configured to be able to encode */ - if (!fclass->encoder_present) - HGOTO_ERROR (H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled."); + if(!fclass->encoder_present) + HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled."); /* Check if there is a "can apply" callback */ - if (fclass->can_apply) { + if(fclass->can_apply) { /* Make callback to filter's "can apply" function */ htri_t status = (fclass->can_apply)(dcpl_id, type_id, space_id); /* Indicate error during filter callback */ - if (status < 0) + if(status < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback") - /* Indicate filter can't apply to this combination of parameters. + /* Indicate filter can't apply to this combination of parameters. * If the filter is NOT optional, returns failure. */ - if (status == FALSE && !(pline->filter[u].flags & H5Z_FLAG_OPTIONAL)) + if(status == FALSE && !(pline->filter[u].flags & H5Z_FLAG_OPTIONAL)) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate") } /* end if */ break; case H5Z_PRELUDE_SET_LOCAL: /* Check if there is a "set local" callback */ - if (fclass->set_local) { + if(fclass->set_local) { /* Make callback to filter's "set local" function */ - if ((fclass->set_local)(dcpl_id, type_id, space_id) < 0) + if((fclass->set_local)(dcpl_id, type_id, space_id) < 0) /* Indicate error during filter callback */ - HGOTO_ERROR (H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback") + HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback") } /* end if */ break; default: - HDassert ("invalid prelude type" && 0); + HDassert("invalid prelude type" && 0); } /* end switch */ } /* end else */ } /* end for */ @@ -746,77 +752,82 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_prepare_prelude_callback_dcpl + * Function: H5Z_prepare_prelude_callback_dcpl * - * Purpose: Prepares to make a dataset creation "prelude" callback - * for the "can_apply" or "set_local" routines. + * Purpose: Prepares to make a dataset creation "prelude" callback + * for the "can_apply" or "set_local" routines. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, April 4, 2003 + * + * Notes: + * The chunk dimensions are used to create a dataspace, instead + * of passing in the dataset's dataspace, since the chunk + * dimensions are what the I/O filter will actually see * - * Notes: The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ static herr_t H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type) { - hid_t space_id = -1; /* ID for dataspace describing chunk */ - herr_t ret_value = SUCCEED; /* Return value */ + hid_t space_id = -1; /* ID for dataspace describing chunk */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - HDassert (H5I_GENPROP_LST == H5I_get_type(dcpl_id)); - HDassert (H5I_DATATYPE == H5I_get_type(type_id)); + HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); + HDassert(H5I_DATATYPE == H5I_get_type(type_id)); /* Check if the property list is non-default */ - if (dcpl_id != H5P_DATASET_CREATE_DEFAULT) { - H5P_genplist_t *dc_plist; /* Dataset creation property list object */ - H5O_layout_t dcpl_layout; /* Dataset's layout information */ + if(dcpl_id != H5P_DATASET_CREATE_DEFAULT) { + H5P_genplist_t *dc_plist; /* Dataset creation property list object */ + H5O_layout_t dcpl_layout; /* Dataset's layout information */ /* 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") + 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") /* Get layout information */ - if (H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") + if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") /* Check if the dataset is chunked */ - if (H5D_CHUNKED == dcpl_layout.type) { + if(H5D_CHUNKED == dcpl_layout.type) { H5O_pline_t dcpl_pline; /* Object's I/O pipeline information */ /* Get I/O pipeline information */ - if (H5P_get(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") + if(H5P_get(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") /* Check if the chunks have filters */ - if (dcpl_pline.nused > 0) { + if(dcpl_pline.nused > 0) { hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; /* Size of chunk dimensions */ - H5S_t *space; /* Dataspace describing chunk */ - size_t u; /* Local index variable */ + H5S_t *space; /* Dataspace describing chunk */ + size_t u; /* Local index variable */ /* Create a dataspace for a chunk & set the extent */ - for (u = 0; u < dcpl_layout.u.chunk.ndims; u++) + for(u = 0; u < dcpl_layout.u.chunk.ndims; u++) chunk_dims[u] = dcpl_layout.u.chunk.dim[u]; - if (NULL == (space = H5S_create_simple(dcpl_layout.u.chunk.ndims, chunk_dims, NULL))) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + if(NULL == (space = H5S_create_simple(dcpl_layout.u.chunk.ndims, chunk_dims, NULL))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") /* 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") + 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") } /* end if */ /* 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") + 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") } /* end if */ } /* end if */ } /* end if */ done: - if (space_id > 0 && H5I_dec_ref(space_id) < 0) + if(space_id > 0 && H5I_dec_ref(space_id) < 0) HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") FUNC_LEAVE_NOAPI(ret_value) @@ -824,18 +835,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_can_apply + * Function: H5Z_can_apply * - * Purpose: Checks if all the filters defined in the dataset creation - * property list can be applied to a particular combination of - * datatype and dataspace for a dataset. + * Purpose: Checks if all the filters defined in the dataset creation + * property list can be applied to a particular combination of + * datatype and dataspace for a dataset. * - * Return: Non-negative on success - * Negative on failure + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, April 3, 2003 + * + * Notes: + * The chunk dimensions are used to create a dataspace, instead + * of passing in the dataset's dataspace, since the chunk + * dimensions are what the I/O filter will actually see * - * Notes: The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ herr_t @@ -846,8 +861,8 @@ H5Z_can_apply(hid_t dcpl_id, hid_t type_id) FUNC_ENTER_NOAPI(FAIL) /* Make "can apply" callbacks for filters in pipeline */ - if (H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + if(H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") done: FUNC_LEAVE_NOAPI(ret_value) @@ -855,18 +870,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_set_local + * Function: H5Z_set_local * - * Purpose: Makes callbacks to modify dataset creation list property - * settings for filters on a new dataset, based on the datatype - * and dataspace of that dataset (chunk). + * Purpose: Makes callbacks to modify dataset creation list property + * settings for filters on a new dataset, based on the datatype + * and dataspace of that dataset (chunk). * - * Return: Non-negative on success - * Negative on failure + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, April 4, 2003 + * + * Notes: + * The chunk dimensions are used to create a dataspace, instead + * of passing in the dataset's dataspace, since the chunk + * dimensions are what the I/O filter will actually see * - * Notes: The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ herr_t @@ -877,8 +896,8 @@ H5Z_set_local(hid_t dcpl_id, hid_t type_id) FUNC_ENTER_NOAPI(FAIL) /* Make "set local" callbacks for filters in pipeline */ - if (H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") + if(H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") done: FUNC_LEAVE_NOAPI(ret_value) @@ -886,14 +905,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_can_apply_direct + * Function: H5Z_can_apply_direct * - * Purpose: Checks if all the filters defined in the pipeline can be - * applied to an opaque byte stream (currently only a group). - * The pipeline is assumed to have at least one filter. + * Purpose: Checks if all the filters defined in the pipeline can be + * applied to an opaque byte stream (currently only a group). + * The pipeline is assumed to have at least one filter. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Tuesday, September 22, 2009 * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -903,11 +925,11 @@ H5Z_can_apply_direct(const H5O_pline_t *pline) FUNC_ENTER_NOAPI(FAIL) - HDassert (pline->nused > 0); + HDassert(pline->nused > 0); /* Make "can apply" callbacks for filters in pipeline */ - if (H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_CAN_APPLY) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + if(H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_CAN_APPLY) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") done: FUNC_LEAVE_NOAPI(ret_value) @@ -915,18 +937,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_set_local_direct + * Function: H5Z_set_local_direct * - * Purpose: Makes callbacks to modify local settings for filters on a - * new opaque object. The pipeline is assumed to have at - * least one filter. + * Purpose: Makes callbacks to modify local settings for filters on a + * new opaque object. The pipeline is assumed to have at + * least one filter. * - * Return: Non-negative on success - * Negative on failure + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Tuesday, September 22, 2009 + * + * Notes: + * This callback will almost certainly not do anything + * useful, other than to make certain that the filter will + * accept opque data. * - * Notes: This callback will almost certainly not do anything - * useful, other than to make certain that the filter will - * accept opaque data. *------------------------------------------------------------------------- */ herr_t @@ -936,11 +962,11 @@ H5Z_set_local_direct(const H5O_pline_t *pline) FUNC_ENTER_NOAPI(FAIL) - HDassert (pline->nused > 0); + HDassert(pline->nused > 0); /* Make "set local" callbacks for filters in pipeline */ - if (H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_SET_LOCAL) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") + if(H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_SET_LOCAL) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") done: FUNC_LEAVE_NOAPI(ret_value) @@ -948,61 +974,66 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_modify + * Function: H5Z_modify * - * Purpose: Modify filter parameters for specified pipeline. + * Purpose: Modify filter parameters for specified pipeline. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, April 5, 2003 + * + * Modifications: * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, - size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) + size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) { - size_t idx; /* Index of filter in pipeline */ - herr_t ret_value = SUCCEED; /* Return value */ + size_t idx; /* Index of filter in pipeline */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert (pline); - HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX); - HDassert (0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); - HDassert (0 == cd_nelmts || cd_values); + HDassert(pline); + HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); + HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); + HDassert(0 == cd_nelmts || cd_values); /* Locate the filter in the pipeline */ - for (idx = 0; idx < pline->nused; idx++) - if (pline->filter[idx].id == filter) + for(idx = 0; idx < pline->nused; idx++) + if(pline->filter[idx].id == filter) break; /* Check if the filter was not already in the pipeline */ - if (idx > pline->nused) - HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") + if(idx > pline->nused) + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") /* Change parameters for filter */ pline->filter[idx].flags = flags; pline->filter[idx].cd_nelmts = cd_nelmts; /* Free any existing parameters */ - if (pline->filter[idx].cd_values != NULL && pline->filter[idx].cd_values != pline->filter[idx]._cd_values) - H5MM_xfree(pline->filter[idx].cd_values); + if(pline->filter[idx].cd_values != NULL && pline->filter[idx].cd_values != pline->filter[idx]._cd_values) + H5MM_xfree(pline->filter[idx].cd_values); /* Set parameters */ - if (cd_nelmts > 0) { - size_t i; /* Local index variable */ + if(cd_nelmts > 0) { + size_t i; /* Local index variable */ /* Allocate memory or point at internal buffer */ - if (cd_nelmts > H5Z_COMMON_CD_VALUES) { + if(cd_nelmts > H5Z_COMMON_CD_VALUES) { pline->filter[idx].cd_values = (unsigned *)H5MM_malloc(cd_nelmts * sizeof(unsigned)); - if (NULL == pline->filter[idx].cd_values) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter parameters") + if(NULL == pline->filter[idx].cd_values) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter parameters") } /* end if */ else pline->filter[idx].cd_values = pline->filter[idx]._cd_values; /* Copy client data values */ - for (i = 0; i < cd_nelmts; i++) - pline->filter[idx].cd_values[i] = cd_values[i]; + for(i = 0; i < cd_nelmts; i++) + pline->filter[idx].cd_values[i] = cd_values[i]; } /* end if */ else pline->filter[idx].cd_values = NULL; @@ -1013,42 +1044,47 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_append + * Function: H5Z_append * - * Purpose: Append another filter to the specified pipeline. + * Purpose: Append another filter to the specified pipeline. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Tuesday, August 4, 1998 + * + * Modifications: * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, - size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) + size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) { - size_t idx; - herr_t ret_value = SUCCEED; /* Return value */ + size_t idx; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert (pline); - HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX); - HDassert (0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); - HDassert (0 == cd_nelmts || cd_values); + HDassert(pline); + HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); + HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); + HDassert(0 == cd_nelmts || cd_values); /* * Check filter limit. We do it here for early warnings although we may * decide to relax this restriction in the future. */ - if (pline->nused >= H5Z_MAX_NFILTERS) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline") + if(pline->nused >= H5Z_MAX_NFILTERS) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline") /* Check for freshly allocated filter pipeline */ - if (pline->version == 0) + if(pline->version == 0) pline->version = H5O_PLINE_VERSION_1; /* Allocate additional space in the pipeline if it's full */ - if (pline->nused >= pline->nalloc) { - H5O_pline_t x; + if(pline->nused >= pline->nalloc) { + H5O_pline_t x; size_t n; /* Each filter's data may be stored internally or may be @@ -1058,14 +1094,14 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, * filter struct is reallocated. Set these pointers to ~NULL * so that we can reset them after reallocating the filters array. */ - for (n = 0; n < pline->nalloc; ++n) - if (pline->filter[n].cd_values == pline->filter[n]._cd_values) + for(n = 0; n < pline->nalloc; ++n) + if(pline->filter[n].cd_values == pline->filter[n]._cd_values) pline->filter[n].cd_values = (unsigned *)((void *) ~((size_t)NULL)); - x.nalloc = MAX(H5Z_MAX_NFILTERS, 2 * pline->nalloc); - x.filter = (H5Z_filter_info_t *)H5MM_realloc(pline->filter, x.nalloc * sizeof(x.filter[0])); - if (NULL == x.filter) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter pipeline") + x.nalloc = MAX(H5Z_MAX_NFILTERS, 2 * pline->nalloc); + x.filter = (H5Z_filter_info_t *)H5MM_realloc(pline->filter, x.nalloc * sizeof(x.filter[0])); + if(NULL == x.filter) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter pipeline") /* Fix pointers in previous filters that need to point to their own * internal data. @@ -1075,8 +1111,8 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, x.filter[n].cd_values = x.filter[n]._cd_values; /* Point to newly allocated buffer */ - pline->nalloc = x.nalloc; - pline->filter = x.filter; + pline->nalloc = x.nalloc; + pline->filter = x.filter; } /* end if */ /* Add the new filter to the pipeline */ @@ -1085,21 +1121,21 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, pline->filter[idx].flags = flags; pline->filter[idx].name = NULL; /*we'll pick it up later*/ pline->filter[idx].cd_nelmts = cd_nelmts; - if (cd_nelmts > 0) { - size_t i; /* Local index variable */ + if(cd_nelmts > 0) { + size_t i; /* Local index variable */ /* Allocate memory or point at internal buffer */ - if (cd_nelmts > H5Z_COMMON_CD_VALUES) { + if(cd_nelmts > H5Z_COMMON_CD_VALUES) { pline->filter[idx].cd_values = (unsigned *)H5MM_malloc(cd_nelmts * sizeof(unsigned)); - if (NULL == pline->filter[idx].cd_values) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter") + if(NULL == pline->filter[idx].cd_values) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter") } /* end if */ else pline->filter[idx].cd_values = pline->filter[idx]._cd_values; /* Copy client data values */ - for (i = 0; i < cd_nelmts; i++) - pline->filter[idx].cd_values[i] = cd_values[i]; + for(i = 0; i < cd_nelmts; i++) + pline->filter[idx].cd_values[i] = cd_values[i]; } /* end if */ else pline->filter[idx].cd_values = NULL; @@ -1112,26 +1148,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_find_idx + * Function: H5Z_find_idx + * + * Purpose: Given a filter ID return the offset in the global array + * that holds all the registered filters. * - * Purpose: Given a filter ID return the offset in the global array - * that holds all the registered filters. + * Return: Success: Non-negative index of entry in global filter table. + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, April 5, 2003 + * + * Modifications: * - * Return: Success: Non-negative index of entry in global filter table. - * Failure: Negative *------------------------------------------------------------------------- */ static int H5Z_find_idx(H5Z_filter_t id) { size_t i; /* Local index variable */ - int ret_value = FAIL; /* Return value */ + int ret_value=FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR - for (i = 0; i < H5Z_table_used_g; i++) - if (H5Z_table_g[i].id == id) - HGOTO_DONE ((int)i) + for (i=0; i<H5Z_table_used_g; i++) + if (H5Z_table_g[i].id == id) + HGOTO_DONE((int)i) done: FUNC_LEAVE_NOAPI(ret_value) @@ -1139,29 +1181,37 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_find + * Function: H5Z_find + * + * Purpose: Given a filter ID return a pointer to a global struct that + * defines the filter. * - * Purpose: Given a filter ID return a pointer to a global struct that - * defines the filter. + * Return: Success: Ptr to entry in global filter table. + * Failure: NULL + * + * Programmer: Robb Matzke + * Wednesday, August 5, 1998 + * + * Modifications: + * Use H5Z_find_idx now + * Quincey Koziol, April 5, 2003 * - * Return: Success: Ptr to entry in global filter table. - * Failure: NULL *------------------------------------------------------------------------- */ H5Z_class2_t * H5Z_find(H5Z_filter_t id) { - int idx; /* Filter index in global table */ - H5Z_class2_t *ret_value = NULL; /* Return value */ + int idx; /* Filter index in global table */ + H5Z_class2_t *ret_value=NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Get the index in the global table */ - if ((idx = H5Z_find_idx(id)) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, NULL, "required filter %d is not registered", id) + if((idx=H5Z_find_idx(id))<0) + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "required filter is not registered") /* Set return value */ - ret_value = H5Z_table_g+idx; + ret_value=H5Z_table_g+idx; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1169,173 +1219,171 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_pipeline - * - * Purpose: Process data through the filter pipeline. The FLAGS argument - * is the filter invocation flags (definition flags come from - * the PLINE->filter[].flags). The filters are processed in - * definition order unless the H5Z_FLAG_REVERSE is set. The - * FILTER_MASK is a bit-mask to indicate which filters to skip - * and on exit will indicate which filters failed. Each - * filter has an index number in the pipeline and that index - * number is the filter's bit in the FILTER_MASK. NBYTES is the - * number of bytes of data to filter and on exit should be the - * number of resulting bytes while BUF_SIZE holds the total - * allocated size of the buffer, which is pointed to BUF. - * - * If the buffer must grow during processing of the pipeline - * then the pipeline function should free the original buffer - * and return a fresh buffer, adjusting BUF_SIZE accordingly. + * Function: H5Z_pipeline + * + * Purpose: Process data through the filter pipeline. The FLAGS argument + * is the filter invocation flags (definition flags come from + * the PLINE->filter[].flags). The filters are processed in + * definition order unless the H5Z_FLAG_REVERSE is set. The + * FILTER_MASK is a bit-mask to indicate which filters to skip + * and on exit will indicate which filters failed. Each + * filter has an index number in the pipeline and that index + * number is the filter's bit in the FILTER_MASK. NBYTES is the + * number of bytes of data to filter and on exit should be the + * number of resulting bytes while BUF_SIZE holds the total + * allocated size of the buffer, which is pointed to BUF. + * + * If the buffer must grow during processing of the pipeline + * then the pipeline function should free the original buffer + * and return a fresh buffer, adjusting BUF_SIZE accordingly. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Tuesday, August 4, 1998 + * + * Modifications: * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, - unsigned *filter_mask/*in,out*/, H5Z_EDC_t edc_read, - H5Z_cb_t cb_struct, size_t *nbytes/*in,out*/, - size_t *buf_size/*in,out*/, void **buf/*in,out*/) + unsigned *filter_mask/*in,out*/, H5Z_EDC_t edc_read, + H5Z_cb_t cb_struct, size_t *nbytes/*in,out*/, + size_t *buf_size/*in,out*/, void **buf/*in,out*/) { - size_t i, idx, new_nbytes; - int fclass_idx; /* Index of filter class in global table */ - H5Z_class2_t *fclass=NULL; /* Filter class pointer */ + size_t i, idx, new_nbytes; + int fclass_idx; /* Index of filter class in global table */ + H5Z_class2_t *fclass=NULL; /* Filter class pointer */ #ifdef H5Z_DEBUG - H5Z_stats_t *fstats=NULL; /* Filter stats pointer */ - H5_timer_t timer; + H5Z_stats_t *fstats=NULL; /* Filter stats pointer */ + H5_timer_t timer; #endif - unsigned failed = 0; - unsigned tmp_flags; - herr_t ret_value = SUCCEED; /* Return value */ + unsigned failed = 0; + unsigned tmp_flags; + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert (0 == (flags & ~((unsigned)H5Z_FLAG_INVMASK))); - HDassert (filter_mask); - HDassert (nbytes && *nbytes>0); - HDassert (buf_size && *buf_size>0); - HDassert (buf && *buf); - HDassert (!pline || pline->nused<H5Z_MAX_NFILTERS); + HDassert(0==(flags & ~((unsigned)H5Z_FLAG_INVMASK))); + HDassert(filter_mask); + HDassert(nbytes && *nbytes>0); + HDassert(buf_size && *buf_size>0); + HDassert(buf && *buf); + HDassert(!pline || pline->nused<H5Z_MAX_NFILTERS); if (pline && (flags & H5Z_FLAG_REVERSE)) { /* Read */ - for (i = pline->nused; i > 0; --i) { - idx = i-1; + for (i=pline->nused; i>0; --i) { + idx = i-1; - if (*filter_mask & ((unsigned)1 << idx)) { - failed |= (unsigned)1 << idx; - continue; /* filter excluded */ - } + if (*filter_mask & ((unsigned)1<<idx)) { + failed |= (unsigned)1 << idx; + continue;/*filter excluded*/ + } - /* If the filter isn't registered and the application doesn't - * indicate no plugin through HDF5_PRELOAD_PLUG (using the symbol "::"), + /* If the filter isn't registered and the application doesn't + * indicate no plugin through HDF5_PRELOAD_PLUG (using the symbol "::"), * try to load it dynamically and register it. Otherwise, return failure */ - if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { + if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { hbool_t issue_error = FALSE; - H5Z_class2_t *filter_info; - - /* Try loading the filter */ - if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) { - /* Register the filter we loaded */ - herr_t status = H5Z_register(filter_info); - if (filter_info->name) - filter_info->name = (char *)H5MM_xfree(filter_info->name); - filter_info = (H5Z_class2_t *)H5MM_xfree(filter_info); - if (status < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") - - /* Search in the table of registered filters again to find the dynamic filter just loaded and registered */ - if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) + + const H5Z_class2_t *filter_info; + + /* Try loading the filter */ + if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) { + /* Register the filter we loaded */ + if(H5Z_register(filter_info) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") + + /* Search in the table of registered filters again to find the dynamic filter just loaded and registered */ + if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) + issue_error = TRUE; + } /* end if */ + else issue_error = TRUE; - } /* end if */ - else - issue_error = TRUE; /* Check for error */ if(issue_error) { - /* Print out the filter name to give more info. But the name is optional for + /* Print out the filter name to give more info. But the name is optional for * the filter */ - if (pline->filter[idx].name) + if(pline->filter[idx].name) HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter '%s' is not registered", pline->filter[idx].name) else HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter (name unavailable) is not registered") } /* end if */ } /* end if */ - fclass = &H5Z_table_g[fclass_idx]; + fclass=&H5Z_table_g[fclass_idx]; #ifdef H5Z_DEBUG - fstats = &H5Z_stat_table_g[fclass_idx]; - H5_timer_begin (&timer); + fstats=&H5Z_stat_table_g[fclass_idx]; + H5_timer_begin(&timer); #endif - tmp_flags = flags | (pline->filter[idx].flags); - tmp_flags |= (edc_read== H5Z_DISABLE_EDC) ? H5Z_FLAG_SKIP_EDC : 0; - new_nbytes = (fclass->filter)(tmp_flags, pline->filter[idx].cd_nelmts, + tmp_flags=flags|(pline->filter[idx].flags); + tmp_flags|=(edc_read== H5Z_DISABLE_EDC) ? H5Z_FLAG_SKIP_EDC : 0; + new_nbytes = (fclass->filter)(tmp_flags, pline->filter[idx].cd_nelmts, pline->filter[idx].cd_values, *nbytes, buf_size, buf); #ifdef H5Z_DEBUG - H5_timer_end (&(fstats->stats[1].timer), &timer); - fstats->stats[1].total += MAX(*nbytes, new_nbytes); - if (0 == new_nbytes) fstats->stats[1].errors += *nbytes; + H5_timer_end(&(fstats->stats[1].timer), &timer); + fstats->stats[1].total += MAX(*nbytes, new_nbytes); + if (0==new_nbytes) fstats->stats[1].errors += *nbytes; #endif - if (0 == new_nbytes) { - if ((cb_struct.func && - (H5Z_CB_FAIL == cb_struct.func (pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data))) || - !cb_struct.func) - HGOTO_ERROR (H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read") + if(0==new_nbytes) { + if((cb_struct.func && (H5Z_CB_FAIL==cb_struct.func(pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data))) + || !cb_struct.func) + HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read") *nbytes = *buf_size; failed |= (unsigned)1 << idx; - H5E_clear_stack (NULL); - } - else { + H5E_clear_stack(NULL); + } else { *nbytes = new_nbytes; } - } - } - else if (pline) { /* Write */ - for (idx = 0; idx < pline->nused; idx++) { - if (*filter_mask & ((unsigned)1 << idx)) { - failed |= (unsigned)1 << idx; - continue; /*filter excluded*/ - } - if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { + } + } else if (pline) { /* Write */ + for (idx=0; idx<pline->nused; idx++) { + if (*filter_mask & ((unsigned)1<<idx)) { + failed |= (unsigned)1 << idx; + continue; /*filter excluded*/ + } + if ((fclass_idx=H5Z_find_idx(pline->filter[idx].id))<0) { /* Check if filter is optional -- If it isn't, then error */ - if ((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered") - - failed |= (unsigned)1 << idx; - H5E_clear_stack (NULL); - continue; /*filter excluded*/ - } - fclass = &H5Z_table_g[fclass_idx]; + if ((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0) + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered") + + failed |= (unsigned)1 << idx; + H5E_clear_stack(NULL); + continue; /*filter excluded*/ + } + fclass=&H5Z_table_g[fclass_idx]; #ifdef H5Z_DEBUG - fstats = &H5Z_stat_table_g[fclass_idx]; - H5_timer_begin (&timer); + fstats=&H5Z_stat_table_g[fclass_idx]; + H5_timer_begin(&timer); #endif - new_nbytes = (fclass->filter)(flags | (pline->filter[idx].flags), pline->filter[idx].cd_nelmts, - pline->filter[idx].cd_values, *nbytes, buf_size, buf); + new_nbytes = (fclass->filter)(flags|(pline->filter[idx].flags), pline->filter[idx].cd_nelmts, + pline->filter[idx].cd_values, *nbytes, buf_size, buf); #ifdef H5Z_DEBUG - H5_timer_end (&(fstats->stats[0].timer), &timer); - fstats->stats[0].total += MAX(*nbytes, new_nbytes); - if (0 == new_nbytes) fstats->stats[0].errors += *nbytes; + H5_timer_end(&(fstats->stats[0].timer), &timer); + fstats->stats[0].total += MAX(*nbytes, new_nbytes); + if (0==new_nbytes) fstats->stats[0].errors += *nbytes; #endif - if (0 == new_nbytes) { - if (0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) { - if ((cb_struct.func && - (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data))) || - !cb_struct.func) - HGOTO_ERROR (H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure") + if(0==new_nbytes) { + if (0==(pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) { + if((cb_struct.func && (H5Z_CB_FAIL==cb_struct.func(pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data))) + || !cb_struct.func) + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure") *nbytes = *buf_size; } failed |= (unsigned)1 << idx; - H5E_clear_stack (NULL); - } - else + H5E_clear_stack(NULL); + } else { *nbytes = new_nbytes; - } + } + } } *filter_mask = failed; @@ -1346,36 +1394,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_filter_info + * Function: H5Z_filter_info * - * Purpose: Get pointer to filter info for pipeline + * Purpose: Get pointer to filter info for pipeline + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, April 5, 2003 + * + * Modifications: * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ H5Z_filter_info_t * H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter) { - size_t idx; /* Index of filter in pipeline */ - H5Z_filter_info_t *ret_value = NULL; /* Return value */ + size_t idx; /* Index of filter in pipeline */ + H5Z_filter_info_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(NULL) - HDassert (pline); - HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX); + HDassert(pline); + HDassert(filter>=0 && filter<=H5Z_FILTER_MAX); /* Locate the filter in the pipeline */ - for (idx = 0; idx < pline->nused; idx++) - if (pline->filter[idx].id == filter) + for(idx=0; idx<pline->nused; idx++) + if(pline->filter[idx].id==filter) break; /* Check if the filter was not already in the pipeline */ - if (idx >= pline->nused) - HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline") + if(idx>=pline->nused) + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline") /* Set return value */ - ret_value = &pline->filter[idx]; + ret_value=&pline->filter[idx]; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1383,35 +1436,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_filter_in_pline + * Function: H5Z_filter_in_pline + * + * Purpose: Check wheter a filter is in the filter pipeline using the + * filter ID. This function is very similar to H5Z_filter_info + * + * Return: TRUE - found filter + * FALSE - not found + * FAIL - error + * + * Programmer: Raymond Lu + * 26 April 2013 * - * Purpose: Check wheter a filter is in the filter pipeline using the - * filter ID. This function is very similar to H5Z_filter_info + * Modifications: * - * Return: TRUE - found filter - * FALSE - not found - * FAIL - error *------------------------------------------------------------------------- */ htri_t H5Z_filter_in_pline(const H5O_pline_t *pline, H5Z_filter_t filter) { - size_t idx; /* Index of filter in pipeline */ - htri_t ret_value = TRUE; /* Return value */ + size_t idx; /* Index of filter in pipeline */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert (pline); - HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX); + HDassert(pline); + HDassert(filter>=0 && filter<=H5Z_FILTER_MAX); /* Locate the filter in the pipeline */ - for (idx = 0; idx < pline->nused; idx++) - if (pline->filter[idx].id == filter) + for(idx=0; idx<pline->nused; idx++) + if(pline->filter[idx].id==filter) break; /* Check if the filter was not already in the pipeline */ - if (idx >= pline->nused) - ret_value = FALSE; + if(idx>=pline->nused) + ret_value = FALSE; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1420,36 +1479,42 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_all_filters_avail + * Function: H5Z_all_filters_avail * - * Purpose: Verify that all the filters in a pipeline are currently - * available (i.e. registered) + * Purpose: Verify that all the filters in a pipeline are currently + * available (i.e. registered) + * + * Return: Non-negative (TRUE/FALSE) on success/Negative on failure + * + * Programmer: Quincey Koziol + * Tuesday, April 8, 2003 + * + * Modifications: * - * Return: Non-negative (TRUE/FALSE) on success - * Negative on failure *------------------------------------------------------------------------- */ htri_t H5Z_all_filters_avail(const H5O_pline_t *pline) { - size_t i, j; /* Local index variable */ - htri_t ret_value = TRUE; /* Return value */ + size_t i,j; /* Local index variable */ + htri_t ret_value=TRUE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert (pline); + HDassert(pline); /* Iterate through all the filters in pipeline */ - for (i = 0; i < pline->nused; i++) { + for(i=0; i<pline->nused; i++) { + /* Look for each filter in the list of registered filters */ - for (j = 0; j < H5Z_table_used_g; j++) - if (H5Z_table_g[j].id == pline->filter[i].id) + for(j=0; j<H5Z_table_used_g; j++) + if(H5Z_table_g[j].id==pline->filter[i].id) break; /* Check if we didn't find the filter */ - if (j == H5Z_table_used_g) - HGOTO_DONE (FALSE) + if(j==H5Z_table_used_g) + HGOTO_DONE(FALSE) } /* end for */ done: @@ -1461,11 +1526,16 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_delete * - * Purpose: Delete filter FILTER from pipeline PLINE; - * deletes all filters if FILTER is H5Z_FILTER_NONE + * Purpose: Delete filter FILTER from pipeline PLINE; + * deletes all filters if FILTER is H5Z_FILTER_NONE + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Pedro Vicente + * Monday, January 26, 2004 + * + * Modifications: * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1476,52 +1546,52 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert (pline); - HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX); + HDassert(pline); + HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); /* if the pipeline has no filters, just return */ - if (pline->nused == 0) - HGOTO_DONE (SUCCEED) + if(pline->nused==0) + HGOTO_DONE(SUCCEED) /* Delete all filters */ - if (H5Z_FILTER_ALL == filter) { - if (H5O_msg_reset(H5O_PLINE_ID, pline) < 0) + 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 */ - hbool_t found = FALSE; /* Indicate filter was found in pipeline */ + size_t idx; /* Index of filter in pipeline */ + hbool_t found = FALSE; /* Indicate filter was found in pipeline */ /* Locate the filter in the pipeline */ - for (idx = 0; idx < pline->nused; idx++) - if (pline->filter[idx].id == filter) { + for(idx = 0; idx < pline->nused; idx++) + if(pline->filter[idx].id == filter) { found = TRUE; break; } /* end if */ /* filter was not found in the pipeline */ - if (!found) - HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") + if(!found) + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") /* Free information for deleted filter */ - if (pline->filter[idx].name && pline->filter[idx].name != pline->filter[idx]._name) - HDassert ((HDstrlen(pline->filter[idx].name) + 1) > H5Z_COMMON_NAME_LEN); - if (pline->filter[idx].name != pline->filter[idx]._name) + if(pline->filter[idx].name && pline->filter[idx].name != pline->filter[idx]._name) + HDassert((HDstrlen(pline->filter[idx].name) + 1) > H5Z_COMMON_NAME_LEN); + if(pline->filter[idx].name != pline->filter[idx]._name) pline->filter[idx].name = (char *)H5MM_xfree(pline->filter[idx].name); - if (pline->filter[idx].cd_values && pline->filter[idx].cd_values != pline->filter[idx]._cd_values) - HDassert (pline->filter[idx].cd_nelmts > H5Z_COMMON_CD_VALUES); - if (pline->filter[idx].cd_values != pline->filter[idx]._cd_values) + if(pline->filter[idx].cd_values && pline->filter[idx].cd_values != pline->filter[idx]._cd_values) + HDassert(pline->filter[idx].cd_nelmts > H5Z_COMMON_CD_VALUES); + if(pline->filter[idx].cd_values != pline->filter[idx]._cd_values) pline->filter[idx].cd_values = (unsigned *)H5MM_xfree(pline->filter[idx].cd_values); /* Remove filter from pipeline array */ - if ((idx + 1) < pline->nused) { + if((idx + 1) < pline->nused) { /* Copy filters down & fix up any client data value arrays using internal storage */ - for (; (idx + 1) < pline->nused; idx++) { + for(; (idx + 1) < pline->nused; idx++) { pline->filter[idx] = pline->filter[idx + 1]; - if (pline->filter[idx].name && (HDstrlen(pline->filter[idx].name) + 1) <= H5Z_COMMON_NAME_LEN) + if(pline->filter[idx].name && (HDstrlen(pline->filter[idx].name) + 1) <= H5Z_COMMON_NAME_LEN) pline->filter[idx].name = pline->filter[idx]._name; - if (pline->filter[idx].cd_nelmts <= H5Z_COMMON_CD_VALUES) + if(pline->filter[idx].cd_nelmts <= H5Z_COMMON_CD_VALUES) pline->filter[idx].cd_values = pline->filter[idx]._cd_values; } /* end for */ } /* end if */ @@ -1530,7 +1600,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: @@ -1541,11 +1611,14 @@ done: /*------------------------------------------------------------------------- * Function: H5Zget_filter_info * - * Purpose: Gets information about a pipeline data filter and stores it - * in filter_config_flags. + * Purpose: Gets information about a pipeline data filter and stores it + * in filter_config_flags. + * + * Return: zero on success / negative on failure + * + * Programmer: James Laird and Nat Furrer + * Monday, June 7, 2004 * - * Return: zero on success - * negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1557,8 +1630,8 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags) H5TRACE2("e", "Zf*Iu", filter, 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") + if(H5Z_get_filter_info(filter, filter_config_flags) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") done: FUNC_LEAVE_API(ret_value) @@ -1568,32 +1641,35 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_get_filter_info * - * Purpose: Gets information about a pipeline data filter and stores it - * in filter_config_flags. + * Purpose: Gets information about a pipeline data filter and stores it + * in filter_config_flags. + * + * Return: zero on success / negative on failure + * + * Programmer: Quincey Koziol + * Saturday, May 11, 2013 * - * Return: zero on success - * negative on failure *------------------------------------------------------------------------- */ herr_t H5Z_get_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags) { H5Z_class2_t *fclass; - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) /* Look up the filter class info */ - if (NULL == (fclass = H5Z_find(filter))) - HGOTO_ERROR (H5E_PLINE, H5E_BADVALUE, FAIL, "Filter not defined") + if(NULL == (fclass = H5Z_find(filter))) + HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "Filter not defined") /* Set the filter config flags for the application */ - if (filter_config_flags != NULL) { + if(filter_config_flags != NULL) { *filter_config_flags = 0; - if (fclass->encoder_present) + if(fclass->encoder_present) *filter_config_flags |= H5Z_FILTER_CONFIG_ENCODE_ENABLED; - if (fclass->decoder_present) + if(fclass->decoder_present) *filter_config_flags |= H5Z_FILTER_CONFIG_DECODE_ENABLED; } /* end if */ |