From 992fb0a2c4596c5c240d71f690bc94ad889117c6 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Sun, 16 Mar 2003 16:38:24 +0000 Subject: Modified get_opt() to terminate reading the definition when a new definition (a word starting with '<') is encountered, in addition to when the definition terminator '<>' is encountered, so that unterminated definitions like those in the distributed esri file will work properly. http://bugzilla.remotesensing.org/show_bug.cgi?id=302 git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1093 4e78687f-474d-0410-85f9-8d5e500ac6b2 --- src/pj_init.c | 61 +++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/pj_init.c b/src/pj_init.c index eb6ab77e..932c1bd1 100644 --- a/src/pj_init.c +++ b/src/pj_init.c @@ -30,6 +30,13 @@ ****************************************************************************** * * $Log$ + * Revision 1.10 2003/03/16 16:38:24 warmerda + * Modified get_opt() to terminate reading the definition when a new + * definition (a word starting with '<') is encountered, in addition to when + * the definition terminator '<>' is encountered, so that unterminated + * definitions like those in the distributed esri file will work properly. + * http://bugzilla.remotesensing.org/show_bug.cgi?id=302 + * * Revision 1.9 2002/12/14 20:15:02 warmerda * added geocentric support, updated headers * @@ -51,31 +58,35 @@ extern FILE *pj_open_lib(char *, char *); /************************************************************************/ static paralist * get_opt(FILE *fid, char *name, paralist *next) { - char sword[52], *word = sword+1; - int first = 1, len, c; - - len = strlen(name); - *sword = 't'; - while (fscanf(fid, "%50s", word) == 1) - if (*word == '#') /* skip comments */ - while((c = fgetc(fid)) != EOF && c != '\n') ; - else if (*word == '<') { /* control name */ - if (first && !strncmp(name, word + 1, len) - && word[len + 1] == '>') - first = 0; - else if (!first && word[1] == '>') - break; - } else if (!first && !pj_param(start, sword).i) { - /* don't default ellipse if datum is set */ - if( strncmp(word,"ellps=",6) != 0 - || !pj_param(start, "tdatum").i ) - { - next = next->next = pj_mkparam(word); - } - } - if (errno == 25) - errno = 0; - return next; + char sword[52], *word = sword+1; + int first = 1, len, c; + + len = strlen(name); + *sword = 't'; + while (fscanf(fid, "%50s", word) == 1) { + if (*word == '#') /* skip comments */ + while((c = fgetc(fid)) != EOF && c != '\n') ; + else if (*word == '<') { /* control name */ + if (first && !strncmp(name, word + 1, len) + && word[len + 1] == '>') + first = 0; + else if (!first && *word == '<') { + while((c = fgetc(fid)) != EOF && c != '\n') ; + break; + } + } else if (!first && !pj_param(start, sword).i) { + /* don't default ellipse if datum is set */ + if( strncmp(word,"ellps=",6) != 0 + || !pj_param(start, "tdatum").i ) + { + next = next->next = pj_mkparam(word); + } + } + } + + if (errno == 25) + errno = 0; + return next; } /************************************************************************/ -- cgit v1.2.3