aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Warmerdam <warmerdam@pobox.com>2002-04-30 16:26:07 +0000
committerFrank Warmerdam <warmerdam@pobox.com>2002-04-30 16:26:07 +0000
commit9939a13be9026dac985ca42846526e07434e6a96 (patch)
tree0a4ceb480b73d673e219859c2ccb822606e4be83 /src
parentf562588c272134c3bd81295f1d1987d071a92e8d (diff)
downloadPROJ-9939a13be9026dac985ca42846526e07434e6a96.tar.gz
PROJ-9939a13be9026dac985ca42846526e07434e6a96.zip
trip newlines of ctable id field
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1007 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src')
-rw-r--r--src/nad_init.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/nad_init.c b/src/nad_init.c
index b70f0d5d..455f4b14 100644
--- a/src/nad_init.c
+++ b/src/nad_init.c
@@ -28,6 +28,9 @@
******************************************************************************
*
* $Log$
+ * Revision 1.5 2002/04/30 16:26:07 warmerda
+ * trip newlines of ctable id field
+ *
* Revision 1.4 2001/08/17 17:28:37 warmerda
* removed use of emess()
*
@@ -210,8 +213,9 @@ static struct CTABLE *nad_load_ntv1( FILE * fid )
static struct CTABLE *nad_load_ctable( FILE * fid )
{
struct CTABLE *ct;
- int a_size;
+ int a_size, id_end;
+ /* read the table header */
ct = (struct CTABLE *) pj_malloc(sizeof(struct CTABLE));
if( ct == NULL
|| fread( ct, sizeof(struct CTABLE), 1, fid ) != 1 )
@@ -220,6 +224,7 @@ static struct CTABLE *nad_load_ctable( FILE * fid )
return NULL;
}
+ /* do some minimal validation to ensure the structure isn't corrupt */
if( ct->lim.lam < 1 || ct->lim.lam > 100000
|| ct->lim.phi < 1 || ct->lim.phi > 100000 )
{
@@ -227,6 +232,16 @@ static struct CTABLE *nad_load_ctable( FILE * fid )
return NULL;
}
+ /* trim white space and newlines off id */
+ for( id_end = strlen(ct->id)-1; id_end > 0; id_end-- )
+ {
+ if( ct->id[id_end] == '\n' || ct->id[id_end] == ' ' )
+ ct->id[id_end] = '\0';
+ else
+ break;
+ }
+
+ /* read all the actual shift values */
a_size = ct->lim.lam * ct->lim.phi;
ct->cvs = (FLP *) pj_malloc(sizeof(FLP) * a_size);
if( ct->cvs == NULL