[Boost-bugs] [ boost-Bugs-989487 ] wrong usage of ios_base::narrow

Bugs item #989487, was opened at 2004-07-12 22:03 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=107586&aid=989487&group_id=7586 Category: date_time Group: None Status: Open Resolution: None Priority: 5 Submitted By: Vyacheslav E. Andrejev (vandrejev) Assigned to: Jeff Garland (az_sw_dude) Summary: wrong usage of ios_base::narrow Initial Comment: /cvsroot/boost/boost/boost/date_time/date_parsing.hpp revision 1.18, lines 207, 214 std::stringstream has char_type typedef evidently equal to char, not wchar_t, so in std::stringstream::narrow function the first argument has type char and in the call ss << ss.narrow(*beg++, 'X'); *beg will be converted from wchar_t to char before call to narrow will be made. I suggest the following patch: diff -c -r1.18 date_parsing.hpp *************** *** 207,214 **** wchar_t) { std::stringstream ss(""); while(beg != end) { ! ss << ss.narrow(*beg++, 'X'); // 'X' will cause exception to be thrown } return parse_date<date_type>(ss.str()); } --- 207,215 ---- wchar_t) { std::stringstream ss(""); + std::locale loc; while(beg != end) { ! ss << std::use_facet<std::ctype<wchar_t> > (loc).narrow(*beg++, 'X'); } return parse_date<date_type>(ss.str()); } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=107586&aid=989487&group_id=7586 ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Boost-bugs mailing list Boost-bugs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/boost-bugs
participants (1)
-
SourceForge.net