From 16d5d29049c08e21f57f7928ceedf40586a2d294 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Sat, 3 Dec 2022 11:10:06 +1100 Subject: Use std::span (backported) and std::byte to make our buffers safer --- src/audio/include/audio_element.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/audio/include/audio_element.hpp') diff --git a/src/audio/include/audio_element.hpp b/src/audio/include/audio_element.hpp index 5b697784..06e47b35 100644 --- a/src/audio/include/audio_element.hpp +++ b/src/audio/include/audio_element.hpp @@ -1,7 +1,5 @@ #pragma once -#include - #include #include "freertos/FreeRTOS.h" @@ -9,6 +7,7 @@ #include "freertos/message_buffer.h" #include "freertos/portmacro.h" #include "result.hpp" +#include "span.hpp" #include "stream_info.hpp" #include "types.hpp" @@ -77,8 +76,8 @@ class IAudioElement { * bytes in this chunk that were actually used; leftover bytes will be * prepended to the next call. */ - virtual auto ProcessChunk(uint8_t* data, std::size_t length) - -> cpp::result = 0; + virtual auto ProcessChunk(cpp::span& chunk) + -> cpp::result = 0; /* * Called when there has been no data received over the input buffer for some -- cgit v1.2.3