| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | #include "rtc_base/stream.h" |
| 11 |
| 12 | #include <errno.h> |
| 13 | #include <string.h> |
| 14 |
| 15 | #include <algorithm> |
| 16 | #include <string> |
| 17 |
| 18 | #include "rtc_base/checks.h" |
| 19 | #include "rtc_base/thread.h" |
| 20 |
| 21 | namespace rtc { |
| 22 |
| 23 | /////////////////////////////////////////////////////////////////////////////// |
| 24 | // StreamInterface |
| 25 | /////////////////////////////////////////////////////////////////////////////// |
| 26 |
| 27 | StreamResult StreamInterface::WriteAll(const void* data, |
| 28 | size_t data_len, |
| 29 | size_t* written, |
| 30 | int* error) { |
| 31 | StreamResult result = SR_SUCCESS; |
| 32 | size_t total_written = 0, current_written; |
| 33 | while (total_written < data_len) { |
| 34 | result = Write(static_cast<const char*>(data) + total_written, |
| 35 | data_len - total_written, ¤t_written, error); |
| 36 | if (result != SR_SUCCESS) |
| 37 | break; |
| 38 | total_written += current_written; |
| 39 | } |
| 40 | if (written) |
| 41 | *written = total_written; |
| 42 | return result; |
| 43 | } |
| 44 |
| 45 | bool StreamInterface::Flush() { |
| 46 | return false; |
| 47 | } |
| 48 |
| 49 | StreamInterface::StreamInterface() {} |
| 50 |
| 51 | } // namespace rtc |
| 52 |