Kaydet (Commit) ea7e6dd4 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

use OUStringBuffer in some loops

Change-Id: Ib32fb5ddc04df1c090f9d7b319e4ff9be0c285f9
Reviewed-on: https://gerrit.libreoffice.org/58007
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst a8ed578f
......@@ -62,7 +62,7 @@ ORowSetValue OOp_Char::operate(const std::vector<ORowSetValue>& lhs) const
if ( lhs.empty() )
return ORowSetValue();
OUString sRet;
OUStringBuffer sRet;
std::vector<ORowSetValue>::const_reverse_iterator aIter = lhs.rbegin();
std::vector<ORowSetValue>::const_reverse_iterator aEnd = lhs.rend();
for (; aIter != aEnd; ++aIter)
......@@ -71,11 +71,11 @@ ORowSetValue OOp_Char::operate(const std::vector<ORowSetValue>& lhs) const
{
sal_Char c = static_cast<sal_Char>(static_cast<sal_Int32>(*aIter));
sRet += OUString(&c,1,RTL_TEXTENCODING_ASCII_US);
sRet.appendAscii(&c, 1);
}
}
return sRet;
return sRet.makeStringAndClear();
}
ORowSetValue OOp_Concat::operate(const std::vector<ORowSetValue>& lhs) const
......
......@@ -858,7 +858,7 @@ css::uno::Sequence< sal_Int32 > string2intarray( const OUString & str )
std::vector< sal_Int32 > vec;
do
{
OUString digits;
OUStringBuffer digits;
do
{
if(!iswspace(c))
......@@ -873,10 +873,10 @@ css::uno::Sequence< sal_Int32 > string2intarray( const OUString & str )
break;
if ( start == strlen)
return ret;
digits += OUString(&c, 1);
digits.append(OUString(&c, 1));
c = str.iterateCodePoints(&start);
} while ( c );
vec.push_back( digits.toInt32() );
vec.push_back( digits.makeStringAndClear().toInt32() );
do
{
if(!iswspace(c))
......
......@@ -691,7 +691,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
eState = ssGetChar;
//! All the variables below (plus ParseResult) have to be resetted on ssRewindFromValue!
OUString aSymbol;
OUStringBuffer aSymbol;
bool isFirst(true);
sal_Int32 index(nPos); // index of next code point after current
sal_Int32 postSymbolIndex(index); // index of code point following last quote
......@@ -880,13 +880,13 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
{
if ( cLast == '\\' )
{ // escaped
aSymbol += rText.copy(postSymbolIndex, nextCharIndex - postSymbolIndex - 2);
aSymbol += OUString(&current, 1);
aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex - 2);
aSymbol.append(OUString(&current, 1));
}
else
{
eState = ssStop;
aSymbol += rText.copy(postSymbolIndex, nextCharIndex - postSymbolIndex - 1);
aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex - 1);
}
postSymbolIndex = nextCharIndex;
}
......@@ -905,13 +905,13 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
{
if ( cLast == '\\' )
{ // escaped
aSymbol += rText.copy(postSymbolIndex, nextCharIndex - postSymbolIndex - 2);
aSymbol += OUString(&current, 1);
aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex - 2);
aSymbol.append(OUString(&current, 1));
}
else if (current == nextChar &&
!(nContTypes & KParseTokens::TWO_DOUBLE_QUOTES_BREAK_STRING) )
{ // "" => literal " escaped
aSymbol += rText.copy(postSymbolIndex, nextCharIndex - postSymbolIndex);
aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex);
nextCharIndex = index;
if (index < rText.getLength()) { ++nCodePoints; }
nextChar = (index < rText.getLength()) ? rText.iterateCodePoints(&index) : 0;
......@@ -919,7 +919,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
else
{
eState = ssStop;
aSymbol += rText.copy(postSymbolIndex, nextCharIndex - postSymbolIndex - 1);
aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex - 1);
}
postSymbolIndex = nextCharIndex;
}
......@@ -945,7 +945,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
index = nPos;
postSymbolIndex = nPos;
nextCharIndex = nPos;
aSymbol.clear();
aSymbol.setLength(0);
current = (index < rText.getLength()) ? rText.iterateCodePoints(&index) : 0;
nCodePoints = (nPos < rText.getLength()) ? 1 : 0;
isFirst = true;
......@@ -1028,10 +1028,10 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
{
if (postSymbolIndex < nextCharIndex)
{ //! open quote
aSymbol += rText.copy(postSymbolIndex, nextCharIndex - postSymbolIndex - 1);
aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex - 1);
r.TokenType |= KParseType::MISSING_QUOTE;
}
r.DequotedNameOrString = aSymbol;
r.DequotedNameOrString = aSymbol.toString();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment