From 79d2ad79ac0b41368d7f8c4404d86b757307b58a Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Wed, 25 Sep 2013 14:30:48 -0400 Subject: [PATCH] Fix some snafus on windows --- PVRTCEncoder/src/Image.cpp | 9 +++++++-- PVRTCEncoder/test/DecompTestPVR.cpp | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/PVRTCEncoder/src/Image.cpp b/PVRTCEncoder/src/Image.cpp index c90a57c..f928bf3 100644 --- a/PVRTCEncoder/src/Image.cpp +++ b/PVRTCEncoder/src/Image.cpp @@ -56,6 +56,11 @@ #include #include +#if _MSC_VER +# define _CRT_SECURE_NO_WARNINGS +# define snprintf _snprintf +#endif + #include "Pixel.h" #include "Core/include/Image.h" @@ -303,8 +308,8 @@ const Pixel & Image::operator()(uint32 i, uint32 j) const { void Image::DebugOutput(const char *filename) const { uint32 *outPixels = new uint32[m_Width * m_Height]; const uint8 fullDepth[4] = { 8, 8, 8, 8 }; - for(int j = 0; j < m_Height; j++) { - for(int i = 0; i < m_Width; i++) { + for(uint32 j = 0; j < m_Height; j++) { + for(uint32 i = 0; i < m_Width; i++) { uint32 idx = j * m_Width + i; Pixel p = m_Pixels[idx]; p.ChangeBitDepth(fullDepth); diff --git a/PVRTCEncoder/test/DecompTestPVR.cpp b/PVRTCEncoder/test/DecompTestPVR.cpp index e5a64f2..2d29aa1 100644 --- a/PVRTCEncoder/test/DecompTestPVR.cpp +++ b/PVRTCEncoder/test/DecompTestPVR.cpp @@ -73,7 +73,7 @@ class ImageTester { pvrtexture::CPVRTexture pvrTex(filename); const uint8 *data = static_cast(pvrTex.getDataPtr()); - ASSERT_TRUE(data); + assert(data); const pvrtexture::CPVRTextureHeader &hdr = pvrTex.getHeader(); const uint32 w = hdr.getWidth(); @@ -96,7 +96,7 @@ class ImageTester { uint32 *libPixels = static_cast(pvrTex.getDataPtr()); - for(int i = 0; i < w*h; i++) { + for(uint32 i = 0; i < w*h; i++) { EXPECT_EQ(PixelPrinter(libPixels[i]), PixelPrinter(outPixels[i])); }