mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1089705 - Replace "assert" with "MOZ_ASSERT" in some media code. r=dholbert
This commit is contained in:
parent
4adb27481c
commit
28bc1f81d2
@ -12,8 +12,8 @@
|
||||
#include <istream>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/NullPtr.h"
|
||||
|
||||
@ -36,7 +36,7 @@ MaybeFinish()
|
||||
FakeDecryptor::FakeDecryptor()
|
||||
: mCallback(nullptr)
|
||||
{
|
||||
assert(!sInstance);
|
||||
MOZ_ASSERT(!sInstance);
|
||||
sInstance = this;
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ void FakeDecryptor::DecryptingComplete()
|
||||
void
|
||||
FakeDecryptor::Message(const std::string& aMessage)
|
||||
{
|
||||
assert(sInstance);
|
||||
MOZ_ASSERT(sInstance);
|
||||
const static std::string sid("fake-session-id");
|
||||
sInstance->mCallback->SessionMessage(sid.c_str(), sid.size(),
|
||||
(const uint8_t*)aMessage.c_str(), aMessage.size(),
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
#include "gmp-test-storage.h"
|
||||
#include <vector>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class WriteRecordClient : public GMPRecordClient {
|
||||
@ -119,7 +120,7 @@ GMPErr
|
||||
ReadRecord(const std::string& aRecordName,
|
||||
ReadContinuation* aContinuation)
|
||||
{
|
||||
assert(aContinuation);
|
||||
MOZ_ASSERT(aContinuation);
|
||||
GMPRecord* record;
|
||||
ReadRecordClient* client = new ReadRecordClient();
|
||||
auto err = GMPOpenRecord(aRecordName.c_str(),
|
||||
@ -140,14 +141,14 @@ GMPOpenRecord(const char* aName,
|
||||
GMPRecord** aOutRecord,
|
||||
GMPRecordClient* aClient)
|
||||
{
|
||||
assert(g_platform_api);
|
||||
MOZ_ASSERT(g_platform_api);
|
||||
return g_platform_api->createrecord(aName, aNameLength, aOutRecord, aClient);
|
||||
}
|
||||
|
||||
GMPErr
|
||||
GMPRunOnMainThread(GMPTask* aTask)
|
||||
{
|
||||
assert(g_platform_api);
|
||||
MOZ_ASSERT(g_platform_api);
|
||||
return g_platform_api->runonmainthread(aTask);
|
||||
}
|
||||
|
||||
@ -180,7 +181,7 @@ GMPErr
|
||||
GMPOpenRecord(const std::string& aRecordName,
|
||||
OpenContinuation* aContinuation)
|
||||
{
|
||||
assert(aContinuation);
|
||||
MOZ_ASSERT(aContinuation);
|
||||
GMPRecord* record;
|
||||
OpenRecordClient* client = new OpenRecordClient();
|
||||
auto err = GMPOpenRecord(aRecordName.c_str(),
|
||||
|
@ -2,13 +2,14 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <assert.h>
|
||||
#include <sstream>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ClearKeyDecryptionManager.h"
|
||||
#include "ClearKeyUtils.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/NullPtr.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -129,7 +130,7 @@ ClearKeyDecryptionManager::CreateSession(uint32_t aPromiseId,
|
||||
}
|
||||
|
||||
string sessionId = GetNewSessionId();
|
||||
assert(mSessions.find(sessionId) == mSessions.end());
|
||||
MOZ_ASSERT(mSessions.find(sessionId) == mSessions.end());
|
||||
|
||||
ClearKeySession* session = new ClearKeySession(sessionId, mCallback);
|
||||
session->Init(aPromiseId, aInitData, aInitDataSize);
|
||||
@ -221,11 +222,11 @@ ClearKeyDecryptionManager::CloseSession(uint32_t aPromiseId,
|
||||
string sessionId(aSessionId, aSessionId + aSessionIdLength);
|
||||
ClearKeySession* session = mSessions[sessionId];
|
||||
|
||||
assert(session);
|
||||
MOZ_ASSERT(session);
|
||||
|
||||
const vector<KeyId>& keyIds = session->GetKeyIds();
|
||||
for (auto it = keyIds.begin(); it != keyIds.end(); it++) {
|
||||
assert(mDecryptors.find(*it) != mDecryptors.end());
|
||||
MOZ_ASSERT(mDecryptors.find(*it) != mDecryptors.end());
|
||||
|
||||
if (!mDecryptors[*it]->Release()) {
|
||||
mDecryptors.erase(*it);
|
||||
@ -332,7 +333,7 @@ ClearKeyDecryptor::Decrypt(GMPBuffer* aBuffer,
|
||||
memcpy(&tmp[0], aBuffer->Data(), aBuffer->Size());
|
||||
}
|
||||
|
||||
assert(aMetadata->IVSize() == 8 || aMetadata->IVSize() == 16);
|
||||
MOZ_ASSERT(aMetadata->IVSize() == 8 || aMetadata->IVSize() == 16);
|
||||
vector<uint8_t> iv(aMetadata->IV(), aMetadata->IV() + aMetadata->IVSize());
|
||||
iv.insert(iv.end(), CLEARKEY_KEY_LEN - aMetadata->IVSize(), 0);
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
@ -43,7 +42,7 @@ static void
|
||||
IncrementIV(vector<uint8_t>& aIV) {
|
||||
using mozilla::BigEndian;
|
||||
|
||||
assert(aIV.size() == 16);
|
||||
MOZ_ASSERT(aIV.size() == 16);
|
||||
BigEndian::writeUint64(&aIV[8], BigEndian::readUint64(&aIV[8]) + 1);
|
||||
}
|
||||
|
||||
@ -51,8 +50,8 @@ IncrementIV(vector<uint8_t>& aIV) {
|
||||
ClearKeyUtils::DecryptAES(const vector<uint8_t>& aKey,
|
||||
vector<uint8_t>& aData, vector<uint8_t>& aIV)
|
||||
{
|
||||
assert(aIV.size() == CLEARKEY_KEY_LEN);
|
||||
assert(aKey.size() == CLEARKEY_KEY_LEN);
|
||||
MOZ_ASSERT(aIV.size() == CLEARKEY_KEY_LEN);
|
||||
MOZ_ASSERT(aKey.size() == CLEARKEY_KEY_LEN);
|
||||
|
||||
OAES_CTX* aes = oaes_alloc();
|
||||
oaes_key_import_data(aes, &aKey[0], aKey.size());
|
||||
@ -65,7 +64,7 @@ ClearKeyUtils::DecryptAES(const vector<uint8_t>& aKey,
|
||||
vector<uint8_t> enc(encLen);
|
||||
oaes_encrypt(aes, &aIV[0], CLEARKEY_KEY_LEN, &enc[0], &encLen);
|
||||
|
||||
assert(encLen >= 2 * OAES_BLOCK_SIZE + CLEARKEY_KEY_LEN);
|
||||
MOZ_ASSERT(encLen >= 2 * OAES_BLOCK_SIZE + CLEARKEY_KEY_LEN);
|
||||
size_t blockLen = std::min(aData.size() - i, CLEARKEY_KEY_LEN);
|
||||
for (size_t j = 0; j < blockLen; j++) {
|
||||
aData[i + j] ^= enc[2 * OAES_BLOCK_SIZE + j];
|
||||
|
Loading…
Reference in New Issue
Block a user