mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1181479: Refine StringToUuid; r=jocelyn
This commit is contained in:
parent
82a0a1c6a7
commit
15bb1771f3
@ -634,7 +634,7 @@ BluetoothGattManager::StartLeScan(const nsTArray<nsString>& aServiceUuids,
|
||||
client->mStartLeScanRunnable = aRunnable;
|
||||
|
||||
BluetoothUuid appUuid;
|
||||
StringToUuid(NS_ConvertUTF16toUTF8(appUuidStr).get(), appUuid);
|
||||
StringToUuid(appUuidStr, appUuid);
|
||||
|
||||
// 'startLeScan' will be proceeded after client registered
|
||||
sBluetoothGattInterface->RegisterClient(
|
||||
@ -726,7 +726,7 @@ BluetoothGattManager::Connect(const nsAString& aAppUuid,
|
||||
new ConnectResultHandler(client));
|
||||
} else {
|
||||
BluetoothUuid uuid;
|
||||
StringToUuid(NS_ConvertUTF16toUTF8(aAppUuid).get(), uuid);
|
||||
StringToUuid(aAppUuid, uuid);
|
||||
|
||||
// connect will be proceeded after client registered
|
||||
sBluetoothGattInterface->RegisterClient(
|
||||
@ -1507,7 +1507,7 @@ BluetoothGattManager::ConnectPeripheral(
|
||||
new ConnectPeripheralResultHandler(server, aAddress));
|
||||
} else {
|
||||
BluetoothUuid uuid;
|
||||
StringToUuid(NS_ConvertUTF16toUTF8(aAppUuid).get(), uuid);
|
||||
StringToUuid(aAppUuid, uuid);
|
||||
|
||||
// connect will be proceeded after server registered
|
||||
sBluetoothGattInterface->RegisterServer(
|
||||
|
@ -43,12 +43,13 @@ UuidToString(const BluetoothUuid& aUuid, nsAString& aString)
|
||||
}
|
||||
|
||||
void
|
||||
StringToUuid(const char* aString, BluetoothUuid& aUuid)
|
||||
StringToUuid(const nsAString& aString, BluetoothUuid& aUuid)
|
||||
{
|
||||
uint32_t uuid0, uuid4;
|
||||
uint16_t uuid1, uuid2, uuid3, uuid5;
|
||||
|
||||
sscanf(aString, "%08x-%04hx-%04hx-%04hx-%08x%04hx",
|
||||
sscanf(NS_ConvertUTF16toUTF8(aString).get(),
|
||||
"%08x-%04hx-%04hx-%04hx-%08x%04hx",
|
||||
&uuid0, &uuid1, &uuid2, &uuid3, &uuid4, &uuid5);
|
||||
|
||||
uuid0 = htonl(uuid0);
|
||||
@ -66,12 +67,6 @@ StringToUuid(const char* aString, BluetoothUuid& aUuid)
|
||||
memcpy(&aUuid.mUuid[14], &uuid5, sizeof(uint16_t));
|
||||
}
|
||||
|
||||
void
|
||||
StringToUuid(const nsAString& aString, BluetoothUuid& aUuid)
|
||||
{
|
||||
StringToUuid(NS_ConvertUTF16toUTF8(aString).get(), aUuid);
|
||||
}
|
||||
|
||||
void
|
||||
GenerateUuid(nsAString &aUuidString)
|
||||
{
|
||||
|
@ -36,15 +36,6 @@ UuidToString(const BluetoothUuid& aUuid, nsAString& aString);
|
||||
* string created by gecko back to BluetoothUuid representation.
|
||||
*/
|
||||
void
|
||||
StringToUuid(const char* aString, BluetoothUuid& aUuid);
|
||||
|
||||
/**
|
||||
* Convert xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx uuid string to BluetoothUuid object.
|
||||
*
|
||||
* This utility function is used by gecko internal only to convert uuid string
|
||||
* created by gecko back to BluetoothUuid representation.
|
||||
*/
|
||||
void
|
||||
StringToUuid(const nsAString& aString, BluetoothUuid& aUuid);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user