Skip to content
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

Check if @N etc is at start of OGR/GMT line #7713

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Changes from 1 commit
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
9 changes: 6 additions & 3 deletions src/gmt_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ GMT_LOCAL bool gmtio_ogr_header_parser (struct GMT_CTRL *GMT, char *record) {
* set to point to gmtio_ogr_data_parser instead, to speed up data record processing.
*/

unsigned int n_aspatial, k, geometry = 0;
unsigned int n_aspatial, k, geometry = 0, gap = 0;
bool quote;
char *p = NULL;
struct GMT_OGR *S = NULL;
Expand Down Expand Up @@ -952,8 +952,11 @@ GMT_LOCAL bool gmtio_ogr_header_parser (struct GMT_CTRL *GMT, char *record) {
break;

default: /* Just record, probably means this is NOT a GMT/OGR file after all */
GMT_Report (GMT->parent, GMT_MSG_ERROR, "Bad OGR/GMT: @%c not allowed before FEATURE_DATA\n", (int)p[0]);
GMT->current.io.ogr = GMT_OGR_FALSE;
gap = (unsigned int)(p - record);
if (gap < 3) {
GMT_Report (GMT->parent, GMT_MSG_ERROR, "Bad OGR/GMT: @%c not allowed before FEATURE_DATA\n", (int)p[0]);
GMT->current.io.ogr = GMT_OGR_FALSE;
}
break;
}

Expand Down