Resolve MSVC errors and warnings with refactor
parent
8e6b0d0b0e
commit
9675bb81f7
|
|
@ -2,6 +2,8 @@
|
||||||
#error "icsneoc.cpp must be compiled with a C++ compiler!"
|
#error "icsneoc.cpp must be compiled with a C++ compiler!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define NOMINMAX
|
||||||
|
|
||||||
#define ICSNEOC_MAKEDLL
|
#define ICSNEOC_MAKEDLL
|
||||||
#include "icsneo/icsneolegacy.h"
|
#include "icsneo/icsneolegacy.h"
|
||||||
|
|
||||||
|
|
@ -73,6 +75,7 @@ int icsneoOpenNeoDevice(NeoDevice* pNeoDevice, void** hObject, unsigned char* bN
|
||||||
try {
|
try {
|
||||||
device = &neodevices.at(uint64_t(pNeoDevice->Handle) << 32 | pNeoDevice->SerialNumber);
|
device = &neodevices.at(uint64_t(pNeoDevice->Handle) << 32 | pNeoDevice->SerialNumber);
|
||||||
} catch(std::out_of_range& e) {
|
} catch(std::out_of_range& e) {
|
||||||
|
(void)e; // Unused
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -124,7 +127,7 @@ int icsneoGetMessages(void* hObject, icsSpyMessage* pMsg, int* pNumberOfMessages
|
||||||
memcpy(oldmsg.Data, newmsg.data, std::min(newmsg.length, (size_t)8));
|
memcpy(oldmsg.Data, newmsg.data, std::min(newmsg.length, (size_t)8));
|
||||||
oldmsg.ArbIDOrHeader = *(uint32_t*)newmsg.header;
|
oldmsg.ArbIDOrHeader = *(uint32_t*)newmsg.header;
|
||||||
oldmsg.ExtraDataPtrEnabled = newmsg.length > 8;
|
oldmsg.ExtraDataPtrEnabled = newmsg.length > 8;
|
||||||
oldmsg.NetworkID = newmsg.netid;
|
oldmsg.NetworkID = (uint8_t)newmsg.netid; // TODO Handling for this?
|
||||||
switch(Network::Type(newmsg.type)) {
|
switch(Network::Type(newmsg.type)) {
|
||||||
case Network::Type::CAN:
|
case Network::Type::CAN:
|
||||||
oldmsg.Protocol = SPY_PROTOCOL_CAN;
|
oldmsg.Protocol = SPY_PROTOCOL_CAN;
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@ private:
|
||||||
} timestamp;
|
} timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4201) // nameless struct/union
|
||||||
|
#endif
|
||||||
union CoreMiniStatusBits_t {
|
union CoreMiniStatusBits_t {
|
||||||
struct {
|
struct {
|
||||||
unsigned just_reset : 1;
|
unsigned just_reset : 1;
|
||||||
|
|
@ -75,6 +79,9 @@ private:
|
||||||
};
|
};
|
||||||
uint32_t dword;
|
uint32_t dword;
|
||||||
};
|
};
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
struct HardwareResetStatusPacket {
|
struct HardwareResetStatusPacket {
|
||||||
uint16_t main_loop_time_25ns;
|
uint16_t main_loop_time_25ns;
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
|
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
|
|
||||||
class Encoder {
|
class Encoder {
|
||||||
|
|
@ -29,6 +27,4 @@ private:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4201) // nameless struct/union
|
||||||
|
#endif
|
||||||
typedef union {
|
typedef union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t globalError : 1;
|
uint32_t globalError : 1;
|
||||||
|
|
@ -91,6 +95,9 @@ typedef union {
|
||||||
};
|
};
|
||||||
uint32_t statusBitfield[4];
|
uint32_t statusBitfield[4];
|
||||||
} neomessage_statusbitfield_t;
|
} neomessage_statusbitfield_t;
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
neomessage_statusbitfield_t status;
|
neomessage_statusbitfield_t status;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ class NeoVIFIRE2ETH : public NeoVIFIRE2 {
|
||||||
public:
|
public:
|
||||||
static constexpr const uint16_t PRODUCT_ID = 0x0004;
|
static constexpr const uint16_t PRODUCT_ID = 0x0004;
|
||||||
NeoVIFIRE2ETH(neodevice_t neodevice) : NeoVIFIRE2(neodevice) {
|
NeoVIFIRE2ETH(neodevice_t neodevice) : NeoVIFIRE2(neodevice) {
|
||||||
com = MakeCommunicaiton(std::unique_ptr<ICommunication>(new PCAP(getWritableNeoDevice())));
|
com = MakeCommunication(std::unique_ptr<ICommunication>(new PCAP(getWritableNeoDevice())));
|
||||||
settings = std::unique_ptr<IDeviceSettings>(new NeoVIFIRE2Settings(com));
|
settings = std::unique_ptr<IDeviceSettings>(new NeoVIFIRE2Settings(com));
|
||||||
settings->readonly = true;
|
settings->readonly = true;
|
||||||
productId = PRODUCT_ID;
|
productId = PRODUCT_ID;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4201) // nameless struct/union
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define ALIGNED_(x) __declspec(align(x))
|
#define ALIGNED_(x) __declspec(align(x))
|
||||||
#else
|
#else
|
||||||
|
|
@ -817,8 +822,8 @@ typedef struct ALIGNED_(2)
|
||||||
unsigned short brgh;
|
unsigned short brgh;
|
||||||
unsigned short parity;
|
unsigned short parity;
|
||||||
unsigned short stop_bits;
|
unsigned short stop_bits;
|
||||||
byte flow_control; // 0- off, 1 - Simple CTS RTS,
|
unsigned char flow_control; // 0- off, 1 - Simple CTS RTS,
|
||||||
byte reserved_1;
|
unsigned char reserved_1;
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
|
@ -1060,7 +1065,10 @@ typedef struct ALIGNED_(2) _stCM_ISO157652_TxMessage
|
||||||
}stCM_ISO157652_TxMessage;
|
}stCM_ISO157652_TxMessage;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4324) // nameless struct/union
|
||||||
|
#endif
|
||||||
typedef struct ALIGNED_(2)
|
typedef struct ALIGNED_(2)
|
||||||
{
|
{
|
||||||
//transmit message
|
//transmit message
|
||||||
|
|
@ -1102,6 +1110,9 @@ typedef struct ALIGNED_(2)
|
||||||
unsigned char reserved[16];
|
unsigned char reserved[16];
|
||||||
|
|
||||||
}stCM_ISO157652_RxMessage;
|
}stCM_ISO157652_RxMessage;
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1194,3 +1205,6 @@ typedef struct // matching C structure
|
||||||
unsigned char MiscData;
|
unsigned char MiscData;
|
||||||
} icsSpyMessageJ1850;
|
} icsSpyMessageJ1850;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue