-
-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow H5Soffset_simple to accept NULL offsets #4152
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -341,11 +341,6 @@ H5S__check_internal_consistency(const H5S_t *space) | |
DESCRIPTION | ||
Check the states of internal data structures of the hyperslab, and see | ||
whether they are consistent or not | ||
GLOBAL VARIABLES | ||
COMMENTS, BUGS, ASSUMPTIONS | ||
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING | ||
EXAMPLES | ||
REVISION LOG | ||
--------------------------------------------------------------------------*/ | ||
htri_t | ||
H5S__internal_consistency_test(hid_t space_id) | ||
|
@@ -367,3 +362,40 @@ H5S__internal_consistency_test(hid_t space_id) | |
done: | ||
FUNC_LEAVE_NOAPI(ret_value) | ||
} /* H5S__internal_consistency_test() */ | ||
|
||
/*-------------------------------------------------------------------------- | ||
NAME | ||
H5S__verify_offsets | ||
PURPOSE | ||
Verify that internal offsets match an array of offsets | ||
USAGE | ||
herr_t H5S__verify_offsets(hid_t space_id) | ||
hid_t space_id; IN: dataspace id | ||
const hssize_t *offset; IN: Offset to position the selection at | ||
RETURNS | ||
Non-negative true/false on success, negative on failure | ||
DESCRIPTION | ||
This function is necessary because there is no public API call | ||
that lets you get the offsets | ||
--------------------------------------------------------------------------*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strangely, there's no getter for a selection's offsets |
||
herr_t | ||
H5S__verify_offsets(hid_t space_id, const hssize_t *offset) | ||
{ | ||
H5S_t *space; /* Dataspace to modify */ | ||
herr_t ret_value = SUCCEED; /* Return value */ | ||
|
||
FUNC_ENTER_PACKAGE | ||
|
||
if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) | ||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADID, FAIL, "not a dataspace"); | ||
if (space->extent.rank == 0 || | ||
(H5S_GET_EXTENT_TYPE(space) == H5S_SCALAR || H5S_GET_EXTENT_TYPE(space) == H5S_NULL)) | ||
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace"); | ||
|
||
/* Check that the internal and passed-in offset data are the same */ | ||
if (0 != memcmp(space->select.offset, offset, sizeof(hssize_t) * space->extent.rank)) | ||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "internal offsets don't match parameters"); | ||
|
||
done: | ||
FUNC_LEAVE_NOAPI(ret_value) | ||
} /* end H5S__verify_offsets() */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should offset_changed be set to false if NULL was passed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't do that when you pass in all zeroes, so that would be something slightly new under the hood, but it could be done. We'd probably want to do that in the all zeroes case, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we want to set it to false only when the offset was already 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the offset is only non-zero when you've moved the selection around.