include/rtl/stringutils.hxx |   11 +++++++++++
 include/rtl/ustrbuf.hxx     |   10 ++++++++++
 2 files changed, 21 insertions(+)

New commits:
commit 349386559c4283317321772018086e613a5a7b03
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Mon Oct 21 17:04:11 2019 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Mon Oct 21 20:57:30 2019 +0200

    Actually choose the OUStringBuffer::append overload for UTF-16 string 
literals
    
    ...instead of prefering the `const sal_Unicode *` overload
    
    Change-Id: Idc8fd0a2188e2b3399965f303faa2aae8dcd6fd0
    Reviewed-on: https://gerrit.libreoffice.org/81251
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx
index a043f753ccce..3ed4bfc8e950 100644
--- a/include/rtl/stringutils.hxx
+++ b/include/rtl/stringutils.hxx
@@ -133,6 +133,12 @@ struct CharPtrDetector< char*, T >
     typedef T Type;
     static const bool ok = true;
 };
+#if defined LIBO_INTERNAL_ONLY
+template<typename T> struct CharPtrDetector<sal_Unicode *, T> { using 
TypeUtf16 = T; };
+template<typename T> struct CharPtrDetector<sal_Unicode const *, T> { using 
TypeUtf16 = T; };
+template<typename T> struct CharPtrDetector<sal_Unicode[], T> { using 
TypeUtf16 = T; };
+template<typename T> struct CharPtrDetector<sal_Unicode const[], T> { using 
TypeUtf16 = T; };
+#endif
 
 template< typename T1, typename T2 >
 struct NonConstCharArrayDetector
@@ -156,6 +162,11 @@ struct NonConstCharArrayDetector< const char[], T >
     typedef T Type;
 };
 #endif
+#if defined LIBO_INTERNAL_ONLY
+template<typename T, std::size_t N> struct 
NonConstCharArrayDetector<sal_Unicode[N], T> {
+    using TypeUtf16 = T;
+};
+#endif
 
 template< typename T1, typename T2 = void >
 struct ConstCharArrayDetector
diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
index 14e5fc6dda6f..a1b477498f6e 100644
--- a/include/rtl/ustrbuf.hxx
+++ b/include/rtl/ustrbuf.hxx
@@ -596,7 +596,13 @@ public:
         @param   str   the characters to be appended.
         @return  this string buffer.
      */
+#if defined LIBO_INTERNAL_ONLY
+    template<typename T>
+    typename libreoffice_internal::CharPtrDetector<T, OUStringBuffer 
&>::TypeUtf16
+    append(T const & str)
+#else
     OUStringBuffer & append( const sal_Unicode * str )
+#endif
     {
         return append( str, rtl_ustr_getLength( str ) );
     }
@@ -637,6 +643,10 @@ public:
     }
 
 #if defined LIBO_INTERNAL_ONLY
+    template<typename T>
+    typename libreoffice_internal::NonConstCharArrayDetector<T, OUStringBuffer 
&>::TypeUtf16
+    append(T & value) { return append(static_cast<sal_Unicode *>(value)); }
+
     /** @overload @since LibreOffice 5.3 */
     template<typename T>
     typename libreoffice_internal::ConstCharArrayDetector<
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to