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 /desktop | |
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 'desktop')
-rw-r--r-- | desktop/source/deployment/misc/dp_misc.cxx | 3 | ||||
-rw-r--r-- | desktop/source/deployment/misc/dp_ucb.cxx | 15 |
2 files changed, 11 insertions, 7 deletions
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 031d599050f2..568ab79d4ec1 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/deployment/ExtensionManager.hpp> #include <com/sun/star/task/OfficeRestartManager.hpp> #include <memory> +#include <string_view> #include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <salhelper/linkhelper.hxx> @@ -266,7 +267,7 @@ OUString makeURL( OUString const & baseURL, OUString const & relPath_ ) { OUStringBuffer buf; if (baseURL.getLength() > 1 && baseURL[ baseURL.getLength() - 1 ] == '/') - buf.appendCopy( baseURL, 0, baseURL.getLength() - 1 ); + buf.append( std::u16string_view(baseURL).substr(0, baseURL.getLength() - 1) ); else buf.append( baseURL ); OUString relPath(relPath_); diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx index 75bbbe843142..35be6bb90918 100644 --- a/desktop/source/deployment/misc/dp_ucb.cxx +++ b/desktop/source/deployment/misc/dp_ucb.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> #include <dp_misc.h> #include <dp_ucb.h> @@ -216,18 +219,18 @@ bool readLine( OUString * res, OUString const & startingWith, { pos = file.indexOf( LF, pos ); if (pos < 0) { // EOF - buf.appendCopy( file, start ); + buf.append( std::u16string_view(file).substr(start) ); } else { if (pos > 0 && file[ pos - 1 ] == CR) { // consume extra CR - buf.appendCopy( file, start, pos - start - 1 ); + buf.append( std::u16string_view(file).substr(start, pos - start - 1) ); ++pos; } else - buf.appendCopy( file, start, pos - start ); + buf.append( std::u16string_view(file).substr(start, pos - start) ); ++pos; // consume LF // check next line: if (pos < file.getLength() && @@ -271,16 +274,16 @@ bool readProperties( std::vector< std::pair< OUString, OUString> > & out_result, bool bEOF = false; pos = file.indexOf( LF, pos ); if (pos < 0) { // EOF - buf.appendCopy( file, start ); + buf.append( std::u16string_view(file).substr(start) ); bEOF = true; } else { if (pos > 0 && file[ pos - 1 ] == CR) // consume extra CR - buf.appendCopy( file, start, pos - start - 1 ); + buf.append( std::u16string_view(file).substr(start, pos - start - 1) ); else - buf.appendCopy( file, start, pos - start ); + buf.append( std::u16string_view(file).substr(start, pos - start) ); pos++; } OUString aLine = buf.makeStringAndClear(); |