From eae59ca2cdc68236136685c52da17f6c37515d59 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 26 Jan 2019 18:29:41 +0200 Subject: libcamera: signal: Don't use reinterpret_cast<>() to perform downcasts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use static_cast<>() instead of reinterpret_cast<>() to perform downcasts, as reinterpret_cast<>() isn't meant (and guaranteed to be safe) for that purpose. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- include/libcamera/signal.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/libcamera/signal.h b/include/libcamera/signal.h index 0b437a48..c375b0a8 100644 --- a/include/libcamera/signal.h +++ b/include/libcamera/signal.h @@ -37,7 +37,7 @@ public: SlotMember(T *obj, void(T::*func)(Args...)) : SlotBase(obj), func_(func) { } - void invoke(Args... args) { (reinterpret_cast(this->obj_)->*func_)(args...); } + void invoke(Args... args) { (static_cast(this->obj_)->*func_)(args...); } private: friend class Signal; @@ -111,7 +111,7 @@ public: * match, so we can safely cast to SlotMember. */ if (slot->obj_ == object && - reinterpret_cast *>(slot)->func_ == func) { + static_cast *>(slot)->func_ == func) { iter = slots_.erase(iter); delete slot; } else { @@ -125,7 +125,7 @@ public: for (auto iter = slots_.begin(); iter != slots_.end(); ) { SlotBase *slot = *iter; if (slot->obj_ == nullptr && - reinterpret_cast *>(slot)->func_ == func) { + static_cast *>(slot)->func_ == func) { iter = slots_.erase(iter); delete slot; } else { -- cgit v1.2.1