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

Method LongWrite

library/cpp/binsaver/buffered_io.cpp:3–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "buffered_io.h"
2
3i64 IBinaryStream::LongWrite(const void* userBuffer, i64 size) {
4 Y_ABORT_UNLESS(size >= 0, "IBinaryStream::Write() called with a negative buffer size.");
5
6 i64 leftToWrite = size;
7 while (leftToWrite != 0) {
8 int writeSz = static_cast<int>(Min<i64>(leftToWrite, std::numeric_limits<int>::max()));
9 int written = WriteImpl(userBuffer, writeSz);
10 Y_ASSERT(written <= writeSz);
11 leftToWrite -= written;
12 // Assumption: if WriteImpl(buf, writeSz) returns < writeSz, the stream is
13 // full and there's no sense in continuing.
14 if (written < writeSz)
15 break;
16 }
17 Y_ASSERT(size >= leftToWrite);
18 return size - leftToWrite;
19}
20
21i64 IBinaryStream::LongRead(void* userBuffer, i64 size) {
22 Y_ABORT_UNLESS(size >= 0, "IBinaryStream::Read() called with a negative buffer size.");

Callers

nothing calls this directly

Calls 2

WriteImplFunction · 0.85
maxFunction · 0.50

Tested by

no test coverage detected