MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / formatContentRange

Method formatContentRange

Libraries/Http/HttpAsyncFileServer.cpp:842–853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840}
841
842Result HttpAsyncFileServer::Internal::formatContentRange(const ByteRange& range, size_t fileSize, char* buffer,
843 size_t bufferSize, size_t& outLength)
844{
845 outLength = static_cast<size_t>(snprintf(
846 buffer, bufferSize, "bytes %llu-%llu/%llu", static_cast<unsigned long long>(range.offset),
847 static_cast<unsigned long long>(range.offset + range.length - 1), static_cast<unsigned long long>(fileSize)));
848 if (outLength == 0 or outLength >= bufferSize)
849 {
850 return Result::Error("Failed to format Content-Range");
851 }
852 return Result(true);
853}
854
855Result HttpAsyncFileServer::Internal::formatUnsatisfiedContentRange(size_t fileSize, char* buffer, size_t bufferSize,
856 size_t& outLength)

Callers

nothing calls this directly

Calls 2

ErrorEnum · 0.50
ResultClass · 0.50

Tested by

no test coverage detected