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 /chart2/source/view | |
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 'chart2/source/view')
-rw-r--r-- | chart2/source/view/axes/VCartesianAxis.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/VLegend.cxx | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 8bd6690ff3ca..25919f548cfb 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -103,7 +103,7 @@ static void lcl_ResizeTextShapeToFitAvailableSpace( SvxShapeText& rShape2DText, if( !nAvgCharWidth ) return; - static const OUStringLiteral sDots = u"..."; + static constexpr OUStringLiteral sDots = u"..."; const sal_Int32 nCharsToRemove = ( nTextSize - nMaxLabelsSize ) / nAvgCharWidth + 1; sal_Int32 nNewLen = rLabel.size() - nCharsToRemove - sDots.getLength(); // Prevent from showing only dots diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 885f1acac8d6..de8d0377bd7c 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -421,7 +421,7 @@ awt::Size lcl_placeLegendEntries( try { OUString aLabelString = rEntries[0].xLabel->getString(); - static const OUStringLiteral sDots = u"..."; + static constexpr OUStringLiteral sDots = u"..."; for (sal_Int32 nNewLen = aLabelString.getLength() - sDots.getLength(); nNewLen > 0; ) { OUString aNewLabel = aLabelString.subView(0, nNewLen) + sDots; |