[Libreoffice-commits] .: svl/source svtools/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Oct 9 14:37:12 PDT 2012
svl/source/numbers/zformat.cxx | 2 +-
svtools/source/misc/ehdl.cxx | 40 +++++++++-------------------------------
2 files changed, 10 insertions(+), 32 deletions(-)
New commits:
commit 55149144cb926513ef250c87fdf0c59e11e2f6cf
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Oct 9 23:32:18 2012 +0200
SfxErrorHandler::CreateString: remove pointless loops
Change-Id: I585add18ea917249df252827e0eee944e59ce410
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 4049881..447bcf5 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -4721,7 +4721,7 @@ OUString SvNumberformat::GetMappedFormatstring(
{ // append empty subformats
aStr.append( ';' );
}
- return aStr.getStr();
+ return aStr.makeStringAndClear();
}
String SvNumberformat::ImpGetNatNumString( const SvNumberNatNum& rNum,
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index 97b81fd..1fac294 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -192,13 +192,7 @@ sal_Bool SfxErrorHandler::CreateString(
{
if(GetMessageString(nErrCode, rStr, nFlags))
{
- for (xub_StrLen i = 0; i < rStr.getLength();)
- {
- if( rStr.indexOf(OUString("$(ARG1)"), i) == -1 )
- break;
- rStr = rStr.replaceAll("$(ARG1)", pMsgInfo->GetMessageArg(), i);
- i = i + pMsgInfo->GetMessageArg().getLength();
- }
+ rStr = rStr.replaceAll("$(ARG1)", pMsgInfo->GetMessageArg());
return sal_True;
}
}
@@ -206,35 +200,19 @@ sal_Bool SfxErrorHandler::CreateString(
{
StringErrorInfo *pStringInfo=PTR_CAST(StringErrorInfo,pErr);
if(pStringInfo)
- for (xub_StrLen i = 0; i < rStr.getLength();)
- {
- if( rStr.indexOf("$(ARG1)", i) == -1 )
- break;
- rStr = rStr.replaceAll(rtl::OUString("$(ARG1)"),
- pStringInfo->GetErrorString(), i);
- i = i + pStringInfo->GetErrorString().getLength();
- }
+ {
+ rStr = rStr.replaceAll(rtl::OUString("$(ARG1)"),
+ pStringInfo->GetErrorString());
+ }
else
{
TwoStringErrorInfo * pTwoStringInfo = PTR_CAST(TwoStringErrorInfo,
pErr);
if (pTwoStringInfo)
- for (sal_uInt16 i = 0; i < rStr.getLength();)
- {
- sal_uInt16 nArg1Pos = rStr.indexOf(rtl::OUString("$(ARG1)"), i);
- sal_uInt16 nArg2Pos = rStr.indexOf(rtl::OUString("$(ARG2)"), i);
- if (nArg1Pos < nArg2Pos)
- {
- rStr = rStr.replaceAt(nArg1Pos, 7, pTwoStringInfo->GetArg1());
- i = nArg1Pos + pTwoStringInfo->GetArg1().getLength();
- }
- else if (nArg2Pos < nArg1Pos)
- {
- rStr = rStr.replaceAt(nArg2Pos, 7, pTwoStringInfo->GetArg2());
- i = nArg2Pos + pTwoStringInfo->GetArg2().getLength();
- }
- else break;
- }
+ {
+ rStr = rStr.replaceAll("$(ARG1)", pTwoStringInfo->GetArg1());
+ rStr = rStr.replaceAll("$(ARG2)", pTwoStringInfo->GetArg2());
+ }
}
return sal_True;
}
More information about the Libreoffice-commits
mailing list