Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Thiago Macieira
On sexta-feira, 8 de novembro de 2013 10:34:00, Andreas Aardal Hanssen wrote: > On 08 Nov 2013, at 10:15, Yves Bailly wrote: > > Le 08/11/2013 10:05, Giuseppe D'Angelo a écrit : > >> See QDataStream::setFloatingPointPrecision. The default is double. > > > > That's pretty strange... what if I want

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread André Somers
Andreas Aardal Hanssen schreef op 8-11-2013 13:28: On 08 Nov 2013, at 12:41, Yves Bailly > wrote: ]I would recommend against using QDataStream for anything else than reading back what was written using QDataStream. This is what I called a step backward. It's jus

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Andreas Aardal Hanssen
On 08 Nov 2013, at 12:41, Yves Bailly wrote: >> ]I would recommend against using QDataStream for anything else than reading >> back what was written using QDataStream. > This is what I called a step backward. It’s just stating a fact. QDataStream isn’t a generic cross-framework class, it’s not

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Giuseppe D'Angelo
On 8 November 2013 12:41, Yves Bailly wrote: > >> QDataStream is for Qt only, it’s incompatible with all other binary formats >> out there, with the undocumented exception for cases where primitive types >> match. > > Then maybe it should be stated more clearly in the doc? A big red blinking >

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Yves Bailly
On 08/11/2013 11:37, Andreas Aardal Hanssen wrote: > On 08 Nov 2013, at 11:32, André Somers wrote: >> Eskil Abrahamsen Blomfeldt schreef op 8-11-2013 11:20 >>> QDataStream supports reading and writing floats and doubles, but it >>> might use more bytes than necessary to represent them in the strea

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Christian Ehrlicher
Am 08.11.2013 10:42, schrieb André Somers: Christian Ehrlicher schreef op 8-11-2013 10:29: Am 08.11.2013 10:15, schrieb Yves Bailly: Le 08/11/2013 10:05, Giuseppe D'Angelo a écrit : On 8 November 2013 10:01, Yves Bailly wrote: As a float is 4 bytes, I would expect the second f.pos() to displ

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Andreas Aardal Hanssen
On 08 Nov 2013, at 11:32, André Somers wrote: > Eskil Abrahamsen Blomfeldt schreef op 8-11-2013 11:20 >> >> QDataStream supports reading and writing floats and doubles, but it >> might use more bytes than necessary to represent them in the stream. >> the main ... > I don't see what's wrong wit

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread André Somers
Eskil Abrahamsen Blomfeldt schreef op 8-11-2013 11:20: > > QDataStream supports reading and writing floats and doubles, but it > might use more bytes than necessary to represent them in the stream. > > The main use case of QDataStream is to serialize Qt data in a portable, > binary form with the co

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Eskil Abrahamsen Blomfeldt
On 11/08/2013 11:03 AM, André Somers wrote: > Olivier Goffart schreef op 8-11-2013 10:57: >> On Friday 08 November 2013 10:42:16 Yves Bailly wrote: >> >>> I can understand this for high-level Qt objects, but what about lower-level >>> data? Does this mean I can't use QDataStream to read a file writ

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Olivier Goffart
On Friday 08 November 2013 11:03:40 André Somers wrote: > Olivier Goffart schreef op 8-11-2013 10:57: > > It was changed in Qt 4.6 for compatibility with qreal that > > can be float or double depending on the platform. > > Perhaps one could add a > > QDataStream::FloatingPointPrecision::AutoPreci

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread André Somers
Olivier Goffart schreef op 8-11-2013 10:57: > On Friday 08 November 2013 10:42:16 Yves Bailly wrote: > >> I can understand this for high-level Qt objects, but what about lower-level >> data? Does this mean I can't use QDataStream to read a file written by >> some other program, and/or can't use it

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Olivier Goffart
On Friday 08 November 2013 10:42:16 Yves Bailly wrote: > I can understand this for high-level Qt objects, but what about lower-level > data? Does this mean I can't use QDataStream to read a file written by > some other program, and/or can't use it to *write* a file which could be > read back by so

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread André Somers
Yves Bailly schreef op 8-11-2013 10:42: > Le 08/11/2013 10:29, Christian Ehrlicher a écrit : >> Am 08.11.2013 10:15, schrieb Yves Bailly: >>> Le 08/11/2013 10:05, Giuseppe D'Angelo a écrit : On 8 November 2013 10:01, Yves Bailly wrote: > As a float is 4 bytes, I would expect the second f.

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread André Somers
Christian Ehrlicher schreef op 8-11-2013 10:29: Am 08.11.2013 10:15, schrieb Yves Bailly: Le 08/11/2013 10:05, Giuseppe D'Angelo a écrit : On 8 November 2013 10:01, Yves Bailly wrote: As a float is 4 bytes, I would expect the second f.pos() to display "4"... but it displays "8", as if QDataSt

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Yves Bailly
Le 08/11/2013 10:29, Christian Ehrlicher a écrit : > Am 08.11.2013 10:15, schrieb Yves Bailly: >> Le 08/11/2013 10:05, Giuseppe D'Angelo a écrit : >>> On 8 November 2013 10:01, Yves Bailly wrote: As a float is 4 bytes, I would expect the second f.pos() to display "4"... but it disp

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Andreas Aardal Hanssen
On 08 Nov 2013, at 10:15, Yves Bailly wrote: > Le 08/11/2013 10:05, Giuseppe D'Angelo a écrit : >> See QDataStream::setFloatingPointPrecision. The default is double. > That's pretty strange... what if I want to read a float then a double? do I > have to switch between the two each time? > Does thi

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Christian Ehrlicher
Am 08.11.2013 10:15, schrieb Yves Bailly: > Le 08/11/2013 10:05, Giuseppe D'Angelo a écrit : >> On 8 November 2013 10:01, Yves Bailly wrote: >>> As a float is 4 bytes, I would expect the second f.pos() to display "4"... >>> but >>> it displays "8", as if QDataStream had moved 8 bytes ahead instea

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Yves Bailly
Le 08/11/2013 10:05, Giuseppe D'Angelo a écrit : > On 8 November 2013 10:01, Yves Bailly wrote: >> >> As a float is 4 bytes, I would expect the second f.pos() to display "4"... >> but >> it displays "8", as if QDataStream had moved 8 bytes ahead instead of just 4. >> Needless to say, the read flo

Re: [Development] Weird offseting in QDataStream

2013-11-08 Thread Giuseppe D'Angelo
On 8 November 2013 10:01, Yves Bailly wrote: > > As a float is 4 bytes, I would expect the second f.pos() to display "4"... but > it displays "8", as if QDataStream had moved 8 bytes ahead instead of just 4. > Needless to say, the read float is wrong... > > Am I missing something here, or is it a