| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_PLATFORM_FILE_H_ | 5 #ifndef BASE_PLATFORM_FILE_H_ |
| 6 #define BASE_PLATFORM_FILE_H_ | 6 #define BASE_PLATFORM_FILE_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 #if defined(OS_WIN) | 127 #if defined(OS_WIN) |
| 128 typedef HANDLE PlatformFile; | 128 typedef HANDLE PlatformFile; |
| 129 const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE; | 129 const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE; |
| 130 BASE_EXPORT PlatformFileError LastErrorToPlatformFileError(DWORD last_error); | 130 BASE_EXPORT PlatformFileError LastErrorToPlatformFileError(DWORD last_error); |
| 131 #elif defined(OS_POSIX) | 131 #elif defined(OS_POSIX) |
| 132 typedef int PlatformFile; | 132 typedef int PlatformFile; |
| 133 const PlatformFile kInvalidPlatformFileValue = -1; | 133 const PlatformFile kInvalidPlatformFileValue = -1; |
| 134 BASE_EXPORT PlatformFileError ErrnoToPlatformFileError(int saved_errno); | 134 BASE_EXPORT PlatformFileError ErrnoToPlatformFileError(int saved_errno); |
| 135 #endif | 135 #endif |
| 136 | 136 |
| 137 BASE_EXPORT FILE* FdopenPlatformFile(PlatformFile file, const char* mode); | |
| 138 | |
| 139 // Closes a file handle. Returns |true| on success and |false| otherwise. | 137 // Closes a file handle. Returns |true| on success and |false| otherwise. |
| 140 BASE_EXPORT bool ClosePlatformFile(PlatformFile file); | 138 BASE_EXPORT bool ClosePlatformFile(PlatformFile file); |
| 141 | 139 |
| 142 // Changes current position in the file to an |offset| relative to an origin | 140 // Changes current position in the file to an |offset| relative to an origin |
| 143 // defined by |whence|. Returns the resultant current position in the file | 141 // defined by |whence|. Returns the resultant current position in the file |
| 144 // (relative to the start) or -1 in case of error. | 142 // (relative to the start) or -1 in case of error. |
| 145 BASE_EXPORT int64 SeekPlatformFile(PlatformFile file, | 143 BASE_EXPORT int64 SeekPlatformFile(PlatformFile file, |
| 146 PlatformFileWhence whence, | 144 PlatformFileWhence whence, |
| 147 int64 offset); | 145 int64 offset); |
| 148 | 146 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 return temp; | 259 return temp; |
| 262 } | 260 } |
| 263 | 261 |
| 264 private: | 262 private: |
| 265 PlatformFile* value_; | 263 PlatformFile* value_; |
| 266 }; | 264 }; |
| 267 | 265 |
| 268 } // namespace base | 266 } // namespace base |
| 269 | 267 |
| 270 #endif // BASE_PLATFORM_FILE_H_ | 268 #endif // BASE_PLATFORM_FILE_H_ |
| OLD | NEW |