Fix multiple AND expression
During multiple ANDs, and intermediate probe, the ret
state would be reset. Fix this so that it won't happen.
Tested: R1000 Chassis connectors worked again
Change-Id: I6fb7c8601411df3bca4310e6a61ffac1882d25ce
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index ab7938e..4afc4e1 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -328,6 +328,7 @@
bool matchOne = false;
bool cur = true;
probe_type_codes lastCommand = probe_type_codes::FALSE_T;
+ bool first = true;
for (auto& probe : probeCommand)
{
@@ -424,17 +425,19 @@
// some functions like AND and OR only take affect after the
// fact
- switch (lastCommand)
+ if (lastCommand == probe_type_codes::AND)
{
- case probe_type_codes::AND:
- ret = cur && ret;
- break;
- case probe_type_codes::OR:
- ret = cur || ret;
- break;
- default:
- ret = cur;
- break;
+ ret = cur && ret;
+ }
+ else if (lastCommand == probe_type_codes::OR)
+ {
+ ret = cur || ret;
+ }
+
+ if (first)
+ {
+ ret = cur;
+ first = false;
}
lastCommand = probeType != PROBE_TYPES.end()
? probeType->second