Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: base/files/file_win.cc

Issue 314023002: Require FLAG_WRITE when FLAG_CREATE_ALWAYS is specified (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Require FLAG_WRITE on Windows too Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/files/file_unittest.cc ('k') | base/platform_file_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/files/file.h" 5 #include "base/files/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 16 matching lines...) Expand all
27 disposition = CREATE_NEW; 27 disposition = CREATE_NEW;
28 } 28 }
29 29
30 if (flags & FLAG_OPEN_ALWAYS) { 30 if (flags & FLAG_OPEN_ALWAYS) {
31 DCHECK(!disposition); 31 DCHECK(!disposition);
32 disposition = OPEN_ALWAYS; 32 disposition = OPEN_ALWAYS;
33 } 33 }
34 34
35 if (flags & FLAG_CREATE_ALWAYS) { 35 if (flags & FLAG_CREATE_ALWAYS) {
36 DCHECK(!disposition); 36 DCHECK(!disposition);
37 DCHECK(flags & FLAG_WRITE);
37 disposition = CREATE_ALWAYS; 38 disposition = CREATE_ALWAYS;
38 } 39 }
39 40
40 if (flags & FLAG_OPEN_TRUNCATED) { 41 if (flags & FLAG_OPEN_TRUNCATED) {
41 DCHECK(!disposition); 42 DCHECK(!disposition);
42 DCHECK(flags & FLAG_WRITE); 43 DCHECK(flags & FLAG_WRITE);
43 disposition = TRUNCATE_EXISTING; 44 disposition = TRUNCATE_EXISTING;
44 } 45 }
45 46
46 if (!disposition) { 47 if (!disposition) {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 last_error); 340 last_error);
340 return FILE_ERROR_FAILED; 341 return FILE_ERROR_FAILED;
341 } 342 }
342 } 343 }
343 344
344 void File::SetPlatformFile(PlatformFile file) { 345 void File::SetPlatformFile(PlatformFile file) {
345 file_.Set(file); 346 file_.Set(file);
346 } 347 }
347 348
348 } // namespace base 349 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_unittest.cc ('k') | base/platform_file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698