connectivity/source/commontools/dbcharset.cxx                   |    6 +--
 dbaccess/source/ui/control/charsetlistbox.cxx                   |    2 -
 dbaccess/source/ui/dlg/DbAdminImpl.cxx                          |    3 -
 dbaccess/source/ui/inc/charsetlistbox.hxx                       |    2 -
 dbaccess/source/ui/inc/charsets.hxx                             |    2 -
 dbaccess/source/ui/misc/charsets.cxx                            |    2 -
 include/connectivity/dbcharset.hxx                              |    2 -
 svx/source/form/fmtextcontrolshell.cxx                          |    2 -
 ucb/source/ucp/webdav-curl/DateTimeHelper.cxx                   |   16 
+++++-----
 ucb/source/ucp/webdav-curl/DateTimeHelper.hxx                   |    6 +--
 writerfilter/source/dmapper/util.cxx                            |    2 -
 xmlhelp/source/cxxhelp/provider/databases.cxx                   |    6 +--
 xmlhelp/source/cxxhelp/provider/databases.hxx                   |    2 -
 xmlhelp/source/cxxhelp/provider/urlparameter.cxx                |    4 +-
 xmlhelp/source/cxxhelp/test/searchdemo.cxx                      |    2 -
 xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx |    2 -
 16 files changed, 30 insertions(+), 31 deletions(-)

New commits:
commit 3fbadf2801f4c13f086d76a3ed566180cc0693dc
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Apr 7 17:53:00 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Apr 9 16:28:13 2023 +0200

    use more OUStringToOString
    
    which makes it easier to pass around string_view in a few places.
    
    Change-Id: Icbbb7f56494986582f1c3272404775bd98031240
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150129
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/connectivity/source/commontools/dbcharset.cxx 
b/connectivity/source/commontools/dbcharset.cxx
index 9e0b9ac2dd07..381afa606e08 100644
--- a/connectivity/source/commontools/dbcharset.cxx
+++ b/connectivity/source/commontools/dbcharset.cxx
@@ -93,15 +93,15 @@ namespace dbtools
     }
 
 
-    OCharsetMap::CharsetIterator    OCharsetMap::findIanaName(const OUString& 
_rIanaName) const
+    OCharsetMap::CharsetIterator    
OCharsetMap::findIanaName(std::u16string_view _rIanaName) const
     {
         ensureConstructed( );
 
         rtl_TextEncoding eEncoding = RTL_TEXTENCODING_DONTKNOW;
-        if ( !_rIanaName.isEmpty() )
+        if ( !_rIanaName.empty() )
         {
             // byte string conversion
-            OString sMimeByteString( _rIanaName.getStr(), 
_rIanaName.getLength(), RTL_TEXTENCODING_ASCII_US );
+            OString sMimeByteString = OUStringToOString( _rIanaName, 
RTL_TEXTENCODING_ASCII_US );
             // look up
             eEncoding = rtl_getTextEncodingFromMimeCharset( 
sMimeByteString.getStr() );
 
diff --git a/dbaccess/source/ui/control/charsetlistbox.cxx 
b/dbaccess/source/ui/control/charsetlistbox.cxx
index 8915b65c9455..e6090ccfd84d 100644
--- a/dbaccess/source/ui/control/charsetlistbox.cxx
+++ b/dbaccess/source/ui/control/charsetlistbox.cxx
@@ -34,7 +34,7 @@ namespace dbaui
         }
     }
 
-    void CharSetListBox::SelectEntryByIanaName( const OUString& _rIanaName )
+    void CharSetListBox::SelectEntryByIanaName( std::u16string_view _rIanaName 
)
     {
         OCharsetDisplay::const_iterator aFind = m_aCharSets.findIanaName( 
_rIanaName );
         if (aFind == m_aCharSets.end())
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx 
b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 2f60d21a9101..97210e843b00 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -860,8 +860,7 @@ OString 
ODbDataSourceAdministrationHelper::translatePropertyId( sal_Int32 _nId )
             aString = indirectPos->second;
     }
 
-    OString aReturn( aString.getStr(), aString.getLength(), 
RTL_TEXTENCODING_ASCII_US );
-    return aReturn;
+    return OUStringToOString( aString, RTL_TEXTENCODING_ASCII_US );
 }
 template<class T> static bool checkItemType(const SfxPoolItem* pItem){ return 
dynamic_cast<const T*>(pItem) != nullptr;}
 
