diff options
Diffstat (limited to 'src/H5Z.c')
-rw-r--r-- | src/H5Z.c | 75 |
1 files changed, 32 insertions, 43 deletions
@@ -133,7 +133,7 @@ done: *------------------------------------------------------------------------- */ int -H5Z_term_interface (void) +H5Z_term_interface(void) { #ifdef H5Z_DEBUG size_t i; @@ -141,7 +141,7 @@ H5Z_term_interface (void) char comment[16], bandwidth[32]; #endif - if (H5_interface_initialize_g) { + if(H5_interface_initialize_g) { #ifdef H5Z_DEBUG if (H5DEBUG(Z)) { for (i=0; i<H5Z_table_used_g; i++) { @@ -191,15 +191,16 @@ H5Z_term_interface (void) } #endif /* H5Z_DEBUG */ /* Free the table of filters */ - H5Z_table_g = H5MM_xfree(H5Z_table_g); + H5Z_table_g = (H5Z_class_t *)H5MM_xfree(H5Z_table_g); #ifdef H5Z_DEBUG - H5Z_stat_table_g = H5MM_xfree(H5Z_stat_table_g); + H5Z_stat_table_g = (H5Z_stats_t *)H5MM_xfree(H5Z_stat_table_g); #endif /* H5Z_DEBUG */ H5Z_table_used_g = H5Z_table_alloc_g = 0; H5_interface_initialize_g = 0; - } - return 0; -} + } /* end if */ + + return(0); +} /* end H5Z_term_interface() */ /*------------------------------------------------------------------------- @@ -284,20 +285,18 @@ H5Z_register (const H5Z_class_t *cls) break; /* Filter not already registered */ - if (i>=H5Z_table_used_g) { - if (H5Z_table_used_g>=H5Z_table_alloc_g) { + if(i >= H5Z_table_used_g) { + if(H5Z_table_used_g >= H5Z_table_alloc_g) { size_t n = MAX(H5Z_MAX_NFILTERS, 2*H5Z_table_alloc_g); - H5Z_class_t *table = H5MM_realloc(H5Z_table_g, - n*sizeof(H5Z_class_t)); + H5Z_class_t *table = (H5Z_class_t *)H5MM_realloc(H5Z_table_g, n * sizeof(H5Z_class_t)); #ifdef H5Z_DEBUG - H5Z_stats_t *stat_table = H5MM_realloc(H5Z_stat_table_g, - n*sizeof(H5Z_stats_t)); + H5Z_stats_t *stat_table = (H5Z_stats_t *)H5MM_realloc(H5Z_stat_table_g, n * sizeof(H5Z_stats_t)); #endif /* H5Z_DEBUG */ - if (!table) + if(!table) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter table") H5Z_table_g = table; #ifdef H5Z_DEBUG - if (!stat_table) + if(!stat_table) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter statistics table") H5Z_stat_table_g = stat_table; #endif /* H5Z_DEBUG */ @@ -478,10 +477,10 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* 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 */ - H5D_layout_t dcpl_layout; /* Dataset's layout information */ + H5O_layout_t dcpl_layout; /* Dataset's layout information */ /* Get dataset creation property list object */ - if(NULL == (dc_plist = H5I_object(dcpl_id))) + 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 */ @@ -489,7 +488,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") /* Check if the dataset is chunked */ - if(H5D_CHUNKED == dcpl_layout) { + if(H5D_CHUNKED == dcpl_layout.type) { H5O_pline_t dcpl_pline; /* Dataset's I/O pipeline information */ /* Get I/O pipeline information */ @@ -498,23 +497,15 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* Check if the chunks have filters */ if(dcpl_pline.nused > 0) { - unsigned chunk_ndims; /* # of chunk dimensions */ - uint32_t chunk_size[H5O_LAYOUT_NDIMS]; /* Size of chunk dimensions */ hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; /* Size of chunk dimensions */ H5S_t *space; /* Dataspace describing chunk */ hid_t space_id; /* ID for dataspace describing chunk */ size_t u; /* Local index variable */ - /* 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") - 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") - /* Create a data space for a chunk & set the extent */ - for(u = 0; u < chunk_ndims; u++) - chunk_dims[u] = chunk_size[u]; - if(NULL == (space = H5S_create_simple(chunk_ndims,chunk_dims,NULL))) + 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") /* Get ID for dataspace to pass to filter routines */ @@ -547,22 +538,20 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* Check if there is a "can apply" callback */ if(fclass->can_apply) { /* Make callback to filter's "can apply" function */ - herr_t status=(fclass->can_apply)(dcpl_id, type_id, space_id); + herr_t status = (fclass->can_apply)(dcpl_id, type_id, space_id); /* Check return value */ - if(status<=0) { + if(status <= 0) { /* We're leaving, so close dataspace */ - if(H5I_dec_ref(space_id, FALSE)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") + if(H5I_dec_ref(space_id, FALSE) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") /* Indicate filter can't apply to this combination of parameters */ - if(status==0) { + if(status == 0) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate") - } /* end if */ /* Indicate error during filter callback */ - else { + else HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback") - } /* end if */ } /* end if */ } /* end if */ break; @@ -727,7 +716,7 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, /* Allocate memory or point at internal buffer */ if(cd_nelmts > H5Z_COMMON_CD_VALUES) { - pline->filter[idx].cd_values = H5MM_malloc(cd_nelmts * sizeof(unsigned)); + 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") } /* end if */ @@ -799,10 +788,10 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, */ for(n = 0; n < pline->nalloc; ++n) if(pline->filter[n].cd_values == pline->filter[n]._cd_values) - pline->filter[n].cd_values = (void *) ~((size_t)NULL); + pline->filter[n].cd_values = (unsigned *)((void *) ~((size_t)NULL)); x.nalloc = MAX(H5Z_MAX_NFILTERS, 2 * pline->nalloc); - x.filter = H5MM_realloc(pline->filter, x.nalloc * sizeof(x.filter[0])); + 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") @@ -829,7 +818,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, /* Allocate memory or point at internal buffer */ if(cd_nelmts > H5Z_COMMON_CD_VALUES) { - pline->filter[idx].cd_values = H5MM_malloc(cd_nelmts * sizeof(unsigned)); + 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") } /* end if */ @@ -1207,11 +1196,11 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t 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) - pline->filter[idx].name = H5MM_xfree(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) - pline->filter[idx].cd_values = H5MM_xfree(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) { |