Some manual change to for-ranged loop.

Use "const auto&" where possible.
This commit is contained in:
Haojian Wu 2016-07-10 15:56:42 +02:00
parent 2717b96310
commit 4ac4dacffe
8 changed files with 9 additions and 8 deletions

View file

@ -241,7 +241,7 @@ void OnGetBackend(disk_cache::Backend** backend_ptr,
} else if (action == Session::CacheAction::STATS) { } else if (action == Session::CacheAction::STATS) {
base::StringPairs stats; base::StringPairs stats;
(*backend_ptr)->GetStats(&stats); (*backend_ptr)->GetStats(&stats);
for (auto& stat : stats) { for (const auto& stat : stats) {
if (stat.first == "Current size") { if (stat.first == "Current size") {
int current_size; int current_size;
base::StringToInt(stat.second, &current_size); base::StringToInt(stat.second, &current_size);

View file

@ -435,7 +435,7 @@ void CommonWebContentsDelegate::DevToolsRequestFileSystems() {
} }
base::ListValue file_system_value; base::ListValue file_system_value;
for (auto& file_system : file_systems) for (const auto& file_system : file_systems)
file_system_value.Append(CreateFileSystemValue(file_system)); file_system_value.Append(CreateFileSystemValue(file_system));
web_contents_->CallClientFunction("DevToolsAPI.fileSystemsLoaded", web_contents_->CallClientFunction("DevToolsAPI.fileSystemsLoaded",
&file_system_value, nullptr, nullptr); &file_system_value, nullptr, nullptr);

View file

@ -30,7 +30,7 @@ bool StringToAccelerator(const std::string& shortcut,
// Now, parse it into an accelerator. // Now, parse it into an accelerator.
int modifiers = ui::EF_NONE; int modifiers = ui::EF_NONE;
ui::KeyboardCode key = ui::VKEY_UNKNOWN; ui::KeyboardCode key = ui::VKEY_UNKNOWN;
for (auto& token : tokens) { for (const auto& token : tokens) {
bool shifted = false; bool shifted = false;
ui::KeyboardCode code = atom::KeyboardCodeFromStr(token, &shifted); ui::KeyboardCode code = atom::KeyboardCodeFromStr(token, &shifted);
if (shifted) if (shifted)

View file

@ -70,7 +70,7 @@ void WindowList::RemoveObserver(WindowListObserver* observer) {
// static // static
void WindowList::CloseAllWindows() { void WindowList::CloseAllWindows() {
WindowVector windows = GetInstance()->windows_; WindowVector windows = GetInstance()->windows_;
for (auto& window : windows) for (const auto& window : windows)
window->Close(); window->Close();
} }

View file

@ -63,7 +63,7 @@ float GetScaleFactorFromPath(const base::FilePath& path) {
// We don't try to convert string to float here because it is very very // We don't try to convert string to float here because it is very very
// expensive. // expensive.
for (auto& kScaleFactorPair : kScaleFactorPairs) { for (const auto& kScaleFactorPair : kScaleFactorPairs) {
if (base::EndsWith(filename, kScaleFactorPair.name, if (base::EndsWith(filename, kScaleFactorPair.name,
base::CompareCase::INSENSITIVE_ASCII)) base::CompareCase::INSENSITIVE_ASCII))
return kScaleFactorPair.scale; return kScaleFactorPair.scale;

View file

@ -54,7 +54,8 @@ void NodeBindingsMac::PollEvents() {
// Wait for new libuv events. // Wait for new libuv events.
int r; int r;
do { do {
r = select(fd + 1, &readset, nullptr, nullptr, timeout == -1 ? nullptr : &tv); r = select(fd + 1, &readset, nullptr, nullptr,
timeout == -1 ? nullptr : &tv);
} while (r == -1 && errno == EINTR); } while (r == -1 && errno == EINTR);
} }

View file

@ -132,7 +132,7 @@ void AtomRenderViewObserver::DraggableRegionsChanged(blink::WebFrame* frame) {
blink::WebVector<blink::WebDraggableRegion> webregions = blink::WebVector<blink::WebDraggableRegion> webregions =
frame->document().draggableRegions(); frame->document().draggableRegions();
std::vector<DraggableRegion> regions; std::vector<DraggableRegion> regions;
for (auto& webregion : webregions) { for (const auto& webregion : webregions) {
DraggableRegion region; DraggableRegion region;
region.bounds = webregion.bounds; region.bounds = webregion.bounds;
region.draggable = webregion.draggable; region.draggable = webregion.draggable;

View file

@ -58,7 +58,7 @@ bool AtomContentUtilityClient::OnMessageReceived(
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP() IPC_END_MESSAGE_MAP()
for (auto it = handlers_.begin(); !handled && it != handlers_.end(); ++it) { for (auto it = handlers_.begin(); !handled && it != handlers_.end(); ++it) {
handled = (*it)->OnMessageReceived(message); handled = (*it)->OnMessageReceived(message);
} }