summaryrefslogtreecommitdiffstats
path: root/base/file_util_win.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-19 02:31:03 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-19 02:31:03 +0000
commitb026e35d56ca317e00fa54864e7f869be62e99d9 (patch)
treee9a32e7cc2d0574cf3ef29a0f4e75b7fc3cde6c6 /base/file_util_win.cc
parent12a94ea157a6326c835f6dc9bca3a2332b911606 (diff)
downloadchromium_src-b026e35d56ca317e00fa54864e7f869be62e99d9.zip
chromium_src-b026e35d56ca317e00fa54864e7f869be62e99d9.tar.gz
chromium_src-b026e35d56ca317e00fa54864e7f869be62e99d9.tar.bz2
Reland r62959 without the changes to histogram.cc, in hopes it won't break tab_switching_test, and without the changes to tools_sanity_unittest.cc, which have already been relanded separately.
TBR=timsteele Original changelog message: Convert LOG(INFO) to VLOG(1) - base/. Also removes an "else" after "return" and aligns "<<" per style guide. BUG=none TEST=none Review URL: http://codereview.chromium.org/3850007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63009 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_win.cc')
-rw-r--r--base/file_util_win.cc28
1 files changed, 11 insertions, 17 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index d9f8404..30d314f 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -561,8 +561,7 @@ bool CreateTemporaryDirInDir(const FilePath& base_dir,
FilePath path_to_create;
srand(static_cast<uint32>(time(NULL)));
- int count = 0;
- while (count < 50) {
+ for (int count = 0; count < 50; ++count) {
// Try create a new temporary directory with random generated name. If
// the one exists, keep trying another path name until we reach some limit.
path_to_create = base_dir;
@@ -572,17 +571,13 @@ bool CreateTemporaryDirInDir(const FilePath& base_dir,
new_dir_name.append(base::IntToString16(rand() % kint16max));
path_to_create = path_to_create.Append(new_dir_name);
- if (::CreateDirectory(path_to_create.value().c_str(), NULL))
- break;
- count++;
- }
-
- if (count == 50) {
- return false;
+ if (::CreateDirectory(path_to_create.value().c_str(), NULL)) {
+ *new_dir = path_to_create;
+ return true;
+ }
}
- *new_dir = path_to_create;
- return true;
+ return false;
}
bool CreateNewTempDirectory(const FilePath::StringType& prefix,
@@ -600,14 +595,13 @@ bool CreateDirectory(const FilePath& full_path) {
DWORD fileattr = ::GetFileAttributes(full_path_str);
if (fileattr != INVALID_FILE_ATTRIBUTES) {
if ((fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
- DLOG(INFO) << "CreateDirectory(" << full_path_str << "), "
- << "directory already exists.";
+ DVLOG(1) << "CreateDirectory(" << full_path_str << "), "
+ << "directory already exists.";
return true;
- } else {
- LOG(WARNING) << "CreateDirectory(" << full_path_str << "), "
- << "conflicts with existing file.";
- return false;
}
+ LOG(WARNING) << "CreateDirectory(" << full_path_str << "), "
+ << "conflicts with existing file.";
+ return false;
}
// Invariant: Path does not exist as file or directory.