| 18 | } |
| 19 | |
| 20 | size_t ChunkedStream::transform(const uint8_t* source, size_t sourceLength, uint8_t* target, size_t targetLength) |
| 21 | { |
| 22 | if(sourceLength == 0) { |
| 23 | memcpy(target, _F("0\r\n\r\n"), 5); |
| 24 | return 5; |
| 25 | } |
| 26 | |
| 27 | // Header |
| 28 | unsigned offset = |
| 29 | m_snprintf(reinterpret_cast<char*>(target), targetLength, "%X\r\n", static_cast<unsigned>(sourceLength)); |
| 30 | |
| 31 | // Content |
| 32 | memcpy(target + offset, source, sourceLength); |
| 33 | offset += sourceLength; |
| 34 | |
| 35 | // Footer |
| 36 | memcpy(target + offset, "\r\n", 2); |
| 37 | offset += 2; |
| 38 | |
| 39 | return offset; |
| 40 | } |
nothing calls this directly
no test coverage detected