Re: [Quickfix-developers] CharConvertor::convert( char value ) bug
Brought to you by:
orenmnero
|
From: Alexey Z. <ale...@in...> - 2005-07-05 19:23:28
|
Brian, I know what the problem is. See my posting: some changes in C++ version <http://sourceforge.net/mailarchive/forum.php?thread_id=7465814&forum_id=103> Alexey Zubko <alexey@in...> 2 2005-06-09 06:06 Is there a reason not to put this patch to the version? Regards, Alexey Zubko Infinium Capital Corporation (416) 360-7000 ext. 305 Brian Erst wrote: >Quick patch that would fix this problem (QF 1.9.4): > >FieldConverters.h: > >249 struct CharConvertor >250 { >251 static std::string convert( char value ) >252 { >++ if (value) >253 return std::string( 1, value ); >++ else >++ return std::string(""); >254 } > >The problem is that the std::string template either has a "feature" or >a "bug" that doesn't check if the results of a char-based >initialization will cause a weird disconnect between the encapsulated >C-string (c_str) and the length/size member. The size or length >reported from such an initialization will be "1", even though the >size/length of c_str is "0". > >Changing the initialization to use an empty string when the char value >is null should fix this problem. > >- Brian Erst >Thynk Software, Inc. > > > > >--- Alexey Zubko <ale...@in...> wrote: > > > >>QuickFIX Documentation: >>http://www.quickfixengine.org/quickfix/doc/html/index.html >>QuickFIX FAQ: >>http://www.quickfixengine.org/wikifix/index.php?QuickFixFAQ >>QuickFIX Support: http://www.quickfixengine.org/services.html >> >>Guys, >> >>I don't want to annoy you, but I think the following bug must be >>fixed. >>I reported about it early and I thought it would be a part of this >>release. >> >>I think quickfix must be more stable for this cases. At least throw >>something like InvalidFieldValue... >> >>Here is the example: >> >> char >>its_just_a_bug_or_wrong_input = >>'\0'; >>// oops! >> FIX::OrdStatus OrdStatus = >>its_just_a_bug_or_wrong_input; >> >> FIX::Message message; >> message.setField(OrdStatus); >> message.setField(FIX::TransactTime()); >> >>// now we send the message: >> std::string str; >> message.toString(str); // result: "9=26|39=" >> >> >> >>-- >> >>Regards, >> Alexey Zubko >> >>Infinium Capital Corporation >>(416) 360-7000 ext. 305 >> >> >> >>------------------------------------------------------- >>SF.Net email is sponsored by: Discover Easy Linux Migration >>Strategies >>from IBM. Find simple to follow Roadmaps, straightforward articles, >>informative Webcasts and more! Get everything you need to get up to >>speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click >>_______________________________________________ >>Quickfix-developers mailing list >>Qui...@li... >>https://lists.sourceforge.net/lists/listinfo/quickfix-developers >> >> >> > > > > |