Mercurial > hg > octave-lyh
changeset 8087:7d19f4f70c61
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 | 83646120b54c |
children | 3eda9aa17d7c |
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-09-03 Ben Abbott <bpabott@mac.com> * mappers.cc: Use eps(single) as tolerance for single precesion test.
--- a/src/ls-oct-ascii.cc +++ b/src/ls-oct-ascii.cc @@ -110,10 +110,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; } @@ -124,7 +124,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; }