зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 5f7ea2187fa6 (bug 1533527) for build bustages on a CLOSED TREE
This commit is contained in:
Родитель
8235aa9f56
Коммит
5a60df453a
|
@ -359,7 +359,7 @@ bool TexUnpackBlob::ConvertIfNeeded(
|
|||
return false;
|
||||
}
|
||||
|
||||
UniqueBuffer dstBuffer = calloc((size_t)1, (size_t)dstTotalBytes.value());
|
||||
UniqueBuffer dstBuffer = calloc(1, dstTotalBytes.value());
|
||||
if (!dstBuffer.get()) {
|
||||
webgl->ErrorOutOfMemory("Failed to allocate dest buffer.");
|
||||
return false;
|
||||
|
|
|
@ -303,13 +303,10 @@ void WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, GLenum usage) {
|
|||
|
||||
////
|
||||
|
||||
const auto checkedSize = CheckedInt<size_t>(size);
|
||||
if (!checkedSize.isValid()) return ErrorOutOfMemory("size too large for platform.");
|
||||
|
||||
const UniqueBuffer zeroBuffer(calloc(checkedSize.value(), size_t(1)));
|
||||
const UniqueBuffer zeroBuffer(calloc(size, 1));
|
||||
if (!zeroBuffer) return ErrorOutOfMemory("Failed to allocate zeros.");
|
||||
|
||||
BufferDataImpl(target, checkedSize.value(), (const uint8_t*)zeroBuffer.get(), usage);
|
||||
BufferDataImpl(target, size_t(size), (const uint8_t*)zeroBuffer.get(), usage);
|
||||
}
|
||||
|
||||
void WebGLContext::BufferData(GLenum target,
|
||||
|
|
|
@ -586,7 +586,7 @@ static bool ZeroTextureData(const WebGLContext* webgl, GLuint tex,
|
|||
|
||||
const size_t byteCount = checkedByteCount.value();
|
||||
|
||||
UniqueBuffer zeros = calloc(size_t(1), byteCount);
|
||||
UniqueBuffer zeros = calloc(1, byteCount);
|
||||
if (!zeros) return false;
|
||||
|
||||
ScopedUnpackReset scopedReset(webgl);
|
||||
|
@ -623,7 +623,7 @@ static bool ZeroTextureData(const WebGLContext* webgl, GLuint tex,
|
|||
|
||||
const size_t byteCount = checkedByteCount.value();
|
||||
|
||||
UniqueBuffer zeros = calloc(size_t(1), byteCount);
|
||||
UniqueBuffer zeros = calloc(1, byteCount);
|
||||
if (!zeros) return false;
|
||||
|
||||
ScopedUnpackReset scopedReset(webgl);
|
||||
|
|
|
@ -1951,12 +1951,12 @@ static bool DoCopyTexOrSubImage(WebGLContext* webgl, bool isSubImage,
|
|||
|
||||
if (uint32_t(rwWidth) != dstWidth || uint32_t(rwHeight) != dstHeight) {
|
||||
const auto& pi = idealUnpack->ToPacking();
|
||||
CheckedInt<size_t> byteCount = BytesPerPixel(pi);
|
||||
CheckedUint32 byteCount = BytesPerPixel(pi);
|
||||
byteCount *= dstWidth;
|
||||
byteCount *= dstHeight;
|
||||
|
||||
if (byteCount.isValid()) {
|
||||
buffer = calloc(size_t(1), byteCount.value());
|
||||
buffer = calloc(1, byteCount.value());
|
||||
}
|
||||
|
||||
if (!buffer.get()) {
|
||||
|
|
|
@ -15,17 +15,6 @@ typedef int64_t WebGLsizeiptr;
|
|||
typedef int64_t WebGLintptr;
|
||||
typedef bool WebGLboolean;
|
||||
|
||||
// -
|
||||
// Prevent implicit conversions into calloc and malloc.
|
||||
|
||||
template<typename RequireSizeT1, typename RequireSizeT2>
|
||||
void* calloc(RequireSizeT1 n, RequireSizeT2 size) = delete;
|
||||
|
||||
template<typename RequireSizeT>
|
||||
void* malloc(RequireSizeT size) = delete;
|
||||
|
||||
// -
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
class GLContext; // This is going to be needed a lot.
|
||||
|
|
|
@ -125,7 +125,7 @@ struct AlignedArray {
|
|||
if (aZero) {
|
||||
// calloc can be more efficient than new[] for large chunks,
|
||||
// so we use calloc/malloc/free for everything.
|
||||
mStorage = static_cast<uint8_t *>(calloc((size_t)1, storageByteCount.value()));
|
||||
mStorage = static_cast<uint8_t *>(calloc(1, storageByteCount.value()));
|
||||
} else {
|
||||
mStorage = static_cast<uint8_t *>(malloc(storageByteCount.value()));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче