From aab3313042e28f4cbf85b36564bfc3e5e39ffac4 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 17 May 2017 14:32:14 +0200 Subject: Fix: Generator compilation warnings. Change-Id: Ib9267901da5f0cddd191b5736e47b43c696a85e6 Signed-off-by: Romain Forlot --- CAN-config-generator/src/openxc/can_message.cpp | 6 +++--- CAN-config-generator/src/openxc/message_set.cpp | 2 +- CAN-config-generator/src/openxc/signal.cpp | 6 +++--- CAN-config-generator/src/openxc/signal.hpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CAN-config-generator/src/openxc/can_message.cpp b/CAN-config-generator/src/openxc/can_message.cpp index fab5a85f..40e897b2 100755 --- a/CAN-config-generator/src/openxc/can_message.cpp +++ b/CAN-config-generator/src/openxc/can_message.cpp @@ -69,8 +69,8 @@ namespace openxc name_ = j.count("name") ? j["name"].get() : ""; handlers_ = j.count("handlers") ? j["handlers"].get>() : std::vector(); enabled_ = j.count("enabled") ? j["enabled"].get() : true; - max_frequency_ = j.count("max_frequency") ? j["max_frequency"].get() : 0; - max_signal_frequency_ = j.count("max_signal_frequency") ? j["max_signal_frequency"].get() : 0; + max_frequency_ = (float)j.count("max_frequency") ? j["max_frequency"].get() : 5; + max_signal_frequency_ = j.count("max_signal_frequency") ? j["max_signal_frequency"].get() : 5; force_send_changed_ = j.count("force_send_changed") ? j["force_send_changed"].get() : true; force_send_changed_signals_ = j.count("force_send_changed_signals") ? j["force_send_changed_signals"].get() : false; @@ -89,7 +89,7 @@ namespace openxc std::uint32_t can_message::get_signals_count() const { - return signals_.size(); + return (uint32_t)signals_.size(); } nlohmann::json can_message::to_json() const diff --git a/CAN-config-generator/src/openxc/message_set.cpp b/CAN-config-generator/src/openxc/message_set.cpp index c47c45f8..d6745bfc 100755 --- a/CAN-config-generator/src/openxc/message_set.cpp +++ b/CAN-config-generator/src/openxc/message_set.cpp @@ -89,7 +89,7 @@ namespace openxc { name_ = j["name"].get(); bit_numbering_inverted_ = j.count("bit_numbering_inverted") ? j["bit_numbering_inverted"].get() : false; // TODO: should be true by default if database-backed. - max_message_frequency_ = j.count("max_message_frequency") ? j["max_message_frequency"].get() : 0; + max_message_frequency_ = j.count("max_message_frequency") ? j["max_message_frequency"].get() : 0.0f; raw_can_mode_ = j.count("raw_can_mode") ? j["raw_can_mode"].get() : can_bus_mode::off; parents_ = j.count("parents") ? j["parents"].get>() : std::vector(); initializers_ = j.count("initializers") ? j["initializers"].get>() : std::vector(); diff --git a/CAN-config-generator/src/openxc/signal.cpp b/CAN-config-generator/src/openxc/signal.cpp index 6c3ff82a..e9c1088b 100755 --- a/CAN-config-generator/src/openxc/signal.cpp +++ b/CAN-config-generator/src/openxc/signal.cpp @@ -34,7 +34,7 @@ namespace openxc return factor_; } - std::uint32_t signal::offset() const + float signal::offset() const { return offset_; } @@ -90,11 +90,11 @@ namespace openxc bit_position_ = j.count("bit_position") ? j["bit_position"].get() : 0; bit_size_ = j.count("bit_size") ? j["bit_size"].get() : 0; factor_ = j.count("factor") ? j["factor"].get() : 1.0f; - offset_ = j.count("offset") ? j["offset"].get() : 0; + offset_ = j.count("offset") ? j["offset"].get() : 0.0f; decoder_ = j.count("decoder") ? j["decoder"].get() : ""; ignore_ = j.count("ignore") ? j["ignore"].get() : false; enabled_ = j.count("enabled") ? j["enabled"].get() : true; - max_frequency_ = j.count("max_frequency") ? j["max_frequency"].get() : 0; + max_frequency_ = j.count("max_frequency") ? j["max_frequency"].get() : 0.0f; send_same_ = j.count("send_same") ? j["send_same"].get() : true; force_send_changed_ = j.count("force_send_changed") ? j["force_send_changed"].get() : false; writable_ = j.count("writable") ? j["writable"].get() : false; diff --git a/CAN-config-generator/src/openxc/signal.hpp b/CAN-config-generator/src/openxc/signal.hpp index 64dba75e..e0124c35 100755 --- a/CAN-config-generator/src/openxc/signal.hpp +++ b/CAN-config-generator/src/openxc/signal.hpp @@ -16,7 +16,7 @@ namespace openxc std::uint32_t bit_position_; std::uint32_t bit_size_; float factor_; - std::uint32_t offset_; + float offset_; std::string decoder_; bool ignore_; bool enabled_; @@ -33,7 +33,7 @@ namespace openxc std::uint32_t bit_position() const; std::uint32_t bit_size() const; float factor() const; - std::uint32_t offset() const; + float offset() const; std::string decoder() const; bool ignore() const; bool enabled() const; -- cgit 1.2.3-korg