mirror of
https://github.com/esphome/esphome.git
synced 2024-11-14 02:58:11 +01:00
add const for pointer parameter when writing to ring buffer
This commit is contained in:
parent
a2dccc4730
commit
3bfd6abc61
2 changed files with 4 additions and 4 deletions
|
@ -46,7 +46,7 @@ size_t RingBuffer::read(void *data, size_t len, TickType_t ticks_to_wait) {
|
|||
return bytes_read;
|
||||
}
|
||||
|
||||
size_t RingBuffer::write(void *data, size_t len) {
|
||||
size_t RingBuffer::write(const void *data, size_t len) {
|
||||
size_t free = this->free();
|
||||
if (free < len) {
|
||||
size_t needed = len - free;
|
||||
|
@ -56,7 +56,7 @@ size_t RingBuffer::write(void *data, size_t len) {
|
|||
return xStreamBufferSend(this->handle_, data, len, 0);
|
||||
}
|
||||
|
||||
size_t RingBuffer::write_without_replacement(void *data, size_t len, TickType_t ticks_to_wait) {
|
||||
size_t RingBuffer::write_without_replacement(const void *data, size_t len, TickType_t ticks_to_wait) {
|
||||
return xStreamBufferSend(this->handle_, data, len, ticks_to_wait);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class RingBuffer {
|
|||
* @param len Number of bytes to write
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
size_t write(void *data, size_t len);
|
||||
size_t write(const void *data, size_t len);
|
||||
|
||||
/**
|
||||
* @brief Writes to the ring buffer without overwriting oldest data.
|
||||
|
@ -50,7 +50,7 @@ class RingBuffer {
|
|||
* @param ticks_to_wait Maximum number of FreeRTOS ticks to wait (default: 0)
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
size_t write_without_replacement(void *data, size_t len, TickType_t ticks_to_wait = 0);
|
||||
size_t write_without_replacement(const void *data, size_t len, TickType_t ticks_to_wait = 0);
|
||||
|
||||
/**
|
||||
* @brief Returns the number of available bytes in the ring buffer.
|
||||
|
|
Loading…
Reference in a new issue