From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7612 invoked by alias); 4 Jan 2003 10:26:03 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 7584 invoked by uid 71); 4 Jan 2003 10:26:01 -0000 Resent-Date: 4 Jan 2003 10:26:01 -0000 Resent-Message-ID: <20030104102601.7583.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, peturr02@ru.is Received: (qmail 7245 invoked by uid 61); 4 Jan 2003 10:23:52 -0000 Message-Id: <20030104102352.7244.qmail@sources.redhat.com> Date: Sat, 04 Jan 2003 10:26:00 -0000 From: peturr02@ru.is Reply-To: peturr02@ru.is To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: libstdc++/9169: filebuf output fails if codecvt<>::out returns noconv X-SW-Source: 2003-01/txt/msg00275.txt.bz2 List-Id: >Number: 9169 >Category: libstdc++ >Synopsis: filebuf output fails if codecvt<>::out returns noconv >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sat Jan 04 02:26:00 PST 2003 >Closed-Date: >Last-Modified: >Originator: peturr02@ru.is >Release: gcc-3.2.1 >Organization: >Environment: Red Hat Linux 8.0 >Description: If a codecvt facet that returns false from always_noconv(), but returns noconv from out() is installed in a filebuf, no output is produced. >How-To-Repeat: See attachment. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="noconvout.cc" Content-Disposition: inline; filename="noconvout.cc" #include #include #include #include #include #include #include using namespace std; class Cvt_to_upper : public codecvt { typedef codecvt Base; public: explicit Cvt_to_upper(size_t refs = 0) : Base(refs) { } protected: result do_in(state_type&, const extern_type* from, const extern_type* from_end, const extern_type*& from_next, intern_type* to, intern_type* to_end, intern_type*& to_next) const { while (from < from_end && to < to_end) *to++ = toupper(*from++); to_next = to; from_next = from; return from == from_end ? ok : partial; } bool do_always_noconv() const throw() { return false; } }; int main() { locale loc1; locale loc (loc1, new Cvt_to_upper); char name[] = "noconvXXXXXX"; mktemp(name); string str ("abcdefghijklmnopqrstuvwxyz"); string tmp; { ofstream out; out.imbue(loc); out.open(name); copy(str.begin(), str.end(), ostreambuf_iterator(out)); } { ifstream in; in.open(name); copy(istreambuf_iterator(in), istreambuf_iterator(), back_inserter(tmp)); } remove(name); cout << tmp << endl; assert(tmp.size() == str.size()); assert(tmp == str); return 0; }