From 93c367be3b9420ee122fed41d69b329a7f4b5567 Mon Sep 17 00:00:00 2001 From: Mike Purvis Date: Wed, 18 Feb 2015 22:53:05 -0500 Subject: [PATCH] Initialize linear buffer from void pointer. This is more flexible and avoids an unnecessary cast when interoperating with code which expects strings to be char arrays rather than unsigned char arrays. --- lib/include/stream/BufferedInputOutputStream.h | 4 ++-- lib/include/stream/LinearBufferInputOutputStream.h | 2 +- lib/src/stream/LinearBufferInputOutputStream.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/include/stream/BufferedInputOutputStream.h b/lib/include/stream/BufferedInputOutputStream.h index 3fc4f670..faeb1136 100644 --- a/lib/include/stream/BufferedInputOutputStream.h +++ b/lib/include/stream/BufferedInputOutputStream.h @@ -56,8 +56,8 @@ namespace stm32plus { * @param[in] size The size of the caller supplied buffer */ - BufferedInputOutputStream(uint8_t *buffer,uint32_t size) { - _readPtr=_writePtr=_buffer=buffer; + BufferedInputOutputStream(void *buffer,uint32_t size) { + _readPtr=_writePtr=_buffer=static_cast(buffer); _bufferSize=size; _needToFree=false; } diff --git a/lib/include/stream/LinearBufferInputOutputStream.h b/lib/include/stream/LinearBufferInputOutputStream.h index a4b100df..cc98ca3d 100644 --- a/lib/include/stream/LinearBufferInputOutputStream.h +++ b/lib/include/stream/LinearBufferInputOutputStream.h @@ -22,7 +22,7 @@ namespace stm32plus { // constructors - LinearBufferInputOutputStream(uint8_t *buffer,uint32_t size); + LinearBufferInputOutputStream(void *buffer,uint32_t size); LinearBufferInputOutputStream(uint32_t initialSize); void resetOutput(); diff --git a/lib/src/stream/LinearBufferInputOutputStream.cpp b/lib/src/stream/LinearBufferInputOutputStream.cpp index fd59a3b2..729fabad 100644 --- a/lib/src/stream/LinearBufferInputOutputStream.cpp +++ b/lib/src/stream/LinearBufferInputOutputStream.cpp @@ -18,7 +18,7 @@ namespace stm32plus { * @param size */ - LinearBufferInputOutputStream::LinearBufferInputOutputStream(uint8_t *buffer,uint32_t size) + LinearBufferInputOutputStream::LinearBufferInputOutputStream(void *buffer,uint32_t size) : BufferedInputOutputStream(buffer,size) { }