aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-02 22:24:32 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-02 22:24:32 +0100
commitdff88d0ddd9054add5b8f0760e8e12c27c65c8eb (patch)
treefb98a98f7fdf8d4f29d63e52def4d4cab9998b99
parent3cefa7d43712f94c78dbbdff499b0a9a7645284b (diff)
Initialize all boolean value of DynamicField. Avoiding mistake.
Change-Id: I9cd5551186debd153e838b6d4156430553d5235f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--src/openxc-utils.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/openxc-utils.cpp b/src/openxc-utils.cpp
index bbea968..c996176 100644
--- a/src/openxc-utils.cpp
+++ b/src/openxc-utils.cpp
@@ -67,6 +67,8 @@ openxc_DynamicField build_DynamicField(const std::string& value)
d.type = openxc_DynamicField_Type_STRING;
d.has_string_value = true;
+ d.has_numeric_value = false;
+ d.has_boolean_value = false;
::strncpy(d.string_value, value.c_str(), 100);
return d;
@@ -78,7 +80,9 @@ openxc_DynamicField build_DynamicField(double value)
d.has_type = true;
d.type = openxc_DynamicField_Type_NUM;
+ d.has_string_value = false;
d.has_numeric_value = true;
+ d.has_boolean_value = false;
d.numeric_value = value;
return d;
@@ -90,6 +94,8 @@ openxc_DynamicField build_DynamicField(bool value)
d.has_type = true;
d.type = openxc_DynamicField_Type_BOOL;
+ d.has_string_value = false;
+ d.has_numeric_value = false;
d.has_boolean_value = true;
d.boolean_value = value;