← Back to team overview

mudlet-makers team mailing list archive

[Bug 1471508] [NEW] No Qt QDatastream version control handling

 

Public bug reported:

In https://bugs.launchpad.net/mudlet/+bug/1471406 several issues were
mentioned, this is one specific issue:

The Qt documents note:
"
QDataStream's binary format has evolved since Qt 1.0, and is likely to continue evolving to reflect changes done in Qt. When inputting or outputting complex types, it's very important to make sure that the same version of the stream (version()) is used for reading and writing. If you need both forward and backward compatibility, you can hardcode the version number in the application:

stream.setVersion(QDataStream::Qt_4_0);
"

We do not currently do this, so, theoretically if someone tries to load
a map file format version 4 (the earliest that we still support) there
is no guarantee that the current Qt libraries will parse the serialized
bytes in the same manner as they did in the past - however by addressing
that, this become an issue that we can solve for the future.

I would suggest that for the moment we use Qt_4_6 WHEN WRITING as I
think that will be compatible with what was used when the binaries for
Mudlet 2.1 were created.

I have checked the differences between Qt_4_8 (which is THE SAME as
Qt_4_6, QDataStream enum value 12) and the current (Qt_5_4 enum value
16) and the differences are:

QDateTime:
    Date (QDate)
    Time (QTime)
    0 for Qt::LocalTime,
    1 for Qt::UTC (quint8)
*** ONLY IN Qt_5_4 ***
    2 for Qt::OffsetFromUTC = An offset in seconds from Coordinated Universal Time.
    3 for Qt::TimeZone = A named time zone using a specific set of Daylight Savings rules.
**********************

*** Only in Qt_5_4
QMargins:
    left (int)
    top (int)
    right (int)
    bottom (int)

QRegularExpression:
    The regular expression pattern (QString)
    The pattern options (quint32)
***

In addition in:
QMatrix4x4
QQuaternion	
QVector2D	
QVector3D
QVector4D
*** In Qt_5_4 ***
    All the above have several elements that are ALL floats NOT doubles
***

The only ones that could be relevant to us here is QDateTime but we do
not (currently) save such a value in any of the different files AFAICT
and QVector3D (which is unused) in two places in TArea as span and pos,
I'm not totally clear on the number of bytes used for a float and how
that compares to a double (more for the latter) so that ought to mean we
should be having problems but it is not clear that we are - I'll try to
download a windows binary version of 2.1 and see what happens if I
create a map with that and then load it into a current Mudlet version
compiled with Qt5.4...

UPDATE TO FOLLOW...(I need some sleep)

** Affects: mudlet
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Mudlet
Makers, which is subscribed to Mudlet.
https://bugs.launchpad.net/bugs/1471508

Title:
  No Qt QDatastream version control handling

Status in Mudlet the MUD client:
  New

Bug description:
  In https://bugs.launchpad.net/mudlet/+bug/1471406 several issues were
  mentioned, this is one specific issue:

  The Qt documents note:
  "
  QDataStream's binary format has evolved since Qt 1.0, and is likely to continue evolving to reflect changes done in Qt. When inputting or outputting complex types, it's very important to make sure that the same version of the stream (version()) is used for reading and writing. If you need both forward and backward compatibility, you can hardcode the version number in the application:

  stream.setVersion(QDataStream::Qt_4_0);
  "

  We do not currently do this, so, theoretically if someone tries to
  load a map file format version 4 (the earliest that we still support)
  there is no guarantee that the current Qt libraries will parse the
  serialized bytes in the same manner as they did in the past - however
  by addressing that, this become an issue that we can solve for the
  future.

  I would suggest that for the moment we use Qt_4_6 WHEN WRITING as I
  think that will be compatible with what was used when the binaries for
  Mudlet 2.1 were created.

  I have checked the differences between Qt_4_8 (which is THE SAME as
  Qt_4_6, QDataStream enum value 12) and the current (Qt_5_4 enum value
  16) and the differences are:

  QDateTime:
      Date (QDate)
      Time (QTime)
      0 for Qt::LocalTime,
      1 for Qt::UTC (quint8)
  *** ONLY IN Qt_5_4 ***
      2 for Qt::OffsetFromUTC = An offset in seconds from Coordinated Universal Time.
      3 for Qt::TimeZone = A named time zone using a specific set of Daylight Savings rules.
  **********************

  *** Only in Qt_5_4
  QMargins:
      left (int)
      top (int)
      right (int)
      bottom (int)

  QRegularExpression:
      The regular expression pattern (QString)
      The pattern options (quint32)
  ***

  In addition in:
  QMatrix4x4
  QQuaternion	
  QVector2D	
  QVector3D
  QVector4D
  *** In Qt_5_4 ***
      All the above have several elements that are ALL floats NOT doubles
  ***

  The only ones that could be relevant to us here is QDateTime but we do
  not (currently) save such a value in any of the different files AFAICT
  and QVector3D (which is unused) in two places in TArea as span and
  pos, I'm not totally clear on the number of bytes used for a float and
  how that compares to a double (more for the latter) so that ought to
  mean we should be having problems but it is not clear that we are -
  I'll try to download a windows binary version of 2.1 and see what
  happens if I create a map with that and then load it into a current
  Mudlet version compiled with Qt5.4...

  UPDATE TO FOLLOW...(I need some sleep)

To manage notifications about this bug go to:
https://bugs.launchpad.net/mudlet/+bug/1471508/+subscriptions


Follow ups

References