Commit ca928d5002b8834635705f5ae9b482040966010e

Authored by Stéphane Raimbault
1 parent f720851a

Don't use reserved word 'byte' on Windows!

Showing 1 changed file with 6 additions and 5 deletions
src/modbus.c
@@ -640,22 +640,23 @@ static int response_io_status(int address, int nb, @@ -640,22 +640,23 @@ static int response_io_status(int address, int nb,
640 uint8_t *rsp, int offset) 640 uint8_t *rsp, int offset)
641 { 641 {
642 int shift = 0; 642 int shift = 0;
643 - int byte = 0; 643 + /* Instead of byte (not allowed in Win32) */
  644 + int one_byte = 0;
644 int i; 645 int i;
645 646
646 for (i = address; i < address+nb; i++) { 647 for (i = address; i < address+nb; i++) {
647 - byte |= tab_io_status[i] << shift; 648 + one_byte |= tab_io_status[i] << shift;
648 if (shift == 7) { 649 if (shift == 7) {
649 /* Byte is full */ 650 /* Byte is full */
650 - rsp[offset++] = byte;  
651 - byte = shift = 0; 651 + rsp[offset++] = one_byte;
  652 + one_byte = shift = 0;
652 } else { 653 } else {
653 shift++; 654 shift++;
654 } 655 }
655 } 656 }
656 657
657 if (shift != 0) 658 if (shift != 0)
658 - rsp[offset++] = byte; 659 + rsp[offset++] = one_byte;
659 660
660 return offset; 661 return offset;
661 } 662 }