Got rid of some more compiler warnings.

This commit is contained in:
Pavel Krajcevski 2013-01-28 16:57:15 -05:00
parent 08df6f6d65
commit 1b30efe488
10 changed files with 53 additions and 32 deletions

View file

@ -114,17 +114,18 @@ class BlockStatManager {
private:
BlockStatList(const BlockStat &stat);
BlockStat m_Stat;
BlockStatList *m_Tail;
BlockStat m_Stat;
ReferenceCounter m_Counter;
} *m_BlockStatList;
uint32 m_BlockStatListSz;
TCMutex *m_Mutex;
uint32 m_NextBlock;
ReferenceCounter m_Counter;
TCMutex *m_Mutex;
// Note: we probably shouldn't call this...
void Copy(const BlockStatManager &);
};

View file

@ -55,12 +55,14 @@ enum ECompressionFormat {
class CompressedImage {
private:
unsigned char *m_Data;
unsigned int m_DataSz;
unsigned int m_Width;
unsigned int m_Height;
ECompressionFormat m_Format;
unsigned char *m_Data;
unsigned int m_DataSz;
void InitData(const unsigned char *withData);
public:
CompressedImage();
@ -71,8 +73,8 @@ class CompressedImage {
const unsigned char *data
);
unsigned int GetHeight() const { return m_Height; }
unsigned int GetWidth() const { return m_Width; }
unsigned int GetHeight() const { return m_Height; }
unsigned int GetWidth() const { return m_Width; }
CompressedImage( const CompressedImage &other );
~CompressedImage();

View file

@ -63,8 +63,8 @@ static T max(const T &a, const T &b) {
////////////////////////////////////////////////////////////////////////////////
BlockStat::BlockStat(const CHAR *statName, int stat)
: m_IntStat(stat)
, m_Type(eType_Int)
: m_Type(eType_Int)
, m_IntStat(stat)
{
#ifdef _MSC_VER
strncpy_s(m_StatName, statName, kStatNameSz);
@ -74,8 +74,8 @@ BlockStat::BlockStat(const CHAR *statName, int stat)
}
BlockStat::BlockStat(const CHAR *statName, double stat)
: m_FloatStat(stat)
, m_Type(eType_Float)
: m_Type(eType_Float)
, m_FloatStat(stat)
{
#ifdef _MSC_VER
strncpy_s(m_StatName, statName, kStatNameSz);
@ -124,19 +124,19 @@ void BlockStat::ToString(CHAR *buf, int bufSz) const {
////////////////////////////////////////////////////////////////////////////////
void BlockStatManager::Copy(const BlockStatManager &other) {
// This is a bug. If we copy the manager then all of the lists and pointers
// become shared and can cause dereferencing issues. Check to see where you're
// copying this class and make sure to actually create a new instance.
assert(!"We shouldn't be copying these in this manner!");
m_BlockStatList = new BlockStatList(*other.m_BlockStatList);
m_BlockStatListSz = other.m_BlockStatListSz;
m_NextBlock = other.m_NextBlock;
// This is a bug. If we copy the manager then all of the lists and pointers
// become shared and can cause dereferencing issues. Check to see where you're
// copying this class and make sure to actually create a new instance.
assert(!"We shouldn't be copying these in this manner!");
// If we do copy them, then make sure that we are actually using the exact same
// pointers for our synchronization primitives... otherwise we could run into
// deadlock issues.
m_Mutex = other.m_Mutex;
m_BlockStatList = new BlockStatList(*other.m_BlockStatList);
m_BlockStatListSz = other.m_BlockStatListSz;
m_NextBlock = other.m_NextBlock;
// If we do copy them, then make sure that we are actually using the exact same
// pointers for our synchronization primitives... otherwise we could run into
// deadlock issues.
m_Mutex = other.m_Mutex;
}
BlockStatManager::BlockStatManager(const BlockStatManager &other) {

View file

@ -89,6 +89,7 @@ void CompressedImage::InitData(const unsigned char *withData) {
int uncompDataSz = m_Width * m_Height * 4;
switch(m_Format) {
default: assert(!"Not implemented!"); // Fall through V
case eCompressionFormat_DXT1: m_DataSz = uncompDataSz / 8; break;
case eCompressionFormat_DXT5: m_DataSz = uncompDataSz / 4; break;
case eCompressionFormat_BPTC: m_DataSz = uncompDataSz / 4; break;
@ -112,6 +113,7 @@ bool CompressedImage::DecompressImage(unsigned char *outBuf, unsigned int outBuf
// First make sure that we have enough data
uint32 dataSz = 0;
switch(m_Format) {
default: assert(!"Not implemented!"); // Fall through V
case eCompressionFormat_DXT1: dataSz = m_DataSz * 8; break;
case eCompressionFormat_DXT5: dataSz = m_DataSz * 4; break;
case eCompressionFormat_BPTC: dataSz = m_DataSz * 4; break;

View file

@ -70,9 +70,9 @@ Image::Image(const CompressedImage &ci)
}
Image::Image(const ImageLoader &loader)
: m_PixelData(0)
, m_Width(loader.GetWidth())
: m_Width(loader.GetWidth())
, m_Height(loader.GetHeight())
, m_PixelData(0)
{
if(loader.GetImageData()) {
m_PixelData = new uint8[ loader.GetImageDataSz() ];
@ -93,6 +93,7 @@ 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;

View file

@ -71,6 +71,7 @@ StopWatch &StopWatch::operator=(const StopWatch &other) {
}
impl = new StopWatchImpl();
memcpy(impl, other.impl, sizeof(StopWatchImpl));
return *this;
}
StopWatch::~StopWatch() {

View file

@ -93,6 +93,12 @@ static CompressionFuncWithStats ChooseFuncFromSettingsWithStats(const SCompress
return BC7C::CompressImageBC7Stats;
}
break;
default:
{
assert(!"Not implemented!");
return NULL;
}
}
return NULL;
}
@ -114,6 +120,12 @@ static CompressionFunc ChooseFuncFromSettings(const SCompressionSettings &s) {
#endif
}
break;
default:
{
assert(!"Not implemented!");
return NULL;
}
}
return NULL;
}
@ -270,9 +282,10 @@ bool CompressImageData(
// Allocate data based on the compression method
uint32 cmpDataSzNeeded = 0;
switch(settings.format) {
case eCompressionFormat_DXT1: cmpDataSzNeeded = dataSz / 8;
case eCompressionFormat_DXT5: cmpDataSzNeeded = dataSz / 4;
case eCompressionFormat_BPTC: cmpDataSzNeeded = dataSz / 4;
default: assert(!"Not implemented!"); // Fall through V
case eCompressionFormat_DXT1: cmpDataSzNeeded = dataSz / 8; break;
case eCompressionFormat_DXT5: cmpDataSzNeeded = dataSz / 4; break;
case eCompressionFormat_BPTC: cmpDataSzNeeded = dataSz / 4; break;
}
if(cmpDataSzNeeded == 0) {

View file

@ -117,8 +117,8 @@ private:
public:
TCBarrierImpl(int threads)
: TCThreadBaseImpl()
, m_ThreadCount(threads)
, m_ThreadLimit(threads)
, m_ThreadCount(threads)
, m_Times(0)
{
assert(threads > 0);

View file

@ -133,13 +133,13 @@ class ThreadGroup {
const unsigned char *const m_ImageData;
unsigned char *m_OutBuf;
const unsigned int m_CompressedBlockSize;
const unsigned int m_UncompressedBlockSize;
StopWatch m_StopWatch;
EThreadState m_ThreadState;
bool m_ExitFlag;
const unsigned int m_CompressedBlockSize;
const unsigned int m_UncompressedBlockSize;
};
#endif // _THREAD_GROUP_H_

View file

@ -134,9 +134,10 @@ class WorkerQueue {
const CompressionFunc m_CompressionFunc;
CompressionFunc GetCompressionFunc() const { return m_CompressionFunc; }
BlockStatManager *m_BlockStatManager;
const CompressionFuncWithStats m_CompressionFuncWithStats;
CompressionFuncWithStats GetCompressionFuncWithStats() const { return m_CompressionFuncWithStats; }
BlockStatManager *m_BlockStatManager;
BlockStatManager *GetBlockStatManager() const { return m_BlockStatManager; }
StopWatch m_StopWatch;