security-manager: Improve integration
[AGL/meta-agl.git] / meta-security / recipes-security / security-manager / security-manager / 0012-Avoid-casting-from-const-T-to-void.patch
@@ -1,7 +1,7 @@
-From 14c8842ed8a37fecbc70d46e27b49ae929b0c85f Mon Sep 17 00:00:00 2001
+From 5ee51d38575f289c2bf37ed817ef680ed47bb320 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
 Date: Fri, 1 Feb 2019 15:37:44 +0100
-Subject: [PATCH] Avoid casting from "const T&" to "void*"
+Subject: [PATCH 12/14] Avoid casting from "const T&" to "void*"
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
@@ -15,14 +15,14 @@ is coming from the const or not.
 
 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
 ---
- src/server/main/include/service-thread.h | 43 ++++++++++--------------
- 1 file changed, 18 insertions(+), 25 deletions(-)
+ src/server/main/include/service-thread.h | 42 ++++++++++--------------
+ 1 file changed, 18 insertions(+), 24 deletions(-)
 
 diff --git a/src/server/main/include/service-thread.h b/src/server/main/include/service-thread.h
-index 964d168..92b0ec8 100644
+index 964d168..61fdda8 100644
 --- a/src/server/main/include/service-thread.h
 +++ b/src/server/main/include/service-thread.h
-@@ -9,78 +94,72 @@ public:
+@@ -94,7 +94,7 @@ public:
              Join();
          while (!m_eventQueue.empty()){
              auto front = m_eventQueue.front();
@@ -31,9 +31,7 @@ index 964d168..92b0ec8 100644
              m_eventQueue.pop();
          }
      }
-     template <class T>
-     void Event(const T &event,
+@@ -104,34 +104,28 @@ public:
                 Service *servicePtr,
                 void (Service::*serviceFunction)(const T &))
      {
@@ -59,30 +57,27 @@ index 964d168..92b0ec8 100644
 -        Service *servicePtr;
 -        void (ServiceThread::*eventFunctionPtr)(const EventDescription &event);
 -        GenericEvent* eventPtr;
--    };
--
--    template <class T>
++    struct EventCallerBase {
++       virtual void fire() = 0;
++       virtual ~EventCallerBase() {}
+     };
+     template <class T>
 -    void EventCall(const EventDescription &desc) {
 -        auto fun = reinterpret_cast<void (Service::*)(const T&)>(desc.serviceFunctionPtr);
 -        const T& eventLocale = *(static_cast<T*>(desc.eventPtr));
 -        (desc.servicePtr->*fun)(eventLocale);
 -    }
-+    struct EventCallerBase {
-+       virtual void fire() = 0;
-+       virtual ~EventCallerBase() {}
-+    };
-+    template <class T>
 +    struct EventCaller : public EventCallerBase {
 +        T *event; Service *target; void (Service::*function)(const T&);
 +        EventCaller(const T &e, Service *c, void (Service::*f)(const T&)) : event(new T(e)), target(c), function(f) {}
 +      ~EventCaller() { delete event; }
 +      void fire() { (target->*function)(*event); }
 +    };
-+
      static void ThreadLoopStatic(ServiceThread *ptr) {
          ptr->ThreadLoop();
-     }
+@@ -139,33 +133,33 @@ protected:
  
      void ThreadLoop(){
          for (;;) {
@@ -123,5 +118,5 @@ index 964d168..92b0ec8 100644
  
      State m_state;
 -- 
-2.17.2
+2.21.0