diff --git a/PVRTCEncoder/src/Image.cpp b/PVRTCEncoder/src/Image.cpp index 4f94a5c..c91e0e0 100644 --- a/PVRTCEncoder/src/Image.cpp +++ b/PVRTCEncoder/src/Image.cpp @@ -183,7 +183,7 @@ void Image::BilinearUpscale(uint32 times, EWrapMode wrapMode) { bottomRight.GetBitDepth(debugDepth); assert(CompareBitDepths(bitDepth, debugDepth)); -#endif //NDEBUG +#endif // NDEBUG // bilerp each channel.... const uint16 scaleMask = (scale * scale) - 1; @@ -314,7 +314,7 @@ void Image::DebugOutput(const char *filename) const { ::Image img(m_Height, m_Width, outPixels); char debugFilename[256]; - sprintf(debugFilename, "%s.png", filename); + snprintf(debugFilename, sizeof(debugFilename), "%s.png", filename); ::ImageFile imgFile(debugFilename, eFileFormat_PNG, img); imgFile.Write(); diff --git a/PVRTCEncoder/test/DecompTestPVR.cpp b/PVRTCEncoder/test/DecompTestPVR.cpp index eabbaca..fa62706 100644 --- a/PVRTCEncoder/test/DecompTestPVR.cpp +++ b/PVRTCEncoder/test/DecompTestPVR.cpp @@ -68,13 +68,13 @@ #endif // OUTPUT_DEBUG_IMAGE class ImageTester { -public: - ImageTester(const char *filename) { + public: + explicit ImageTester(const char *filename) { pvrtexture::CPVRTexture pvrTex(filename); const uint8 *data = static_cast(pvrTex.getDataPtr()); ASSERT_TRUE(data); - + const pvrtexture::CPVRTextureHeader &hdr = pvrTex.getHeader(); const uint32 w = hdr.getWidth(); const uint32 h = hdr.getHeight(); @@ -98,7 +98,7 @@ public: #ifdef OUTPUT_DEBUG_IMAGE char dbgfname[256]; - sprintf(dbgfname, "Debug%s.png", filename); + snprintf(dbgfname, sizeof(dgbfname), "Debug%s.png", filename); ::ImageFile imgFile(dbgfname, eFileFormat_PNG, ::Image(w, h, outPixels)); imgFile.Write(); #endif // OUTPUT_DEBUG_IMAGE diff --git a/PVRTCEncoder/test/DecompressorTest.cpp b/PVRTCEncoder/test/DecompressorTest.cpp index 7066e11..492baf0 100644 --- a/PVRTCEncoder/test/DecompressorTest.cpp +++ b/PVRTCEncoder/test/DecompressorTest.cpp @@ -75,7 +75,8 @@ TEST(Decompressor, DecompressWhite) { for(int i = 0; i < kWidth; i++) { for(int j = 0; j < kHeight; j++) { const uint32 *pixelData = reinterpret_cast(outData); - EXPECT_EQ(PixelPrinter(pixelData[j*kWidth + i]), PixelPrinter(0xFFFFFFFF)); + const uint32 p = pixelData[j*kWidth + i]; + EXPECT_EQ(PixelPrinter(p), PixelPrinter(0xFFFFFFFF)); } } } @@ -99,7 +100,8 @@ TEST(Decompressor, DecompressGray) { for(int i = 0; i < kWidth; i++) { for(int j = 0; j < kHeight; j++) { const uint32 *pixelData = reinterpret_cast(outData); - EXPECT_EQ(PixelPrinter(pixelData[j*kWidth + i]), PixelPrinter(0xFF818080)); + const uint32 p = pixelData[j*kWidth + i]; + EXPECT_EQ(PixelPrinter(p), PixelPrinter(0xFF818080)); } } } diff --git a/PVRTCEncoder/test/TestUtils.h b/PVRTCEncoder/test/TestUtils.h index b907f07..e1239ae 100644 --- a/PVRTCEncoder/test/TestUtils.h +++ b/PVRTCEncoder/test/TestUtils.h @@ -54,13 +54,12 @@ #define PVRTCENCODER_TEST_TESTUTILS_H_ #include "Core/include/TexCompTypes.h" -#include class PixelPrinter { private: uint32 m_PixelValue; public: - PixelPrinter(uint32 p) : m_PixelValue(p) { } + explicit PixelPrinter(uint32 p) : m_PixelValue(p) { } bool operator==(const PixelPrinter &other) const { return other.m_PixelValue == this->m_PixelValue; }