Bug 1055655 - Fix warnings turned to errors by bug 1018288 found by mingw build. r=ted,jmathies

--HG--
extra : rebase_source : 2e1d8d0ae697515994b718634f8f8ae9b26b8d80
This commit is contained in:
Jacek Caban 2014-09-02 11:07:25 +02:00
parent 64b4ec3de7
commit e8562197ec
6 changed files with 16 additions and 16 deletions

View File

@ -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;

View File

@ -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
@ -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);
@ -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;
}
@ -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
@ -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;
}
@ -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,
@ -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());

View File

@ -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;
}

View File

@ -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));
@ -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;

View File

@ -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);
}

View File

@ -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);