changeset 4927:b7732e23965b

[project @ 2004-08-03 05:00:33 by jwe]
author jwe
date Tue, 03 Aug 2004 05:00:33 +0000
parents e80587ad9503
children 1cf16fb3459a
files src/ChangeLog src/oct-stream.cc
diffstat 2 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Aug 02 23:48:40 2004 +0000
+++ b/src/ChangeLog	Tue Aug 03 05:00:33 2004 +0000
@@ -1,3 +1,8 @@
+2004-08-03  John W. Eaton  <jwe@octave.org>
+
+	* oct-stream.cc (octave_scan): Avoid need for pushing two
+	characters back on the input stream.
+
 2004-08-02  John W. Eaton  <jwe@octave.org>
 
 	* oct-stream.cc (octave_scan): For %i format, recognize numbers
--- a/src/oct-stream.cc	Mon Aug 02 23:48:40 2004 +0000
+++ b/src/oct-stream.cc	Tue Aug 03 05:00:33 2004 +0000
@@ -1109,14 +1109,21 @@
 	  {
 	    if (c1 == '0')
 	      {
-		int c2 = is.peek ();
-
-		is.putback (c1);
+		int c2 = is.get ();
 
 		if (c2 == 'x' || c2 == 'X')
 		  is >> std::hex >> ref >> std::dec;
 		else
-		  is >> std::oct >> ref >> std::dec;
+		  {
+		    is.putback (c2);
+
+		    if (c2 == '0' || c2 == '1' || c2 == '2'
+			|| c2 == '3' || c2 == '4' || c2 == '5'
+			|| c2 == '6' || c2 == '7')
+		      is >> std::oct >> ref >> std::dec;
+		    else
+		      ref = 0;
+		  }
 	      }
 	    else
 	      {