Fix void pointer arithmetic in the Serial peripheral drivers.
authorDean Camera <dean@fourwalledcubicle.com>
Tue, 22 Dec 2015 11:31:54 +0000 (22:31 +1100)
committerDean Camera <dean@fourwalledcubicle.com>
Tue, 22 Dec 2015 11:31:54 +0000 (22:31 +1100)
LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c
LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c

index 3df3981..6680a6b 100644 (file)
@@ -88,8 +88,10 @@ void Serial_SendString(const char* StringPtr)
 void Serial_SendData(const void* Buffer,
                      uint16_t Length)
 {
 void Serial_SendData(const void* Buffer,
                      uint16_t Length)
 {
+       uint8_t* CurrByte = (uint8_t*)Buffer;
+
        while (Length--)
        while (Length--)
-         Serial_SendByte(*((uint8_t*)Buffer++));
+         Serial_SendByte(*(CurrByte++));
 }
 
 void Serial_CreateStream(FILE* Stream)
 }
 
 void Serial_CreateStream(FILE* Stream)
index f86bd97..b7a39d3 100644 (file)
@@ -91,8 +91,10 @@ void Serial_SendData(USART_t* const USART,
                      const void* Buffer,
                      uint16_t Length)
 {
                      const void* Buffer,
                      uint16_t Length)
 {
+       uint8_t* CurrByte = (uint8_t*)Buffer;
+
        while (Length--)
        while (Length--)
-         Serial_SendByte(USART, *((uint8_t*)Buffer++));
+         Serial_SendByte(USART, *(CurrByte++));
 }
 
 void Serial_CreateStream(USART_t* USART, FILE* Stream)
 }
 
 void Serial_CreateStream(USART_t* USART, FILE* Stream)