Update AMB with amb-qt(qml) plugins to latest
[AGL/meta-agl.git] / meta-ivi-common / recipes-automotive / automotive-message-broker / automotive-message-broker / 0001-Improve-backward-compatibility-with-old-linaro-gcc.patch
1 From fb401094c3d88da14e1b909d786a86c3a68d2199 Mon Sep 17 00:00:00 2001
2 From: Petr Nechaev <petr.nechaev@cogentembedded.com>
3 Date: Mon, 27 Jul 2015 20:34:47 +0300
4 Subject: [PATCH 1/9] Improve backward compatibility with old linaro gcc
5
6 ---
7  lib/listplusplus.h                | 8 ++++++--
8  plugins/common/jsonprotocol.cpp   | 6 +++---
9  plugins/testplugin/testplugin.cpp | 2 +-
10  3 files changed, 10 insertions(+), 6 deletions(-)
11
12 diff --git a/lib/listplusplus.h b/lib/listplusplus.h
13 index 433d34c..e653615 100644
14 --- a/lib/listplusplus.h
15 +++ b/lib/listplusplus.h
16 @@ -27,13 +27,17 @@
17  template <class T, class V, class Predicate>
18  bool contains(const T & iteratable, V value, Predicate comparator )
19  {
20 -       return std::any_of(iteratable.begin(), iteratable.end(), [value, &comparator](auto i) { return comparator(value, i); });
21 +    for(auto i : iteratable)
22 +       {
23 +               if(comparator(value, i))
24 +                       return true;
25 +       }
26  }
27  
28  template <class T, class V>
29  bool contains(const T & iteratable, V value)
30  {
31 -       return contains(iteratable, value, [](auto a, auto b) { return a == b; });
32 +       return iteratable.size() > 0 && (std::find(iteratable.begin(), iteratable.end(), value) != iteratable.end());
33  }
34  
35  
36 diff --git a/plugins/common/jsonprotocol.cpp b/plugins/common/jsonprotocol.cpp
37 index a534900..43ef8cf 100644
38 --- a/plugins/common/jsonprotocol.cpp
39 +++ b/plugins/common/jsonprotocol.cpp
40 @@ -149,7 +149,7 @@ void amb::AmbRemoteClient::hasJsonMessage(const picojson::value &json)
41  
42                         const ListMethodCall::Ptr listMethod = listMethodReply.method();
43  
44 -                       auto itr = std::find_if(mListCalls.begin(), mListCalls.end(),[&listMethod](auto o)
45 +                       auto itr = std::find_if(mListCalls.begin(), mListCalls.end(),[&listMethod](ListMethodCall::Ptr o)
46                         {
47                                 return o->messageId == listMethod->messageId;
48                         });
49 @@ -176,7 +176,7 @@ void amb::AmbRemoteClient::hasJsonMessage(const picojson::value &json)
50                         reply.fromJson(json);
51                         GetMethodCall::Ptr getCall = reply.method();
52  
53 -                       auto itr = std::find_if(mGetMethodCalls.begin(), mGetMethodCalls.end(),[&getCall](auto o)
54 +                       auto itr = std::find_if(mGetMethodCalls.begin(), mGetMethodCalls.end(),[&getCall](GetMethodCall::Ptr o)
55                         {
56                                 return o->messageId == getCall->messageId;
57                         });
58 @@ -205,7 +205,7 @@ void amb::AmbRemoteClient::hasJsonMessage(const picojson::value &json)
59  
60                         auto call = reply.method();
61  
62 -                       auto itr = std::find_if(mSetMethodCalls.begin(), mSetMethodCalls.end(),[&call](auto o)
63 +                       auto itr = std::find_if(mSetMethodCalls.begin(), mSetMethodCalls.end(),[&call](SetMethodCall::Ptr o)
64                         {
65                                 return o->messageId == call->messageId;
66                         });
67 diff --git a/plugins/testplugin/testplugin.cpp b/plugins/testplugin/testplugin.cpp
68 index d854d5f..a96cf19 100644
69 --- a/plugins/testplugin/testplugin.cpp
70 +++ b/plugins/testplugin/testplugin.cpp
71 @@ -268,7 +268,7 @@ bool testListPlusPlus()
72         complexList.push_back(complex1);
73         complexList.push_back(complex2);
74  
75 -       TEST(contains(complexList, complex1, [](auto a, auto b) { return a.foo == b.foo && a.bar == b.bar; }));
76 +       TEST(contains(complexList, complex1, [](Complex a, Complex b) { return a.foo == b.foo && a.bar == b.bar; }));
77  
78         return true;
79  }
80 -- 
81 1.9.1
82