diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-01-11 11:21:46 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-01-11 13:55:14 +0100 |
commit | 70519a43e0d89a6b5d89859a6851f8c757c6b0c7 (patch) | |
tree | bc1f4a6b6510e3bff75e9dc54eb71e2fa6cfc3c8 /svl | |
parent | a0210c5c5e8fd47b55567a8b18788d57d2b7decb (diff) |
Replace OUStringBuffer::appendCopy with append(std::u16string_view)
...which is more general
Change-Id: I94f28f8eda887120cf5f143b4549e0339b60e6a7
Reviewed-on: https://gerrit.libreoffice.org/66155
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/misc/urihelper.cxx | 6 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 12 |
2 files changed, 11 insertions, 7 deletions
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx index a424653679e8..dc60dee5f73f 100644 --- a/svl/source/misc/urihelper.cxx +++ b/svl/source/misc/urihelper.cxx @@ -18,6 +18,8 @@ */ #include <memory> +#include <string_view> + #include <sal/config.h> #include <unicode/idna.h> @@ -783,11 +785,11 @@ OUString URIHelper::resolveIdnaHost(OUString const & url) { return url; } OUStringBuffer buf(uri->getScheme()); - buf.append("://").appendCopy(auth, 0, hostStart); + buf.append("://").append(std::u16string_view(auth).substr(0, hostStart)); buf.append( reinterpret_cast<sal_Unicode const *>(ascii.getBuffer()), ascii.length()); - buf.appendCopy(auth, hostEnd).append(uri->getPath()); + buf.append(std::u16string_view(auth).substr(hostEnd)).append(uri->getPath()); if (uri->hasQuery()) { buf.append('?').append(uri->getQuery()); } diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 903fd9960200..94a6ed27bb16 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -21,6 +21,8 @@ #include <float.h> #include <errno.h> #include <stdlib.h> +#include <string_view> + #include <comphelper/string.hxx> #include <sal/log.hxx> #include <tools/debug.hxx> @@ -1734,7 +1736,7 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString, 0 <= nNatNumNum && nNatNumNum <= 19 ) { sBuffSymbol.stripStart('['); - sBuffSymbol.appendCopy( aBufStr, --nPos, aNatNum.getLength()+1 ); + sBuffSymbol.append( std::u16string_view(aBufStr).substr(--nPos, aNatNum.getLength()+1) ); nPos += aNatNum.getLength()+1; //! SymbolType is negative eSymbolType = static_cast<short>(BRACKET_SYMBOLTYPE_NATNUM0 - nNatNumNum); @@ -1744,7 +1746,7 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString, 1 <= nDBNum && nDBNum <= 9 ) { sBuffSymbol.stripStart('['); - sBuffSymbol.appendCopy( aBufStr, --nPos, aDBNum.getLength()+1 ); + sBuffSymbol.append( std::u16string_view(aBufStr).substr(--nPos, aDBNum.getLength()+1) ); nPos += aDBNum.getLength()+1; //! SymbolType is negative eSymbolType = sal::static_int_cast< short >( BRACKET_SYMBOLTYPE_DBNUM1 - (nDBNum - 1) ); @@ -1972,7 +1974,7 @@ OUString SvNumberformat::StripNewCurrencyDelimiters( const OUString& rStr ) } else { - aTmp.appendCopy(rStr, nStartPos, nPos - nStartPos ); + aTmp.append(std::u16string_view(rStr).substr(nStartPos, nPos - nStartPos) ); nStartPos = nPos + 2; sal_Int32 nDash; nEnd = nStartPos - 1; @@ -2003,13 +2005,13 @@ OUString SvNumberformat::StripNewCurrencyDelimiters( const OUString& rStr ) { nPos = nDash; } - aTmp.appendCopy(rStr, nStartPos, nPos - nStartPos ); + aTmp.append(std::u16string_view(rStr).substr(nStartPos, nPos - nStartPos) ); nStartPos = nClose + 1; } } if ( nLen > nStartPos ) { - aTmp.appendCopy(rStr, nStartPos, nLen - nStartPos ); + aTmp.append(std::u16string_view(rStr).substr(nStartPos, nLen - nStartPos) ); } return aTmp.makeStringAndClear(); } |