Commit dabefe46 authored by pkasting's avatar pkasting Committed by Commit bot

Type conversion fixes, content/ edition.

This is mostly to fix MSVC warnings about possible value truncation.

BUG=81439
TEST=none
TBR=cpu

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

Cr-Commit-Position: refs/heads/master@{#300159}
parent f5125a28
......@@ -193,8 +193,8 @@ void BlacklistAddOneDll(const wchar_t* module_name,
DCHECK_LE(3U, (name.size() - period));
if (period <= 8)
return;
for (int ix = 0; ix < 3; ++ix) {
const wchar_t suffix[] = {'~', ('1' + ix), 0};
for (wchar_t ix = '1'; ix <= '3'; ++ix) {
const wchar_t suffix[] = {'~', ix, 0};
std::wstring alt_name = name.substr(0, 6) + suffix;
alt_name += name.substr(period, name.size());
if (check_in_browser) {
......
......@@ -1174,10 +1174,10 @@ static bool invalidateRect(PluginObject* obj,
return false;
NPRect rect;
rect.left = static_cast<int>(NPVARIANT_TO_DOUBLE(args[0]));
rect.top = static_cast<int>(NPVARIANT_TO_DOUBLE(args[1]));
rect.right = static_cast<int>(NPVARIANT_TO_DOUBLE(args[2]));
rect.bottom = static_cast<int>(NPVARIANT_TO_DOUBLE(args[3]));
rect.left = static_cast<uint16_t>(NPVARIANT_TO_DOUBLE(args[0]));
rect.top = static_cast<uint16_t>(NPVARIANT_TO_DOUBLE(args[1]));
rect.right = static_cast<uint16_t>(NPVARIANT_TO_DOUBLE(args[2]));
rect.bottom = static_cast<uint16_t>(NPVARIANT_TO_DOUBLE(args[3]));
browser->invalidaterect(obj->npp, &rect);
return true;
......
......@@ -91,11 +91,10 @@ int32 PluginRequestReadTest::Write(NPStream* stream, int32 offset, int32 len,
if (it->length == 0)
requested_ranges_.erase(it);
// Verify that data, which we got, is right.
// Verify the data we got is right. We expect a string like "01234...".
const char* data = static_cast<const char*>(buffer);
for (int32 i = 0; i < len; ++i) {
int cur_offset = offset + i;
char expected = '0' + cur_offset;
char expected = '0' + static_cast<char>(offset + i);
if (data[i] != expected) {
SetError("Content mismatch between data and source!");
break;
......
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