MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / write_content_without_length

Function write_content_without_length

dependencies/httplib/httplib.h:3537–3563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3535
3536template <typename T>
3537inline bool
3538write_content_without_length(Stream &strm,
3539 const ContentProvider &content_provider,
3540 const T &is_shutting_down) {
3541 size_t offset = 0;
3542 auto data_available = true;
3543 auto ok = true;
3544 DataSink data_sink;
3545
3546 data_sink.write = [&](const char *d, size_t l) -> bool {
3547 if (ok) {
3548 offset += l;
3549 if (!write_data(strm, d, l)) { ok = false; }
3550 }
3551 return ok;
3552 };
3553
3554 data_sink.done = [&](void) { data_available = false; };
3555
3556 data_sink.is_writable = [&](void) { return ok && strm.is_writable(); };
3557
3558 while (data_available && !is_shutting_down()) {
3559 if (!content_provider(offset, 0, data_sink)) { return false; }
3560 if (!ok) { return false; }
3561 }
3562 return true;
3563}
3564
3565template <typename T, typename U>
3566inline bool

Callers 1

Calls 2

write_dataFunction · 0.85
is_writableMethod · 0.80

Tested by

no test coverage detected