From 2f5f45921b05904a4be1ff633be09c62cb44ff08 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Fri, 13 Sep 2019 15:13:55 +0200 Subject: support O(U)String::number() for fast string concatenation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When I did the fast string concatenation, I didn't add any support for number(), which simply returned a O(U)String, and so it did the extra allocation/deallocation, although that could be avoided. In order to support this, number() now returns a special temporary return type, similarly to O(U)StringConcat, which allows delaying the concatenation the same way. Also similarly, the change of the return type in some cases requires explicit cast to the actual string type. Usage of OString::getStr() is so extensive in the codebase that I actually added it to the helper class, after that it's only relatively few cases. Change-Id: Iba6e158010e1e458089698c426803052b6f46031 Reviewed-on: https://gerrit.libreoffice.org/78873 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- connectivity/source/drivers/file/FStringFunctions.cxx | 2 +- connectivity/source/drivers/flat/ETable.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'connectivity/source') diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx index c8d9977472a6..06e62a1a4cc2 100644 --- a/connectivity/source/drivers/file/FStringFunctions.cxx +++ b/connectivity/source/drivers/file/FStringFunctions.cxx @@ -103,7 +103,7 @@ ORowSetValue OOp_Locate::operate(const std::vector& lhs) const return ORowSetValue(); if ( lhs.size() == 2 ) - return OUString::number(lhs[0].getString().indexOf(lhs[1].getString())+1); + return OUString(OUString::number(lhs[0].getString().indexOf(lhs[1].getString())+1)); else if ( lhs.size() != 3 ) return ORowSetValue(); diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index bc978bcc3599..0e2290dddc91 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -681,7 +681,7 @@ bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool // #99178# OJ if ( DataType::DECIMAL == nType || DataType::NUMERIC == nType ) - *(_rRow->get())[i] = OUString::number(nVal); + *(_rRow->get())[i] = OUString(OUString::number(nVal)); else *(_rRow->get())[i] = nVal; } break; -- cgit