From 50f38a20dfa0ff209a3604f4a77e6f31018820cb Mon Sep 17 00:00:00 2001 From: Jan-Willem Blokland Date: Mon, 2 Oct 2023 17:19:47 +0200 Subject: [PATCH] rest_vol_dataset: (fix) is_contiguous() and offset - Improved the function RV_dataspace_selection_is_contiguous() and RV_convert_start_to_offset at suggested in pull request #58 on Github. In short, now the switch statements handle the various dataspace types correctly. --- src/rest_vol_dataset.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/rest_vol_dataset.c b/src/rest_vol_dataset.c index de977f17..3a079387 100644 --- a/src/rest_vol_dataset.c +++ b/src/rest_vol_dataset.c @@ -4302,11 +4302,17 @@ RV_dataspace_selection_is_contiguous(hid_t space_id) break; case H5S_SEL_ALL: + FUNC_GOTO_DONE(TRUE); + break; + + case H5S_SEL_NONE: + FUNC_GOTO_DONE(FALSE); + break; + case H5S_SEL_ERROR: case H5S_SEL_N: - case H5S_SEL_NONE: default: - FUNC_GOTO_DONE(TRUE); + FUNC_GOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "specified unsupported dataspace type"); } /* end switch */ done: @@ -4379,11 +4385,14 @@ RV_convert_start_to_offset(hid_t space_id) break; case H5S_SEL_ALL: + case H5S_SEL_NONE: + ret_value = 0; + break; + case H5S_SEL_ERROR: case H5S_SEL_N: - case H5S_SEL_NONE: default: - ret_value = 0; + FUNC_GOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, -1, "specified unsupported dataspace type"); } /* end switch */ done: @@ -4503,4 +4512,4 @@ RV_json_values_to_binary_callback(char *HTTP_response, void *callback_data_in, v RV_free(value_buffer); return ret_value; -} \ No newline at end of file +}