Bug 819791 - Part 7: Use explicit TArray copy constructors in Bluetooth code. r=qdot

This commit is contained in:
Justin Lebar 2012-12-18 20:16:06 -05:00
parent 78bc0372cf
commit 336e8ead35
4 changed files with 7 additions and 8 deletions

View File

@ -181,7 +181,7 @@ BluetoothDevice::Notify(const BluetoothSignal& aData)
if (aData.name().EqualsLiteral("PropertyChanged")) {
NS_ASSERTION(aData.value().type() == BluetoothValue::TArrayOfBluetoothNamedValue,
"PropertyChanged: Invalid value type");
InfallibleTArray<BluetoothNamedValue> arr = aData.value().get_ArrayOfBluetoothNamedValue();
InfallibleTArray<BluetoothNamedValue> arr(aData.value().get_ArrayOfBluetoothNamedValue());
NS_ASSERTION(arr.Length() == 1, "Got more than one property in a change message!");
BluetoothNamedValue v = arr[0];

View File

@ -703,7 +703,7 @@ BluetoothService::Observe(nsISupports* aSubject, const char* aTopic,
void
BluetoothService::Notify(const BluetoothSignal& aData)
{
InfallibleTArray<BluetoothNamedValue> arr = aData.value().get_ArrayOfBluetoothNamedValue();
InfallibleTArray<BluetoothNamedValue> arr(aData.value().get_ArrayOfBluetoothNamedValue());
nsString type;
JSContext* cx = nsContentUtils::GetSafeJSContext();

View File

@ -393,9 +393,8 @@ BluetoothRequestParent::DoRequest(const DevicePropertiesRequest& aRequest)
MOZ_ASSERT(mService);
MOZ_ASSERT(mRequestType == Request::TDevicePropertiesRequest);
// Have to copy because our array types don't match up
nsresult rv =
mService->GetPairedDevicePropertiesInternal(nsTArray<nsString>(aRequest.addresses()),
mService->GetPairedDevicePropertiesInternal(aRequest.addresses(),
mReplyRunnable.get());
NS_ENSURE_SUCCESS(rv, false);

View File

@ -1720,7 +1720,7 @@ public:
BluetoothValue v = mSignal.value();
if (v.type() == BluetoothValue::TArrayOfBluetoothNamedValue &&
v.get_ArrayOfBluetoothNamedValue().Length() ) {
InfallibleTArray<BluetoothNamedValue> arr = v.get_ArrayOfBluetoothNamedValue();
const InfallibleTArray<BluetoothNamedValue>& arr = v.get_ArrayOfBluetoothNamedValue();
NS_ASSERTION(arr[0].value().type() == BluetoothValue::TnsString, "failed to get_nsString");
devicePath = arr[0].value().get_nsString();
}
@ -1737,11 +1737,11 @@ public:
NS_WARNING("Getting properties failed!");
return NS_ERROR_FAILURE;
}
InfallibleTArray<BluetoothNamedValue> properties = prop.get_ArrayOfBluetoothNamedValue();
InfallibleTArray<BluetoothNamedValue> properties(prop.get_ArrayOfBluetoothNamedValue());
if (v.type() == BluetoothValue::TArrayOfBluetoothNamedValue) {
// Return original dbus message parameters and also device name
// for agent events "RequestConfirmation", "RequestPinCode", and "RequestPasskey"
InfallibleTArray<BluetoothNamedValue> parameters = v.get_ArrayOfBluetoothNamedValue();
InfallibleTArray<BluetoothNamedValue> parameters(v.get_ArrayOfBluetoothNamedValue());
// For consistency, append path
nsString path = parameters[0].value();
@ -1804,7 +1804,7 @@ public:
BluetoothValue values = InfallibleTArray<BluetoothNamedValue>();
for (int i = 0; i < mDeviceAddresses.Length(); i++) {
for (uint32_t i = 0; i < mDeviceAddresses.Length(); i++) {
BluetoothValue v;
if (!GetPropertiesInternal(mDeviceAddresses[i], DBUS_DEVICE_IFACE, v)) {
nsAutoString errorStr;