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