From 1772c04c565fef881525fc566ddbf9a5f187ddff Mon Sep 17 00:00:00 2001 From: Milan Sreckovic Date: Wed, 26 Nov 2014 22:00:32 -0500 Subject: [PATCH] Bug 1099437 - Part 2: Clean up int vs uint usage. r=nical --- gfx/layers/ImageDataSerializer.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gfx/layers/ImageDataSerializer.cpp b/gfx/layers/ImageDataSerializer.cpp index c88fdb6d017..5dd6aca7677 100644 --- a/gfx/layers/ImageDataSerializer.cpp +++ b/gfx/layers/ImageDataSerializer.cpp @@ -35,11 +35,11 @@ using namespace gfx; namespace { struct SurfaceBufferInfo { - uint32_t width; - uint32_t height; + int32_t width; + int32_t height; SurfaceFormat format; - static uint32_t GetOffset() + static int32_t GetOffset() { return GetAlignedStride<16>(sizeof(SurfaceBufferInfo)); } @@ -66,12 +66,12 @@ ImageDataSerializer::InitializeBufferInfo(IntSize aSize, Validate(); } -static inline uint32_t -ComputeStride(SurfaceFormat aFormat, uint32_t aWidth) +static inline int32_t +ComputeStride(SurfaceFormat aFormat, int32_t aWidth) { - CheckedInt size = BytesPerPixel(aFormat); + CheckedInt size = BytesPerPixel(aFormat); size *= aWidth; - if (!size.isValid() || size == 0) { + if (!size.isValid() || size.value() <= 0) { gfxDebug() << "ComputeStride overflow " << aWidth; return 0; } @@ -89,10 +89,10 @@ ImageDataSerializerBase::ComputeMinBufferSize(IntSize aSize, return 0; } - CheckedInt bufsize = ComputeStride(aFormat, aSize.width); + CheckedInt bufsize = ComputeStride(aFormat, aSize.width); bufsize *= aSize.height; - if (!bufsize.isValid() || bufsize.value() == 0) { + if (!bufsize.isValid() || bufsize.value() <= 0) { gfxDebug() << "Buffer size overflow " << aSize.width << "x" << aSize.height; return 0; }