瀏覽代碼

Fix compilation warnings with Microsoft compiler (closes #64)

Stéphane Raimbault 13 年之前
父節點
當前提交
a98392f06f
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/modbus-data.c

+ 3 - 3
src/modbus-data.c

@@ -31,7 +31,7 @@ void modbus_set_bits_from_byte(uint8_t *dest, int index, const uint8_t value)
 {
     int i;
 
-    for (i=0; i<8; i++) {
+    for (i=0; i < 8; i++) {
         dest[index+i] = (value & (1 << i)) ? 1 : 0;
     }
 }
@@ -41,7 +41,7 @@ void modbus_set_bits_from_byte(uint8_t *dest, int index, const uint8_t value)
 void modbus_set_bits_from_bytes(uint8_t *dest, int index, unsigned int nb_bits,
                                 const uint8_t *tab_byte)
 {
-    int i;
+    unsigned int i;
     int shift = 0;
 
     for (i = index; i < index + nb_bits; i++) {
@@ -57,7 +57,7 @@ void modbus_set_bits_from_bytes(uint8_t *dest, int index, unsigned int nb_bits,
 uint8_t modbus_get_byte_from_bits(const uint8_t *src, int index,
                                   unsigned int nb_bits)
 {
-    int i;
+    unsigned int i;
     uint8_t value = 0;
 
     if (nb_bits > 8) {