From dc062a0844d9d5050724302478f2d1c0cf0c813e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Sun, 15 May 2011 00:07:29 +0200 Subject: [PATCH] Make RefCounter compile on OS X with the 10.4 SDK The 10.4 SDK defines OSAtomic functions as int32_t, while 10.5 and newer SDKs define them as volatile int32_t. This caused a compilation error when compiling against the 10.4 SDK. I'd have prefered a preprocessor-based solution, but I couldn't find any macro that says the SDK version, so I copied this cast solution from Apple's WebKit. I assume then know what they are doing if they have to workaround their own API. :) --- taglib/toolkit/taglib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taglib/toolkit/taglib.h b/taglib/toolkit/taglib.h index 922640d1..c42f1bde 100644 --- a/taglib/toolkit/taglib.h +++ b/taglib/toolkit/taglib.h @@ -100,8 +100,8 @@ namespace TagLib { RefCounter() : refCount(1) {} #ifdef TAGLIB_ATOMIC_MAC - void ref() { OSAtomicIncrement32Barrier(&refCount); } - bool deref() { return ! OSAtomicDecrement32Barrier(&refCount); } + void ref() { OSAtomicIncrement32Barrier(const_cast(&refCount)); } + bool deref() { return ! OSAtomicDecrement32Barrier(const_cast(&refCount)); } int32_t count() { return refCount; } private: volatile int32_t refCount;