MCPcopy Create free account
hub / github.com/antirez/ds4 / dist_payload_write_bytes

Function dist_payload_write_bytes

ds4_distributed.c:557–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

555 * ========================================================================= */
556
557static int dist_payload_write_bytes(FILE *fp, const void *ptr, uint64_t bytes, char *err, size_t errlen) {
558 const uint8_t *p = ptr;
559 while (bytes != 0) {
560 const size_t n = bytes > (uint64_t)SIZE_MAX ? SIZE_MAX : (size_t)bytes;
561 if (fwrite(p, 1, n, fp) != n) {
562 if (errlen) snprintf(err, errlen, "failed to write distributed payload");
563 return 1;
564 }
565 p += n;
566 bytes -= n;
567 }
568 return 0;
569}
570
571static int dist_payload_read_bytes(FILE *fp, void *ptr, uint64_t bytes, uint64_t *remaining, char *err, size_t errlen) {
572 if (remaining && *remaining < bytes) {

Callers 2

dist_payload_write_u32Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected