From a3d0091d185f39eddabf4d372ebe0ac3061dbb89 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 23 Dec 2020 13:16:31 +0100 Subject: New loplugin:stringliteralvar See the comment at the top of compilerplugins/clang/stringliteralvar.cxx for details. (Turned some affected variables in included files into inline variables, to avoid GCC warnings about unused variables.) Change-Id: Ie77219e6adfdaaceaa8b4e590b08971f2f04c83a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- xmloff/source/draw/sdxmlexp.cxx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'xmloff/source/draw') diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index c7a6b44401aa..dac4db9eb464 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include + #include #include #include @@ -1313,7 +1317,7 @@ void SdXMLExport::ImpPrepDrawPageInfos() } } -static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUString& rText, const char* pPrefix ) +static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUString& rText, std::u16string_view pPrefix ) { // search rVector if there is already a string that equals rText auto aIter = std::find(rVector.begin(), rVector.end(), rText); @@ -1325,10 +1329,10 @@ static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUStri // create a reference string with pPrefix and the index of the // found or created rText - return OUString::createFromAscii( pPrefix ) + OUString::number( nIndex ); + return pPrefix + OUString::number( nIndex ); } -static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, const OUString& rText, bool bFixed, sal_Int32 nFormat, const char* pPrefix ) +static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, const OUString& rText, bool bFixed, sal_Int32 nFormat, std::u16string_view pPrefix ) { // search rVector if there is already a DateTimeDeclImpl with rText,bFixed and nFormat auto aIter = std::find_if(rVector.begin(), rVector.end(), @@ -1351,12 +1355,12 @@ static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, cons // create a reference string with pPrefix and the index of the // found or created DateTimeDeclImpl - return OUString::createFromAscii( pPrefix ) + OUString::number( nIndex ); + return pPrefix + OUString::number( nIndex ); } -const char gpStrHeaderTextPrefix[] = "hdr"; -const char gpStrFooterTextPrefix[] = "ftr"; -const char gpStrDateTimeTextPrefix[] = "dtd"; +const OUStringLiteral gpStrHeaderTextPrefix = u"hdr"; +const OUStringLiteral gpStrFooterTextPrefix = u"ftr"; +const OUStringLiteral gpStrDateTimeTextPrefix = u"dtd"; HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( const Reference& xDrawPage ) { -- cgit