You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2008/12/04 22:58:44 UTC
[jira] Resolved: (STDCXX-1026) sgetn() fails to extract characters
from an unbuffered stream
[ https://issues.apache.org/jira/browse/STDCXX-1026?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Sebor resolved STDCXX-1026.
----------------------------------
Resolution: Fixed
Fixed in [r723461 | http://svn.apache.org/viewvc?rev=723461&view=rev].
Test passes. Will close after merging out to 4.3.0 and trunk.
> sgetn() fails to extract characters from an unbuffered stream
> -------------------------------------------------------------
>
> Key: STDCXX-1026
> URL: https://issues.apache.org/jira/browse/STDCXX-1026
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 27. Input/Output
> Affects Versions: 4.2.1
> Reporter: Martin Sebor
> Assignee: Martin Sebor
> Fix For: 4.2.2
>
> Original Estimate: 2h
> Time Spent: 2h
> Remaining Estimate: 0h
>
> This bug was uncovered in this [discussion | http://forums.sun.com/thread.jspa?messageID=10532349]:
> {noformat}
> $ cat t.cpp && make t && ./t
> #include <cassert>
> #include <istream>
> #include <streambuf>
> int main ()
> {
> static int x = '0';
> struct: std::streambuf {
> // unbuffered, always successfully reads one character
> int_type underflow () { return x++; }
> } sb;
> // "endless" stream that never reaches EOF
> std::istream endless (&sb);
> char s [4] = "";
> endless.read (s, sizeof s);
>
> // expect to extract as many characters as requested
> assert (endless.good ());
> assert (sizeof s == endless.gcount ());
> assert ('0' == s [0] && '1' == s [1] && '2' == s [2] && '3' == s [3]);
>
> }
> gcc -c -I/home/sebor/stdcxx-4.2.1/include/ansi \
> -I/home/sebor/stdcxx-4.2.1/include \
> -I/build/sebor/stdcxx-4.2.1-gcc-4.3.0-8D/include \
> -I/home/sebor/stdcxx-4.2.1/examples/include \
> -pedantic -nostdinc++ -O2 -W -Wall \
> -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align t.cpp
> t.cpp: In function 'int main()':
> t.cpp:9: warning: inlining failed in call to 'virtual main()::<anonymous struct>::~._26()': call is unlikely and code size would grow
> t.cpp:24: warning: called from here
> t.cpp:9: warning: inlining failed in call to 'virtual main()::<anonymous struct>::~._26()': call is unlikely and code size would grow
> t.cpp:24: warning: called from here
> gcc t.o -o t -L/build/sebor/stdcxx-4.2.1-gcc-4.3.0-8D/lib -Wl,-R/build/sebor/stdcxx-4.2.1-gcc-4.3.0-8D/lib -lstd8D -lsupc++ -lm
> t: t.cpp:22: int main(): Assertion `endless.good ()' failed.
> Aborted
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.