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

Side by Side Diff: base/file_path.h

Issue 11642041: Don't allow '\0' characters in FilePath. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments, check that FPS() works Created 7 years, 11 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 | « no previous file | base/file_path.cc » ('j') | base/file_path.cc » ('J')
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 // FilePath is a container for pathnames stored in a platform's native string 5 // FilePath is a container for pathnames stored in a platform's native string
6 // type, providing containers for manipulation in according with the 6 // type, providing containers for manipulation in according with the
7 // platform's conventions for pathnames. It supports the following path 7 // platform's conventions for pathnames. It supports the following path
8 // types: 8 // types:
9 // 9 //
10 // POSIX Windows 10 // POSIX Windows
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // at all, making them safe to use without fear of blocking on I/O operations. 46 // at all, making them safe to use without fear of blocking on I/O operations.
47 // These methods do not function as mutators but instead return distinct 47 // These methods do not function as mutators but instead return distinct
48 // instances of FilePath objects, and are therefore safe to use on const 48 // instances of FilePath objects, and are therefore safe to use on const
49 // objects. The objects themselves are safe to share between threads. 49 // objects. The objects themselves are safe to share between threads.
50 // 50 //
51 // To aid in initialization of FilePath objects from string literals, a 51 // To aid in initialization of FilePath objects from string literals, a
52 // FILE_PATH_LITERAL macro is provided, which accounts for the difference 52 // FILE_PATH_LITERAL macro is provided, which accounts for the difference
53 // between char[]-based pathnames on POSIX systems and wchar_t[]-based 53 // between char[]-based pathnames on POSIX systems and wchar_t[]-based
54 // pathnames on Windows. 54 // pathnames on Windows.
55 // 55 //
56 // Paths can't contain NULs as a precaution agaist premature truncation.
57 //
56 // Because a FilePath object should not be instantiated at the global scope, 58 // Because a FilePath object should not be instantiated at the global scope,
57 // instead, use a FilePath::CharType[] and initialize it with 59 // instead, use a FilePath::CharType[] and initialize it with
58 // FILE_PATH_LITERAL. At runtime, a FilePath object can be created from the 60 // FILE_PATH_LITERAL. At runtime, a FilePath object can be created from the
59 // character array. Example: 61 // character array. Example:
60 // 62 //
61 // | const FilePath::CharType kLogFileName[] = FILE_PATH_LITERAL("log.txt"); 63 // | const FilePath::CharType kLogFileName[] = FILE_PATH_LITERAL("log.txt");
62 // | 64 // |
63 // | void Function() { 65 // | void Function() {
64 // | FilePath log_file_path(kLogFileName); 66 // | FilePath log_file_path(kLogFileName);
65 // | [...] 67 // | [...]
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 429
428 inline size_t hash_value(const FilePath& f) { 430 inline size_t hash_value(const FilePath& f) {
429 return hash_value(f.value()); 431 return hash_value(f.value());
430 } 432 }
431 433
432 #endif // COMPILER 434 #endif // COMPILER
433 435
434 } // namespace BASE_HASH_NAMESPACE 436 } // namespace BASE_HASH_NAMESPACE
435 437
436 #endif // BASE_FILE_PATH_H_ 438 #endif // BASE_FILE_PATH_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_path.cc » ('j') | base/file_path.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698