diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-23 12:34:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-26 13:12:31 +0200 |
commit | 0193b284e880a659ab73160e42238e1d5fe5cf8f (patch) | |
tree | da09299838a6afb43d7c601803a6bab787489854 /oox | |
parent | 2ef138de767c312188d41a7f206234eafac3108b (diff) |
new loplugin:constexprliteral
OUStringLiteral should be declared constexpr, to enforce
that it is initialised at compile-time and not runtime.
This seems to make a different at least on Visual Studio
Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/core/filterbase.cxx | 6 | ||||
-rw-r--r-- | oox/source/drawingml/customshapeproperties.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/fontworkhelpers.cxx | 6 | ||||
-rw-r--r-- | oox/source/drawingml/hyperlinkcontext.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 2 | ||||
-rw-r--r-- | oox/source/export/shapes.cxx | 2 | ||||
-rw-r--r-- | oox/source/helper/propertymap.cxx | 2 | ||||
-rw-r--r-- | oox/source/ole/vbacontrol.cxx | 2 | ||||
-rw-r--r-- | oox/source/ole/vbaexport.cxx | 2 | ||||
-rw-r--r-- | oox/source/ppt/pptshape.cxx | 2 | ||||
-rw-r--r-- | oox/source/ppt/presentationfragmenthandler.cxx | 4 | ||||
-rw-r--r-- | oox/source/ppt/slidepersist.cxx | 8 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 2 |
13 files changed, 23 insertions, 23 deletions
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index cc00953685a0..105cb0660b7b 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -269,10 +269,10 @@ OUString FilterBase::getAbsoluteUrl( const OUString& rUrl ) const { // handle some special cases before calling ::rtl::Uri::convertRelToAbs() - static const OUStringLiteral aFileSchema = u"file:"; - static const OUStringLiteral aFilePrefix = u"file:///"; + static constexpr OUStringLiteral aFileSchema = u"file:"; + static constexpr OUStringLiteral aFilePrefix = u"file:///"; const sal_Int32 nFilePrefixLen = aFilePrefix.getLength(); - static const OUStringLiteral aUncPrefix = u"//"; + static constexpr OUStringLiteral aUncPrefix = u"//"; /* (1) convert all backslashes to slashes, and check that passed URL is not empty. */ diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 9cdbb4ee8801..ac6fba8e7d53 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -134,8 +134,8 @@ void CustomShapeProperties::pushToPropSet( if ( !maAdjustmentGuideList.empty() ) { - static const OUStringLiteral sCustomShapeGeometry(u"CustomShapeGeometry"); - static const OUStringLiteral sAdjustmentValues(u"AdjustmentValues"); + static constexpr OUStringLiteral sCustomShapeGeometry(u"CustomShapeGeometry"); + static constexpr OUStringLiteral sAdjustmentValues(u"AdjustmentValues"); uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry ); uno::Sequence< beans::PropertyValue > aGeoPropSeq; if ( aGeoPropSet >>= aGeoPropSeq ) diff --git a/oox/source/drawingml/fontworkhelpers.cxx b/oox/source/drawingml/fontworkhelpers.cxx index 3061230f9e5b..70c24ed5c3c8 100644 --- a/oox/source/drawingml/fontworkhelpers.cxx +++ b/oox/source/drawingml/fontworkhelpers.cxx @@ -155,9 +155,9 @@ void FontworkHelpers::putCustomShapeIntoTextPathMode( = comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(aGeomPropSeq); // Reset old properties - static const OUStringLiteral sTextPath(u"TextPath"); - static const OUStringLiteral sAdjustmentValues(u"AdjustmentValues"); - static const OUStringLiteral sPresetTextWarp(u"PresetTextWarp"); + static constexpr OUStringLiteral sTextPath(u"TextPath"); + static constexpr OUStringLiteral sAdjustmentValues(u"AdjustmentValues"); + static constexpr OUStringLiteral sPresetTextWarp(u"PresetTextWarp"); resetPropertyValueInVec(aGeomPropVec, u"CoordinateSize"); resetPropertyValueInVec(aGeomPropVec, u"Equations"); diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx index 920d37609f8f..c4bc08b40c13 100644 --- a/oox/source/drawingml/hyperlinkcontext.cxx +++ b/oox/source/drawingml/hyperlinkcontext.cxx @@ -81,7 +81,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent, // ppaction://macro?name=MACRO_NAME // ppaction://program - static const OUStringLiteral sPPAction( u"ppaction://" ); + static constexpr OUStringLiteral sPPAction( u"ppaction://" ); if ( aAction.matchIgnoreAsciiCase( sPPAction ) ) { OUString aPPAct( aAction.copy( sPPAction.getLength() ) ); @@ -90,7 +90,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent, if ( aPPAction.match( "hlinkshowjump" ) ) { - static const OUStringLiteral sJump( u"jump=" ); + static constexpr OUStringLiteral sJump( u"jump=" ); if ( aPPAct.match( sJump, nIndex + 1 ) ) { std::u16string_view aDestination( aPPAct.subView( nIndex + 1 + sJump.getLength() ) ); diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index b9aebab1b31d..4c1492451dd4 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1413,7 +1413,7 @@ Reference< XShape > const & Shape::createAndInsert( if(mnRotation) { uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY); - static const OUStringLiteral aGrabBagPropName = u"FrameInteropGrabBag"; + static constexpr OUStringLiteral aGrabBagPropName = u"FrameInteropGrabBag"; uno::Sequence<beans::PropertyValue> aGrabBag; xPropertySet->getPropertyValue(aGrabBagPropName) >>= aGrabBag; beans::PropertyValue aPair(comphelper::makePropertyValue("mso-rotation-angle", diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index b93dd01b69fb..dceb4ee706f8 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -646,7 +646,7 @@ static void lcl_AnalyzeHandles( const uno::Sequence<beans::PropertyValues> & rHa { for ( const Sequence< PropertyValue >& rPropSeq : rHandles ) { - static const OUStringLiteral sPosition( u"Position" ); + static constexpr OUStringLiteral sPosition( u"Position" ); bool bPosition = false; EnhancedCustomShapeParameterPair aPosition; for ( const PropertyValue& rPropVal: rPropSeq ) diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx index 7290fa1573a3..9b2bd48e5715 100644 --- a/oox/source/helper/propertymap.cxx +++ b/oox/source/helper/propertymap.cxx @@ -909,7 +909,7 @@ void PropertyMap::dumpCode( const Reference< XPropertySet >& rXPropSet ) { Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo (); const Sequence< Property > props = info->getProperties (); - static const OUStringLiteral sType = u"Type"; + static constexpr OUStringLiteral sType = u"Type"; for (const Property& rProp : props) { diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 217fc32fcf2e..dd9de50a2501 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -803,7 +803,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, // scan for the line 'Begin {GUID} <FormName>' TextInputStream aFrameTextStrm( mxContext, aInStrm, eTextEnc ); - static const OUStringLiteral aBegin = u"Begin"; + static constexpr OUStringLiteral aBegin = u"Begin"; OUString aLine; bool bBeginFound = false; while( !bBeginFound && !aFrameTextStrm.isEof() ) diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx index 5e0fc8ae2a71..c59895246a09 100644 --- a/oox/source/ole/vbaexport.cxx +++ b/oox/source/ole/vbaexport.cxx @@ -773,7 +773,7 @@ void exportDirStream(SvStream& rStrm, aDirStream.WriteUInt32(0x00000000); // reserved #if VBA_EXPORT_DEBUG - static const OUStringLiteral aDirFileName(u"/tmp/vba_dir_out.bin"); + static constexpr OUStringLiteral aDirFileName(u"/tmp/vba_dir_out.bin"); SvFileStream aDirStreamDebug(aDirFileName, StreamMode::READWRITE); aDirStream.Seek(0); aDirStreamDebug.WriteStream(aDirStream); diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index be7046c7498e..daa482eab94f 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -182,7 +182,7 @@ void PPTShape::addShape( if (sServiceName != "com.sun.star.drawing.GraphicObjectShape" && sServiceName != "com.sun.star.drawing.OLE2Shape") { - static const OUStringLiteral sOutlinerShapeService(u"com.sun.star.presentation.OutlinerShape"); + static constexpr OUStringLiteral sOutlinerShapeService(u"com.sun.star.presentation.OutlinerShape"); SAL_INFO("oox.ppt","has master: " << std::hex << rSlidePersist.getMasterPersist().get()); switch (mnSubType) { diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index cc972b80a8b0..9b52b92d97d0 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -194,7 +194,7 @@ void PresentationFragmentHandler::importCustomSlideShow(std::vector<CustomShow>& UNO_QUERY); if (xShow.is()) { - static const OUStringLiteral sSlide = u"slides/slide"; + static constexpr OUStringLiteral sSlide = u"slides/slide"; for (size_t j = 0; j < rCustomShowList[i].maSldLst.size(); ++j) { OUString sCustomSlide = rCustomShowList[i].maSldLst[j]; @@ -228,7 +228,7 @@ void PresentationFragmentHandler::saveThemeToGrabBag(const oox::drawingml::Theme { uno::Reference<beans::XPropertySetInfo> 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 diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index 0f7479e8ede9..7ea55ced1b96 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -241,10 +241,10 @@ void SlidePersist::applyTextStyles( const XmlFilterBase& rFilterBase ) OUString aStyle; OUString aFamily; - static const OUStringLiteral sOutline( u"outline1" ); - static const OUStringLiteral sTitle( u"title" ); - static const OUStringLiteral sStandard( u"standard" ); - static const OUStringLiteral sSubtitle( u"subtitle" ); + static constexpr OUStringLiteral sOutline( u"outline1" ); + static constexpr OUStringLiteral sTitle( u"title" ); + static constexpr OUStringLiteral sStandard( u"standard" ); + static constexpr OUStringLiteral sSubtitle( u"subtitle" ); for( int i = 0; i < 4; i++ ) // todo: aggregation of bodystyle (subtitle) { diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index bdbea0c86fc4..607ddf5354b4 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -312,7 +312,7 @@ void ShapeBase::finalizeFragmentImport() else { // Temporary fix, shapetype not found if referenced from different substream // FIXME: extend scope of ShapeContainer to store all shapetypes from the document - static const OUStringLiteral sShapeTypePrefix = u"shapetype_"; + static constexpr OUStringLiteral sShapeTypePrefix = u"shapetype_"; OUString tmp; if (aType.startsWith(sShapeTypePrefix)) { maTypeModel.moShapeType = o3tl::toInt32(aType.subView(sShapeTypePrefix.getLength())); |