summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-28 17:56:40 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-29 16:42:33 +0100
commit042033f1e6da22616cb76c8d950c20c9efecbad5 (patch)
tree26b3f1f42d067506f44550b410f3fb9640616a5b /stoc
parentccfd8e9d09f9ac0a0ea92d0f378391006faaf934 (diff)
loplugin:stringviewparam: operator +
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/implementationregistration/implreg.cxx5
-rw-r--r--stoc/source/security/file_policy.cxx25
-rw-r--r--stoc/source/servicemanager/servicemanager.cxx11
3 files changed, 22 insertions, 19 deletions
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index 972b4f9d9b0f..24471b8ad4e5 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -18,6 +18,7 @@
*/
#include <string.h>
+#include <string_view>
#include <vector>
#include <cppuhelper/exc_hlp.hxx>
@@ -210,7 +211,7 @@ void prepareLink( const Reference < XSimpleRegistry > & xDest,
OUString searchImplForLink(
const Reference < XRegistryKey > & xRootKey,
- const OUString& linkName,
+ std::u16string_view linkName,
std::u16string_view implName )
// throw ( InvalidRegistryException, RuntimeException )
{
@@ -246,7 +247,7 @@ OUString searchImplForLink(
// static searchLinkTargetForImpl
OUString searchLinkTargetForImpl(const Reference < XRegistryKey >& xRootKey,
- const OUString& linkName,
+ std::u16string_view linkName,
const OUString& implName)
{
Reference < XRegistryKey > xKey = xRootKey->openKey( slash_IMPLEMENTATIONS );
diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx
index 7b70602f982c..b3789fe04e36 100644
--- a/stoc/source/security/file_policy.cxx
+++ b/stoc/source/security/file_policy.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/connection/SocketPermission.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <string_view>
#include <unordered_map>
#define IMPL_NAME "com.sun.star.security.comp.stoc.FilePolicy"
@@ -157,7 +158,7 @@ public:
PolicyReader( OUString const & file, AccessControl & ac );
~PolicyReader();
- void error( OUString const & msg );
+ void error( std::u16string_view msg );
OUString getToken();
OUString assureToken();
@@ -180,7 +181,7 @@ OUString PolicyReader::assureQuotedToken()
{
OUString token( getQuotedToken() );
if (token.isEmpty())
- error( "unexpected end of file!" );
+ error( u"unexpected end of file!" );
return token;
}
@@ -190,7 +191,7 @@ OUString PolicyReader::getQuotedToken()
OUStringBuffer buf( 32 );
sal_Unicode c = get();
if ('\"' != c)
- error( "expected quoting >\"< character!" );
+ error( u"expected quoting >\"< character!" );
c = get();
while ('\0' != c && '\"' != c)
{
@@ -204,7 +205,7 @@ OUString PolicyReader::assureToken()
{
OUString token( getToken() );
if ( token.isEmpty())
- error( "unexpected end of file!" );
+ error( u"unexpected end of file!" );
return token;
}
@@ -266,7 +267,7 @@ void PolicyReader::skipWhiteSpace()
}
else
{
- error( "expected C/C++ like comment!" );
+ error( u"expected C/C++ like comment!" );
}
}
else if ('#' == c) // script like comment
@@ -303,13 +304,13 @@ sal_Unicode PolicyReader::get()
sal_Bool eof;
oslFileError rc = ::osl_isEndOfFile( m_file, &eof );
if (osl_File_E_None != rc)
- error( "checking eof failed!" );
+ error( u"checking eof failed!" );
if (eof)
return '\0';
rc = ::osl_readLine( m_file, reinterpret_cast< sal_Sequence ** >( &m_line ) );
if (osl_File_E_None != rc)
- error( "read line failed!" );
+ error( u"read line failed!" );
++m_linepos;
if (! m_line.getLength()) // empty line read
{
@@ -321,7 +322,7 @@ sal_Unicode PolicyReader::get()
return (m_line.getConstArray()[ m_pos++ ]);
}
-void PolicyReader::error( OUString const & msg )
+void PolicyReader::error( std::u16string_view msg )
{
throw RuntimeException(
"error processing file \"" + m_fileName +
@@ -388,7 +389,7 @@ void FilePolicy::refresh()
while (!token.isEmpty())
{
if ( token != s_grant )
- reader.error( "expected >grant< token!" );
+ reader.error( u"expected >grant< token!" );
OUString userId;
token = reader.assureToken();
if ( token == s_user ) // next token is user-id
@@ -397,13 +398,13 @@ void FilePolicy::refresh()
token = reader.assureToken();
}
if ( token != s_openBrace )
- reader.error( "expected opening brace >{<!" );
+ reader.error( u"expected opening brace >{<!" );
token = reader.assureToken();
// permissions list
while ( token != s_closingBrace )
{
if ( token != s_permission )
- reader.error( "expected >permission< or closing brace >}<!" );
+ reader.error( u"expected >permission< or closing brace >}<!" );
token = reader.assureToken(); // permission type
Any perm;
@@ -432,7 +433,7 @@ void FilePolicy::refresh()
}
else
{
- reader.error( "expected permission type!" );
+ reader.error( u"expected permission type!" );
}
reader.assureToken( ';' );
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index 3ed0e7c802a7..09814d5d08eb 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -51,6 +51,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <iterator>
+#include <string_view>
#include <unordered_map>
#include <unordered_set>
@@ -1175,9 +1176,9 @@ private:
Reference<XRegistryKey > getRootKey();
Reference<XInterface > loadWithImplementationName(
const OUString & rImplName, Reference< XComponentContext > const & xContext );
- Sequence<OUString> getFromServiceName(const OUString& serviceName) const;
+ Sequence<OUString> getFromServiceName(std::u16string_view serviceName) const;
Reference<XInterface > loadWithServiceName(
- const OUString & rImplName, Reference< XComponentContext > const & xContext );
+ std::u16string_view rImplName, Reference< XComponentContext > const & xContext );
void fillAllNamesFromRegistry( HashSet_OWString & );
bool m_searchedRegistry;
@@ -1287,9 +1288,9 @@ Reference<XInterface > ORegistryServiceManager::loadWithImplementationName(
* Return all implementation out of the registry.
*/
Sequence<OUString> ORegistryServiceManager::getFromServiceName(
- const OUString& serviceName ) const
+ std::u16string_view serviceName ) const
{
- OUString buf = "/SERVICES/" + serviceName;
+ OUString buf = OUString::Concat("/SERVICES/") + serviceName;
return retrieveAsciiValueList( m_xRegistry, buf );
}
@@ -1297,7 +1298,7 @@ Sequence<OUString> ORegistryServiceManager::getFromServiceName(
* Create a service provider from the registry
*/
Reference<XInterface > ORegistryServiceManager::loadWithServiceName(
- const OUString& serviceName, Reference< XComponentContext > const & xContext )
+ std::u16string_view serviceName, Reference< XComponentContext > const & xContext )
{
const Sequence<OUString> implEntries = getFromServiceName( serviceName );
for (const auto& rEntry : implEntries)