diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-03-08 17:27:52 +0100 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-03-08 22:44:50 +0100 |
commit | ad7963f939c629657c1aca03765169ace14a5bbd (patch) | |
tree | dae4095a02eef40817ee3dc0dddbae7da40e2911 /static | |
parent | 747cfc7a021d8a4664462ddd6b0fad6c178da602 (diff) |
Directly go via std::u16string
Change-Id: I99d3322afc7876c37a7ace016c1c6af691f28406
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164591
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'static')
-rw-r--r-- | static/source/unoembindhelpers/PrimaryBindings.cxx | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/static/source/unoembindhelpers/PrimaryBindings.cxx b/static/source/unoembindhelpers/PrimaryBindings.cxx index 54ce34d0724c..bfbf7d90b12d 100644 --- a/static/source/unoembindhelpers/PrimaryBindings.cxx +++ b/static/source/unoembindhelpers/PrimaryBindings.cxx @@ -18,9 +18,6 @@ #include <comphelper/processfactory.hxx> #include <o3tl/any.hxx> #include <o3tl/unreachable.hxx> -#include <rtl/string.hxx> -#include <rtl/textcvt.h> -#include <rtl/textenc.h> #include <rtl/ustring.hxx> #include <sal/log.hxx> #include <sfx2/viewsh.hxx> @@ -142,18 +139,6 @@ EM_JS(void, jsRegisterString, (std::type_info const* raw), namespace { -OString toUtf8(OUString const& string) -{ - OString s; - if (!string.convertToString(&s, RTL_TEXTENCODING_UTF8, - RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR - | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)) - { - throw css::uno::RuntimeException("cannot convert OUString to UTF-8"); - } - return s; -} - void copyStruct(typelib_CompoundTypeDescription* desc, void const* source, void* dest) { if (desc->pBaseTypeDescription != nullptr) @@ -258,8 +243,8 @@ EMSCRIPTEN_BINDINGS(PrimaryBindings) return css::uno::Type(css::uno::TypeClass_INTERFACE, OUString(name)); }) .function("toString", +[](css::uno::Type const& self) { - auto const name = toUtf8(self.getTypeName()); - return std::string(name.getStr(), name.getLength()); + auto const name = self.getTypeName(); + return std::u16string(name.getStr(), name.getLength()); }); // Any |