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

Unified Diff: net/tools/dump_cache/dump_files.cc

Issue 153001: Fix 15 coverity complaints.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/dump_cache/dump_cache.cc ('k') | net/tools/dump_cache/upgrade.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/dump_cache/dump_files.cc
===================================================================
--- net/tools/dump_cache/dump_files.cc (revision 19697)
+++ net/tools/dump_cache/dump_files.cc (working copy)
@@ -23,7 +23,7 @@
const wchar_t kDataPrefix[] = L"data_";
// Reads the |header_size| bytes from the beginning of file |name|.
-bool ReadHeader(const std::wstring name, char* header, int header_size) {
+bool ReadHeader(const std::wstring& name, char* header, int header_size) {
net::FileStream file;
file.Open(FilePath::FromWStringHack(name),
base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ);
@@ -40,7 +40,7 @@
return true;
}
-int GetMajorVersionFromFile(const std::wstring name) {
+int GetMajorVersionFromFile(const std::wstring& name) {
disk_cache::IndexHeader header;
if (!ReadHeader(name, reinterpret_cast<char*>(&header), sizeof(header)))
return 0;
@@ -49,7 +49,7 @@
}
// Dumps the contents of the Index-file header.
-void DumpIndexHeader(const std::wstring name) {
+void DumpIndexHeader(const std::wstring& name) {
disk_cache::IndexHeader header;
if (!ReadHeader(name, reinterpret_cast<char*>(&header), sizeof(header)))
return;
@@ -75,7 +75,7 @@
}
// Dumps the contents of a block-file header.
-void DumpBlockHeader(const std::wstring name) {
+void DumpBlockHeader(const std::wstring& name) {
disk_cache::BlockFileHeader header;
if (!ReadHeader(name, reinterpret_cast<char*>(&header), sizeof(header)))
return;
@@ -105,7 +105,7 @@
// Simple class that interacts with the set of cache files.
class CacheDumper {
public:
- explicit CacheDumper(const std::wstring path)
+ explicit CacheDumper(const std::wstring& path)
: path_(path), block_files_(path), index_(NULL) {}
bool Init();
@@ -251,7 +251,7 @@
// -----------------------------------------------------------------------
-int GetMajorVersion(const std::wstring input_path) {
+int GetMajorVersion(const std::wstring& input_path) {
std::wstring index_name(input_path);
file_util::AppendToPath(&index_name, kIndexName);
@@ -273,7 +273,7 @@
}
// Dumps the headers of all files.
-int DumpHeaders(const std::wstring input_path) {
+int DumpHeaders(const std::wstring& input_path) {
std::wstring index_name(input_path);
file_util::AppendToPath(&index_name, kIndexName);
DumpIndexHeader(index_name);
@@ -291,7 +291,7 @@
}
// Dumps all entries from the cache.
-int DumpContents(const std::wstring input_path) {
+int DumpContents(const std::wstring& input_path) {
DumpHeaders(input_path);
// We need a message loop, although we really don't run any task.
« no previous file with comments | « net/tools/dump_cache/dump_cache.cc ('k') | net/tools/dump_cache/upgrade.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698