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

Side by Side Diff: base/file_util_posix.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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/debug/trace_event_unittest.cc ('k') | base/file_util_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/file_util.h" 5 #include "base/file_util.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <fnmatch.h> 10 #include <fnmatch.h>
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 // time. Check to see if it exists and make sure it is a directory. 534 // time. Check to see if it exists and make sure it is a directory.
535 if (!DirectoryExists(*i)) 535 if (!DirectoryExists(*i))
536 return false; 536 return false;
537 } 537 }
538 return true; 538 return true;
539 } 539 }
540 540
541 base::FilePath MakeUniqueDirectory(const base::FilePath& path) { 541 base::FilePath MakeUniqueDirectory(const base::FilePath& path) {
542 const int kMaxAttempts = 20; 542 const int kMaxAttempts = 20;
543 for (int attempts = 0; attempts < kMaxAttempts; attempts++) { 543 for (int attempts = 0; attempts < kMaxAttempts; attempts++) {
544 int uniquifier = GetUniquePathNumber(path, FILE_PATH_LITERAL("")); 544 int uniquifier =
545 GetUniquePathNumber(path, base::FilePath::StringType());
545 if (uniquifier < 0) 546 if (uniquifier < 0)
546 break; 547 break;
547 base::FilePath test_path = (uniquifier == 0) ? path : 548 base::FilePath test_path = (uniquifier == 0) ? path :
548 path.InsertBeforeExtensionASCII( 549 path.InsertBeforeExtensionASCII(
549 base::StringPrintf(" (%d)", uniquifier)); 550 base::StringPrintf(" (%d)", uniquifier));
550 if (mkdir(test_path.value().c_str(), 0777) == 0) 551 if (mkdir(test_path.value().c_str(), 0777) == 0)
551 return test_path; 552 return test_path;
552 else if (errno != EEXIST) 553 else if (errno != EEXIST)
553 break; 554 break;
554 } 555 }
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 kFileSystemRoot, path, kRootUid, allowed_group_ids); 1056 kFileSystemRoot, path, kRootUid, allowed_group_ids);
1056 } 1057 }
1057 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 1058 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
1058 1059
1059 int GetMaximumPathComponentLength(const FilePath& path) { 1060 int GetMaximumPathComponentLength(const FilePath& path) {
1060 base::ThreadRestrictions::AssertIOAllowed(); 1061 base::ThreadRestrictions::AssertIOAllowed();
1061 return pathconf(path.value().c_str(), _PC_NAME_MAX); 1062 return pathconf(path.value().c_str(), _PC_NAME_MAX);
1062 } 1063 }
1063 1064
1064 } // namespace file_util 1065 } // namespace file_util
OLDNEW
« no previous file with comments | « base/debug/trace_event_unittest.cc ('k') | base/file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698