MSVC: Resolve warnings
parent
111d377d4a
commit
c620b2ee8b
|
|
@ -142,7 +142,7 @@ static inline bool IdIsSlaveBRange1(size_t fullNetid)
|
|||
return Within(fullNetid, PLASMA_SLAVE2_OFFSET, PLASMA_SLAVE2_OFFSET + PLASMA_SLAVE_NUM);
|
||||
}
|
||||
|
||||
static inline bool IdIsSlaveBRange2(unsigned int fullNetid)
|
||||
static inline bool IdIsSlaveBRange2(size_t fullNetid)
|
||||
{
|
||||
return Within(fullNetid, PLASMA_SLAVE2_OFFSET_RANGE2, PLASMA_SLAVE3_OFFSET_RANGE2);
|
||||
}
|
||||
|
|
@ -168,7 +168,7 @@ static inline bool GetVnetNetid(size_t& netId, EPlasmaIonVnetChannel_t vnetSlot)
|
|||
* the offset from PLASMA_SLAVE1_OFFSET2, return the vnet agnostic
|
||||
* netid so caller can commonize handlers without caring about WHICH slave.
|
||||
*/
|
||||
static inline unsigned int OffsetToSimpleNetworkId(size_t offset)
|
||||
static inline size_t OffsetToSimpleNetworkId(size_t offset)
|
||||
{
|
||||
for (const auto& it : mp_netIDToVnetOffSet)
|
||||
{
|
||||
|
|
@ -181,23 +181,13 @@ static inline unsigned int OffsetToSimpleNetworkId(size_t offset)
|
|||
static inline size_t GetVnetAgnosticNetid(size_t fullNetid)
|
||||
{
|
||||
if (IdIsSlaveARange1(fullNetid))
|
||||
{
|
||||
unsigned int off = fullNetid - PLASMA_SLAVE1_OFFSET;
|
||||
return OffsetToSimpleNetworkId(off);
|
||||
}
|
||||
return OffsetToSimpleNetworkId(fullNetid - PLASMA_SLAVE1_OFFSET);
|
||||
else if (IdIsSlaveARange2(fullNetid))
|
||||
{
|
||||
return fullNetid - PLASMA_SLAVE1_OFFSET_RANGE2;
|
||||
}
|
||||
else if (IdIsSlaveBRange1(fullNetid))
|
||||
{
|
||||
unsigned int off = fullNetid - PLASMA_SLAVE2_OFFSET;
|
||||
return OffsetToSimpleNetworkId(off);
|
||||
}
|
||||
return OffsetToSimpleNetworkId(fullNetid - PLASMA_SLAVE2_OFFSET);
|
||||
else if (IdIsSlaveBRange2(fullNetid))
|
||||
{
|
||||
return fullNetid - PLASMA_SLAVE2_OFFSET_RANGE2;
|
||||
}
|
||||
return fullNetid;
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +223,7 @@ int LegacyDLLExport icsneoFindDevices(NeoDeviceEx* devs, int* devCount, unsigned
|
|||
|
||||
if (devTypes && devTypeCount)
|
||||
{
|
||||
for (auto j = 0; j < devTypeCount; j++)
|
||||
for (unsigned int j = 0; j < devTypeCount; j++)
|
||||
{
|
||||
if (foundDevices[i].DeviceType == devTypes[j])
|
||||
{
|
||||
|
|
@ -1094,7 +1084,8 @@ int LegacyDLLExport icsneoGetDLLFirmwareInfoEx(void* hObject, stAPIFirmwareInfo*
|
|||
int LegacyDLLExport icsneoJ2534Cmd(void* hObject, unsigned char* CmdBuf, short Len, void* pVoid)
|
||||
{
|
||||
uint64_t* pTmp = nullptr;
|
||||
int iRetVal = 0, iNumBytes = 0, NetworkID;
|
||||
int iRetVal = 0, iNumBytes = 0;
|
||||
uint16_t NetworkID = 0;
|
||||
|
||||
if (!icsneoValidateHObject(hObject))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -9,19 +9,19 @@ static optional<uint8_t> CANFD_DLCToLength(uint8_t length) {
|
|||
|
||||
switch(length) {
|
||||
case 0x9:
|
||||
return 12;
|
||||
return uint8_t(12);
|
||||
case 0xa:
|
||||
return 16;
|
||||
return uint8_t(16);
|
||||
case 0xb:
|
||||
return 20;
|
||||
return uint8_t(20);
|
||||
case 0xc:
|
||||
return 24;
|
||||
return uint8_t(24);
|
||||
case 0xd:
|
||||
return 32;
|
||||
return uint8_t(32);
|
||||
case 0xe:
|
||||
return 48;
|
||||
return uint8_t(48);
|
||||
case 0xf:
|
||||
return 64;
|
||||
return uint8_t(64);
|
||||
}
|
||||
return nullopt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ bool HardwareISO9141Packet::EncodeFromMessage(const ISO9141Message& message, std
|
|||
const uint8_t maxSize = (firstPacket ? 9 : 12);
|
||||
uint8_t currentSize = maxSize;
|
||||
if(bytesToSend - currentStart < maxSize)
|
||||
currentSize = bytesToSend - currentStart;
|
||||
currentSize = (uint8_t)(bytesToSend - currentStart);
|
||||
|
||||
packet.insert(packet.begin(), {
|
||||
(uint8_t)Network::NetID::RED, // 0x0C for long message
|
||||
|
|
@ -75,7 +75,7 @@ bool HardwareISO9141Packet::EncodeFromMessage(const ISO9141Message& message, std
|
|||
}
|
||||
|
||||
std::shared_ptr<ISO9141Message> HardwareISO9141Packet::Decoder::decodeToMessage(const std::vector<uint8_t>& bytestream) {
|
||||
const HardwareISO9141Packet* data = (const HardwareISO9141Packet*)bytestream.data();
|
||||
const HardwareISO9141Packet& packet = *reinterpret_cast<const HardwareISO9141Packet*>(bytestream.data());
|
||||
|
||||
if(!mMsg) {
|
||||
mMsg = std::make_shared<ISO9141Message>();
|
||||
|
|
@ -84,8 +84,8 @@ std::shared_ptr<ISO9141Message> HardwareISO9141Packet::Decoder::decodeToMessage(
|
|||
|
||||
mGotPackets++;
|
||||
|
||||
const bool morePacketsComing = data->c3.frm == 0;
|
||||
const uint8_t bytesInCurrentMessage = data->c3.len;
|
||||
const bool morePacketsComing = packet.c3.frm == 0;
|
||||
const uint8_t bytesInCurrentMessage = packet.c3.len;
|
||||
if(mMsg->data.size() + bytesInCurrentMessage > 500) {
|
||||
mMsg.reset();
|
||||
return std::shared_ptr<ISO9141Message>();
|
||||
|
|
@ -93,9 +93,9 @@ std::shared_ptr<ISO9141Message> HardwareISO9141Packet::Decoder::decodeToMessage(
|
|||
|
||||
// This timestamp is raw off the device (in timestampResolution increments)
|
||||
// Decoder will fix as it has information about the timestampResolution increments
|
||||
mMsg->timestamp = data->timestamp.TS;
|
||||
mMsg->timestamp = packet.timestamp.TS;
|
||||
|
||||
auto* dataStart = data->data;
|
||||
auto* dataStart = packet.data;
|
||||
if(mGotPackets == 1) {
|
||||
// Header
|
||||
if(bytesInCurrentMessage < 3) {
|
||||
|
|
@ -103,31 +103,31 @@ std::shared_ptr<ISO9141Message> HardwareISO9141Packet::Decoder::decodeToMessage(
|
|||
return std::shared_ptr<ISO9141Message>();
|
||||
}
|
||||
|
||||
std::copy(data->data, data->data + 3, mMsg->header.begin());
|
||||
std::copy(packet.data, packet.data + 3, mMsg->header.begin());
|
||||
dataStart += 3;
|
||||
}
|
||||
|
||||
// Data
|
||||
mMsg->data.insert(mMsg->data.end(), dataStart, data->data + (bytesInCurrentMessage > 8 ? 8 : bytesInCurrentMessage));
|
||||
mMsg->data.insert(mMsg->data.end(), dataStart, packet.data + (bytesInCurrentMessage > 8 ? 8 : bytesInCurrentMessage));
|
||||
if(bytesInCurrentMessage > 8)
|
||||
mMsg->data.push_back(data->c1.d8);
|
||||
mMsg->data.push_back(packet.c1.d8);
|
||||
if(bytesInCurrentMessage > 9)
|
||||
mMsg->data.push_back(data->c2.d9);
|
||||
mMsg->data.push_back(packet.c2.d9);
|
||||
if(bytesInCurrentMessage > 10)
|
||||
mMsg->data.push_back(data->c2.d10);
|
||||
mMsg->data.push_back(packet.c2.d10);
|
||||
if(bytesInCurrentMessage > 11)
|
||||
mMsg->data.push_back(data->c3.d11);
|
||||
mMsg->data.push_back(packet.c3.d11);
|
||||
|
||||
if(morePacketsComing)
|
||||
return std::shared_ptr<ISO9141Message>();
|
||||
|
||||
mMsg->transmitted = data->c1.tx;
|
||||
mMsg->isInit = data->c3.init;
|
||||
mMsg->framingError = data->c1.options & 0x1;
|
||||
mMsg->overflowError = data->c1.options & 0x2;
|
||||
mMsg->parityError = data->c1.options & 0x4;
|
||||
mMsg->rxTimeoutError = data->c1.options & 0x8;
|
||||
mMsg->description = data->stats;
|
||||
mMsg->transmitted = packet.c1.tx;
|
||||
mMsg->isInit = packet.c3.init;
|
||||
mMsg->framingError = packet.c1.options & 0x1;
|
||||
mMsg->overflowError = packet.c1.options & 0x2;
|
||||
mMsg->parityError = packet.c1.options & 0x4;
|
||||
mMsg->rxTimeoutError = packet.c1.options & 0x8;
|
||||
mMsg->description = packet.stats;
|
||||
|
||||
auto ret = mMsg;
|
||||
mMsg.reset();
|
||||
|
|
|
|||
|
|
@ -636,7 +636,7 @@ int main() {
|
|||
names.push_back("Ethernet (DoIP) Activation Line");
|
||||
if(ethAct > 1) {
|
||||
names.back() += ' ';
|
||||
names.back() += i;
|
||||
names.back() += std::to_string(i);
|
||||
}
|
||||
std::cout << '[' << options.back() << "] " << names.back();
|
||||
const auto val = selectedDevice->getDigitalIO(icsneo::IO::EthernetActivation, i);
|
||||
|
|
@ -655,7 +655,7 @@ int main() {
|
|||
names.push_back("USB Host Power");
|
||||
if(usbHost > 1) {
|
||||
names.back() += ' ';
|
||||
names.back() += i;
|
||||
names.back() += std::to_string(i);
|
||||
}
|
||||
std::cout << '[' << options.back() << "] " << names.back();
|
||||
const auto val = selectedDevice->getDigitalIO(icsneo::IO::USBHostPower, i);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
namespace icsneo {
|
||||
|
||||
static void AddBuiltInExtensionsTo([[maybe_unused]] const std::shared_ptr<icsneo::Device>& device) {
|
||||
static void AddBuiltInExtensionsTo(const std::shared_ptr<icsneo::Device>& device) {
|
||||
(void)device; // [[maybe_unused]]
|
||||
@LIBICSNEO_EXT_CODE@
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ namespace icsneo {
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201) // nameless struct/union
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 2)
|
||||
typedef struct {
|
||||
uint16_t perf_en;
|
||||
|
|
@ -57,8 +62,7 @@ typedef struct {
|
|||
ETHERNET_SETTINGS ethernet;
|
||||
TIMESYNC_ICSHARDWARE_SETTINGS timeSync;
|
||||
STextAPISettings text_api;
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
uint32_t disableUsbCheckOnBoot : 1;
|
||||
uint32_t enableLatencyTest : 1;
|
||||
uint32_t busMessagesToAndroid : 1;
|
||||
|
|
@ -87,6 +91,10 @@ typedef struct {
|
|||
} neovired2_status_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ typedef unsigned __int64 uint64_t;
|
|||
#define IS_64BIT_SYSTEM
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201) // nameless struct/union
|
||||
#endif
|
||||
|
||||
/* OpenPort "OpenType" Argument Constants -- deprecated, use OpenNeoDevice */
|
||||
#define NEOVI_COMMTYPE_RS232 0
|
||||
#define NEOVI_COMMTYPE_USB_BULK 1
|
||||
|
|
@ -2106,6 +2111,8 @@ typedef struct _stCM_ISO157652_RxMessage
|
|||
{
|
||||
uint16_t vs_netid; /* The netid of the message (determines which network to decode receives), not supported */
|
||||
|
||||
uint8_t reservedPacking;
|
||||
|
||||
uint8_t padding; /* The padding byte to use to fill the unused portion of
|
||||
* transmitted CAN frames (flow control), see paddingEnable. */
|
||||
|
||||
|
|
@ -2495,4 +2502,8 @@ CHECK_STRUCT_SIZE(SRADMoon2Settings);
|
|||
|
||||
#endif /* INTREPID_NO_CHECK_STRUCT_SIZE */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif /* _ICSNVC40_H */
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ TEST_F(EventManagerTest, GetSizeFilterTest) {
|
|||
}
|
||||
|
||||
// (Incorrectly) try to get settings type again. 5 {mismatch, warning} remaining.
|
||||
events = EventManager::GetInstance().get(-1, EventFilter(APIEvent::Type::SWCANSettingsNotAvailable));
|
||||
events = EventManager::GetInstance().get(APIEvent::Type::SWCANSettingsNotAvailable);
|
||||
EXPECT_EQ(events.size(), 0);
|
||||
EXPECT_EQ(EventCount(), 5);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue