[Libreoffice-commits] core.git: basic/source embedserv/source extensions/source fpicker/source hwpfilter/source i18npool/source include/rtl sal/osl sal/qa sc/source sfx2/source shell/source svl/source sw/source tools/source vcl/source vcl/win writerfilter/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 7 17:19:55 UTC 2020


 basic/source/runtime/methods.cxx                      |    2 
 embedserv/source/embed/ed_ioleobject.cxx              |    4 
 extensions/source/ole/unoobjw.cxx                     |    2 
 fpicker/source/win32/VistaFilePickerImpl.cxx          |    6 
 hwpfilter/source/hwpreader.cxx                        |    6 
 i18npool/source/localedata/localedata.cxx             |  124 +++++++++---------
 include/rtl/ustring.hxx                               |   49 ++++++-
 sal/osl/w32/file_dirvol.cxx                           |    2 
 sal/osl/w32/procimpl.cxx                              |    2 
 sal/osl/w32/socket.cxx                                |    2 
 sal/qa/osl/file/osl_File.cxx                          |    4 
 sal/qa/osl/security/osl_Security.cxx                  |    4 
 sc/source/core/tool/compiler.cxx                      |    2 
 sfx2/source/doc/guisaveas.cxx                         |    2 
 shell/source/win32/simplemail/smplmailclient.cxx      |    2 
 svl/source/svdde/ddedata.cxx                          |    2 
 svl/source/svdde/ddesvr.cxx                           |    4 
 sw/source/filter/ww8/ww8par.cxx                       |    4 
 sw/source/uibase/dochdl/swdtflvr.cxx                  |    2 
 tools/source/fsys/fileutil.cxx                        |    2 
 vcl/source/font/font.cxx                              |    2 
 vcl/win/gdi/salfont.cxx                               |    6 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    2 
 23 files changed, 139 insertions(+), 98 deletions(-)

