Skip to content

Commit

Permalink
Bug 1055655 - Fix warnings turned to errors by bug 1018288 found by m…
Browse files Browse the repository at this point in the history
…ingw build. r=ted,jmathies

--HG--
extra : rebase_source : 2e1d8d0ae697515994b718634f8f8ae9b26b8d80
  • Loading branch information
cjacek committed Sep 2, 2014
1 parent 9f938c2 commit cd7ba96
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
1 change: 0 additions & 1 deletion gfx/layers/d3d9/CompositorD3D9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,6 @@ CompositorD3D9::SetMask(const EffectChain &aEffectChain, uint32_t aMaskTexture)

TextureSourceD3D9 *source = maskEffect->mMaskTexture->AsSourceD3D9();

MOZ_ASSERT(aMaskTexture >= 0);
device()->SetTexture(aMaskTexture, source->GetD3D9Texture());

const gfx::Matrix4x4& maskTransform = maskEffect->mMaskTransform;
Expand Down
19 changes: 10 additions & 9 deletions hal/windows/WindowsGamepad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const uint32_t kDevicesChangedStableDelay = 200;
// poll it periodically. 50ms is arbitrarily chosen.
const uint32_t kXInputPollInterval = 50;

const UINT kRawInputError = (UINT)-1;

#ifndef XUSER_MAX_COUNT
#define XUSER_MAX_COUNT 4
#endif
Expand Down Expand Up @@ -178,7 +180,7 @@ bool
GetPreparsedData(HANDLE handle, nsTArray<uint8_t>& data)
{
UINT size;
if (GetRawInputDeviceInfo(handle, RIDI_PREPARSEDDATA, nullptr, &size) < 0) {
if (GetRawInputDeviceInfo(handle, RIDI_PREPARSEDDATA, nullptr, &size) == kRawInputError) {
return false;
}
data.SetLength(size);
Expand Down Expand Up @@ -418,13 +420,13 @@ WindowsGamepadService::ScanForRawInputDevices()

UINT numDevices;
if (GetRawInputDeviceList(nullptr, &numDevices, sizeof(RAWINPUTDEVICELIST))
== -1) {
== kRawInputError) {
return;
}
nsTArray<RAWINPUTDEVICELIST> devices(numDevices);
devices.SetLength(numDevices);
if (GetRawInputDeviceList(devices.Elements(), &numDevices,
sizeof(RAWINPUTDEVICELIST)) == -1) {
sizeof(RAWINPUTDEVICELIST)) == kRawInputError) {
return;
}

Expand Down Expand Up @@ -631,7 +633,7 @@ WindowsGamepadService::GetRawGamepad(HANDLE handle)

RID_DEVICE_INFO rdi = {};
UINT size = rdi.cbSize = sizeof(RID_DEVICE_INFO);
if (GetRawInputDeviceInfo(handle, RIDI_DEVICEINFO, &rdi, &size) < 0) {
if (GetRawInputDeviceInfo(handle, RIDI_DEVICEINFO, &rdi, &size) == kRawInputError) {
return false;
}
// Ensure that this is a device we care about
Expand All @@ -642,14 +644,13 @@ WindowsGamepadService::GetRawGamepad(HANDLE handle)
Gamepad gamepad = {};

// Device name is a mostly-opaque string.
if (GetRawInputDeviceInfo(handle, RIDI_DEVICENAME, nullptr, &size) < 0) {
if (GetRawInputDeviceInfo(handle, RIDI_DEVICENAME, nullptr, &size) == kRawInputError) {
return false;
}

nsTArray<wchar_t> devname(size);
devname.SetLength(size);
if (GetRawInputDeviceInfo(handle, RIDI_DEVICENAME, devname.Elements(), &size)
<= 0) {
if (GetRawInputDeviceInfo(handle, RIDI_DEVICENAME, devname.Elements(), &size) == kRawInputError) {
return false;
}

Expand All @@ -667,7 +668,7 @@ WindowsGamepadService::GetRawGamepad(HANDLE handle)
size = sizeof(name);
nsTArray<char> gamepad_name;
HANDLE hid_handle = CreateFile(devname.Elements(), GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, NULL, NULL);
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hid_handle) {
if (mHID.mHidD_GetProductString(hid_handle, &name, size)) {
int bytes = WideCharToMultiByte(CP_UTF8, 0, name, -1, nullptr, 0, nullptr,
Expand Down Expand Up @@ -786,7 +787,7 @@ WindowsGamepadService::HandleRawInput(HRAWINPUT handle)
nsTArray<uint8_t> data(size);
data.SetLength(size);
if (GetRawInputData(handle, RID_INPUT, data.Elements(), &size,
sizeof(RAWINPUTHEADER)) < 0) {
sizeof(RAWINPUTHEADER)) == kRawInputError) {
return false;
}
PRAWINPUT raw = reinterpret_cast<PRAWINPUT>(data.Elements());
Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/base/waitable_event_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ size_t WaitableEvent::WaitMany(WaitableEvent** events, size_t count) {
WaitForMultipleObjects(count, handles,
FALSE, // don't wait for all the objects
INFINITE); // no timeout
if (result < WAIT_OBJECT_0 || result >= WAIT_OBJECT_0 + count) {
if (result >= WAIT_OBJECT_0 + count) {
NOTREACHED() << "WaitForMultipleObjects failed: " << GetLastError();
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions widget/windows/KeyboardLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ UniCharsAndModifiers
VirtualKey::GetNativeUniChars(ShiftState aShiftState) const
{
#ifdef DEBUG
if (aShiftState < 0 || aShiftState >= ArrayLength(mShiftStates)) {
if (aShiftState >= ArrayLength(mShiftStates)) {
nsPrintfCString warning("Shift state is out of range: "
"aShiftState=%d, ArrayLength(mShiftState)=%d",
aShiftState, ArrayLength(mShiftStates));
Expand Down Expand Up @@ -2259,8 +2259,8 @@ KeyboardLayout::LoadLayout(HKL aLayout)
static const UINT kMapType =
IsVistaOrLater() ? MAPVK_VSC_TO_VK_EX : MAPVK_VSC_TO_VK;
PR_LOG(sKeyboardLayoutLogger, PR_LOG_DEBUG,
("Logging virtual keycode values for scancode (0x%08X)...",
reinterpret_cast<const uint32_t>(mKeyboardLayout)));
("Logging virtual keycode values for scancode (0x%p)...",
mKeyboardLayout));
for (uint32_t i = 0; i < ArrayLength(kExtendedScanCode); i++) {
for (uint32_t j = 1; j <= 0xFF; j++) {
UINT scanCode = kExtendedScanCode[i] + j;
Expand Down
2 changes: 1 addition & 1 deletion widget/windows/WindowHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ WindowHook::DeleteIfEmpty(MessageData *data) {

MessageDataArray::index_type idx;
idx = data - mMessageData.Elements();
NS_ASSERTION(idx >= 0 && idx < mMessageData.Length(), "Attempted to delete MessageData that doesn't belong to this array!");
NS_ASSERTION(idx < mMessageData.Length(), "Attempted to delete MessageData that doesn't belong to this array!");
mMessageData.RemoveElementAt(idx);
}

Expand Down
2 changes: 1 addition & 1 deletion widget/windows/nsDragService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ nsDragService::GetData(nsITransferable * aTransferable, uint32_t anItem)
// multiple items, use |anItem| as an index into our collection
nsDataObjCollection * dataObjCol = GetDataObjCollection(mDataObject);
uint32_t cnt = dataObjCol->GetNumDataObjects();
if (anItem >= 0 && anItem < cnt) {
if (anItem < cnt) {
IDataObject * dataObj = dataObjCol->GetDataObjectAt(anItem);
dataFound = nsClipboard::GetDataFromDataObject(dataObj, 0, nullptr,
aTransferable);
Expand Down

0 comments on commit cd7ba96

Please sign in to comment.