From 994ae1b656ff160f04da49fea8bb3bdcb3c6af35 Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Fri, 8 May 2015 03:19:00 +0200 Subject: [PATCH] Bug 1162901 - Fix warnings in BootAnimation. r=mwu --- widget/gonk/libdisplay/BootAnimation.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/widget/gonk/libdisplay/BootAnimation.cpp b/widget/gonk/libdisplay/BootAnimation.cpp index 2b59df5a3f8..57f96f711fd 100644 --- a/widget/gonk/libdisplay/BootAnimation.cpp +++ b/widget/gonk/libdisplay/BootAnimation.cpp @@ -279,7 +279,7 @@ TransformTo565(png_structp png_ptr, png_row_infop row_info, png_bytep data) { uint16_t *outbuf = (uint16_t *)data; uint8_t *inbuf = (uint8_t *)data; - for (int i = 0; i < row_info->rowbytes; i += 3) { + for (uint32_t i = 0; i < row_info->rowbytes; i += 3) { *outbuf++ = ((inbuf[i] & 0xF8) << 8) | ((inbuf[i + 1] & 0xFC) << 3) | ((inbuf[i + 2] ) >> 3); @@ -387,7 +387,7 @@ AnimationFrame::ReadPngFrame(int outputFormat) vector rows(height + 1); uint32_t stride = width * bytepp; - for (int i = 0; i < height; i++) { + for (uint32_t i = 0; i < height; i++) { rows[i] = buf + (stride * i); } rows[height] = nullptr; @@ -547,12 +547,12 @@ AnimationThread(void *) sort(part.frames.begin(), part.frames.end()); } - uint32_t frameDelayUs = 1000000 / fps; + long int frameDelayUs = 1000000 / fps; for (uint32_t i = 0; i < parts.size(); i++) { AnimationPart &part = parts[i]; - uint32_t j = 0; + int32_t j = 0; while (sRunAnimation && (!part.count || j++ < part.count)) { for (uint32_t k = 0; k < part.frames.size(); k++) { struct timeval tv1, tv2; @@ -585,11 +585,11 @@ AnimationThread(void *) (buf->height * buf->stride * frame.bytepp) / sizeof(wchar_t)); } - if (buf->height == frame.height && buf->stride == frame.width) { + if ((uint32_t)buf->height == frame.height && (uint32_t)buf->stride == frame.width) { memcpy(vaddr, frame.buf, frame.width * frame.height * frame.bytepp); - } else if (buf->height >= frame.height && - buf->width >= frame.width) { + } else if ((uint32_t)buf->height >= frame.height && + (uint32_t)buf->width >= frame.width) { int startx = (buf->width - frame.width) / 2; int starty = (buf->height - frame.height) / 2; @@ -599,7 +599,7 @@ AnimationThread(void *) char *src = frame.buf; char *dst = (char *) vaddr + starty * dst_stride + startx * frame.bytepp; - for (int i = 0; i < frame.height; i++) { + for (uint32_t i = 0; i < frame.height; i++) { memcpy(dst, src, src_stride); src += src_stride; dst += dst_stride; @@ -614,7 +614,7 @@ AnimationThread(void *) if (tv2.tv_usec < frameDelayUs) { usleep(frameDelayUs - tv2.tv_usec); } else { - LOGW("Frame delay is %d us but decoding took %d us", + LOGW("Frame delay is %ld us but decoding took %ld us", frameDelayUs, tv2.tv_usec); }