mkvparser: Cluster::Create clean up.

- Asserts to error condition check and return.
- Use nothrow new.

Change-Id: Iff9da5806e6f3240e7ea9f9e90ccdf729848a778
This commit is contained in:
Tom Finegan 2015-08-24 14:56:35 -07:00
parent 064f2eed62
commit 275ac22cae

View File

@ -6413,15 +6413,14 @@ long Cluster::GetEntry(long index, const mkvparser::BlockEntry*& pEntry) const {
return E_BUFFER_NOT_FULL; // underflow, since more remains to be parsed
}
Cluster* Cluster::Create(Segment* pSegment, long idx, long long off)
// long long element_size)
{
assert(pSegment);
assert(off >= 0);
Cluster* Cluster::Create(Segment* pSegment, long idx, long long off) {
if (!pSegment || off < 0)
return NULL;
const long long element_start = pSegment->m_start + off;
Cluster* const pCluster = new Cluster(pSegment, idx, element_start);
Cluster* const pCluster =
new (std::nothrow) Cluster(pSegment, idx, element_start);
return pCluster;
}