diff options
Diffstat (limited to 'raul')
-rw-r--r-- | raul/Atom.hpp | 6 | ||||
-rw-r--r-- | raul/AtomicInt.hpp | 11 | ||||
-rw-r--r-- | raul/AtomicPtr.hpp | 8 | ||||
-rw-r--r-- | raul/List.hpp | 2 | ||||
-rw-r--r-- | raul/SRSWQueue.hpp | 2 | ||||
-rw-r--r-- | raul/TimeStamp.hpp | 4 |
6 files changed, 16 insertions, 17 deletions
diff --git a/raul/Atom.hpp b/raul/Atom.hpp index 04ff4cb..46e93ad 100644 --- a/raul/Atom.hpp +++ b/raul/Atom.hpp @@ -203,7 +203,7 @@ private: , _buf(malloc(_type_length + _size)) { memcpy(_buf, type, _type_length); - memcpy((char*)_buf + _type_length, data, size); + memcpy(static_cast<char*>(_buf) + _type_length, data, size); } BlobValue(const BlobValue& copy) @@ -217,8 +217,8 @@ private: ~BlobValue() { free(_buf); } - inline const char* type() const { return (const char*)_buf; } - inline const void* data() const { return (const char*)_buf + _type_length; } + inline const char* type() const { return static_cast<const char*>(_buf); } + inline const void* data() const { return static_cast<const char*>(_buf) + _type_length; } inline size_t size() const { return _size; } private: size_t _type_length; ///< Length of type string (first part of buffer, inc. \0) diff --git a/raul/AtomicInt.hpp b/raul/AtomicInt.hpp index e7fe5ac..c2aa3c1 100644 --- a/raul/AtomicInt.hpp +++ b/raul/AtomicInt.hpp @@ -25,24 +25,23 @@ namespace Raul { class AtomicInt { public: - inline AtomicInt(int val) - { g_atomic_int_set(static_cast<volatile gint*>(&_val), (gint)val); } + { g_atomic_int_set(static_cast<volatile gint*>(&_val), val); } inline AtomicInt(const AtomicInt& copy) - { g_atomic_int_set(static_cast<volatile gint*>(&_val), (gint)copy.get()); } + { g_atomic_int_set(static_cast<volatile gint*>(&_val), copy.get()); } inline int get() const { return g_atomic_int_get(static_cast<volatile gint*>(&_val)); } inline void operator=(int val) - { g_atomic_int_set(static_cast<volatile gint*>(&_val), (gint)val); } + { g_atomic_int_set(static_cast<volatile gint*>(&_val), val); } inline void operator+=(int val) - { g_atomic_int_add(static_cast<volatile gint*>(&_val), (gint)val); } + { g_atomic_int_add(static_cast<volatile gint*>(&_val), val); } inline void operator-=(int val) - { g_atomic_int_add(static_cast<volatile gint*>(&_val), (gint)-val); } + { g_atomic_int_add(static_cast<volatile gint*>(&_val), -val); } inline bool operator==(int val) const { return get() == val; } diff --git a/raul/AtomicPtr.hpp b/raul/AtomicPtr.hpp index 089b54c..0e086c2 100644 --- a/raul/AtomicPtr.hpp +++ b/raul/AtomicPtr.hpp @@ -26,15 +26,15 @@ namespace Raul { template<typename T> class AtomicPtr { public: - inline AtomicPtr() - { g_atomic_pointer_set((volatile gpointer*)&_val, NULL); } + { g_atomic_pointer_set(static_cast<volatile gpointer*>(&_val), NULL); } inline AtomicPtr(const AtomicPtr& copy) - { g_atomic_pointer_set((volatile gpointer*)(&_val), (gpointer)copy.get()); } + { g_atomic_pointer_set(static_cast<volatile gpointer*>(&_val), + static_cast<gpointer>(copy.get())); } inline T* get() const - { return (T*)g_atomic_pointer_get((volatile gpointer*)(&_val)); } + { return static_cast<T*>(g_atomic_pointer_get(static_cast<volatile gpointer*>(&_val))); } inline void operator=(T* val) { g_atomic_pointer_set(&_val, static_cast<gpointer>(val)); } diff --git a/raul/List.hpp b/raul/List.hpp index 764d684..3a55136 100644 --- a/raul/List.hpp +++ b/raul/List.hpp @@ -90,7 +90,7 @@ public: void clear(); /// Valid only in the write thread - unsigned size() const { return (unsigned)_size.get(); } + unsigned size() const { return static_cast<unsigned>(_size.get()); } /// Valid for any thread bool empty() { return (_head.get() == NULL); } diff --git a/raul/SRSWQueue.hpp b/raul/SRSWQueue.hpp index a36efd9..c40738a 100644 --- a/raul/SRSWQueue.hpp +++ b/raul/SRSWQueue.hpp @@ -72,7 +72,7 @@ SRSWQueue<T>::SRSWQueue(size_t size) : _front(0) , _back(0) , _size(size+1) - , _objects((T*)calloc(_size, sizeof(T))) + , _objects(static_cast<T*>(calloc(_size, sizeof(T)))) { assert(size > 1); } diff --git a/raul/TimeStamp.hpp b/raul/TimeStamp.hpp index 7e6529b..6b1bf19 100644 --- a/raul/TimeStamp.hpp +++ b/raul/TimeStamp.hpp @@ -85,7 +85,7 @@ public: {} inline TimeStamp(TimeUnit unit, double dec) - : _ticks((uint32_t)floor(dec)) + : _ticks(static_cast<uint32_t>(floor(dec))) , _subticks((dec - floor(dec)) * unit.ppt()) , _unit(unit) { @@ -98,7 +98,7 @@ public: inline uint32_t subticks() const { return _subticks; } inline double to_double() const { - return _ticks + (_subticks / (double)_unit.ppt()); + return _ticks + (_subticks / static_cast<double>(_unit.ppt())); } inline bool is_zero() const { |