[Libreoffice-commits] core.git: sdext/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue May 18 11:38:58 UTC 2021


 sdext/source/pdfimport/wrapper/wrapper.cxx |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 66b4852551aa1838009fac72dc6453bf94de2dd8
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue May 18 10:23:06 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue May 18 13:38:21 2021 +0200

    Use some more std::string_view
    
    Change-Id: I7d4039e87fda447b1d2087b2430a3544e9a1eb14
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115732
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index f2439a5bb83c..9bd803d0348f 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -210,10 +210,10 @@ public:
     characters are encoded as pairs of characters: '\\' 'n', resp.
     '\\' 'r'. This function converts them back to '\n', resp. '\r'.
   */
-OString lcl_unescapeLineFeeds(const OString& i_rStr)
+OString lcl_unescapeLineFeeds(std::string_view i_rStr)
 {
-    const size_t nOrigLen(sal::static_int_cast<size_t>(i_rStr.getLength()));
-    const char* const pOrig(i_rStr.getStr());
+    const size_t nOrigLen(i_rStr.size());
+    const char* const pOrig(i_rStr.data());
     std::unique_ptr<char[]> pBuffer(new char[nOrigLen + 1]);
 
     const char* pRead(pOrig);
@@ -316,7 +316,7 @@ void LineParser::readBinaryData( uno::Sequence<sal_Int8>& rBuf )
 
 uno::Reference<rendering::XPolyPolygon2D> LineParser::readPath()
 {
-    const OString aSubPathMarker( "subpath" );
+    static const std::string_view aSubPathMarker( "subpath" );
 
     if( readNextToken() != aSubPathMarker )
         OSL_PRECOND(false, "broken path");
@@ -332,7 +332,7 @@ uno::Reference<rendering::XPolyPolygon2D> LineParser::readPath()
 
         sal_Int32 nContiguousControlPoints(0);
         sal_Int32 nDummy=m_nCharIndex;
-        OString aCurrToken( m_aLine.getToken(0,' ',nDummy) );
+        std::string_view aCurrToken( m_aLine.getTokenView(0,' ',nDummy) );
 
         while( m_nCharIndex != -1 && aCurrToken != aSubPathMarker )
         {
@@ -366,7 +366,7 @@ uno::Reference<rendering::XPolyPolygon2D> LineParser::readPath()
 
             // one token look-ahead (new subpath or more points?
             nDummy=m_nCharIndex;
-            aCurrToken = m_aLine.getToken(0,' ',nDummy);
+            aCurrToken = m_aLine.getTokenView(0,' ',nDummy);
         }
 
         aResult.append( aSubPath );
@@ -397,7 +397,7 @@ void LineParser::readChar()
     OString aChars;
 
     if (m_nCharIndex != -1)
-        aChars = lcl_unescapeLineFeeds( m_aLine.copy( m_nCharIndex ) );
+        aChars = lcl_unescapeLineFeeds( m_aLine.subView( m_nCharIndex ) );
 
     // chars gobble up rest of line
     m_nCharIndex = -1;
@@ -610,7 +610,7 @@ void LineParser::readFont()
     readInt32(nFileLen);
 
     nSize = nSize < 0.0 ? -nSize : nSize;
-    aFontName = lcl_unescapeLineFeeds( m_aLine.copy( m_nCharIndex ) );
+    aFontName = lcl_unescapeLineFeeds( m_aLine.subView( m_nCharIndex ) );
 
     // name gobbles up rest of line
     m_nCharIndex = -1;
@@ -790,7 +790,7 @@ void LineParser::readLink()
 
     m_parser.m_pSink->hyperLink( aBounds,
                         OStringToOUString( lcl_unescapeLineFeeds(
-                                m_aLine.copy(m_nCharIndex) ),
+                                m_aLine.subView(m_nCharIndex) ),
                                 RTL_TEXTENCODING_UTF8 ) );
     // name gobbles up rest of line
     m_nCharIndex = -1;


More information about the Libreoffice-commits mailing list