diff options
author | craig.schlenter@chromium.org <craig.schlenter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-12 18:39:59 +0000 |
---|---|---|
committer | craig.schlenter@chromium.org <craig.schlenter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-12 18:39:59 +0000 |
commit | 002c9bbb960f20bbb088fc716e3438d673750729 (patch) | |
tree | 69f3d6bca72f014d0c9feb72feef35d2c45439e1 /chrome/browser/safe_browsing/safe_browsing_util.h | |
parent | 17d3c2d593b73244f1fea106e6f4287dd798c017 (diff) | |
download | chromium_src-002c9bbb960f20bbb088fc716e3438d673750729.zip chromium_src-002c9bbb960f20bbb088fc716e3438d673750729.tar.gz chromium_src-002c9bbb960f20bbb088fc716e3438d673750729.tar.bz2 |
Fix some strict aliasing errors from r31773 caught with gcc 4.4.
I've chosen to use a union here instead of restoring the original memcpy code.
Errors were as follows:
cc1plus: warnings being treated as errors
chrome/browser/safe_browsing/safe_browsing_database_bloom.cc: In member function ‘virtual bool SafeBrowsingDatabaseBloom::ContainsUrl(const GURL&, std::string*, std::vector<int, std::allocator<int> >*, std::vector<SBFullHashResult, std::allocator<SBFullHashResult> >*, base::Time)’:
chrome/browser/safe_browsing/safe_browsing_database_bloom.cc:274: error: dereferencing pointer ‘full_hash.207’ does break strict-aliasing rules
chrome/browser/safe_browsing/safe_browsing_database_bloom.cc:274: note: initialized from here
chrome/browser/safe_browsing/safe_browsing_database_bloom.cc: In member function ‘void SafeBrowsingDatabaseBloom::InsertSub(int, SBPrefix, SBEntry*)’:
chrome/browser/safe_browsing/safe_browsing_database_bloom.cc:478: error: dereferencing pointer ‘full_hash.258’ does break strict-aliasing rules
chrome/browser/safe_browsing/safe_browsing_database_bloom.cc:478: note: initialized from here
chrome/browser/safe_browsing/safe_browsing_database_bloom.cc: In member function ‘void SafeBrowsingDatabaseBloom::InsertAdd(SBPrefix, SBEntry*)’:
chrome/browser/safe_browsing/safe_browsing_database_bloom.cc:402: error: dereferencing pointer ‘full_hash.237’ does break strict-aliasing rules
chrome/browser/safe_browsing/safe_browsing_database_bloom.cc:402: note: initialized from here
make: *** [out/Release/obj.target/browser/chrome/browser/safe_browsing/safe_browsing_database_bloom.o] Error 1
Review URL: http://codereview.chromium.org/389021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31798 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing/safe_browsing_util.h')
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_util.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.h b/chrome/browser/safe_browsing/safe_browsing_util.h index a184ca6..8c2d60b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_util.h +++ b/chrome/browser/safe_browsing/safe_browsing_util.h @@ -41,8 +41,9 @@ typedef struct { typedef int SBPrefix; // A full hash. -typedef struct { +typedef union { char full_hash[32]; + SBPrefix prefix; } SBFullHash; inline bool operator==(const SBFullHash& rhash, const SBFullHash& lhash) { |