Re: [Quickfix-developers] Rawdata field
Brought to you by:
orenmnero
|
From: Caleb E. <cal...@gm...> - 2005-05-31 15:49:55
|
On 5/31/05, Alexey Zubko <ale...@in...> wrote:
> Enclosed are the logs.
I actually get crashes trying to send the last message in that
.outgoing file (the one with the 0xA4 bytes in RawData). It looks
like the CheckSum calculation gets messed up by high-bit ASCII
characters and goes negative, which is out-of-spec. This patch fixes
the problem.
diff -u -b -u -p -r1.18 Field.h=20
--- Field.h 28 Dec 2004 15:23:26 -0000 1.18=20
+++ Field.h 31 May 2005 15:44:37 -0000=20
@@ -121,7 +121,10 @@ private:=20
m_length =3D m_data.length();=20
}=20
=20
- const char* iter =3D m_data.c_str();=20
+ // Treat strings as unsigned in case values contain high-bit=20
+ // chars. Don't want checksum to go negative.=20
+ const unsigned char* iter =3D=20
+ reintepret_cast<const unsigned char*> (m_data.c_str());=20
m_total =3D std::accumulate( iter, iter + m_length, 0 );=20
=20
m_calculated =3D true;=20
--=20
Caleb Epstein
caleb dot epstein at gmail dot com
|