Fix warnings.

This commit is contained in:
castano 2010-10-28 05:39:35 +00:00
parent 1c588e3311
commit 5ae77ae037
3 changed files with 14 additions and 9 deletions

View File

@ -468,8 +468,6 @@ void FloatColorBlock::init(const Image * img, uint x, uint y)
// @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :(
// @@ Ideally we should zero the weights of the pixels out of range. // @@ Ideally we should zero the weights of the pixels out of range.
uint srcPlane = w * h;
for (uint i = 0; i < 4; i++) for (uint i = 0; i < 4; i++)
{ {
const uint by = i % h; const uint by = i % h;

View File

@ -524,7 +524,7 @@ namespace
static uint findD3D9Format(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask) static uint findD3D9Format(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
{ {
for (int i = 0; i < s_d3dFormatCount; i++) for (uint i = 0; i < s_d3dFormatCount; i++)
{ {
if (s_d3dFormats[i].bitcount == bitcount && if (s_d3dFormats[i].bitcount == bitcount &&
s_d3dFormats[i].rmask == rmask && s_d3dFormats[i].rmask == rmask &&
@ -1160,7 +1160,7 @@ void * DirectDrawSurface::readData(uint * sizePtr)
void * data = new unsigned char [size]; void * data = new unsigned char [size];
size = stream->serialize(data, size); size = stream->serialize(data, size);
nvDebugCheck(size == *sizePtr); nvDebugCheck(uint(size) == *sizePtr);
return data; return data;
} }

View File

@ -118,17 +118,18 @@ Image * nv::ImageIO::load(const char * fileName, Stream & s)
nvDebugCheck(fileName != NULL); nvDebugCheck(fileName != NULL);
nvDebugCheck(s.isLoading()); nvDebugCheck(s.isLoading());
const char * extension = Path::extension(fileName);
#if defined(HAVE_FREEIMAGE) #if defined(HAVE_FREEIMAGE)
FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(fileName); FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(fileName);
if (fif != FIF_UNKNOWN && FreeImage_FIFSupportsReading(fif)) { if (fif != FIF_UNKNOWN && FreeImage_FIFSupportsReading(fif)) {
return loadFreeImage(fif, s); return loadFreeImage(fif, s);
} }
#else // defined(HAVE_FREEIMAGE) #else // defined(HAVE_FREEIMAGE)
const char * extension = Path::extension(fileName);
if (strCaseCmp(extension, ".tga") == 0) { if (strCaseCmp(extension, ".tga") == 0) {
return loadTGA(s); return loadTGA(s);
} }
#if defined(HAVE_JPEG) #if defined(HAVE_JPEG)
if (strCaseCmp(extension, ".jpg") == 0 || strCaseCmp(extension, ".jpeg") == 0) { if (strCaseCmp(extension, ".jpg") == 0 || strCaseCmp(extension, ".jpeg") == 0) {
return loadJPG(s); return loadJPG(s);
@ -139,7 +140,8 @@ Image * nv::ImageIO::load(const char * fileName, Stream & s)
return loadPNG(s); return loadPNG(s);
} }
#endif #endif
if (strCaseCmp(extension, ".psd") == 0) {
if (strCaseCmp(extension, ".psd") == 0) {
return loadPSD(s); return loadPSD(s);
} }
#endif // defined(HAVE_FREEIMAGE) #endif // defined(HAVE_FREEIMAGE)
@ -297,9 +299,9 @@ bool nv::ImageIO::saveFloat(const char * fileName, Stream & s, const FloatImage
bool nv::ImageIO::saveFloat(const char * fileName, const FloatImage * fimage, uint baseComponent, uint componentCount) bool nv::ImageIO::saveFloat(const char * fileName, const FloatImage * fimage, uint baseComponent, uint componentCount)
{ {
#if !defined(HAVE_FREEIMAGE)
const char * extension = Path::extension(fileName); const char * extension = Path::extension(fileName);
#if !defined(HAVE_FREEIMAGE)
#if defined(HAVE_OPENEXR) #if defined(HAVE_OPENEXR)
if (strCaseCmp(extension, ".exr") == 0) { if (strCaseCmp(extension, ".exr") == 0) {
return saveFloatEXR(fileName, fimage, baseComponent, componentCount); return saveFloatEXR(fileName, fimage, baseComponent, componentCount);
@ -310,7 +312,8 @@ bool nv::ImageIO::saveFloat(const char * fileName, const FloatImage * fimage, ui
return saveFloatTIFF(fileName, fimage, baseComponent, componentCount); return saveFloatTIFF(fileName, fimage, baseComponent, componentCount);
} }
#endif #endif
#endif // defined(HAVE_FREEIMAGE)
#endif // !defined(HAVE_FREEIMAGE)
StdInputStream stream(fileName); StdInputStream stream(fileName);
@ -600,6 +603,10 @@ bool nv::ImageIO::saveFloatFreeImage(FREE_IMAGE_FORMAT fif, Stream & s, const Fl
{ {
type = FIT_RGBAF; type = FIT_RGBAF;
} }
else {
return false;
}
FIBITMAP * bitmap = FreeImage_AllocateT(type, w, h); FIBITMAP * bitmap = FreeImage_AllocateT(type, w, h);