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

Function read_content_with_length

dependencies/httplib/httplib.h:3292–3312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3290}
3291
3292inline bool read_content_with_length(Stream &strm, uint64_t len,
3293 Progress progress,
3294 ContentReceiverWithProgress out) {
3295 char buf[CPPHTTPLIB_RECV_BUFSIZ];
3296
3297 uint64_t r = 0;
3298 while (r < len) {
3299 auto read_len = static_cast<size_t>(len - r);
3300 auto n = strm.read(buf, (std::min)(read_len, CPPHTTPLIB_RECV_BUFSIZ));
3301 if (n <= 0) { return false; }
3302
3303 if (!out(buf, static_cast<size_t>(n), r, len)) { return false; }
3304 r += static_cast<uint64_t>(n);
3305
3306 if (progress) {
3307 if (!progress(r, len)) { return false; }
3308 }
3309 }
3310
3311 return true;
3312}
3313
3314inline void skip_content_with_length(Stream &strm, uint64_t len) {
3315 char buf[CPPHTTPLIB_RECV_BUFSIZ];

Callers 2

read_content_chunkedFunction · 0.85
read_contentFunction · 0.85

Calls 1

readMethod · 0.45

Tested by

no test coverage detected