diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-23 11:06:22 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-23 19:54:06 +0100 |
commit | ad9871a5d1119593068f7e3a01d4249b4dff982a (patch) | |
tree | 70edfa451e9b739b3d01d5ad354c4bd8846b1ba0 /basic/source | |
parent | 429072614e3c1d4bc0f9ca706414a43040464fe4 (diff) |
Introduce SbxValues::clear
...to avoid upcoming GCC 8 -Werror=class-memaccess ("clearing an object of non-
trivial type ‘struct SbxValues’")
Change-Id: Icf610e692b81030bfd6f2f940c43ee8bf6f1d4e0
Reviewed-on: https://gerrit.libreoffice.org/48389
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index dcf336544c3e..0f609d866135 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -44,8 +44,7 @@ SbxValue::SbxValue( SbxDataType t ) : SbxBase() n = SbxEMPTY; else SetFlag( SbxFlagBits::Fixed ); - memset( &aData, 0, sizeof( SbxValues ) ); - aData.eType = SbxDataType( n ); + aData.clear(SbxDataType( n )); } SbxValue::SbxValue( const SbxValue& r ) @@ -172,8 +171,7 @@ void SbxValue::Clear() default: { SbxValues aEmpty; - memset( &aEmpty, 0, sizeof( SbxValues ) ); - aEmpty.eType = GetType(); + aEmpty.clear(GetType()); Put( aEmpty ); } } @@ -341,8 +339,7 @@ bool SbxValue::Get( SbxValues& rRes ) const { // Object contained itself SbxDataType eTemp = rRes.eType; - memset( &rRes, 0, sizeof( SbxValues ) ); - rRes.eType = eTemp; + rRes.clear(eTemp); } } if( !IsError() ) @@ -753,9 +750,7 @@ bool SbxValue::SetType( SbxDataType t ) break; default: break; } - // This works always, because the Float representations are 0 as well. - memset( &aData, 0, sizeof( SbxValues ) ); - aData.eType = t; + aData.clear(t); } } return true; @@ -1502,9 +1497,8 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) case SbxWCHAR: break; default: - memset (&aData,0,sizeof(aData)); + aData.clear(SbxNULL); ResetFlag(SbxFlagBits::Fixed); - aData.eType = SbxNULL; SAL_WARN( "basic.sbx", "Loaded a non-supported data type" ); return false; |