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

Side by Side Diff: components/filesystem/util.cc

Issue 1546143002: Switch to standard integer types in components/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « components/filesystem/util.h ('k') | components/flags_ui/feature_entry_macros.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/filesystem/util.h" 5 #include "components/filesystem/util.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <time.h> 10 #include <time.h>
11 11
12 #include <limits> 12 #include <limits>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "build/build_config.h"
16 #include "mojo/public/cpp/bindings/string.h" 17 #include "mojo/public/cpp/bindings/string.h"
17 18
18 #if defined(OS_WIN) 19 #if defined(OS_WIN)
19 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
20 #endif 21 #endif
21 22
22 // module filesystem has various constants which must line up with enum values 23 // module filesystem has various constants which must line up with enum values
23 // in base::File::Flags. 24 // in base::File::Flags.
24 static_assert(filesystem::kFlagOpen == 25 static_assert(filesystem::kFlagOpen ==
25 static_cast<uint32>(base::File::FLAG_OPEN), 26 static_cast<uint32_t>(base::File::FLAG_OPEN),
26 ""); 27 "");
27 static_assert(filesystem::kFlagCreate == 28 static_assert(filesystem::kFlagCreate ==
28 static_cast<uint32>(base::File::FLAG_CREATE), 29 static_cast<uint32_t>(base::File::FLAG_CREATE),
29 ""); 30 "");
30 static_assert(filesystem::kFlagOpenAlways == 31 static_assert(filesystem::kFlagOpenAlways ==
31 static_cast<uint32>(base::File::FLAG_OPEN_ALWAYS), 32 static_cast<uint32_t>(base::File::FLAG_OPEN_ALWAYS),
32 ""); 33 "");
33 static_assert(filesystem::kCreateAlways == 34 static_assert(filesystem::kCreateAlways ==
34 static_cast<uint32>(base::File::FLAG_CREATE_ALWAYS), 35 static_cast<uint32_t>(base::File::FLAG_CREATE_ALWAYS),
35 ""); 36 "");
36 static_assert(filesystem::kFlagOpenTruncated == 37 static_assert(filesystem::kFlagOpenTruncated ==
37 static_cast<uint32>(base::File::FLAG_OPEN_TRUNCATED), 38 static_cast<uint32_t>(base::File::FLAG_OPEN_TRUNCATED),
38 ""); 39 "");
39 static_assert(filesystem::kFlagRead == 40 static_assert(filesystem::kFlagRead ==
40 static_cast<uint32>(base::File::FLAG_READ), 41 static_cast<uint32_t>(base::File::FLAG_READ),
41 ""); 42 "");
42 static_assert(filesystem::kFlagWrite == 43 static_assert(filesystem::kFlagWrite ==
43 static_cast<uint32>(base::File::FLAG_WRITE), 44 static_cast<uint32_t>(base::File::FLAG_WRITE),
44 ""); 45 "");
45 static_assert(filesystem::kFlagAppend == 46 static_assert(filesystem::kFlagAppend ==
46 static_cast<uint32>(base::File::FLAG_APPEND), 47 static_cast<uint32_t>(base::File::FLAG_APPEND),
47 ""); 48 "");
48 49
49 // filesystem.Error in types.mojom must be the same as base::File::Error. 50 // filesystem.Error in types.mojom must be the same as base::File::Error.
50 static_assert(static_cast<int>(filesystem::FILE_ERROR_OK) == 51 static_assert(static_cast<int>(filesystem::FILE_ERROR_OK) ==
51 static_cast<int>(base::File::FILE_OK), 52 static_cast<int>(base::File::FILE_OK),
52 ""); 53 "");
53 static_assert(static_cast<int>(filesystem::FILE_ERROR_FAILED) == 54 static_assert(static_cast<int>(filesystem::FILE_ERROR_FAILED) ==
54 static_cast<int>(base::File::FILE_ERROR_FAILED), 55 static_cast<int>(base::File::FILE_ERROR_FAILED),
55 ""); 56 "");
56 static_assert(static_cast<int>(filesystem::FILE_ERROR_IN_USE) == 57 static_assert(static_cast<int>(filesystem::FILE_ERROR_IN_USE) ==
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (full_path.ReferencesParent()) { 165 if (full_path.ReferencesParent()) {
165 // TODO(erg): For now, if it references a parent, we'll consider this bad. 166 // TODO(erg): For now, if it references a parent, we'll consider this bad.
166 return FILE_ERROR_ACCESS_DENIED; 167 return FILE_ERROR_ACCESS_DENIED;
167 } 168 }
168 169
169 *out = full_path; 170 *out = full_path;
170 return FILE_ERROR_OK; 171 return FILE_ERROR_OK;
171 } 172 }
172 173
173 } // namespace filesystem 174 } // namespace filesystem
OLDNEW
« no previous file with comments | « components/filesystem/util.h ('k') | components/flags_ui/feature_entry_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698