Fixed Coverity reported issues.

CID 11834: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _tickLastUpdated is not initialized in this constructor nor in any functions that it calls.
Non-static class member _tmpText is not initialized in this constructor nor in any functions that it calls.

CID 11833: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _tmpText is not initialized in this constructor nor in any functions that it calls.
This commit is contained in:
Robert Osfield 2011-05-06 12:20:48 +00:00
parent 4a3aa2680d
commit 0e56247cd0

View File

@ -358,8 +358,9 @@ struct AveragedValueTextDrawCallback : public virtual osg::Drawable::DrawCallbac
double value; double value;
if (_stats->getAveragedAttribute( _attributeName, value, _averageInInverseSpace)) if (_stats->getAveragedAttribute( _attributeName, value, _averageInInverseSpace))
{ {
sprintf(_tmpText,"%4.2f",value * _multiplier); char tmpText[128];
text->setText(_tmpText); sprintf(tmpText,"%4.2f",value * _multiplier);
text->setText(tmpText);
} }
else else
{ {
@ -374,7 +375,6 @@ struct AveragedValueTextDrawCallback : public virtual osg::Drawable::DrawCallbac
int _frameDelta; int _frameDelta;
bool _averageInInverseSpace; bool _averageInInverseSpace;
double _multiplier; double _multiplier;
mutable char _tmpText[128];
mutable osg::Timer_t _tickLastUpdated; mutable osg::Timer_t _tickLastUpdated;
}; };
@ -406,8 +406,9 @@ struct RawValueTextDrawCallback : public virtual osg::Drawable::DrawCallback
double value; double value;
if (_stats->getAttribute(frameNumber, _attributeName, value)) if (_stats->getAttribute(frameNumber, _attributeName, value))
{ {
sprintf(_tmpText,"%4.2f",value * _multiplier); char tmpText[128];
text->setText(_tmpText); sprintf(tmpText,"%4.2f",value * _multiplier);
text->setText(tmpText);
} }
else else
{ {
@ -421,7 +422,6 @@ struct RawValueTextDrawCallback : public virtual osg::Drawable::DrawCallback
std::string _attributeName; std::string _attributeName;
int _frameDelta; int _frameDelta;
double _multiplier; double _multiplier;
mutable char _tmpText[128];
mutable osg::Timer_t _tickLastUpdated; mutable osg::Timer_t _tickLastUpdated;
}; };
@ -922,7 +922,7 @@ struct FrameMarkerDrawCallback : public virtual osg::Drawable::DrawCallback
struct PagerCallback : public virtual osg::NodeCallback struct PagerCallback : public virtual osg::NodeCallback
{ {
PagerCallback( osgDB::DatabasePager* dp, PagerCallback( osgDB::DatabasePager* dp,
osgText::Text* minValue, osgText::Text* minValue,
osgText::Text* maxValue, osgText::Text* maxValue,
osgText::Text* averageValue, osgText::Text* averageValue,
@ -943,11 +943,13 @@ struct PagerCallback : public virtual osg::NodeCallback
{ {
if (_dp.valid()) if (_dp.valid())
{ {
char tmpText[128];
double value = _dp->getAverageTimeToMergeTiles(); double value = _dp->getAverageTimeToMergeTiles();
if (value>= 0.0 && value <= 1000) if (value>= 0.0 && value <= 1000)
{ {
sprintf(_tmpText,"%4.0f",value * _multiplier); sprintf(tmpText,"%4.0f",value * _multiplier);
_averageValue->setText(_tmpText); _averageValue->setText(tmpText);
} }
else else
{ {
@ -957,8 +959,8 @@ struct PagerCallback : public virtual osg::NodeCallback
value = _dp->getMinimumTimeToMergeTile(); value = _dp->getMinimumTimeToMergeTile();
if (value>= 0.0 && value <= 1000) if (value>= 0.0 && value <= 1000)
{ {
sprintf(_tmpText,"%4.0f",value * _multiplier); sprintf(tmpText,"%4.0f",value * _multiplier);
_minValue->setText(_tmpText); _minValue->setText(tmpText);
} }
else else
{ {
@ -968,19 +970,19 @@ struct PagerCallback : public virtual osg::NodeCallback
value = _dp->getMaximumTimeToMergeTile(); value = _dp->getMaximumTimeToMergeTile();
if (value>= 0.0 && value <= 1000) if (value>= 0.0 && value <= 1000)
{ {
sprintf(_tmpText,"%4.0f",value * _multiplier); sprintf(tmpText,"%4.0f",value * _multiplier);
_maxValue->setText(_tmpText); _maxValue->setText(tmpText);
} }
else else
{ {
_maxValue->setText(""); _maxValue->setText("");
} }
sprintf(_tmpText,"%4d", _dp->getFileRequestListSize()); sprintf(tmpText,"%4d", _dp->getFileRequestListSize());
_filerequestlist->setText(_tmpText); _filerequestlist->setText(tmpText);
sprintf(_tmpText,"%4d", _dp->getDataToCompileListSize()); sprintf(tmpText,"%4d", _dp->getDataToCompileListSize());
_compilelist->setText(_tmpText); _compilelist->setText(tmpText);
} }
traverse(node,nv); traverse(node,nv);
@ -993,9 +995,7 @@ struct PagerCallback : public virtual osg::NodeCallback
osg::ref_ptr<osgText::Text> _averageValue; osg::ref_ptr<osgText::Text> _averageValue;
osg::ref_ptr<osgText::Text> _filerequestlist; osg::ref_ptr<osgText::Text> _filerequestlist;
osg::ref_ptr<osgText::Text> _compilelist; osg::ref_ptr<osgText::Text> _compilelist;
double _multiplier; double _multiplier;
char _tmpText[128];
osg::Timer_t _tickLastUpdated;
}; };