aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@unitus.it>2003-06-18 21:13:18 +0200
committerPaolo Carlini <paolo@gcc.gnu.org>2003-06-18 19:13:18 +0000
commitb82a33d2a9dfc943324f34c60e4b231baa236eca (patch)
tree586cefbc08cd9ac16ec8f231a3d016705973004e /libstdc++-v3
parent4c526d09602ab32b5412501b42b4fbe95e8148d2 (diff)
downloadgcc-b82a33d2a9dfc943324f34c60e4b231baa236eca.zip
gcc-b82a33d2a9dfc943324f34c60e4b231baa236eca.tar.gz
gcc-b82a33d2a9dfc943324f34c60e4b231baa236eca.tar.bz2
std_sstream.h (setbuf): Check __n >= 0.
2003-06-18 Paolo Carlini <pcarlini@unitus.it> Benjamin Kosnik <bkoz@redhat.com> * include/std/std_sstream.h (setbuf): Check __n >= 0. * include/bits/fstream.tcc (setbuf): Tweak. Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com> From-SVN: r68163
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc2
-rw-r--r--libstdc++-v3/include/std/std_sstream.h8
3 files changed, 11 insertions, 5 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index fad6a08..ac0426e 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,4 +1,10 @@
2003-06-18 Paolo Carlini <pcarlini@unitus.it>
+ Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/std/std_sstream.h (setbuf): Check __n >= 0.
+ * include/bits/fstream.tcc (setbuf): Tweak.
+
+2003-06-18 Paolo Carlini <pcarlini@unitus.it>
* include/bits/sstream.tcc (seekoff): We can't seek beyond
_M_out_lim, therefore _M_move_out_cur boils down to simply
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index c0ef882..1327588 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -429,7 +429,7 @@ namespace std
{
if (!this->is_open() && __s == 0 && __n == 0)
this->_M_buf_size = 1;
- else if (__s && __n >= 1)
+ else if (__s && __n > 0)
{
// This is implementation-defined behavior, and assumes that
// an external char_type array of length __n exists and has
diff --git a/libstdc++-v3/include/std/std_sstream.h b/libstdc++-v3/include/std/std_sstream.h
index ca7b1e5..a720d35 100644
--- a/libstdc++-v3/include/std/std_sstream.h
+++ b/libstdc++-v3/include/std/std_sstream.h
@@ -208,12 +208,12 @@ namespace std
virtual __streambuf_type*
setbuf(char_type* __s, streamsize __n)
{
- if (__s && __n)
+ if (__s && __n >= 0)
{
// This is implementation-defined behavior, and assumes
- // that an external char_type array of length (__s + __n)
- // exists and has been pre-allocated. If this is not the
- // case, things will quickly blow up.
+ // that an external char_type array of length __n exists
+ // and has been pre-allocated. If this is not the case,
+ // things will quickly blow up.
// Step 1: Destroy the current internal array.
_M_string = __string_type(__s, __n);