зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1551099. Stop using [array] in nsISDBResults. r=asuth
Though given that getAsArray is unused and untested, maybe we should just remove it? Differential Revision: https://phabricator.services.mozilla.com/D30832 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e95d575f7f
Коммит
c8eeaf68de
|
@ -16,24 +16,14 @@ SDBResult::SDBResult(const nsACString& aData) : mData(aData) {}
|
|||
NS_IMPL_ISUPPORTS(SDBResult, nsISDBResult)
|
||||
|
||||
NS_IMETHODIMP
|
||||
SDBResult::GetAsArray(uint32_t* aDataLen, uint8_t** aData) {
|
||||
MOZ_ASSERT(aDataLen);
|
||||
MOZ_ASSERT(aData);
|
||||
SDBResult::GetAsArray(nsTArray<uint8_t>& aData) {
|
||||
uint32_t length = mData.Length();
|
||||
aData.SetLength(length);
|
||||
|
||||
if (mData.IsEmpty()) {
|
||||
*aDataLen = 0;
|
||||
*aData = nullptr;
|
||||
return NS_OK;
|
||||
if (length != 0) {
|
||||
memcpy(aData.Elements(), mData.BeginReading(), length * sizeof(uint8_t));
|
||||
}
|
||||
|
||||
uint32_t length = mData.Length();
|
||||
|
||||
uint8_t* data = static_cast<uint8_t*>(moz_xmalloc(length * sizeof(uint8_t)));
|
||||
|
||||
memcpy(data, mData.BeginReading(), length * sizeof(uint8_t));
|
||||
|
||||
*aDataLen = length;
|
||||
*aData = data;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
[scriptable, uuid(bca19e01-b34e-4a48-8875-2f4cb871febf)]
|
||||
interface nsISDBResult : nsISupports
|
||||
{
|
||||
[must_use] void
|
||||
getAsArray([optional] out uint32_t dataLen,
|
||||
[array, retval, size_is(dataLen)] out uint8_t data);
|
||||
[must_use] Array<uint8_t>
|
||||
getAsArray();
|
||||
|
||||
[must_use, implicit_jscontext] jsval
|
||||
getAsArrayBuffer();
|
||||
|
|
Загрузка…
Ссылка в новой задаче