Fix more compiler warnings.

This commit is contained in:
Pavel Krajcevski 2013-01-28 16:42:11 -05:00
parent aaf16eacc8
commit 08df6f6d65
5 changed files with 19 additions and 19 deletions

View File

@ -51,6 +51,9 @@ class ImageLoader {
protected: protected:
const uint8 *const m_RawData;
uint8 *m_PixelData;
uint32 m_Width; uint32 m_Width;
uint32 m_Height; uint32 m_Height;
@ -66,9 +69,6 @@ class ImageLoader {
uint32 m_AlphaChannelPrecision; uint32 m_AlphaChannelPrecision;
uint8 *m_AlphaData; uint8 *m_AlphaData;
uint8 *m_PixelData;
const uint8 *const m_RawData;
ImageLoader(const uint8 *rawData) ImageLoader(const uint8 *rawData)
: m_RawData(rawData) : m_RawData(rawData)
, m_PixelData(0) , m_PixelData(0)

View File

@ -51,18 +51,18 @@ class ImageWriter {
protected: protected:
const uint8 *m_PixelData;
uint32 m_RawFileDataSz;
uint8 *m_RawFileData;
uint32 m_Width; uint32 m_Width;
uint32 m_Height; uint32 m_Height;
const uint8 *m_PixelData;
uint32 m_RawFileDataSz;
uint8 *m_RawFileData;
ImageWriter(const int width, const int height, const uint8 *rawData) ImageWriter(const int width, const int height, const uint8 *rawData)
: m_PixelData(rawData) : m_PixelData(rawData)
, m_RawFileDataSz(256)
, m_RawFileData(new uint8[m_RawFileDataSz])
, m_Width(width), m_Height(height) , m_Width(width), m_Height(height)
, m_RawFileDataSz(256)
, m_RawFileData(new uint8[m_RawFileDataSz])
{ } { }
uint32 GetChannelForPixel(uint32 x, uint32 y, uint32 ch); uint32 GetChannelForPixel(uint32 x, uint32 y, uint32 ch);

View File

@ -99,11 +99,11 @@ class FileStream {
private: private:
EFileMode m_Mode;
// Platform specific implementation // Platform specific implementation
FileStreamImpl *m_Impl; FileStreamImpl *m_Impl;
EFileMode m_Mode;
static const uint32 kMaxFilenameSz = 256; static const uint32 kMaxFilenameSz = 256;
CHAR m_Filename[kMaxFilenameSz]; CHAR m_Filename[kMaxFilenameSz];
}; };

View File

@ -59,7 +59,7 @@ public:
ImageFile(const char *filename); ImageFile(const char *filename);
ImageFile(const char *filename, EImageFileFormat format); ImageFile(const char *filename, EImageFileFormat format);
ImageFile(const char *filename, EImageFileFormat format, const Image &); ImageFile(const char *filename, EImageFileFormat format, const Image &);
~ImageFile(); ~ImageFile();
unsigned int GetWidth() const { return m_Width; } unsigned int GetWidth() const { return m_Width; }
@ -67,20 +67,21 @@ public:
CompressedImage *Compress(const SCompressionSettings &) const; CompressedImage *Compress(const SCompressionSettings &) const;
Image *GetImage() const { return m_Image; } Image *GetImage() const { return m_Image; }
bool Load(); bool Load();
bool Write(); bool Write();
private: private:
static const unsigned int kMaxFilenameSz = 256;
char m_Filename[kMaxFilenameSz]; static const unsigned int kMaxFilenameSz = 256;
char m_Filename[kMaxFilenameSz];
unsigned int m_Handle; unsigned int m_Handle;
unsigned int m_Width; unsigned int m_Width;
unsigned int m_Height; unsigned int m_Height;
Image *m_Image;
const EImageFileFormat m_FileFormat; const EImageFileFormat m_FileFormat;
Image *m_Image;
static unsigned char *ReadFileData(const CHAR *filename); static unsigned char *ReadFileData(const CHAR *filename);
static bool WriteImageDataToFile(const uint8 *data, const uint32 dataSz, const CHAR *filename); static bool WriteImageDataToFile(const uint8 *data, const uint32 dataSz, const CHAR *filename);
static EImageFileFormat DetectFileFormat(const CHAR *filename); static EImageFileFormat DetectFileFormat(const CHAR *filename);

View File

@ -245,7 +245,6 @@ unsigned char *ImageFile::ReadFileData(const CHAR *filename) {
// Read all of the data // Read all of the data
uint64 totalBytesRead = 0; uint64 totalBytesRead = 0;
uint64 totalBytesLeft = fileSize; uint64 totalBytesLeft = fileSize;
uint32 bytesToRead = uint32(std::min(totalBytesLeft, uint64(1 << 31)));
int32 bytesRead; int32 bytesRead;
while((bytesRead = fstr.Read(rawData, uint32(fileSize))) > 0) { while((bytesRead = fstr.Read(rawData, uint32(fileSize))) > 0) {
totalBytesRead += bytesRead; totalBytesRead += bytesRead;