diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-11 17:44:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-11 21:25:10 +0100 |
commit | 35e471bb4d1388cf5afcdcee214cf5111edf44e3 (patch) | |
tree | bb78f4f13f131f0cb206a9707cc3cfc495a3876a /l10ntools | |
parent | 0c06e77c122f10a1842bc908bd6e25b1110ddbd2 (diff) |
Adapt the remaining OUString functions to std string_view
...for LIBO_INTERNAL_ONLY. These had been missed by
1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take
std::u16string_view parameters" because they did not match the multi-overload
pattern that was addressed there, but they nevertheless benefit from being
changed just as well (witness e.g. the various resulting changes from copy() to
subView()).
This showed a conversion from OStringChar to std::string_view to be missing
(while the corresponding conversion form OUStringChar to std::u16string_view was
already present).
The improvement to loplugin:stringadd became necessary to fix
> [CPT] compilerplugins/clang/test/stringadd.cxx
> error: 'error' diagnostics expected but not seen:
> File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd]
> File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd]
> 2 errors generated.
Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/source/localize.cxx | 4 | ||||
-rw-r--r-- | l10ntools/source/merge.cxx | 2 | ||||
-rw-r--r-- | l10ntools/source/propmerge.cxx | 3 | ||||
-rw-r--r-- | l10ntools/source/xmlparse.cxx | 5 |
4 files changed, 8 insertions, 6 deletions
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 17ad73f3b2a4..1aa3bab4b6d8 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -125,7 +125,7 @@ void InitPoFile( { OUString outDir = OStringToOUString( - rPotDir.copy(0,rPotDir.lastIndexOf('/')), RTL_TEXTENCODING_UTF8); + rPotDir.subView(0,rPotDir.lastIndexOf('/')), RTL_TEXTENCODING_UTF8); OUString outDirUrl; if (osl::FileBase::getFileURLFromSystemPath(outDir, outDirUrl) != osl::FileBase::E_None) @@ -406,7 +406,7 @@ void handleDirectory( //Remove empty pot directory OUString sPoPath = OStringToOUString( - aPotDir.copy(0,aPotDir.lastIndexOf('/')), RTL_TEXTENCODING_UTF8); + aPotDir.subView(0,aPotDir.lastIndexOf('/')), RTL_TEXTENCODING_UTF8); OUString sPoUrl; if (osl::FileBase::getFileURLFromSystemPath(sPoPath, sPoUrl) != osl::FileBase::E_None) diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 694e48f23f4f..22beb6f1b962 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -94,7 +94,7 @@ namespace { //DOUBLE VERTICAL LINE instead of || because the translations make their //way into action_names under gtk3 where || is illegal - return OUStringToOString(OUString(u'\x2016'), RTL_TEXTENCODING_UTF8); + return OUStringToOString(u"\x2016", RTL_TEXTENCODING_UTF8); } } diff --git a/l10ntools/source/propmerge.cxx b/l10ntools/source/propmerge.cxx index 42945aee316d..3922d172398e 100644 --- a/l10ntools/source/propmerge.cxx +++ b/l10ntools/source/propmerge.cxx @@ -13,6 +13,7 @@ #include <iostream> #include <fstream> #include <iomanip> +#include <string_view> #include <export.hxx> #include <common.hxx> @@ -59,7 +60,7 @@ namespace } //Escape unicode characters - void lcl_PrintJavaStyle( const OString& rText, std::ofstream &rOfstream ) + void lcl_PrintJavaStyle( std::string_view rText, std::ofstream &rOfstream ) { const OUString sTemp = OStringToOUString( rText, RTL_TEXTENCODING_UTF8 ); diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx index 54b9c6bf4d8e..4bd58b1a49f6 100644 --- a/l10ntools/source/xmlparse.cxx +++ b/l10ntools/source/xmlparse.cxx @@ -22,6 +22,7 @@ #include <cassert> #include <stdio.h> +#include <string_view> #include <helper.hxx> #include <common.hxx> @@ -741,7 +742,7 @@ void XMLElement::Print(XMLNode *pCur, OStringBuffer& rBuffer, bool bRootelement namespace { -OUString lcl_pathnameToAbsoluteUrl(const OString& rPathname) +OUString lcl_pathnameToAbsoluteUrl(std::string_view rPathname) { OUString sPath = OStringToOUString(rPathname, RTL_TEXTENCODING_UTF8 ); OUString sUrl; @@ -1112,7 +1113,7 @@ OString XMLUtil::QuotHTML( const OString &rString ) sReturn.append('\0'); return OUStringToOString( - OUString(reinterpret_cast<const sal_Unicode*>(sReturn.getBuffer())), + reinterpret_cast<const sal_Unicode*>(sReturn.getBuffer()), RTL_TEXTENCODING_UTF8); } |