diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-23 13:16:31 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-26 14:51:15 +0100 |
commit | a3d0091d185f39eddabf4d372ebe0ac3061dbb89 (patch) | |
tree | 4d70cedc274972ccc21b6b8e7105f042090cf5d6 /xmloff/source/draw | |
parent | af791fb775e35c11ad01c42a7085dd121ab9c7a6 (diff) |
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 <sbergman@redhat.com>
Diffstat (limited to 'xmloff/source/draw')
-rw-r--r-- | xmloff/source/draw/sdxmlexp.cxx | 18 |
1 files changed, 11 insertions, 7 deletions
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 <sal/config.h> + +#include <string_view> + #include <xmloff/autolayout.hxx> #include <xmloff/unointerfacetouniqueidentifiermapper.hxx> #include <xmloff/namespacemap.hxx> @@ -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>& xDrawPage ) { |