aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukáš Lalinský <lalinsky@gmail.com>2011-05-15 00:07:29 +0200
committerLukáš Lalinský <lalinsky@gmail.com>2011-05-15 00:07:29 +0200
commitdc062a0844d9d5050724302478f2d1c0cf0c813e (patch)
treed34a1eb88cd8b9f61adf980c790aa09c8f950c7a
parentefeccbf72614efaed1c7282f8c9ee02a0acf871f (diff)
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. :)
-rw-r--r--taglib/toolkit/taglib.h4
1 files 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<int32_t*>(&refCount)); }
+ bool deref() { return ! OSAtomicDecrement32Barrier(const_cast<int32_t*>(&refCount)); }
int32_t count() { return refCount; }
private:
volatile int32_t refCount;