diff --git a/dbaccess/source/ui/inc/charsetlistbox.hxx 
b/dbaccess/source/ui/inc/charsetlistbox.hxx
index aedfb6ec50a4..2b91bbb5389f 100644
--- a/dbaccess/source/ui/inc/charsetlistbox.hxx
+++ b/dbaccess/source/ui/inc/charsetlistbox.hxx
@@ -32,7 +32,7 @@ namespace dbaui
     public:
         CharSetListBox(std::unique_ptr<weld::ComboBox> xControl);
 
-        void    SelectEntryByIanaName( const OUString& _rIanaName );
+        void    SelectEntryByIanaName( std::u16string_view _rIanaName );
         bool    StoreSelectedCharSet( SfxItemSet& _rSet, const sal_uInt16 
_nItemId );
 
         weld::ComboBox* get_widget() { return m_xControl.get(); }
diff --git a/dbaccess/source/ui/inc/charsets.hxx 
b/dbaccess/source/ui/inc/charsets.hxx
index 4d4454e010d1..49977bd56262 100644
--- a/dbaccess/source/ui/inc/charsets.hxx
+++ b/dbaccess/source/ui/inc/charsets.hxx
@@ -43,7 +43,7 @@ namespace dbaui
 
         // various find operations
         const_iterator findEncoding(const rtl_TextEncoding _eEncoding) const;
-        const_iterator findIanaName(const OUString& _rIanaName) const;
+        const_iterator findIanaName(std::u16string_view _rIanaName) const;
         const_iterator findDisplayName(const OUString& _rDisplayName) const;
 
         /// get access to the first element of the charset collection
diff --git a/dbaccess/source/ui/misc/charsets.cxx 
b/dbaccess/source/ui/misc/charsets.cxx
index 3cec6284511e..5224e65d3c63 100644
--- a/dbaccess/source/ui/misc/charsets.cxx
+++ b/dbaccess/source/ui/misc/charsets.cxx
@@ -62,7 +62,7 @@ namespace dbaui
         return const_iterator( this, aBaseIter );
     }
 
-    OCharsetDisplay::const_iterator OCharsetDisplay::findIanaName(const 
OUString& _rIanaName) const
+    OCharsetDisplay::const_iterator 
OCharsetDisplay::findIanaName(std::u16string_view _rIanaName) const
     {
         OCharsetMap::const_iterator aBaseIter = 
OCharsetMap::findIanaName(_rIanaName);
         return const_iterator( this, aBaseIter );
diff --git a/include/connectivity/dbcharset.hxx 
b/include/connectivity/dbcharset.hxx
index 8d98710594ed..18ef0fe67fc3 100644
--- a/include/connectivity/dbcharset.hxx
+++ b/include/connectivity/dbcharset.hxx
@@ -73,7 +73,7 @@ namespace dbtools
         /** find the given IANA name in the map.
             @return the <em>end</em> iterator if the IANA name could not be 
found.
         */
-        CharsetIterator findIanaName(const OUString& _rIanaName) const;
+        CharsetIterator findIanaName(std::u16string_view _rIanaName) const;
 
         /// get access to the first element of the charset collection
         CharsetIterator begin() const;
diff --git a/svx/source/form/fmtextcontrolshell.cxx 
b/svx/source/form/fmtextcontrolshell.cxx
index 25b5e42ca879..ede035b9d63b 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -559,7 +559,7 @@ namespace svx
             else
                 sUnoSlotName = "<unknown>";
             OString sUnoSlotNameAscii = "\"" +
-                OString( sUnoSlotName.getStr(), sUnoSlotName.getLength(), 
RTL_TEXTENCODING_ASCII_US ) +
+                OUStringToOString( sUnoSlotName, RTL_TEXTENCODING_ASCII_US ) +
                 "\"";
 #endif
 
diff --git a/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx 
b/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx
index 06514d682fa6..6725b3c6fcf2 100644
--- a/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx
+++ b/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx
@@ -25,10 +25,10 @@ using namespace com::sun::star::util;
 
 using namespace http_dav_ucp;
 
-bool DateTimeHelper::ISO8601_To_DateTime (const OUString& s,
+bool DateTimeHelper::ISO8601_To_DateTime (std::u16string_view s,
     DateTime& dateTime)
 {
-    OString aDT (s.getStr(), s.getLength(), RTL_TEXTENCODING_ASCII_US);
+    OString aDT = OUStringToOString(s, RTL_TEXTENCODING_ASCII_US);
 
     int year, month, day, hours, minutes, off_hours, off_minutes, fix;
     double seconds;
@@ -155,7 +155,7 @@ sal_Int32 
DateTimeHelper::convertMonthToInt(std::u16string_view month)
         return 0;
 }
 
-bool DateTimeHelper::RFC2068_To_DateTime (const OUString& s,
+bool DateTimeHelper::RFC2068_To_DateTime (std::u16string_view s,
     DateTime& dateTime)
 {
     int year;
@@ -166,10 +166,10 @@ bool DateTimeHelper::RFC2068_To_DateTime (const OUString& 
s,
     char string_month[3 + 1];
     char string_day[3 + 1];
 
-    sal_Int32 found = s.indexOf (',');
-    if (found != -1)
+    size_t found = s.find(',');
+    if (found != std::u16string_view::npos)
     {
-        OString aDT (s.getStr(), s.getLength(), RTL_TEXTENCODING_ASCII_US);
+        OString aDT = OUStringToOString(s, RTL_TEXTENCODING_ASCII_US);
 
         // RFC 1123
         found = sscanf (aDT.getStr(), "%3s, %2d %3s %4d %2d:%2d:%2d GMT",
@@ -184,7 +184,7 @@ bool DateTimeHelper::RFC2068_To_DateTime (const OUString& s,
     }
     else
     {
-        OString aDT (s.getStr(), s.getLength(), RTL_TEXTENCODING_ASCII_US);
+        OString aDT = OUStringToOString(s, RTL_TEXTENCODING_ASCII_US);
 
         // ANSI C's asctime () format
         found = sscanf (aDT.getStr(), "%3s %3s %d %2d:%2d:%2d %4d",
@@ -245,7 +245,7 @@ bool DateTimeHelper::RFC2068_To_DateTime (const OUString& s,
     return found;
 }
 
-bool DateTimeHelper::convert (const OUString& s, DateTime& dateTime)
+bool DateTimeHelper::convert (std::u16string_view s, DateTime& dateTime)
 {
     if (ISO8601_To_DateTime (s, dateTime))
         return true;
diff --git a/ucb/source/ucp/webdav-curl/DateTimeHelper.hxx 
b/ucb/source/ucp/webdav-curl/DateTimeHelper.hxx
index 22a8e9519b80..35784412742f 100644
--- a/ucb/source/ucp/webdav-curl/DateTimeHelper.hxx
+++ b/ucb/source/ucp/webdav-curl/DateTimeHelper.hxx
@@ -39,14 +39,14 @@ class DateTimeHelper
 private:
     static sal_Int32 convertMonthToInt(std::u16string_view month);
 
-    static bool ISO8601_To_DateTime (const OUString&,
+    static bool ISO8601_To_DateTime (std::u16string_view,
         css::util::DateTime& );
 
-    static bool RFC2068_To_DateTime (const OUString&,
+    static bool RFC2068_To_DateTime (std::u16string_view,
         css::util::DateTime& );
 
 public:
-    static bool convert (const OUString&,
+    static bool convert (std::u16string_view,
         css::util::DateTime& );
 };
 
diff --git a/writerfilter/source/dmapper/util.cxx 
b/writerfilter/source/dmapper/util.cxx
index d5b23a3d46bc..3e22cbb72784 100644
--- a/writerfilter/source/dmapper/util.cxx
+++ b/writerfilter/source/dmapper/util.cxx
@@ -44,7 +44,7 @@ std::string 
XTextRangeToString(uno::Reference<text::XTextRange> const& textRange
             result += ")";
         }
 
-        OString aOStr(aOUStr.getStr(), aOUStr.getLength(), 
RTL_TEXTENCODING_ASCII_US);
+        OString aOStr = OUStringToOString(aOUStr, RTL_TEXTENCODING_ASCII_US);
 
         result = aOStr.getStr();
     }
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx 
b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 23ea6db661ee..be5f964ca292 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -626,7 +626,7 @@ void KeywordInfo::KeywordElement::init( Databases const 
*pDatabases,helpdatafile
 
         if( pHdf )
         {
-            OString idi( 
id[i].getStr(),id[i].getLength(),RTL_TEXTENCODING_UTF8 );
+            OString idi = OUStringToOString( id[i], RTL_TEXTENCODING_UTF8 );
             bool bSuccess = pHdf->getValueForKey( idi, aHDFData );
             if( bSuccess )
                 pData = aHDFData.getData();
@@ -1041,13 +1041,13 @@ void Databases::cascadingStylesheet( const OUString& 
Language,
 
 void Databases::setActiveText( const OUString& Module,
                                const OUString& Language,
-                               const OUString& Id,
+                               std::u16string_view Id,
                                OStringBuffer& buffer )
 {
     DataBaseIterator aDbIt( m_xContext, *this, Module, Language, true );
 
     // #i84550 Cache information about failed ids
-    OString id( Id.getStr(),Id.getLength(),RTL_TEXTENCODING_UTF8 );
+    OString id = OUStringToOString( Id, RTL_TEXTENCODING_UTF8 );
     EmptyActiveTextSet::iterator it = m_aEmptyActiveTextSet.find( id );
     bool bFoundAsEmpty = ( it != m_aEmptyActiveTextSet.end() );
     helpdatafileproxy::HDFData aHDFData;
diff --git a/xmlhelp/source/cxxhelp/provider/databases.hxx 
b/xmlhelp/source/cxxhelp/provider/databases.hxx
index dbf38e022e70..1711cba5278c 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.hxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.hxx
@@ -186,7 +186,7 @@ namespace chelp {
 
         void setActiveText( const OUString& Module,
                             const OUString& Language,
-                            const OUString& Id,
+                            std::u16string_view Id,
                             OStringBuffer& buffer );
 
         /**
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx 
b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index 493618621c46..6f92fae77db8 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -102,7 +102,7 @@ OString URLParameter::getByName( const char* par )
     else if( strcmp( par,"HelpPrefix" ) == 0 )
         val = m_aPrefix;
 
-    return OString( val.getStr(),val.getLength(),RTL_TEXTENCODING_UTF8 );
+    return OUStringToOString( val, RTL_TEXTENCODING_UTF8 );
 }
 
 
@@ -255,7 +255,7 @@ void URLParameter::readHelpDataFile()
         if( !pHdf )
             break;
 
-        OString keyStr( m_aId.getStr(),m_aId.getLength(),RTL_TEXTENCODING_UTF8 
);
+        OString keyStr = OUStringToOString( m_aId,RTL_TEXTENCODING_UTF8 );
         bSuccess = pHdf->getValueForKey( keyStr, aHDFData );
         if( bSuccess )
         {
diff --git a/xmlhelp/source/cxxhelp/test/searchdemo.cxx 
b/xmlhelp/source/cxxhelp/test/searchdemo.cxx
index cfe1a51ee369..1300e68e6126 100644
--- a/xmlhelp/source/cxxhelp/test/searchdemo.cxx
+++ b/xmlhelp/source/cxxhelp/test/searchdemo.cxx
@@ -41,7 +41,7 @@ extern RandomAccessStream* theFile();
 
 void print_rtl_OUString( const OUString bla )
 {
-    OString bluber = OString( 
bla.getStr(),bla.getLength(),RTL_TEXTENCODING_UTF8 );
+    OString bluber = OUStringToOString( bla,RTL_TEXTENCODING_UTF8 );
     char* bluberChr = new char[ 1+bluber.getLength() ];
     const char* jux = bluber.getStr();
 
diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
index d4eb48f877cd..99381e5e25fd 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
@@ -57,7 +57,7 @@ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL
     //Initialize the crypto engine
     if( sCertDB.getLength() > 0 )
     {
-        sCertDir = OString(sCertDB.getStr(), sCertDB.getLength(), 
RTL_TEXTENCODING_ASCII_US);
+        sCertDir = OUStringToOString(sCertDB, RTL_TEXTENCODING_ASCII_US);
         n_pCertStore = sCertDir.getStr();
         n_hStoreHandle = CertOpenSystemStoreW( 0, o3tl::toW(sCertDB.getStr())) 
;
         if( n_hStoreHandle == nullptr )

Reply via email to