From de74d98c58db604aafc0ee623c252f3aa25ac4b7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 20 Sep 2020 12:53:27 +0100 Subject: OUStringLiteral/OStringLiteral coverity PARSE_ERROR workaround MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit do more like commit 121771e37f7e2de41cd5643475861062bf25627b Date: Mon Sep 21 09:17:54 2020 +0200 Make some OUStringLiteral vars constexpr cause coverity can live with that Change-Id: I9efd7f848289c4865997a44c6780373068422227 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103147 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- oox/source/core/xmlfilterbase.cxx | 6 +++--- oox/source/crypto/Standard2007Engine.cxx | 2 +- oox/source/helper/modelobjecthelper.cxx | 10 +++++----- oox/source/ole/vbacontrol.cxx | 2 +- oox/source/vml/vmlinputstream.cxx | 4 ++-- oox/source/vml/vmlshapecontext.cxx | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) (limited to 'oox') diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index adf132dded13..dbc419c28a3e 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -181,7 +181,7 @@ struct XmlFilterBaseImpl explicit XmlFilterBaseImpl(); }; -const OUStringLiteral gaBinSuffix( u".bin" ); +constexpr OUStringLiteral gaBinSuffix( u".bin" ); XmlFilterBaseImpl::XmlFilterBaseImpl() : mrNamespaceMap(StaticNamespaceMap::get()) @@ -248,7 +248,7 @@ void XmlFilterBase::putPropertiesToDocumentGrabBag(const css::uno::Reference xPropsInfo = xDocProps->getPropertySetInfo(); - static const OUStringLiteral aGrabBagPropName = u"InteropGrabBag"; + static constexpr OUStringLiteral aGrabBagPropName = u"InteropGrabBag"; if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(aGrabBagPropName)) { // get existing grab bag @@ -1041,7 +1041,7 @@ void XmlFilterBase::exportCustomFragments() uno::Reference xPropSet(xModel, uno::UNO_QUERY_THROW); uno::Reference xPropSetInfo = xPropSet->getPropertySetInfo(); - static const OUStringLiteral aName = u"" UNO_NAME_MISC_OBJ_INTEROPGRABBAG; + static constexpr OUStringLiteral aName = u"" UNO_NAME_MISC_OBJ_INTEROPGRABBAG; if (!xPropSetInfo->hasPropertyByName(aName)) return; diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx index ebfac58ee3f8..ec9269e771fc 100644 --- a/oox/source/crypto/Standard2007Engine.cxx +++ b/oox/source/crypto/Standard2007Engine.cxx @@ -32,7 +32,7 @@ void lclRandomGenerateValues(sal_uInt8* aArray, sal_uInt32 aSize) rtl_random_destroyPool(aRandomPool); } -const OUStringLiteral lclCspName = u"Microsoft Enhanced RSA and AES Cryptographic Provider"; +constexpr OUStringLiteral lclCspName = u"Microsoft Enhanced RSA and AES Cryptographic Provider"; constexpr const sal_uInt32 AES128Size = 16; } // end anonymous namespace diff --git a/oox/source/helper/modelobjecthelper.cxx b/oox/source/helper/modelobjecthelper.cxx index da84bd63c6c8..c5115bba3e7c 100644 --- a/oox/source/helper/modelobjecthelper.cxx +++ b/oox/source/helper/modelobjecthelper.cxx @@ -88,11 +88,11 @@ void ObjectContainer::createContainer() const OSL_ENSURE( mxContainer.is(), "ObjectContainer::createContainer - container not found" ); } -const OUStringLiteral gaDashNameBase( u"msLineDash " ); ///< Base name for all named line dashes. -const OUStringLiteral gaGradientNameBase( u"msFillGradient " ); ///< Base name for all named fill gradients. -const OUStringLiteral gaTransGradNameBase( u"msTransGradient " ); ///< Base name for all named fill gradients. -const OUStringLiteral gaBitmapUrlNameBase( u"msFillBitmap " ); ///< Base name for all named fill bitmap URLs. -const OUStringLiteral gaHatchNameBase( u"msFillHatch " ); ///< Base name for all named fill hatches. +constexpr OUStringLiteral gaDashNameBase( u"msLineDash " ); ///< Base name for all named line dashes. +constexpr OUStringLiteral gaGradientNameBase( u"msFillGradient " ); ///< Base name for all named fill gradients. +constexpr OUStringLiteral gaTransGradNameBase( u"msTransGradient " ); ///< Base name for all named fill gradients. +constexpr OUStringLiteral gaBitmapUrlNameBase( u"msFillBitmap " ); ///< Base name for all named fill bitmap URLs. +constexpr OUStringLiteral gaHatchNameBase( u"msFillHatch " ); ///< Base name for all named fill hatches. ModelObjectHelper::ModelObjectHelper( const Reference< XMultiServiceFactory >& rxModelFactory ) : maMarkerContainer( rxModelFactory, "com.sun.star.drawing.MarkerTable" ), diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 18bcb2226805..1b85c27dd6f6 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -100,7 +100,7 @@ private: sal_Int32 mnIndex; }; -const OUStringLiteral gaDummyBaseName( u"DummyGroupSep" ); +constexpr OUStringLiteral gaDummyBaseName( u"DummyGroupSep" ); VbaControlNamesSet::VbaControlNamesSet() : mnIndex( 0 ) diff --git a/oox/source/vml/vmlinputstream.cxx b/oox/source/vml/vmlinputstream.cxx index 72bceb6e4016..cdb8b9724ec6 100644 --- a/oox/source/vml/vmlinputstream.cxx +++ b/oox/source/vml/vmlinputstream.cxx @@ -263,8 +263,8 @@ bool lclProcessCharacters( OStringBuffer& rBuffer, const OString& rChars ) } // namespace -const OStringLiteral gaOpeningCData( "" ); +constexpr OStringLiteral gaOpeningCData( "" ); InputStream::InputStream( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm ) : // use single-byte ISO-8859-1 encoding which maps all byte characters to the first 256 Unicode characters diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 6613f476930a..5ade9c17bd93 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -290,7 +290,7 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper const & rParent, { mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() ); // get ShapeType and ShapeId from name for compatibility - static const OUStringLiteral sShapeTypePrefix = u"shapetype_"; + static constexpr OUStringLiteral sShapeTypePrefix = u"shapetype_"; if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) ) { mrTypeModel.maShapeId = mrTypeModel.maShapeName; -- cgit