summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-09-13 15:13:55 +0200
committerLuboš Luňák <l.lunak@collabora.com>2019-09-24 12:58:14 +0200
commit2f5f45921b05904a4be1ff633be09c62cb44ff08 (patch)
treeddd0cd5ef0349706f935d8360db88343347639a3 /sc
parenta7d40f575463467698df76f041e558cb3bea7c85 (diff)
support O(U)String::number() for fast string concatenation
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 <l.lunak@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr7.cxx2
-rw-r--r--sc/source/filter/excel/xepage.cxx4
-rw-r--r--sc/source/filter/inc/xestream.hxx6
3 files changed, 6 insertions, 6 deletions
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index 908c1d20aef2..4e682b531df8 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -437,7 +437,7 @@ void ScInterpreter::ScEncodeURL()
else
{
aUrlBuf.append( '%' );
- OString convertedChar = OString::number( static_cast<unsigned char>( c ), 16 ).toAsciiUpperCase();
+ OString convertedChar = OString( OString::number( static_cast<unsigned char>( c ), 16 )).toAsciiUpperCase();
// RFC 3986 indicates:
// "A percent-encoded octet is encoded as a character triplet,
// consisting of the percent character "%" followed by the two hexadecimal digits
diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx
index 3e32ab1f3251..9783ea5e5fc0 100644
--- a/sc/source/filter/excel/xepage.cxx
+++ b/sc/source/filter/excel/xepage.cxx
@@ -95,8 +95,8 @@ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
}
else
{
- pAttrList->add( XML_paperWidth, OString::number( mrData.mnPaperWidth ).concat("mm").getStr() );
- pAttrList->add( XML_paperHeight, OString::number( mrData.mnPaperHeight ).concat("mm").getStr() );
+ pAttrList->add( XML_paperWidth, OString(OString::number( mrData.mnPaperWidth ) + "mm").getStr() );
+ pAttrList->add( XML_paperHeight, OString(OString::number( mrData.mnPaperHeight ) + "mm").getStr() );
// pAttrList->add( XML_paperUnits, "mm" );
}
pAttrList->add( XML_scale, OString::number( mrData.mnScaling ).getStr() );
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index 93b070a55da9..6b8152bc6b48 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -287,12 +287,12 @@ public:
sax_fastparser::FSHelperPtr GetStreamForPath( const OUString& rPath );
template <typename Str, typename... Args>
- void WriteAttributes(sal_Int32 nAttribute, const Str& value, Args... rest)
+ void WriteAttributes(sal_Int32 nAttribute, Str&& value, Args&&... rest)
{
- WriteAttribute(nAttribute, value);
+ WriteAttribute(nAttribute, std::forward<Str>(value));
// coverity[stray_semicolon : FALSE] - coverity parse error
if constexpr(sizeof...(rest) > 0)
- WriteAttributes(rest...);
+ WriteAttributes(std::forward<Args>(rest)...);
}
sax_fastparser::FSHelperPtr CreateOutputStream (