Fix some more compiler warnings. This time some were actually very useful\!

This commit is contained in:
Pavel Krajcevski 2013-01-28 20:20:52 -05:00
parent ff1c3658fb
commit fa5d5e865c
4 changed files with 9 additions and 11 deletions

View File

@ -730,7 +730,7 @@ double BC7CompressionMode::CompressCluster(const RGBACluster &cluster, RGBAVecto
}
RGBACluster rgbCluster;
float alphaVals[kMaxNumDataPoints];
float alphaVals[kMaxNumDataPoints] = {0};
float alphaMin = FLT_MAX, alphaMax = -FLT_MAX;
for(uint32 i = 0; i < cluster.GetNumPoints(); i++) {
@ -1013,7 +1013,7 @@ double BC7CompressionMode::CompressCluster(const RGBACluster &cluster, RGBAVecto
assert(pts[nBuckets - 1] == p2);
// Do k-means clustering...
uint32 bucketIdx[kMaxNumDataPoints];
uint32 bucketIdx[kMaxNumDataPoints] = {0};
bool fixed = false;
while(!fixed) {

View File

@ -93,10 +93,10 @@ CompressedImage *Image::Compress(const SCompressionSettings &settings) const {
// Allocate data based on the compression method
int cmpDataSz = 0;
switch(settings.format) {
default: assert(!"Not implemented!");
case eCompressionFormat_DXT1: cmpDataSz = dataSz / 8;
case eCompressionFormat_DXT5: cmpDataSz = dataSz / 4;
case eCompressionFormat_BPTC: cmpDataSz = dataSz / 4;
default: assert(!"Not implemented!"); // Fall Through V
case eCompressionFormat_DXT1: cmpDataSz = dataSz / 8; break;
case eCompressionFormat_DXT5: cmpDataSz = dataSz / 4; break;
case eCompressionFormat_BPTC: cmpDataSz = dataSz / 4; break;
}
unsigned char *cmpData = new unsigned char[cmpDataSz];

View File

@ -227,7 +227,7 @@ void WorkerQueue::NotifyWorkerFinished() {
}
WorkerThread::EAction WorkerQueue::AcceptThreadData(uint32 threadIdx) {
if(threadIdx < 0 || threadIdx >= m_ActiveThreads) {
if(threadIdx >= m_ActiveThreads) {
return WorkerThread::eAction_Quit;
}

View File

@ -206,10 +206,8 @@ EImageFileFormat ImageFile::DetectFileFormat(const CHAR *filename) {
size_t dotPos = len - 1;
while(dotPos >= 0 && filename[dotPos--] != '.');
if(dotPos < 0) {
// !FIXME! Report Error.....
while((dotPos >= len)? false : filename[dotPos--] != '.');
if (dotPos >= len) {
return kNumImageFileFormats;
}