New commits:
commit c927aab29ebfff1ce3ac0b2f27ae343025a9890c
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Sep 5 21:45:38 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Sep 7 19:19:14 2020 +0200

    Make the OUString ctors taking raw sal_Unicode pointer/non-const array explicit
    
    ...and in turn add OUString::operator = and OUString::operator +=
    overloads that take a std::u16string_view.  Without making the ctors explicit,
    the operator overloads would have caused ambiguities when called with raw
    sal_Unicode pointers/non-const arrays, as those can convert to both OUString and
    to std::u16string_view.
    
    But the std::u16string_view operator overloads will generally be useful when
    changing OUStringLiteral similarly to 4b9e440c51be3e40326bc90c33ae69885bfb51e4
    "Turn OStringLiteral into a consteval'ed, static-refcound rtl_String", at which
    point many existing uses of OUStringLiteral will be replaced with uses of
    std::u16string_view.
    
    Implementing this change turned up a need for an operator = overload for
    OUStringNumber, which has thus been added.  No such need turned up for a
    corresponding operator += overload, but which can easily be added when the need
    arises.
    
    It also revealed that the operator == overloads between an OUString and a raw
    sal_Unicode pointer/non-const array were implemented rather inefficiently,
    creating a temporary OUString from the raw argument.  Those have been improved.
    
    Preceding commits have already taken care of many dubious or simply unnecessary
    implicit uses of the now-explicit OUString ctors.  This commit makes explicit
    the few remaining reasonable uses.  (And in some cases needed to change variable
    initialization syntax from using parentheses to using curly braces, to avoid the
    most vexing parse issue.  And needed to explicitly add OUString ctors from
    char16 const[2] string literal lvalues in a conditional expression in
    writerfilter/source/ooxml/OOXMLFastContextHandler.cxx that are only necessary
    because MSVC apparently still insists on doing array-to-pointer decay there.)
    
    All of this only affects LIBO_INTERNAL_ONLY.
    
    Change-Id: I7ce31162e9be1c3ff3c0bd184a34b535ec56be9e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102098
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 7fcf5cecd40a..91c279d477b4 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -414,7 +414,7 @@ void SbRtl_CurDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
     _set_thread_local_invalid_parameter_handler(handler);
     if ( ok )
     {
-        rPar.Get32(0)->PutString( o3tl::toU(pBuffer) );
+        rPar.Get32(0)->PutString( OUString(o3tl::toU(pBuffer)) );
     }
     else
     {
diff --git a/embedserv/source/embed/ed_ioleobject.cxx b/embedserv/source/embed/ed_ioleobject.cxx
index a84b1c2bdedd..08032e9c8b2b 100644
--- a/embedserv/source/embed/ed_ioleobject.cxx
+++ b/embedserv/source/embed/ed_ioleobject.cxx
@@ -45,8 +45,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP EmbedDocument_Impl::SetHostNames( LPCOLESTR sz
     // the code should be ignored for links
     if ( !m_aFileName.getLength() )
     {
-        m_pDocHolder->setTitle(o3tl::toU(szContainerObj));
-        m_pDocHolder->setContainerName(o3tl::toU(szContainerApp));
+        m_pDocHolder->setTitle(OUString(o3tl::toU(szContainerObj)));
+        m_pDocHolder->setContainerName(OUString(o3tl::toU(szContainerApp)));
     }
 
     return S_OK;
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index e31ae8816ca3..87b00e340bde 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -2866,7 +2866,7 @@ HRESULT InterfaceOleWrapper::InvokeGeneral( DISPID dispidMember, unsigned short
             CComVariant arg;
             if( pdispparams->cArgs == 1 && SUCCEEDED( arg.ChangeType( VT_BSTR, &pdispparams->rgvarg[0])) )
             {
-                Reference<XIdlClass> classStruct= xRefl->forName(o3tl::toU(arg.bstrVal));
+                Reference<XIdlClass> classStruct= xRefl->forName(OUString(o3tl::toU(arg.bstrVal)));
                 if( classStruct.is())
                 {
                     Any anyStruct;
diff --git a/fpicker/source/win32/VistaFilePickerImpl.cxx b/fpicker/source/win32/VistaFilePickerImpl.cxx
index 6c0c6b53856f..d6e10115ac82 100644
--- a/fpicker/source/win32/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/VistaFilePickerImpl.cxx
@@ -102,7 +102,7 @@ static OUString lcl_getURLFromShellItem (IShellItem* pItem)
     hr = pItem->GetDisplayName ( SIGDN_FILESYSPATH, &pStr );
     if (SUCCEEDED(hr))
     {
-        ::osl::FileBase::getFileURLFromSystemPath( o3tl::toU(pStr), sURL );
+        ::osl::FileBase::getFileURLFromSystemPath( OUString(o3tl::toU(pStr)), sURL );
         goto cleanup;
     }
 
@@ -128,7 +128,7 @@ static OUString lcl_getURLFromShellItem (IShellItem* pItem)
             hr = SHGetKnownFolderPath(known_folder_id, 0, nullptr, &pStr);
             if (SUCCEEDED(hr))
             {
-                ::osl::FileBase::getFileURLFromSystemPath(o3tl::toU(pStr), sURL);
+                ::osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(pStr)), sURL);
                 goto cleanup;
             }
         }
@@ -137,7 +137,7 @@ static OUString lcl_getURLFromShellItem (IShellItem* pItem)
     // Default fallback
     hr = SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &pStr);
     if (SUCCEEDED(hr))
-        ::osl::FileBase::getFileURLFromSystemPath(o3tl::toU(pStr), sURL);
+        ::osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(pStr)), sURL);
     else // shouldn't happen...
         goto bailout;
 
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index 9a785645a5a3..45574c8ed344 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -3826,9 +3826,9 @@ void HwpReader::makePicture(Picture * hbox)
                 padd("xlink:type", sXML_CDATA, "simple");
 #ifdef _WIN32
                 if( hbox->follow[4] != 0 )
-                    padd("xlink:href", sXML_CDATA, reinterpret_cast<sal_Unicode const *>(hconv(kstr2hstr(hbox->follow.data() + 4).c_str())));
+                    padd("xlink:href", sXML_CDATA, fromHcharStringToOUString(hstr2ucsstr(kstr2hstr(hbox->follow.data() + 4).c_str())));
                 else
-                    padd("xlink:href", sXML_CDATA, reinterpret_cast<sal_Unicode const *>(hconv(kstr2hstr(hbox->follow.data() + 5).c_str())));
+                    padd("xlink:href", sXML_CDATA, fromHcharStringToOUString(hstr2ucsstr(kstr2hstr(hbox->follow.data() + 5).c_str())));
 #else
                 if( hbox->follow[4] != 0 )
                     padd("xlink:href", sXML_CDATA,
@@ -3887,7 +3887,7 @@ void HwpReader::makePicture(Picture * hbox)
             if ( hbox->pictype == PICTYPE_FILE ){
 #ifdef _WIN32
                 sprintf(buf, "file:///%s", hbox->picinfo.picun.path );
-                padd("xlink:href", sXML_CDATA, reinterpret_cast<sal_Unicode const *>(hconv(kstr2hstr(reinterpret_cast<uchar *>(buf)).c_str())));
+                padd("xlink:href", sXML_CDATA, fromHcharStringToOUString(hstr2ucsstr(kstr2hstr(reinterpret_cast<uchar *>(buf)).c_str())));
 #else
                 padd("xlink:href", sXML_CDATA,
                     fromHcharStringToOUString(hstr2ucsstr(kstr2hstr(reinterpret_cast<uchar const *>(urltounix(hbox->picinfo.picun.path).c_str())).c_str())));
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index 61d04abbdfc0..d9db1822fead 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -403,26 +403,26 @@ LocaleDataImpl::getLocaleItem( const Locale& rLocale )
         sal_Int16 dataItemCount = 0;
         sal_Unicode **dataItem = func(dataItemCount);
 
-        LocaleDataItem item(
-                dataItem[0],
-                dataItem[1],
-                dataItem[2],
-                dataItem[3],
-                dataItem[4],
-                dataItem[5],
-                dataItem[6],
-                dataItem[7],
-                dataItem[8],
-                dataItem[9],
-                dataItem[10],
-                dataItem[11],
-                dataItem[12],
-                dataItem[13],
-                dataItem[14],
-                dataItem[15],
-                dataItem[16],
-                dataItem[17]
-                );
+        LocaleDataItem item{
+                OUString(dataItem[0]),
+                OUString(dataItem[1]),
+                OUString(dataItem[2]),
+                OUString(dataItem[3]),
+                OUString(dataItem[4]),
+                OUString(dataItem[5]),
+                OUString(dataItem[6]),
+                OUString(dataItem[7]),
+                OUString(dataItem[8]),
+                OUString(dataItem[9]),
+                OUString(dataItem[10]),
+                OUString(dataItem[11]),
+                OUString(dataItem[12]),
+                OUString(dataItem[13]),
+                OUString(dataItem[14]),
+                OUString(dataItem[15]),
+                OUString(dataItem[16]),
+                OUString(dataItem[17])
+                };
         return item;
     }
     else {
@@ -443,27 +443,27 @@ LocaleDataImpl::getLocaleItem2( const Locale& rLocale )
 
         assert(dataItemCount >= 18);
 
-        LocaleDataItem2 item(
-                dataItem[0],
-                dataItem[1],
-                dataItem[2],
-                dataItem[3],
-                dataItem[4],
-                dataItem[5],
-                dataItem[6],
-                dataItem[7],
-                dataItem[8],
-                dataItem[9],
-                dataItem[10],
-                dataItem[11],
-                dataItem[12],
-                dataItem[13],
-                dataItem[14],
-                dataItem[15],
-                dataItem[16],
-                dataItem[17],
-                dataItemCount >= 19 ? dataItem[18] : OUString()
-                );
+        LocaleDataItem2 item{
+                OUString(dataItem[0]),
+                OUString(dataItem[1]),
+                OUString(dataItem[2]),
+                OUString(dataItem[3]),
+                OUString(dataItem[4]),
+                OUString(dataItem[5]),
+                OUString(dataItem[6]),
+                OUString(dataItem[7]),
+                OUString(dataItem[8]),
+                OUString(dataItem[9]),
+                OUString(dataItem[10]),
+                OUString(dataItem[11]),
+                OUString(dataItem[12]),
+                OUString(dataItem[13]),
+                OUString(dataItem[14]),
+                OUString(dataItem[15]),
+                OUString(dataItem[16]),
+                OUString(dataItem[17]),
+                dataItemCount >= 19 ? OUString(dataItem[18]) : OUString()
+                };
         return item;
     }
     else {
@@ -719,8 +719,9 @@ Sequence< CalendarItem2 > LocaleDataImpl::getCalendarItems(
             case REF_PMONTHS:
                 for (CalendarItem2& rItem : aItems)
                 {
-                    CalendarItem2 item( allCalendars[rnOffset], allCalendars[rnOffset+1],
-                            allCalendars[rnOffset+2], allCalendars[rnOffset+3]);
+                    CalendarItem2 item{ OUString(allCalendars[rnOffset]),
+                            OUString(allCalendars[rnOffset+1]),
+                            OUString(allCalendars[rnOffset+2]), OUString(allCalendars[rnOffset+3])};
                     rItem = item;
                     rnOffset += 4;
                 }
@@ -729,8 +730,9 @@ Sequence< CalendarItem2 > LocaleDataImpl::getCalendarItems(
                 // Absent narrow name.
                 for (CalendarItem2& rItem : aItems)
                 {
-                    CalendarItem2 item( allCalendars[rnOffset], allCalendars[rnOffset+1],
-                            allCalendars[rnOffset+2], OUString());
+                    CalendarItem2 item{ OUString(allCalendars[rnOffset]),
+                            OUString(allCalendars[rnOffset+1]),
+                            OUString(allCalendars[rnOffset+2]), OUString()};
                     rItem = item;
                     rnOffset += 3;
                 }
@@ -812,10 +814,10 @@ LocaleDataImpl::getAllCurrencies2( const Locale& rLocale )
         Sequence< Currency2 > seq(currencyCount);
         for(int i = 0, nOff = 0; i < currencyCount; i++, nOff += 8 ) {
             Currency2 cur(
-                    allCurrencies[nOff],        // string ID
-                    allCurrencies[nOff+1],      // string Symbol
-                    allCurrencies[nOff+2],      // string BankSymbol
-                    allCurrencies[nOff+3],      // string Name
+                    OUString(allCurrencies[nOff]), // string ID
+                    OUString(allCurrencies[nOff+1]), // string Symbol
+                    OUString(allCurrencies[nOff+2]), // string BankSymbol
+                    OUString(allCurrencies[nOff+3]), // string Name
                     allCurrencies[nOff+4][0] != 0, // boolean Default
                     allCurrencies[nOff+5][0] != 0, // boolean UsedInCompatibleFormatCodes
                     allCurrencies[nOff+6][0],   // short DecimalPlaces
@@ -876,10 +878,10 @@ LocaleDataImpl::getAllFormats( const Locale& rLocale )
             {
                 FormatElement elem(
                         OUString(formatArray[nOff]).replaceAll(s.from, s.to),
-                        formatArray[nOff + 1],
-                        formatArray[nOff + 2],
-                        formatArray[nOff + 3],
-                        formatArray[nOff + 4],
+                        OUString(formatArray[nOff + 1]),
+                        OUString(formatArray[nOff + 2]),
+                        OUString(formatArray[nOff + 3]),
+                        OUString(formatArray[nOff + 4]),
                         formatArray[nOff + 5][0],
                         formatArray[nOff + 6][0] != 0);
                 seq[f] = elem;
@@ -944,7 +946,8 @@ LocaleDataImpl::getCollatorImplementations( const Locale& rLocale )
         sal_Unicode **collatorArray = func(collatorCount);
         Sequence< Implementation > seq(collatorCount);
         for(sal_Int16 i = 0; i < collatorCount; i++) {
-            Implementation impl(collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_ALGO],
+            Implementation impl(
+                    OUString(collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_ALGO]),
                     collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_DEFAULT][0] != 0);
             seq[i] = impl;
         }
@@ -1163,11 +1166,11 @@ LocaleDataImpl::getLanguageCountryInfo( const Locale& rLocale )
     if ( func ) {
         sal_Int16 LCInfoCount = 0;
         sal_Unicode **LCInfoArray = func(LCInfoCount);
-        LanguageCountryInfo info(LCInfoArray[0],
-                LCInfoArray[1],
-                LCInfoArray[2],
-                LCInfoArray[3],
-                LCInfoArray[4]);
+        LanguageCountryInfo info{OUString(LCInfoArray[0]),
+                OUString(LCInfoArray[1]),
+                OUString(LCInfoArray[2]),
+                OUString(LCInfoArray[3]),
+                OUString(LCInfoArray[4])};
         return info;
     }
     else {
@@ -1186,7 +1189,8 @@ LocaleDataImpl::getForbiddenCharacters( const Locale& rLocale )
     if ( func ) {
         sal_Int16 LCForbiddenCharactersCount = 0;
         sal_Unicode **LCForbiddenCharactersArray = func(LCForbiddenCharactersCount);
-        ForbiddenCharacters chars(LCForbiddenCharactersArray[0], LCForbiddenCharactersArray[1]);
+        ForbiddenCharacters chars{
+            OUString(LCForbiddenCharactersArray[0]), OUString(LCForbiddenCharactersArray[1])};
         return chars;
     }
     else {
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index cba3c47f5155..035f407c7672 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -213,14 +213,14 @@ public:
 
 #if defined LIBO_INTERNAL_ONLY
 
-    template<typename T> OUString(
+    template<typename T> explicit OUString(
         T const & value,
         typename libreoffice_internal::CharPtrDetector<T, libreoffice_internal::Dummy>::TypeUtf16
             = libreoffice_internal::Dummy()):
         pData(nullptr)
     { rtl_uString_newFromStr(&pData, value); }
 
-    template<typename T> OUString(
+    template<typename T> explicit OUString(
         T & value,
         typename
         libreoffice_internal::NonConstCharArrayDetector<T, libreoffice_internal::Dummy>::TypeUtf16
@@ -560,6 +560,22 @@ public:
         }
         return *this;
     }
+
+    template<typename T>
+    OUString & operator =(OUStringNumber<T> && n) {
+        // n.length should never be zero, so no need to add an optimization for that case
+        rtl_uString_newFromStr_WithLength(&pData, n.buf, n.length);
+        return *this;
+    }
+
+    OUString & operator =(std::u16string_view sv) {
+        if (sv.empty()) {
+            rtl_uString_new(&pData);
+        } else {
+            rtl_uString_newFromStr_WithLength(&pData, sv.data(), sv.size());
+        }
+        return *this;
+    }
 #endif
 
 #if defined LIBO_INTERNAL_ONLY
@@ -642,6 +658,15 @@ public:
         return *this;
     }
     void operator +=(OUStringLiteral const &) && = delete;
+
+    OUString & operator +=(std::u16string_view sv) & {
+        if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
+            throw std::bad_alloc();
+        }
+        rtl_uString_newConcatUtf16L(&pData, pData, sv.data(), sv.size());
+        return *this;
+    }
+    void operator +=(std::u16string_view) && = delete;
 #endif
 
 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
@@ -1614,18 +1639,30 @@ public:
 #if defined LIBO_INTERNAL_ONLY
 
     template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
-    operator ==(OUString const & s1, T const & s2) { return s1.compareTo(s2) == 0; }
+    operator ==(OUString const & s1, T const & s2) {
+        return rtl_ustr_compare_WithLength(s1.getStr(), s1.getLength(), s2, rtl_ustr_getLength(s2))
+            == 0;
+    }
 
     template<typename T>
     friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
-    operator ==(OUString const & s1, T & s2) { return s1.compareTo(s2) == 0; }
+    operator ==(OUString const & s1, T & s2) {
+        return rtl_ustr_compare_WithLength(s1.getStr(), s1.getLength(), s2, rtl_ustr_getLength(s2))
+            == 0;
+    }
 
     template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
-    operator ==(T const & s1, OUString const & s2) { return s2.compareTo(s1) == 0; }
+    operator ==(T const & s1, OUString const & s2) {
+        return rtl_ustr_compare_WithLength(s1, rtl_ustr_getLength(s1), s2.getStr(), s2.getLength())
+            == 0;
+    }
 
     template<typename T>
     friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
-    operator ==(T & s1, OUString const & s2) { return s2.compareTo(s1) == 0; }
+    operator ==(T & s1, OUString const & s2) {
+        return rtl_ustr_compare_WithLength(s1, rtl_ustr_getLength(s1), s2.getStr(), s2.getLength())
+            == 0;
+    }
 
     template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
     operator !=(OUString const & s1, T const & s2) { return !(s1 == s2); }
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index bf8e8fbcd9d6..71cee43ffad8 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -174,7 +174,7 @@ namespace
         }
         else
         {
-            has_parent = !osl::systemPathIsLogicalDrivePattern(path);
+            has_parent = !osl::systemPathIsLogicalDrivePattern(OUString(path));
         }
         return has_parent;
     }
diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx
index 25b356a74d0b..5fb9a46348b2 100644
--- a/sal/osl/w32/procimpl.cxx
+++ b/sal/osl/w32/procimpl.cxx
@@ -102,7 +102,7 @@ namespace /* private */
 
         while (size_t l = wcslen(p))
         {
-            environment->push_back(o3tl::toU(p));
+            environment->push_back(OUString(o3tl::toU(p)));
             p += l + 1;
         }
         FreeEnvironmentStringsW(env);
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index 52f6738e8205..f1c46e8f2568 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -651,7 +651,7 @@ oslSocketResult SAL_CALL osl_getLocalHostname (rtl_uString **strLocalHostname)
 
             if (rtl_ustr_getLength(LocalHostname) > 0)
             {
-                return {osl_Socket_Ok, LocalHostname};
+                return {osl_Socket_Ok, OUString(LocalHostname)};
             }
 
             return {osl_Socket_Error, OUString()};
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 9bf73c421d45..32eafc2f6db2 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -4975,14 +4975,14 @@ namespace osl_Directory
         if (i == path.getLength())
             buffer[i] = 0;
 
-        Directory::remove(buffer);
+        Directory::remove(OUString(buffer));
 
         i = rtl_ustr_lastIndexOfChar(buffer, '/');
         assert(i != -1);
         if (i != -1)
         {
             buffer[i] = 0;
-            Directory::remove(buffer);
+            Directory::remove(OUString(buffer));
         }
     }
 
diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx
index 0026975fa760..b5e46ee3eccd 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -389,7 +389,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
         if ( ( lRet == ERROR_SUCCESS ) && ( Type == REG_SZ ) &&  ( _waccess( o3tl::toW(PathW), 0 ) == 0 ) )
         {
             CPPUNIT_ASSERT_EQUAL_MESSAGE( "#Convert from system path to URL failed.",
-                                    ::osl::File::E_None, ::osl::File::getFileURLFromSystemPath( PathW, strConfigDirectory ) );
+                                    ::osl::File::E_None, ::osl::File::getFileURLFromSystemPath( OUString(PathW), strConfigDirectory ) );
         }
 
         lSize = sizeof(PathW);
@@ -397,7 +397,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
         if ( ( lRet == ERROR_SUCCESS ) && ( Type == REG_SZ ) &&  ( _waccess( o3tl::toW(PathW), 0 ) == 0 ) )
         {
             CPPUNIT_ASSERT_EQUAL_MESSAGE( "#Convert from system path to URL failed.",
-                                    ::osl::File::E_None, ::osl::File::getFileURLFromSystemPath( PathW, strHomeDirectory ) );
+                                    ::osl::File::E_None, ::osl::File::getFileURLFromSystemPath( OUString(PathW), strHomeDirectory ) );
         }
 
         RegCloseKey(hRegKey);
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 867bca1e3ba5..6824a701e879 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2938,7 +2938,7 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray )
         else
         {
             // Old (deprecated) addins first for legacy.
-            if (ScGlobal::GetLegacyFuncCollection()->findByName(cSymbol))
+            if (ScGlobal::GetLegacyFuncCollection()->findByName(OUString(cSymbol)))
             {
                 aIntName = cSymbol;
             }
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 2eadf26ed64d..84909c1bab13 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1189,7 +1189,7 @@ OUString ModelData_Impl::GetRecommendedDir( const OUString& aSuggestedDir )
             if( SUCCEEDED(hRes) )
             {
                 OUString sTempINetFiles;
-                if( osl::FileBase::getFileURLFromSystemPath(o3tl::toU(sPath), sTempINetFiles) == osl::FileBase::E_None )
+                if( osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(sPath)), sTempINetFiles) == osl::FileBase::E_None )
                     bIsInTempPath = !sTempINetFiles.isEmpty() && sLocationURL.startsWith( sTempINetFiles );
             }
         }
