From Mike Weiblen, "1) best practices suggest that values passed by-reference should be

initialized.
2) explanatory comments are handy when available as notify() messages."
This commit is contained in:
Robert Osfield 2008-01-28 20:54:14 +00:00
parent e0e98d3426
commit f0087e821e

View File

@ -412,7 +412,7 @@ simage_tiff_load(std::istream& fin,
photometric != PHOTOMETRIC_MINISWHITE && photometric != PHOTOMETRIC_MINISWHITE &&
photometric != PHOTOMETRIC_MINISBLACK) photometric != PHOTOMETRIC_MINISBLACK)
{ {
/*Bad photometric; can only handle Grayscale, RGB and Palette images :-( */ osg::notify(osg::DEBUG_INFO) << "Bad photometric; can only handle Grayscale, RGB and Palette images" << std::endl;
TIFFClose(in); TIFFClose(in);
tifferror = ERR_UNSUPPORTED; tifferror = ERR_UNSUPPORTED;
return NULL; return NULL;
@ -432,7 +432,7 @@ simage_tiff_load(std::istream& fin,
samplesperpixel != 3 && samplesperpixel != 3 &&
samplesperpixel != 4) samplesperpixel != 4)
{ {
/* Bad samples/pixel */ osg::notify(osg::DEBUG_INFO) << "Bad samples/pixel" << std::endl;
tifferror = ERR_UNSUPPORTED; tifferror = ERR_UNSUPPORTED;
TIFFClose(in); TIFFClose(in);
return NULL; return NULL;
@ -449,7 +449,7 @@ simage_tiff_load(std::istream& fin,
{ {
if (bitspersample != 8 && bitspersample != 16) if (bitspersample != 8 && bitspersample != 16)
{ {
/* can only handle 8 and 16 bit samples. */ osg::notify(osg::DEBUG_INFO) << "can only handle 8 and 16 bit samples" << std::endl;
TIFFClose(in); TIFFClose(in);
tifferror = ERR_UNSUPPORTED; tifferror = ERR_UNSUPPORTED;
return NULL; return NULL;
@ -642,12 +642,12 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
ReadResult readTIFStream(std::istream& fin) const ReadResult readTIFStream(std::istream& fin) const
{ {
unsigned char *imageData = NULL; unsigned char *imageData = NULL;
int width_ret; int width_ret = -1;
int height_ret; int height_ret = -1;
int numComponents_ret; int numComponents_ret = -1;
uint16 bitspersample; uint16 bitspersample_ret = 0;
imageData = simage_tiff_load(fin, width_ret, height_ret, numComponents_ret, bitspersample); imageData = simage_tiff_load(fin, width_ret, height_ret, numComponents_ret, bitspersample_ret);
if (imageData==NULL) if (imageData==NULL)
{ {
@ -669,7 +669,7 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
numComponents_ret == 3 ? GL_RGB : numComponents_ret == 3 ? GL_RGB :
numComponents_ret == 4 ? GL_RGBA : (GLenum)-1; numComponents_ret == 4 ? GL_RGBA : (GLenum)-1;
unsigned int dataType = bitspersample==8 ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT; unsigned int dataType = bitspersample_ret==8 ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT;
osg::Image* pOsgImage = new osg::Image; osg::Image* pOsgImage = new osg::Image;
pOsgImage->setImage(s,t,r, pOsgImage->setImage(s,t,r,