[GRASS-SVN] r33907 - grass/branches/develbranch_6/imagery/i.ortho.photo/libes

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 16 07:21:33 EDT 2008


Author: hamish
Date: 2008-10-16 07:21:33 -0400 (Thu, 16 Oct 2008)
New Revision: 33907

Modified:
   grass/branches/develbranch_6/imagery/i.ortho.photo/libes/cam_info.c
Log:
bugfix: camera name and ID can contain spaces, but %s stops at 1st whitespace; i18n; G_getl2

Modified: grass/branches/develbranch_6/imagery/i.ortho.photo/libes/cam_info.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/libes/cam_info.c	2008-10-16 11:19:55 UTC (rev 33906)
+++ grass/branches/develbranch_6/imagery/i.ortho.photo/libes/cam_info.c	2008-10-16 11:21:33 UTC (rev 33907)
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <grass/glocale.h>
 #include "orthophoto.h"
 #include <grass/ortholib.h>
 
@@ -17,38 +18,38 @@
     char fid_id[30];
     double Xf, Yf;
 
-    G_getl(buf, IN_BUF, fd);
+    G_getl2(buf, IN_BUF, fd);
     G_strip(buf);
-    if (sscanf(buf, "CAMERA NAME   %s \n", cam_name) == 1)
+    if (sscanf(buf, "CAMERA NAME   %[^\n]", cam_name) == 1)
 	strcpy(cam_info->cam_name, cam_name);
 
-    G_getl(buf, IN_BUF, fd);
+    G_getl2(buf, IN_BUF, fd);
     G_strip(buf);
-    if (sscanf(buf, "CAMERA ID     %s \n", cam_id) == 1)
+    if (sscanf(buf, "CAMERA ID     %[^\n]", cam_id) == 1)
 	strcpy(cam_info->cam_id, cam_id);
 
-    G_getl(buf, IN_BUF, fd);
+    G_getl2(buf, IN_BUF, fd);
     G_strip(buf);
     if (sscanf(buf, "CAMERA XP     %lf \n", &Xp) == 1)
 	cam_info->Xp = Xp;
 
-    G_getl(buf, IN_BUF, fd);
+    G_getl2(buf, IN_BUF, fd);
     G_strip(buf);
     if (sscanf(buf, "CAMERA YP     %lf \n", &Yp) == 1)
 	cam_info->Yp = Yp;
 
-    G_getl(buf, IN_BUF, fd);
+    G_getl2(buf, IN_BUF, fd);
     G_strip(buf);
     if (sscanf(buf, "CAMERA CFL    %lf \n", &CFL) == 1)
 	cam_info->CFL = CFL;
 
-    G_getl(buf, IN_BUF, fd);
+    G_getl2(buf, IN_BUF, fd);
     G_strip(buf);
     if (sscanf(buf, "NUM FID       %d \n", &num_fid) == 1)
 	cam_info->num_fid = num_fid;
 
     for (n = 0; n < cam_info->num_fid; n++) {
-	G_getl(buf, IN_BUF, fd);
+	G_getl2(buf, IN_BUF, fd);
 	G_strip(buf);
 	if (sscanf(buf, "%s %lf %lf", fid_id, &Xf, &Yf) == 3) {
 	    strcpy(cam_info->fiducials[n].fid_id, fid_id);
@@ -95,7 +96,8 @@
 
     fd = I_fopen_cam_file_old(camera);
     if (fd == NULL) {
-	G_warning("unable to open camera file %s in %s", camera, G_mapset());
+	G_warning(_("Unable to open camera file [%s] in [%s]"),
+		  camera, G_mapset());
 
 	return 0;
     }
@@ -103,7 +105,8 @@
     stat = I_read_cam_info(fd, cam_info);
     fclose(fd);
     if (stat < 0) {
-	G_warning("bad format in camera file %s in %s", camera, G_mapset());
+	G_warning(_("Bad format in camera file [%s] in [%s]"),
+		  camera, G_mapset());
 
 	return 0;
     }
@@ -118,7 +121,8 @@
 
     fd = I_fopen_cam_file_new(camera);
     if (fd == NULL) {
-	G_warning("unable to open camera file %s in %s", camera, G_mapset());
+	G_warning(_("Unable to open camera file [%s] in [%s]"),
+		  camera, G_mapset());
 
 	return 0;
     }



More information about the grass-commit mailing list