summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-06 22:35:13 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-06 22:35:13 +0000
commit3fc364f9059372255062f7e5d009cce3b4d349f2 (patch)
tree3ab7e808ce97ce2fd901b1531a366bda8ca692d5 /net
parent892b70d03e3b6aa795b43a4bc70c77249e469958 (diff)
downloadchromium_src-3fc364f9059372255062f7e5d009cce3b4d349f2.zip
chromium_src-3fc364f9059372255062f7e5d009cce3b4d349f2.tar.gz
chromium_src-3fc364f9059372255062f7e5d009cce3b4d349f2.tar.bz2
Relanding Coverity fixes from http://codereview.chromium.org/159862 excluding the broken ones.
The change of GURL -> const GURL& caused some nasty crash and the change got reverted. TEST=none BUG=none Review URL: http://codereview.chromium.org/164095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/bzip2_filter_unittest.cc2
-rw-r--r--net/base/file_stream_posix.cc7
-rw-r--r--net/base/file_stream_unittest.cc2
-rw-r--r--net/base/file_stream_win.cc7
-rw-r--r--net/base/gzip_filter_unittest.cc2
-rw-r--r--net/disk_cache/block_files_unittest.cc2
-rw-r--r--net/url_request/url_request_view_cache_job.cc4
7 files changed, 15 insertions, 11 deletions
diff --git a/net/base/bzip2_filter_unittest.cc b/net/base/bzip2_filter_unittest.cc
index 7705ebb..4e6ec54 100644
--- a/net/base/bzip2_filter_unittest.cc
+++ b/net/base/bzip2_filter_unittest.cc
@@ -48,7 +48,7 @@ class BZip2FilterUnitTest : public PlatformTest {
file_path = file_path.AppendASCII("google.txt");
// Read data from the file into buffer.
- file_util::ReadFileToString(file_path, &source_buffer_);
+ ASSERT_TRUE(file_util::ReadFileToString(file_path, &source_buffer_));
// Append the extra data to end of source
source_buffer_.append(kExtraData, kExtraDataBufferSize);
diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc
index 5c55781..aac0be2 100644
--- a/net/base/file_stream_posix.cc
+++ b/net/base/file_stream_posix.cc
@@ -290,12 +290,15 @@ void FileStream::AsyncContext::RunAsynchronousCallback() {
// FileStream ------------------------------------------------------------
-FileStream::FileStream() : file_(base::kInvalidPlatformFileValue) {
+FileStream::FileStream()
+ : file_(base::kInvalidPlatformFileValue),
+ open_flags_(0) {
DCHECK(!IsOpen());
}
FileStream::FileStream(base::PlatformFile file, int flags)
- : file_(file), open_flags_(flags) {
+ : file_(file),
+ open_flags_(flags) {
// If the file handle is opened with base::PLATFORM_FILE_ASYNC, we need to
// make sure we will perform asynchronous File IO to it.
if (flags & base::PLATFORM_FILE_ASYNC) {
diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc
index 4b8b12b..f430d8e 100644
--- a/net/base/file_stream_unittest.cc
+++ b/net/base/file_stream_unittest.cc
@@ -885,7 +885,7 @@ TEST_F(FileStreamTest, Truncate) {
// Read in the contents and make sure we get back what we expected.
std::string read_contents;
- file_util::ReadFileToString(temp_file_path(), &read_contents);
+ EXPECT_TRUE(file_util::ReadFileToString(temp_file_path(), &read_contents));
EXPECT_EQ("01230123", read_contents);
}
diff --git a/net/base/file_stream_win.cc b/net/base/file_stream_win.cc
index 09ad88e..cec6a9d 100644
--- a/net/base/file_stream_win.cc
+++ b/net/base/file_stream_win.cc
@@ -115,11 +115,14 @@ void FileStream::AsyncContext::OnIOCompleted(
// FileStream ------------------------------------------------------------
-FileStream::FileStream() : file_(INVALID_HANDLE_VALUE) {
+FileStream::FileStream()
+ : file_(INVALID_HANDLE_VALUE),
+ open_flags_(0) {
}
FileStream::FileStream(base::PlatformFile file, int flags)
- : file_(file), open_flags_(flags) {
+ : file_(file),
+ open_flags_(flags) {
// If the file handle is opened with base::PLATFORM_FILE_ASYNC, we need to
// make sure we will perform asynchronous File IO to it.
if (flags & base::PLATFORM_FILE_ASYNC) {
diff --git a/net/base/gzip_filter_unittest.cc b/net/base/gzip_filter_unittest.cc
index 3b464ea..377b521 100644
--- a/net/base/gzip_filter_unittest.cc
+++ b/net/base/gzip_filter_unittest.cc
@@ -71,7 +71,7 @@ class GZipUnitTest : public PlatformTest {
file_path = file_path.AppendASCII("google.txt");
// Read data from the file into buffer.
- file_util::ReadFileToString(file_path, &source_buffer_);
+ ASSERT_TRUE(file_util::ReadFileToString(file_path, &source_buffer_));
// Encode the data with deflate
deflate_encode_buffer_ = new char[kDefaultBufferSize];
diff --git a/net/disk_cache/block_files_unittest.cc b/net/disk_cache/block_files_unittest.cc
index ce76fd6..b4ce107 100644
--- a/net/disk_cache/block_files_unittest.cc
+++ b/net/disk_cache/block_files_unittest.cc
@@ -14,7 +14,7 @@ using base::Time;
namespace {
// Returns the number of files in this folder.
-int NumberOfFiles(const std::wstring path) {
+int NumberOfFiles(const std::wstring& path) {
file_util::FileEnumerator iter(FilePath::FromWStringHack(path), false,
file_util::FileEnumerator::FILES);
int count = 0;
diff --git a/net/url_request/url_request_view_cache_job.cc b/net/url_request/url_request_view_cache_job.cc
index 6fd4e23..ca82680 100644
--- a/net/url_request/url_request_view_cache_job.cc
+++ b/net/url_request/url_request_view_cache_job.cc
@@ -66,9 +66,7 @@ static std::string FormatEntryDetails(disk_cache::Entry* entry) {
std::string result = EscapeForHTML(entry->GetKey());
net::HttpResponseInfo response;
- net::HttpCache::ReadResponseInfo(entry, &response);
-
- if (response.headers) {
+ if (net::HttpCache::ReadResponseInfo(entry, &response) && response.headers) {
result.append("<hr><pre>");
result.append(EscapeForHTML(response.headers->GetStatusLine()));
result.push_back('\n');