diff options
author | twiz@google.com <twiz@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 16:43:53 +0000 |
---|---|---|
committer | twiz@google.com <twiz@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 16:43:53 +0000 |
commit | 7856f82d98587907c2005ecc245b57a3c58c56c7 (patch) | |
tree | 1edc614ee1b11d7bb4b1f1143697de1e20e3f0d8 /chrome_frame | |
parent | 5b96f3777bb119aa09ec4e531c8e9ac127103668 (diff) | |
download | chromium_src-7856f82d98587907c2005ecc245b57a3c58c56c7.zip chromium_src-7856f82d98587907c2005ecc245b57a3c58c56c7.tar.gz chromium_src-7856f82d98587907c2005ecc245b57a3c58c56c7.tar.bz2 |
Correction of union that was assuming big-endian behaviour when writing integers to memory. Since Chrome-Frame runs on Intelx86 architecture, this assumption was incorrect. To prevent future endian problems, I changed the routine to explicitly extract the minor and major version.
This versioning error was prevent access to the NPVERS_HAS_URL_AND_AUTH_INFO set of APIS, as the returned version was always zero.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3396028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60800 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/np_browser_functions.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/chrome_frame/np_browser_functions.cc b/chrome_frame/np_browser_functions.cc index 597fde3..2646d24 100644 --- a/chrome_frame/np_browser_functions.cc +++ b/chrome_frame/np_browser_functions.cc @@ -9,12 +9,20 @@ namespace npapi { // global function pointers (within this namespace) for the NPN functions. -union NpVersion { +struct NpVersion { struct { - uint8 major; uint8 minor; + uint8 major; } v; - uint16 version; + + void set_version(uint16 version) { + v.minor = version & 0xFF; + v.major = version >> 8; + } + + uint16 version() const { + return v.minor | (v.major << 8); + } }; NpVersion g_version = {0}; @@ -73,7 +81,7 @@ void InitializeBrowserFunctions(NPNetscapeFuncs* functions) { CHECK(functions); DCHECK(g_geturl == NULL || g_geturl == functions->geturl); - g_version.version = functions->version; + g_version.set_version(functions->version); g_geturl = functions->geturl; g_posturl = functions->posturl; @@ -129,7 +137,7 @@ void InitializeBrowserFunctions(NPNetscapeFuncs* functions) { } void UninitializeBrowserFunctions() { - g_version.version = 0; + g_version.set_version(0); // We skip doing this in the official build as it doesn't serve much purpose // during shutdown. The reason for it being here in the other types of builds |