critical bug in streams.

Armel Asselin armelasselin at hotmail.com
Tue Oct 17 16:17:50 PDT 2006


this is just a little endian stream, while it is not usual as in general so=
cket order is big endian.
Armel

  "Sebastien Senechal" <seb at cyberdine.ca> a =E9crit dans le message de news=
: 200610171709.15592.seb at cyberdine.ca...

  Well


  Using wxWidget 2.7.0-1

  linked to DataStream.



  // get socket stream

  wxSocketOutputStream* socketStream =3D new wxSocketOutputStream(*m_sockCl=
ient);


  // and address it as a Data stream

  wxDataOutputStream* m_outputStream =3D new wxDataOutputStream(*socketStre=
am);


  wxUint16 var1 =3D 1;

  wxUint8 var2 =3D 2;

  wxUint64 var3 =3D 3;

  wxUint32 var4 =3D 4;

  wxUint64 var5 =3D 5;

  wxUint16 var6 =3D 6;


  m_outputStream << var1 << var2 << var3 << var4 << var5 << var6 ;


  gives

  < 00000000 01 00 02 03 00 00 00 00 00 00 00 04 00 00 00 05 # ............=
....

  < 00000010 00 00 00 00 00 00 00 06 00 00 00 00 00 # .............


  It seems a given variable is encoded with the previous variable type !!!!!

  var1 is encoded as 1 byte instead of 2

  var2 is encoded as 2 bytes instead of 1

  var3 is encoded as 1 bytes instead of 8

  var4 is encoded as 8 bytes instead of 4

  var5 is encoded as 4 bytes instead of 8

  var6 is encoded as 8 bytes instead of 2


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20061018/069=
dada1/attachment.htm


More information about the wx-users mailing list