You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ji...@apache.org on 2021/08/05 18:51:26 UTC
[openoffice] branch AOO42X updated: bool strangeness...
This is an automated email from the ASF dual-hosted git repository.
jim pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push:
new 1912a40 bool strangeness...
1912a40 is described below
commit 1912a40296ec0b01eeab2b1cc126c3631f8869c8
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Thu Aug 5 14:49:43 2021 -0400
bool strangeness...
(cherry picked from commit 70aac8b51665545813b3f6de032a774876a9e74d)
---
main/comphelper/inc/comphelper/extract.hxx | 5 +++--
main/cppu/inc/com/sun/star/uno/Any.hxx | 4 ++--
main/starmath/source/mathmlexport.cxx | 4 +---
main/sw/source/filter/xml/wrtxml.cxx | 3 +--
main/xmloff/source/core/xmlexp.cxx | 16 ++++++++++++----
5 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/main/comphelper/inc/comphelper/extract.hxx b/main/comphelper/inc/comphelper/extract.hxx
index dc67c5d..fc75fa9 100644
--- a/main/comphelper/inc/comphelper/extract.hxx
+++ b/main/comphelper/inc/comphelper/extract.hxx
@@ -131,9 +131,10 @@ inline sal_Bool SAL_CALL extractInterface(
inline sal_Bool SAL_CALL any2bool( const ::com::sun::star::uno::Any & rAny )
throw( ::com::sun::star::lang::IllegalArgumentException )
{
- if (rAny.getValueTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN)
+ sal_Bool sValue;
+ if ( rAny >>= sValue)
{
- return *(sal_Bool *)rAny.getValue();
+ return sValue;
}
else
{
diff --git a/main/cppu/inc/com/sun/star/uno/Any.hxx b/main/cppu/inc/com/sun/star/uno/Any.hxx
index 0ae5391..62213e2 100644
--- a/main/cppu/inc/com/sun/star/uno/Any.hxx
+++ b/main/cppu/inc/com/sun/star/uno/Any.hxx
@@ -251,9 +251,9 @@ inline sal_Bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
{
value = *reinterpret_cast< sal_Bool const * >(
rAny.pData ) != sal_False;
- return true;
+ return sal_True;
}
- return false;
+ return sal_False;
}
//______________________________________________________________________________
diff --git a/main/starmath/source/mathmlexport.cxx b/main/starmath/source/mathmlexport.cxx
index 486b2ff..1ee3512 100644
--- a/main/starmath/source/mathmlexport.cxx
+++ b/main/starmath/source/mathmlexport.cxx
@@ -169,9 +169,7 @@ sal_Bool SmXMLExportWrapper::Export(SfxMedium &rMedium)
SvtSaveOptions aSaveOpt;
OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
sal_Bool bUsePrettyPrinting( bFlat || aSaveOpt.IsPrettyPrinting() );
- Any aAny;
- aAny.setValue( &bUsePrettyPrinting, ::getBooleanCppuType() );
- xInfoSet->setPropertyValue( sUsePrettyPrinting, aAny );
+ xInfoSet->setPropertyValue( sUsePrettyPrinting, uno::makeAny(bUsePrettyPrinting));
// Set base URI
OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("BaseURI") );
diff --git a/main/sw/source/filter/xml/wrtxml.cxx b/main/sw/source/filter/xml/wrtxml.cxx
index e288bfc..7677f86 100644
--- a/main/sw/source/filter/xml/wrtxml.cxx
+++ b/main/sw/source/filter/xml/wrtxml.cxx
@@ -207,8 +207,7 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg,
SvtSaveOptions aSaveOpt;
OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() );
- aAny.setValue( &bUsePrettyPrinting, ::getBooleanCppuType() );
- xInfoSet->setPropertyValue( sUsePrettyPrinting, aAny );
+ xInfoSet->setPropertyValue( sUsePrettyPrinting, uno::makeAny(bUsePrettyPrinting));
// save show redline mode ...
OUString sShowChanges(RTL_CONSTASCII_USTRINGPARAM("ShowChanges"));
diff --git a/main/xmloff/source/core/xmlexp.cxx b/main/xmloff/source/core/xmlexp.cxx
index 932574b..790afe0 100644
--- a/main/xmloff/source/core/xmlexp.cxx
+++ b/main/xmloff/source/core/xmlexp.cxx
@@ -700,10 +700,18 @@ void SAL_CALL SvXMLExport::setSourceDocument( const uno::Reference< lang::XCompo
if (xPropertySetInfo->hasPropertyByName(sUsePrettyPrinting))
{
uno::Any aAny = mxExportInfo->getPropertyValue(sUsePrettyPrinting);
- if (::cppu::any2bool(aAny))
- mnExportFlags |= EXPORT_PRETTY;
- else
- mnExportFlags &= ~EXPORT_PRETTY;
+ try
+ {
+ if (::cppu::any2bool(aAny))
+ mnExportFlags |= EXPORT_PRETTY;
+ else
+ mnExportFlags &= ~EXPORT_PRETTY;
+ }
+ }
+ catch ( lang::IllegalArgumentException& )
+ {
+ DBG_ERRORFILE("why is bUsePrettyPrint not boolean?");
+ }
}
if (mpNumExport && (mnExportFlags & (EXPORT_AUTOSTYLES | EXPORT_STYLES)))