diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-10-01 20:47:48 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-02 09:14:49 +0100 |
commit | 173234f394105756b3530f789fb68dec53689a93 (patch) | |
tree | 59435ab308c0eb1b68a8cd21962101db09fc29cf /tools/source | |
parent | b6cff5fae1a91549402bdee55a1077719f7b9c65 (diff) |
coverity#708208 Uninitialized scalar field
Change-Id: I5f1e889746067bad478d8fa3acd8c41c893b135a
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/ref/globname.cxx | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index aaa8b3fc2d0e..5bb60de6a057 100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -27,26 +27,42 @@ #include <tools/globname.hxx> // ImpSvGlobalName ------------------------------------------------------------ - ImpSvGlobalName::ImpSvGlobalName( const ImpSvGlobalName & rObj ) + : szData(rObj.szData) + , nRefCount(0) { - nRefCount = 0; - szData = rObj.szData; } ImpSvGlobalName::ImpSvGlobalName( Empty ) + : nRefCount(1) { - nRefCount = 1; memset( &szData, 0, sizeof( szData ) ); } +ImpSvGlobalName::ImpSvGlobalName(sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, + sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, + sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15) + : nRefCount(0) +{ + szData.Data1 = n1; + szData.Data2 = n2; + szData.Data3 = n3; + szData.Data4[0] = b8; + szData.Data4[1] = b9; + szData.Data4[2] = b10; + szData.Data4[3] = b11; + szData.Data4[4] = b12; + szData.Data4[5] = b13; + szData.Data4[6] = b14; + szData.Data4[7] = b15; +} + bool ImpSvGlobalName::operator == ( const ImpSvGlobalName & rObj ) const { return !memcmp( &szData, &rObj.szData, sizeof( szData ) ); } // SvGlobalName ---------------------------------------------------------------- - SvGlobalName::SvGlobalName() { static ImpSvGlobalName aNoName( ImpSvGlobalName::EMPTY ); @@ -57,28 +73,16 @@ SvGlobalName::SvGlobalName() SvGlobalName::SvGlobalName( const SvGUID & rId ) { - pImp = new ImpSvGlobalName(); + pImp = new ImpSvGlobalName(rId); pImp->nRefCount++; - pImp->szData = rId; } SvGlobalName::SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 ) { - pImp = new ImpSvGlobalName(); + pImp = new ImpSvGlobalName(n1, n2, n3, b8, b9, b10, b11, b12, b13, b14, b15); pImp->nRefCount++; - pImp->szData.Data1 = n1; - pImp->szData.Data2 = n2; - pImp->szData.Data3 = n3; - pImp->szData.Data4[0] = b8; - pImp->szData.Data4[1] = b9; - pImp->szData.Data4[2] = b10; - pImp->szData.Data4[3] = b11; - pImp->szData.Data4[4] = b12; - pImp->szData.Data4[5] = b13; - pImp->szData.Data4[6] = b14; - pImp->szData.Data4[7] = b15; } SvGlobalName::~SvGlobalName() @@ -315,9 +319,8 @@ SvGlobalName::SvGlobalName( const com::sun::star::uno::Sequence < sal_Int8 >& aS aResult.Data4[nInd] = ( sal_uInt8 )aSeq[nInd+8]; } - pImp = new ImpSvGlobalName(); + pImp = new ImpSvGlobalName(aResult); pImp->nRefCount++; - pImp->szData = aResult; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |