This is an automated email from Gerrit. Andreas Fritiofson ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/1776
-- gerrit commit c935766a67e72495081b4af73a8dc904ae8f66d3 Author: Andreas Fritiofson <[email protected]> Date: Sat Sep 28 23:01:07 2013 +0200 binarybuffer: Remove unnecessary cast and fix hidden "bug" Because of the cast, the const decoration on the parameter provided no guarantee against modification since it was silently discarded. Change-Id: Ib83ade955e1a61ee2175c690620437b5e19cbb6a Signed-off-by: Andreas Fritiofson <[email protected]> diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c index 6fe3664..a3c993d 100644 --- a/src/helper/binarybuffer.c +++ b/src/helper/binarybuffer.c @@ -148,7 +148,7 @@ void *buf_set_buf(const void *_src, unsigned src_start, if ((sq == 0) && (dq == 0) && (lq == 0)) { for (i = 0; i < lb; i++) *dst++ = *src++; - return (uint8_t *)_dst; + return _dst; } /* fallback to slow bit copy */ @@ -167,7 +167,7 @@ void *buf_set_buf(const void *_src, unsigned src_start, } } - return (uint8_t *)_dst; + return _dst; } uint32_t flip_u32(uint32_t value, unsigned int num) diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h index 5b86c5f..9c20bcd 100644 --- a/src/helper/binarybuffer.h +++ b/src/helper/binarybuffer.h @@ -42,7 +42,7 @@ static inline void buf_set_u32(void *_buffer, unsigned first, unsigned num, uint32_t value) { - uint8_t *buffer = (uint8_t *)_buffer; + uint8_t *buffer = _buffer; if ((num == 32) && (first == 0)) { buffer[3] = (value >> 24) & 0xff; @@ -71,7 +71,7 @@ static inline void buf_set_u32(void *_buffer, static inline void buf_set_u64(void *_buffer, unsigned first, unsigned num, uint64_t value) { - uint8_t *buffer = (uint8_t *)_buffer; + uint8_t *buffer = _buffer; if ((num == 32) && (first == 0)) { buffer[3] = (value >> 24) & 0xff; @@ -109,7 +109,7 @@ static inline void buf_set_u64(void *_buffer, static inline uint32_t buf_get_u32(const void *_buffer, unsigned first, unsigned num) { - uint8_t *buffer = (uint8_t *)_buffer; + const uint8_t *buffer = _buffer; if ((num == 32) && (first == 0)) { return (((uint32_t)buffer[3]) << 24) | @@ -138,7 +138,7 @@ static inline uint32_t buf_get_u32(const void *_buffer, static inline uint64_t buf_get_u64(const void *_buffer, unsigned first, unsigned num) { - uint8_t *buffer = (uint8_t *)_buffer; + const uint8_t *buffer = _buffer; if ((num == 32) && (first == 0)) { return 0 + ((((uint32_t)buffer[3]) << 24) | /* Note - zero plus is to avoid a checkpatch bug */ -- ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
