From f9a7013c2915974c8c2278a69783b9228aaa5047 Mon Sep 17 00:00:00 2001 From: Milan Sreckovic Date: Thu, 20 Nov 2014 15:23:41 -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 3cda63e50446..3420a508cc96 100644 --- a/gfx/layers/ImageDataSerializer.cpp +++ b/gfx/layers/ImageDataSerializer.cpp @@ -34,11 +34,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)); } @@ -65,12 +65,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 <= 0) { gfxDebug() << "ComputeStride overflow " << aWidth; return 0; } @@ -88,10 +88,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; }