[GRASS-SVN] r35312 - grass/branches/releasebranch_6_3/lib/proj

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 10 07:14:48 EST 2009


Author: neteler
Date: 2009-01-10 07:14:48 -0500 (Sat, 10 Jan 2009)
New Revision: 35312

Modified:
   grass/branches/releasebranch_6_3/lib/proj/convert.c
   grass/branches/releasebranch_6_3/lib/proj/datum.c
   grass/branches/releasebranch_6_3/lib/proj/do_proj.c
   grass/branches/releasebranch_6_3/lib/proj/ellipse.c
   grass/branches/releasebranch_6_3/lib/proj/get_proj.c
Log:
grass64/tools/grass_indent.sh applied for easier bugtracking

Modified: grass/branches/releasebranch_6_3/lib/proj/convert.c
===================================================================
--- grass/branches/releasebranch_6_3/lib/proj/convert.c	2009-01-10 09:09:27 UTC (rev 35311)
+++ grass/branches/releasebranch_6_3/lib/proj/convert.c	2009-01-10 12:14:48 UTC (rev 35312)
@@ -31,7 +31,7 @@
 /* GRASS relative location of OGR co-ordinate system lookup tables */
 #define CSVDIR "/etc/ogr_csv"
 
-static void DatumNameMassage( char ** );
+static void DatumNameMassage(char **);
 
 /**
  * \brief Converts a GRASS co-ordinate system representation to WKT style.
@@ -59,10 +59,10 @@
     char *wkt;
 
     hSRS = GPJ_grass_to_osr(proj_info, proj_units);
-  
+
     if (hSRS == NULL)
-        return NULL;
-   
+	return NULL;
+
     if (esri_style)
 	OSRMorphToESRI(hSRS);
 
@@ -86,24 +86,24 @@
  **/
 
 OGRSpatialReferenceH GPJ_grass_to_osr(struct Key_Value * proj_info,
-				       struct Key_Value * proj_units)
+				      struct Key_Value * proj_units)
 {
     struct pj_info pjinfo;
     char *proj4, *proj4mod, *wkt, *modwkt, *startmod, *lastpart;
     OGRSpatialReferenceH hSRS, hSRS2;
     OGRErr errcode;
     struct gpj_datum dstruct;
-    struct gpj_ellps estruct;       
+    struct gpj_ellps estruct;
     size_t len;
     char *ellps, *ellpslong, *datum, *params, *towgs84, *datumlongname,
-        *start, *end, *unit, *unfact, *buff;
+	*start, *end, *unit, *unfact, *buff;
     const char *sysname, *osrunit, *osrunfact;
     double a, es, rf;
     int haveparams = 0;
 
-    if( (proj_info == NULL) || (proj_units == NULL) )
-        return NULL;
-   
+    if ((proj_info == NULL) || (proj_units == NULL))
+	return NULL;
+
     hSRS = OSRNewSpatialReference(NULL);
 
     if (pj_get_kv(&pjinfo, proj_info, proj_units) < 0) {
@@ -124,7 +124,7 @@
 	proj4mod = proj4;
 
     if ((errcode = OSRImportFromProj4(hSRS, proj4mod)) != OGRERR_NONE) {
-	G_warning(_("OGR can't parse PROJ.4-style parameter string:\n" 
+	G_warning(_("OGR can't parse PROJ.4-style parameter string:\n"
 		    "%s\n(OGR Error code was %d)"), proj4mod, errcode);
 	return NULL;
     }
@@ -148,16 +148,15 @@
 	datumlongname = G_store(dstruct.longname);
 	if (ellps == NULL)
 	    ellps = G_store(dstruct.ellps);
-	GPJ_free_datum(&dstruct);       
+	GPJ_free_datum(&dstruct);
     }
-    if( GPJ_get_ellipsoid_by_name(ellps, &estruct) > 0 )	 
-    {
+    if (GPJ_get_ellipsoid_by_name(ellps, &estruct) > 0) {
 	ellpslong = G_store(estruct.longname);
 	DatumNameMassage(&ellpslong);
-	GPJ_free_ellps(&estruct);	   
-    }       
+	GPJ_free_ellps(&estruct);
+    }
     else
-	ellpslong = G_store(ellps); 
+	ellpslong = G_store(ellps);
 
     startmod = G_strstr(wkt, "GEOGCS");
     lastpart = G_strstr(wkt, "PRIMEM");
@@ -167,6 +166,7 @@
 	/* Only put datum params into the WKT if they were specifically
 	 * specified in PROJ_INFO */
 	char *paramkey, *paramvalue;
+
 	paramkey = strtok(params, "=");
 	paramvalue = params + strlen(paramkey) + 1;
 	if (G_strcasecmp(paramkey, "towgs84") == 0)
@@ -214,8 +214,8 @@
 
     G_asprintf(&modwkt,
 	       "%sGEOGCS[\"%s\",DATUM[\"%s\",SPHEROID[\"%s\",%.16g,%.16g]%s],%s%s",
-	       start, ellps, datumlongname, ellpslong, a, rf, towgs84, lastpart,
-	       end);
+	       start, ellps, datumlongname, ellpslong, a, rf, towgs84,
+	       lastpart, end);
 
     hSRS2 = OSRNewSpatialReference(modwkt);
 
@@ -255,8 +255,8 @@
  *                    been defined
  **/
 
-int GPJ_osr_to_grass(struct Cell_head *cellhd, struct Key_Value **projinfo, 
-                     struct Key_Value **projunits, OGRSpatialReferenceH hSRS,
+int GPJ_osr_to_grass(struct Cell_head *cellhd, struct Key_Value **projinfo,
+		     struct Key_Value **projunits, OGRSpatialReferenceH hSRS,
 		     int datumtrans)
 {
     struct Key_Value *temp_projinfo;
@@ -264,404 +264,383 @@
     char *pszProj = NULL;
     char *datum = NULL;
     struct gpj_datum dstruct;
-    
-    if( hSRS == NULL )
-        goto default_to_xy;
 
+    if (hSRS == NULL)
+	goto default_to_xy;
+
     /* Set finder function for locating OGR csv co-ordinate system tables */
-    SetCSVFilenameHook( GPJ_set_csv_loc );
-     
+    SetCSVFilenameHook(GPJ_set_csv_loc);
+
     /* Hopefully this doesn't do any harm if it wasn't in ESRI format
      * to start with... */
-    OSRMorphFromESRI( hSRS );
+    OSRMorphFromESRI(hSRS);
 
-/* -------------------------------------------------------------------- */
-/*      Set cellhd for well known coordinate systems.                   */
-/* -------------------------------------------------------------------- */
-    if( !OSRIsGeographic( hSRS ) && !OSRIsProjected( hSRS ) )
-        goto default_to_xy;
+    /* -------------------------------------------------------------------- */
+    /*      Set cellhd for well known coordinate systems.                   */
+    /* -------------------------------------------------------------------- */
+    if (!OSRIsGeographic(hSRS) && !OSRIsProjected(hSRS))
+	goto default_to_xy;
 
-    if( cellhd )
-    {
-        int   bNorth;
+    if (cellhd) {
+	int bNorth;
 
-        if( OSRIsGeographic( hSRS ) )
-        {
-            cellhd->proj = PROJECTION_LL;
-            cellhd->zone = 0;
-        }
-        else if( OSRGetUTMZone( hSRS, &bNorth ) != 0 )
-        {
-            cellhd->proj = PROJECTION_UTM;
-            cellhd->zone = OSRGetUTMZone( hSRS, &bNorth );
-            if( !bNorth )
-                cellhd->zone *= -1;
-        }
-        else 
-        {
-            cellhd->proj = PROJECTION_OTHER;
-            cellhd->zone = 0;
-        }
+	if (OSRIsGeographic(hSRS)) {
+	    cellhd->proj = PROJECTION_LL;
+	    cellhd->zone = 0;
+	}
+	else if (OSRGetUTMZone(hSRS, &bNorth) != 0) {
+	    cellhd->proj = PROJECTION_UTM;
+	    cellhd->zone = OSRGetUTMZone(hSRS, &bNorth);
+	    if (!bNorth)
+		cellhd->zone *= -1;
+	}
+	else {
+	    cellhd->proj = PROJECTION_OTHER;
+	    cellhd->zone = 0;
+	}
     }
 
-/* -------------------------------------------------------------------- */
-/*      Get the coordinate system definition in PROJ.4 format.          */
-/* -------------------------------------------------------------------- */
-    if( OSRExportToProj4( hSRS, &pszProj4 ) != OGRERR_NONE )
-        goto default_to_xy;
+    /* -------------------------------------------------------------------- */
+    /*      Get the coordinate system definition in PROJ.4 format.          */
+    /* -------------------------------------------------------------------- */
+    if (OSRExportToProj4(hSRS, &pszProj4) != OGRERR_NONE)
+	goto default_to_xy;
 
-/* -------------------------------------------------------------------- */
-/*      Parse the PROJ.4 string into key/value pairs.  Do a bit of      */
-/*      extra work to "GRASSify" the result.                            */
-/* -------------------------------------------------------------------- */
+    /* -------------------------------------------------------------------- */
+    /*      Parse the PROJ.4 string into key/value pairs.  Do a bit of      */
+    /*      extra work to "GRASSify" the result.                            */
+    /* -------------------------------------------------------------------- */
     temp_projinfo = G_create_key_value();
-   
+
     pszRemaining = pszProj4;
-    while( (pszRemaining = strstr(pszRemaining,"+")) != NULL )
-    {
-        char 	*pszToken, *pszValue;
+    while ((pszRemaining = strstr(pszRemaining, "+")) != NULL) {
+	char *pszToken, *pszValue;
 
-        pszRemaining++;
-        
-        /* Advance pszRemaining to end of this token[=value] pair */
-        pszToken = pszRemaining;
-        while( *pszRemaining != ' ' && *pszRemaining != '\0' )
-            pszRemaining++;
+	pszRemaining++;
 
-        if( *pszRemaining == ' ' )
-        {
-            *pszRemaining = '\0';
-            pszRemaining++;
-        }
+	/* Advance pszRemaining to end of this token[=value] pair */
+	pszToken = pszRemaining;
+	while (*pszRemaining != ' ' && *pszRemaining != '\0')
+	    pszRemaining++;
 
-        /* parse token, and value */
-        if( strstr(pszToken,"=") != NULL )
-        {
-            pszValue = strstr(pszToken,"=");
-            *pszValue = '\0';
-            pszValue++;
-        }
-        else
-            pszValue = "defined";
-        
+	if (*pszRemaining == ' ') {
+	    *pszRemaining = '\0';
+	    pszRemaining++;
+	}
 
-        if( G_strcasecmp(pszToken,"proj") == 0 )
-	{
-            /* The ll projection is known as longlat in PROJ.4 */
-            if( G_strcasecmp(pszValue,"longlat") == 0 )
-	        pszValue = "ll";
-	   
-            pszProj = pszValue;
+	/* parse token, and value */
+	if (strstr(pszToken, "=") != NULL) {
+	    pszValue = strstr(pszToken, "=");
+	    *pszValue = '\0';
+	    pszValue++;
+	}
+	else
+	    pszValue = "defined";
+
+
+	if (G_strcasecmp(pszToken, "proj") == 0) {
+	    /* The ll projection is known as longlat in PROJ.4 */
+	    if (G_strcasecmp(pszValue, "longlat") == 0)
+		pszValue = "ll";
+
+	    pszProj = pszValue;
 	    continue;
 	}
 
-        /* Ellipsoid and datum handled separately below */
-        if( G_strcasecmp(pszToken,"ellps") == 0
-            || G_strcasecmp(pszToken,"a") == 0
-            || G_strcasecmp(pszToken,"b") == 0
-            || G_strcasecmp(pszToken,"es") == 0
-            || G_strcasecmp(pszToken,"rf") == 0
-            || G_strcasecmp(pszToken,"datum") == 0 )
-            continue;
-       
-        /* We will handle units separately */
-        if( G_strcasecmp(pszToken,"to_meter") == 0 
-            || G_strcasecmp(pszToken,"units") == 0 )
-            continue;
+	/* Ellipsoid and datum handled separately below */
+	if (G_strcasecmp(pszToken, "ellps") == 0
+	    || G_strcasecmp(pszToken, "a") == 0
+	    || G_strcasecmp(pszToken, "b") == 0
+	    || G_strcasecmp(pszToken, "es") == 0
+	    || G_strcasecmp(pszToken, "rf") == 0
+	    || G_strcasecmp(pszToken, "datum") == 0)
+	    continue;
 
-        G_set_key_value( pszToken, pszValue, temp_projinfo );
+	/* We will handle units separately */
+	if (G_strcasecmp(pszToken, "to_meter") == 0
+	    || G_strcasecmp(pszToken, "units") == 0)
+	    continue;
+
+	G_set_key_value(pszToken, pszValue, temp_projinfo);
     }
 
     *projinfo = G_create_key_value();
-   
-/* -------------------------------------------------------------------- */
-/*      Derive the user name for the projection.                        */
-/* -------------------------------------------------------------------- */
-     if( pszProj )
-     {
-        char	path[4095];
-        char    name[80];
 
-        sprintf(path,"%s/etc/projections",G_gisbase());
-        if( G_lookup_key_value_from_file(path,pszProj,name,sizeof(name)) > 0 )
-            G_set_key_value( "name", name, *projinfo );
-        else
-            G_set_key_value( "name", pszProj, *projinfo );
-	
-	G_set_key_value( "proj", pszProj, *projinfo );
+    /* -------------------------------------------------------------------- */
+    /*      Derive the user name for the projection.                        */
+    /* -------------------------------------------------------------------- */
+    if (pszProj) {
+	char path[4095];
+	char name[80];
+
+	sprintf(path, "%s/etc/projections", G_gisbase());
+	if (G_lookup_key_value_from_file(path, pszProj, name, sizeof(name)) >
+	    0)
+	    G_set_key_value("name", name, *projinfo);
+	else
+	    G_set_key_value("name", pszProj, *projinfo);
+
+	G_set_key_value("proj", pszProj, *projinfo);
     }
     else
 	G_warning(_("No projection name! Projection parameters likely to be meaningless."));
 
-       
-/* -------------------------------------------------------------------- */
-/*      Find the GRASS datum name and choose parameters either          */
-/*      interactively or not.                                           */
-/* -------------------------------------------------------------------- */
 
-    {   
-        const char *pszDatumNameConst = OSRGetAttrValue( hSRS, "DATUM", 0 );
-        struct datum_list *list, *listhead;
-        char *dum1, *dum2, *pszDatumName;
-        int paramspresent = GPJ__get_datum_params(temp_projinfo, &dum1, &dum2);
+    /* -------------------------------------------------------------------- */
+    /*      Find the GRASS datum name and choose parameters either          */
+    /*      interactively or not.                                           */
+    /* -------------------------------------------------------------------- */
 
-        if ( pszDatumNameConst )
-        {
+    {
+	const char *pszDatumNameConst = OSRGetAttrValue(hSRS, "DATUM", 0);
+	struct datum_list *list, *listhead;
+	char *dum1, *dum2, *pszDatumName;
+	int paramspresent =
+	    GPJ__get_datum_params(temp_projinfo, &dum1, &dum2);
+
+	if (pszDatumNameConst) {
 	    /* Need to make a new copy of the string so we don't mess
 	     * around with the memory inside the OGRSpatialReferenceH? */
 
-	    pszDatumName = G_store( pszDatumNameConst );
-            DatumNameMassage( &pszDatumName );
+	    pszDatumName = G_store(pszDatumNameConst);
+	    DatumNameMassage(&pszDatumName);
 
-            list = listhead = read_datum_table();
- 
-            while (list != NULL) {
-    	        if (G_strcasecmp(pszDatumName, list->longname) == 0) {
-    	            datum = G_store(list->name);
-	            break;
-	        }
-	        list = list->next;
-            }
-            free_datum_list(listhead);
-	   
-	    if (datum == NULL)
-	    {
-	        if( paramspresent < 2)
+	    list = listhead = read_datum_table();
+
+	    while (list != NULL) {
+		if (G_strcasecmp(pszDatumName, list->longname) == 0) {
+		    datum = G_store(list->name);
+		    break;
+		}
+		list = list->next;
+	    }
+	    free_datum_list(listhead);
+
+	    if (datum == NULL) {
+		if (paramspresent < 2)
 		    /* Only give warning if no parameters present */
-	            G_warning(_("Datum <%s> not recognised by GRASS and no parameters found."),
+		    G_warning(_("Datum <%s> not recognised by GRASS and no parameters found."),
 			      pszDatumName);
 	    }
-            else
-	    {
-                G_set_key_value( "datum", datum, *projinfo );        
+	    else {
+		G_set_key_value("datum", datum, *projinfo);
 
-                if (paramspresent < 2)
-                {
-                    /* If no datum parameters were imported from the OSR
-                     * object then we should use the set specified by datumtrans */
-                    char *params, *chosenparams = NULL;
-                    int paramsets;
+		if (paramspresent < 2) {
+		    /* If no datum parameters were imported from the OSR
+		     * object then we should use the set specified by datumtrans */
+		    char *params, *chosenparams = NULL;
+		    int paramsets;
 
-                    paramsets = GPJ_get_default_datum_params_by_name(datum, &params);
+		    paramsets =
+			GPJ_get_default_datum_params_by_name(datum, &params);
 
-                    if( paramsets < 0 )
-                        G_warning(_("Datum <%s> apparently recognised by GRASS but no parameters found. "
-				    "You may want to look into this."), datum );
-                    else if( datumtrans > paramsets )
-                    {
+		    if (paramsets < 0)
+			G_warning(_("Datum <%s> apparently recognised by GRASS but no parameters found. "
+				   "You may want to look into this."), datum);
+		    else if (datumtrans > paramsets) {
 
-                        G_warning(_("Invalid tranformation number %d; valid range is 1 to %d. "
-				    "Leaving datum transform parameters unspecified."),
-                                  datumtrans, paramsets);
-                        datumtrans = 0;
-                    }
+			G_warning(_("Invalid tranformation number %d; valid range is 1 to %d. "
+				   "Leaving datum transform parameters unspecified."),
+				  datumtrans, paramsets);
+			datumtrans = 0;
+		    }
 
-                    if( paramsets > 0 )
-                    {
-                        struct gpj_datum_transform_list *list, *old;
-                       
-                        list = GPJ_get_datum_transform_by_name( datum );
-           
-                        if( list != NULL )
-                        {
-                            do
-                            {
-                                if( list->count == datumtrans )
-                                {                            
-                                    chosenparams = G_store( list->params );
-                                    break;
-                                }
-                                old = list;
-                                list = list->next;
-                                G_free( old );
-                            } while(list != NULL);
-                        }
-                    }
-                   
-                    if( chosenparams != NULL )
-                    {
-                        char *paramkey, *paramvalue;
-                       
-                        paramkey = strtok(chosenparams, "=");
-                        paramvalue = chosenparams + strlen(paramkey) + 1;
-                        G_set_key_value( paramkey, paramvalue, *projinfo );
-                        G_free( chosenparams );
-                    }
-                   
-                    if(paramsets > 0)
-                        G_free(params);
-                }
+		    if (paramsets > 0) {
+			struct gpj_datum_transform_list *list, *old;
 
-            }
-        }
+			list = GPJ_get_datum_transform_by_name(datum);
+
+			if (list != NULL) {
+			    do {
+				if (list->count == datumtrans) {
+				    chosenparams = G_store(list->params);
+				    break;
+				}
+				old = list;
+				list = list->next;
+				G_free(old);
+			    } while (list != NULL);
+			}
+		    }
+
+		    if (chosenparams != NULL) {
+			char *paramkey, *paramvalue;
+
+			paramkey = strtok(chosenparams, "=");
+			paramvalue = chosenparams + strlen(paramkey) + 1;
+			G_set_key_value(paramkey, paramvalue, *projinfo);
+			G_free(chosenparams);
+		    }
+
+		    if (paramsets > 0)
+			G_free(params);
+		}
+
+	    }
+	}
     }
 
-/* -------------------------------------------------------------------- */
-/*   Determine an appropriate GRASS ellipsoid name if possible, or	*/
-/*   else just put a and es values into PROJ_INFO			*/
-/* -------------------------------------------------------------------- */
+    /* -------------------------------------------------------------------- */
+    /*   Determine an appropriate GRASS ellipsoid name if possible, or      */
+    /*   else just put a and es values into PROJ_INFO                       */
+    /* -------------------------------------------------------------------- */
 
-    if( (datum != NULL) && (GPJ_get_datum_by_name( datum, &dstruct ) > 0) )
-    {
-        /* Use ellps name associated with datum */
-        G_set_key_value( "ellps", dstruct.ellps, *projinfo );
-        GPJ_free_datum( &dstruct );
-        G_free( datum );
+    if ((datum != NULL) && (GPJ_get_datum_by_name(datum, &dstruct) > 0)) {
+	/* Use ellps name associated with datum */
+	G_set_key_value("ellps", dstruct.ellps, *projinfo);
+	GPJ_free_datum(&dstruct);
+	G_free(datum);
     }
-    else
-    {
-        /* If we can't determine the ellipsoid from the datum, derive it
-         * directly from "SPHEROID" parameters in WKT */       
-        const char *pszSemiMajor = OSRGetAttrValue( hSRS, "SPHEROID", 1 );
-        const char *pszInvFlat = OSRGetAttrValue( hSRS, "SPHEROID", 2 );
+    else {
+	/* If we can't determine the ellipsoid from the datum, derive it
+	 * directly from "SPHEROID" parameters in WKT */
+	const char *pszSemiMajor = OSRGetAttrValue(hSRS, "SPHEROID", 1);
+	const char *pszInvFlat = OSRGetAttrValue(hSRS, "SPHEROID", 2);
 
-        if( pszSemiMajor != NULL && pszInvFlat != NULL )
-        {
-            char *ellps = NULL;
-            struct ellps_list *list, *listhead;
-            double a = atof(pszSemiMajor), flat = atof(pszInvFlat);
-            double es;
-           
-            /* Allow for incorrect WKT describing a sphere where InvFlat 
-             * is given as 0 rather than inf */
-            if( flat > 0 )
-                flat = 1 / flat;
-            
-            es = flat * (2.0 - flat);
+	if (pszSemiMajor != NULL && pszInvFlat != NULL) {
+	    char *ellps = NULL;
+	    struct ellps_list *list, *listhead;
+	    double a = atof(pszSemiMajor), flat = atof(pszInvFlat);
+	    double es;
 
-            list = listhead = read_ellipsoid_table(0);
-       
-            while (list != NULL) 
-            {
-	        /* Try and match a and es against GRASS defined ellipsoids;
+	    /* Allow for incorrect WKT describing a sphere where InvFlat 
+	     * is given as 0 rather than inf */
+	    if (flat > 0)
+		flat = 1 / flat;
+
+	    es = flat * (2.0 - flat);
+
+	    list = listhead = read_ellipsoid_table(0);
+
+	    while (list != NULL) {
+		/* Try and match a and es against GRASS defined ellipsoids;
 		 * accept first one that matches. These numbers were found
 		 * by trial and error and could be fine-tuned, or possibly
 		 * a direct comparison of IEEE floating point values used. */
-                if ( ( a == list->a || fabs(a - list->a) < 0.1 || fabs(1 - a/list->a) < 0.0000001 ) &&
-                     ( es == list->es || fabs(es - list->es) < 0.000000001 || fabs(1 - es/list->es) < 0.0000001) )
-                {
-                    ellps = G_store(list->name);
-                    break;
-                }
-                list = list->next;
-            }
-            if(listhead != NULL)
-                free_ellps_list(listhead);
+		if ((a == list->a || fabs(a - list->a) < 0.1 ||
+		     fabs(1 - a / list->a) < 0.0000001) && (es == list->es ||
+							    fabs(es -
+								 list->es) <
+							    0.000000001 ||
+							    fabs(1 -
+								 es /
+								 list->es) <
+							    0.0000001)) {
+		    ellps = G_store(list->name);
+		    break;
+		}
+		list = list->next;
+	    }
+	    if (listhead != NULL)
+		free_ellps_list(listhead);
 
-            if(ellps == NULL)
-            {
-                /* If we weren't able to find a matching ellps name, set
-                 * a and es values directly from WKT-derived data */
-                char es_str[100];
+	    if (ellps == NULL) {
+		/* If we weren't able to find a matching ellps name, set
+		 * a and es values directly from WKT-derived data */
+		char es_str[100];
 
-                G_set_key_value( "a", (char *) pszSemiMajor, *projinfo );
+		G_set_key_value("a", (char *)pszSemiMajor, *projinfo);
 
-                sprintf( es_str, "%.16g", es );
-                G_set_key_value( "es", es_str, *projinfo );
-            }
-            else
-            {
-                /* else specify the GRASS ellps name for readability */
-                G_set_key_value( "ellps", ellps, *projinfo );
-                G_free(ellps);
-            }
-           
-        }
-       
+		sprintf(es_str, "%.16g", es);
+		G_set_key_value("es", es_str, *projinfo);
+	    }
+	    else {
+		/* else specify the GRASS ellps name for readability */
+		G_set_key_value("ellps", ellps, *projinfo);
+		G_free(ellps);
+	    }
+
+	}
+
     }
-   
-/* -------------------------------------------------------------------- */
-/*	Finally append the detailed projection parameters to the end	*/
-/* -------------------------------------------------------------------- */
 
+    /* -------------------------------------------------------------------- */
+    /*      Finally append the detailed projection parameters to the end    */
+    /* -------------------------------------------------------------------- */
+
     {
-        int i;
-        
-        for ( i = 0; i < temp_projinfo->nitems; i++)	 	
-	    G_set_key_value( temp_projinfo->key[i], 
-			     temp_projinfo->value[i], *projinfo );
-       
-        G_free_key_value( temp_projinfo );
+	int i;
+
+	for (i = 0; i < temp_projinfo->nitems; i++)
+	    G_set_key_value(temp_projinfo->key[i],
+			    temp_projinfo->value[i], *projinfo);
+
+	G_free_key_value(temp_projinfo);
     }
-       
-    free( pszProj4 ); /* hopefully the same as CPLFree()! */
 
-/* -------------------------------------------------------------------- */
-/*      Set the linear units.                                           */
-/* -------------------------------------------------------------------- */
+    free(pszProj4);		/* hopefully the same as CPLFree()! */
+
+    /* -------------------------------------------------------------------- */
+    /*      Set the linear units.                                           */
+    /* -------------------------------------------------------------------- */
     *projunits = G_create_key_value();
-    
-    if( OSRIsGeographic( hSRS ) )
-    {
-        /* We assume degrees ... someday we will be wrong! */
-        G_set_key_value( "unit", "degree", *projunits );
-        G_set_key_value( "units", "degrees", *projunits );
-        G_set_key_value( "meters", "1.0", *projunits );
+
+    if (OSRIsGeographic(hSRS)) {
+	/* We assume degrees ... someday we will be wrong! */
+	G_set_key_value("unit", "degree", *projunits);
+	G_set_key_value("units", "degrees", *projunits);
+	G_set_key_value("meters", "1.0", *projunits);
     }
-    else 
-    {
-        char	szFormatBuf[256];
-        char    *pszUnitsName = NULL;
-        double  dfToMeters;
-        char    *pszUnitsPlural, *pszStringEnd;
+    else {
+	char szFormatBuf[256];
+	char *pszUnitsName = NULL;
+	double dfToMeters;
+	char *pszUnitsPlural, *pszStringEnd;
 
-        dfToMeters = OSRGetLinearUnits( hSRS, &pszUnitsName );
-        
-        /* Workaround for the most obvious case when unit name is unknown */
-        if( (G_strcasecmp(pszUnitsName, "unknown") == 0) && (dfToMeters == 1.) )
-	    G_asprintf( &pszUnitsName, "meter" );
-       
-        G_set_key_value( "unit", pszUnitsName, *projunits );
-     
-        /* Attempt at plural formation (WKT format doesn't store plural
-         * form of unit name) */
-        pszUnitsPlural = G_malloc( strlen(pszUnitsName) + 3 );
-        strcpy(pszUnitsPlural, pszUnitsName);
-        pszStringEnd = pszUnitsPlural + strlen(pszUnitsPlural) - 4;
-        if( G_strcasecmp(pszStringEnd, "foot") == 0 )
-        {
-            /* Special case for foot - change two o's to e's */
-            pszStringEnd[1] = 'e';
-            pszStringEnd[2] = 'e';
-        }
-        else if( G_strcasecmp(pszStringEnd, "inch") == 0 )
-        {
-            /* Special case for inch - add es */
-            pszStringEnd[4] = 'e';
-            pszStringEnd[5] = 's';
-            pszStringEnd[6] = '\0';
-        }
-        else
-        {
-            /* For anything else add an s at the end */
-            pszStringEnd[4] = 's';
-            pszStringEnd[5] = '\0';
-        }
-       
-        G_set_key_value( "units", pszUnitsPlural, *projunits );
-        G_free( pszUnitsPlural );
-       
-        sprintf( szFormatBuf, "%.16g", dfToMeters );
-        G_set_key_value( "meters", szFormatBuf, *projunits );
+	dfToMeters = OSRGetLinearUnits(hSRS, &pszUnitsName);
 
+	/* Workaround for the most obvious case when unit name is unknown */
+	if ((G_strcasecmp(pszUnitsName, "unknown") == 0) &&
+	    (dfToMeters == 1.))
+	    G_asprintf(&pszUnitsName, "meter");
+
+	G_set_key_value("unit", pszUnitsName, *projunits);
+
+	/* Attempt at plural formation (WKT format doesn't store plural
+	 * form of unit name) */
+	pszUnitsPlural = G_malloc(strlen(pszUnitsName) + 3);
+	strcpy(pszUnitsPlural, pszUnitsName);
+	pszStringEnd = pszUnitsPlural + strlen(pszUnitsPlural) - 4;
+	if (G_strcasecmp(pszStringEnd, "foot") == 0) {
+	    /* Special case for foot - change two o's to e's */
+	    pszStringEnd[1] = 'e';
+	    pszStringEnd[2] = 'e';
+	}
+	else if (G_strcasecmp(pszStringEnd, "inch") == 0) {
+	    /* Special case for inch - add es */
+	    pszStringEnd[4] = 'e';
+	    pszStringEnd[5] = 's';
+	    pszStringEnd[6] = '\0';
+	}
+	else {
+	    /* For anything else add an s at the end */
+	    pszStringEnd[4] = 's';
+	    pszStringEnd[5] = '\0';
+	}
+
+	G_set_key_value("units", pszUnitsPlural, *projunits);
+	G_free(pszUnitsPlural);
+
+	sprintf(szFormatBuf, "%.16g", dfToMeters);
+	G_set_key_value("meters", szFormatBuf, *projunits);
+
     }
 
     return 2;
 
-/* -------------------------------------------------------------------- */
-/*      Fallback to returning an ungeoreferenced definition.            */
-/* -------------------------------------------------------------------- */
+    /* -------------------------------------------------------------------- */
+    /*      Fallback to returning an ungeoreferenced definition.            */
+    /* -------------------------------------------------------------------- */
   default_to_xy:
-    if( cellhd != NULL )
-    {
-        cellhd->proj = PROJECTION_XY;
-        cellhd->zone = 0;
+    if (cellhd != NULL) {
+	cellhd->proj = PROJECTION_XY;
+	cellhd->zone = 0;
     }
 
     *projinfo = NULL;
     *projunits = NULL;
-    
-    return 1; 
+
+    return 1;
 }
 
 
@@ -684,26 +663,27 @@
  *                    been defined
  **/
 
-int GPJ_wkt_to_grass(struct Cell_head *cellhd, struct Key_Value **projinfo, 
-                     struct Key_Value **projunits, const char *wkt,
+int GPJ_wkt_to_grass(struct Cell_head *cellhd, struct Key_Value **projinfo,
+		     struct Key_Value **projunits, const char *wkt,
 		     int datumtrans)
 {
     int retval;
 
-    if( wkt == NULL )
-        retval = GPJ_osr_to_grass(cellhd, projinfo, projunits, NULL, datumtrans);
-    else
-    {
-        OGRSpatialReferenceH hSRS;
+    if (wkt == NULL)
+	retval =
+	    GPJ_osr_to_grass(cellhd, projinfo, projunits, NULL, datumtrans);
+    else {
+	OGRSpatialReferenceH hSRS;
 
-        /* Set finder function for locating OGR csv co-ordinate system tables */
-        SetCSVFilenameHook( GPJ_set_csv_loc );
-       
-        hSRS = OSRNewSpatialReference(wkt);
-        retval = GPJ_osr_to_grass(cellhd, projinfo, projunits, hSRS, datumtrans);
-        OSRDestroySpatialReference(hSRS);
+	/* Set finder function for locating OGR csv co-ordinate system tables */
+	SetCSVFilenameHook(GPJ_set_csv_loc);
+
+	hSRS = OSRNewSpatialReference(wkt);
+	retval =
+	    GPJ_osr_to_grass(cellhd, projinfo, projunits, hSRS, datumtrans);
+	OSRDestroySpatialReference(hSRS);
     }
-   
+
     return retval;
 }
 
@@ -717,7 +697,7 @@
     static char *buf = NULL;
 
     if (buf != NULL)
-        G_free(buf);
+	G_free(buf);
 
     G_asprintf(&buf, "%s%s/%s", gisbase, CSVDIR, name);
 
@@ -738,8 +718,7 @@
  * these shortened versions seem to be standard
  */
 
-static const char *papszDatumEquiv[] =
-{
+static const char *papszDatumEquiv[] = {
     "Militar_Geographische_Institute",
     "Militar_Geographische_Institut",
     "World_Geodetic_System_1984",
@@ -768,54 +747,49 @@
 /*                                                                      */
 /*      Massage an EPSG datum name into WMT format.  Also transform     */
 /*      specific exception cases into WKT versions.                     */
+
 /************************************************************************/
 
-static void DatumNameMassage( char ** ppszDatum )
-
+static void DatumNameMassage(char **ppszDatum)
 {
-    int         i, j;
-    char        *pszDatum = *ppszDatum;
+    int i, j;
+    char *pszDatum = *ppszDatum;
 
-/* -------------------------------------------------------------------- */
-/*      Translate non-alphanumeric values to underscores.               */
-/* -------------------------------------------------------------------- */
-    for( i = 0; pszDatum[i] != '\0'; i++ )
-    {
-        if( !(pszDatum[i] >= 'A' && pszDatum[i] <= 'Z')
-            && !(pszDatum[i] >= 'a' && pszDatum[i] <= 'z')
-            && !(pszDatum[i] >= '0' && pszDatum[i] <= '9') )
-        {
-            pszDatum[i] = '_';
-        }
+    /* -------------------------------------------------------------------- */
+    /*      Translate non-alphanumeric values to underscores.               */
+    /* -------------------------------------------------------------------- */
+    for (i = 0; pszDatum[i] != '\0'; i++) {
+	if (!(pszDatum[i] >= 'A' && pszDatum[i] <= 'Z')
+	    && !(pszDatum[i] >= 'a' && pszDatum[i] <= 'z')
+	    && !(pszDatum[i] >= '0' && pszDatum[i] <= '9')) {
+	    pszDatum[i] = '_';
+	}
     }
 
-/* -------------------------------------------------------------------- */
-/*      Remove repeated and trailing underscores.                       */
-/* -------------------------------------------------------------------- */
-    for( i = 1, j = 0; pszDatum[i] != '\0'; i++ )
-    {
-        if( pszDatum[j] == '_' && pszDatum[i] == '_' )
-            continue;
+    /* -------------------------------------------------------------------- */
+    /*      Remove repeated and trailing underscores.                       */
+    /* -------------------------------------------------------------------- */
+    for (i = 1, j = 0; pszDatum[i] != '\0'; i++) {
+	if (pszDatum[j] == '_' && pszDatum[i] == '_')
+	    continue;
 
-        pszDatum[++j] = pszDatum[i];
+	pszDatum[++j] = pszDatum[i];
     }
-    if( pszDatum[j] == '_' )
-        pszDatum[j] = '\0';
+    if (pszDatum[j] == '_')
+	pszDatum[j] = '\0';
     else
-        pszDatum[j+1] = '\0';
-    
-/* -------------------------------------------------------------------- */
-/*      Search for datum equivelences.  Specific massaged names get     */
-/*      mapped to OpenGIS specified names.                              */
-/* -------------------------------------------------------------------- */
-    for( i = 0; papszDatumEquiv[i] != NULL; i += 2 )
-    {
-        if( EQUAL(*ppszDatum,papszDatumEquiv[i]) )
-        {
-            CPLFree( *ppszDatum );
-            *ppszDatum = CPLStrdup( papszDatumEquiv[i+1] );
-            break;
-        }
+	pszDatum[j + 1] = '\0';
+
+    /* -------------------------------------------------------------------- */
+    /*      Search for datum equivelences.  Specific massaged names get     */
+    /*      mapped to OpenGIS specified names.                              */
+    /* -------------------------------------------------------------------- */
+    for (i = 0; papszDatumEquiv[i] != NULL; i += 2) {
+	if (EQUAL(*ppszDatum, papszDatumEquiv[i])) {
+	    CPLFree(*ppszDatum);
+	    *ppszDatum = CPLStrdup(papszDatumEquiv[i + 1]);
+	    break;
+	}
     }
 }
 

Modified: grass/branches/releasebranch_6_3/lib/proj/datum.c
===================================================================
--- grass/branches/releasebranch_6_3/lib/proj/datum.c	2009-01-10 09:09:27 UTC (rev 35311)
+++ grass/branches/releasebranch_6_3/lib/proj/datum.c	2009-01-10 12:14:48 UTC (rev 35312)
@@ -87,32 +87,30 @@
 
 int GPJ_get_default_datum_params_by_name(const char *name, char **params)
 {
-   struct gpj_datum_transform_list *list, *old;
-   int count = 1;
+    struct gpj_datum_transform_list *list, *old;
+    int count = 1;
 
-   list = GPJ_get_datum_transform_by_name( name );
-   
-   if( list == NULL)
-   {
-      *params = NULL;
-      return -1;
-   }
-   
-   /* Take the first parameter set in the list as the default
-    * (will normally be a 3-parameter transformation)        */   
-   *params = G_store( list->params );
-   
-   while(list->next != NULL)
-   {
-        count++;
+    list = GPJ_get_datum_transform_by_name(name);
+
+    if (list == NULL) {
+	*params = NULL;
+	return -1;
+    }
+
+    /* Take the first parameter set in the list as the default
+     * (will normally be a 3-parameter transformation)        */
+    *params = G_store(list->params);
+
+    while (list->next != NULL) {
+	count++;
 	old = list;
 	list = list->next;
-	G_free( old );
-   }
-   
-   G_free( list );
-   return count;
-   
+	G_free(old);
+    }
+
+    G_free(list);
+    return count;
+
 }
 
 /**
@@ -193,14 +191,15 @@
 	returnval = 2;
     }
     else if (G_find_key_value("nadgrids", projinfo) != NULL) {
-        const char *gisbase = G_gisbase();
-       
+	const char *gisbase = G_gisbase();
+
 	G_asprintf(params, "nadgrids=%s%s/%s", gisbase, GRIDDIR,
 		   G_find_key_value("nadgrids", projinfo));
 	returnval = 2;
     }
     else if (G_find_key_value("towgs84", projinfo) != NULL) {
-	G_asprintf(params, "towgs84=%s", G_find_key_value("towgs84", projinfo));
+	G_asprintf(params, "towgs84=%s",
+		   G_find_key_value("towgs84", projinfo));
 	returnval = 2;
     }
     else if (G_find_key_value("dx", projinfo) != NULL
@@ -245,114 +244,124 @@
 {
     char buff[1024], answer[100];
     char *Tmp_file;
-    FILE  *Tmp_fd = NULL;
+    FILE *Tmp_fd = NULL;
     struct gpj_datum_transform_list *list, *listhead, *old;
     int transformcount, currenttransform;
 
-    if( G_strcasecmp(datumname, "custom") != 0)
-    {
-        Tmp_file = G_tempfile ();
-        if (NULL == (Tmp_fd = fopen (Tmp_file, "w"))) {
-            G_warning(_("Cannot open temp file") );
-        }
+    if (G_strcasecmp(datumname, "custom") != 0) {
+	Tmp_file = G_tempfile();
+	if (NULL == (Tmp_fd = fopen(Tmp_file, "w"))) {
+	    G_warning(_("Cannot open temp file"));
+	}
 
-        fprintf(Tmp_fd,"Number\tDetails\t\n---\n");
-        listhead = GPJ_get_datum_transform_by_name( datumname );
-        list = listhead;
-        transformcount = 0;
-        while( list != NULL)
-        {	   
+	fprintf(Tmp_fd, "Number\tDetails\t\n---\n");
+	listhead = GPJ_get_datum_transform_by_name(datumname);
+	list = listhead;
+	transformcount = 0;
+	while (list != NULL) {
 	    /* Count how many sets of transformation paramters have been 
 	     * defined for this datum and print them to a temporary file 
 	     * in case the user asks for them to be displayed */
-            fprintf(Tmp_fd,"%d\tUsed in %s\n\t(PROJ.4 Params %s)\n\t%s\n---\n",
-        	   list->count, list->where_used, list->params, list->comment);
-            list = list->next;
-            transformcount++;
-        }      
-        fclose(Tmp_fd);
+	    fprintf(Tmp_fd,
+		    "%d\tUsed in %s\n\t(PROJ.4 Params %s)\n\t%s\n---\n",
+		    list->count, list->where_used, list->params,
+		    list->comment);
+	    list = list->next;
+	    transformcount++;
+	}
+	fclose(Tmp_fd);
 
-        for(;;) {
-            do {
-                fprintf(stderr,("\nNow select Datum Transformation Parameters\n"));
-                fprintf(stderr,("Please think carefully about the area covered by your data\n"
-                                "and the accuracy you require before making your selection.\n"));
-                fprintf(stderr,("\nEnter 'list' to see the list of available Parameter sets\n"));
-                fprintf(stderr,("Enter the corresponding number, or <RETURN> to cancel request\n"));
-                fprintf(stderr,">");
-            } while(!G_gets(answer));
-            G_strip(answer); 
-            if(strlen(answer)==0) 
-            {
-                remove( Tmp_file );
-                G_free( Tmp_file );
-                return -1;
-            }
-            if (strcmp(answer,"list") == 0) {
-                char *pager;
+	for (;;) {
+	    do {
+		fprintf(stderr,
+			("\nNow select Datum Transformation Parameters\n"));
+		fprintf(stderr,
+			("Please think carefully about the area covered by your data\n"
+			 "and the accuracy you require before making your selection.\n"));
+		fprintf(stderr,
+			("\nEnter 'list' to see the list of available Parameter sets\n"));
+		fprintf(stderr,
+			("Enter the corresponding number, or <RETURN> to cancel request\n"));
+		fprintf(stderr, ">");
+	    } while (!G_gets(answer));
+	    G_strip(answer);
+	    if (strlen(answer) == 0) {
+		remove(Tmp_file);
+		G_free(Tmp_file);
+		return -1;
+	    }
+	    if (strcmp(answer, "list") == 0) {
+		char *pager;
 
-                pager = getenv("GRASS_PAGER");
-                if (!pager || strlen(pager) == 0)
-                    pager = "cat";
+		pager = getenv("GRASS_PAGER");
+		if (!pager || strlen(pager) == 0)
+		    pager = "cat";
 
 		/* Always print interactive output to stderr */
-                sprintf(buff,"%s \"%s\" 1>&2", pager, G_convert_dirseps_to_host(Tmp_file));
-                G_system(buff);
-            }
-            else {
-                if ( (sscanf(answer, "%d", &currenttransform) != 1) ||
-                    currenttransform > transformcount || currenttransform < 1) {
+		sprintf(buff, "%s \"%s\" 1>&2", pager,
+			G_convert_dirseps_to_host(Tmp_file));
+		G_system(buff);
+	    }
+	    else {
+		if ((sscanf(answer, "%d", &currenttransform) != 1) ||
+		    currenttransform > transformcount ||
+		    currenttransform < 1) {
 
 		    /* If a number was not typed, was less than 0 or greater
 		     * than the number of sets of parameters, ask again */
-                    fprintf(stderr,("\ninvalid transformation number\n"));
-                }
-                else break;
-            }
+		    fprintf(stderr, ("\ninvalid transformation number\n"));
+		}
+		else
+		    break;
+	    }
 
-        }
-        remove ( Tmp_file );
-        G_free ( Tmp_file );
-   
-        list = listhead;
-        while (list != NULL)
-        {
+	}
+	remove(Tmp_file);
+	G_free(Tmp_file);
+
+	list = listhead;
+	while (list != NULL) {
 	    /* Search through the linked list to find the parameter string
 	     * that corresponds to the number entered */
-            if( list->count == currenttransform )
-                G_asprintf(params, list->params);
-	   
+	    if (list->count == currenttransform)
+		G_asprintf(params, list->params);
+
 	    /* Continue to end of list even after we find it, to free all
 	     * the memory used */
-            old = list;
-            list = old->next;
-            G_free( old );
-        }
+	    old = list;
+	    list = old->next;
+	    G_free(old);
+	}
     }
-    else
-    {
-        /* Here we ask the user to enter customised parameters */
-        for(;;) {
-            do {
-                fprintf(stderr,("\nPlease specify datum transformation parameters in PROJ.4 syntax. Examples:\n"));
-                fprintf(stderr,("\ttowgs84=dx,dy,dz\t(3-parameter transformation)\n"));
-                fprintf(stderr,("\ttowgs84=dx,dy,dz,rx,ry,rz,m\t(7-parameter transformation)\n"));
-                fprintf(stderr,("\tnadgrids=alaska\t(Tables-based grid-shifting transformation)\n"));
-                fprintf (stderr,_("Hit RETURN to cancel request\n"));
-                fprintf(stderr,">");
-            } while(!G_gets(answer));
-            G_strip(answer); 
-            if(strlen(answer)==0)
-                return -1;
+    else {
+	/* Here we ask the user to enter customised parameters */
+	for (;;) {
+	    do {
+		fprintf(stderr,
+			("\nPlease specify datum transformation parameters in PROJ.4 syntax. Examples:\n"));
+		fprintf(stderr,
+			("\ttowgs84=dx,dy,dz\t(3-parameter transformation)\n"));
+		fprintf(stderr,
+			("\ttowgs84=dx,dy,dz,rx,ry,rz,m\t(7-parameter transformation)\n"));
+		fprintf(stderr,
+			("\tnadgrids=alaska\t(Tables-based grid-shifting transformation)\n"));
+		fprintf(stderr, _("Hit RETURN to cancel request\n"));
+		fprintf(stderr, ">");
+	    } while (!G_gets(answer));
+	    G_strip(answer);
+	    if (strlen(answer) == 0)
+		return -1;
 	    G_asprintf(params, answer);
-            sprintf(buff, "Parameters to be used are:\n\"%s\"\nIs this correct?", *params);
-            if (G_yes(buff, 1))
-                break;
+	    sprintf(buff,
+		    "Parameters to be used are:\n\"%s\"\nIs this correct?",
+		    *params);
+	    if (G_yes(buff, 1))
+		break;
 
-        }
+	}
 
     }
-   
+
     return 1;
 
 }
@@ -370,7 +379,7 @@
  **/
 
 struct gpj_datum_transform_list *GPJ_get_datum_transform_by_name(const char
-								*inputname)
+								 *inputname)
 {
     FILE *fd;
     char *file;
@@ -394,9 +403,10 @@
 	G_asprintf(&(current->params), "towgs84=%.3f,%.3f,%.3f", dstruct.dx,
 		   dstruct.dy, dstruct.dz);
 	G_asprintf(&(current->where_used), "whole %s region", inputname);
-	G_asprintf(&(current->comment), "Default 3-Parameter Transformation (May not be optimum for "
-		                        "older datums; use this only if no more appropriate options "
-		                        "are available.)");
+	G_asprintf(&(current->comment),
+		   "Default 3-Parameter Transformation (May not be optimum for "
+		   "older datums; use this only if no more appropriate options "
+		   "are available.)");
 	count++;
 	current->count = count;
 	current->next = NULL;
@@ -404,7 +414,7 @@
     GPJ_free_datum(&dstruct);
 
     /* Now check for additional parameters in datumtransform.table */
-   
+
     G_asprintf(&file, "%s%s", G_gisbase(), DATUMTRANSFORMTABLE);
 
     fd = fopen(file, "r");

Modified: grass/branches/releasebranch_6_3/lib/proj/do_proj.c
===================================================================
--- grass/branches/releasebranch_6_3/lib/proj/do_proj.c	2009-01-10 09:09:27 UTC (rev 35311)
+++ grass/branches/releasebranch_6_3/lib/proj/do_proj.c	2009-01-10 12:14:48 UTC (rev 35312)
@@ -144,6 +144,7 @@
 
     if (h == NULL) {
 	int i;
+
 	h = G_malloc(sizeof *h * count);
 	/* they say memset is only guaranteed for chars ;-( */
 	for (i = 0; i < count; ++i)

Modified: grass/branches/releasebranch_6_3/lib/proj/ellipse.c
===================================================================
--- grass/branches/releasebranch_6_3/lib/proj/ellipse.c	2009-01-10 09:09:27 UTC (rev 35311)
+++ grass/branches/releasebranch_6_3/lib/proj/ellipse.c	2009-01-10 12:14:48 UTC (rev 35312)
@@ -26,7 +26,8 @@
 #include <grass/gprojects.h>
 #include "local_proto.h"
 
-static int get_a_e2_f(const char *, const char *, double *, double *, double *);
+static int get_a_e2_f(const char *, const char *, double *, double *,
+		      double *);
 
 /**
  * This routine returns the ellipsoid parameters from the database.
@@ -217,7 +218,8 @@
 
     if (fd == NULL) {
 	perror(file);
-	G_asprintf(&errbuf, _("unable to open ellipsoid table file: %s"), file);
+	G_asprintf(&errbuf, _("unable to open ellipsoid table file: %s"),
+		   file);
 	fatal ? G_fatal_error(errbuf) : G_warning(errbuf);
 	G_free(errbuf);
 	return 0;
@@ -230,8 +232,8 @@
 	if (*buf == 0 || *buf == '#')
 	    continue;
 
-	if (sscanf(buf, "%s  \"%1023[^\"]\" %s %s", name, descr, buf1, buf2) !=
-	    4) {
+	if (sscanf(buf, "%s  \"%1023[^\"]\" %s %s", name, descr, buf1, buf2)
+	    != 4) {
 	    err++;
 	    sprintf(buf, " %d", line);
 	    if (*badlines)

Modified: grass/branches/releasebranch_6_3/lib/proj/get_proj.c
===================================================================
--- grass/branches/releasebranch_6_3/lib/proj/get_proj.c	2009-01-10 09:09:27 UTC (rev 35311)
+++ grass/branches/releasebranch_6_3/lib/proj/get_proj.c	2009-01-10 12:14:48 UTC (rev 35312)
@@ -1,3 +1,4 @@
+
 /**
    \file get_proj.c
 
@@ -187,9 +188,9 @@
     /* Workaround to stop PROJ reading values from defaults file when
      * rf (and sometimes ellps) is not specified */
     if (G_find_key_value("no_defs", in_proj_keys) == NULL) {
-        sprintf(buffa, "no_defs");
-        alloc_options(buffa);
-    }	    	    
+	sprintf(buffa, "no_defs");
+	alloc_options(buffa);
+    }
 
     /* If datum parameters are present in the PROJ_INFO keys, pass them on */
     if (GPJ__get_datum_params(in_proj_keys, &datum, &params) == 2) {
@@ -201,7 +202,7 @@
 	 * from the datum.table file */
     }
     else if (datum != NULL) {
-        
+
 	if (GPJ_get_default_datum_params_by_name(datum, &params) > 0) {
 	    sprintf(buffa, params);
 	    alloc_options(buffa);
@@ -227,15 +228,16 @@
     pj_set_finder(FINDERFUNC);
 
     if (!(pj = pj_init(nopt1, opt_in))) {
-	strcpy(buffa, _("Unable to initialise PROJ.4 with the following parameter list:"));
+	strcpy(buffa,
+	       _("Unable to initialise PROJ.4 with the following parameter list:"));
 	for (i = 0; i < nopt1; i++) {
 	    char err[50];
-	    sprintf (err, " +%s", opt_in[i]);
-	    strcat (buffa, err);
+
+	    sprintf(err, " +%s", opt_in[i]);
+	    strcat(buffa, err);
 	}
-	G_warning (buffa);
-	G_warning (_("The error message: %s"),
-		   pj_strerrno(pj_errno));
+	G_warning(buffa);
+	G_warning(_("The error message: %s"), pj_strerrno(pj_errno));
 	return -1;
     }
     info->pj = pj;
@@ -248,7 +250,7 @@
     int nsize;
 
     nsize = strlen(buffa);
-    opt_in[nopt1++] = (char *) G_malloc(nsize + 1);
+    opt_in[nopt1++] = (char *)G_malloc(nsize + 1);
     sprintf(opt_in[nopt1 - 1], buffa);
     return;
 }
@@ -273,7 +275,7 @@
 	sprintf(info->proj, "ll");
 	sprintf(buffa, "proj=latlong ellps=WGS84");
 	nsize = strlen(buffa);
-	opt_in[nopt] = (char *) G_malloc(nsize + 1);
+	opt_in[nopt] = (char *)G_malloc(nsize + 1);
 	sprintf(opt_in[nopt++], buffa);
     }
     else {
@@ -312,7 +314,7 @@
 			sprintf(buffa, s);
 		    }
 		    nsize = strlen(buffa);
-		    opt_in[nopt] = (char *) G_malloc(nsize + 1);
+		    opt_in[nopt] = (char *)G_malloc(nsize + 1);
 		    sprintf(opt_in[nopt++], buffa);
 		}
 	    }
@@ -324,7 +326,8 @@
     pj_set_finder(FINDERFUNC);
 
     if (!(pj = pj_init(nopt, opt_in))) {
-	G_warning (_("Unable to initialize pj cause: %s"), pj_strerrno(pj_errno));
+	G_warning(_("Unable to initialize pj cause: %s"),
+		  pj_strerrno(pj_errno));
 	return -1;
     }
     info->pj = pj;
@@ -399,9 +402,11 @@
     if (iproj) {
 	str = pj_get_def(iproj->pj, 1);
 	if (str != NULL) {
-	    fprintf (stderr, "%s: %s\n", _("Input Projection Parameters"), str);
+	    fprintf(stderr, "%s: %s\n", _("Input Projection Parameters"),
+		    str);
 	    G_free(str);
-	    fprintf (stderr, "%s: %.16g\n", _("Input Unit Factor"), iproj->meters);
+	    fprintf(stderr, "%s: %.16g\n", _("Input Unit Factor"),
+		    iproj->meters);
 	}
 	else
 	    return -1;
@@ -410,9 +415,11 @@
     if (oproj) {
 	str = pj_get_def(oproj->pj, 1);
 	if (str != NULL) {
-	    fprintf (stderr, "%s: %s\n", _("Output Projection Parameters"), str);
+	    fprintf(stderr, "%s: %s\n", _("Output Projection Parameters"),
+		    str);
 	    G_free(str);
-	    fprintf (stderr, "%s: %.16g\n", _("Output Unit Factor"), oproj->meters);
+	    fprintf(stderr, "%s: %.16g\n", _("Output Unit Factor"),
+		    oproj->meters);
 	}
 	else
 	    return -1;



More information about the grass-commit mailing list