diff options
author | Noel Grandin <noel@peralex.com> | 2016-09-29 12:43:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-09-30 06:57:26 +0000 |
commit | 4d87443bf59c3242d58b56cc1583d73213ae1f2f (patch) | |
tree | c1f74fc569506299100b5063f14c09e46035a943 /basic | |
parent | 8e812b87ff7f8c5bf2c6f8858646c55effd2eea3 (diff) |
loplugin:constantparam
Change-Id: Idbe8c8e6b3d44cacce296ec8c79b2b244281057c
Reviewed-on: https://gerrit.libreoffice.org/29321
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 43 | ||||
-rw-r--r-- | basic/source/sbx/sbxvar.cxx | 2 |
2 files changed, 4 insertions, 41 deletions
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 5e6195ddc420..2183d16ad38e 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -36,52 +36,15 @@ SbxValue::SbxValue() : SbxBase() aData.eType = SbxEMPTY; } -SbxValue::SbxValue( SbxDataType t, void* p ) : SbxBase() +SbxValue::SbxValue( SbxDataType t ) : SbxBase() { int n = t & 0x0FFF; - if( p ) - n |= SbxBYREF; + if( n == SbxVARIANT ) n = SbxEMPTY; else SetFlag( SbxFlagBits::Fixed ); - if( p ) - { - switch( t & 0x0FFF ) - { - case SbxINTEGER: n |= SbxBYREF; aData.pInteger = static_cast<sal_Int16*>(p); break; - case SbxSALUINT64: n |= SbxBYREF; aData.puInt64 = static_cast<sal_uInt64*>(p); break; - case SbxSALINT64: - case SbxCURRENCY: n |= SbxBYREF; aData.pnInt64 = static_cast<sal_Int64*>(p); break; - case SbxLONG: n |= SbxBYREF; aData.pLong = static_cast<sal_Int32*>(p); break; - case SbxSINGLE: n |= SbxBYREF; aData.pSingle = static_cast<float*>(p); break; - case SbxDATE: - case SbxDOUBLE: n |= SbxBYREF; aData.pDouble = static_cast<double*>(p); break; - case SbxSTRING: n |= SbxBYREF; aData.pOUString = static_cast<OUString*>(p); break; - case SbxERROR: - case SbxUSHORT: - case SbxBOOL: n |= SbxBYREF; aData.pUShort = static_cast<sal_uInt16*>(p); break; - case SbxULONG: n |= SbxBYREF; aData.pULong = static_cast<sal_uInt32*>(p); break; - case SbxCHAR: n |= SbxBYREF; aData.pChar = static_cast<sal_Unicode*>(p); break; - case SbxBYTE: n |= SbxBYREF; aData.pByte = static_cast<sal_uInt8*>(p); break; - case SbxINT: n |= SbxBYREF; aData.pInt = static_cast<int*>(p); break; - case SbxOBJECT: - aData.pObj = static_cast<SbxBase*>(p); - if( p ) - aData.pObj->AddFirstRef(); - break; - case SbxDECIMAL: - aData.pDecimal = static_cast<SbxDecimal*>(p); - if( p ) - aData.pDecimal->addRef(); - break; - default: - SAL_WARN( "basic", "Improper pointer argument" ); - n = SbxNULL; - } - } - else - memset( &aData, 0, sizeof( SbxValues ) ); + memset( &aData, 0, sizeof( SbxValues ) ); aData.eType = SbxDataType( n ); } diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 908c88f4d2c4..ff8c7e07fccc 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -116,7 +116,7 @@ void SbxEnsureParentVariable::SetParent(SbxObject* p) assert(GetParent() == xParent.get()); } -SbxVariable::SbxVariable( SbxDataType t ) : SbxValue( t, nullptr ) +SbxVariable::SbxVariable( SbxDataType t ) : SbxValue( t ) { pCst = nullptr; pParent = nullptr; |