| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/system_wrappers/include/file_wrapper.h" | 11 #include "webrtc/system_wrappers/include/file_wrapper.h" |
| 12 | 12 |
| 13 #ifdef _WIN32 | 13 #ifdef _WIN32 |
| 14 #include <Windows.h> | 14 #include <Windows.h> |
| 15 #else | 15 #else |
| 16 #include <stdarg.h> | 16 #include <stdarg.h> |
| 17 #include <string.h> | 17 #include <string.h> |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 #include "webrtc/base/checks.h" | 20 #include "webrtc/rtc_base/checks.h" |
| 21 | 21 |
| 22 namespace webrtc { | 22 namespace webrtc { |
| 23 namespace { | 23 namespace { |
| 24 FILE* FileOpen(const char* file_name_utf8, bool read_only) { | 24 FILE* FileOpen(const char* file_name_utf8, bool read_only) { |
| 25 #if defined(_WIN32) | 25 #if defined(_WIN32) |
| 26 int len = MultiByteToWideChar(CP_UTF8, 0, file_name_utf8, -1, nullptr, 0); | 26 int len = MultiByteToWideChar(CP_UTF8, 0, file_name_utf8, -1, nullptr, 0); |
| 27 std::wstring wstr(len, 0); | 27 std::wstring wstr(len, 0); |
| 28 MultiByteToWideChar(CP_UTF8, 0, file_name_utf8, -1, &wstr[0], len); | 28 MultiByteToWideChar(CP_UTF8, 0, file_name_utf8, -1, &wstr[0], len); |
| 29 FILE* file = _wfopen(wstr.c_str(), read_only ? L"rb" : L"wb"); | 29 FILE* file = _wfopen(wstr.c_str(), read_only ? L"rb" : L"wb"); |
| 30 #else | 30 #else |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if (file_ != nullptr) | 143 if (file_ != nullptr) |
| 144 fclose(file_); | 144 fclose(file_); |
| 145 file_ = nullptr; | 145 file_ = nullptr; |
| 146 } | 146 } |
| 147 | 147 |
| 148 int FileWrapper::FlushImpl() { | 148 int FileWrapper::FlushImpl() { |
| 149 return (file_ != nullptr) ? fflush(file_) : -1; | 149 return (file_ != nullptr) ? fflush(file_) : -1; |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace webrtc | 152 } // namespace webrtc |
| OLD | NEW |