Chromium Code Reviews| 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 #include "base/platform_file.h" | 5 #include "base/platform_file.h" |
| 6 | 6 |
| 7 #include <io.h> | 7 #include <io.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 DCHECK(!disposition); | 44 DCHECK(!disposition); |
| 45 DCHECK(flags & PLATFORM_FILE_WRITE); | 45 DCHECK(flags & PLATFORM_FILE_WRITE); |
| 46 disposition = TRUNCATE_EXISTING; | 46 disposition = TRUNCATE_EXISTING; |
| 47 } | 47 } |
| 48 | 48 |
| 49 if (!disposition) { | 49 if (!disposition) { |
| 50 NOTREACHED(); | 50 NOTREACHED(); |
| 51 return NULL; | 51 return NULL; |
| 52 } | 52 } |
| 53 | 53 |
| 54 DWORD access = (flags & PLATFORM_FILE_READ) ? GENERIC_READ : 0; | 54 DWORD access = 0; |
| 55 if (flags & PLATFORM_FILE_WRITE) | 55 if (flags & PLATFORM_FILE_WRITE) |
| 56 access |= GENERIC_WRITE; | 56 access = GENERIC_WRITE; |
| 57 if (flags & PLATFORM_FILE_APPEND) { | |
| 58 DCHECK(!access) | |
|
jar (doing other things)
2013/06/05 16:39:21
missing semicolon.
| |
| 59 access = FILE_APPEND_DATA; | |
| 60 } | |
| 61 if (flags & PLATFORM_FILE_READ) | |
| 62 access |= GENERIC_READ; | |
| 57 if (flags & PLATFORM_FILE_WRITE_ATTRIBUTES) | 63 if (flags & PLATFORM_FILE_WRITE_ATTRIBUTES) |
| 58 access |= FILE_WRITE_ATTRIBUTES; | 64 access |= FILE_WRITE_ATTRIBUTES; |
| 59 if (flags & PLATFORM_FILE_EXECUTE) | 65 if (flags & PLATFORM_FILE_EXECUTE) |
| 60 access |= GENERIC_EXECUTE; | 66 access |= GENERIC_EXECUTE; |
| 61 | 67 |
| 62 DWORD sharing = (flags & PLATFORM_FILE_EXCLUSIVE_READ) ? 0 : FILE_SHARE_READ; | 68 DWORD sharing = (flags & PLATFORM_FILE_EXCLUSIVE_READ) ? 0 : FILE_SHARE_READ; |
| 63 if (!(flags & PLATFORM_FILE_EXCLUSIVE_WRITE)) | 69 if (!(flags & PLATFORM_FILE_EXCLUSIVE_WRITE)) |
| 64 sharing |= FILE_SHARE_WRITE; | 70 sharing |= FILE_SHARE_WRITE; |
| 65 if (flags & PLATFORM_FILE_SHARE_DELETE) | 71 if (flags & PLATFORM_FILE_SHARE_DELETE) |
| 66 sharing |= FILE_SHARE_DELETE; | 72 sharing |= FILE_SHARE_DELETE; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 case ERROR_DISK_CORRUPT: | 292 case ERROR_DISK_CORRUPT: |
| 287 return PLATFORM_FILE_ERROR_IO; | 293 return PLATFORM_FILE_ERROR_IO; |
| 288 default: | 294 default: |
| 289 UMA_HISTOGRAM_SPARSE_SLOWLY("PlatformFile.UnknownErrors.Windows", | 295 UMA_HISTOGRAM_SPARSE_SLOWLY("PlatformFile.UnknownErrors.Windows", |
| 290 last_error); | 296 last_error); |
| 291 return PLATFORM_FILE_ERROR_FAILED; | 297 return PLATFORM_FILE_ERROR_FAILED; |
| 292 } | 298 } |
| 293 } | 299 } |
| 294 | 300 |
| 295 } // namespace base | 301 } // namespace base |
| OLD | NEW |