Jelajahi Sumber

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

Stéphane Raimbault 12 tahun lalu
induk
melakukan
ca928d5002
1 mengubah file dengan 6 tambahan dan 5 penghapusan
  1. 6 5
      src/modbus.c

+ 6 - 5
src/modbus.c

@@ -640,22 +640,23 @@ static int response_io_status(int address, int nb,
                               uint8_t *rsp, int offset)
 {
     int shift = 0;
-    int byte = 0;
+    /* Instead of byte (not allowed in Win32) */
+    int one_byte = 0;
     int i;
 
     for (i = address; i < address+nb; i++) {
-        byte |= tab_io_status[i] << shift;
+        one_byte |= tab_io_status[i] << shift;
         if (shift == 7) {
             /* Byte is full */
-            rsp[offset++] = byte;
-            byte = shift = 0;
+            rsp[offset++] = one_byte;
+            one_byte = shift = 0;
         } else {
             shift++;
         }
     }
 
     if (shift != 0)
-        rsp[offset++] = byte;
+        rsp[offset++] = one_byte;
 
     return offset;
 }