Merge pull request #7503 from MerryMage/signed_comparison

BTReal: Correct comparison of integers of different signs
This commit is contained in:
Tilka 2018-10-15 19:36:45 +01:00 committed by GitHub
commit cb576bf382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -363,7 +363,7 @@ void BluetoothReal::WaitForHCICommandComplete(const u16 opcode)
{ {
const int ret = libusb_interrupt_transfer(m_handle, HCI_EVENT, buffer.data(), const int ret = libusb_interrupt_transfer(m_handle, HCI_EVENT, buffer.data(),
static_cast<int>(buffer.size()), &actual_length, 20); static_cast<int>(buffer.size()), &actual_length, 20);
if (ret != 0 || actual_length < sizeof(packet)) if (ret != 0 || actual_length < static_cast<int>(sizeof(packet)))
continue; continue;
std::memcpy(&packet, buffer.data(), sizeof(packet)); std::memcpy(&packet, buffer.data(), sizeof(packet));
if (packet.EventType == HCI_EVENT_COMMAND_COMPL && packet.Opcode == opcode) if (packet.EventType == HCI_EVENT_COMMAND_COMPL && packet.Opcode == opcode)