summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-11 17:44:34 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-11 21:25:10 +0100
commit35e471bb4d1388cf5afcdcee214cf5111edf44e3 (patch)
treebb78f4f13f131f0cb206a9707cc3cfc495a3876a /pyuno
parent0c06e77c122f10a1842bc908bd6e25b1110ddbd2 (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 'pyuno')
-rw-r--r--pyuno/source/module/pyuno_impl.hxx5
-rw-r--r--pyuno/source/module/pyuno_module.cxx3
-rw-r--r--pyuno/source/module/pyuno_runtime.cxx4
-rw-r--r--pyuno/source/module/pyuno_util.cxx4
4 files changed, 9 insertions, 7 deletions
diff --git a/pyuno/source/module/pyuno_impl.hxx b/pyuno/source/module/pyuno_impl.hxx
index 6517884a01ef..e48dae7ce9ac 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -39,6 +39,7 @@
#include <pyuno.hxx>
+#include <string_view>
#include <unordered_map>
#include <unordered_set>
@@ -76,7 +77,7 @@ const sal_Int32 ARGS = 2;
}
bool isLog( RuntimeCargo const *cargo, sal_Int32 loglevel );
-void log( RuntimeCargo *cargo, sal_Int32 level, const OUString &logString );
+void log( RuntimeCargo *cargo, sal_Int32 level, std::u16string_view logString );
void log( RuntimeCargo *cargo, sal_Int32 level, const char *str );
void logCall( RuntimeCargo *cargo, const char *intro,
void * ptr, const OUString & aFunctionName,
@@ -168,7 +169,7 @@ typedef struct
} PyUNO_list_iterator;
PyRef ustring2PyUnicode( const OUString &source );
-PyRef ustring2PyString( const OUString & source );
+PyRef ustring2PyString( std::u16string_view source );
OUString pyString2ustring( PyObject *str );
/// @throws css::reflection::InvocationTargetException
diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx
index cb2824d00005..4a9d1921386f 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -22,6 +22,7 @@
#include "pyuno_impl.hxx"
#include <cassert>
+#include <string_view>
#include <unordered_map>
#include <osl/module.hxx>
@@ -216,7 +217,7 @@ OUString getLibDir()
return sLibDir;
}
-void raisePySystemException( const char * exceptionType, const OUString & message )
+void raisePySystemException( const char * exceptionType, std::u16string_view message )
{
OString buf = OStringLiteral("Error during bootstrapping uno (") +
exceptionType +
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index 91005f1e13aa..961014ebc74b 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -474,8 +474,8 @@ PyRef Runtime::any2PyObject (const Any &a ) const
{
if( pEnumDesc->pEnumValues[i] == l )
{
- OString v = OUStringToOString( pEnumDesc->ppEnumNames[i], RTL_TEXTENCODING_ASCII_US);
- OString e = OUStringToOString( pEnumDesc->aBase.pTypeName, RTL_TEXTENCODING_ASCII_US);
+ OString v = OUStringToOString( OUString::unacquired(&pEnumDesc->ppEnumNames[i]), RTL_TEXTENCODING_ASCII_US);
+ OString e = OUStringToOString( OUString::unacquired(&pEnumDesc->aBase.pTypeName), RTL_TEXTENCODING_ASCII_US);
return PyRef( PyUNO_Enum_new(e.getStr(),v.getStr(), *this ), SAL_NO_ACQUIRE );
}
}
diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx
index 77006c33acac..35b96183c739 100644
--- a/pyuno/source/module/pyuno_util.cxx
+++ b/pyuno/source/module/pyuno_util.cxx
@@ -48,7 +48,7 @@ PyRef ustring2PyUnicode( const OUString & str )
return ret;
}
-PyRef ustring2PyString( const OUString &str )
+PyRef ustring2PyString( std::u16string_view str )
{
OString o = OUStringToOString( str, osl_getThreadTextEncoding() );
return PyRef( PyUnicode_FromString( o.getStr() ), SAL_NO_ACQUIRE );
@@ -95,7 +95,7 @@ bool isLog( RuntimeCargo const * cargo, sal_Int32 loglevel )
return cargo && cargo->logFile && loglevel <= cargo->logLevel;
}
-void log( RuntimeCargo * cargo, sal_Int32 level, const OUString &logString )
+void log( RuntimeCargo * cargo, sal_Int32 level, std::u16string_view logString )
{
log( cargo, level, OUStringToOString( logString, osl_getThreadTextEncoding() ).getStr() );
}