Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Jan-Willem Blokland authored Dec 6, 2023
1 parent f4c06bd commit f693c90
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/rest_vol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down Expand Up @@ -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() */
} /* end RV_free_visited_link_hash_table_key() */
5 changes: 3 additions & 2 deletions src/rest_vol_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/rest_vol_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -1037,4 +1038,4 @@ RV_iterate_count_obj_cb(hid_t obj_id, void *udata)
RV_free(containing_filename);

return ret_value;
}
}

0 comments on commit f693c90

Please sign in to comment.