зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1251541: Replace |nsAutoArrayPtr<>| with |UniquePtr<[]>| in Bluetooth managers, r=shuang
This commit is contained in:
Родитель
63ee16b1e1
Коммит
d8cb801b6f
|
@ -1444,7 +1444,7 @@ BluetoothMapSmsManager::HandleSmsMmsPushMessage(const ObexHeaderSet& aHeader)
|
|||
// Get Body
|
||||
uint8_t* bodyPtr = nullptr;
|
||||
aHeader.GetBody(&bodyPtr, &mBodySegmentLength);
|
||||
mBodySegment = bodyPtr;
|
||||
mBodySegment.reset(bodyPtr);
|
||||
|
||||
RefPtr<BluetoothMapBMessage> bmsg =
|
||||
new BluetoothMapBMessage(bodyPtr, mBodySegmentLength);
|
||||
|
|
|
@ -285,7 +285,7 @@ private:
|
|||
RefPtr<BluetoothSocket> mMnsSocket;
|
||||
|
||||
int mBodySegmentLength;
|
||||
nsAutoArrayPtr<uint8_t> mBodySegment;
|
||||
UniquePtr<uint8_t[]> mBodySegment;
|
||||
|
||||
/**
|
||||
* The bMessage/message-listing data stream for current processing response
|
||||
|
|
|
@ -803,7 +803,7 @@ BluetoothOppManager::ExtractPacketHeaders(const ObexHeaderSet& aHeader)
|
|||
aHeader.Has(ObexHeaderId::EndOfBody)) {
|
||||
uint8_t* bodyPtr;
|
||||
aHeader.GetBody(&bodyPtr, &mBodySegmentLength);
|
||||
mBodySegment = bodyPtr;
|
||||
mBodySegment.reset(bodyPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -934,7 +934,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketBuffer* aMessage)
|
|||
* so here we keep a variable mPutPacketReceivedLength to indicate if
|
||||
* current PUT request is done.
|
||||
*/
|
||||
mReceivedDataBuffer = new uint8_t[mPacketLength];
|
||||
mReceivedDataBuffer.reset(new uint8_t[mPacketLength]);
|
||||
mPutFinalFlag = (aOpCode == ObexRequestCode::PutFinal);
|
||||
}
|
||||
|
||||
|
|
|
@ -207,8 +207,8 @@ private:
|
|||
uint32_t mSentFileLength;
|
||||
bool mWaitingToSendPutFinal;
|
||||
|
||||
nsAutoArrayPtr<uint8_t> mBodySegment;
|
||||
nsAutoArrayPtr<uint8_t> mReceivedDataBuffer;
|
||||
UniquePtr<uint8_t[]> mBodySegment;
|
||||
UniquePtr<uint8_t[]> mReceivedDataBuffer;
|
||||
|
||||
int mCurrentBlobIndex;
|
||||
RefPtr<Blob> mBlob;
|
||||
|
|
|
@ -795,14 +795,14 @@ BluetoothPbapManager::ReplyToConnect(const nsAString& aPassword)
|
|||
// The request-digest is required and calculated as follows:
|
||||
// H(nonce ":" password)
|
||||
uint32_t hashStringLength = DIGEST_LENGTH + aPassword.Length() + 1;
|
||||
nsAutoArrayPtr<char> hashString(new char[hashStringLength]);
|
||||
UniquePtr<char[]> hashString(new char[hashStringLength]);
|
||||
|
||||
memcpy(hashString, mRemoteNonce, DIGEST_LENGTH);
|
||||
memcpy(hashString.get(), mRemoteNonce, DIGEST_LENGTH);
|
||||
hashString[DIGEST_LENGTH] = ':';
|
||||
memcpy(&hashString[DIGEST_LENGTH + 1],
|
||||
NS_ConvertUTF16toUTF8(aPassword).get(),
|
||||
aPassword.Length());
|
||||
MD5Hash(hashString, hashStringLength);
|
||||
MD5Hash(hashString.get(), hashStringLength);
|
||||
|
||||
// 2 tag-length-value triplets: <request-digest:16><nonce:16>
|
||||
uint8_t digestResponse[(DIGEST_LENGTH + 2) * 2];
|
||||
|
@ -1090,8 +1090,8 @@ BluetoothPbapManager::ReplyToGet(uint16_t aPhonebookSize)
|
|||
|
||||
// Read vCard data from input stream
|
||||
uint32_t numRead = 0;
|
||||
nsAutoArrayPtr<char> buf(new char[remainingPacketSize]);
|
||||
rv = mVCardDataStream->Read(buf, remainingPacketSize, &numRead);
|
||||
UniquePtr<char[]> buf(new char[remainingPacketSize]);
|
||||
rv = mVCardDataStream->Read(buf.get(), remainingPacketSize, &numRead);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_LOGR("Failed to read from input stream. rv=0x%x",
|
||||
static_cast<uint32_t>(rv));
|
||||
|
|
|
@ -721,7 +721,7 @@ BluetoothOppManager::ExtractPacketHeaders(const ObexHeaderSet& aHeader)
|
|||
aHeader.Has(ObexHeaderId::EndOfBody)) {
|
||||
uint8_t* bodyPtr;
|
||||
aHeader.GetBody(&bodyPtr, &mBodySegmentLength);
|
||||
mBodySegment = bodyPtr;
|
||||
mBodySegment.reset(bodyPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -851,7 +851,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketBuffer* aMessage)
|
|||
* so here we keep a variable mPutPacketReceivedLength to indicate if
|
||||
* current PUT request is done.
|
||||
*/
|
||||
mReceivedDataBuffer = new uint8_t[mPacketLength];
|
||||
mReceivedDataBuffer.reset(new uint8_t[mPacketLength]);
|
||||
mPutFinalFlag = (aOpCode == ObexRequestCode::PutFinal);
|
||||
}
|
||||
|
||||
|
|
|
@ -191,8 +191,8 @@ private:
|
|||
uint32_t mSentFileLength;
|
||||
bool mWaitingToSendPutFinal;
|
||||
|
||||
nsAutoArrayPtr<uint8_t> mBodySegment;
|
||||
nsAutoArrayPtr<uint8_t> mReceivedDataBuffer;
|
||||
UniquePtr<uint8_t[]> mBodySegment;
|
||||
UniquePtr<uint8_t[]> mReceivedDataBuffer;
|
||||
|
||||
int mCurrentBlobIndex;
|
||||
RefPtr<Blob> mBlob;
|
||||
|
|
|
@ -144,8 +144,8 @@ public:
|
|||
, mDataLength(aDataLength)
|
||||
, mData(nullptr)
|
||||
{
|
||||
mData = new uint8_t[mDataLength];
|
||||
memcpy(mData, aData, aDataLength);
|
||||
mData.reset(new uint8_t[mDataLength]);
|
||||
memcpy(mData.get(), aData, aDataLength);
|
||||
}
|
||||
|
||||
~ObexHeader()
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
|
||||
ObexHeaderId mId;
|
||||
int mDataLength;
|
||||
nsAutoArrayPtr<uint8_t> mData;
|
||||
UniquePtr<uint8_t[]> mData;
|
||||
};
|
||||
|
||||
class ObexHeaderSet
|
||||
|
|
Загрузка…
Ссылка в новой задаче