diff options
author | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-21 22:26:06 +0000 |
---|---|---|
committer | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-21 22:26:06 +0000 |
commit | f1ea2fa47af56a08b964a5ad0512156bfcbfda11 (patch) | |
tree | 1626a8a9dfb5de1b6ec86cb2552096d2ee2f1b75 /net | |
parent | a2221350d2f9240099d88930d24c19b7745d3154 (diff) | |
download | chromium_src-f1ea2fa47af56a08b964a5ad0512156bfcbfda11.zip chromium_src-f1ea2fa47af56a08b964a5ad0512156bfcbfda11.tar.gz chromium_src-f1ea2fa47af56a08b964a5ad0512156bfcbfda11.tar.bz2 |
Fix the final gcc warnings in base and net. Provide some macros to selectively disable MSVC warnings.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/base64.cc | 3 | ||||
-rw-r--r-- | net/base/net_util_unittest.cc | 20 | ||||
-rw-r--r-- | net/http/http_cache.cc | 12 |
3 files changed, 17 insertions, 18 deletions
diff --git a/net/base/base64.cc b/net/base/base64.cc index 05716f5b..63c9c47 100644 --- a/net/base/base64.cc +++ b/net/base/base64.cc @@ -29,10 +29,7 @@ #include "net/base/base64.h" -#pragma warning(push) -#pragma warning(disable: 4267) #include "third_party/modp_b64/modp_b64.h" -#pragma warning(pop) namespace net { diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc index bf7c90c..3bf93c1 100644 --- a/net/base/net_util_unittest.cc +++ b/net/base/net_util_unittest.cc @@ -97,7 +97,7 @@ TEST(NetUtilTest, FileURLConversion) { // First, we'll test that we can round-trip all of the above cases of URLs std::wstring output; - for (int i = 0; i < arraysize(round_trip_cases); i++) { + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(round_trip_cases); i++) { // convert to the file URL GURL file_url(net::FilePathToFileURL(round_trip_cases[i].file)); EXPECT_EQ(std::wstring(round_trip_cases[i].url), @@ -119,14 +119,14 @@ TEST(NetUtilTest, FileURLConversion) { {L"\\\\foo\\bar.txt", L"file://foo\\bar.txt"}, {L"C:\\foo\\bar.txt", L"file:\\\\\\c:/foo/bar.txt"}, }; - for (int i = 0; i < arraysize(url_cases); i++) { + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(url_cases); i++) { net::FileURLToFilePath(GURL(WideToUTF16(url_cases[i].url)), &output); EXPECT_EQ(std::wstring(url_cases[i].file), output); } // Here, we test that UTF-8 encoded strings get decoded properly, even when // they might be stored with wide characters - const wchar_t utf8[] = L"file:///d:/Chinese/\xe6\x89\x80\xe6\x9c\x89\xe4\xb8\xad\xe6\x96\x87\xe7\xbd\x91\xe9\xa1\xb5.doc"; + const wchar_t utf8[] = "file:///d:/Chinese/\xe6\x89\x80\xe6\x9c\x89\xe4\xb8\xad\xe6\x96\x87\xe7\xbd\x91\xe9\xa1\xb5.doc"; const wchar_t wide[] = L"D:\\Chinese\\\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc"; EXPECT_TRUE(net::FileURLToFilePath(GURL(WideToUTF16(utf8)), &output)); EXPECT_EQ(std::wstring(wide), output); @@ -179,14 +179,14 @@ TEST(NetUtilTest, GetSpecificHeader) { }; // Test first with google_headers. - for (size_t i = 0; i < arraysize(tests); ++i) { + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { std::wstring result = net::GetSpecificHeader(google_headers, tests[i].header_name); EXPECT_EQ(result, tests[i].expected); } // Test again with empty headers. - for (size_t i = 0; i < arraysize(tests); ++i) { + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { std::wstring result = net::GetSpecificHeader(L"", tests[i].header_name); EXPECT_EQ(result, std::wstring()); } @@ -208,7 +208,7 @@ TEST(NetUtilTest, GetHeaderParamValue) { }; // TODO(mpcomplete): add tests for other formats of headers. - for (size_t i = 0; i < arraysize(tests); ++i) { + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { std::wstring header_value = net::GetSpecificHeader(google_headers, tests[i].header_name); std::wstring result = @@ -216,7 +216,7 @@ TEST(NetUtilTest, GetHeaderParamValue) { EXPECT_EQ(result, tests[i].expected); } - for (size_t i = 0; i < arraysize(tests); ++i) { + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { std::wstring header_value = net::GetSpecificHeader(L"", tests[i].header_name); std::wstring result = @@ -293,7 +293,7 @@ TEST(NetUtilTest, GetFileNameFromCD) { {"Content-Disposition: attachment; filename==?windows-1252?Q?caf=E3?=" "=?iso-8859-7?b?4eIucG5nCg==?=", L""}, }; - for (size_t i = 0; i < arraysize(tests); ++i) { + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { EXPECT_EQ(tests[i].expected, net::GetFileNameFromCD(tests[i].header_field)); } @@ -570,7 +570,7 @@ TEST(NetUtilTest, IDNToUnicode) { #endif }; - for (int i = 0; i < arraysize(idn_cases); i++) { + for (int i = 0; i < ARRAYSIZE_UNSAFE(idn_cases); i++) { for (int j = 0; j < arraysize(kLanguages); j++) { std::wstring output; net::IDNToUnicode(idn_cases[i].input, @@ -682,7 +682,7 @@ TEST(NetUtilTest, GetSuggestedFilename) { L"", L"test.html"}, }; - for (int i = 0; i < arraysize(test_cases); ++i) { + for (int i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { std::wstring filename = net::GetSuggestedFilename( GURL(test_cases[i].url), test_cases[i].content_disp_header, test_cases[i].default_filename); diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index f629243..dad0d85 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -31,6 +31,7 @@ #include <algorithm> +#include "base/compiler_specific.h" #include "base/message_loop.h" #include "base/pickle.h" #include "base/ref_counted.h" @@ -45,8 +46,6 @@ #include "net/http/http_transaction.h" #include "net/http/http_util.h" -#pragma warning(disable: 4355) - namespace net { // disk cache entry data indices. @@ -196,9 +195,12 @@ class HttpCache::Transaction : public HttpTransaction, read_offset_(0), effective_load_flags_(0), final_upload_progress_(0), - network_info_callback_(this, &Transaction::OnNetworkInfoAvailable), - network_read_callback_(this, &Transaction::OnNetworkReadCompleted), - cache_read_callback_(this, &Transaction::OnCacheReadCompleted) { + ALLOW_THIS_IN_INITIALIZER_LIST( + network_info_callback_(this, &Transaction::OnNetworkInfoAvailable)), + ALLOW_THIS_IN_INITIALIZER_LIST( + network_read_callback_(this, &Transaction::OnNetworkReadCompleted)), + ALLOW_THIS_IN_INITIALIZER_LIST( + cache_read_callback_(this, &Transaction::OnCacheReadCompleted)) { AddRef(); // Balanced in Destroy } |