From d033442f92cfee0de952578044bbcb5e858ee835 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 22 Feb 2010 14:39:39 +0100 Subject: Imporve win64 support for mingw Reviewed-by: ogoffart --- src/activeqt/container/qaxbase.cpp | 4 +--- src/activeqt/container/qaxwidget.cpp | 34 +++++++++++++---------------- src/activeqt/control/qaxserverbase.cpp | 10 ++++----- src/corelib/kernel/qcoreapplication_win.cpp | 12 +++++----- src/corelib/thread/qmutex.cpp | 7 +++--- src/gui/kernel/qkeymapper_win.cpp | 2 +- src/gui/painting/qdrawhelper.cpp | 34 ++++++++++++++--------------- src/gui/painting/qdrawhelper_p.h | 2 +- src/gui/text/qfontengine_win.cpp | 6 ++--- src/qt3support/text/q3richtext.cpp | 2 +- src/qt3support/text/q3textstream.cpp | 2 +- src/qt3support/tools/q3gcache.cpp | 10 ++++----- src/qt3support/tools/q3gdict.cpp | 4 ++-- 13 files changed, 61 insertions(+), 68 deletions(-) diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index 02a29d9..7692749 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -1353,11 +1353,9 @@ bool QAxBase::initializeFromFile(IUnknown** ptr) // There seams to be a naming problem in mingw headers -#ifdef Q_CC_GNU -#ifndef COAUTHIDENTITY +#if defined(Q_CC_GNU) && !defined(COAUTHIDENTITY) && !defined(__MINGW64_VERSION_MAJOR) #define COAUTHIDENTITY AUTH_IDENTITY #endif -#endif /*! diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index 9149320..7d2dde7 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -77,25 +77,21 @@ // #define QAX_SUPPORT_BORDERSPACE // missing interface from win32api -#if defined(Q_CC_GNU) -# if !defined(IOleInPlaceObjectWindowless) -# undef INTERFACE -# define INTERFACE IOleInPlaceObjectWindowless - DECLARE_INTERFACE_(IOleInPlaceObjectWindowless,IOleInPlaceObject) - { - STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(GetWindow)(THIS_ HWND*) PURE; - STDMETHOD(ContextSensitiveHelp)(THIS_ BOOL) PURE; - STDMETHOD(InPlaceDeactivate)(THIS) PURE; - STDMETHOD(UIDeactivate)(THIS) PURE; - STDMETHOD(SetObjectRects)(THIS_ LPCRECT,LPCRECT) PURE; - STDMETHOD(ReactivateAndUndo)(THIS) PURE; - STDMETHOD(OnWindowMessage)(THIS_ UINT, WPARAM, LPARAM, LRESULT*) PURE; - STDMETHOD(GetDropTarget)(THIS_ IDropTarget**) PURE; - }; -# endif +#if defined(Q_CC_GNU) && !defined(__MINGW64_VERSION_MAJOR) + DECLARE_INTERFACE_(IOleInPlaceObjectWindowless,IOleInPlaceObject) + { + STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + STDMETHOD(GetWindow)(THIS_ HWND*) PURE; + STDMETHOD(ContextSensitiveHelp)(THIS_ BOOL) PURE; + STDMETHOD(InPlaceDeactivate)(THIS) PURE; + STDMETHOD(UIDeactivate)(THIS) PURE; + STDMETHOD(SetObjectRects)(THIS_ LPCRECT,LPCRECT) PURE; + STDMETHOD(ReactivateAndUndo)(THIS) PURE; + STDMETHOD(OnWindowMessage)(THIS_ UINT, WPARAM, LPARAM, LRESULT*) PURE; + STDMETHOD(GetDropTarget)(THIS_ IDropTarget**) PURE; + }; #endif #include "../shared/qaxtypes.h" diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index 5fa0aad..ce71490 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -1536,7 +1536,7 @@ HWND QAxServerBase::create(HWND hWndParent, RECT& rcPos) HINSTANCE hInst = (HINSTANCE)qAxInstance; EnterCriticalSection(&createWindowSection); QString cn(QLatin1String("QAxControl")); - cn += QString::number((int)ActiveXProc); + cn += QString::number((quintptr)ActiveXProc); if (!atom) { WNDCLASS wcTemp; wcTemp.style = CS_DBLCLKS; @@ -1599,10 +1599,10 @@ HMENU QAxServerBase::createPopup(QMenu *popup, HMENU oldMenu) ushort itemId; if (flags & MF_POPUP) { itemId = static_cast( - reinterpret_cast(createPopup(action->menu())) + reinterpret_cast(createPopup(action->menu())) ); } else { - itemId = static_cast(reinterpret_cast(action)); + itemId = static_cast(reinterpret_cast(action)); actionMap.remove(itemId); actionMap.insert(itemId, action); } @@ -1646,10 +1646,10 @@ void QAxServerBase::createMenu(QMenuBar *menuBar) ushort itemId; if (flags & MF_POPUP) { itemId = static_cast( - reinterpret_cast(createPopup(action->menu())) + reinterpret_cast(createPopup(action->menu())) ); } else { - itemId = static_cast(reinterpret_cast(action)); + itemId = static_cast(reinterpret_cast(action)); actionMap.insert(itemId, action); } AppendMenu(hmenuShared, flags, itemId, (const wchar_t *)action->text().utf16()); diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 5990f86..566626d 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -1021,14 +1021,14 @@ QString decodeMSG(const MSG& msg) LPWINDOWPOS winPos = (LPWINDOWPOS)lParam; if (!winPos) break; - QString hwndAfter = valueCheck((uint)winPos->hwndInsertAfter, - FLAG_STRING((uint)HWND_BOTTOM, "HWND_BOTTOM"), - FLAG_STRING((int)HWND_NOTOPMOST, "HWND_NOTOPMOST"), - FLAG_STRING((uint)HWND_TOP, "HWND_TOP"), - FLAG_STRING((int)HWND_TOPMOST, "HWND_TOPMOST"), + QString hwndAfter = valueCheck(quint64(winPos->hwndInsertAfter), + FLAG_STRING((quintptr)HWND_BOTTOM, "HWND_BOTTOM"), + FLAG_STRING((quintptr)HWND_NOTOPMOST, "HWND_NOTOPMOST"), + FLAG_STRING((quintptr)HWND_TOP, "HWND_TOP"), + FLAG_STRING((quintptr)HWND_TOPMOST, "HWND_TOPMOST"), FLAG_STRING()); if (hwndAfter.size() == 0) - hwndAfter = QString::number((uint)winPos->hwndInsertAfter, 16); + hwndAfter = QString::number((quintptr)winPos->hwndInsertAfter, 16); QString flags = flagCheck(winPos->flags, FLGSTR(SWP_DRAWFRAME), FLGSTR(SWP_FRAMECHANGED), diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index ec50ac8..43df13a 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -41,6 +41,7 @@ #include "qplatformdefs.h" #include "qmutex.h" +#include #ifndef QT_NO_THREAD #include "qatomic.h" @@ -159,8 +160,7 @@ void QMutex::lock() if (!isLocked) { #ifndef QT_NO_DEBUG if (d->owner == self) - qWarning("QMutex::lock: Deadlock detected in thread %ld", - long(d->owner)); + qWarning() << "QMutex::lock: Deadlock detected in thread" << d->owner; #endif // didn't get the lock, wait for it @@ -197,8 +197,7 @@ void QMutex::lock() if (!isLocked) { #ifndef QT_NO_DEBUG if (d->owner == self) - qWarning("QMutex::lock: Deadlock detected in thread %ld", - long(d->owner)); + qWarning() << "QMutex::lock: Deadlock detected in thread" << d->owner; #endif // didn't get the lock, wait for it diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp index 578f32a..e555c5c 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/gui/kernel/qkeymapper_win.cpp @@ -619,7 +619,7 @@ void QKeyMapperPrivate::clearMappings() /* MAKELCID()'s first argument is a WORD, and GetKeyboardLayout() * returns a DWORD. */ - LCID newLCID = MAKELCID((DWORD)GetKeyboardLayout(0), SORT_DEFAULT); + LCID newLCID = MAKELCID((quintptr)GetKeyboardLayout(0), SORT_DEFAULT); // keyboardInputLocale = qt_localeFromLCID(newLCID); bool bidi = false; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 070491d..fae26e0 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -3700,7 +3700,7 @@ template <> Q_STATIC_TEMPLATE_SPECIALIZATION inline quint32 alpha_4(const qargb8555 *src) { - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint8 *src8 = reinterpret_cast(src); return src8[0] << 24 | src8[3] << 16 | src8[6] << 8 | src8[9]; } @@ -4026,8 +4026,8 @@ template <> inline void interpolate_pixel_4(qargb8565 *dest, const qargb8565 *src, quint32 alpha) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = eff_alpha_4(alpha, dest); const quint32 ia = eff_ialpha_4(alpha, dest); @@ -4122,8 +4122,8 @@ template <> inline void interpolate_pixel_4(qargb8555 *dest, const qargb8555 *src, quint32 alpha) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = eff_alpha_4(alpha, dest); @@ -4218,8 +4218,8 @@ template <> inline void interpolate_pixel_4(qrgb888 *dest, const qrgb888 *src, quint32 alpha) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = eff_alpha_4(alpha, dest); const quint32 ia = eff_ialpha_4(alpha, dest); @@ -4291,8 +4291,8 @@ template inline void interpolate_pixel_4(DST *dest, quint8 a, const SRC *src, quint8 b) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); dest[0] = dest[0].byte_mul(a) + DST(src[0]).byte_mul(b); dest[1] = dest[1].byte_mul(a) + DST(src[1]).byte_mul(b); @@ -4303,8 +4303,8 @@ inline void interpolate_pixel_4(DST *dest, quint8 a, template inline void blend_sourceOver_4(DST *dest, const SRC *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { @@ -4319,8 +4319,8 @@ inline void blend_sourceOver_4(DST *dest, const SRC *src) template <> inline void blend_sourceOver_4(qargb8565 *dest, const qargb8565 *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { @@ -4333,8 +4333,8 @@ inline void blend_sourceOver_4(qargb8565 *dest, const qargb8565 *src) template <> inline void blend_sourceOver_4(qargb8555 *dest, const qargb8555 *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { @@ -4347,8 +4347,8 @@ inline void blend_sourceOver_4(qargb8555 *dest, const qargb8555 *src) template <> inline void blend_sourceOver_4(qargb6666 *dest, const qargb6666 *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index cb0db4f..2f78b00 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -1649,7 +1649,7 @@ inline void qt_memconvert(qrgb666 *dest, const quint32 *src, int count) return; } - const int align = (long(dest) & 3); + const int align = (quintptr(dest) & 3); switch (align) { case 1: *dest++ = qrgb666(*src++); --count; case 2: *dest++ = qrgb666(*src++); --count; diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 1a815d3..55e93bd 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -208,7 +208,7 @@ void QFontEngineWin::getCMap() unitsPerEm = otm->otmEMSquare; x_height = (int)otm->otmsXHeight; loadKerningPairs(designToDevice); - _faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpFullName)).toLatin1(); + _faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFullName)).toLatin1(); lineWidth = otm->otmsUnderscoreSize; fsType = otm->otmfsType; free(otm); @@ -1006,8 +1006,8 @@ QFontEngine::Properties QFontEngineWin::properties() const Properties p; p.emSquare = unitsPerEm; p.italicAngle = otm->otmItalicAngle; - p.postscriptName = QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpFamilyName)).toLatin1(); - p.postscriptName += QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpStyleName)).toLatin1(); + p.postscriptName = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFamilyName)).toLatin1(); + p.postscriptName += QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpStyleName)).toLatin1(); #ifndef QT_NO_PRINTER p.postscriptName = QPdf::stripSpecialCharacters(p.postscriptName); #endif diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp index 21383bd..8614076 100644 --- a/src/qt3support/text/q3richtext.cpp +++ b/src/qt3support/text/q3richtext.cpp @@ -6667,7 +6667,7 @@ Q3TextImage::Q3TextImage(Q3TextDocument *p, const QMap &attr, imageName = attr[QLatin1String("source")]; if (!imageName.isEmpty()) { - imgId = QString::fromLatin1("%1,%2,%3,%4").arg(imageName).arg(width).arg(height).arg((ulong)&factory); + imgId = QString::fromLatin1("%1,%2,%3,%4").arg(imageName).arg(width).arg(height).arg((quintptr)&factory); if (!pixmap_map) pixmap_map = new QMap; if (pixmap_map->contains(imgId)) { diff --git a/src/qt3support/text/q3textstream.cpp b/src/qt3support/text/q3textstream.cpp index 41aab4d..8c86c7c 100644 --- a/src/qt3support/text/q3textstream.cpp +++ b/src/qt3support/text/q3textstream.cpp @@ -2084,7 +2084,7 @@ Q3TextStream &Q3TextStream::operator<<( void *ptr ) setf( hex, basefield ); setf( showbase ); unsetf( uppercase ); - output_int( I_LONG | I_UNSIGNED, (ulong)ptr, FALSE ); + output_int( I_LONG | I_UNSIGNED, (quintptr)ptr, FALSE ); flags( f ); return *this; } diff --git a/src/qt3support/tools/q3gcache.cpp b/src/qt3support/tools/q3gcache.cpp index a31f827..ada8330 100644 --- a/src/qt3support/tools/q3gcache.cpp +++ b/src/qt3support/tools/q3gcache.cpp @@ -226,7 +226,7 @@ public: bool remove_ascii(Q3CacheItem *item) { return Q3GDict::remove_ascii((const char *)item->key,item); } bool remove_int(Q3CacheItem *item) - { return Q3GDict::remove_int((long)item->key,item);} + { return Q3GDict::remove_int((quintptr)item->key,item);} void statistics() { Q3GDict::statistics(); } @@ -426,7 +426,7 @@ bool Q3GCache::insert_other(const char *key, Q3PtrCollection::Item data, if (keytype == AsciiKey) dict->insert_ascii(key, ci); else - dict->insert_int((long)key, ci); + dict->insert_int((quintptr)key, ci); tCost += cost; return true; } @@ -486,7 +486,7 @@ Q3PtrCollection::Item Q3GCache::take_other(const char *key) if (keytype == AsciiKey) ci = dict->take_ascii(key); else - ci = dict->take_int((long)key); + ci = dict->take_int((quintptr)key); Item d; if (ci) { d = ci->data; @@ -563,7 +563,7 @@ Q3PtrCollection::Item Q3GCache::find_string(const QString &key, bool ref) const Q3PtrCollection::Item Q3GCache::find_other(const char *key, bool ref) const { Q3CacheItem *ci = keytype == AsciiKey ? dict->find_ascii(key) - : dict->find_int((long)key); + : dict->find_int((quintptr)key); #if defined(QT_DEBUG) lruList->finds++; #endif @@ -811,7 +811,7 @@ const char *Q3GCacheIterator::getKeyAscii() const long Q3GCacheIterator::getKeyInt() const { Q3CacheItem *item = it->current(); - return item ? (long)item->key : 0; + return item ? (quintptr)item->key : 0; } /*! diff --git a/src/qt3support/tools/q3gdict.cpp b/src/qt3support/tools/q3gdict.cpp index a968407..e8144fe 100644 --- a/src/qt3support/tools/q3gdict.cpp +++ b/src/qt3support/tools/q3gdict.cpp @@ -437,7 +437,7 @@ Q3PtrCollection::Item Q3GDict::look_int(long key, Q3PtrCollection::Item d, int o Q3PtrCollection::Item Q3GDict::look_ptr(void *key, Q3PtrCollection::Item d, int op) { Q3PtrBucket *n; - int index = (int)((ulong)key % vlen); // simple hash + int index = (int)((quintptr)key % vlen); // simple hash if (op == op_find) { // find for (n=(Q3PtrBucket*)vec[index]; n; n=(Q3PtrBucket*)n->getNext()) { @@ -650,7 +650,7 @@ Q3PtrBucket *Q3GDict::unlink_ptr(void *key, Q3PtrCollection::Item d) return 0; Q3PtrBucket *n; Q3PtrBucket *prev = 0; - int index = (int)((ulong)key % vlen); + int index = (int)((quintptr)key % vlen); for (n=(Q3PtrBucket *)vec[index]; n; n=(Q3PtrBucket *)n->getNext()) { bool found = (n->getKey() == key); if (found && d) -- cgit v0.12