Chromium Code Reviews| Index: runtime/bin/file_android.cc |
| diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc |
| index f1d3e4a1a2efbc5f829b51355faee2b4f34a02a3..a8ca445623357441a57ddfea7b6013f949285a41 100644 |
| --- a/runtime/bin/file_android.cc |
| +++ b/runtime/bin/file_android.cc |
| @@ -120,6 +120,27 @@ int64_t File::Write(const void* buffer, int64_t num_bytes) { |
| } |
| +bool File::VPrint(const char* format, va_list args) { |
| + // Measure. |
| + va_list measure_args; |
| + va_copy(measure_args, args); |
| + intptr_t len = vsnprintf(NULL, 0, format, measure_args); |
| + va_end(measure_args); |
| + |
| + char* buffer = reinterpret_cast<char*>(malloc(len + 1)); |
| + |
| + // Print. |
| + va_list print_args; |
| + va_copy(print_args, args); |
| + vsnprintf(buffer, len + 1, format, print_args); |
| + va_end(print_args); |
| + |
| + bool result = WriteFully(buffer, len); |
| + free(buffer); |
| + return result; |
| +} |
|
siva
2017/02/22 23:37:16
This seems to be identical in all the different OS
rmacnak
2017/02/23 19:00:17
Windows is different from non-Windows because of v
|
| + |
| + |
| int64_t File::Position() { |
| ASSERT(handle_->fd() >= 0); |
| return NO_RETRY_EXPECTED(lseek64(handle_->fd(), 0, SEEK_CUR)); |