From 66b4852551aa1838009fac72dc6453bf94de2dd8 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 18 May 2021 10:23:06 +0200 Subject: 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 --- sdext/source/pdfimport/wrapper/wrapper.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'sdext') 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(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 pBuffer(new char[nOrigLen + 1]); const char* pRead(pOrig); @@ -316,7 +316,7 @@ void LineParser::readBinaryData( uno::Sequence& rBuf ) uno::Reference 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 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 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; -- cgit v1.2.3