From 4f43c8357f109ab8f7b0886a41ae11ac4d07a830 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 16 Nov 2008 20:42:11 +0000 Subject: Cast glib operations to compile on annoying platforms. git-svn-id: http://svn.drobilla.net/lad/trunk/raul@1732 a436a847-0d15-0410-975c-d299462d15a1 --- raul/AtomicInt.hpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'raul/AtomicInt.hpp') diff --git a/raul/AtomicInt.hpp b/raul/AtomicInt.hpp index cb0591d..a07ec3c 100644 --- a/raul/AtomicInt.hpp +++ b/raul/AtomicInt.hpp @@ -27,22 +27,22 @@ class AtomicInt { public: inline AtomicInt(int val) - { g_atomic_int_set(&_val, val); } + { g_atomic_int_set(static_cast(&_val), (gint)val); } inline AtomicInt(const AtomicInt& copy) - { g_atomic_int_set(&_val, copy.get()); } + { g_atomic_int_set(static_cast(&_val), (gint)copy.get()); } inline int get() const - { return g_atomic_int_get(&_val); } + { return g_atomic_int_get(static_cast(&_val)); } inline void operator=(int val) - { g_atomic_int_set(&_val, val); } + { g_atomic_int_set(static_cast(&_val), (gint)val); } inline void operator+=(int val) - { g_atomic_int_add(&_val, val); } + { g_atomic_int_add(static_cast(&_val), (gint)val); } inline void operator-=(int val) - { g_atomic_int_add(&_val, -val); } + { g_atomic_int_add(static_cast(&_val), (gint)-val); } inline bool operator==(int val) const { return get() == val; } @@ -51,28 +51,28 @@ public: { return get() + val; } inline AtomicInt& operator++() // prefix - { g_atomic_int_inc(&_val); return *this; } + { g_atomic_int_inc(static_cast(&_val)); return *this; } inline AtomicInt& operator--() // prefix - { g_atomic_int_add(&_val, -1); return *this; } + { g_atomic_int_add(static_cast(&_val), -1); return *this; } - /** Set value to newval iff current value is oldval. - * @return whether set succeeded. + /** Set value to @a val iff current value is @a old. + * @return true iff set succeeded. */ - inline bool compare_and_exchange(int oldval, int newval) - { return g_atomic_int_compare_and_exchange(&_val, oldval, newval); } + inline bool compare_and_exchange(int old, int val) + { return g_atomic_int_compare_and_exchange(static_cast(&_val), old, val); } /** Add val to value. * @return value immediately before addition took place. */ inline int exchange_and_add(int val) - { return g_atomic_int_exchange_and_add(&_val, val); } + { return g_atomic_int_exchange_and_add(static_cast(&_val), val); } /** Decrement value. * @return true if value is now 0, otherwise false. */ inline bool decrement_and_test() - { return g_atomic_int_dec_and_test(&_val); } + { return g_atomic_int_dec_and_test(static_cast(&_val)); } private: volatile mutable int _val; -- cgit v1.2.1