diff options
| author | schererleander <leander@schererleander.de> | 2026-01-20 08:34:54 +0100 |
|---|---|---|
| committer | schererleander <leander@schererleander.de> | 2026-01-20 08:34:54 +0100 |
| commit | 85ea4e995a75abe061f6fc375ea0481084dddd43 (patch) | |
| tree | 7eb5d57653ecd8f041aeac4e68d7d554c1168681 /libraries/ESP_Async_WebServer/src/ChunkPrint.cpp | |
Diffstat (limited to 'libraries/ESP_Async_WebServer/src/ChunkPrint.cpp')
| -rw-r--r-- | libraries/ESP_Async_WebServer/src/ChunkPrint.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libraries/ESP_Async_WebServer/src/ChunkPrint.cpp b/libraries/ESP_Async_WebServer/src/ChunkPrint.cpp new file mode 100644 index 0000000..4617d34 --- /dev/null +++ b/libraries/ESP_Async_WebServer/src/ChunkPrint.cpp @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright 2016-2025 Hristo Gochkov, Mathieu Carbou, Emil Muratov + +#include <ChunkPrint.h> + +ChunkPrint::ChunkPrint(uint8_t *destination, size_t from, size_t len) : _destination(destination), _to_skip(from), _to_write(len), _pos{0} {} + +size_t ChunkPrint::write(uint8_t c) { + if (_to_skip > 0) { + _to_skip--; + return 1; + } else if (_to_write > 0) { + _to_write--; + _destination[_pos++] = c; + return 1; + } + return 0; +} |
