diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-12-26 05:57:06 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-12-26 05:57:06 +0000 |
commit | 8ed7a73e22c049a2e013bb436e599bff41fc5b9b (patch) | |
tree | ad4a4cc6fb4ff4d3e3ffe3a3f8e3d056e441ae46 /plugins/ethercat | |
parent | 8ede6b7dc09aa636f87147ab432a137c209e8aca (diff) |
Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().
Change some data types to avoid those implicit conversion warnings.
When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.
Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers. Cast
away those warnings in some cases where an API we don't control forces
us to do so.
Enable a bunch of additional warnings by default. Note why at least
some of the other warnings aren't enabled.
randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.
If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.
svn path=/trunk/; revision=46748
Diffstat (limited to 'plugins/ethercat')
-rw-r--r-- | plugins/ethercat/packet-ams.c | 186 | ||||
-rw-r--r-- | plugins/ethercat/packet-ams.h | 34 | ||||
-rw-r--r-- | plugins/ethercat/packet-ecatmb.c | 22 | ||||
-rw-r--r-- | plugins/ethercat/packet-ethercat-datagram.c | 22 | ||||
-rw-r--r-- | plugins/ethercat/packet-ethercat-frame.h | 2 | ||||
-rw-r--r-- | plugins/ethercat/packet-ioraw.h | 2 | ||||
-rw-r--r-- | plugins/ethercat/packet-nv.c | 28 | ||||
-rw-r--r-- | plugins/ethercat/packet-nv.h | 4 |
8 files changed, 150 insertions, 150 deletions
diff --git a/plugins/ethercat/packet-ams.c b/plugins/ethercat/packet-ams.c index 3e096f11d5..0740c98c06 100644 --- a/plugins/ethercat/packet-ams.c +++ b/plugins/ethercat/packet-ams.c @@ -431,43 +431,43 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi proto_tree_add_string(ams_tree, hf_ams_targetnetid, tvb, offset, AmsNetId_Len, szText); offset += AmsNetId_Len; - proto_tree_add_item(ams_tree, hf_ams_targetport, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset += sizeof(guint16); + proto_tree_add_item(ams_tree, hf_ams_targetport, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset += (int)sizeof(guint16); NetIdFormater(tvb, offset, szText, nMax); proto_tree_add_string(ams_tree, hf_ams_sendernetid, tvb, offset, AmsNetId_Len, szText); offset += AmsNetId_Len; - proto_tree_add_item(ams_tree, hf_ams_senderport, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset += sizeof(guint16); + proto_tree_add_item(ams_tree, hf_ams_senderport, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset += (int)sizeof(guint16); - proto_tree_add_item(ams_tree, hf_ams_cmdid, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_tree, hf_ams_cmdid, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); cmdId = tvb_get_letohs(tvb, offset); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); - anItem = proto_tree_add_item(ams_tree, hf_ams_stateflags, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + anItem = proto_tree_add_item(ams_tree, hf_ams_stateflags, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); ams_statetree = proto_item_add_subtree(anItem, ett_ams_stateflags); - proto_tree_add_item(ams_statetree, hf_ams_stateresponse,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statenoreturn,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_stateadscmd,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statesyscmd,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statehighprio,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statetimestampadded,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_stateudp,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_stateinitcmd,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statebroadcast,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateresponse,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statenoreturn,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateadscmd,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statesyscmd,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statehighprio,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statetimestampadded,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateudp,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateinitcmd,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statebroadcast,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); stateflags = tvb_get_letohs(tvb, offset); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); - proto_tree_add_item(ams_tree, hf_ams_cbdata, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_tree, hf_ams_cbdata, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); cbdata = tvb_get_letohl(tvb,offset); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_tree, hf_ams_errorcode, tvb, offset, sizeof(guint32),ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_tree, hf_ams_errorcode, tvb, offset, (int)sizeof(guint32),ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_tree, hf_ams_invokeid, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_tree, hf_ams_invokeid, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); } else { @@ -492,14 +492,14 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsReadReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadrequest); - proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); } } } @@ -511,17 +511,17 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adswriterequest, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsWriteReq_Len - sizeof(guint16) ) + if( ams_length-offset >= TAdsWriteReq_Len - (int)sizeof(guint16) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswriterequest); proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -535,20 +535,20 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adsreadwriterequest, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsReadWriteReq_Len - sizeof(guint16)) + if( ams_length-offset >= TAdsReadWriteReq_Len - (int)sizeof(guint16)) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadwriterequest); - proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscbreadlength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscbreadlength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscbwritelength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscbwritelength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset+16, ams_length-offset, ENC_NA); } @@ -565,7 +565,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsReadStateReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadstaterequest); - proto_tree_add_item(ams_adstree, hf_ams_adsinvokeid, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsinvokeid, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -577,17 +577,17 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adswritectrlrequest, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsWriteControlReq_Len - sizeof(guint16) ) + if( ams_length-offset >= TAdsWriteControlReq_Len - (int)sizeof(guint16) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswritectrlrequest); proto_tree_add_item(ams_adstree, hf_ams_adsstate, tvb, offset, 2, ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); proto_tree_add_item(ams_adstree, hf_ams_adsdevicestate, tvb, offset, 2, ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -604,7 +604,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsReadDeviceInfoReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreaddinforequest); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -619,23 +619,23 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsAddDeviceNotificationReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsadddnrequest); - proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adstransmode, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adstransmode, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsmaxdelay, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsmaxdelay, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscycletime, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscycletime, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); } } } @@ -650,7 +650,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsDelDeviceNotificationReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsdeldnrequest); - proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -668,13 +668,13 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsDeviceNotificationReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsdnrequest); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); /*cbLength = tvb_get_letohs(tvb, offset);*/ - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsnoteblocksstamps, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsnoteblocksstamps, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); /*nStamps = tvb_get_letohs(tvb, offset);*/ - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); /*ToDo: dissect noteblocks*/ } @@ -695,14 +695,14 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adsreadresponse, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsReadRes_Len - sizeof(guint16) ) + if( ams_length-offset >= TAdsReadRes_Len - (int)sizeof(guint16) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -719,7 +719,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsWriteRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswriteresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -731,14 +731,14 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adsreadwriteresponse, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsReadWriteRes_Len - sizeof(guint16) ) + if( ams_length-offset >= TAdsReadWriteRes_Len - (int)sizeof(guint16) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadwriteresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -755,13 +755,13 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsReadStateRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadstateresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsstate, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsstate, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsdevicestate, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsdevicestate, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); } } } @@ -776,7 +776,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsWriteControlRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswritectrlresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -791,13 +791,13 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsReadDeviceInfoRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreaddinforesponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsversionversion, tvb, offset++, sizeof(guint8), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_adstree, hf_ams_adsversionrevision, tvb, offset++, sizeof(guint8), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_adstree, hf_ams_adsversionbuild, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + proto_tree_add_item(ams_adstree, hf_ams_adsversionversion, tvb, offset++, (int)sizeof(guint8), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsversionrevision, tvb, offset++, (int)sizeof(guint8), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsversionbuild, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint16); proto_tree_add_item(ams_adstree, hf_ams_adsdevicename, tvb, offset, ams_length-offset, ENC_ASCII|ENC_NA); } @@ -814,10 +814,10 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsAddDeviceNotificationRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsadddnresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -832,7 +832,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsDelDeviceNotificationRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsdeldnresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } diff --git a/plugins/ethercat/packet-ams.h b/plugins/ethercat/packet-ams.h index befa02b696..6ffc2315a7 100644 --- a/plugins/ethercat/packet-ams.h +++ b/plugins/ethercat/packet-ams.h @@ -675,7 +675,7 @@ typedef struct AmsNetId_ { guint8 b[6]; } AmsNetId; -#define AmsNetId_Len sizeof(AmsNetId) +#define AmsNetId_Len (int)sizeof(AmsNetId) typedef struct AmsAddr_ { @@ -710,7 +710,7 @@ typedef struct ErrCodeUnion anErrCodeUnion; UserUnion aUserUnion; } AmsHead; -#define AmsHead_Len sizeof(AmsHead) +#define AmsHead_Len (int)sizeof(AmsHead) /* State flags */ @@ -992,7 +992,7 @@ typedef struct guint32 invokeId; } TAdsReadDeviceInfoReq; -#define TAdsReadDeviceInfoReq_Len sizeof(TAdsReadDeviceInfoReq) +#define TAdsReadDeviceInfoReq_Len (int)sizeof(TAdsReadDeviceInfoReq) /*typedef struct { @@ -1007,7 +1007,7 @@ typedef struct { guint32 invokeId; } TAdsReadStateReq; -#define TAdsReadStateReq_Len sizeof(TAdsReadStateReq) +#define TAdsReadStateReq_Len (int)sizeof(TAdsReadStateReq) typedef struct { @@ -1015,7 +1015,7 @@ typedef struct guint32 indexOffset; guint32 cbLength; } TAdsReadReq; -#define TAdsReadReq_Len sizeof(TAdsReadReq) +#define TAdsReadReq_Len (int)sizeof(TAdsReadReq) /*typedef struct { @@ -1053,26 +1053,26 @@ typedef struct guint32 indexOffset; AdsNotificationAttrib noteAttrib; } TAdsAddDeviceNotificationReq; -#define TAdsAddDeviceNotificationReq_Len sizeof(TAdsAddDeviceNotificationReq) +#define TAdsAddDeviceNotificationReq_Len (int)sizeof(TAdsAddDeviceNotificationReq) typedef struct { guint32 hNotification; } TAdsDelDeviceNotificationReq; -#define TAdsDelDeviceNotificationReq_Len sizeof(TAdsDelDeviceNotificationReq) +#define TAdsDelDeviceNotificationReq_Len (int)sizeof(TAdsDelDeviceNotificationReq) typedef struct { guint32 cbLength; guint32 nStamps; } TAdsDeviceNotificationReq; -#define TAdsDeviceNotificationReq_Len sizeof(TAdsDeviceNotificationReq) +#define TAdsDeviceNotificationReq_Len (int)sizeof(TAdsDeviceNotificationReq) typedef struct { guint32 result; } TAdsRes; -#define TAdsRes_Len sizeof(TAdsRes) +#define TAdsRes_Len (int)sizeof(TAdsRes) typedef struct { @@ -1087,13 +1087,13 @@ typedef struct AdsVersion version; char sName[ADS_FIXEDNAMESIZE]; } TAdsReadDeviceInfoRes; -#define TAdsReadDeviceInfoRes_Len sizeof(TAdsReadDeviceInfoRes) +#define TAdsReadDeviceInfoRes_Len (int)sizeof(TAdsReadDeviceInfoRes) typedef struct { guint32 result; } TAdsWriteControlRes; -#define TAdsWriteControlRes_Len sizeof(TAdsWriteControlRes) +#define TAdsWriteControlRes_Len (int)sizeof(TAdsWriteControlRes) typedef struct { @@ -1101,7 +1101,7 @@ typedef struct guint16 adsState; guint16 deviceState; } TAdsReadStateRes; -#define TAdsReadStateRes_Len sizeof(TAdsReadStateRes) +#define TAdsReadStateRes_Len (int)sizeof(TAdsReadStateRes) typedef struct { @@ -1109,7 +1109,7 @@ typedef struct guint32 cbLength; guint16 firstDataWord; } TAdsReadRes; -#define TAdsReadRes_Len sizeof(TAdsReadRes) +#define TAdsReadRes_Len (int)sizeof(TAdsReadRes) typedef struct { @@ -1117,26 +1117,26 @@ typedef struct guint32 cbLength; guint16 firstDataWord; } TAdsReadWriteRes; -#define TAdsReadWriteRes_Len sizeof(TAdsReadWriteRes) +#define TAdsReadWriteRes_Len (int)sizeof(TAdsReadWriteRes) typedef struct { guint32 result; } TAdsWriteRes; -#define TAdsWriteRes_Len sizeof(TAdsWriteRes) +#define TAdsWriteRes_Len (int)sizeof(TAdsWriteRes) typedef struct { guint32 result; guint32 handle; } TAdsAddDeviceNotificationRes; -#define TAdsAddDeviceNotificationRes_Len sizeof(TAdsAddDeviceNotificationRes) +#define TAdsAddDeviceNotificationRes_Len (int)sizeof(TAdsAddDeviceNotificationRes) typedef struct { guint32 result; } TAdsDelDeviceNotificationRes; -#define TAdsDelDeviceNotificationRes_Len sizeof(TAdsDelDeviceNotificationRes) +#define TAdsDelDeviceNotificationRes_Len (int)sizeof(TAdsDelDeviceNotificationRes) /* structure for decoding the header -----------------------------------------*/ diff --git a/plugins/ethercat/packet-ecatmb.c b/plugins/ethercat/packet-ecatmb.c index 7620734ab4..3ab266c3f4 100644 --- a/plugins/ethercat/packet-ecatmb.c +++ b/plugins/ethercat/packet-ecatmb.c @@ -253,14 +253,14 @@ static const true_false_string tfs_complete = void init_mbx_header(PETHERCAT_MBOX_HEADER pMbox, tvbuff_t *tvb, gint offset) { - pMbox->Length = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); - pMbox->Address = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); + pMbox->Length = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); + pMbox->Address = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); pMbox->aControlUnion.Control = tvb_get_letohs(tvb, offset); } void init_eoe_header(PETHERCAT_EOE_HEADER pEoE, tvbuff_t *tvb, gint offset) { - pEoE->anEoeHeaderInfoUnion.Info = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); + pEoE->anEoeHeaderInfoUnion.Info = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); pEoE->anEoeHeaderDataUnion.Result = tvb_get_letohs(tvb, offset); } @@ -286,7 +286,7 @@ void init_coe_header(PETHERCAT_COE_HEADER pCoE, tvbuff_t *tvb, gint offset) void init_sdo_header(PETHERCAT_SDO_HEADER pSdo, tvbuff_t *tvb, gint offset) { pSdo->anSdoHeaderUnion.CS = tvb_get_guint8(tvb, offset++); - pSdo->Index = tvb_get_letohs(tvb, offset);offset+=sizeof(guint16); + pSdo->Index = tvb_get_letohs(tvb, offset);offset+=(int)sizeof(guint16); pSdo->SubIndex = tvb_get_guint8(tvb, offset++); pSdo->Data = tvb_get_letohl(tvb, offset); } @@ -295,7 +295,7 @@ void init_sdo_info_header(PETHERCAT_SDO_INFO_HEADER pInfo, tvbuff_t *tvb, gint o { pInfo->anSdoControlUnion.Control = tvb_get_guint8(tvb, offset++); pInfo->Reserved = tvb_get_guint8(tvb, offset); - pInfo->FragmentsLeft = sizeof(guint16); + pInfo->FragmentsLeft = (int)sizeof(guint16); } @@ -435,7 +435,7 @@ static void CANopenSdoResFormatter(PETHERCAT_SDO_HEADER pSdo, char *szText, gint static void CANopenSdoInfoFormatter(PETHERCAT_SDO_INFO_HEADER pHead, char *szText, gint nMax) { guint8 opCode = pHead->anSdoControlUnion.v.OpCode & 0x7F; - char* txt2 = ""; + const char* txt2 = ""; if ( (pHead->anSdoControlUnion.v.OpCode & 0x80) != 0 ) txt2 = " - More Follows"; switch (opCode) @@ -1161,10 +1161,10 @@ static void dissect_ecat_eoe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro proto_tree_add_item(ecat_eoe_macfilter_filter_tree, hf_ecat_mailbox_eoe_macfilter_filters[nCnt], tvb, offset+nCnt*ETHERNET_ADDRESS_LEN, ETHERNET_ADDRESS_LEN, ENC_NA); offset+=16*ETHERNET_ADDRESS_LEN; - anItem = proto_tree_add_item(ecat_eoe_macfilter_tree, hf_ecat_mailbox_eoe_macfilter_filtermask, tvb, offset, 4*sizeof(guint32), ENC_NA); + anItem = proto_tree_add_item(ecat_eoe_macfilter_tree, hf_ecat_mailbox_eoe_macfilter_filtermask, tvb, offset, 4*(int)sizeof(guint32), ENC_NA); ecat_eoe_macfilter_filtermask_tree = proto_item_add_subtree(anItem, ett_ecat_mailbox_eoe_macfilter_filtermask); for( nCnt=0; nCnt<options.v.MacFilterMaskCount; nCnt++) - proto_tree_add_item(ecat_eoe_macfilter_filtermask_tree, hf_ecat_mailbox_eoe_macfilter_filtermasks[nCnt], tvb, offset+nCnt*sizeof(guint32), sizeof(guint32), ENC_NA); + proto_tree_add_item(ecat_eoe_macfilter_filtermask_tree, hf_ecat_mailbox_eoe_macfilter_filtermasks[nCnt], tvb, offset+nCnt*(int)sizeof(guint32), (int)sizeof(guint32), ENC_NA); } else proto_item_append_text(anItem, " - Invalid length!"); @@ -1319,15 +1319,15 @@ static void dissect_ecat_mailbox(tvbuff_t *tvb, packet_info *pinfo, proto_tree * /* Add length information to the mailbox header */ proto_tree_add_item(ecat_mailbox_header_tree, hf_ecat_mailboxlength, tvb, offset, sizeof(hdr.Length), ENC_LITTLE_ENDIAN); - offset+=sizeof(hdr.Length); + offset+=(int)sizeof(hdr.Length); /* Add address information to the mailbox header */ proto_tree_add_item(ecat_mailbox_header_tree, hf_ecat_mailboxaddress, tvb, offset, sizeof(hdr.Address), ENC_LITTLE_ENDIAN); - offset+=sizeof(hdr.Address); + offset+=(int)sizeof(hdr.Address); /* Add priority information to the mailbox header */ proto_tree_add_text(ecat_mailbox_header_tree, tvb, offset, 1, "Priority: %d", tvb_get_guint8(tvb, offset) & 0x3); - offset+=sizeof(guint8); + offset+=(int)sizeof(guint8); /* Add type information to the mailbox header */ MailboxTypeFormatter(&hdr, szText, nMax); diff --git a/plugins/ethercat/packet-ethercat-datagram.c b/plugins/ethercat/packet-ethercat-datagram.c index 827af0f500..60dacf25e7 100644 --- a/plugins/ethercat/packet-ethercat-datagram.c +++ b/plugins/ethercat/packet-ethercat-datagram.c @@ -291,9 +291,9 @@ static void init_EcParserHDR(EcParserHDR* pHdr, tvbuff_t *tvb, gint offset) { pHdr->cmd = tvb_get_guint8(tvb, offset++); pHdr->idx = tvb_get_guint8(tvb, offset++); - pHdr->anAddrUnion.a.adp = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); - pHdr->anAddrUnion.a.ado = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); - pHdr->len = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); + pHdr->anAddrUnion.a.adp = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); + pHdr->anAddrUnion.a.ado = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); + pHdr->len = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); pHdr->intr = tvb_get_letohs(tvb, offset); } @@ -303,7 +303,7 @@ static void init_dc_measure(guint32* pDC, tvbuff_t *tvb, gint offset) for ( i=0; i<4; i++ ) { pDC[i] = tvb_get_letohl(tvb, offset); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); } } @@ -555,14 +555,14 @@ static void dissect_ecat_datagram(tvbuff_t *tvb, packet_info *pinfo, proto_tree PROTO_ITEM_SET_HIDDEN(aitem); } - suboffset+= sizeof(ecHdr.cmd); + suboffset+= (int)sizeof(ecHdr.cmd); proto_tree_add_item(ecat_header_tree, hf_ecat_idx, tvb, suboffset, sizeof(ecHdr.idx), ENC_LITTLE_ENDIAN); if( subCount < 10 ){ aitem = proto_tree_add_item(ecat_header_tree, hf_ecat_sub_idx[subCount], tvb, suboffset, sizeof(ecHdr.idx), ENC_LITTLE_ENDIAN); PROTO_ITEM_SET_HIDDEN(aitem); } - suboffset+= sizeof(ecHdr.idx); + suboffset+= (int)sizeof(ecHdr.idx); switch ( ecHdr.cmd ) { @@ -575,7 +575,7 @@ static void dissect_ecat_datagram(tvbuff_t *tvb, packet_info *pinfo, proto_tree PROTO_ITEM_SET_HIDDEN(aitem); } - suboffset += (sizeof(ecHdr.anAddrUnion.a.adp)+sizeof(ecHdr.anAddrUnion.a.ado)); + suboffset += (int)((sizeof(ecHdr.anAddrUnion.a.adp)+sizeof(ecHdr.anAddrUnion.a.ado))); break; default: proto_tree_add_item(ecat_header_tree, hf_ecat_adp, tvb, suboffset, sizeof(ecHdr.anAddrUnion.a.adp), ENC_LITTLE_ENDIAN); @@ -584,14 +584,14 @@ static void dissect_ecat_datagram(tvbuff_t *tvb, packet_info *pinfo, proto_tree PROTO_ITEM_SET_HIDDEN(aitem); } - suboffset+= sizeof(ecHdr.anAddrUnion.a.adp); + suboffset+= (int)sizeof(ecHdr.anAddrUnion.a.adp); proto_tree_add_item(ecat_header_tree, hf_ecat_ado, tvb, suboffset, sizeof(ecHdr.anAddrUnion.a.ado), ENC_LITTLE_ENDIAN); if( subCount < 10 ){ aitem = proto_tree_add_item(ecat_header_tree, hf_ecat_sub_ado[subCount], tvb, suboffset, sizeof(ecHdr.anAddrUnion.a.ado), ENC_LITTLE_ENDIAN); PROTO_ITEM_SET_HIDDEN(aitem); } - suboffset+= sizeof(ecHdr.anAddrUnion.a.ado); + suboffset+= (int)sizeof(ecHdr.anAddrUnion.a.ado); } { @@ -609,11 +609,11 @@ static void dissect_ecat_datagram(tvbuff_t *tvb, packet_info *pinfo, proto_tree proto_tree_add_item(length_sub_tree, hf_ecat_length_c, tvb, suboffset, sizeof(ecHdr.len), ENC_LITTLE_ENDIAN); proto_tree_add_item(length_sub_tree, hf_ecat_length_m, tvb, suboffset, sizeof(ecHdr.len), ENC_LITTLE_ENDIAN); - suboffset+= sizeof(ecHdr.len); + suboffset+= (int)sizeof(ecHdr.len); } proto_tree_add_item(ecat_header_tree, hf_ecat_int, tvb, suboffset, sizeof(ecHdr.intr), ENC_LITTLE_ENDIAN); - suboffset+= sizeof(ecHdr.intr); + suboffset+= (int)sizeof(ecHdr.intr); } else { diff --git a/plugins/ethercat/packet-ethercat-frame.h b/plugins/ethercat/packet-ethercat-frame.h index 94662a3acf..f552a2444a 100644 --- a/plugins/ethercat/packet-ethercat-frame.h +++ b/plugins/ethercat/packet-ethercat-frame.h @@ -38,6 +38,6 @@ typedef union _EtherCATFrameParser } EtherCATFrameParserHDR; typedef EtherCATFrameParserHDR *PEtherCATFrameParserHDR; -#define EtherCATFrameParserHDR_Len sizeof(EtherCATFrameParserHDR) +#define EtherCATFrameParserHDR_Len (int)sizeof(EtherCATFrameParserHDR) #endif diff --git a/plugins/ethercat/packet-ioraw.h b/plugins/ethercat/packet-ioraw.h index b67e0f2055..fbbc1ceafe 100644 --- a/plugins/ethercat/packet-ioraw.h +++ b/plugins/ethercat/packet-ioraw.h @@ -30,6 +30,6 @@ typedef struct _IoRawParser { guint32 head; } IoRawParserHDR, *PIoRawParserHDR; -#define IoRawParserHDR_Len sizeof(IoRawParserHDR) +#define IoRawParserHDR_Len (int)sizeof(IoRawParserHDR) #endif /* _PACKET_IORAW_H_*/ diff --git a/plugins/ethercat/packet-nv.c b/plugins/ethercat/packet-nv.c index 58bc9f1633..1ecaca676c 100644 --- a/plugins/ethercat/packet-nv.c +++ b/plugins/ethercat/packet-nv.c @@ -96,7 +96,7 @@ static void dissect_nv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *nv_tree, *nv_header_tree, *nv_var_tree,*nv_varheader_tree; gint offset = 0; char szText[200]; - int nMax = sizeof(szText)-1; + int nMax = (int)sizeof(szText)-1; gint i; @@ -119,16 +119,16 @@ static void dissect_nv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) nv_header_tree = proto_item_add_subtree(ti, ett_nv_header); - ti= proto_tree_add_item(nv_header_tree, hf_nv_publisher, tvb, offset, sizeof(guint8)*6, ENC_NA); + ti= proto_tree_add_item(nv_header_tree, hf_nv_publisher, tvb, offset, (int)sizeof(guint8)*6, ENC_NA); NvPublisherFormater(tvb, offset, szText, nMax); proto_item_set_text(ti, "%s", szText); - offset+=(sizeof(guint8)*6); + offset+=((int)sizeof(guint8)*6); - proto_tree_add_item(nv_header_tree, hf_nv_count, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(nv_header_tree, hf_nv_count, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); nv_count = tvb_get_letohs(tvb, offset); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); - proto_tree_add_item(nv_header_tree, hf_nv_cycleindex, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(nv_header_tree, hf_nv_cycleindex, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); offset = NvParserHDR_Len; for ( i=0; i < nv_count; i++ ) @@ -143,17 +143,17 @@ static void dissect_nv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_item(nv_var_tree, hf_nv_varheader, tvb, offset, ETYPE_88A4_NV_DATA_HEADER_Len, ENC_NA); nv_varheader_tree = proto_item_add_subtree(ti, ett_nv_varheader); - proto_tree_add_item(nv_varheader_tree, hf_nv_id, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + proto_tree_add_item(nv_varheader_tree, hf_nv_id, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint16); - proto_tree_add_item(nv_varheader_tree, hf_nv_hash, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + proto_tree_add_item(nv_varheader_tree, hf_nv_hash, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint16); - proto_tree_add_item(nv_varheader_tree, hf_nv_length, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + proto_tree_add_item(nv_varheader_tree, hf_nv_length, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint16); - proto_tree_add_item(nv_varheader_tree, hf_nv_quality, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + proto_tree_add_item(nv_varheader_tree, hf_nv_quality, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint16); proto_tree_add_item(nv_var_tree, hf_nv_data, tvb, offset, var_length, ENC_NA); offset+=var_length; diff --git a/plugins/ethercat/packet-nv.h b/plugins/ethercat/packet-nv.h index e1ad83d0bd..19fbe951e2 100644 --- a/plugins/ethercat/packet-nv.h +++ b/plugins/ethercat/packet-nv.h @@ -34,7 +34,7 @@ typedef struct _ETYPE_88A4_NV_DATA_HEADER guint16 Length; guint16 Quality; } ETYPE_88A4_NV_DATA_HEADER; -#define ETYPE_88A4_NV_DATA_HEADER_Len sizeof(ETYPE_88A4_NV_DATA_HEADER) +#define ETYPE_88A4_NV_DATA_HEADER_Len (int)sizeof(ETYPE_88A4_NV_DATA_HEADER) typedef struct _NvParserHDR { @@ -43,6 +43,6 @@ typedef struct _NvParserHDR guint16 CycleIndex; guint16 Reserved; } NvParserHDR; -#define NvParserHDR_Len sizeof(NvParserHDR) +#define NvParserHDR_Len (int)sizeof(NvParserHDR) #endif /* _PACKET_NV_H_*/ |