From f693c900af5fca1c2f77cf2eab5a0e1e1bb9baf2 Mon Sep 17 00:00:00 2001 From: Jan-Willem Blokland Date: Wed, 6 Dec 2023 20:18:50 +0100 Subject: [PATCH] Bugfixes * rest_vol_dataset: (fix) missing brackets and variable declaration. - Added the missing brackets when setting the variable nblocks. - Moved the declaration of ndims, new_extent and layout outside of the switch statement. If inside the switch statement the Intel OenAPI C compiler reports it as an error. A similar message is reported by the FOSS toolchain however the message is a warning message. * rest_vol_file: (fix) Variable declaration - Moved the declaration of the variable target_domain outside of the switch statement. If inside the switch statement Intel OneAPI C compiler will report it as an error. * rest_vol: (fix) Return variable and GCPL_buf - Change return value to FAIL in the case the filepath cannot be allocated. The NULL value is not allowed when using Intel OneAPI C compiler. - Ensure that freeing GCPL_buf is only done when it is allocated. * rest_vol_file, rest_vol_dataset: (fix) Variable declaration - As suggested make use of braces in the switch statement also solves the problem. Actually this is the better solution so make use of braces and moved the declarations back to their original position. --- src/rest_vol.c | 6 +++--- src/rest_vol_dataset.c | 5 +++-- src/rest_vol_file.c | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/rest_vol.c b/src/rest_vol.c index 39e84c36..630c3a95 100644 --- a/src/rest_vol.c +++ b/src/rest_vol.c @@ -2530,7 +2530,7 @@ RV_copy_object_loc_info_callback(char *HTTP_response, void *callback_data_in, vo /* Allocate root "path" on heap for consistency with other RV_object_t types */ if ((new_domain->handle_path = RV_malloc(2)) == NULL) - FUNC_GOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "can't allocate space for filepath"); + FUNC_GOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate space for filepath"); strncpy(new_domain->handle_path, "/", 2); @@ -2552,7 +2552,7 @@ RV_copy_object_loc_info_callback(char *HTTP_response, void *callback_data_in, vo if (parse_tree) yajl_tree_free(parse_tree); - if (ret_value < 0) { + if ((ret_value < 0) && GCPL_buf) { RV_free(GCPL_buf); GCPL_buf = NULL; loc_info_out->GCPL_base64 = NULL; @@ -3825,4 +3825,4 @@ RV_free_visited_link_hash_table_key(rv_hash_table_key_t value) { RV_free(value); value = NULL; -} /* end RV_free_visited_link_hash_table_key() */ \ No newline at end of file +} /* end RV_free_visited_link_hash_table_key() */ diff --git a/src/rest_vol_dataset.c b/src/rest_vol_dataset.c index 2af81ae3..4a596533 100644 --- a/src/rest_vol_dataset.c +++ b/src/rest_vol_dataset.c @@ -1485,7 +1485,7 @@ RV_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id switch (args->op_type) { /* H5Dset_extent */ - case H5VL_DATASET_SET_EXTENT: + case H5VL_DATASET_SET_EXTENT: { int ndims = 0; const hsize_t *new_extent = NULL; H5D_layout_t layout = H5D_LAYOUT_ERROR; @@ -1629,6 +1629,7 @@ RV_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id "unable to modify extent of local dataspace"); break; + } /* H5Dflush */ case H5VL_DATASET_FLUSH: @@ -4616,7 +4617,7 @@ RV_dataspace_selection_is_contiguous(hid_t space_id) FUNC_GOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate space for hyperslab selection 'block' values"); - if (nblocks = H5Sget_select_hyper_nblocks(space_id) < 0) + if ((nblocks = H5Sget_select_hyper_nblocks(space_id)) < 0) FUNC_GOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get number of hyperslab blocks"); if (H5Sget_regular_hyperslab(space_id, start, stride, count, block) < 0) diff --git a/src/rest_vol_file.c b/src/rest_vol_file.c index 8c89a8d1..a12c9b9d 100644 --- a/src/rest_vol_file.c +++ b/src/rest_vol_file.c @@ -686,7 +686,7 @@ RV_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void switch (args->op_type) { /* H5Fflush */ - case H5VL_FILE_FLUSH: + case H5VL_FILE_FLUSH: { /* H5Fflush() may be passed an object within the domain, so explicitly target * the containing domain. */ RV_object_t *target_domain = file->domain; @@ -735,6 +735,7 @@ RV_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void FUNC_GOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "invalid server response from flush"); break; + } /* H5Freopen */ case H5VL_FILE_REOPEN: { @@ -1037,4 +1038,4 @@ RV_iterate_count_obj_cb(hid_t obj_id, void *udata) RV_free(containing_filename); return ret_value; -} \ No newline at end of file +}