diff --git a/communication/message/flexray/control/flexraycontrolmessage.cpp b/communication/message/flexray/control/flexraycontrolmessage.cpp index 7d90222..c7ff439 100644 --- a/communication/message/flexray/control/flexraycontrolmessage.cpp +++ b/communication/message/flexray/control/flexraycontrolmessage.cpp @@ -1,5 +1,6 @@ #include #include // memcpy +#include using namespace icsneo; @@ -7,7 +8,7 @@ std::vector FlexRayControlMessage::BuildBaseControlArgs(uint8_t control std::vector ret; ret.reserve(args.size() + 4); ret.push_back(controller); - const uint16_t size = args.size() + 1; // Add 1 for the opcode + const uint16_t size = uint16_t(std::min(args.size() + 1, size_t(std::numeric_limits::max()))); // Add 1 for the opcode ret.push_back(uint8_t(size)); ret.push_back(uint8_t(size >> 8)); ret.push_back(uint8_t(op)); diff --git a/communication/packet/flexraypacket.cpp b/communication/packet/flexraypacket.cpp index ba23aa7..54dcfdb 100644 --- a/communication/packet/flexraypacket.cpp +++ b/communication/packet/flexraypacket.cpp @@ -31,7 +31,7 @@ std::shared_ptr HardwareFlexRayPacket::DecodeToMessage(const std } uint32_t numBytes = data->payload_len * 2; - if(ssize_t(numBytes) >= ssize_t(data->Length) - 4) { + if(int64_t(numBytes) >= int64_t(data->Length) - 4) { if(data->statusBits.bits.fcrc_error) msg->crcStatus = FlexRay::CRCStatus::Error; } else { @@ -47,7 +47,7 @@ std::shared_ptr HardwareFlexRayPacket::DecodeToMessage(const std msg->sync = data->sync; msg->startup = data->startup; msg->id = data->id; - if(ssize_t(numBytes) != ssize_t(data->Length) - 4) { + if(int64_t(numBytes) != int64_t(data->Length) - 4) { } else { // This is an error, probably need to flag it diff --git a/include/icsneo/device/device.h b/include/icsneo/device/device.h index 3a5ee34..6b12d96 100644 --- a/include/icsneo/device/device.h +++ b/include/icsneo/device/device.h @@ -86,7 +86,7 @@ public: virtual size_t getNetworkCountByType(Network::Type) const; virtual Network getNetworkByNumber(Network::Type, size_t) const; - virtual std::shared_ptr getFlexRayControllerByNetwork(const Network& net) const { return nullptr; } + virtual std::shared_ptr getFlexRayControllerByNetwork(const Network&) const { return nullptr; } const device_eventhandler_t& getEventHandler() const { return report; } diff --git a/include/icsneo/device/extensions/deviceextension.h b/include/icsneo/device/extensions/deviceextension.h index ab7ff2b..2979c7f 100644 --- a/include/icsneo/device/extensions/deviceextension.h +++ b/include/icsneo/device/extensions/deviceextension.h @@ -14,7 +14,7 @@ public: DeviceExtension(Device& device) : device(device) {} virtual ~DeviceExtension() = default; virtual const char* getName() const = 0; - virtual void handleMessage(const std::shared_ptr& message) {} + virtual void handleMessage(const std::shared_ptr&) {} protected: Device& device;