diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-04-20 00:19:46 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-04-20 00:19:46 (GMT) |
commit | 365ca1225d447e1680d9c0dbe00c375655c3948d (patch) | |
tree | 509845d3928879ed774f8c48d44acb669565f1c2 /src/H5Z.c | |
parent | beb0079ae11d4932a1ce91545e49801ac206c75a (diff) | |
download | hdf5-365ca1225d447e1680d9c0dbe00c375655c3948d.zip hdf5-365ca1225d447e1680d9c0dbe00c375655c3948d.tar.gz hdf5-365ca1225d447e1680d9c0dbe00c375655c3948d.tar.bz2 |
[svn-r8397] Purpose:
h5repack in 1.6
Description:
2 functions we re added to /src:
H5Premove filter and H5Iget_file_id
Solution:
Platforms tested:
linux
solaris
AIX
Misc. update:
Diffstat (limited to 'src/H5Z.c')
-rw-r--r-- | src/H5Z.c | 72 |
1 files changed, 72 insertions, 0 deletions
@@ -1134,3 +1134,75 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5Z_all_filters_avail() */ + + +/*------------------------------------------------------------------------- + * Function: H5Z_delete + * + * 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: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5Z_delete, FAIL) + + /* Check args */ + assert(pline); + assert(filter>=0 && filter<=H5Z_FILTER_MAX); + + /* if the pipeline has no filters, just return */ + if(pline->nfilters==0) + HGOTO_DONE(SUCCEED) + + /* Delete all filters */ + if (H5Z_FILTER_ALL==filter) { + if(H5O_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 */ + unsigned found=0; /* Indicate filter was found in pipeline */ + + /* Locate the filter in the pipeline */ + for(idx=0; idx<pline->nfilters; idx++) + if(pline->filter[idx].id==filter) { + found=1; + break; + } + + /* filter was not found in the pipeline */ + if (!found) + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") + + /* Free information for deleted filter */ + H5MM_xfree(pline->filter[idx].name); + H5MM_xfree(pline->filter[idx].cd_values); + + /* Remove filter from pipeline array */ + if((idx+1)<pline->nfilters) + HDmemcpy(&pline->filter[idx], &pline->filter[idx+1], + sizeof (H5Z_filter_info_t)*(pline->nfilters-(idx+1))); + + /* Decrement number of used filters */ + pline->nfilters--; + + /* Reset information for previous last filter in pipeline */ + HDmemset(&pline->filter[pline->nfilters], 0, sizeof (H5Z_filter_info_t)); + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} |