зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1126720: Use |int32_t| for |Channel| in Bluetooth Socket HAL (under bluetooth2/), r=btian
This patch is based on bug 1129257
.
This commit is contained in:
Родитель
db3ff31476
Коммит
54771250c1
|
@ -342,6 +342,18 @@ Convert(uint8_t aIn, BluetoothHandsfreeVolumeType& aOut)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Convert(int aIn, int32_t& aOut)
|
||||
{
|
||||
if (NS_WARN_IF(aIn < std::numeric_limits<int32_t>::min()) ||
|
||||
NS_WARN_IF(aIn > std::numeric_limits<int32_t>::max())) {
|
||||
aOut = 0; // silences compiler warning
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
aOut = static_cast<int32_t>(aIn);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Convert(int32_t aIn, BluetoothTypeOfDevice& aOut)
|
||||
{
|
||||
|
|
|
@ -128,6 +128,9 @@ Convert(int aIn, uint8_t& aOut);
|
|||
nsresult
|
||||
Convert(int aIn, int16_t& aOut);
|
||||
|
||||
nsresult
|
||||
Convert(int aIn, int32_t& aOut);
|
||||
|
||||
nsresult
|
||||
Convert(uint8_t aIn, bool& aOut);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType,
|
|||
aType,
|
||||
PackConversion<nsAString, BluetoothServiceName>(aServiceName),
|
||||
PackArray<uint8_t>(aServiceUuid, 16),
|
||||
PackConversion<int, uint16_t>(aChannel),
|
||||
PackConversion<int, int32_t>(aChannel),
|
||||
SocketFlags(aEncrypt, aAuth), *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
|
@ -65,7 +65,7 @@ BluetoothDaemonSocketModule::ConnectCmd(const nsAString& aBdAddr,
|
|||
PackConversion<nsAString, BluetoothAddress>(aBdAddr),
|
||||
aType,
|
||||
PackArray<uint8_t>(aUuid, 16),
|
||||
PackConversion<int, int16_t>(aChannel),
|
||||
PackConversion<int, int32_t>(aChannel),
|
||||
SocketFlags(aEncrypt, aAuth), *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
|
|
Загрузка…
Ссылка в новой задаче