diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2017-11-21 18:38:15 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2017-11-21 18:38:15 (GMT) |
commit | 20bb11b52640befc4a0073520b23d9e49bf3e96c (patch) | |
tree | e1f8d0487c48264391c54f7c8f5aadf42f295290 /src/H5Z.c | |
parent | 4d2e7ea66651e8902c91ea92f0236f327924d138 (diff) | |
download | hdf5-20bb11b52640befc4a0073520b23d9e49bf3e96c.zip hdf5-20bb11b52640befc4a0073520b23d9e49bf3e96c.tar.gz hdf5-20bb11b52640befc4a0073520b23d9e49bf3e96c.tar.bz2 |
Fixed an uninitialized filter callback struct in H5Dchunk.c and
unified the naming and initialization of said struct throughout
the library. This was causing a crash on VS2015 in debug mode
when the debug heap complained. Fixes HDFFV-10330.
Diffstat (limited to 'src/H5Z.c')
-rw-r--r-- | src/H5Z.c | 62 |
1 files changed, 32 insertions, 30 deletions
@@ -275,7 +275,7 @@ done: * Function: H5Z_register * * Purpose: Same as the public version except this one allows filters - * to be set for predefined method numbers <H5Z_FILTER_RESERVED + * to be set for predefined method numbers < H5Z_FILTER_RESERVED * * Return: Non-negative on success * Negative on failure @@ -532,7 +532,7 @@ 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) @@ -576,7 +576,7 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_UNUS FUNC_ENTER_STATIC - HDassert (obj_ptr); + HDassert(obj_ptr); /* Call the flush routine for mounted file hierarchies. Do a global flush * if the file is opened for write */ @@ -724,7 +724,7 @@ H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, break; default: - HDassert ("invalid prelude type" && 0); + HDassert("invalid prelude type" && 0); } /* end switch */ } /* end else */ } /* end for */ @@ -893,7 +893,7 @@ 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) @@ -926,7 +926,7 @@ 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) @@ -1200,12 +1200,12 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, 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) { @@ -1235,7 +1235,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, /* 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; @@ -1247,7 +1247,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, 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]; @@ -1263,11 +1263,12 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, #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; + 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) + 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; @@ -1303,7 +1304,8 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, #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; + if (0 == new_nbytes) + fstats->stats[0].errors += *nbytes; #endif if (0 == new_nbytes) { if (0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) { @@ -1345,8 +1347,8 @@ H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter) 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++) @@ -1384,8 +1386,8 @@ H5Z_filter_in_pline(const H5O_pline_t *pline, H5Z_filter_t filter) 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++) @@ -1421,7 +1423,7 @@ H5Z_all_filters_avail(const H5O_pline_t *pline) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert (pline); + HDassert(pline); /* Iterate through all the filters in pipeline */ for (i = 0; i < pline->nused; i++) { @@ -1459,8 +1461,8 @@ 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) @@ -1470,7 +1472,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) 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 */ @@ -1481,7 +1483,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) if (pline->filter[idx].id == filter) { found = TRUE; break; - } /* end if */ + } /* filter was not found in the pipeline */ if (!found) @@ -1489,11 +1491,11 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) /* 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); + 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); + 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); @@ -1506,8 +1508,8 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) pline->filter[idx].name = pline->filter[idx]._name; if (pline->filter[idx].cd_nelmts <= H5Z_COMMON_CD_VALUES) pline->filter[idx].cd_values = pline->filter[idx]._cd_values; - } /* end for */ - } /* end if */ + } + } /* Decrement number of used filters */ pline->nused--; |