Skip to content

Commit 3450be8

Browse files
authored
Merge pull request #1575 from smoe/cppcheck_fixes
int (also literals as it seems) are signed by default
2 parents 6497d3c + 0f32d7e commit 3450be8

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

src/emc/usr_intf/emcsched.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ void SchedEntry::setTool(int t) {
190190

191191
static void crcInit() {
192192
crc rmdr;
193-
int i;
193+
unsigned int i;
194194
uint32_t bit;
195195

196196
for (i = 0; i < 256; ++i)

src/hal/drivers/hal_gm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,18 +1126,18 @@ read(void *arg, long period)
11261126
{
11271127
gm_device_t *device = (gm_device_t *)arg;
11281128
card *pCard = device->pCard;
1129-
int i;
1129+
unsigned int i;
11301130
hal_u32_t temp;
1131-
1131+
11321132
//basic card functionality: watchdog, switches, estop
11331133
card_mgr(arg, period);
11341134

11351135
//read parallel IOs
11361136
temp=pCard->gpio;
11371137
for(i = 0; i < 32; i++)
11381138
{
1139-
*(device->gpio[i].in) = (hal_bit_t)((temp & (0x0001 << i)) == 0 ? 0 : 1);
1140-
*(device->gpio[i].inNot) = (hal_bit_t)((temp & (0x0001 << i)) == 0 ? 1 : 0);
1139+
*(device->gpio[i].in) = (hal_bit_t)((temp & ((unsigned int) 1 << i)) == 0 ? 0 : 1);
1140+
*(device->gpio[i].inNot) = (hal_bit_t)((temp & ((unsigned int) 1 << i)) == 0 ? 1 : 0);
11411141
}
11421142

11431143
//Read Encoders

src/hal/drivers/opto_ac5.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,8 @@ Device_DigitalOutWrite(void *arg, long period)
401401
{
402402
board_data_t *pboard = (board_data_t *)arg;
403403
DigitalPinsParams *pDigital;
404-
int i, j, portnum=0;
404+
int portnum=0;
405+
unsigned int i,j;
405406
unsigned long pins, offset=DATA_WRITE_OFFSET_0,mask;
406407

407408
// For each port.
@@ -421,22 +422,22 @@ Device_DigitalOutWrite(void *arg, long period)
421422
( *(pDigital->pValue) && (pDigital->invert) ))
422423
{ pins |= mask; }
423424
}
424-
mask <<=1; // shift mask
425+
mask <<=1; // shift mask
425426

426427
}
427428

428429
// CHECK LED PINS
429430
pDigital = &pboard->port[portnum].io[23];//one before what we want to check
430-
for (i = 0;i < 2;i++)
431-
{
432-
mask=1<<(31-i);
433-
pDigital++;
431+
for (i = 0; i < 2; i++)
432+
{
433+
mask = (unsigned int) 1 << (31-i);
434+
pDigital++;
434435

435-
if ( *(pDigital->pValue) ==0 ) { pins |= mask; }
436-
}
436+
if ( *(pDigital->pValue) == 0 ) { pins |= mask; }
437+
}
437438
// Write digital I/O register.
438439
writel(pins,pboard->base + (offset));
439-
portnum ++;
440+
portnum++;
440441
offset=DATA_WRITE_OFFSET_1; // set to port1 offset
441442
}
442443
}

0 commit comments

Comments
 (0)