Fixed Coverity reported issue.

CID 11844: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _defaultValue is not initialized in this constructor nor in any functions that it calls.
Index: ../include/osgDB/Serializer
This commit is contained in:
Robert Osfield 2011-05-05 12:37:00 +00:00
parent f0b0a8788b
commit fbfc19d3ec

View File

@ -197,8 +197,9 @@ template<typename P>
class TemplateSerializer : public BaseSerializer class TemplateSerializer : public BaseSerializer
{ {
public: public:
TemplateSerializer( const char* name )
: BaseSerializer(), _name(name) {} TemplateSerializer( const char* name, P def)
: BaseSerializer(), _name(name), _defaultValue(def) {}
virtual bool read( InputStream& is, osg::Object& obj ) = 0; virtual bool read( InputStream& is, osg::Object& obj ) = 0;
virtual bool write( OutputStream& os, const osg::Object& obj ) = 0; virtual bool write( OutputStream& os, const osg::Object& obj ) = 0;
@ -218,8 +219,7 @@ public:
typedef void (C::*Setter)( P ); typedef void (C::*Setter)( P );
PropByValSerializer( const char* name, P def, Getter gf, Setter sf, bool useHex=false ) PropByValSerializer( const char* name, P def, Getter gf, Setter sf, bool useHex=false )
: ParentType(name), _getter(gf), _setter(sf), _useHex(useHex) : ParentType(name, def), _getter(gf), _setter(sf), _useHex(useHex) {}
{ ParentType::_defaultValue = def; }
virtual bool read( InputStream& is, osg::Object& obj ) virtual bool read( InputStream& is, osg::Object& obj )
{ {
@ -278,8 +278,7 @@ public:
typedef void (C::*Setter)( CP ); typedef void (C::*Setter)( CP );
PropByRefSerializer( const char* name, CP def, Getter gf, Setter sf ) PropByRefSerializer( const char* name, CP def, Getter gf, Setter sf )
: ParentType(name), _getter(gf), _setter(sf) : ParentType(name, def), _getter(gf), _setter(sf) {}
{ ParentType::_defaultValue = def; }
virtual bool read( InputStream& is, osg::Object& obj ) virtual bool read( InputStream& is, osg::Object& obj )
{ {
@ -328,8 +327,7 @@ public:
typedef void (C::*Setter)( const osg::Matrix& ); typedef void (C::*Setter)( const osg::Matrix& );
MatrixSerializer( const char* name, const osg::Matrix& def, Getter gf, Setter sf ) MatrixSerializer( const char* name, const osg::Matrix& def, Getter gf, Setter sf )
: ParentType(name), _getter(gf), _setter(sf) : ParentType(name, def), _getter(gf), _setter(sf) {}
{ ParentType::_defaultValue = def; }
virtual bool read( InputStream& is, osg::Object& obj ) virtual bool read( InputStream& is, osg::Object& obj )
{ {
@ -398,8 +396,7 @@ public:
typedef void (C::*Setter)( P ); typedef void (C::*Setter)( P );
GLenumSerializer( const char* name, P def, Getter gf, Setter sf ) GLenumSerializer( const char* name, P def, Getter gf, Setter sf )
: ParentType(name), _getter(gf), _setter(sf) : ParentType(name, def), _getter(gf), _setter(sf) {}
{ ParentType::_defaultValue = def; }
virtual bool read( InputStream& is, osg::Object& obj ) virtual bool read( InputStream& is, osg::Object& obj )
{ {
@ -447,8 +444,7 @@ public:
typedef void (C::*Setter)( const std::string& ); typedef void (C::*Setter)( const std::string& );
StringSerializer( const char* name, const std::string& def, Getter gf, Setter sf ) StringSerializer( const char* name, const std::string& def, Getter gf, Setter sf )
: ParentType(name), _getter(gf), _setter(sf) : ParentType(name, def), _getter(gf), _setter(sf) {}
{ ParentType::_defaultValue = def; }
virtual bool read( InputStream& is, osg::Object& obj ) virtual bool read( InputStream& is, osg::Object& obj )
{ {
@ -500,8 +496,7 @@ public:
typedef void (C::*Setter)( P* ); typedef void (C::*Setter)( P* );
ObjectSerializer( const char* name, P* def, Getter gf, Setter sf ) ObjectSerializer( const char* name, P* def, Getter gf, Setter sf )
: ParentType(name), _getter(gf), _setter(sf) : ParentType(name, def), _getter(gf), _setter(sf) {}
{ ParentType::_defaultValue = def; }
virtual bool read( InputStream& is, osg::Object& obj ) virtual bool read( InputStream& is, osg::Object& obj )
{ {
@ -570,8 +565,7 @@ public:
typedef void (C::*Setter)( P* ); typedef void (C::*Setter)( P* );
ImageSerializer( const char* name, P* def, Getter gf, Setter sf ) ImageSerializer( const char* name, P* def, Getter gf, Setter sf )
: ParentType(name), _getter(gf), _setter(sf) : ParentType(name, def), _getter(gf), _setter(sf) {}
{ ParentType::_defaultValue = def; }
virtual bool read( InputStream& is, osg::Object& obj ) virtual bool read( InputStream& is, osg::Object& obj )
{ {
@ -640,8 +634,7 @@ public:
typedef B (C::*Setter)( P ); typedef B (C::*Setter)( P );
EnumSerializer( const char* name, P def, Getter gf, Setter sf ) EnumSerializer( const char* name, P def, Getter gf, Setter sf )
: ParentType(name), _getter(gf), _setter(sf) : ParentType(name, def), _getter(gf), _setter(sf) {}
{ ParentType::_defaultValue = def; }
void add( const char* str, P value ) void add( const char* str, P value )
{ _lookup.add(str, static_cast<IntLookup::Value>(value)); } { _lookup.add(str, static_cast<IntLookup::Value>(value)); }