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

Side by Side Diff: util/test/scoped_temp_dir_posix.cc

Issue 913273002: win: Implementation of CrashReportDatabase for Windows (for C++ Windows readability review) (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 10 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
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 27 matching lines...) Expand all
38 return base::FilePath(dir_template); 38 return base::FilePath(dir_template);
39 } 39 }
40 40
41 // static 41 // static
42 void ScopedTempDir::RecursivelyDeleteTemporaryDirectory( 42 void ScopedTempDir::RecursivelyDeleteTemporaryDirectory(
43 const base::FilePath& path) { 43 const base::FilePath& path) {
44 DIR* dir = opendir(path.value().c_str()); 44 DIR* dir = opendir(path.value().c_str());
45 ASSERT_TRUE(dir) << ErrnoMessage("opendir") << " " << path.value(); 45 ASSERT_TRUE(dir) << ErrnoMessage("opendir") << " " << path.value();
46 46
47 dirent* entry; 47 dirent* entry;
48 while ((entry = readdir(dir))) { 48 while ((entry = readdir(dir))) {
Peter Kasting 2015/02/13 00:32:40 Nit: Consider avoiding using a with-side-effect st
scottmg 2015/02/13 06:34:05 I defer to Robert/Mark if they prefer that in this
Peter Kasting 2015/02/13 22:30:33 Part of the history here is that a few months back
Mark Mentovai 2015/02/13 22:36:15 scottmg wrote:
Peter Kasting 2015/02/13 22:38:26 OK. I defer to you guys. I think the primary ben
Mark Mentovai 2015/02/13 22:42:27 Peter Kasting wrote:
49 if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) { 49 if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) {
50 continue; 50 continue;
51 } 51 }
52 52
53 base::FilePath entry_path = path.Append(entry->d_name); 53 base::FilePath entry_path = path.Append(entry->d_name);
54 if (entry->d_type == DT_DIR) { 54 if (entry->d_type == DT_DIR) {
55 RecursivelyDeleteTemporaryDirectory(entry_path); 55 RecursivelyDeleteTemporaryDirectory(entry_path);
56 } else { 56 } else {
57 EXPECT_EQ(0, unlink(entry_path.value().c_str())) 57 EXPECT_EQ(0, unlink(entry_path.value().c_str()))
58 << ErrnoMessage("unlink") << " " << entry_path.value(); 58 << ErrnoMessage("unlink") << " " << entry_path.value();
59 } 59 }
60 } 60 }
61 61
62 EXPECT_EQ(0, closedir(dir)) 62 EXPECT_EQ(0, closedir(dir))
63 << ErrnoMessage("closedir") << " " << path.value(); 63 << ErrnoMessage("closedir") << " " << path.value();
64 EXPECT_EQ(0, rmdir(path.value().c_str())) 64 EXPECT_EQ(0, rmdir(path.value().c_str()))
65 << ErrnoMessage("rmdir") << " " << path.value(); 65 << ErrnoMessage("rmdir") << " " << path.value();
66 } 66 }
67 67
68 } // namespace test 68 } // namespace test
69 } // namespace crashpad 69 } // namespace crashpad
70 // EOF comment added for readability review.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698