This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] Minor tweak to streambuf
- From: Paolo Carlini <pcarlini at suse dot de>
- To: "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 21 Jul 2005 00:13:22 +0200
- Subject: [v3] Minor tweak to streambuf
Hi,
a minor adjustment dictated by consistency with other functions and by
the return type of streambuf::sputn.
Tested x86/x86_64-linux.
Paolo.
////////////
2005-07-20 Paolo Carlini <pcarlini@suse.de>
* include/bits/streambuf.tcc (xsgetn, xsputn): Use streamsize
instead of size_t.
* src/streambuf.cc (__copy_streambufs): Likewise.
Index: include/bits/streambuf.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/streambuf.tcc,v
retrieving revision 1.51
diff -u -r1.51 streambuf.tcc
--- include/bits/streambuf.tcc 24 Nov 2004 04:11:10 -0000 1.51
+++ include/bits/streambuf.tcc 20 Jul 2005 19:16:27 -0000
@@ -1,6 +1,6 @@
// Stream buffer classes -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -52,11 +52,11 @@
streamsize __ret = 0;
while (__ret < __n)
{
- const size_t __buf_len = this->egptr() - this->gptr();
+ const streamsize __buf_len = this->egptr() - this->gptr();
if (__buf_len)
{
- const size_t __remaining = __n - __ret;
- const size_t __len = std::min(__buf_len, __remaining);
+ const streamsize __remaining = __n - __ret;
+ const streamsize __len = std::min(__buf_len, __remaining);
traits_type::copy(__s, this->gptr(), __len);
__ret += __len;
__s += __len;
@@ -86,11 +86,11 @@
streamsize __ret = 0;
while (__ret < __n)
{
- const size_t __buf_len = this->epptr() - this->pptr();
+ const streamsize __buf_len = this->epptr() - this->pptr();
if (__buf_len)
{
- const size_t __remaining = __n - __ret;
- const size_t __len = std::min(__buf_len, __remaining);
+ const streamsize __remaining = __n - __ret;
+ const streamsize __len = std::min(__buf_len, __remaining);
traits_type::copy(this->pptr(), __s, __len);
__ret += __len;
__s += __len;
Index: src/streambuf.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/streambuf.cc,v
retrieving revision 1.1
diff -u -r1.1 streambuf.cc
--- src/streambuf.cc 15 Nov 2004 23:33:05 -0000 1.1
+++ src/streambuf.cc 20 Jul 2005 19:16:27 -0000
@@ -1,6 +1,6 @@
// Stream buffer classes -*- C++ -*-
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -45,10 +45,10 @@
traits_type::int_type __c = __sbin->sgetc();
while (!traits_type::eq_int_type(__c, traits_type::eof()))
{
- const size_t __n = __sbin->egptr() - __sbin->gptr();
+ const streamsize __n = __sbin->egptr() - __sbin->gptr();
if (__n > 1)
{
- const size_t __wrote = __sbout->sputn(__sbin->gptr(), __n);
+ const streamsize __wrote = __sbout->sputn(__sbin->gptr(), __n);
__sbin->gbump(__wrote);
__ret += __wrote;
if (__wrote < __n)
@@ -78,10 +78,10 @@
traits_type::int_type __c = __sbin->sgetc();
while (!traits_type::eq_int_type(__c, traits_type::eof()))
{
- const size_t __n = __sbin->egptr() - __sbin->gptr();
+ const streamsize __n = __sbin->egptr() - __sbin->gptr();
if (__n > 1)
{
- const size_t __wrote = __sbout->sputn(__sbin->gptr(), __n);
+ const streamsize __wrote = __sbout->sputn(__sbin->gptr(), __n);
__sbin->gbump(__wrote);
__ret += __wrote;
if (__wrote < __n)