From c95d4ccc748c44b520ae687bcc7d4f61698723e8 Mon Sep 17 00:00:00 2001 From: rich_sposato Date: Thu, 1 Mar 2007 01:54:23 +0000 Subject: [PATCH] Fixed compiler error that occurs when using 64 bit pointers. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@817 7ec92016-0320-0410-acc4-a06ded1c099a --- test/SmartPtr/LockTest.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/SmartPtr/LockTest.cpp b/test/SmartPtr/LockTest.cpp index e2a9ee4..963c5f7 100644 --- a/test/SmartPtr/LockTest.cpp +++ b/test/SmartPtr/LockTest.cpp @@ -32,6 +32,8 @@ #define LOKI_WINDOWS_H #endif +#include + #include #include #include @@ -371,13 +373,14 @@ SelfLockedA * SelfLockedA::s_instance = NULL; void * RunLocked( void * id ) { A_Lockable_ptr ap( SafeA::GetIt().GetA() ); - const int threadIndex = reinterpret_cast< int >( id ); + const ptrdiff_t threadIndex = reinterpret_cast< ptrdiff_t >( id ); + const int index = static_cast< int >( threadIndex ); for( unsigned int i = 0; i < loop; i++ ) { ap.Lock(); Loki::ScopeGuard unlockGuard = MakeGuard( &A_Lockable_ptr::Unlock, ap ); (void)unlockGuard; - ap->Print( threadIndex ); + ap->Print( index ); } return 0; } @@ -387,17 +390,18 @@ void * RunLocked( void * id ) void * RunLockedStorage( void * id ) { A_Locked_ptr ap( SelfLockedA::GetIt().GetA() ); - const int threadIndex = reinterpret_cast< int >( id ); + const ptrdiff_t threadIndex = reinterpret_cast< ptrdiff_t >( id ); + const int index = static_cast< int >( threadIndex ); int j = 0; for( unsigned int i = 0; i < loop; i++ ) { - ap->Print( threadIndex, j ); + ap->Print( index, j ); j++; #ifdef DO_EXTRA_LOKI_TESTS - ap->Print( threadIndex, j ); + ap->Print( index, j ); j++; A_Locked_ptr ap1( ap ); - ap1->Print( threadIndex, j ); + ap1->Print( index, j ); j++; #endif } @@ -408,10 +412,11 @@ void * RunLockedStorage( void * id ) void * Run( void * id ) { A_ptr ap( UnsafeA::GetIt().GetA() ); - const int threadIndex = reinterpret_cast< int >( id ); + const ptrdiff_t threadIndex = reinterpret_cast< ptrdiff_t >( id ); + const int index = static_cast< int >( threadIndex ); for( unsigned int i = 0; i < loop; i++ ) { - ap->Print( threadIndex ); + ap->Print( index ); } return 0; }