Commit 418c4abf authored by thakis@chromium.org's avatar thakis@chromium.org

Fix a warning in 64bit c++11 mode.

The (harmless) warning was:

../../webkit/plugins/ppapi/message_channel.cc:286:69: error: comparison of constant 2305843009213693951 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
      if (std::numeric_limits<size_t>::max() / sizeof(NPIdentifier) <=
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1 error generated.

It's always false in 64bit mode, but it's arguably useful in 32bit mode.

BUG=233330

Review URL: https://codereview.chromium.org/14246019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195026 0039d316-1c4b-4281-b951-d872f2087c98
parent 5faefe08
......@@ -284,7 +284,7 @@ bool MessageChannelEnumerate(NPObject *np_obj, NPIdentifier **value,
if (success) {
// Add postMessage to the list and return it.
if (std::numeric_limits<size_t>::max() / sizeof(NPIdentifier) <=
(*count + 1))
static_cast<size_t>(*count) + 1) // Else, "always false" x64 warning.
return false;
NPIdentifier* new_array = static_cast<NPIdentifier*>(
std::malloc(sizeof(NPIdentifier) * (*count + 1)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment