Skip to content

Commit

Permalink
Fix data type for CPF address item count.
Browse files Browse the repository at this point in the history
Resolves warning about possible loss of data due to implicit integer
conversion, e.g., Visual Studio C4244.
  • Loading branch information
jvalenzuela committed Aug 16, 2023
1 parent fc0179e commit 417202a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/src/enet_encap/cpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ EipStatus CreateCommonPacketFormatStructure(const EipUint8 *data,
return kEipStatusError;
}

CipUsint address_item_count = common_packet_format_data->item_count - 2;
/* Data type per CIP Volume 2, Edition 1.4, Table 2-6.1. */
CipUint address_item_count = (CipUint)(common_packet_format_data->item_count - 2U);

for(size_t j = 0; j < (address_item_count > 2 ? 2 : address_item_count);
j++) /* TODO there needs to be a limit check here???*/
{
Expand Down

0 comments on commit 417202a

Please sign in to comment.