From: <zw...@ma...> - 2009-05-07 01:28:42
|
Author: zwelch Date: 2009-05-07 01:28:38 +0200 (Thu, 07 May 2009) New Revision: 1624 Modified: trunk/src/target/image.c Log: Fix pointer cast alignment warnings in target/image.c. Modified: trunk/src/target/image.c =================================================================== --- trunk/src/target/image.c 2009-05-06 23:25:27 UTC (rev 1623) +++ trunk/src/target/image.c 2009-05-06 23:28:38 UTC (rev 1624) @@ -217,7 +217,9 @@ while (count-- > 0) { - sscanf(&lpszLine[bytes_read], "%2x", (u32*)&ihex->buffer[cooked_bytes]); + unsigned value; + sscanf(&lpszLine[bytes_read], "%2x", &value); + ihex->buffer[cooked_bytes] = (u8)value; cal_checksum += (u8)ihex->buffer[cooked_bytes]; bytes_read += 2; cooked_bytes += 1; @@ -594,7 +596,9 @@ while (count-- > 0) { - sscanf(&lpszLine[bytes_read], "%2x", (u32*)&mot->buffer[cooked_bytes]); + unsigned value; + sscanf(&lpszLine[bytes_read], "%2x", &value); + mot->buffer[cooked_bytes] = (u8)value; cal_checksum += (u8)mot->buffer[cooked_bytes]; bytes_read += 2; cooked_bytes += 1; |