Make QBasicAtomicPointer work with T=const (int|any type) on Windows
authorJan-Arve Saether <jan-arve.saether@nokia.com>
Fri, 25 Nov 2011 12:28:40 +0000 (13:28 +0100)
committerQt by Nokia <qt-info@nokia.com>
Fri, 25 Nov 2011 13:37:02 +0000 (14:37 +0100)
Change-Id: I2301ea3fa399bcc5d6d8c6b487a3fb78db19c67a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
src/corelib/arch/qatomic_windows.h

index f3f9914..4807c69 100644 (file)
@@ -219,13 +219,13 @@ extern "C" {
 
 # define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
     QT_INTERLOCKED_FUNCTION( CompareExchangePointer )( \
-            reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \
+            (void * QT_INTERLOCKED_VOLATILE *)( QT_INTERLOCKED_REMOVE_VOLATILE(value) ), \
             newValue, \
             expectedValue )
 
 # define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
     QT_INTERLOCKED_FUNCTION( ExchangePointer )( \
-            reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \
+            (void * QT_INTERLOCKED_VOLATILE *)( QT_INTERLOCKED_REMOVE_VOLATILE(value) ), \
             newValue )
 
 # define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
@@ -345,7 +345,7 @@ inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd)
 template <typename T>
 Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue)
 {
-    return QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&_q_value, newValue, expectedValue)
+    return QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&_q_value, (void*)newValue, (void*)expectedValue)
             == expectedValue;
 }
 
@@ -353,7 +353,7 @@ template <typename T>
 Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T* newValue)
 {
     return reinterpret_cast<T *>(
-            QT_INTERLOCKED_EXCHANGE_POINTER(&_q_value, newValue));
+            QT_INTERLOCKED_EXCHANGE_POINTER(&_q_value, (void*)newValue));
 }
 
 template <typename T>