mirror of
https://github.com/Ponce/slackbuilds
synced 2024-12-05 00:55:44 +01:00
aa1f82bec5
Added also a couple of patches from git Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
159 lines
5.6 KiB
Diff
159 lines
5.6 KiB
Diff
From: Richard Kreckel <kreckel@ginac.de>
|
|
Date: Sun, 18 Mar 2012 23:35:03 +0000 (+0100)
|
|
Subject: Avoid input stream fail state when reading number at EOF.
|
|
X-Git-Url: http://www.ginac.de/CLN/cln.git/?p=cln.git;a=commitdiff_plain;h=4985c8a7895076df62758466c86cd1bc9df10438
|
|
|
|
Avoid input stream fail state when reading number at EOF.
|
|
|
|
istream::get() puts the stream in fail state when trying to read at
|
|
EOF. This is best avoided by first peek()ing what is available.
|
|
---
|
|
|
|
diff --git a/README b/README
|
|
index 7de3f55..d445d55 100644
|
|
--- a/README
|
|
+++ b/README
|
|
@@ -1,8 +1,8 @@
|
|
Class Library for Numbers
|
|
|
|
Copyright (c) Bruno Haible 1988-2008
|
|
-Copyright (c) Richard Kreckel 2000-2009
|
|
-Copyright (c) Alexei Sheplyakov 2008
|
|
+Copyright (c) Richard Kreckel 2000-2012
|
|
+Copyright (c) Alexei Sheplyakov 2008-2010
|
|
|
|
GPL
|
|
|
|
diff --git a/doc/cln.texi b/doc/cln.texi
|
|
index 354cacc..d5ed502 100644
|
|
--- a/doc/cln.texi
|
|
+++ b/doc/cln.texi
|
|
@@ -36,7 +36,7 @@ Published by Bruno Haible, @code{<haible@@clisp.cons.org>} and
|
|
Richard B. Kreckel, @code{<kreckel@@ginac.de>}.
|
|
|
|
Copyright (C) Bruno Haible 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008.
|
|
-Copyright (C) Richard B. Kreckel 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011.
|
|
+Copyright (C) Richard B. Kreckel 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012.
|
|
Copyright (C) Alexei Sheplyakov 2008, 2010.
|
|
|
|
Permission is granted to make and distribute verbatim copies of
|
|
diff --git a/src/base/cl_free.cc b/src/base/cl_free.cc
|
|
index ccda8af..a829aa2 100644
|
|
--- a/src/base/cl_free.cc
|
|
+++ b/src/base/cl_free.cc
|
|
@@ -34,8 +34,8 @@ void cl_free_heap_object (cl_heap* pointer)
|
|
static const char * copyright_notice[] = {
|
|
" \n"
|
|
"Copyright (c) Bruno Haible 1988-2008 \n"
|
|
- "Copyright (c) Richard Kreckel 2000-2009 \n"
|
|
- "Copyright (c) Alexei Sheplyakov 2008 \n"
|
|
+ "Copyright (c) Richard Kreckel 2000-2012 \n"
|
|
+ "Copyright (c) Alexei Sheplyakov 2008-2010 \n"
|
|
" \n"
|
|
"This program is free software; you can redistribute it and/or modify\n"
|
|
"it under the terms of the GNU General Public License as published by\n"
|
|
diff --git a/src/complex/input/cl_N_read_stream.cc b/src/complex/input/cl_N_read_stream.cc
|
|
index 139af04..fc207aa 100644
|
|
--- a/src/complex/input/cl_N_read_stream.cc
|
|
+++ b/src/complex/input/cl_N_read_stream.cc
|
|
@@ -91,13 +91,10 @@ const cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
|
|
goto syntax1;
|
|
loop {
|
|
buffer.push(c);
|
|
- c = stream.get();
|
|
- if (stream.eof() || stream.fail())
|
|
- break;
|
|
- if (!number_char_p(c)) {
|
|
- stream.putback(c);
|
|
+ c = stream.peek(); // Avoid fail state on EOF.
|
|
+ if (stream.eof() || stream.fail() || !number_char_p(c))
|
|
break;
|
|
- }
|
|
+ c = stream.get();
|
|
}
|
|
done:
|
|
// Parse the number.
|
|
diff --git a/src/float/input/cl_F_read_stream.cc b/src/float/input/cl_F_read_stream.cc
|
|
index baafc3b..044e4d6 100644
|
|
--- a/src/float/input/cl_F_read_stream.cc
|
|
+++ b/src/float/input/cl_F_read_stream.cc
|
|
@@ -82,13 +82,10 @@ const cl_F read_float (std::istream& stream, const cl_read_flags& flags)
|
|
goto syntax1;
|
|
loop {
|
|
buffer.push(c);
|
|
- c = stream.get();
|
|
- if (stream.eof() || stream.fail())
|
|
- break;
|
|
- if (!number_char_p(c)) {
|
|
- stream.putback(c);
|
|
+ c = stream.peek(); // Avoid fail state on EOF.
|
|
+ if (stream.eof() || stream.fail() || !number_char_p(c))
|
|
break;
|
|
- }
|
|
+ c = stream.get();
|
|
}
|
|
// Parse the number.
|
|
return read_float(flags,
|
|
diff --git a/src/integer/input/cl_I_read_stream.cc b/src/integer/input/cl_I_read_stream.cc
|
|
index 227d845..b242ae7 100644
|
|
--- a/src/integer/input/cl_I_read_stream.cc
|
|
+++ b/src/integer/input/cl_I_read_stream.cc
|
|
@@ -82,13 +82,10 @@ const cl_I read_integer (std::istream& stream, const cl_read_flags& flags)
|
|
goto syntax1;
|
|
loop {
|
|
buffer.push(c);
|
|
- c = stream.get();
|
|
- if (stream.eof() || stream.fail())
|
|
- break;
|
|
- if (!number_char_p(c)) {
|
|
- stream.putback(c);
|
|
+ c = stream.peek(); // Avoid fail state on EOF.
|
|
+ if (stream.eof() || stream.fail() || !number_char_p(c))
|
|
break;
|
|
- }
|
|
+ c = stream.get();
|
|
}
|
|
// Parse the number.
|
|
return read_integer(flags,
|
|
diff --git a/src/rational/input/cl_RA_read_stream.cc b/src/rational/input/cl_RA_read_stream.cc
|
|
index bba1d03..9e5f4f6 100644
|
|
--- a/src/rational/input/cl_RA_read_stream.cc
|
|
+++ b/src/rational/input/cl_RA_read_stream.cc
|
|
@@ -83,13 +83,10 @@ const cl_RA read_rational (std::istream& stream, const cl_read_flags& flags)
|
|
goto syntax1;
|
|
loop {
|
|
buffer.push(c);
|
|
- c = stream.get();
|
|
- if (stream.eof() || stream.fail())
|
|
- break;
|
|
- if (!number_char_p(c)) {
|
|
- stream.putback(c);
|
|
+ c = stream.peek(); // Avoid fail state on EOF.
|
|
+ if (stream.eof() || stream.fail() || !number_char_p(c))
|
|
break;
|
|
- }
|
|
+ c = stream.get();
|
|
}
|
|
// Parse the number.
|
|
return read_rational(flags,
|
|
diff --git a/src/real/input/cl_R_read_stream.cc b/src/real/input/cl_R_read_stream.cc
|
|
index 56b01d3..c032eee 100644
|
|
--- a/src/real/input/cl_R_read_stream.cc
|
|
+++ b/src/real/input/cl_R_read_stream.cc
|
|
@@ -82,13 +82,10 @@ const cl_R read_real (std::istream& stream, const cl_read_flags& flags)
|
|
goto syntax1;
|
|
loop {
|
|
buffer.push(c);
|
|
- c = stream.get();
|
|
- if (stream.eof() || stream.fail())
|
|
- break;
|
|
- if (!number_char_p(c)) {
|
|
- stream.putback(c);
|
|
+ c = stream.peek(); // Avoid fail state on EOF.
|
|
+ if (stream.eof() || stream.fail() || !number_char_p(c))
|
|
break;
|
|
- }
|
|
+ c = stream.get();
|
|
}
|
|
// Parse the number.
|
|
return read_real(flags,
|