Merge pull request #548 from eglimi/fix_546
Fix some UB cases. Closes #546
This commit is contained in:
commit
4b81d4099d
|
@ -1473,10 +1473,13 @@ int ecx_config_overlap_map_group(ecx_contextt *context, void *pIOmap, uint8 grou
|
||||||
for (slave = 1; slave <= *(context->slavecount); slave++)
|
for (slave = 1; slave <= *(context->slavecount); slave++)
|
||||||
{
|
{
|
||||||
if (!group || (group == context->slavelist[slave].group))
|
if (!group || (group == context->slavelist[slave].group))
|
||||||
|
{
|
||||||
|
if(context->slavelist[slave].Ibits > 0)
|
||||||
{
|
{
|
||||||
context->slavelist[slave].inputs += context->grouplist[group].Obytes;
|
context->slavelist[slave].inputs += context->grouplist[group].Obytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!group)
|
if (!group)
|
||||||
{
|
{
|
||||||
|
|
|
@ -349,7 +349,7 @@ uint8 ecx_siigetbyte(ecx_contextt *context, uint16 slave, uint16 address)
|
||||||
{
|
{
|
||||||
mapw = address >> 5;
|
mapw = address >> 5;
|
||||||
mapb = (uint16)(address - (mapw << 5));
|
mapb = (uint16)(address - (mapw << 5));
|
||||||
if (context->esimap[mapw] & (uint32)(1 << mapb))
|
if (context->esimap[mapw] & (1U << mapb))
|
||||||
{
|
{
|
||||||
/* byte is already in buffer */
|
/* byte is already in buffer */
|
||||||
retval = context->esibuf[address];
|
retval = context->esibuf[address];
|
||||||
|
@ -380,7 +380,7 @@ uint8 ecx_siigetbyte(ecx_contextt *context, uint16 slave, uint16 address)
|
||||||
for(lp = 0 ; lp < cnt ; lp++)
|
for(lp = 0 ; lp < cnt ; lp++)
|
||||||
{
|
{
|
||||||
/* set bitmap for each byte that is read */
|
/* set bitmap for each byte that is read */
|
||||||
context->esimap[mapw] |= (1 << mapb);
|
context->esimap[mapw] |= (1U << mapb);
|
||||||
mapb++;
|
mapb++;
|
||||||
if (mapb > 31)
|
if (mapb > 31)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue