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 /sdext | |
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 'sdext')
-rw-r--r-- | sdext/source/pdfimport/test/pdfunzip.cxx | 8 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/style.cxx | 2 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/style.hxx | 3 | ||||
-rw-r--r-- | sdext/source/pdfimport/wrapper/wrapper.cxx | 3 |
4 files changed, 11 insertions, 5 deletions
diff --git a/sdext/source/pdfimport/test/pdfunzip.cxx b/sdext/source/pdfimport/test/pdfunzip.cxx index 7c857e884bd6..a4d93c611d7d 100644 --- a/sdext/source/pdfimport/test/pdfunzip.cxx +++ b/sdext/source/pdfimport/test/pdfunzip.cxx @@ -19,6 +19,8 @@ #include <stdio.h> +#include <string_view> + #include <sal/main.h> #include <osl/file.h> #include <osl/thread.h> @@ -80,7 +82,8 @@ FileEmitContext::FileEmitContext( const char* pFileName, const char* pOrigName, m_aReadHandle( nullptr ), m_nReadLen( 0 ) { - OUString aSysFile( OStringToOUString( OString( pFileName ), osl_getThreadTextEncoding() ) ); + OUString aSysFile( + OStringToOUString( std::string_view( pFileName ), osl_getThreadTextEncoding() ) ); OUString aURL; if( osl_getFileURLFromSystemPath( aSysFile.pData, &aURL.pData ) != osl_File_E_None ) { @@ -118,7 +121,8 @@ FileEmitContext::~FileEmitContext() void FileEmitContext::openReadFile( const char* pInFile ) { - OUString aSysFile( OStringToOUString( OString( pInFile ), osl_getThreadTextEncoding() ) ); + OUString aSysFile( + OStringToOUString( std::string_view( pInFile ), osl_getThreadTextEncoding() ) ); OUString aURL; if( osl_getFileURLFromSystemPath( aSysFile.pData, &aURL.pData ) != osl_File_E_None ) { diff --git a/sdext/source/pdfimport/tree/style.cxx b/sdext/source/pdfimport/tree/style.cxx index 8d6f7d3753cd..68f36379e172 100644 --- a/sdext/source/pdfimport/tree/style.cxx +++ b/sdext/source/pdfimport/tree/style.cxx @@ -73,7 +73,7 @@ sal_Int32 StyleContainer::impl_getStyleId( const Style& rStyle, bool bSubStyle ) return nRet; } -sal_Int32 StyleContainer::getStandardStyleId( const OString& rName ) +sal_Int32 StyleContainer::getStandardStyleId( std::string_view rName ) { PropertyMap aProps; aProps[ "style:family" ] = OStringToOUString( rName, RTL_TEXTENCODING_UTF8 ); diff --git a/sdext/source/pdfimport/tree/style.hxx b/sdext/source/pdfimport/tree/style.hxx index ee7cafeabc93..784249a114c4 100644 --- a/sdext/source/pdfimport/tree/style.hxx +++ b/sdext/source/pdfimport/tree/style.hxx @@ -22,6 +22,7 @@ #include <pdfihelper.hxx> #include <numeric> +#include <string_view> #include <unordered_map> #include <vector> #include <rtl/ustring.hxx> @@ -151,7 +152,7 @@ namespace pdfi sal_Int32 impl_getStyleId( const Style& rStyle, bool bSubStyle ); sal_Int32 getStyleId( const Style& rStyle ) { return impl_getStyleId( rStyle, false ); } - sal_Int32 getStandardStyleId( const OString& rFamily ); + sal_Int32 getStandardStyleId( std::string_view rFamily ); // returns NULL for an invalid style id const PropertyMap* getProperties( sal_Int32 nStyleId ) const; diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index aba48b11a053..1b9a6c18af97 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -59,6 +59,7 @@ #include <vcl/virdev.hxx> #include <memory> +#include <string_view> #include <unordered_map> #include <string.h> #include <stdlib.h> @@ -890,7 +891,7 @@ void Parser::parseLine( const OString& rLine ) } // namespace -static bool checkEncryption( const OUString& i_rPath, +static bool checkEncryption( std::u16string_view i_rPath, const uno::Reference< task::XInteractionHandler >& i_xIHdl, OUString& io_rPwd, bool& o_rIsEncrypted, |