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/09 18:24:53 UTC
[openoffice] branch AOO41X updated: bool strangeness...
This is an automated email from the ASF dual-hosted git repository.
jim pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO41X by this push:
new 4082994 bool strangeness...
4082994 is described below
commit 4082994dab2988e0b38b5f8025ee41e2a873bc79
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 | 6 +++---
main/starmath/source/mathmlexport.cxx | 4 +---
main/sw/source/filter/xml/wrtxml.cxx | 3 +--
main/xmloff/source/core/xmlexp.cxx | 15 +++++++++++----
5 files changed, 19 insertions(+), 14 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 e1d125b..23bce5f 100644
--- a/main/cppu/inc/com/sun/star/uno/Any.hxx
+++ b/main/cppu/inc/com/sun/star/uno/Any.hxx
@@ -250,10 +250,10 @@ inline sal_Bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
{
value = *reinterpret_cast< sal_Bool const * >(
- &rAny.pReserved ) != sal_False;
- return true;
+ rAny.pData ) != sal_False;
+ return sal_True;
}
- return false;
+ return sal_False;
}
//______________________________________________________________________________
diff --git a/main/starmath/source/mathmlexport.cxx b/main/starmath/source/mathmlexport.cxx
index 3f36ff1..00b301d 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 4a867ca..c90c2d0 100644
--- a/main/xmloff/source/core/xmlexp.cxx
+++ b/main/xmloff/source/core/xmlexp.cxx
@@ -700,10 +700,17 @@ 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)))