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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 bool* created, | 128 bool* created, |
129 PlatformFileError* error); | 129 PlatformFileError* error); |
130 | 130 |
131 // Same as CreatePlatformFile but allows paths with traversal (like \..\) | 131 // Same as CreatePlatformFile but allows paths with traversal (like \..\) |
132 // components. Use only with extreme care. | 132 // components. Use only with extreme care. |
133 BASE_EXPORT PlatformFile CreatePlatformFileUnsafe(const FilePath& name, | 133 BASE_EXPORT PlatformFile CreatePlatformFileUnsafe(const FilePath& name, |
134 int flags, | 134 int flags, |
135 bool* created, | 135 bool* created, |
136 PlatformFileError* error); | 136 PlatformFileError* error); |
137 | 137 |
| 138 BASE_EXPORT FILE* FdopenPlatformFile(PlatformFile file, const char* mode); |
| 139 |
138 // Closes a file handle. Returns |true| on success and |false| otherwise. | 140 // Closes a file handle. Returns |true| on success and |false| otherwise. |
139 BASE_EXPORT bool ClosePlatformFile(PlatformFile file); | 141 BASE_EXPORT bool ClosePlatformFile(PlatformFile file); |
140 | 142 |
141 // Changes current position in the file to an |offset| relative to an origin | 143 // Changes current position in the file to an |offset| relative to an origin |
142 // defined by |whence|. Returns the resultant current position in the file | 144 // defined by |whence|. Returns the resultant current position in the file |
143 // (relative to the start) or -1 in case of error. | 145 // (relative to the start) or -1 in case of error. |
144 BASE_EXPORT int64 SeekPlatformFile(PlatformFile file, | 146 BASE_EXPORT int64 SeekPlatformFile(PlatformFile file, |
145 PlatformFileWhence whence, | 147 PlatformFileWhence whence, |
146 int64 offset); | 148 int64 offset); |
147 | 149 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 return temp; | 235 return temp; |
234 } | 236 } |
235 | 237 |
236 private: | 238 private: |
237 PlatformFile* value_; | 239 PlatformFile* value_; |
238 }; | 240 }; |
239 | 241 |
240 } // namespace base | 242 } // namespace base |
241 | 243 |
242 #endif // BASE_PLATFORM_FILE_H_ | 244 #endif // BASE_PLATFORM_FILE_H_ |
OLD | NEW |