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

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

Issue 1218243002: Fix some clang warnings with -Wmissing-braces in base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 5 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
« no previous file with comments | « base/file_version_info_unittest.cc ('k') | base/process/launch_win.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/memory_mapped_file.h" 5 #include "base/files/memory_mapped_file.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 10
(...skipping 14 matching lines...) Expand all
25 if (!file_.IsValid()) 25 if (!file_.IsValid())
26 return false; 26 return false;
27 27
28 int flags = image_ ? SEC_IMAGE | PAGE_READONLY : PAGE_READONLY; 28 int flags = image_ ? SEC_IMAGE | PAGE_READONLY : PAGE_READONLY;
29 29
30 file_mapping_.Set(::CreateFileMapping(file_.GetPlatformFile(), NULL, 30 file_mapping_.Set(::CreateFileMapping(file_.GetPlatformFile(), NULL,
31 flags, 0, 0, NULL)); 31 flags, 0, 0, NULL));
32 if (!file_mapping_.IsValid()) 32 if (!file_mapping_.IsValid())
33 return false; 33 return false;
34 34
35 LARGE_INTEGER map_start = {0}; 35 LARGE_INTEGER map_start = {};
36 SIZE_T map_size = 0; 36 SIZE_T map_size = 0;
37 int32 data_offset = 0; 37 int32 data_offset = 0;
38 38
39 if (region == MemoryMappedFile::Region::kWholeFile) { 39 if (region == MemoryMappedFile::Region::kWholeFile) {
40 int64 file_len = file_.GetLength(); 40 int64 file_len = file_.GetLength();
41 if (file_len <= 0 || file_len > kint32max) 41 if (file_len <= 0 || file_len > kint32max)
42 return false; 42 return false;
43 length_ = static_cast<size_t>(file_len); 43 length_ = static_cast<size_t>(file_len);
44 } else { 44 } else {
45 // The region can be arbitrarily aligned. MapViewOfFile, instead, requires 45 // The region can be arbitrarily aligned. MapViewOfFile, instead, requires
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (file_mapping_.IsValid()) 83 if (file_mapping_.IsValid())
84 file_mapping_.Close(); 84 file_mapping_.Close();
85 if (file_.IsValid()) 85 if (file_.IsValid())
86 file_.Close(); 86 file_.Close();
87 87
88 data_ = NULL; 88 data_ = NULL;
89 length_ = 0; 89 length_ = 0;
90 } 90 }
91 91
92 } // namespace base 92 } // namespace base
OLDNEW
« no previous file with comments | « base/file_version_info_unittest.cc ('k') | base/process/launch_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698