Chromium Code Reviews| Index: base/platform_file_win.cc |
| diff --git a/base/platform_file_win.cc b/base/platform_file_win.cc |
| index 7c72f9e92e1451d5873e854e9e818c298533078b..a68272e87503fd005f655b90e9e5f153d77fb5ae 100644 |
| --- a/base/platform_file_win.cc |
| +++ b/base/platform_file_win.cc |
| @@ -4,6 +4,8 @@ |
| #include "base/platform_file.h" |
| +#include <io.h> |
| + |
| #include "base/file_path.h" |
| #include "base/logging.h" |
| #include "base/threading/thread_restrictions.h" |
| @@ -109,6 +111,15 @@ PlatformFile CreatePlatformFileUnsafe(const FilePath& name, |
| return file; |
| } |
| +FILE* FdopenPlatformFile(PlatformFile file, const char* mode) { |
| + if (file == kInvalidPlatformFileValue) |
|
darin (slow to review)
2013/02/21 04:08:44
nit: Is it really necessary to add this preconditi
Paweł Hajdan Jr.
2013/02/21 09:14:19
Good question. It does fail and takes entire proce
|
| + return NULL; |
| + int fd = _open_osfhandle(reinterpret_cast<intptr_t>(file), 0); |
| + if (fd < 0) |
| + return NULL; |
| + return _fdopen(fd, mode); |
| +} |
| + |
| bool ClosePlatformFile(PlatformFile file) { |
| base::ThreadRestrictions::AssertIOAllowed(); |
| return (CloseHandle(file) != 0); |