diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-07-16 16:29:32 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-07-16 16:29:32 (GMT) |
commit | 4ddde287dc94d235c1b981488ccbca1c31324f2f (patch) | |
tree | 071a2cd36cae1b793490ac39a781fd5bf9c900e2 | |
parent | e9cc951e034865fb1f2e9dc0385ed34072675bba (diff) | |
download | hdf5-4ddde287dc94d235c1b981488ccbca1c31324f2f.zip hdf5-4ddde287dc94d235c1b981488ccbca1c31324f2f.tar.gz hdf5-4ddde287dc94d235c1b981488ccbca1c31324f2f.tar.bz2 |
[svn-r7236] Purpose:
Code cleanup
Description:
Clean up more warnings from lint.
Platforms tested:
FreeBSD 4.8 (sleipnir)
too minor for h5committest
-rw-r--r-- | src/H5Z.c | 163 | ||||
-rw-r--r-- | src/H5Zdeflate.c | 66 | ||||
-rw-r--r-- | src/H5Zfletcher32.c | 18 | ||||
-rw-r--r-- | src/H5Zprivate.h | 6 | ||||
-rw-r--r-- | src/H5Zshuffle.c | 26 | ||||
-rw-r--r-- | src/H5Zszip.c | 68 | ||||
-rwxr-xr-x | src/hdf5.lnt | 7 |
7 files changed, 181 insertions, 173 deletions
@@ -80,29 +80,29 @@ H5Z_init_interface (void) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOINIT(H5Z_init_interface); + FUNC_ENTER_NOINIT(H5Z_init_interface) #ifdef H5_HAVE_FILTER_DEFLATE if (H5Z_register (H5Z_DEFLATE)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register deflate filter"); + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register deflate filter") #endif /* H5_HAVE_FILTER_DEFLATE */ #ifdef H5_HAVE_FILTER_SHUFFLE if (H5Z_register (H5Z_SHUFFLE)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter"); + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter") #endif /* H5_HAVE_FILTER_SHUFFLE */ #ifdef H5_HAVE_FILTER_FLETCHER32 if (H5Z_register (H5Z_FLETCHER32)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter"); + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter") #endif /* H5_HAVE_FILTER_FLETCHER32 */ #ifdef H5_HAVE_FILTER_SZIP if (H5Z_register (H5Z_SZIP)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter"); + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter") #endif /* H5_HAVE_FILTER_SZIP */ #if (defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_FLETCHER32 | defined H5_HAVE_FILTER_SHUFFLE | defined H5_HAVE_FILTER_SZIP) done: #endif /* (defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_FLETCHER32 | defined H5_HAVE_FILTER_SHUFFLE | defined H5_HAVE_FILTER_SZIP) */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -211,24 +211,24 @@ H5Zregister(const H5Z_class_t *cls) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Zregister, FAIL); + FUNC_ENTER_API(H5Zregister, FAIL) /* Check args */ if (cls==NULL) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class"); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class") if (cls->id<0 || cls->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->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->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)<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); + FUNC_LEAVE_API(ret_value) } @@ -253,7 +253,7 @@ H5Z_register (const H5Z_class_t *cls) size_t i; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_register, FAIL); + FUNC_ENTER_NOAPI(H5Z_register, FAIL) assert (cls); assert (cls->id>=0 && cls->id<=H5Z_FILTER_MAX); @@ -274,11 +274,11 @@ H5Z_register (const H5Z_class_t *cls) n*sizeof(H5Z_stats_t)); #endif /* H5Z_DEBUG */ if (!table) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter table"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter table") 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; @@ -298,7 +298,7 @@ H5Z_register (const H5Z_class_t *cls) } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -321,21 +321,21 @@ H5Zunregister(H5Z_filter_t id) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Zunregister, FAIL); + FUNC_ENTER_API(H5Zunregister, FAIL) H5TRACE1("e","Zf",id); /* Check args */ if (id<0 || 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 (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") /* Do it */ if (H5Z_unregister (id)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to unregister filter"); + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to unregister filter") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Zunregister() */ @@ -360,7 +360,7 @@ H5Z_unregister (H5Z_filter_t id) size_t i; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_unregister,FAIL); + FUNC_ENTER_NOAPI(H5Z_unregister,FAIL) assert (id>=0 && id<=H5Z_FILTER_MAX); @@ -371,7 +371,7 @@ H5Z_unregister (H5Z_filter_t id) /* Fail if filter not found */ if (i>=H5Z_table_used_g) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter is not registered"); + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter is not registered") /* Remove filter from table */ /* Don't worry about shrinking table size (for now) */ @@ -382,7 +382,7 @@ H5Z_unregister (H5Z_filter_t id) H5Z_table_used_g--; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_unregister() */ @@ -406,12 +406,12 @@ H5Zfilter_avail(H5Z_filter_t id) size_t i; /* Local index variable */ htri_t ret_value=FALSE; /* Return value */ - FUNC_ENTER_API(H5Zfilter_avail, FAIL); + FUNC_ENTER_API(H5Zfilter_avail, FAIL) H5TRACE1("b","Zf",id); /* Check args */ if(id<0 || 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") /* Is the filter already registered? */ for(i=0; i<H5Z_table_used_g; i++) @@ -421,7 +421,7 @@ H5Zfilter_avail(H5Z_filter_t id) } /* end if */ done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Zfilter_avail() */ @@ -450,7 +450,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOINIT(H5Z_prelude_callback); + FUNC_ENTER_NOINIT(H5Z_prelude_callback) assert (H5I_GENPROP_LST==H5I_get_type(dcpl_id)); assert (H5I_DATATYPE==H5I_get_type(type_id)); @@ -462,11 +462,11 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* Get dataset creation property list object */ if (NULL == (dc_plist = 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") /* 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"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") /* Check if the dataset is chunked */ if(H5D_CHUNKED == dcpl_layout) { @@ -474,7 +474,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* Get I/O pipeline information */ if(H5P_get(dc_plist, H5D_CRT_DATA_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.nfilters > 0) { @@ -486,18 +486,18 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* Get chunk information */ if(H5P_get(dc_plist, H5D_CRT_CHUNK_DIM_NAME, &chunk_ndims) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve chunk dimensions"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve chunk dimensions") if(H5P_get(dc_plist, H5D_CRT_CHUNK_SIZE_NAME, chunk_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve chunk size"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve chunk size") /* Create a data space for a chunk & set the extent */ if(NULL == (space = H5S_create_simple(chunk_ndims,chunk_size,NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); + 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))<0) { - H5S_close(space); - HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); + (void)H5S_close(space); + HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") } /* end if */ /* Iterate over filters */ @@ -510,7 +510,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty if (dcpl_pline.filter[u].flags & H5Z_FLAG_OPTIONAL) H5E_clear(); 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 */ @@ -525,15 +525,15 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty if(status<=0) { /* We're leaving, so close dataspace */ if(H5Sclose(space_id)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace"); + HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") /* Indicate filter can't apply to this combination of parameters */ if(status==0) { - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate"); + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate") } /* end if */ /* Indicate error during filter callback */ else { - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback"); + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback") } /* end if */ } /* end if */ } /* end if */ @@ -546,10 +546,10 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty if((fclass->set_local)(dcpl_id, type_id, space_id)<0) { /* We're leaving, so close dataspace */ if(H5Sclose(space_id)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace"); + HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") /* 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 */ } /* end if */ break; @@ -562,13 +562,13 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* Close dataspace */ if(H5Sclose(space_id)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace"); + HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") } /* end if */ } /* end if */ } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_prelude_callback() */ @@ -598,17 +598,17 @@ H5Z_can_apply (hid_t dcpl_id, hid_t type_id) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_can_apply,FAIL); + FUNC_ENTER_NOAPI(H5Z_can_apply,FAIL) assert (H5I_GENPROP_LST==H5I_get_type(dcpl_id)); assert (H5I_DATATYPE==H5I_get_type(type_id)); /* Make "can apply" callbacks for filters in pipeline */ if(H5Z_prelude_callback(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY)<0) - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate"); + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_can_apply() */ @@ -638,17 +638,17 @@ H5Z_set_local (hid_t dcpl_id, hid_t type_id) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_set_local,FAIL); + FUNC_ENTER_NOAPI(H5Z_set_local,FAIL) assert (H5I_GENPROP_LST==H5I_get_type(dcpl_id)); assert (H5I_DATATYPE==H5I_get_type(type_id)); /* Make "set local" callbacks for filters in pipeline */ if(H5Z_prelude_callback(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL)<0) - HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set"); + HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_set_local() */ @@ -667,14 +667,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Z_modify(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, +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 idx; /* Index of filter in pipeline */ size_t i; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_modify, FAIL); + FUNC_ENTER_NOAPI(H5Z_modify, FAIL) assert(pline); assert(filter>=0 && filter<=H5Z_FILTER_MAX); @@ -688,7 +688,7 @@ H5Z_modify(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, /* Check if the filter was not already in the pipeline */ if(idx>pline->nfilters) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline"); + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") /* Change parameters for filter */ pline->filter[idx].flags = flags; @@ -702,7 +702,7 @@ H5Z_modify(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, if (cd_nelmts>0) { pline->filter[idx].cd_values = 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"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter parameters") for (i=0; i<cd_nelmts; i++) pline->filter[idx].cd_values[i] = cd_values[i]; } /* end if */ @@ -710,7 +710,7 @@ H5Z_modify(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, pline->filter[idx].cd_values = NULL; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_modify() */ @@ -735,7 +735,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t idx, i; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_append, FAIL); + FUNC_ENTER_NOAPI(H5Z_append, FAIL) assert(pline); assert(filter>=0 && filter<=H5Z_FILTER_MAX); @@ -747,7 +747,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, * decide to relax this restriction in the future. */ if (pline->nfilters>=H5Z_MAX_NFILTERS) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline"); + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline") /* Allocate additional space in the pipeline if it's full */ if (pline->nfilters>=pline->nalloc) { @@ -755,7 +755,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, x.nalloc = MAX(H5Z_MAX_NFILTERS, 2*pline->nalloc); x.filter = 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"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter pipeline") pline->nalloc = x.nalloc; pline->filter = x.filter; } @@ -769,7 +769,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, if (cd_nelmts>0) { pline->filter[idx].cd_values = 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"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter") for (i=0; i<cd_nelmts; i++) pline->filter[idx].cd_values[i] = cd_values[i]; } else { @@ -778,7 +778,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, pline->nfilters++; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -804,14 +804,14 @@ H5Z_find_idx(H5Z_filter_t id) size_t i; /* Local index variable */ int ret_value=FAIL; /* Return value */ - FUNC_ENTER_NOINIT(H5Z_find_idx); + FUNC_ENTER_NOINIT(H5Z_find_idx) for (i=0; i<H5Z_table_used_g; i++) if (H5Z_table_g[i].id == id) - HGOTO_DONE((int)i); + HGOTO_DONE((int)i) done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_find_idx() */ @@ -839,17 +839,17 @@ H5Z_find(H5Z_filter_t id) int idx; /* Filter index in global table */ H5Z_class_t *ret_value=NULL; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_find, NULL); + FUNC_ENTER_NOAPI(H5Z_find, NULL) /* Get the index in the global table */ if((idx=H5Z_find_idx(id))<0) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "required filter is not registered"); + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "required filter is not registered") /* Set return value */ ret_value=H5Z_table_g+idx; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5Z_find() */ @@ -898,7 +898,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned tmp_flags; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_pipeline, FAIL); + FUNC_ENTER_NOAPI(H5Z_pipeline, FAIL) assert(0==(flags & ~((unsigned)H5Z_FLAG_INVMASK))); assert(filter_mask); @@ -916,7 +916,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, continue;/*filter excluded*/ } if ((fclass_idx=H5Z_find_idx(pline->filter[idx].id))<0) { - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter is not registered"); + HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter is not registered") } fclass=&H5Z_table_g[fclass_idx]; #ifdef H5Z_DEBUG @@ -937,7 +937,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, 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"); + HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read") *nbytes = *buf_size; failed |= (unsigned)1 << idx; @@ -955,8 +955,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, 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"); + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered") failed |= (unsigned)1 << idx; H5E_clear(); @@ -978,7 +977,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, 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"); + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure") *nbytes = *buf_size; } @@ -994,7 +993,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, *filter_mask = failed; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1013,12 +1012,12 @@ done: *------------------------------------------------------------------------- */ H5Z_filter_info_t * -H5Z_filter_info(H5O_pline_t *pline, H5Z_filter_t filter) +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; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_filter_info, NULL); + FUNC_ENTER_NOAPI(H5Z_filter_info, NULL) assert(pline); assert(filter>=0 && filter<=H5Z_FILTER_MAX); @@ -1030,13 +1029,13 @@ H5Z_filter_info(H5O_pline_t *pline, H5Z_filter_t filter) /* Check if the filter was not already in the pipeline */ if(idx>pline->nfilters) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline"); + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline") /* Set return value */ ret_value=&pline->filter[idx]; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_filter_info() */ @@ -1056,12 +1055,12 @@ done: *------------------------------------------------------------------------- */ htri_t -H5Z_all_filters_avail(H5O_pline_t *pline) +H5Z_all_filters_avail(const H5O_pline_t *pline) { size_t i,j; /* Local index variable */ htri_t ret_value=TRUE; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_all_filters_avail, UFAIL); + FUNC_ENTER_NOAPI(H5Z_all_filters_avail, FAIL) /* Check args */ assert(pline); @@ -1076,10 +1075,10 @@ H5Z_all_filters_avail(H5O_pline_t *pline) /* Check if we didn't find the filter */ if(j==H5Z_table_used_g) - HGOTO_DONE(FALSE); + HGOTO_DONE(FALSE) } /* end for */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_all_filters_avail() */ diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c index 89f15cc..80004f7 100644 --- a/src/H5Zdeflate.c +++ b/src/H5Zdeflate.c @@ -76,11 +76,11 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, int status; /* Status from zlib operation */ size_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_filter_deflate, 0); + FUNC_ENTER_NOAPI(H5Z_filter_deflate, 0) /* Check arguments */ if (cd_nelmts!=1 || cd_values[0]>9) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid deflate aggression level"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid deflate aggression level") if (flags & H5Z_FLAG_REVERSE) { /* Input; uncompress */ @@ -89,7 +89,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, /* Allocate space for the compressed buffer */ if (NULL==(outbuf = H5MM_malloc(nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for deflate uncompression"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for deflate uncompression") /* Set the uncompression parameters */ HDmemset(&z_strm, 0, sizeof(z_strm)); @@ -100,10 +100,10 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, /* Initialize the uncompression routines */ if (Z_OK!=inflateInit(&z_strm)) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflateInit() failed"); + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflateInit() failed") /* Loop to uncompress the buffer */ - while (1) { + do { /* Uncompress some data */ status = inflate(&z_strm, Z_SYNC_FLUSH); @@ -113,24 +113,25 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, /* Check for error */ if (Z_OK!=status) { - inflateEnd(&z_strm); - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflate() failed"); + (void)inflateEnd(&z_strm); + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflate() failed") } - - /* If we're not done and just ran out of buffer space, get more */ - if (Z_OK==status && 0==z_strm.avail_out) { - /* Allocate a buffer twice as big */ - nalloc *= 2; - if (NULL==(outbuf = H5MM_realloc(outbuf, nalloc))) { - inflateEnd(&z_strm); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for deflate uncompression"); - } - - /* Update pointers to buffer for next set of uncompressed data */ - z_strm.next_out = (unsigned char*)outbuf + z_strm.total_out; - z_strm.avail_out = (uInt)(nalloc - z_strm.total_out); - } - } + else { + /* If we're not done and just ran out of buffer space, get more */ + if (0==z_strm.avail_out) { + /* Allocate a buffer twice as big */ + nalloc *= 2; + if (NULL==(outbuf = H5MM_realloc(outbuf, nalloc))) { + (void)inflateEnd(&z_strm); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for deflate uncompression") + } + + /* Update pointers to buffer for next set of uncompressed data */ + z_strm.next_out = (unsigned char*)outbuf + z_strm.total_out; + z_strm.avail_out = (uInt)(nalloc - z_strm.total_out); + } + } /* end else */ + } while(status==Z_OK); /* Free the input buffer */ H5MM_xfree(*buf); @@ -142,7 +143,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, ret_value = z_strm.total_out; /* Finish uncompressing the stream */ - inflateEnd(&z_strm); + (void)inflateEnd(&z_strm); } else { /* @@ -157,23 +158,22 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, int aggression; /* Compression aggression setting */ /* Set the compression aggression level */ - aggression = cd_values[0]; + H5_ASSIGN_OVERFLOW(aggression,cd_values[0],unsigned,int); /* Allocate output (compressed) buffer */ if (NULL==(z_dst=outbuf=H5MM_malloc(z_dst_nbytes))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate deflate destination buffer"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate deflate destination buffer") /* Perform compression from the source to the destination buffer */ status = compress2 (z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); /* Check for various zlib errors */ - if (Z_BUF_ERROR==status) { - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow"); - } else if (Z_MEM_ERROR==status) { - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "deflate memory error"); - } else if (Z_OK!=status) { - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "other deflate error"); - } + if (Z_BUF_ERROR==status) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow") + else if (Z_MEM_ERROR==status) + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "deflate memory error") + else if (Z_OK!=status) + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "other deflate error") /* Successfully uncompressed the buffer */ else { /* Free the input buffer */ @@ -190,7 +190,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, done: if(outbuf) H5MM_xfree(outbuf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5_HAVE_FILTER_DEFLATE */ diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c index c97d004..ce00955 100644 --- a/src/H5Zfletcher32.c +++ b/src/H5Zfletcher32.c @@ -77,7 +77,7 @@ H5Z_filter_fletcher32_compute(void *_src, size_t len) size_t count = len; /* Number of bytes left to checksum */ uint32_t s1 = 0, s2 = 0; /* Temporary partial checksums */ - FUNC_ENTER_NOINIT(H5Z_filter_fletcher32_compute); + FUNC_ENTER_NOINIT(H5Z_filter_fletcher32_compute) /* Compute checksum */ while(count > 1) { @@ -115,7 +115,7 @@ H5Z_filter_fletcher32_compute(void *_src, size_t len) } } - FUNC_LEAVE_NOAPI((s2 << 16) + s1); + FUNC_LEAVE_NOAPI((s2 << 16) + s1) } @@ -143,7 +143,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned U uint32_t fletcher; /* Checksum value */ size_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_filter_fletcher32, 0); + FUNC_ENTER_NOAPI(H5Z_filter_fletcher32, 0) assert(sizeof(uint32_t)>=4); @@ -161,11 +161,11 @@ H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned U UINT32DECODE(tmp_src, stored_fletcher); /* Compute checksum (can't fail) */ - fletcher = H5Z_filter_fletcher32_compute((unsigned short*)src,src_nbytes); + fletcher = H5Z_filter_fletcher32_compute(src,src_nbytes); /* Verify computed checksum matches stored checksum */ if(stored_fletcher != fletcher) - HGOTO_ERROR(H5E_STORAGE, H5E_READERROR, 0, "data error detected by Fletcher32 checksum"); + HGOTO_ERROR(H5E_STORAGE, H5E_READERROR, 0, "data error detected by Fletcher32 checksum") } /* Set return values */ @@ -175,10 +175,10 @@ H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned U unsigned char *dst; /* Temporary pointer to destination buffer */ /* Compute checksum (can't fail) */ - fletcher = H5Z_filter_fletcher32_compute((unsigned short*)src,nbytes); + fletcher = H5Z_filter_fletcher32_compute(src,nbytes); if (NULL==(dst=outbuf=H5MM_malloc(nbytes+FLETCHER_LEN))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate Fletcher32 checksum destination buffer"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate Fletcher32 checksum destination buffer") /* Copy raw data */ HDmemcpy((void*)dst, (void*)(*buf), nbytes); @@ -200,7 +200,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned U done: if(outbuf) H5MM_xfree(outbuf); - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /*lint !e715 Make lint ignore cd_nelmts and cd_values parameters */ #endif /* H5_HAVE_FILTER_FLETCHER32 */ diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h index 103aeff..08c0d93 100644 --- a/src/H5Zprivate.h +++ b/src/H5Zprivate.h @@ -45,7 +45,7 @@ H5_DLL herr_t H5Z_register(const H5Z_class_t *cls); H5_DLL herr_t H5Z_unregister(H5Z_filter_t id); H5_DLL herr_t H5Z_append(struct H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t cd_nelmts, const unsigned int cd_values[]); -H5_DLL herr_t H5Z_modify(struct H5O_pline_t *pline, H5Z_filter_t filter, +H5_DLL herr_t H5Z_modify(const struct H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t cd_nelmts, const unsigned int cd_values[]); H5_DLL herr_t H5Z_pipeline(const struct H5O_pline_t *pline, unsigned flags, unsigned *filter_mask/*in,out*/, @@ -55,8 +55,8 @@ H5_DLL herr_t H5Z_pipeline(const struct H5O_pline_t *pline, H5_DLL H5Z_class_t *H5Z_find(H5Z_filter_t id); H5_DLL herr_t H5Z_can_apply(hid_t dcpl_id, hid_t type_id); H5_DLL herr_t H5Z_set_local(hid_t dcpl_id, hid_t type_id); -H5_DLL H5Z_filter_info_t *H5Z_filter_info(struct H5O_pline_t *pline, +H5_DLL H5Z_filter_info_t *H5Z_filter_info(const struct H5O_pline_t *pline, H5Z_filter_t filter); -H5_DLL htri_t H5Z_all_filters_avail(struct H5O_pline_t *pline); +H5_DLL htri_t H5Z_all_filters_avail(const struct H5O_pline_t *pline); #endif diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index 81a1b69..79d8276 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -72,27 +72,27 @@ H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id) unsigned cd_values[H5Z_SHUFFLE_TOTAL_NPARMS]; /* Filter parameters */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_set_local_shuffle, FAIL); + FUNC_ENTER_NOAPI(H5Z_set_local_shuffle, FAIL) /* Get the filter's current parameters */ if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SHUFFLE,&flags,&cd_nelmts, cd_values,0,NULL)<0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get shuffle parameters"); + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get shuffle parameters") /* Check that no parameters are currently set */ if(cd_nelmts!=H5Z_SHUFFLE_USER_NPARMS) - HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "incorrect # of shuffle parameters"); + HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "incorrect # of shuffle parameters") /* Set "local" parameter for this dataset */ if((cd_values[H5Z_SHUFFLE_PARM_SIZE]=(unsigned)H5Tget_size(type_id))==0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") /* Modify the filter's parameters for this dataset */ if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_SHUFFLE, flags, H5Z_SHUFFLE_TOTAL_NPARMS, cd_values)<0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local shuffle parameters"); + HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local shuffle parameters") done: - FUNC_LEAVE_NOAPI(ret_value); -} /* end H5Z_set_local_shuffle() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5Z_set_local_shuffle() */ /*lint !e715 Make lint ignore space_id parameter */ /*------------------------------------------------------------------------- @@ -130,11 +130,11 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t leftover; /* Extra bytes at end of buffer */ size_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_filter_shuffle, 0); + FUNC_ENTER_NOAPI(H5Z_filter_shuffle, 0) /* Check arguments */ if (cd_nelmts!=H5Z_SHUFFLE_TOTAL_NPARMS || cd_values[H5Z_SHUFFLE_PARM_SIZE]==0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid shuffle parameters"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid shuffle parameters") /* Get the number of bytes per element from the parameter block */ bytesoftype=cd_values[H5Z_SHUFFLE_PARM_SIZE]; @@ -149,7 +149,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], /* Allocate the destination buffer */ if (NULL==(dest = H5MM_malloc(nbytes))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for shuffle buffer"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for shuffle buffer") if(flags & H5Z_FLAG_REVERSE) { /* Get the pointer to the source buffer */ @@ -167,7 +167,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], /* Add leftover to the end of data */ if(leftover>0) { /* Adjust back to end of shuffled bytes */ - _dest -= (bytesoftype - 1); + _dest -= (bytesoftype - 1); /*lint !e794 _dest is initialized */ HDmemcpy((void*)_dest, (void*)_src, leftover); } } /* end if */ @@ -187,7 +187,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], /* Add leftover to the end of data */ if(leftover>0) { /* Adjust back to end of shuffled bytes */ - _src -= (bytesoftype - 1); + _src -= (bytesoftype - 1); /*lint !e794 _src is initialized */ HDmemcpy((void*)_dest, (void*)_src, leftover); } } /* end else */ @@ -204,7 +204,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], ret_value = nbytes; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /*H5_HAVE_FILTER_SHUFFLE */ diff --git a/src/H5Zszip.c b/src/H5Zszip.c index bf3bcda..decf0d3 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -89,56 +89,57 @@ H5Z_can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) unsigned cd_values[H5Z_SZIP_TOTAL_NPARMS]; /* Filter parameters */ hsize_t dims[H5O_LAYOUT_NDIMS]; /* Dataspace (i.e. chunk) dimensions */ int ndims; /* Number of (chunk) dimensions */ - int dtype_size; /* Datatype's size (in bits) */ + unsigned dtype_size; /* Datatype's size (in bits) */ H5T_order_t dtype_order; /* Datatype's endianness order */ hsize_t scanline; /* Size of dataspace's fastest changing dimension */ herr_t ret_value=TRUE; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_can_apply_szip, FAIL); + FUNC_ENTER_NOAPI(H5Z_can_apply_szip, FAIL) /* Get the filter's current parameters */ if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SZIP,&flags,&cd_nelmts, cd_values,0,NULL)<0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get szip parameters"); + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get szip parameters") /* Check that no parameters are currently set */ if(cd_nelmts!=H5Z_SZIP_USER_NPARMS) - HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "incorrect # of szip parameters"); + HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "incorrect # of szip parameters") /* Get datatype's size, for checking the "bits-per-pixel" */ if((dtype_size=(sizeof(unsigned char)*H5Tget_size(type_id)))==0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") /* Range check datatype's size */ if(dtype_size>32 && dtype_size!=64) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype size"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype size") /* Get datatype's endianness order */ if((dtype_order=H5Tget_order(type_id))==H5T_ORDER_ERROR) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order"); + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order") /* Range check datatype's endianness order */ /* (Note: this may not handle non-atomic datatypes well) */ if(dtype_order != H5T_ORDER_LE && dtype_order != H5T_ORDER_BE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype endianness order"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype endianness order") /* Get dimensions for dataspace */ if ((ndims=H5Sget_simple_extent_dims(space_id, dims, NULL))<0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get dataspace dimensions"); + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get dataspace dimensions") /* Get "local" parameter for this dataset's "pixels-per-scanline" */ /* (Use the chunk's fastest changing dimension size) */ + assert(ndims>0); scanline=dims[ndims-1]; /* Range check the scanline's size */ if(scanline > SZ_MAX_PIXELS_PER_SCANLINE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid scanline size"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid scanline size") /* Range check the scanline's number of blocks */ if((scanline/cd_values[H5Z_SZIP_PARM_PPB]) > SZ_MAX_BLOCKS_PER_SCANLINE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid number of blocks per scanline"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid number of blocks per scanline") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_can_apply_szip() */ @@ -168,31 +169,32 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) H5T_order_t dtype_order; /* Datatype's endianness order */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_set_local_szip, FAIL); + FUNC_ENTER_NOAPI(H5Z_set_local_szip, FAIL) /* Get the filter's current parameters */ if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SZIP,&flags,&cd_nelmts, cd_values,0,NULL)<0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get szip parameters"); + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get szip parameters") /* Check that no parameters are currently set */ if(cd_nelmts!=H5Z_SZIP_USER_NPARMS) - HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "incorrect # of szip parameters"); + HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "incorrect # of szip parameters") /* Get dimensions for dataspace */ if ((ndims=H5Sget_simple_extent_dims(space_id, dims, NULL))<0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get dataspace dimensions"); + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get dataspace dimensions") /* Set "local" parameter for this dataset's "bits-per-pixel" */ if((cd_values[H5Z_SZIP_PARM_BPP]=(8*sizeof(unsigned char)*H5Tget_size(type_id)))==0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") /* Set "local" parameter for this dataset's "pixels-per-scanline" */ /* (Use the chunk's fastest changing dimension size) */ - cd_values[H5Z_SZIP_PARM_PPS]=dims[ndims-1]; + assert(ndims>0); + H5_ASSIGN_OVERFLOW(cd_values[H5Z_SZIP_PARM_PPS],dims[ndims-1],hsize_t,unsigned); /* Get datatype's endianness order */ if((dtype_order=H5Tget_order(type_id))==H5T_ORDER_ERROR) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order"); + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") /* Set the correct endianness flag for szip */ /* (Note: this may not handle non-atomic datatypes well) */ @@ -206,15 +208,15 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) break; default: - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order"); + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") } /* end switch */ /* Modify the filter's parameters for this dataset */ if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_SZIP, flags, H5Z_SZIP_TOTAL_NPARMS, cd_values)<0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local szip parameters"); + HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local szip parameters") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_set_local_szip() */ @@ -246,7 +248,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[], unsigned char *newbuf = NULL; /* Pointer to input buffer */ SZ_com_t sz_param; /* szip parameter block */ - FUNC_ENTER_NOAPI(H5Z_filter_szip, 0); + FUNC_ENTER_NOAPI(H5Z_filter_szip, 0) /* Sanity check to make certain that we haven't drifted out of date with * the mask options from the szlib.h header */ @@ -260,13 +262,13 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[], /* Check arguments */ if (cd_nelmts!=4) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid deflate aggression level"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid deflate aggression level") /* Copy the filter parameters into the szip parameter block */ - sz_param.options_mask = cd_values[H5Z_SZIP_PARM_MASK]; - sz_param.bits_per_pixel = cd_values[H5Z_SZIP_PARM_BPP]; - sz_param.pixels_per_block = cd_values[H5Z_SZIP_PARM_PPB]; - sz_param.pixels_per_scanline = cd_values[H5Z_SZIP_PARM_PPS]; + H5_ASSIGN_OVERFLOW(sz_param.options_mask,cd_values[H5Z_SZIP_PARM_MASK],unsigned,int); + H5_ASSIGN_OVERFLOW(sz_param.bits_per_pixel,cd_values[H5Z_SZIP_PARM_BPP],unsigned,int); + H5_ASSIGN_OVERFLOW(sz_param.pixels_per_block,cd_values[H5Z_SZIP_PARM_PPB],unsigned,int); + H5_ASSIGN_OVERFLOW(sz_param.pixels_per_scanline,cd_values[H5Z_SZIP_PARM_PPS],unsigned,int); /* Input; uncompress */ if (flags & H5Z_FLAG_REVERSE) { @@ -280,12 +282,12 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[], /* Allocate space for the uncompressed buffer */ if(NULL==(outbuf = H5MM_malloc(nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for szip decompression"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for szip decompression") /* Decompress the buffer */ size_out=nalloc; if(SZ_BufftoBuffDecompress(outbuf, &size_out, newbuf, nbytes-4, &sz_param) != SZ_OK) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "szip_filter: decompression failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "szip_filter: decompression failed") assert(size_out==nalloc); /* Free the input buffer */ @@ -303,7 +305,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[], /* Allocate space for the compressed buffer & header (assume data won't get bigger) */ if(NULL==(dst=outbuf = H5MM_malloc(nbytes+4))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate szip destination buffer"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate szip destination buffer") /* Encode the uncompressed length */ H5_CHECK_OVERFLOW(nbytes,size_t,uint32_t); @@ -312,7 +314,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[], /* Compress the buffer */ size_out = nbytes; if(SZ_OK!= SZ_BufftoBuffCompress(dst, &size_out, *buf, nbytes, &sz_param)) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow"); + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow") assert(size_out<=nbytes); /* Free the input buffer */ @@ -328,7 +330,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[], done: if(outbuf) H5MM_xfree(outbuf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } #endif /* H5_HAVE_FILTER_SZIP */ diff --git a/src/hdf5.lnt b/src/hdf5.lnt index 75d1d76..7ed29f0 100755 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -73,4 +73,11 @@ H5AC.c H5B.c H5D.c + H5Dio.c + + H5Z.c + H5Zdeflate.c + H5Zfletcher32.c + H5Zshuffle.c + H5Zszip.c */ |