Warning, /sdk/cutehmi/extensions/CuteHMI/Modbus.4/dev/CuteHMI.Modbus-7.workaround.Qt.design.txt is written in an unsupported language. File is not indexed.
0001 Problem: 0002 0003 QModbusDataUnit::setValue() function accepts `int` type as its `index` parameter, 0004 while functions such as QModbusDataUnit::valueCount() use `uint` 0005 as return type. It may be not safe to access container elements through index 0006 type, which covers smaller range than type used to determine container size. 0007 0008 Workaround: 0009 0010 Because valueCount() can not exceed maximal theoretical amount of registers that 0011 can be queried at once (2008 coils through RTU) it is safe to downcast returned 0012 `uint` value to `int`, which is guaranteed to be at least 16 bit wide. 0013 0014 Snippet: 0015