summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-05-03 15:26:01 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-05-03 15:26:01 +0200
commit0b1e4a306705d8c25db6e233244101ba6c4c16b6 (patch)
treee3ce34a2d884bb5469aa0e15e8d66b6aa08a876e /svl
parentab3d2e568fe1595584c66c2ff07843e72f608944 (diff)
Prevent Any::setValue from reinterpreting bool* as sal_Bool*
...which only happens ot work in environments where sizeof (bool) == 1. The simpler alternative is to use the operator <<= template without passing explicit UNO type information, anyway. The std::nullptr_t overloads are needed to disambiguate calls with a nullptr argument. (Which can at least be meaningful for VOID, but for other types what it happens to do is store a default value of the given type.) As std::nullptr_t is only C++11, this all needs to be LIBO_INTERNAL_ONLY. Change-Id: Iff06a6ba94250bd4ae4afc937c2a2bfa75f0888f
Diffstat (limited to 'svl')
-rw-r--r--svl/source/config/cjkoptions.cxx19
-rw-r--r--svl/source/config/ctloptions.cxx10
-rw-r--r--svl/source/numbers/numfmuno.cxx25
3 files changed, 24 insertions, 30 deletions
diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx
index 906250174d41..3c7d9f201cc6 100644
--- a/svl/source/config/cjkoptions.cxx
+++ b/svl/source/config/cjkoptions.cxx
@@ -246,7 +246,6 @@ void SvtCJKOptions_Impl::ImplCommit()
Any* pValues = aValues.getArray();
sal_Int32 nRealCount = 0;
- const Type& rType = cppu::UnoType<bool>::get();
for(int nProp = 0; nProp < nOrgCount; nProp++)
{
switch(nProp)
@@ -256,7 +255,7 @@ void SvtCJKOptions_Impl::ImplCommit()
if (!bROCJKFont)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bCJKFont, rType);
+ pValues[nRealCount] <<= bCJKFont;
++nRealCount;
}
}
@@ -267,7 +266,7 @@ void SvtCJKOptions_Impl::ImplCommit()
if (!bROVerticalText)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bVerticalText, rType);
+ pValues[nRealCount] <<= bVerticalText;
++nRealCount;
}
}
@@ -278,7 +277,7 @@ void SvtCJKOptions_Impl::ImplCommit()
if (!bROAsianTypography)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bAsianTypography, rType);
+ pValues[nRealCount] <<= bAsianTypography;
++nRealCount;
}
}
@@ -289,7 +288,7 @@ void SvtCJKOptions_Impl::ImplCommit()
if (!bROJapaneseFind)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bJapaneseFind, rType);
+ pValues[nRealCount] <<= bJapaneseFind;
++nRealCount;
}
}
@@ -300,7 +299,7 @@ void SvtCJKOptions_Impl::ImplCommit()
if (!bRORuby)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bRuby, rType);
+ pValues[nRealCount] <<= bRuby;
++nRealCount;
}
}
@@ -311,7 +310,7 @@ void SvtCJKOptions_Impl::ImplCommit()
if (!bROChangeCaseMap)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bChangeCaseMap, rType);
+ pValues[nRealCount] <<= bChangeCaseMap;
++nRealCount;
}
}
@@ -322,7 +321,7 @@ void SvtCJKOptions_Impl::ImplCommit()
if (!bRODoubleLines)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bDoubleLines, rType);
+ pValues[nRealCount] <<= bDoubleLines;
++nRealCount;
}
}
@@ -333,7 +332,7 @@ void SvtCJKOptions_Impl::ImplCommit()
if (!bROEmphasisMarks)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bEmphasisMarks, rType);
+ pValues[nRealCount] <<= bEmphasisMarks;
++nRealCount;
}
}
@@ -344,7 +343,7 @@ void SvtCJKOptions_Impl::ImplCommit()
if (!bROVerticalCallOut)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bVerticalCallOut, rType);
+ pValues[nRealCount] <<= bVerticalCallOut;
++nRealCount;
}
}
diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx
index 7aed551e926a..d95d4c5e7723 100644
--- a/svl/source/config/ctloptions.cxx
+++ b/svl/source/config/ctloptions.cxx
@@ -150,8 +150,6 @@ void SvtCTLOptions_Impl::ImplCommit()
Any* pValues = aValues.getArray();
sal_Int32 nRealCount = 0;
- const uno::Type& rType = cppu::UnoType<bool>::get();
-
for ( int nProp = 0; nProp < nOrgCount; nProp++ )
{
switch ( nProp )
@@ -161,7 +159,7 @@ void SvtCTLOptions_Impl::ImplCommit()
if (!m_bROCTLFontEnabled)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue( &m_bCTLFontEnabled, rType );
+ pValues[nRealCount] <<= m_bCTLFontEnabled;
++nRealCount;
}
}
@@ -172,7 +170,7 @@ void SvtCTLOptions_Impl::ImplCommit()
if (!m_bROCTLSequenceChecking)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue( &m_bCTLSequenceChecking, rType );
+ pValues[nRealCount] <<= m_bCTLSequenceChecking;
++nRealCount;
}
}
@@ -205,7 +203,7 @@ void SvtCTLOptions_Impl::ImplCommit()
if (!m_bROCTLRestricted)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue( &m_bCTLRestricted, rType );
+ pValues[nRealCount] <<= m_bCTLRestricted;
++nRealCount;
}
}
@@ -215,7 +213,7 @@ void SvtCTLOptions_Impl::ImplCommit()
if(!m_bROCTLTypeAndReplace)
{
pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue( &m_bCTLTypeAndReplace, rType );
+ pValues[nRealCount] <<= m_bCTLTypeAndReplace;
++nRealCount;
}
}
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 368dde3e3174..0f87d6809b5e 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -737,13 +737,11 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const OUString& aProperty
else if (aPropertyName == PROPERTYNAME_STDFORM)
{
//! Pass through SvNumberformat Member bStandard?
- sal_Bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
- aRet.setValue( &bStandard, cppu::UnoType<bool>::get() );
+ aRet <<= ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
}
else if (aPropertyName == PROPERTYNAME_USERDEF)
{
- sal_Bool bUserDef = ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 );
- aRet.setValue( &bUserDef, cppu::UnoType<bool>::get() );
+ aRet <<= ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 );
}
else if (aPropertyName == PROPERTYNAME_DECIMALS)
{
@@ -758,12 +756,12 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const OUString& aProperty
else if (aPropertyName == PROPERTYNAME_NEGRED)
{
pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
- aRet.setValue( &bRed, cppu::UnoType<bool>::get() );
+ aRet <<= bRed;
}
else if (aPropertyName == PROPERTYNAME_THOUS)
{
pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
- aRet.setValue( &bThousand, cppu::UnoType<bool>::get() );
+ aRet <<= bThousand;
}
else if (aPropertyName == PROPERTYNAME_CURRSYM)
{
@@ -852,9 +850,9 @@ uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValue
OUString aFmtStr = pFormat->GetFormatstring();
OUString aComment = pFormat->GetComment();
- sal_Bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
+ bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
//! Pass through SvNumberformat Member bStandard?
- sal_Bool bUserDef = ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 );
+ bool bUserDef = ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 );
bool bThousand, bRed;
sal_uInt16 nDecimals, nLeading;
pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
@@ -872,17 +870,17 @@ uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValue
pArray[3].Name = PROPERTYNAME_COMMENT;
pArray[3].Value <<= aComment;
pArray[4].Name = PROPERTYNAME_STDFORM;
- pArray[4].Value.setValue( &bStandard, cppu::UnoType<bool>::get() );
+ pArray[4].Value <<= bStandard;
pArray[5].Name = PROPERTYNAME_USERDEF;
- pArray[5].Value.setValue( &bUserDef, cppu::UnoType<bool>::get() );
+ pArray[5].Value <<= bUserDef;
pArray[6].Name = PROPERTYNAME_DECIMALS;
pArray[6].Value <<= (sal_Int16)( nDecimals );
pArray[7].Name = PROPERTYNAME_LEADING;
pArray[7].Value <<= (sal_Int16)( nLeading );
pArray[8].Name = PROPERTYNAME_NEGRED;
- pArray[8].Value.setValue( &bRed, cppu::UnoType<bool>::get() );
+ pArray[8].Value <<= bRed;
pArray[9].Name = PROPERTYNAME_THOUS;
- pArray[9].Value.setValue( &bThousand, cppu::UnoType<bool>::get() );
+ pArray[9].Value <<= bThousand;
pArray[10].Name = PROPERTYNAME_CURRSYM;
pArray[10].Value <<= aSymbol;
pArray[11].Name = PROPERTYNAME_CURREXT;
@@ -1001,8 +999,7 @@ uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const OUString& a
{
if (aPropertyName == PROPERTYNAME_NOZERO)
{
- sal_Bool bNoZero = pFormatter->GetNoZero();
- aRet.setValue( &bNoZero, cppu::UnoType<bool>::get() );
+ aRet <<= pFormatter->GetNoZero();
}
else if (aPropertyName == PROPERTYNAME_NULLDATE)
{