diff --git a/dlls/kernel/sync.c b/dlls/kernel/sync.c index 8390ef713b1..38007366495 100644 --- a/dlls/kernel/sync.c +++ b/dlls/kernel/sync.c @@ -1919,7 +1919,7 @@ __ASM_GLOBAL_FUNC(InterlockedDecrement, */ LONG WINAPI InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG compare ) { - return interlocked_cmpxchg( dest, xchg, compare ); + return interlocked_cmpxchg( (int *)dest, xchg, compare ); } /*********************************************************************** @@ -1936,7 +1936,7 @@ LONG WINAPI InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG com */ LONG WINAPI InterlockedExchange( LONG volatile *dest, LONG val ) { - return interlocked_xchg( dest, val ); + return interlocked_xchg( (int *)dest, val ); } /*********************************************************************** @@ -1953,7 +1953,7 @@ LONG WINAPI InterlockedExchange( LONG volatile *dest, LONG val ) */ LONG WINAPI InterlockedExchangeAdd( LONG volatile *dest, LONG incr ) { - return interlocked_xchg_add( dest, incr ); + return interlocked_xchg_add( (int *)dest, incr ); } /*********************************************************************** @@ -1969,7 +1969,7 @@ LONG WINAPI InterlockedExchangeAdd( LONG volatile *dest, LONG incr ) */ LONG WINAPI InterlockedIncrement( LONG volatile *dest ) { - return interlocked_xchg_add( dest, 1 ) + 1; + return interlocked_xchg_add( (int *)dest, 1 ) + 1; } /*********************************************************************** @@ -1985,7 +1985,7 @@ LONG WINAPI InterlockedIncrement( LONG volatile *dest ) */ LONG WINAPI InterlockedDecrement( LONG volatile *dest ) { - return interlocked_xchg_add( dest, -1 ) - 1; + return interlocked_xchg_add( (int *)dest, -1 ) - 1; } #endif /* __i386__ */ diff --git a/dlls/ntdll/critsection.c b/dlls/ntdll/critsection.c index e0066d5fe56..eaab5ac64fa 100644 --- a/dlls/ntdll/critsection.c +++ b/dlls/ntdll/critsection.c @@ -35,12 +35,12 @@ WINE_DECLARE_DEBUG_CHANNEL(relay); inline static LONG interlocked_inc( PLONG dest ) { - return interlocked_xchg_add( dest, 1 ) + 1; + return interlocked_xchg_add( (int *)dest, 1 ) + 1; } inline static LONG interlocked_dec( PLONG dest ) { - return interlocked_xchg_add( dest, -1 ) - 1; + return interlocked_xchg_add( (int *)dest, -1 ) - 1; } inline static void small_pause(void) @@ -322,7 +322,7 @@ NTSTATUS WINAPI RtlEnterCriticalSection( RTL_CRITICAL_SECTION *crit ) if (crit->LockCount > 0) break; /* more than one waiter, don't bother spinning */ if (crit->LockCount == -1) /* try again */ { - if (interlocked_cmpxchg( &crit->LockCount, 0, -1 ) == -1) goto done; + if (interlocked_cmpxchg( (int *)&crit->LockCount, 0, -1 ) == -1) goto done; } small_pause(); } @@ -366,7 +366,7 @@ done: BOOL WINAPI RtlTryEnterCriticalSection( RTL_CRITICAL_SECTION *crit ) { BOOL ret = FALSE; - if (interlocked_cmpxchg( &crit->LockCount, 0L, -1 ) == -1) + if (interlocked_cmpxchg( (int *)&crit->LockCount, 0, -1 ) == -1) { crit->OwningThread = (HANDLE)GetCurrentThreadId(); crit->RecursionCount = 1; diff --git a/include/wine/port.h b/include/wine/port.h index 10c96db7513..0cf8274d166 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -383,15 +383,15 @@ extern int spawnvp(int mode, const char *cmdname, const char * const argv[]); #if defined(__i386__) && defined(__GNUC__) -extern inline long interlocked_cmpxchg( long *dest, long xchg, long compare ); +extern inline int interlocked_cmpxchg( int *dest, int xchg, int compare ); extern inline void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare ); -extern inline long interlocked_xchg( long *dest, long val ); +extern inline int interlocked_xchg( int *dest, int val ); extern inline void *interlocked_xchg_ptr( void **dest, void *val ); -extern inline long interlocked_xchg_add( long *dest, long incr ); +extern inline int interlocked_xchg_add( int *dest, int incr ); -extern inline long interlocked_cmpxchg( long *dest, long xchg, long compare ) +extern inline int interlocked_cmpxchg( int *dest, int xchg, int compare ) { - long ret; + int ret; __asm__ __volatile__( "lock; cmpxchgl %2,(%1)" : "=a" (ret) : "r" (dest), "r" (xchg), "0" (compare) : "memory" ); return ret; @@ -405,9 +405,9 @@ extern inline void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *comp return ret; } -extern inline long interlocked_xchg( long *dest, long val ) +extern inline int interlocked_xchg( int *dest, int val ) { - long ret; + int ret; __asm__ __volatile__( "lock; xchgl %0,(%1)" : "=r" (ret) : "r" (dest), "0" (val) : "memory" ); return ret; @@ -421,9 +421,9 @@ extern inline void *interlocked_xchg_ptr( void **dest, void *val ) return ret; } -extern inline long interlocked_xchg_add( long *dest, long incr ) +extern inline int interlocked_xchg_add( int *dest, int incr ) { - long ret; + int ret; __asm__ __volatile__( "lock; xaddl %0,(%1)" : "=r" (ret) : "r" (dest), "0" (incr) : "memory" ); return ret; @@ -431,11 +431,11 @@ extern inline long interlocked_xchg_add( long *dest, long incr ) #else /* __i386___ && __GNUC__ */ -extern long interlocked_cmpxchg( long *dest, long xchg, long compare ); +extern int interlocked_cmpxchg( int *dest, int xchg, int compare ); extern void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare ); -extern long interlocked_xchg( long *dest, long val ); +extern int interlocked_xchg( int *dest, int val ); extern void *interlocked_xchg_ptr( void **dest, void *val ); -extern long interlocked_xchg_add( long *dest, long incr ); +extern int interlocked_xchg_add( int *dest, int incr ); #endif /* __i386___ && __GNUC__ */ diff --git a/libs/port/interlocked.c b/libs/port/interlocked.c index 18abe1b7af7..dc353510867 100644 --- a/libs/port/interlocked.c +++ b/libs/port/interlocked.c @@ -55,7 +55,7 @@ __ASM_GLOBAL_FUNC(interlocked_xchg_add, #elif defined(_MSC_VER) -__declspec(naked) long interlocked_cmpxchg( long *dest, long xchg, long compare ) +__declspec(naked) int interlocked_cmpxchg( int *dest, int xchg, int compare ) { __asm mov eax, 12[esp]; __asm mov ecx, 8[esp]; @@ -73,7 +73,7 @@ __declspec(naked) void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void * __asm ret; } -__declspec(naked) long interlocked_xchg( long *dest, long val ) +__declspec(naked) int interlocked_xchg( int *dest, int val ) { __asm mov eax, 8[esp]; __asm mov edx, 4[esp]; @@ -89,7 +89,7 @@ __declspec(naked) void *interlocked_xchg_ptr( void **dest, void *val ) __asm ret; } -__declspec(naked) long interlocked_xchg_add( long *dest, long incr ) +__declspec(naked) int interlocked_xchg_add( int *dest, int incr ) { __asm mov eax, 8[esp]; __asm mov edx, 4[esp]; @@ -133,8 +133,8 @@ __ASM_GLOBAL_FUNC(interlocked_xchg_add, #elif defined(__powerpc__) void* interlocked_cmpxchg_ptr( void **dest, void* xchg, void* compare) { - long ret = 0; - long scratch; + void *ret = 0; + void *scratch; __asm__ __volatile__( "0: lwarx %0,0,%2\n" " xor. %1,%4,%0\n" @@ -146,13 +146,13 @@ void* interlocked_cmpxchg_ptr( void **dest, void* xchg, void* compare) : "=&r"(ret), "=&r"(scratch) : "r"(dest), "r"(xchg), "r"(compare) : "cr0","memory"); - return (void*)ret; + return ret; } -long interlocked_cmpxchg( long *dest, long xchg, long compare) +int interlocked_cmpxchg( int *dest, int xchg, int compare) { - long ret = 0; - long scratch; + int ret = 0; + int scratch; __asm__ __volatile__( "0: lwarx %0,0,%2\n" " xor. %1,%4,%0\n" @@ -167,10 +167,10 @@ long interlocked_cmpxchg( long *dest, long xchg, long compare) return ret; } -long interlocked_xchg_add( long *dest, long incr ) +int interlocked_xchg_add( int *dest, int incr ) { - long ret = 0; - long zero = 0; + int ret = 0; + int zero = 0; __asm__ __volatile__( "0: lwarx %0, %3, %1\n" " add %0, %2, %0\n" @@ -184,9 +184,9 @@ long interlocked_xchg_add( long *dest, long incr ) return ret-incr; } -long interlocked_xchg( long* dest, long val ) +int interlocked_xchg( int* dest, int val ) { - long ret = 0; + int ret = 0; __asm__ __volatile__( "0: lwarx %0,0,%1\n" " stwcx. %2,0,%1\n" @@ -226,7 +226,7 @@ void* interlocked_xchg_ptr( void** dest, void* val ) #include static lwp_mutex_t interlocked_mutex = DEFAULTMUTEX; -long interlocked_cmpxchg( long *dest, long xchg, long compare ) +int interlocked_cmpxchg( int *dest, int xchg, int compare ) { _lwp_mutex_lock( &interlocked_mutex ); if (*dest == compare) *dest = xchg; @@ -244,9 +244,9 @@ void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare ) return compare; } -long interlocked_xchg( long *dest, long val ) +int interlocked_xchg( int *dest, int val ) { - long retv; + int retv; _lwp_mutex_lock( &interlocked_mutex ); retv = *dest; *dest = val; @@ -256,7 +256,7 @@ long interlocked_xchg( long *dest, long val ) void *interlocked_xchg_ptr( void **dest, void *val ) { - long retv; + void *retv; _lwp_mutex_lock( &interlocked_mutex ); retv = *dest; *dest = val; @@ -264,9 +264,9 @@ void *interlocked_xchg_ptr( void **dest, void *val ) return retv; } -long interlocked_xchg_add( long *dest, long incr ) +int interlocked_xchg_add( int *dest, int incr ) { - long retv; + int retv; _lwp_mutex_lock( &interlocked_mutex ); retv = *dest; *dest += incr; diff --git a/libs/wine/debug.c b/libs/wine/debug.c index 377b950b9d8..34ebc149cbb 100644 --- a/libs/wine/debug.c +++ b/libs/wine/debug.c @@ -243,7 +243,7 @@ int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *chan static char *get_tmp_space( int size ) { static char *list[32]; - static long pos; + static int pos; char *ret; int idx; diff --git a/loader/kthread.c b/loader/kthread.c index 899770082cf..ddc9bb348a2 100644 --- a/loader/kthread.c +++ b/loader/kthread.c @@ -166,7 +166,7 @@ static inline void writejump( const char *symbol, void *dest ) #define TEMP_STACK_SIZE 1024 #define NB_TEMP_STACKS 8 static char temp_stacks[NB_TEMP_STACKS][TEMP_STACK_SIZE]; -static LONG next_temp_stack; /* next temp stack to use */ +static int next_temp_stack; /* next temp stack to use */ /*********************************************************************** * get_temp_stack @@ -543,10 +543,10 @@ int pthread_attr_setstack(pthread_attr_t *attr, void *addr, size_t size) int __pthread_once(pthread_once_t *once_control, void (*init_routine)(void)) { static pthread_once_t the_once = PTHREAD_ONCE_INIT; - long once_now; + int once_now; memcpy(&once_now,&the_once,sizeof(once_now)); - if (interlocked_cmpxchg((long*)once_control, once_now+1, once_now) == once_now) + if (interlocked_cmpxchg((int*)once_control, once_now+1, once_now) == once_now) (*init_routine)(); return 0; } @@ -694,7 +694,7 @@ strong_alias(__pthread_mutexattr_gettype, pthread_mutexattr_gettype); int __pthread_key_create(pthread_key_t *key, void (*destr_function)(void *)) { - static long keycnt = FIRST_KEY; + static int keycnt = FIRST_KEY; *key = interlocked_xchg_add(&keycnt, 1); return 0; } diff --git a/server/change.c b/server/change.c index b76cf060bc2..a5819c5a38c 100644 --- a/server/change.c +++ b/server/change.c @@ -55,7 +55,7 @@ struct change struct list entry; /* entry in global change notifications list */ int subtree; /* watch all the subtree */ unsigned int filter; /* notification filter */ - long notified; /* SIGIO counter */ + int notified; /* SIGIO counter */ long signaled; /* the file changed */ };