Skip to content

Commit

Permalink
rest_vol_dataset: (fix) is_contiguous() and offset
Browse files Browse the repository at this point in the history
- Improved the function RV_dataspace_selection_is_contiguous() and
  RV_convert_start_to_offset at suggested in pull request HDFGroup#58
  on Github. In short, now the switch statements handle the various
  dataspace types correctly.
  • Loading branch information
jwsblokland committed Oct 3, 2023
1 parent c2ab7ab commit 50f38a2
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/rest_vol_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 50f38a2

Please sign in to comment.