diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-11-23 23:10:29 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-11-23 23:11:02 +0100 |
commit | d689ad29c28ad7f077c2239a8fa4c2b6307a6aa1 (patch) | |
tree | d66cc700033fe101357b386f1e028101f64049ee /bridges | |
parent | 5645c15d3df900f65a1d9513155ee38743c543fa (diff) |
New o3tl::runtimeToOUString to convert from C++ runtime NTBS to OUString
Change-Id: I613bb70b6828f615fd45af38b2d873ece55ace60
Diffstat (limited to 'bridges')
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx | 19 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx | 18 |
2 files changed, 7 insertions, 30 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx index 71e76a9f3b09..fb7bf08a81b3 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx @@ -23,10 +23,10 @@ #include <typeinfo> #include "rtl/alloc.h" -#include "rtl/ustrbuf.hxx" #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" +#include <o3tl/runtimetooustring.hxx> #include <uno/data.h> #include <bridge.hxx> @@ -95,14 +95,6 @@ void INSERT_INT8( *pDS++ = *static_cast<sal_uInt8 const *>( pSV ); } -void appendCString(OUStringBuffer & buffer, char const * text) { - if (text != nullptr) { - buffer.append( - OStringToOUString(OString(text), RTL_TEXTENCODING_ISO_8859_1)); - // use 8859-1 to avoid conversion failure - } -} - } static void cpp_call( @@ -246,12 +238,9 @@ static void cpp_call( } catch (const Exception &) { throw; } catch (const std::exception & e) { - OUStringBuffer buf; - buf.append("C++ code threw "); - appendCString(buf, typeid(e).name()); - buf.append(": "); - appendCString(buf, e.what()); - throw RuntimeException(buf.makeStringAndClear()); + throw RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + + ": " + o3tl::runtimeToOUString(e.what())); } catch (...) { throw RuntimeException("C++ code threw unknown exception"); } diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx index f606f7275990..9770dba7d4ba 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx @@ -23,10 +23,10 @@ #include <typeinfo> #include "rtl/alloc.h" -#include "rtl/ustrbuf.hxx" #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" +#include <o3tl/runtimetooustring.hxx> #include <uno/data.h> #include <bridge.hxx> @@ -95,14 +95,6 @@ void INSERT_INT8( *pDS++ = *static_cast<sal_uInt8 const *>( pSV ); } -void appendCString(OUStringBuffer & buffer, char const * text) { - if (text != nullptr) { - buffer.append( - OStringToOUString(OString(text), RTL_TEXTENCODING_ISO_8859_1)); - // use 8859-1 to avoid conversion failure - } -} - } static void cpp_call( @@ -246,13 +238,9 @@ static void cpp_call( } catch (const Exception &) { throw; } catch (const std::exception & e) { - OUStringBuffer buf; - buf.append("C++ code threw "); - appendCString(buf, typeid(e).name()); - buf.append(": "); - appendCString(buf, e.what()); throw RuntimeException( - buf.makeStringAndClear()); + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + + ": " + o3tl::runtimeToOUString(e.what())); } catch (...) { throw RuntimeException("C++ code threw unknown exception"); } |