changeset 11828:4c6738504366 release-3-0-x

ls-oct-ascii.{h,cc} (extract_keyword): accept \r as line ending character
author John W. Eaton <jwe@octave.org>
date Mon, 08 Sep 2008 12:45:53 -0400
parents 4b36e0cc57ed
children 5f6f05c2d69e
files src/ChangeLog src/ls-oct-ascii.cc src/ls-oct-ascii.h
diffstat 3 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+2008-09-08  John W. Eaton  <jwe@octave.org>
+
+	* ls-oct-ascii.cc (std::string extract_keyword (std::istream&,
+	const char *, const bool)): Also accept \r as line ending character.
+	* ls-oct-ascii.h (template <class T> bool extract_keyword
+	(std::istream&, const char *, T&, const bool)): Likewise.
+	(template <class T> bool extract_keyword (std::istream&, const
+	string_vector&, std::string&, T&, const bool)): Likewise.
+
 2008-08-27  Jaroslav Hajek  <highegg@gmail.com>
 
 	* DLD-FUNCTIONS/__glpk__.cc (F__glpk__): Initialize output vectors 
--- a/src/ls-oct-ascii.cc
+++ b/src/ls-oct-ascii.cc
@@ -108,10 +108,10 @@
 	      while (is.get (c) && (c == ' ' || c == '\t' || c == ':'))
 		; // Skip whitespace and the colon.
 
-	      if (c != '\n')
+	      if (c != '\n' && c != '\r')
 		{
 		  value << c;
-		  while (is.get (c) && c != '\n')
+		  while (is.get (c) && c != '\n' && c != '\r')
 		    value << c;
 		}
 
@@ -122,7 +122,7 @@
 	    break;
 	  else
 	    {
-	      while (is.get (c) && c != '\n')
+	      while (is.get (c) && c != '\n' && c != '\r')
 		; // Skip to end of line.
 	    }
 	}
--- a/src/ls-oct-ascii.h
+++ b/src/ls-oct-ascii.h
@@ -99,11 +99,11 @@
 		; // Skip whitespace and the colon.
 
 	      is.putback (c);
-	      if (c != '\n')
+	      if (c != '\n' && c != '\r')
 		is >> value;
 	      if (is)
 		status = true;
-	      while (is.get (c) && c != '\n')
+	      while (is.get (c) && c != '\n' && c != '\r')
 		; // Skip to beginning of next line;
 	      break;
 	    }
@@ -161,11 +161,11 @@
 		    ; // Skip whitespace and the colon.
 
 		  is.putback (c);
-		  if (c != '\n')
+		  if (c != '\n' && c != '\r')
 		    is >> value;
 		  if (is)
 		    status = true;
-		  while (is.get (c) && c != '\n')
+		  while (is.get (c) && c != '\n' && c != '\r')
 		    ; // Skip to beginning of next line;
 		  return status;
 		}