[ https://issues.apache.org/jira/browse/QPID-3206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13019452#comment-13019452 ]
jirapos...@reviews.apache.org commented on QPID-3206: ----------------------------------------------------- bq. On 2011-04-13 14:44:16, Andrew Stitcher wrote: bq. > /trunk/qpid/cpp/src/qpid/types/Variant.cpp, line 114 bq. > <https://reviews.apache.org/r/596/diff/2/?file=15703#file15703line114> bq. > bq. > I think this test will do the wrong thing for -0. bq. > bq. > It's an annoying corner case but it does have a correct unsigned representation! bq. bq. Gordon Sim wrote: bq. Interestingly -0 fails to convert to an unsigned int in the existing code on the older compilers. bq. bq. Gordon Sim wrote: bq. Fixed now. Ok then, I suppose it depends how finicky we want to be! - Andrew ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/596/#review444 ----------------------------------------------------------- On 2011-04-13 16:13:56, Gordon Sim wrote: bq. bq. ----------------------------------------------------------- bq. This is an automatically generated e-mail. To reply, visit: bq. https://reviews.apache.org/r/596/ bq. ----------------------------------------------------------- bq. bq. (Updated 2011-04-13 16:13:56) bq. bq. bq. Review request for Andrew Stitcher, Alan Conway, Kenneth Giusti, Ted Ross, and Steve Huston. bq. bq. bq. Summary bq. ------- bq. bq. Add special test for negative numeric strings when converting to unsigned values. (It appears - though I could be wrong - that in basic form stringstream does not do any special handling of negatives for different locales. That appears only to be done for money values.) bq. bq. bq. This addresses bug QPID-3206. bq. https://issues.apache.org/jira/browse/QPID-3206 bq. bq. bq. Diffs bq. ----- bq. bq. /trunk/qpid/cpp/src/qpid/types/Variant.cpp 1090157 bq. /trunk/qpid/cpp/src/tests/Variant.cpp 1090157 bq. bq. Diff: https://reviews.apache.org/r/596/diff bq. bq. bq. Testing bq. ------- bq. bq. New tests included in patch bq. bq. bq. Thanks, bq. bq. Gordon bq. bq. > Variant converts from negative number in string format to unsigned integer > without error > ---------------------------------------------------------------------------------------- > > Key: QPID-3206 > URL: https://issues.apache.org/jira/browse/QPID-3206 > Project: Qpid > Issue Type: Bug > Components: C++ Broker, C++ Client > Affects Versions: 0.8, 0.10 > Reporter: Gordon Sim > Assignee: Gordon Sim > Fix For: 0.11 > > > E.g. > uint16_t i = 0; > qpid::types::Variant v = "-5"; > i = v; > The above results in an exception in older versions of gcc (e.g. 4.1.2) but > sets i to 65531 on later versions (e.g. 4.4.4). This is a result of a fix to > the gcc std library to be compliant with specification which requires > stringstream to accept negative values even for unsigned ints (which is the > behaviour of scanf). > See e.g: > http://boost.2283326.n4.nabble.com/conversion-lexical-cast-doesn-t-throw-td2593967.html > http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/97475b21515462c9/ce369a327fa39243#ce369a327fa39243 -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:dev-subscr...@qpid.apache.org