Skip to content

Commit e911755

Browse files
Pierre-Luc Tessier Gagnédrebbe-intrepid
authored andcommitted
Fix for platform where sizeof(int) != sizeof(long)
When building the current code on a platform where int and long are not the same size, spy_message do not have the correct structure definition. For example building on Ubuntu 16.04 x86_64 result in some spy_message not being corrected formatted. The ArbIDOrHeader also changed from signed to unsigned to match the included icsnVC40 header file. (cherry picked from commit 19fba47)
1 parent 283aa57 commit e911755

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

include/object_neo_device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ typedef struct {
5959

6060
static PyMemberDef neo_device_object_members[] = {
6161
{ "Name", T_OBJECT_EX, offsetof(neo_device_object, name), 0, "String describing DeviceType, extension to Python api only." },
62-
{ "DeviceType", T_ULONG, offsetof(neo_device_object, dev.DeviceType), 0, "" },
62+
{ "DeviceType", T_UINT, offsetof(neo_device_object, dev.DeviceType), 0, "" },
6363
{ "Handle", T_INT, offsetof(neo_device_object, dev.Handle), 0, "" },
6464
{ "NumberOfClients", T_INT, offsetof(neo_device_object, dev.NumberOfClients), 0, "" },
6565
{ "SerialNumber", T_INT, offsetof(neo_device_object, dev.SerialNumber), 0, "" },

include/object_spy_message.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ typedef struct {
4747
} spy_message_j1850_object;
4848

4949
static PyMemberDef spy_message_object_members[] = {
50-
{ "StatusBitField", T_ULONG, offsetof(spy_message_object, msg.StatusBitField), 0, "StatusBitField" },
51-
{ "StatusBitField2", T_ULONG, offsetof(spy_message_object, msg.StatusBitField2), 0, "StatusBitField2" },
52-
{ "TimeHardware", T_ULONG, offsetof(spy_message_object, msg.TimeHardware), 0, "Hardware time stamp. The TimeStamp is reset on device open" },
53-
{ "TimeHardware2", T_ULONG, offsetof(spy_message_object, msg.TimeHardware2), 0, "Hardware time stamp. The TimeStamp is reset on device open" },
54-
{ "TimeSystem", T_ULONG, offsetof(spy_message_object, msg.TimeSystem), 0, "TimeSystem is loaded with the value received from the timeGetTime call in the WIN32 multimedia API." },
55-
{ "TimeSystem2", T_ULONG, offsetof(spy_message_object, msg.TimeSystem2), 0, "TimeSystem is loaded with the value received from the timeGetTime call in the WIN32 multimedia API." },
50+
{ "StatusBitField", T_UINT, offsetof(spy_message_object, msg.StatusBitField), 0, "StatusBitField" },
51+
{ "StatusBitField2", T_UINT, offsetof(spy_message_object, msg.StatusBitField2), 0, "StatusBitField2" },
52+
{ "TimeHardware", T_UINT, offsetof(spy_message_object, msg.TimeHardware), 0, "Hardware time stamp. The TimeStamp is reset on device open" },
53+
{ "TimeHardware2", T_UINT, offsetof(spy_message_object, msg.TimeHardware2), 0, "Hardware time stamp. The TimeStamp is reset on device open" },
54+
{ "TimeSystem", T_UINT, offsetof(spy_message_object, msg.TimeSystem), 0, "TimeSystem is loaded with the value received from the timeGetTime call in the WIN32 multimedia API." },
55+
{ "TimeSystem2", T_UINT, offsetof(spy_message_object, msg.TimeSystem2), 0, "TimeSystem is loaded with the value received from the timeGetTime call in the WIN32 multimedia API." },
5656
{ "TimeStampHardwareID", T_UBYTE, offsetof(spy_message_object, msg.TimeStampHardwareID), 0, "This is an identifier of what type of hardware timestamp is used. Since neoVI's timestamp is always the same, this doesn't change." },
5757
{ "TimeStampSystemID", T_UBYTE, offsetof(spy_message_object, msg.TimeStampSystemID), 0, "This is an identifier of what type of system timestamp is used. Since WIN32 neoVI's timestamp is always the same, from the timeGetTime API, this doesn't change." },
5858
{ "NetworkID", T_UBYTE, offsetof(spy_message_object, msg.NetworkID), 0, "This value is used to identify which network this message was received on." },
@@ -64,10 +64,10 @@ static PyMemberDef spy_message_object_members[] = {
6464
{ "NumberBytesData", T_UBYTE, offsetof(spy_message_object, msg.NumberBytesData), 0, "Holds the number of bytes in the Data(1 to 8) array or the number of bytes in a CAN remote frame (The DLC)." },
6565
{ "NetworkID2", T_UBYTE, offsetof(spy_message_object, msg.NetworkID2), 0, "This value is used to identify which network this message was received on." },
6666
{ "DescriptionID", T_SHORT, offsetof(spy_message_object, msg.DescriptionID), 0, "Not Used" },
67-
{ "ArbIDOrHeader", T_LONG, offsetof(spy_message_object, msg.ArbIDOrHeader), 0, "" },
67+
{ "ArbIDOrHeader", T_UINT, offsetof(spy_message_object, msg.ArbIDOrHeader), 0, "" },
6868
{ "Data", T_OBJECT_EX, NULL, 0, "" },
69-
{ "StatusBitField3", T_ULONG, offsetof(spy_message_object, msg.StatusBitField3), 0, "StatusBitField3" },
70-
{ "StatusBitField4", T_ULONG, offsetof(spy_message_object, msg.StatusBitField4), 0, "StatusBitField4" },
69+
{ "StatusBitField3", T_UINT, offsetof(spy_message_object, msg.StatusBitField3), 0, "StatusBitField3" },
70+
{ "StatusBitField4", T_UINT, offsetof(spy_message_object, msg.StatusBitField4), 0, "StatusBitField4" },
7171
{ "AckBytes", T_OBJECT_EX, NULL, 0, "" },
7272
{ "ExtraDataPtr", T_OBJECT_EX, offsetof(spy_message_object, msg.ExtraDataPtr), 0, "" },
7373
{ "MiscData", T_UBYTE, offsetof(spy_message_object, msg.MiscData), 0, "" },
@@ -76,12 +76,12 @@ static PyMemberDef spy_message_object_members[] = {
7676
};
7777

7878
static PyMemberDef spy_message_j1850_object_members[] = {
79-
{ "StatusBitField", T_ULONG, offsetof(spy_message_j1850_object, msg.StatusBitField), 0, "StatusBitField" },
80-
{ "StatusBitField2", T_ULONG, offsetof(spy_message_j1850_object, msg.StatusBitField2), 0, "StatusBitField2" },
81-
{ "TimeHardware", T_ULONG, offsetof(spy_message_j1850_object, msg.TimeHardware), 0, "Hardware time stamp. The TimeStamp is reset on device open" },
82-
{ "TimeHardware2", T_ULONG, offsetof(spy_message_j1850_object, msg.TimeHardware2), 0, "Hardware time stamp. The TimeStamp is reset on device open" },
83-
{ "TimeSystem", T_ULONG, offsetof(spy_message_j1850_object, msg.TimeSystem), 0, "TimeSystem is loaded with the value received from the timeGetTime call in the WIN32 multimedia API." },
84-
{ "TimeSystem2", T_ULONG, offsetof(spy_message_j1850_object, msg.TimeSystem2), 0, "TimeSystem is loaded with the value received from the timeGetTime call in the WIN32 multimedia API." },
79+
{ "StatusBitField", T_UINT, offsetof(spy_message_j1850_object, msg.StatusBitField), 0, "StatusBitField" },
80+
{ "StatusBitField2", T_UINT, offsetof(spy_message_j1850_object, msg.StatusBitField2), 0, "StatusBitField2" },
81+
{ "TimeHardware", T_UINT, offsetof(spy_message_j1850_object, msg.TimeHardware), 0, "Hardware time stamp. The TimeStamp is reset on device open" },
82+
{ "TimeHardware2", T_UINT, offsetof(spy_message_j1850_object, msg.TimeHardware2), 0, "Hardware time stamp. The TimeStamp is reset on device open" },
83+
{ "TimeSystem", T_UINT, offsetof(spy_message_j1850_object, msg.TimeSystem), 0, "TimeSystem is loaded with the value received from the timeGetTime call in the WIN32 multimedia API." },
84+
{ "TimeSystem2", T_UINT, offsetof(spy_message_j1850_object, msg.TimeSystem2), 0, "TimeSystem is loaded with the value received from the timeGetTime call in the WIN32 multimedia API." },
8585
{ "TimeStampHardwareID", T_UBYTE, offsetof(spy_message_j1850_object, msg.TimeStampHardwareID), 0, "This is an identifier of what type of hardware timestamp is used. Since neoVI's timestamp is always the same, this doesn't change." },
8686
{ "TimeStampSystemID", T_UBYTE, offsetof(spy_message_j1850_object, msg.TimeStampSystemID), 0, "This is an identifier of what type of system timestamp is used. Since WIN32 neoVI's timestamp is always the same, from the timeGetTime API, this doesn't change." },
8787
{ "NetworkID", T_UBYTE, offsetof(spy_message_j1850_object, msg.NetworkID), 0, "This value is used to identify which network this message was received on." },
@@ -95,8 +95,8 @@ static PyMemberDef spy_message_j1850_object_members[] = {
9595
{ "DescriptionID", T_SHORT, offsetof(spy_message_j1850_object, msg.DescriptionID), 0, "Not Used" },
9696
{ "Header", T_OBJECT_EX, NULL, 0, "" },
9797
{ "Data", T_OBJECT_EX, NULL, 0, "" },
98-
{ "StatusBitField3", T_ULONG, offsetof(spy_message_j1850_object, msg.StatusBitField3), 0, "StatusBitField3" },
99-
{ "StatusBitField4", T_ULONG, offsetof(spy_message_j1850_object, msg.StatusBitField4), 0, "StatusBitField4" },
98+
{ "StatusBitField3", T_UINT, offsetof(spy_message_j1850_object, msg.StatusBitField3), 0, "StatusBitField3" },
99+
{ "StatusBitField4", T_UINT, offsetof(spy_message_j1850_object, msg.StatusBitField4), 0, "StatusBitField4" },
100100
{ "AckBytes", T_OBJECT_EX, NULL, 0, "" },
101101
{ "ExtraDataPtr", T_OBJECT_EX, offsetof(spy_message_j1850_object, msg.ExtraDataPtr), 0, "" },
102102
{ "MiscData", T_UBYTE, offsetof(spy_message_j1850_object, msg.MiscData), 0, "" },

0 commit comments

Comments
 (0)