From a263907e0fa2bd9b75b1518bd5b1822f18db5ac8 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Wed, 11 Feb 2015 21:26:31 -0800 Subject: [PATCH] Fix some small bugs and compiler warnings --- BPTCEncoder/src/Compressor.cpp | 2 -- BPTCEncoder/src/RGBAEndpoints.cpp | 1 - BPTCEncoder/src/RGBAEndpoints.h | 2 +- CLTool/src/tc.cpp | 4 ++++ PVRTCEncoder/src/Block.cpp | 2 -- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/BPTCEncoder/src/Compressor.cpp b/BPTCEncoder/src/Compressor.cpp index b686693..7942270 100755 --- a/BPTCEncoder/src/Compressor.cpp +++ b/BPTCEncoder/src/Compressor.cpp @@ -1123,8 +1123,6 @@ double CompressionMode::CompressCluster( assert(pBitCombo == bestPbitCombo); #endif - assert(bestPbitCombo >= 0); - return OptimizeEndpointsForCluster( cluster, p1, p2, bestIndices, bestPbitCombo ); diff --git a/BPTCEncoder/src/RGBAEndpoints.cpp b/BPTCEncoder/src/RGBAEndpoints.cpp index 20ba9a2..68fcc43 100755 --- a/BPTCEncoder/src/RGBAEndpoints.cpp +++ b/BPTCEncoder/src/RGBAEndpoints.cpp @@ -338,7 +338,6 @@ double RGBACluster::QuantizedError( totalError += minError; - assert(bestBucket >= 0); if(indices) indices[i] = bestBucket; } diff --git a/BPTCEncoder/src/RGBAEndpoints.h b/BPTCEncoder/src/RGBAEndpoints.h index 4fea068..6807b1d 100755 --- a/BPTCEncoder/src/RGBAEndpoints.h +++ b/BPTCEncoder/src/RGBAEndpoints.h @@ -86,7 +86,7 @@ class RGBAVector : public FasTC::Vector4 { typedef FasTC::Vector4 BaseVector; public: uint32 GetIdx() const { return m_Idx; } - RGBAVector() : BaseVector(-1.0, -1.0, -1.0, -1.0) { } + RGBAVector() : BaseVector(-1.0, -1.0, -1.0, -1.0), m_Idx(0) { } RGBAVector(uint32 idx, uint32 pixel) : BaseVector( static_cast(pixel & 0xFF), diff --git a/CLTool/src/tc.cpp b/CLTool/src/tc.cpp index a576931..3ac67ee 100644 --- a/CLTool/src/tc.cpp +++ b/CLTool/src/tc.cpp @@ -101,6 +101,10 @@ void ExtractBasename(const char *filename, char *buf, size_t bufSz) { } } + if (!base) { + base = end; + } + size_t numChars = ext - base + 1; size_t toCopy = ::std::min(numChars, bufSz); memcpy(buf, base, toCopy); diff --git a/PVRTCEncoder/src/Block.cpp b/PVRTCEncoder/src/Block.cpp index 602aab5..6a27335 100644 --- a/PVRTCEncoder/src/Block.cpp +++ b/PVRTCEncoder/src/Block.cpp @@ -146,10 +146,8 @@ namespace PVRTCC { } void Block::SetLerpValue(uint32 texelIdx, uint8 lerpVal) { - assert(texelIdx >= 0); assert(texelIdx <= 15); - assert(lerpVal >= 0); assert(lerpVal < 4); m_LongData &= ~(static_cast(0x3) << (texelIdx * 2));