From 8d09a60b002a4b4d15e944fe84b2287c58698b1d Mon Sep 17 00:00:00 2001 From: mikee47 Date: Sun, 24 Sep 2023 21:21:19 +0100 Subject: [PATCH] Add MemoryDataStream::reset() method --- Sming/Core/Data/Stream/MemoryDataStream.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sming/Core/Data/Stream/MemoryDataStream.h b/Sming/Core/Data/Stream/MemoryDataStream.h index cef511a62b..eeb9b67139 100644 --- a/Sming/Core/Data/Stream/MemoryDataStream.h +++ b/Sming/Core/Data/Stream/MemoryDataStream.h @@ -104,6 +104,17 @@ class MemoryDataStream : public ReadWriteStream readPos = 0; } + /** + * @brief Clear stream and release allocated memory + */ + void reset() + { + clear(); + free(buffer); + buffer = nullptr; + capacity = 0; + } + size_t getSize() const { return size;