critical bug in streams.

Chris Wilson chris at qwirx.com
Tue Oct 17 14:15:58 PDT 2006


Hi Sebastien,

On Tue, 17 Oct 2006, Sebastien Senechal wrote:

> 	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 !!!!!

Are you sure? Looking at this byte stream, one could just aswell say that 
it is in little endian order (lowest byte first), and

01 00 => var1
02 => var2
03 00 00 00 00 00 00 00 => var3
04 00 00 00 => var4

etc.

I haven't used wxDataOutputStream or checked the code, so I can't be sure 
of this. But it makes sense to me.

Cheers, Chris.
-- 
_ ___ __     _
  / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |





More information about the wx-users mailing list