瀏覽代碼

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

Stéphane Raimbault 12 年之前
父節點
當前提交
ca928d5002
共有 1 個文件被更改,包括 6 次插入5 次删除
  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)
                               uint8_t *rsp, int offset)
 {
 {
     int shift = 0;
     int shift = 0;
-    int byte = 0;
+    /* Instead of byte (not allowed in Win32) */
+    int one_byte = 0;
     int i;
     int i;
 
 
     for (i = address; i < address+nb; i++) {
     for (i = address; i < address+nb; i++) {
-        byte |= tab_io_status[i] << shift;
+        one_byte |= tab_io_status[i] << shift;
         if (shift == 7) {
         if (shift == 7) {
             /* Byte is full */
             /* Byte is full */
-            rsp[offset++] = byte;
-            byte = shift = 0;
+            rsp[offset++] = one_byte;
+            one_byte = shift = 0;
         } else {
         } else {
             shift++;
             shift++;
         }
         }
     }
     }
 
 
     if (shift != 0)
     if (shift != 0)
-        rsp[offset++] = byte;
+        rsp[offset++] = one_byte;
 
 
     return offset;
     return offset;
 }
 }