MCPcopy Create free account
hub / github.com/cvanaret/Uno / flush_buffer

Method flush_buffer

interfaces/C/Uno_C_API.cpp:421–438  ·  view source on GitHub ↗

flush buffer to the logger callback

Source from the content-addressed store, hash-verified

419
420 // flush buffer to the logger callback
421 int flush_buffer() {
422 // check for invalid stream callback
423 if (!this->logger_stream_callback) {
424 return -1;
425 }
426 std::ptrdiff_t current_used_buffer_size = this->pptr() - this->pbase();
427 if (current_used_buffer_size > 0) {
428 // call user logger callback
429 const uno_int callback_result = this->logger_stream_callback(this->pbase(), static_cast<uno_int>(current_used_buffer_size),
430 this->user_data);
431 if (callback_result != static_cast<uno_int>(current_used_buffer_size)) {
432 return -1;
433 }
434 // move buffer pointer
435 this->pbump(static_cast<int>(-current_used_buffer_size));
436 }
437 return 0;
438 }
439};
440
441// std::ostream wrapper around uno_logger_stream_callback

Callers 2

overflowMethod · 0.95
syncMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected