diff --git a/taglib/toolkit/trefcounter.cpp b/taglib/toolkit/trefcounter.cpp index 71f3c2f2..27d17b83 100644 --- a/taglib/toolkit/trefcounter.cpp +++ b/taglib/toolkit/trefcounter.cpp @@ -69,20 +69,18 @@ namespace TagLib { + class RefCounter::RefCounterPrivate { public: - RefCounterPrivate() : refCount(1) {} - - void ref() { ATOMIC_INC(refCount); } - bool deref() { return (ATOMIC_DEC(refCount) == 0); } - int count() const { return refCount; } + RefCounterPrivate() : + refCount(1) {} volatile ATOMIC_INT refCount; }; - RefCounter::RefCounter() - : d(new RefCounterPrivate()) + RefCounter::RefCounter() : + d(new RefCounterPrivate()) { } @@ -91,18 +89,18 @@ namespace TagLib delete d; } - void RefCounter::ref() - { - d->ref(); + void RefCounter::ref() + { + ATOMIC_INC(d->refCount); } - bool RefCounter::deref() - { - return d->deref(); + bool RefCounter::deref() + { + return (ATOMIC_DEC(d->refCount) == 0); } - int RefCounter::count() const - { - return d->count(); + int RefCounter::count() const + { + return static_cast(d->refCount); } }