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

Side by Side Diff: mojo/fetcher/network_fetcher.cc

Issue 1372153002: Detecting and fixing stringprintf.h format bugs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Separate #if defined blocks. Created 5 years, 2 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
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | sync/engine/model_type_worker.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mojo/fetcher/network_fetcher.h" 5 #include "mojo/fetcher/network_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // TODO(eseidel): All users of this log should move to using the map file. 83 // TODO(eseidel): All users of this log should move to using the map file.
84 VLOG(1) << "Caching mojo app " << url << " at " << path.value(); 84 VLOG(1) << "Caching mojo app " << url << " at " << path.value();
85 85
86 base::FilePath temp_dir; 86 base::FilePath temp_dir;
87 base::GetTempDir(&temp_dir); 87 base::GetTempDir(&temp_dir);
88 base::ProcessId pid = base::Process::Current().Pid(); 88 base::ProcessId pid = base::Process::Current().Pid();
89 std::string map_name = base::StringPrintf("mojo_shell.%d.maps", pid); 89 std::string map_name = base::StringPrintf("mojo_shell.%d.maps", pid);
90 base::FilePath map_path = temp_dir.AppendASCII(map_name); 90 base::FilePath map_path = temp_dir.AppendASCII(map_name);
91 91
92 // TODO(eseidel): Paths or URLs with spaces will need quoting. 92 // TODO(eseidel): Paths or URLs with spaces will need quoting.
93 std::string map_entry = 93 std::string map_entry = base::StringPrintf(
94 base::StringPrintf("%s %s\n", path.value().c_str(), url.spec().c_str()); 94 "%" PRIsFP " %s\n", path.value().c_str(), url.spec().c_str());
95 // TODO(eseidel): AppendToFile is missing O_CREAT, crbug.com/450696 95 // TODO(eseidel): AppendToFile is missing O_CREAT, crbug.com/450696
96 if (!PathExists(map_path)) { 96 if (!PathExists(map_path)) {
97 base::WriteFile(map_path, map_entry.data(), 97 base::WriteFile(map_path, map_entry.data(),
98 static_cast<int>(map_entry.length())); 98 static_cast<int>(map_entry.length()));
99 } else { 99 } else {
100 base::AppendToFile(map_path, map_entry.data(), 100 base::AppendToFile(map_path, map_entry.data(),
101 static_cast<int>(map_entry.length())); 101 static_cast<int>(map_entry.length()));
102 } 102 }
103 } 103 }
104 104
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 loader_callback_.Run(nullptr); 241 loader_callback_.Run(nullptr);
242 return; 242 return;
243 } 243 }
244 244
245 response_ = response.Pass(); 245 response_ = response.Pass();
246 loader_callback_.Run(owner.Pass()); 246 loader_callback_.Run(owner.Pass());
247 } 247 }
248 248
249 } // namespace fetcher 249 } // namespace fetcher
250 } // namespace mojo 250 } // namespace mojo
OLDNEW
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | sync/engine/model_type_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698