Skip to content

Another try at gmtlib_validate_id #5104

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

Merged
merged 1 commit into from
Apr 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/gmt_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -7704,12 +7704,13 @@ int gmtlib_validate_id (struct GMTAPI_CTRL *API, int family, int object_ID, int
if (direction != GMT_NOTSET && (int)S_obj->direction != direction) continue; /* Not the requested direction */
if (direction == GMT_IN && S_obj->status != GMT_IS_UNUSED && object_ID == GMT_NOTSET) continue; /* Already used this input object once */
/* Preliminary checks passed, no look at family */
if (!(family == GMT_NOTSET || (int)S_obj->family == family)) { /* Not the required data type; check for exceptions... */
if (family == GMT_IS_GRID && S_obj->actual_family == GMT_IS_MATRIX)
//if (!(family == GMT_NOTSET || (int)S_obj->family == family)) { /* Not the required data type; check for exceptions... */
if (family != GMT_NOTSET) { /* Was specific about the family. */
if (family == GMT_IS_GRID && S_obj->actual_family == GMT_IS_MATRIX && S_obj->family != GMT_IS_DATASET)
S_obj->family = GMT_IS_GRID; /* Matrix masquerading as grids is valid. Change the family here. */
else if (family == GMT_IS_DATASET && (S_obj->actual_family == GMT_IS_VECTOR || S_obj->actual_family == GMT_IS_MATRIX) && !(S_obj->family == GMT_IS_GRID || S_obj->family == GMT_IS_IMAGE))
S_obj->family = GMT_IS_DATASET; /* Vectors or Matrix masquerading as dataset are valid. Change their family here. */
else if (family != GMT_NOTSET && family != S_obj->family) /* We don't like your kind */
else if (family != S_obj->family) /* We don't like your kind */
continue;
}
if (object_ID == GMT_NOTSET && (int)S_obj->direction == direction) item = i; /* Pick the first object with the specified direction */
Expand Down