Bug 788254 - [b2g-bluetooth] nsTArray should not be passed back as return value, r=qdot

This commit is contained in:
Eric Chou 2012-09-07 15:56:12 +08:00
parent a44420eb13
commit b6c0097ba3
3 changed files with 13 additions and 12 deletions

View File

@ -230,9 +230,10 @@ public:
const nsAString& aDeviceAddress,
nsAString& aDevicePath) = 0;
virtual nsTArray<uint32_t>
virtual bool
AddReservedServicesInternal(const nsAString& aAdapterPath,
const nsTArray<uint32_t>& aServices) = 0;
const nsTArray<uint32_t>& aServices,
nsTArray<uint32_t>& aServiceHandlesContainer) = 0;
virtual bool
RemoveReservedServicesInternal(const nsAString& aAdapterPath,

View File

@ -1474,16 +1474,15 @@ ExtractHandles(DBusMessage *aReply, nsTArray<uint32_t>& aOutHandles)
}
}
nsTArray<uint32_t>
bool
BluetoothDBusService::AddReservedServicesInternal(const nsAString& aAdapterPath,
const nsTArray<uint32_t>& aServices)
const nsTArray<uint32_t>& aServices,
nsTArray<uint32_t>& aServiceHandlesContainer)
{
MOZ_ASSERT(!NS_IsMainThread());
nsTArray<uint32_t> ret;
int length = aServices.Length();
if (length == 0) return ret;
if (length == 0) return false;
const uint32_t* services = aServices.Elements();
DBusMessage* reply =
@ -1495,11 +1494,11 @@ BluetoothDBusService::AddReservedServicesInternal(const nsAString& aAdapterPath,
if (!reply) {
LOG("Null DBus message. Couldn't extract handles.");
return ret;
return false;
}
ExtractHandles(reply, ret);
return ret;
ExtractHandles(reply, aServiceHandlesContainer);
return true;
}
bool

View File

@ -47,9 +47,10 @@ public:
const nsAString& aDeviceAddress,
nsAString& aDevicePath);
virtual nsTArray<uint32_t>
virtual bool
AddReservedServicesInternal(const nsAString& aAdapterPath,
const nsTArray<uint32_t>& aServices);
const nsTArray<uint32_t>& aServices,
nsTArray<uint32_t>& aServiceHandlesContainer);
virtual bool
RemoveReservedServicesInternal(const nsAString& aAdapterPath,