diff --git a/src/H5Eint.c b/src/H5Eint.c index 80e25ca26c5..82280ce1312 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -1402,24 +1402,26 @@ H5E__walk(const H5E_stack_t *estack, H5E_direction_t direction, const H5E_walk_o if (op->u.func2) { ret_value = SUCCEED; if (H5E_WALK_UPWARD == direction) { - for (i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) + for (i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) { /* Prepare & restore library for user callback */ H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR) { ret_value = (op->u.func2)((unsigned)i, &estack->entries[i].err, client_data); } - H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR) + H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR) + } } /* end if */ else { H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int); - for (i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) + for (i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) { /* Prepare & restore library for user callback */ H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR) { ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), &estack->entries[i].err, client_data); } - H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR) + H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR) + } } /* end else */ if (ret_value < 0) @@ -1944,31 +1946,34 @@ H5E_dump_api_stack(void) assert(estack); #ifdef H5_NO_DEPRECATED_SYMBOLS - if (estack->auto_op.func2) + if (estack->auto_op.func2) { /* Prepare & restore library for user callback */ H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR) { (void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data)); } - H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR) + H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR) + } #else /* H5_NO_DEPRECATED_SYMBOLS */ if (estack->auto_op.vers == 1) { - if (estack->auto_op.func1) + if (estack->auto_op.func1) { /* Prepare & restore library for user callback */ H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR) { (void)((estack->auto_op.func1)(estack->auto_data)); } - H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR) + H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR) + } } /* end if */ else { - if (estack->auto_op.func2) + if (estack->auto_op.func2) { /* Prepare & restore library for user callback */ H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR) { (void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data)); } - H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR) + H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR) + } } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5FD.c b/src/H5FD.c index b50afc2bd9d..0f54bbfe7c8 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -936,7 +936,6 @@ H5FD_open(bool try, H5FD_t **_file, const char *name, unsigned flags, hid_t fapl if (HADDR_UNDEF == maxaddr) maxaddr = driver->maxaddr; - /* clang-format off */ /* Try dispatching to file driver */ if (try) { H5E_PAUSE_ERRORS @@ -964,43 +963,41 @@ H5FD_open(bool try, H5FD_t **_file, const char *name, unsigned flags, hid_t fapl if (NULL == file) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "can't open file"); } -/* clang-format on */ -/* Set the file access flags */ -file->access_flags = flags; + /* Set the file access flags */ + file->access_flags = flags; -/* Fill in public fields. We must increment the reference count on the - * driver ID to prevent it from being freed while this file is open. - */ -file->driver_id = driver_prop.driver_id; -if (H5I_inc_ref(file->driver_id, false) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver"); -file->cls = driver; -file->maxaddr = maxaddr; -if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &file->threshold) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment threshold"); -if (H5P_get(plist, H5F_ACS_ALIGN_NAME, &file->alignment) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment"); - -/* Retrieve the VFL driver feature flags */ -if (H5FD__query(file, &file->feature_flags) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to query file driver"); - -/* Increment the global serial number & assign it to this H5FD_t object */ -if (++H5FD_file_serial_no_g == 0) { - /* (Just error out if we wrap around for now...) */ - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to get file serial number"); -} /* end if */ -file->fileno = H5FD_file_serial_no_g; - -/* Start with base address set to 0 */ -/* (This will be changed later, when the superblock is located) */ -file->base_addr = 0; - -/* Set 'out' parameter */ -*_file = file; - -done : + /* Fill in public fields. We must increment the reference count on the + * driver ID to prevent it from being freed while this file is open. + */ + file->driver_id = driver_prop.driver_id; + if (H5I_inc_ref(file->driver_id, false) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver"); + file->cls = driver; + file->maxaddr = maxaddr; + if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &file->threshold) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment threshold"); + if (H5P_get(plist, H5F_ACS_ALIGN_NAME, &file->alignment) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment"); + + /* Retrieve the VFL driver feature flags */ + if (H5FD__query(file, &file->feature_flags) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to query file driver"); + + /* Increment the global serial number & assign it to this H5FD_t object */ + if (++H5FD_file_serial_no_g == 0) + /* (Just error out if we wrap around for now...) */ + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to get file serial number"); + file->fileno = H5FD_file_serial_no_g; + + /* Start with base address set to 0 */ + /* (This will be changed later, when the superblock is located) */ + file->base_addr = 0; + + /* Set 'out' parameter */ + *_file = file; + +done: /* Can't cleanup 'file' information, since we don't know what type it is */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_open() */ diff --git a/src/H5FDint.c b/src/H5FDint.c index e3abf584125..a4ff1f1a965 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -2539,14 +2539,16 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/) assert(flags); /* Check for the driver to query and then query it */ - if (driver->query) + if (driver->query) { /* Prepare & restore library for user callback */ H5_BEFORE_USER_CB_NOERR(FAIL) { ret_value = (driver->query)(NULL, flags); } - H5_AFTER_USER_CB_NOERR(FAIL) - else *flags = 0; + H5_AFTER_USER_CB_NOERR(FAIL) + } + else + *flags = 0; FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_driver_query() */ diff --git a/src/H5Tconv_macros.h b/src/H5Tconv_macros.h index f4d89c5c346..ebb4c256849 100644 --- a/src/H5Tconv_macros.h +++ b/src/H5Tconv_macros.h @@ -291,6 +291,7 @@ typedef struct H5T_conv_hw_t { { \ if (*(S) > (ST)(D_MAX)) { \ H5T_conv_ret_t except_ret; \ + \ /* Prepare & restore library for user callback */ \ H5_BEFORE_USER_CB(FAIL) \ { \ @@ -328,6 +329,7 @@ typedef struct H5T_conv_hw_t { { \ if (*(S) < 0) { \ H5T_conv_ret_t except_ret; \ + \ /* Prepare & restore library for user callback */ \ H5_BEFORE_USER_CB(FAIL) \ { \ @@ -396,6 +398,7 @@ typedef struct H5T_conv_hw_t { #define H5T_CONV_uS_CORE_1(S, D, ST, DT, D_MIN, D_MAX) \ if (*(S) > (DT)(D_MAX)) { \ H5T_conv_ret_t except_ret; \ + \ /* Prepare & restore library for user callback */ \ H5_BEFORE_USER_CB(FAIL) \ { \ @@ -532,6 +535,7 @@ typedef struct H5T_conv_hw_t { /* Assumes memory format of unsigned & signed integers is same */ \ if (*(S) < 0) { \ H5T_conv_ret_t except_ret; \ + \ /* Prepare & restore library for user callback */ \ H5_BEFORE_USER_CB(FAIL) \ { \ @@ -570,6 +574,7 @@ typedef struct H5T_conv_hw_t { /* Assumes memory format of unsigned & signed integers is same */ \ if (*(S) > (ST)(D_MAX)) { \ H5T_conv_ret_t except_ret; \ + \ /* Prepare & restore library for user callback */ \ H5_BEFORE_USER_CB(FAIL) \ { \ @@ -737,6 +742,7 @@ typedef struct H5T_conv_hw_t { /* Check for more bits of precision in src than available in dst */ \ if ((high_bit_pos - low_bit_pos) >= dprec) { \ H5T_conv_ret_t except_ret; \ + \ /* Prepare & restore library for user callback */ \ H5_BEFORE_USER_CB(FAIL) \ { \ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 459cb79c7c0..d73c4711cf0 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -780,14 +780,16 @@ H5VLget_object(void *obj, hid_t connector_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Check for 'get_object' callback in connector */ - if (connector->cls->wrap_cls.get_object) + if (connector->cls->wrap_cls.get_object) { /* Prepare & restore library for user callback */ H5_BEFORE_USER_CB(NULL) { ret_value = (connector->cls->wrap_cls.get_object)(obj); } - H5_AFTER_USER_CB(NULL) - else ret_value = obj; + H5_AFTER_USER_CB(NULL) + } + else + ret_value = obj; done: FUNC_LEAVE_API_NOINIT(ret_value) diff --git a/src/H5VLint.c b/src/H5VLint.c index 6f40dfceff4..099419d880b 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -1805,14 +1805,16 @@ H5VL_object_data(const H5VL_object_t *vol_obj) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check for 'get_object' callback in connector */ - if (vol_obj->connector->cls->wrap_cls.get_object) + if (vol_obj->connector->cls->wrap_cls.get_object) { /* Prepare & restore library for user callback */ H5_BEFORE_USER_CB_NOERR(NULL) { ret_value = (vol_obj->connector->cls->wrap_cls.get_object)(vol_obj->data); } - H5_AFTER_USER_CB_NOERR(NULL) - else ret_value = vol_obj->data; + H5_AFTER_USER_CB_NOERR(NULL) + } + else + ret_value = vol_obj->data; FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_data() */ @@ -2243,16 +2245,17 @@ H5VL__free_vol_wrapper(H5VL_wrap_ctx_t *vol_wrap_ctx) assert(vol_wrap_ctx->connector->cls); /* If there is a VOL connector object wrapping context, release it */ - if (vol_wrap_ctx->obj_wrap_ctx) + if (vol_wrap_ctx->obj_wrap_ctx) { /* Prepare & restore library for user callback */ H5_BEFORE_USER_CB(FAIL) { /* Release the VOL connector's object wrapping context */ ret_value = (*vol_wrap_ctx->connector->cls->wrap_cls.free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx); } - H5_AFTER_USER_CB(FAIL) - if (ret_value < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release connector's object wrapping context"); + H5_AFTER_USER_CB(FAIL) + if (ret_value < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release connector's object wrapping context"); + } /* Decrement refcount on connector */ if (H5VL_conn_dec_rc(vol_wrap_ctx->connector) < 0) diff --git a/src/H5Z.c b/src/H5Z.c index fb801340c10..d8d72fa2817 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -1447,7 +1447,6 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i tmp_flags = flags | (pline->filter[idx].flags); tmp_flags |= (edc_read == H5Z_DISABLE_EDC) ? H5Z_FLAG_SKIP_EDC : 0; - /* clang-format off */ H5E_PAUSE_ERRORS { /* Prepare & restore library for user callback */ @@ -1459,66 +1458,63 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i H5_AFTER_USER_CB(FAIL) } H5E_RESUME_ERRORS - /* clang-format on */ #ifdef H5Z_DEBUG - H5_timer_stop(&timer); - H5_timer_get_times(timer, ×); - fstats->stats[1].times.elapsed += times.elapsed; - fstats->stats[1].times.system += times.system; - fstats->stats[1].times.user += times.user; - - fstats->stats[1].total += MAX(*nbytes, new_nbytes); - if (0 == new_nbytes) - fstats->stats[1].errors += *nbytes; + H5_timer_stop(&timer); + H5_timer_get_times(timer, ×); + fstats->stats[1].times.elapsed += times.elapsed; + fstats->stats[1].times.system += times.system; + fstats->stats[1].times.user += times.user; + + 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_return_t status; + if (0 == new_nbytes) { + if (cb_struct.func) { + H5Z_cb_return_t status; + + /* Prepare & restore library for user callback */ + H5_BEFORE_USER_CB(FAIL) + { + status = cb_struct.func(pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data); + } + H5_AFTER_USER_CB(FAIL) + if (H5Z_CB_FAIL == status) + HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read"); + } + else + HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read"); - /* Prepare & restore library for user callback */ - H5_BEFORE_USER_CB(FAIL) - { - status = cb_struct.func(pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data); + *nbytes = *buf_size; + failed |= (unsigned)1 << idx; } - H5_AFTER_USER_CB(FAIL) - if (H5Z_CB_FAIL == status) - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read"); + else + *nbytes = new_nbytes; } - else - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read"); - - *nbytes = *buf_size; - failed |= (unsigned)1 << idx; } - 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) { - /* 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; - continue; /* filter excluded */ - } /* end if */ + 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; + continue; /* filter excluded */ + } /* 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_start(&timer); + fstats = &H5Z_stat_table_g[fclass_idx]; + H5_timer_start(&timer); #endif - /* clang-format off */ H5E_PAUSE_ERRORS { /* Prepare & restore library for user callback */ @@ -1530,49 +1526,49 @@ else if (pline) H5_AFTER_USER_CB(FAIL) } H5E_RESUME_ERRORS -/* clang-format on */ #ifdef H5Z_DEBUG -H5_timer_stop(&timer); -H5_timer_get_times(timer, ×); -fstats->stats[0].times.elapsed += times.elapsed; -fstats->stats[0].times.system += times.system; -fstats->stats[0].times.user += times.user; - -fstats->stats[0].total += MAX(*nbytes, new_nbytes); -if (0 == new_nbytes) - fstats->stats[0].errors += *nbytes; + H5_timer_stop(&timer); + H5_timer_get_times(timer, ×); + fstats->stats[0].times.elapsed += times.elapsed; + fstats->stats[0].times.system += times.system; + fstats->stats[0].times.user += times.user; + + 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_return_t status; + if (0 == new_nbytes) { + if (0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) { + if (cb_struct.func) { + H5Z_cb_return_t status; - /* Prepare & restore library for user callback */ - H5_BEFORE_USER_CB(FAIL) - { - status = cb_struct.func(pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data); - } - H5_AFTER_USER_CB(FAIL) - if (H5Z_CB_FAIL == status) - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure"); - } - else - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure"); + /* Prepare & restore library for user callback */ + H5_BEFORE_USER_CB(FAIL) + { + status = cb_struct.func(pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data); + } + H5_AFTER_USER_CB(FAIL) + if (H5Z_CB_FAIL == status) + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure"); + } + else + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure"); - *nbytes = *buf_size; + *nbytes = *buf_size; + } + failed |= (unsigned)1 << idx; + } + else + *nbytes = new_nbytes; + } /* end for */ } - failed |= (unsigned)1 << idx; -} -else - *nbytes = new_nbytes; -} /* end for */ -} -*filter_mask = failed; + *filter_mask = failed; -done : FUNC_LEAVE_NOAPI(ret_value) +done: + FUNC_LEAVE_NOAPI(ret_value) } /*-------------------------------------------------------------------------