From: Glenn Watson Date: Wed, 20 Jun 2012 01:36:31 +0000 (+1000) Subject: Fix some of the bundle test failures on Windows. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=0bc4a13048c030d52fd37debba0e934e1dd49b83;p=konrad%2Fqtdeclarative.git Fix some of the bundle test failures on Windows. The Q_PACKED macro is not supported on Windows, so the code that serializes the bundles does not work with the loading code. Change the maximum bundle size to 4 GB so that struct packing is not required. Change-Id: Ia7c8aa856ac532732eb6e76df813f46acd66b6f2 Reviewed-by: Martin Jones --- diff --git a/src/qml/qml/qqmlbundle.cpp b/src/qml/qml/qqmlbundle.cpp index fa47cb5..622242c 100644 --- a/src/qml/qml/qqmlbundle.cpp +++ b/src/qml/qml/qqmlbundle.cpp @@ -65,7 +65,7 @@ const char *QQmlBundle::FileEntry::contents() const { return &data[fileNameLength]; } -quint64 QQmlBundle::FileEntry::fileSize() const +quint32 QQmlBundle::FileEntry::fileSize() const { return size - (sizeof(FileEntry) + fileNameLength); } @@ -174,7 +174,7 @@ bool QQmlBundle::isBundleHeader(const char *data, int size) // // find a some empty space we can use to insert new entries. // -const QQmlBundle::Entry *QQmlBundle::findInsertPoint(quint64 size, qint64 *offset) +const QQmlBundle::Entry *QQmlBundle::findInsertPoint(quint32 size, qint32 *offset) { const char *ptr = (const char *) buffer + qmlBundleHeaderLength; const char *end = (const char *) buffer + bufferSize; @@ -255,7 +255,7 @@ bool QQmlBundle::add(const QString &name, const QString &fileName) file.seek(file.size()); FileEntry cmd; - const quint64 inputFileSize = inputFile.size(); + const quint32 inputFileSize = inputFile.size(); cmd.kind = Entry::File; cmd.link = 0; @@ -298,7 +298,7 @@ bool QQmlBundle::addMetaLink(const QString &fileName, FileEntry cmd; - const quint64 inputFileSize = data.size(); + const quint32 inputFileSize = data.size(); cmd.kind = Entry::Link; cmd.link = fileEntry->link; diff --git a/src/qml/qml/qqmlbundle_p.h b/src/qml/qml/qqmlbundle_p.h index 8c2cc55..c34e2d9 100644 --- a/src/qml/qml/qqmlbundle_p.h +++ b/src/qml/qml/qqmlbundle_p.h @@ -57,7 +57,7 @@ class Q_QML_PRIVATE_EXPORT QQmlBundle { Q_DISABLE_COPY(QQmlBundle) public: - struct Q_PACKED Q_QML_PRIVATE_EXPORT Entry + struct Q_QML_PRIVATE_EXPORT Entry { enum Kind { File = 123, // Normal file @@ -68,24 +68,24 @@ public: }; int kind; - quint64 size; + quint32 size; }; - struct Q_PACKED Q_QML_PRIVATE_EXPORT RawEntry : public Entry + struct Q_QML_PRIVATE_EXPORT RawEntry : public Entry { char data[]; // trailing data }; - struct Q_PACKED Q_QML_PRIVATE_EXPORT FileEntry : public Entry + struct Q_QML_PRIVATE_EXPORT FileEntry : public Entry { - quint64 link; + quint32 link; int fileNameLength; char data[]; // trailing data QString fileName() const; bool isFileName(const QString &) const; - quint64 fileSize() const; + quint32 fileSize() const; const char *contents() const; }; @@ -112,12 +112,12 @@ public: static int bundleHeaderLength(); static bool isBundleHeader(const char *, int size); private: - const Entry *findInsertPoint(quint64 size, qint64 *offset); + const Entry *findInsertPoint(quint32 size, qint32 *offset); private: QFile file; uchar *buffer; - quint64 bufferSize; + quint32 bufferSize; bool opened:1; bool headerWritten:1; };