Skip to content

Commit

Permalink
rest_vol_file, rest_vol_dataset: (fix) Variable declaration
Browse files Browse the repository at this point in the history
- 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 and Jan-Willem Blokland committed Nov 23, 2023
1 parent b9f8432 commit 4803339
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
34 changes: 18 additions & 16 deletions src/rest_vol_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1464,21 +1464,18 @@ RV_dataset_get(void *obj, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **r
herr_t
RV_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, void **req)
{
RV_object_t *dset = (RV_object_t *)obj;
herr_t ret_value = SUCCEED;
size_t host_header_len = 0;
char *host_header = NULL;
char *request_body = NULL;
char *request_body_shape = NULL;
char request_url[URL_MAX_LENGTH];
int ndims = 0;
int url_len = 0;
hid_t new_dspace_id = H5I_INVALID_HID;
hsize_t *old_extent = NULL;
hsize_t *maxdims = NULL;
const hsize_t *new_extent = NULL;
H5D_layout_t layout = H5D_LAYOUT_ERROR;
upload_info uinfo;
RV_object_t *dset = (RV_object_t *)obj;
herr_t ret_value = SUCCEED;
size_t host_header_len = 0;
char *host_header = NULL;
char *request_body = NULL;
char *request_body_shape = NULL;
char request_url[URL_MAX_LENGTH];
int url_len = 0;
hid_t new_dspace_id = H5I_INVALID_HID;
hsize_t *old_extent = NULL;
hsize_t *maxdims = NULL;
upload_info uinfo;

#ifdef RV_CONNECTOR_DEBUG
printf("-> Received dataset-specific call with following parameters:\n");
Expand All @@ -1493,7 +1490,11 @@ 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;

/* Check for write access */
if (!(dset->domain->u.file.intent & H5F_ACC_RDWR))
FUNC_GOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "no write intent on file");
Expand Down Expand Up @@ -1633,6 +1634,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
10 changes: 5 additions & 5 deletions src/rest_vol_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,6 @@ RV_file_get(void *obj, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req)
herr_t
RV_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req)
{
RV_object_t *target_domain;
RV_object_t *file = (RV_object_t *)obj;
herr_t ret_value = SUCCEED;
size_t host_header_len;
Expand All @@ -686,12 +685,12 @@ 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. */
target_domain = file->domain;
filename = target_domain->u.file.filepath_name;
const char *flush_string = "/?flush=1&rescan=1";
RV_object_t *target_domain = file->domain;
filename = target_domain->u.file.filepath_name;
const char *flush_string = "/?flush=1&rescan=1";

name_length = strlen(filename);

Expand Down Expand Up @@ -735,6 +734,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

0 comments on commit 4803339

Please sign in to comment.