[cig-commits] r8112 - cs/spatialdata-0.1/trunk/libsrc/geocoords

brad at geodynamics.org brad at geodynamics.org
Mon Oct 15 17:38:15 PDT 2007


Author: brad
Date: 2007-10-15 17:38:15 -0700 (Mon, 15 Oct 2007)
New Revision: 8112

Modified:
   cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.cc
Log:
Fixed bug in use of istream::putback(). Need to clear stream after use in this case.

Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.cc	2007-10-13 19:07:53 UTC (rev 8111)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.cc	2007-10-16 00:38:15 UTC (rev 8112)
@@ -181,12 +181,15 @@
       datumVert(cbuffer);
     } else if (0 == strcasecmp(token.c_str(), "projector")) {
       std::string rbuffer(buffer.str());
-      int i = rbuffer.length()-1;
-      while (i >= 0) {
+      int start = token.length();
+      int end = rbuffer.length();
+      for (int i=start; i < end; ++i)
 	if ('=' == rbuffer[i])
-	  break;
-	s.putback(rbuffer[i--]);
-      } // while
+	  start = i+1;
+      for (int i=start; i < end; ++i) {
+	s.putback(rbuffer[i]);
+      } // for
+      s.clear();
       if (0 == _pProjector)
 	_pProjector = new Projector;
       _pProjector->unpickle(s);
@@ -206,7 +209,5 @@
 			     "settings.");
 } // unpickle
 
-// version
-// $Id$
 
 // End of file 



More information about the cig-commits mailing list