15 ESP_LOGE(TAG,
"Initial allocation of download buffer failed!");
21 if (offset > this->
size_) {
22 ESP_LOGE(TAG,
"Tried to access beyond download buffer bounds!!!");
46 const size_t offset = this->
pos_ - this->
start_;
50 return static_cast<int32_t
>(n);
62 if (this->
size_ >= size)
67 ESP_LOGE(TAG,
"allocation of %zu bytes failed. Biggest block in heap: %zu Bytes",
size,
79 if (this->
size_ >= size) {
91 ESP_LOGE(TAG,
"allocation of %zu bytes failed. Biggest block in heap: %zu Bytes",
size,
An STL allocator that uses SPI or internal RAM.
void deallocate(T *p, size_t n)
size_t get_max_free_block_size() const
Return the maximum size block this allocator could allocate.
DownloadBuffer(size_t size)
size_t unread_
Total number of downloaded bytes not yet read.
bool grow(size_t size)
Make the buffer at least size bytes, keeping the unread data. Returns false if the allocation failed.
uint8_t * data(size_t offset=0)
size_t resize(size_t size)
void compact()
Drop the bytes the decoder has read, to make room for more of the download.
int32_t read(uint8_t *buf, uint32_t len) override
bool seek(uint32_t position) override
ESPHOME_LOG_TAG(TAG, "online_image.download_buffer")