mkvparser: SafeArrayAlloc fix type warning

num_bytes has been validated so it's safe to cast to size_t for use with
new

Change-Id: If1a6c5521dd6fbcb7e30f434b81daa3b26bd0386
This commit is contained in:
James Zern
2015-09-11 16:02:18 -07:00
parent f1a99d5f25
commit 267f71c76e

View File

@@ -47,8 +47,10 @@ template<typename Type> Type* SafeArrayAlloc(unsigned long long num_elements,
const unsigned long long num_bytes = num_elements * element_size; const unsigned long long num_bytes = num_elements * element_size;
if (element_size > (kMaxAllocSize / num_elements)) if (element_size > (kMaxAllocSize / num_elements))
return NULL; return NULL;
if (num_bytes != static_cast<size_t>(num_bytes))
return NULL;
return new (std::nothrow) Type[num_bytes]; return new (std::nothrow) Type[static_cast<size_t>(num_bytes)];
} }
void GetVersion(int& major, int& minor, int& build, int& revision) { void GetVersion(int& major, int& minor, int& build, int& revision) {