diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/animation/qpropertyanimation.cpp | 16 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 54 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.h | 1 | ||||
-rw-r--r-- | src/gui/text/qfontengine_qws.cpp | 6 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 4 | ||||
-rw-r--r-- | src/plugins/graphicssystems/opengl/main.cpp | 10 | ||||
-rw-r--r-- | src/s60main/qts60main.cpp | 1 | ||||
-rw-r--r-- | src/s60main/qts60main_mcrt0.cpp | 2 |
8 files changed, 65 insertions, 29 deletions
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index d6ded62..b64d7df 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -106,13 +106,19 @@ void QPropertyAnimationPrivate::updateMetaProperty() return; } + //propertyType will be set to a valid type only if there is a Q_PROPERTY + //otherwise it will be set to QVariant::Invalid at the end of this function propertyType = targetValue->property(propertyName).userType(); propertyIndex = targetValue->metaObject()->indexOfProperty(propertyName); - if (propertyIndex == -1 && !targetValue->dynamicPropertyNames().contains(propertyName)) - qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData()); if (propertyType != QVariant::Invalid) convertValues(propertyType); + if (propertyIndex == -1) { + //there is no Q_PROPERTY on the object + propertyType = QVariant::Invalid; + if (!targetValue->dynamicPropertyNames().contains(propertyName)) + qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData()); + } } void QPropertyAnimationPrivate::updateProperty(const QVariant &newValue) @@ -125,7 +131,7 @@ void QPropertyAnimationPrivate::updateProperty(const QVariant &newValue) return; } - if (propertyIndex != -1 && newValue.userType() == propertyType) { + if (newValue.userType() == propertyType) { //no conversion is needed, we directly call the QObject::qt_metacall void *data = const_cast<void*>(newValue.constData()); targetValue->qt_metacall(QMetaObject::WriteProperty, propertyIndex, &data); @@ -273,9 +279,9 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState, if (oldState == Stopped) { d->setDefaultStartEndValue(d->targetValue->property(d->propertyName.constData())); //let's check if we have a start value and an end value - if (d->direction == Forward && !startValue().isValid() && !d->defaultStartEndValue.isValid()) + if (!startValue().isValid() && (d->direction == Backward || !d->defaultStartEndValue.isValid())) qWarning("QPropertyAnimation::updateState: starting an animation without start value"); - if (d->direction == Backward && !endValue().isValid() && !d->defaultStartEndValue.isValid()) + if (!endValue().isValid() && (d->direction == Forward || !d->defaultStartEndValue.isValid())) qWarning("QPropertyAnimation::updateState: starting an animation without end value"); } } else if (hash.value(key) == this) { diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 6d55ef9..d8557e5 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -47,6 +47,7 @@ #include "qlocale.h" #include "qlocale_p.h" #include "qunicodetables_p.h" +#include "qscopedpointer.h" #ifndef QT_NO_DATASTREAM #include <qdatastream.h> #endif @@ -535,38 +536,49 @@ QByteArray qUncompress(const uchar* data, int nbytes) ulong expectedSize = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3] ); ulong len = qMax(expectedSize, 1ul); - QByteArray baunzip; - int res; - do { - QT_TRY { - baunzip.resize(len); - res = ::uncompress((uchar*)baunzip.data(), &len, - (uchar*)data+4, nbytes-4); - } QT_CATCH (const std::bad_alloc &) { - res = Z_MEM_ERROR; + QScopedPointer<QByteArray::Data, QScopedPointerPodDeleter> d; + + forever { + ulong alloc = len; + d.reset(q_check_ptr(static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + alloc)))); + if (!d) { + // we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS + qWarning("qUncompress: could not allocate enough memory to uncompress data"); + return QByteArray(); } + int res = ::uncompress((uchar*)d->array, &len, + (uchar*)data+4, nbytes-4); + switch (res) { case Z_OK: - if ((int)len != baunzip.size()) - baunzip.resize(len); - break; + if (len != alloc) { + d.reset(q_check_ptr(static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + len)))); + if (!d) { + // we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS + qWarning("qUncompress: could not allocate enough memory to uncompress data"); + return QByteArray(); + } + } + d->ref = 1; + d->alloc = d->size = len; + d->data = d->array; + + return QByteArray(d.take(), 0, 0); + case Z_MEM_ERROR: qWarning("qUncompress: Z_MEM_ERROR: Not enough memory"); - break; + return QByteArray(); + case Z_BUF_ERROR: len *= 2; - break; + continue; + case Z_DATA_ERROR: qWarning("qUncompress: Z_DATA_ERROR: Input data is corrupted"); - break; + return QByteArray(); } - } while (res == Z_BUF_ERROR); - - if (res != Z_OK) - baunzip = QByteArray(); - - return baunzip; + } } #endif diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 191f6a2..9621dbf 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -372,6 +372,7 @@ private: friend class QByteRef; friend class QString; + friend QByteArray qUncompress(const uchar *data, int nbytes); public: typedef Data * DataPtr; inline DataPtr &data_ptr() { return d; } diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp index 62a674a..888e1be 100644 --- a/src/gui/text/qfontengine_qws.cpp +++ b/src/gui/text/qfontengine_qws.cpp @@ -381,6 +381,8 @@ class QFontEngineQPF1Data public: QPFFontMetrics fm; QPFGlyphTree *tree; + void *mmapStart; + size_t mmapLength; }; @@ -410,6 +412,8 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) QT_CLOSE(f); d = new QFontEngineQPF1Data; + d->mmapStart = data; + d->mmapLength = st.st_size; memcpy(reinterpret_cast<char*>(&d->fm),data,sizeof(d->fm)); data += sizeof(d->fm); @@ -431,6 +435,8 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) QFontEngineQPF1::~QFontEngineQPF1() { + if (d->mmapStart) + munmap(d->mmapStart, d->mmapLength); delete d->tree; delete d; } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 4427ee9..e32bbbd 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1405,8 +1405,8 @@ void QGL2PaintEngineEx::ensureActive() glViewport(0, 0, d->width, d->height); glDepthMask(false); glDepthFunc(GL_LESS); - setState(state()); d->needsSync = false; + setState(state()); } } @@ -1519,6 +1519,8 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) // qDebug("QGL2PaintEngineEx::clip()"); Q_D(QGL2PaintEngineEx); + ensureActive(); + if (op == Qt::ReplaceClip && !d->hasClipOperations()) op = Qt::IntersectClip; diff --git a/src/plugins/graphicssystems/opengl/main.cpp b/src/plugins/graphicssystems/opengl/main.cpp index 0562132..c28b09a 100644 --- a/src/plugins/graphicssystems/opengl/main.cpp +++ b/src/plugins/graphicssystems/opengl/main.cpp @@ -41,6 +41,7 @@ #include <private/qgraphicssystemplugin_p.h> #include <private/qgraphicssystem_gl_p.h> +#include <qgl.h> QT_BEGIN_NAMESPACE @@ -53,11 +54,18 @@ public: QStringList QGLGraphicsSystemPlugin::keys() const { - return QStringList(QLatin1String("OpenGL")); + QStringList list; + list << QLatin1String("OpenGL") << QLatin1String("OpenGL1"); + return list; } QGraphicsSystem* QGLGraphicsSystemPlugin::create(const QString& system) { + if (system.toLower() == QLatin1String("opengl1")) { + QGL::setPreferredPaintEngine(QPaintEngine::OpenGL); + return new QGLGraphicsSystem; + } + if (system.toLower() == QLatin1String("opengl")) return new QGLGraphicsSystem; diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp index a919593..725b17c 100644 --- a/src/s60main/qts60main.cpp +++ b/src/s60main/qts60main.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ // INCLUDE FILES +#include <exception> // must be before e32base.h so uncaught_exception gets defined #include <e32base.h> #include <qglobal.h> diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp index 9439d2a..d30e07a 100644 --- a/src/s60main/qts60main_mcrt0.cpp +++ b/src/s60main/qts60main_mcrt0.cpp @@ -48,8 +48,8 @@ // EPOC32 version of crt0.c for C programs which always want multi-threaded support #include <e32std.h> +#include <exception> // must be before e32base.h so uncaught_exception gets defined #include <e32base.h> -#include <exception> #include "estlib.h" // Needed for QT_TRYCATCH_LEAVING. |