diff --git a/shell/source/win32/simplemail/smplmailclient.cxx b/shell/source/win32/simplemail/smplmailclient.cxx
index 205b3eb5344d..1396bd150066 100644
--- a/shell/source/win32/simplemail/smplmailclient.cxx
+++ b/shell/source/win32/simplemail/smplmailclient.cxx
@@ -73,7 +73,7 @@ namespace /* private */
             lret = RegQueryValueW(hkey, nullptr, buff, &sz);
             if (lret == ERROR_SUCCESS)
             {
-                osl::FileBase::getFileURLFromSystemPath(o3tl::toU(buff), altSenddocUrl);
+                osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(buff)), altSenddocUrl);
             }
             RegCloseKey(hkey);
         }
diff --git a/svl/source/svdde/ddedata.cxx b/svl/source/svdde/ddedata.cxx
index c57de4a9ac0b..0a14525c8a31 100644
--- a/svl/source/svdde/ddedata.cxx
+++ b/svl/source/svdde/ddedata.cxx
@@ -160,7 +160,7 @@ SotClipboardFormatId DdeData::GetInternalFormat(sal_uLong nFmt)
             WCHAR szName[ 256 ];
 
             if(GetClipboardFormatNameW( nFmt, szName, SAL_N_ELEMENTS(szName) ))
