From 157295efa3a5c1fa336171560ebd2d0155e68987 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Fri, 27 Sep 2013 17:38:36 -0400 Subject: [PATCH] Squelch some compiler warnings. --- Core/src/CompressedImage.cpp | 1 + PVRTCEncoder/src/Compressor.cpp | 36 ++++++++++++--------------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/Core/src/CompressedImage.cpp b/Core/src/CompressedImage.cpp index f048d4d..1e9b612 100644 --- a/Core/src/CompressedImage.cpp +++ b/Core/src/CompressedImage.cpp @@ -90,6 +90,7 @@ CompressedImage &CompressedImage::operator=(const CompressedImage &other) { m_RGBAData = new uint32[GetWidth() * GetHeight()]; memcpy(m_RGBAData, other.m_RGBAData, sizeof(uint32) * GetWidth() * GetHeight()); } + return *this; } CompressedImage::~CompressedImage() { diff --git a/PVRTCEncoder/src/Compressor.cpp b/PVRTCEncoder/src/Compressor.cpp index 11b8340..56183b7 100644 --- a/PVRTCEncoder/src/Compressor.cpp +++ b/PVRTCEncoder/src/Compressor.cpp @@ -95,36 +95,26 @@ namespace PVRTCC { int32 x, int32 y, uint32 width, uint32 height, const EWrapMode wrapMode) { - while(x >= width) { - if(wrapMode == eWrapMode_Wrap) { - x -= width; - } else { - x = width - 1; - } + int32 w = static_cast(width); + int32 h = static_cast(height); + + assert(w >= 0); + assert(h >= 0); + + while(x >= w) { + x = (wrapMode == eWrapMode_Wrap)? x - w : w - 1; } while(x < 0) { - if(wrapMode == eWrapMode_Wrap) { - x += width; - } else { - x = 0; - } + x = (wrapMode == eWrapMode_Wrap)? x + w : 0; } - while(y >= height) { - if(wrapMode == eWrapMode_Wrap) { - y -= height; - } else { - y = height - 1; - } + while(y >= h) { + y = (wrapMode == eWrapMode_Wrap)? y - h : h - 1; } while(y < 0) { - if(wrapMode == eWrapMode_Wrap) { - y += height; - } else { - y = 0; - } + y = (wrapMode == eWrapMode_Wrap)? y + h : 0; } return img(x, y); @@ -177,7 +167,7 @@ namespace PVRTCC { // Go over the 7x7 texel blocks and extract bounding box diagonals for each // block. We should be able to choose which diagonal we want... - const uint32 kKernelSz = 7; + const int32 kKernelSz = 7; Image imgA = downscaled; Image imgB = downscaled;