MCPcopy Create free account
hub / github.com/catboost/catboost / ReadComplex

Method ReadComplex

library/cpp/binsaver/buffered_io.h:45–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43 bool bIsReading, bIsEof, bFailed;
44
45 void ReadComplex(void* userBuffer, i64 size) {
46 if (bIsEof) {
47 memset(userBuffer, 0, size);
48 return;
49 }
50 char* dst = (char*)userBuffer;
51 i64 leftBytes = BufSize - Pos;
52 memcpy(dst, Buf + Pos, leftBytes);
53 dst += leftBytes;
54 size -= leftBytes;
55 Pos = BufSize = 0;
56 if (size > N_SIZE) {
57 i64 n = Stream.Read(dst, size);
58 bFailed = Stream.IsFailed();
59 if (n != size) {
60 bIsEof = true;
61 memset(dst + n, 0, size - n);
62 }
63 } else {
64 BufSize = Stream.Read(Buf, N_SIZE);
65 bFailed = Stream.IsFailed();
66 if (BufSize == 0)
67 bIsEof = true;
68 Read(dst, size);
69 }
70 }
71
72 void WriteComplex(const void* userBuffer, i64 size) {
73 Flush();

Callers

nothing calls this directly

Calls 3

ReadFunction · 0.50
ReadMethod · 0.45
IsFailedMethod · 0.45

Tested by

no test coverage detected