-                return SotExchange::RegisterFormatName( o3tl::toU(szName) );
+                return SotExchange::RegisterFormatName( OUString(o3tl::toU(szName)) );
         }
 #endif
         break;
diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx
index b2162e3a4a26..330e69f2b167 100644
--- a/svl/source/svdde/ddesvr.cxx
+++ b/svl/source/svdde/ddesvr.cxx
@@ -379,7 +379,7 @@ DdeItem* DdeInternal::FindItem( DdeTopic& rTopic, HSZ hItem )
         // Let's query our subclass
         WCHAR chBuf[250];
         DdeQueryStringW(pInst->hDdeInstSvr,hItem,chBuf,SAL_N_ELEMENTS(chBuf),CP_WINUNICODE );
-        bContinue = rTopic.MakeItem( o3tl::toU(chBuf) );
+        bContinue = rTopic.MakeItem( OUString(o3tl::toU(chBuf)) );
         // We need to search again
     }
     while( bContinue );
@@ -625,7 +625,7 @@ DdeItem::DdeItem( const sal_Unicode* p )
 {
     DdeInstData* pInst = ImpGetInstData();
     assert(pInst);
-    pName = new DdeString( pInst->hDdeInstSvr, p );
+    pName = new DdeString( pInst->hDdeInstSvr, OUString(p) );
     nType = DDEITEM;
     pMyTopic = nullptr;
     pImpData = nullptr;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 457f0410ce95..ba974091c481 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1967,8 +1967,8 @@ void SwWW8ImplReader::ImportDopTypography(const WW8DopTypography &rTypo)
     {
         case 2: // custom
             {
-                i18n::ForbiddenCharacters aForbidden(+rTypo.m_rgxchFPunct,
-                    +rTypo.m_rgxchLPunct);
+                i18n::ForbiddenCharacters aForbidden(OUString(+rTypo.m_rgxchFPunct),
+                    OUString(+rTypo.m_rgxchLPunct));
                     // unary + makes sure not to accidentally call the
                     // OUString(ConstCharArrayDetector<...>::TypeUtf16) ctor that takes the full
                     // m_rgxchFPunct, m_rgxchLPunct arrays with embedded NULs, instead of just the
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index f5497e800308..264f34c6d660 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -2736,7 +2736,7 @@ bool SwTransferable::PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
                     DWORD nCopied = GetLongPathNameW(o3tl::toW(sSysPath.getStr()),
                                                      o3tl::toW(aBuf.get()), 32767);
                     if (nCopied && nCopied < 32767)
-                        sText = URIHelper::SmartRel2Abs(INetURLObject(), aBuf.get(),
+                        sText = URIHelper::SmartRel2Abs(INetURLObject(), OUString(aBuf.get()),
                                                         Link<OUString*, bool>(), false);
                 }
 #endif
diff --git a/tools/source/fsys/fileutil.cxx b/tools/source/fsys/fileutil.cxx
index 9470fabd2fee..ec20e0a513bf 100644
--- a/tools/source/fsys/fileutil.cxx
+++ b/tools/source/fsys/fileutil.cxx
@@ -29,7 +29,7 @@ OUString UNCToDavURL(LPCWSTR sUNC)
         bufURL = std::make_unique<wchar_t[]>(nSize);
         nResult = DavGetHTTPFromUNCPath(sUNC, bufURL.get(), &nSize);
     }
-    return nResult == ERROR_SUCCESS ? o3tl::toU(bufURL.get()) : OUString();
+    return nResult == ERROR_SUCCESS ? OUString(o3tl::toU(bufURL.get())) : OUString();
 }
 #endif
 }
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index cc24f06f33eb..046816510087 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -464,7 +464,7 @@ namespace
             GetTTGlobalFontInfo( pTTF, &aInfo );
             // most importantly: the family name
             if( aInfo.ufamily )
