[LLVMbugs] [Bug 15427] New: basic_istream::read(s, n) should use sgetn(s, n) rather than calling sbumpc() for each character.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Mar 3 01:33:38 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15427

            Bug ID: 15427
           Summary: basic_istream::read(s, n) should use sgetn(s, n)
                    rather than calling sbumpc() for each character.
           Product: libc++
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: tuhertz at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

basic_istream::read(s, n) should call basic_streambuf's sgetn(s, n) as
basic_ostream::write(s, n) calling sputn(s, n).

in basic_istream::read(char_type* __s, streamsize __n)

-         for (; __gc_ < __n; ++__gc_)
-            {
-               typename traits_type::int_type __i = this->rdbuf()->sbumpc();
-                if (traits_type::eq_int_type(__i, traits_type::eof()))
-                {
-                   this->setstate(ios_base::failbit | ios_base::eofbit);
-                   break;
-                }
-                *__s++ = traits_type::to_char_type(__i);
-            }

+          __gc_ = this->rdbuf()->sgetn(__s, __n);
+          if (__gc_ != __n)
+            this->setstate(ios_base::failbit | ios_base::eofbit);

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130303/63dcd62c/attachment.html>


More information about the llvm-bugs mailing list