diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-13 08:47:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-14 08:26:14 +0200 |
commit | 9b5dad13b56bdde7c40970351af3da3a2c3c9350 (patch) | |
tree | abfd4b02743a0e6a93c51c026f4c53f0e21100bc /editeng | |
parent | fa71320329999c968feb16ff65be328b5b8ff5e4 (diff) |
loplugin:stringadd look for unnecessary temporaries
which defeat the *StringConcat optimisation.
Also make StringConcat conversions treat a nullptr as an empty string,
to match the O*String(char*) constructors.
Change-Id: If45f5b4b6a535c97bfeeacd9ec472a7603a52e5b
Reviewed-on: https://gerrit.libreoffice.org/80724
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/borderline.cxx | 2 | ||||
-rw-r--r-- | editeng/source/items/frmitems.cxx | 20 | ||||
-rw-r--r-- | editeng/source/items/itemtype.cxx | 4 | ||||
-rw-r--r-- | editeng/source/items/textitem.cxx | 2 |
4 files changed, 14 insertions, 14 deletions
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx index 33cd0ca6de31..00fff9797f28 100644 --- a/editeng/source/items/borderline.cxx +++ b/editeng/source/items/borderline.cxx @@ -642,7 +642,7 @@ OUString SvxBorderLine::GetValueString(MapUnit eSrcUnit, RID_DASH_DOT, RID_DASH_DOT_DOT }; - OUString aStr = "(" + ::GetColorString( aColor ) + OUString(cpDelim); + OUString aStr = "(" + ::GetColorString( aColor ) + cpDelim; if ( static_cast<int>(m_nStyle) < int(SAL_N_ELEMENTS(aStyleIds)) ) { diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 1d74227313fe..7ee4258df96f 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -799,7 +799,7 @@ bool SvxULSpaceItem::GetPresentation rText += GetMetricText( static_cast<long>(nUpper), eCoreUnit, ePresUnit, &rIntl ) + " " + EditResId(GetMetricId(ePresUnit)); } - rText += OUString(cpDelim) + EditResId(RID_SVXITEMS_ULSPACE_LOWER); + rText += cpDelim + EditResId(RID_SVXITEMS_ULSPACE_LOWER); if ( 100 != nPropLower ) { rText += unicode::formatPercent(nPropLower, @@ -955,12 +955,12 @@ bool SvxProtectItem::GetPresentation if ( bCntnt ) pId = RID_SVXITEMS_PROT_CONTENT_TRUE; - rText = EditResId(pId) + OUString(cpDelim); + rText = EditResId(pId) + cpDelim; pId = RID_SVXITEMS_PROT_SIZE_FALSE; if ( bSize ) pId = RID_SVXITEMS_PROT_SIZE_TRUE; - rText += EditResId(pId) + OUString(cpDelim); + rText += EditResId(pId) + cpDelim; pId = RID_SVXITEMS_PROT_POS_FALSE; if ( bPos ) @@ -1166,15 +1166,15 @@ bool SvxShadowItem::GetPresentation { case SfxItemPresentation::Nameless: { - rText = ::GetColorString( aShadowColor ) + OUString(cpDelim); + rText = ::GetColorString( aShadowColor ) + cpDelim; const char* pId = RID_SVXITEMS_TRANSPARENT_FALSE; if ( aShadowColor.GetTransparency() ) pId = RID_SVXITEMS_TRANSPARENT_TRUE; rText += EditResId(pId) + - OUString(cpDelim) + + cpDelim + GetMetricText( static_cast<long>(nWidth), eCoreUnit, ePresUnit, &rIntl ) + - OUString(cpDelim) + + cpDelim + EditResId(RID_SVXITEMS_SHADOW[static_cast<int>(eLocation)]); return true; } @@ -1182,16 +1182,16 @@ bool SvxShadowItem::GetPresentation { rText = EditResId(RID_SVXITEMS_SHADOW_COMPLETE) + ::GetColorString( aShadowColor ) + - OUString(cpDelim); + cpDelim; const char* pId = RID_SVXITEMS_TRANSPARENT_FALSE; if ( aShadowColor.GetTransparency() ) pId = RID_SVXITEMS_TRANSPARENT_TRUE; rText += EditResId(pId) + - OUString(cpDelim) + + cpDelim + GetMetricText( static_cast<long>(nWidth), eCoreUnit, ePresUnit, &rIntl ) + " " + EditResId(GetMetricId(ePresUnit)) + - OUString(cpDelim) + + cpDelim + EditResId(RID_SVXITEMS_SHADOW[static_cast<int>(eLocation)]); return true; } @@ -3047,7 +3047,7 @@ bool SvxBrushItem::GetPresentation { if ( GPOS_NONE == eGraphicPos ) { - rText = ::GetColorString( aColor ) + OUString(cpDelim); + rText = ::GetColorString( aColor ) + cpDelim; const char* pId = RID_SVXITEMS_TRANSPARENT_FALSE; if ( aColor.GetTransparency() ) diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx index 78b31841869a..9b3996e79975 100644 --- a/editeng/source/items/itemtype.cxx +++ b/editeng/source/items/itemtype.cxx @@ -181,8 +181,8 @@ OUString GetColorString( const Color& rCol ) if ( sStr.isEmpty() ) { sStr += "RGB(" + - OUString::number( rCol.GetRed() ) + OUString(cpDelim) + - OUString::number( rCol.GetGreen() ) + OUString(cpDelim) + + OUString::number( rCol.GetRed() ) + cpDelim + + OUString::number( rCol.GetGreen() ) + cpDelim + OUString::number( rCol.GetBlue() ) + ")"; } return sStr; diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 82889dc91be7..ae7239a8e878 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -965,7 +965,7 @@ bool SvxTextLineItem::GetPresentation { rText = GetValueTextByPos( GetValue() ); if( !mColor.GetTransparency() ) - rText += OUString(cpDelim) + ::GetColorString( mColor ); + rText += cpDelim + ::GetColorString( mColor ); return true; } |