critical bug in streams.

Sebastien Senechal seb at cyberdine.ca
Tue Oct 17 14:09:15 PDT 2006


Well

Using wxWidget 2.7.0-1
linked to DataStream.


// get socket stream
wxSocketOutputStream* socketStream = new wxSocketOutputStream(*m_sockClient);

// and address it as a Data stream
wxDataOutputStream* m_outputStream = new wxDataOutputStream(*socketStream);

	wxUint16 	var1 = 1;
	wxUint8 		var2 = 2;
	wxUint64 	var3 = 3;
	wxUint32 	var4 = 4;
	wxUint64 	var5 = 5;
	wxUint16 	var6 = 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/20061017/dc5b367a/attachment.htm


More information about the wx-users mailing list