aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-03-21 16:06:50 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2018-03-21 16:06:50 +0100
commitb88f284107f7a37813ea093e3ab545d998cf9715 (patch)
tree670a981e93a7675e4328912b5031a0893670e6f3
parenta392191f554dce49f60b34acf40f658d9604b304 (diff)
Linting improvments.
Uninitiliazed variable in submodule Better handling of iterator assigments Avoid multiple call to vector.size() function Change-Id: I9cc8431e71b7d614a1619615a4048f19f5e31540 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
m---------ctl-utilities0
-rw-r--r--docs/part-1/4-SignalComposerAPI.md1
-rw-r--r--signal-composer-binding/clientApp.cpp9
-rw-r--r--signal-composer-binding/signal-composer.cpp11
4 files changed, 12 insertions, 9 deletions
diff --git a/ctl-utilities b/ctl-utilities
-Subproject ef5d0e9cc23a3770f8cf585ef3b59f17533734e
+Subproject 44f5060de064d3acab585d26d8141df3f0481c6
diff --git a/docs/part-1/4-SignalComposerAPI.md b/docs/part-1/4-SignalComposerAPI.md
index aedcd7c..08c9bf9 100644
--- a/docs/part-1/4-SignalComposerAPI.md
+++ b/docs/part-1/4-SignalComposerAPI.md
@@ -60,4 +60,3 @@ binding, by default **last** is used:
## list
Verb **list** will output the list of defined signals.
-
diff --git a/signal-composer-binding/clientApp.cpp b/signal-composer-binding/clientApp.cpp
index da4bb72..854f96e 100644
--- a/signal-composer-binding/clientApp.cpp
+++ b/signal-composer-binding/clientApp.cpp
@@ -37,16 +37,19 @@ void clientAppCtx::appendSignals(std::vector<std::shared_ptr<Signal>>& sigV)
for (std::vector<std::shared_ptr<Signal>>::const_iterator it = sigV.cbegin();
it != sigV.cend(); ++it)
{
+ std::shared_ptr<Signal> sig = nullptr;
for (auto& ctxSig: subscribedSignals_)
{if(*it == ctxSig) {set = true;}}
if (set)
{
set = false;
sigV.erase(it);
- continue;
}
- std::shared_ptr<Signal> sig = *it;
- sig->addObserver(this);
+ else
+ {
+ std::shared_ptr<Signal> sig = *it;
+ sig->addObserver(this);
+ }
}
subscribedSignals_.insert(subscribedSignals_.end(), sigV.begin(), sigV.end());
diff --git a/signal-composer-binding/signal-composer.cpp b/signal-composer-binding/signal-composer.cpp
index 9fc7109..2114d97 100644
--- a/signal-composer-binding/signal-composer.cpp
+++ b/signal-composer-binding/signal-composer.cpp
@@ -148,19 +148,20 @@ json_object* Composer::buildLuaAction(std::string name, std::string function, js
std::string fName, filepath;
std::string uri = std::string(function).substr(6);
std::vector<std::string> uriV = Composer::parseURI(uri);
- if(uriV.size() > 2)
+ uriVsize = uriV.size();
+ if(uriVsize > 2)
{
int i = 0;
- while(i < uriV.size()-1)
+ while(i < uriVsize-1)
{filepath += uriV[i] + "/";}
- fName = uriV[-1];
+ fName = uriV[uriVsize-1];
}
- else if(uriV.size() == 2)
+ else if(uriVsize == 2)
{
filepath = uriV[0];
fName = uriV[2];
}
- else if(uriV.size() == 1)
+ else if(uriVsize == 1)
{fName = uriV[0];}
else
{