diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-08-20 13:38:15 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-22 04:24:00 +0200 |
commit | e04cadca4a6c0b43d29c83d23ac74393694a5ea5 (patch) | |
tree | aa495250e8fa420b6b262c76b1d5ad2050067cb9 /src/qml | |
parent | ff959399c9bd13e4c881cd6aa7f953dce92bda5b (diff) |
Fix compilation with MSVC 2008 (and prospective Windows CE build fix)
* Only 2010 and newer ship stdint.h, so for 2008 we have to provide a little
stdint.h compat header, for some of the third-party code we import. Our own
Qt code this patch changes to use quint* types instead.
* Include math.h and float.h for some math functions.
* disable the JIT on Windows CE for now.
* Change use of intptr_t to qintptr in Qt code. intptr_t is in inttypes.h,
except that with VS 2008 it is indirectly available through stdio.h. Let's
avoid the mess and just use the qt type, that's always available.
Change-Id: I19055edd89e0a6b147d9edbb3b711798ed3c05a5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4global_p.h | 3 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4mm.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4sequenceobject.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4unwindhelper_p-arm.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4unwindhelper_p-dw2.h | 4 | ||||
-rw-r--r-- | src/qml/qml/ftw/qhashedstring.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/ftw/qhashedstring_p.h | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmlabstractbinding_p.h | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmlaccessors_p.h | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmllocale.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlnotifier.cpp | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmlpropertycache_p.h | 2 |
12 files changed, 28 insertions, 27 deletions
diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h index c5a31eb555..d354e7646c 100644 --- a/src/qml/jsruntime/qv4global_p.h +++ b/src/qml/jsruntime/qv4global_p.h @@ -47,6 +47,9 @@ #include <qtqmlglobal.h> #if defined(Q_CC_MSVC) +#include <float.h> +#include <math.h> + namespace std { inline bool isinf(double d) { return !_finite(d) && !_isnan(d); } diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp index 0e53a2088f..095d27e1c0 100644 --- a/src/qml/jsruntime/qv4mm.cpp +++ b/src/qml/jsruntime/qv4mm.cpp @@ -150,7 +150,7 @@ MemoryManager::MemoryManager() // TLS is at the top of each thread's stack, // so the stack base for thread is the result of __tls() m_d->stackTop = reinterpret_cast<quintptr *>( - (((uintptr_t)__tls() + __PAGESIZE - 1) & ~(__PAGESIZE - 1))); + (((quintptr)__tls() + __PAGESIZE - 1) & ~(__PAGESIZE - 1))); #elif USE(PTHREADS) # if OS(DARWIN) void *st = pthread_get_stackaddr_np(pthread_self()); @@ -404,7 +404,7 @@ std::size_t MemoryManager::sweep(char *chunkStart, std::size_t chunkSize, size_t // qDebug("chunk @ %p, size = %lu, in use: %s, mark bit: %s", // chunk, m->size, (m->inUse ? "yes" : "no"), (m->markBit ? "true" : "false")); - assert((intptr_t) chunk % 16 == 0); + assert((qintptr) chunk % 16 == 0); if (m->inUse) { if (m->markBit) { diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index c4d9a71519..c248c9c524 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -454,8 +454,8 @@ public: static QVariant toVariant(QV4::ArrayObject *array) { Container result; - uint32_t length = array->arrayLength(); - for (uint32_t i = 0; i < length; ++i) + quint32 length = array->arrayLength(); + for (quint32 i = 0; i < length; ++i) result << convertValueToElement<typename Container::value_type>(array->getIndexed(i)); return QVariant::fromValue(result); } diff --git a/src/qml/jsruntime/qv4unwindhelper_p-arm.h b/src/qml/jsruntime/qv4unwindhelper_p-arm.h index 8f5febc3d5..740e6c8ca0 100644 --- a/src/qml/jsruntime/qv4unwindhelper_p-arm.h +++ b/src/qml/jsruntime/qv4unwindhelper_p-arm.h @@ -64,7 +64,7 @@ namespace QV4 { static void *removeThumbBit(void *addr) { - return reinterpret_cast<void*>(reinterpret_cast<intptr_t>(addr) & ~1u); + return reinterpret_cast<void*>(reinterpret_cast<qintptr>(addr) & ~1u); } static QMutex functionProtector; diff --git a/src/qml/jsruntime/qv4unwindhelper_p-dw2.h b/src/qml/jsruntime/qv4unwindhelper_p-dw2.h index 3a6204f991..c53d20612c 100644 --- a/src/qml/jsruntime/qv4unwindhelper_p-dw2.h +++ b/src/qml/jsruntime/qv4unwindhelper_p-dw2.h @@ -89,7 +89,7 @@ static const int initial_location_offset = 28; static const int address_range_offset = 32; #endif -void writeIntPtrValue(unsigned char *addr, intptr_t val) +void writeIntPtrValue(unsigned char *addr, qintptr val) { addr[0] = (val >> 0) & 0xff; addr[1] = (val >> 8) & 0xff; @@ -144,7 +144,7 @@ static void ensureUnwindInfo(Function *f) unsigned char *cie_and_fde = reinterpret_cast<unsigned char *>(info.data()); memcpy(cie_and_fde, cie_fde_data, sizeof(cie_fde_data)); - intptr_t ptr = static_cast<char *>(chunk->pages->base()) - static_cast<char *>(0); + qintptr ptr = static_cast<char *>(chunk->pages->base()) - static_cast<char *>(0); writeIntPtrValue(cie_and_fde + initial_location_offset, ptr); writeIntPtrValue(cie_and_fde + address_range_offset, chunk->pages->size()); diff --git a/src/qml/qml/ftw/qhashedstring.cpp b/src/qml/qml/ftw/qhashedstring.cpp index 7e6ea59ef9..40caaf379f 100644 --- a/src/qml/qml/ftw/qhashedstring.cpp +++ b/src/qml/qml/ftw/qhashedstring.cpp @@ -394,7 +394,7 @@ QString QHashedCStringRef::toUtf16() const QString rv; rv.resize(m_length); - writeUtf16((uint16_t*)rv.data()); + writeUtf16((quint16*)rv.data()); return rv; } diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h index 4815f787b6..9b7215f0ae 100644 --- a/src/qml/qml/ftw/qhashedstring_p.h +++ b/src/qml/qml/ftw/qhashedstring_p.h @@ -64,8 +64,6 @@ #include <stdlib.h> #endif -#include <stdint.h> - QT_BEGIN_NAMESPACE // Enable this to debug hash linking assumptions. @@ -164,7 +162,7 @@ public: QString toUtf16() const; inline int utf16length() const; inline void writeUtf16(QChar *) const; - inline void writeUtf16(uint16_t *) const; + inline void writeUtf16(quint16 *) const; private: friend class QHashedStringRef; @@ -232,7 +230,7 @@ public: void setQString(bool v) { if (v) next.setFlag(); else next.clearFlag(); } inline char *cStrData() const { return (char *)ckey; } - inline uint16_t *utf16Data() const { return (uint16_t *)strData->data(); } + inline quint16 *utf16Data() const { return (quint16 *)strData->data(); } inline bool equals(const QV4::Value &string) const { QString s = string.toQString(); @@ -1274,10 +1272,10 @@ int QHashedCStringRef::utf16length() const void QHashedCStringRef::writeUtf16(QChar *output) const { - writeUtf16((uint16_t *)output); + writeUtf16((quint16 *)output); } -void QHashedCStringRef::writeUtf16(uint16_t *output) const +void QHashedCStringRef::writeUtf16(quint16 *output) const { int l = m_length; const char *d = m_data; diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h index 7ac10a6d63..40d42d8284 100644 --- a/src/qml/qml/qqmlabstractbinding_p.h +++ b/src/qml/qml/qqmlabstractbinding_p.h @@ -171,7 +171,7 @@ private: // the vTables array are used for dispatching. // This saves a compiler-generated pointer to a compiler-generated vTable, and thus reduces // the binding object size by sizeof(void*). - uintptr_t m_nextBindingPtr; + qintptr m_nextBindingPtr; static VTable *vTables[]; inline const VTable *vtable() const { return vTables[bindingType()]; } @@ -200,7 +200,7 @@ QQmlAbstractBinding *QQmlAbstractBinding::nextBinding() const void QQmlAbstractBinding::setNextBinding(QQmlAbstractBinding *b) { - m_nextBindingPtr = uintptr_t(b) | (m_nextBindingPtr & 0x3); + m_nextBindingPtr = qintptr(b) | (m_nextBindingPtr & 0x3); } QQmlAbstractBinding::BindingType QQmlAbstractBinding::bindingType() const diff --git a/src/qml/qml/qqmlaccessors_p.h b/src/qml/qml/qqmlaccessors_p.h index 6df624eaf1..1a4aae0ef7 100644 --- a/src/qml/qml/qqmlaccessors_p.h +++ b/src/qml/qml/qqmlaccessors_p.h @@ -94,7 +94,7 @@ class QQmlNotifier; } while (false); #define QML_PRIVATE_ACCESSOR(clazz, cpptype, name, variable) \ - static void clazz ## _ ## name ## Read(QObject *o, intptr_t, void *rv) \ + static void clazz ## _ ## name ## Read(QObject *o, qintptr, void *rv) \ { \ clazz ## Private *d = clazz ## Private::get(static_cast<clazz *>(o)); \ *static_cast<cpptype *>(rv) = d->variable; \ @@ -105,15 +105,15 @@ class QQmlNotifier; class QQmlAccessors { public: - void (*read)(QObject *object, intptr_t property, void *output); - void (*notifier)(QObject *object, intptr_t property, QQmlNotifier **notifier); + void (*read)(QObject *object, qintptr property, void *output); + void (*notifier)(QObject *object, qintptr property, QQmlNotifier **notifier); }; namespace QQmlAccessorProperties { struct Property { const char *name; unsigned int nameLength; - intptr_t data; + qintptr data; QQmlAccessors *accessors; }; diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index c07144a66c..4694e33abd 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -416,7 +416,7 @@ QV4::Value QQmlNumberExtension::toLocaleString(QV4::SimpleCallContext *ctx) GET_LOCALE_DATA_RESOURCE(ctx->arguments[0]); - uint16_t format = 'f'; + quint16 format = 'f'; if (ctx->argumentCount > 1) { if (!ctx->arguments[1].isString()) V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments"); diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp index da016c90a5..3d4b260574 100644 --- a/src/qml/qml/qqmlnotifier.cpp +++ b/src/qml/qml/qqmlnotifier.cpp @@ -61,15 +61,15 @@ static Callback QQmlNotifier_callbacks[] = { void QQmlNotifier::emitNotify(QQmlNotifierEndpoint *endpoint, void **a) { - intptr_t originalSenderPtr; - intptr_t *disconnectWatch; + qintptr originalSenderPtr; + qintptr *disconnectWatch; if (!endpoint->isNotifying()) { originalSenderPtr = endpoint->senderPtr; disconnectWatch = &originalSenderPtr; - endpoint->senderPtr = intptr_t(disconnectWatch) | 0x1; + endpoint->senderPtr = qintptr(disconnectWatch) | 0x1; } else { - disconnectWatch = (intptr_t *)(endpoint->senderPtr & ~0x1); + disconnectWatch = (qintptr *)(endpoint->senderPtr & ~0x1); } if (endpoint->next) @@ -111,7 +111,7 @@ void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine qPrintable(engineName)); } - senderPtr = intptr_t(source); + senderPtr = qintptr(source); this->sourceSignal = sourceSignal; QQmlPropertyPrivate::flushSignal(source, sourceSignal); QQmlData *ddata = QQmlData::get(source, true); diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index daba6e856d..21fee28b02 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -205,7 +205,7 @@ public: }; struct { // When HasAccessors QQmlAccessors *accessors; - intptr_t accessorData; + qintptr accessorData; }; }; |