public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tsyvarev at ispras dot ru" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/37475] New: codecvt::do_in/do_out functions return "ok" when the output sequence has zero length Date: Thu, 11 Sep 2008 09:34:00 -0000 [thread overview] Message-ID: <bug-37475-16694@http.gcc.gnu.org/bugzilla/> (raw) The following member functions of the class codecvt<wchar_t, char, mbstate_t> result in(stateT& state, const externT* from, const externT* from_end, const externT*& from_next, internT* to, internT* to_limit, internT*& to_next) const and result out(stateT& state, const internT* from, const internT* from_end, const internT*& from_next, externT* to, externT* to_limit, externT*& to_next) const return "ok" if (to==to_limit) but (from < from_end), that is, when the output sequence contains no elements but the input sequence is not empty. However, as appears from the description of the functions' return values (22.2.1.5.2 p4), "partial" should be returned instead: ok - completed the conversion partial - not all source characters converted error - encountered a character in [from,from_end) that it could not convert noconv - internT and externT are the same type, and input sequence is identical to converted sequence Note that these functions do return "partial" if the output sequence is not empty but still not large enough to contain all converted characters from the input sequence, that is, if 0< (to_limit - to) < (from_end - from). andrew@Ubuntu:/mnt/hgfs/shared/temp/test$ g++ -Wall test.cpp && ./a.out Calls do_out() function when size of input sequenceis 2, output - 1: do_out() returns partial. Calls do_out() function when size of input sequenceis 2, output - 0: do_out() returns ok. Calls do_in() function when size of input sequenceis 2, output - 1: do_in() returns partial. Calls do_in() function when size of input sequenceis 2, output - 0: do_in() returns ok. andrew@Ubuntu:/mnt/hgfs/shared/temp/test$ g++ --version g++ (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- Summary: codecvt::do_in/do_out functions return "ok" when the output sequence has zero length Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tsyvarev at ispras dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37475
next reply other threads:[~2008-09-11 9:34 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-09-11 9:34 tsyvarev at ispras dot ru [this message] 2008-09-11 9:36 ` [Bug libstdc++/37475] " tsyvarev at ispras dot ru 2008-09-11 10:32 ` paolo dot carlini at oracle dot com 2008-09-11 17:40 ` [Bug libstdc++/37475] [DR 382] " paolo dot carlini at oracle dot com 2008-09-11 17:40 ` paolo dot carlini at oracle dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-37475-16694@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).