diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-17 17:45:02 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-17 17:45:02 +0000 |
commit | d3ad8b706aff05ae06dd3dfc8bac850f0d364718 (patch) | |
tree | db04a23ffba7b4c218d2a634292f5d3f2957256c /chrome/browser/safe_browsing | |
parent | ac8db27fb680fa0a11a99f7dd20176c5c4ce43c8 (diff) | |
download | chromium_src-d3ad8b706aff05ae06dd3dfc8bac850f0d364718.zip chromium_src-d3ad8b706aff05ae06dd3dfc8bac850f0d364718.tar.gz chromium_src-d3ad8b706aff05ae06dd3dfc8bac850f0d364718.tar.bz2 |
Include chrome/browser/SConscript in Linux build.
In dns_host_info.cc there was probably a bug (hardcoded 1
instead of length.
BUG=2333
R=mark,sgk
Original patch by phajdan.jr@gmail.com at:
http://codereview.chromium.org/2890
Review URL: http://codereview.chromium.org/3108
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2317 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r-- | chrome/browser/safe_browsing/bloom_filter.cc | 5 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/chunk_range.cc | 3 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/protocol_parser.cc | 12 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_util.cc | 9 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_util.h | 2 |
5 files changed, 22 insertions, 9 deletions
diff --git a/chrome/browser/safe_browsing/bloom_filter.cc b/chrome/browser/safe_browsing/bloom_filter.cc index 5b9f8dbe..c87da9e 100644 --- a/chrome/browser/safe_browsing/bloom_filter.cc +++ b/chrome/browser/safe_browsing/bloom_filter.cc @@ -4,14 +4,13 @@ #include "chrome/browser/safe_browsing/bloom_filter.h" -#include <windows.h> - +#include <string.h> BloomFilter::BloomFilter(int bit_size) { byte_size_ = bit_size / 8 + 1; bit_size_ = byte_size_ * 8; data_.reset(new char[byte_size_]); - ZeroMemory(data_.get(), byte_size_); + memset(data_.get(), 0, byte_size_); } BloomFilter::BloomFilter(char* data, int size) { diff --git a/chrome/browser/safe_browsing/chunk_range.cc b/chrome/browser/safe_browsing/chunk_range.cc index ff99924..e40ee72 100644 --- a/chrome/browser/safe_browsing/chunk_range.cc +++ b/chrome/browser/safe_browsing/chunk_range.cc @@ -61,8 +61,7 @@ void RangesToString(const std::vector<ChunkRange>& ranges, if (!result->empty()) result->append(","); if (it->start() == it->stop()) { - char num_buf[11]; // One 32 bit positive integer + NULL. - _itoa_s(it->start(), num_buf, sizeof(num_buf), 10); + std::string num_buf = IntToString(it->start()); result->append(num_buf); } else { result->append(StringPrintf("%d-%d", it->start(), it->stop())); diff --git a/chrome/browser/safe_browsing/protocol_parser.cc b/chrome/browser/safe_browsing/protocol_parser.cc index 3c6e17c..b3a460b 100644 --- a/chrome/browser/safe_browsing/protocol_parser.cc +++ b/chrome/browser/safe_browsing/protocol_parser.cc @@ -4,7 +4,13 @@ // // Parse the data returned from the SafeBrowsing v2.1 protocol response. -#include <Winsock2.h> // for htonl +#include "build/build_config.h" + +#if defined(OS_WIN) +#include <Winsock2.h> +#elif defined(OS_POSIX) +#include <arpa/inet.h> +#endif #include "chrome/browser/safe_browsing/protocol_parser.h" @@ -85,7 +91,7 @@ bool SafeBrowsingProtocolParser::ParseGetHash( int full_hash_len = atoi(cmd_parts[2].c_str()); while (full_hash_len > 0) { - DCHECK(full_hash_len >= sizeof(SBFullHash)); + DCHECK(static_cast<size_t>(full_hash_len) >= sizeof(SBFullHash)); memcpy(&full_hash.hash, data, sizeof(SBFullHash)); full_hashes->push_back(full_hash); data += sizeof(SBFullHash); @@ -449,7 +455,7 @@ bool SafeBrowsingProtocolParser::ParseNewKey(const char* chunk_data, if (cmd_parts.size() != 3) return false; - if (cmd_parts[2].size() != atoi(cmd_parts[1].c_str())) + if (static_cast<int>(cmd_parts[2].size()) != atoi(cmd_parts[1].c_str())) return false; if (cmd_parts[0] == "clientkey") { diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc index 8037154..0096263 100644 --- a/chrome/browser/safe_browsing/safe_browsing_util.cc +++ b/chrome/browser/safe_browsing/safe_browsing_util.cc @@ -137,6 +137,11 @@ static void DecodeWebSafe(std::string* decoded) { bool VerifyMAC(const std::string& key, const std::string& mac, const char* data, int data_length) { +#if !defined(OS_WIN) + // TODO(port): Remove #defines when linking issue with modp_b64 is resolved. + NOTIMPLEMENTED(); + return false; +#endif std::string key_copy = key; DecodeWebSafe(&key_copy); std::string decoded_key; @@ -168,6 +173,8 @@ void FreeChunks(std::deque<SBChunk>* chunks) { } } +#if defined(OS_WIN) +// TODO(port): remove conditional #ifs when google_util is ported GURL GeneratePhishingReportUrl(const std::string& report_page, const std::string& url_to_report) { Locale locale = Locale::getDefault(); @@ -183,6 +190,7 @@ GURL GeneratePhishingReportUrl(const std::string& report_page, current_esc.c_str())); return google_util::AppendGoogleLocaleParam(report_url); } +#endif } // namespace safe_browsing_util @@ -476,7 +484,6 @@ void SBHostInfo::RemoveSubEntry(int list_id, int chunk_id) { data.reset(new char[entry->Size()]); new_sub_entry = reinterpret_cast<SBEntry*>(data.get()); memcpy(new_sub_entry, entry, entry->Size()); - int new_prefix_count = 0; // Remove any matching prefixes. for (int i = 0; i < new_sub_entry->prefix_count(); ++i) { if (new_sub_entry->ChunkIdAtPrefix(i) == chunk_id) diff --git a/chrome/browser/safe_browsing/safe_browsing_util.h b/chrome/browser/safe_browsing/safe_browsing_util.h index 1fe7102..f43d85b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_util.h +++ b/chrome/browser/safe_browsing/safe_browsing_util.h @@ -7,6 +7,8 @@ #ifndef CHROME_BROWSER_SAFE_BROWSING_UTIL_H__ #define CHROME_BROWSER_SAFE_BROWSING_UTIL_H__ +#include <string.h> + #include <deque> #include <string> #include <vector> |