-                o_rResult.SetFamilyName( aInfo.ufamily );
+                o_rResult.SetFamilyName( OUString(aInfo.ufamily) );
             else if( aInfo.family )
                 o_rResult.SetFamilyName( OStringToOUString( aInfo.family, RTL_TEXTENCODING_ASCII_US ) );
             // set weight
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index be55c9df0b40..4dac58aaafb2 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -548,7 +548,7 @@ static FontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXW& rEnumFont
     aDFA.SetSymbolFlag(rLogFont.lfCharSet == SYMBOL_CHARSET);
 
     // get the font face name
-    aDFA.SetFamilyName(o3tl::toU(rLogFont.lfFaceName));
+    aDFA.SetFamilyName(OUString(o3tl::toU(rLogFont.lfFaceName)));
 
     // use the face's style name only if it looks reasonable
     const wchar_t* pStyleName = rEnumFont.elfStyle;
@@ -558,7 +558,7 @@ static FontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXW& rEnumFont
         if( *p < 0x0020 )
             break;
     if( p < pEnd )
-        aDFA.SetStyleName(o3tl::toU(pStyleName));
+        aDFA.SetStyleName(OUString(o3tl::toU(pStyleName)));
 
     // heuristics for font quality
     // -   opentypeTT > truetype
@@ -962,7 +962,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFa
 
     wchar_t aFaceName[LF_FACESIZE+60];
     if( GetTextFaceW( getHDC(), SAL_N_ELEMENTS(aFaceName), aFaceName ) )
-        rxFontMetric->SetFamilyName(o3tl::toU(aFaceName));
+        rxFontMetric->SetFamilyName(OUString(o3tl::toU(aFaceName)));
 
     rxFontMetric->SetMinKashida(pFontInstance->GetKashidaWidth());
     rxFontMetric->ImplCalcLineSpacing(pFontInstance.get());
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index f6be2c7089f6..938cbdf88812 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1236,7 +1236,7 @@ void OOXMLFastContextHandlerValue::pushBiDiEmbedLevel()
 {
     const bool bRtl
         = mpValue && mpValue->getInt() == NS_ooxml::LN_Value_ST_Direction_rtl;
-    OOXMLFactory::characters(this, bRtl ? u"\u202B" : u"\u202A"); // RLE / LRE
+    OOXMLFactory::characters(this, bRtl ? OUString(u"\u202B") : OUString(u"\u202A")); // RLE / LRE
 }
 
 void OOXMLFastContextHandlerValue::popBiDiEmbedLevel()


More information about the Libreoffice-commits mailing list