summaryrefslogtreecommitdiffstats
path: root/connectivity/source/drivers/firebird/Util.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/firebird/Util.cxx')
-rw-r--r--connectivity/source/drivers/firebird/Util.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx
index 090e34ca2781..7befd4b99014 100644
--- a/connectivity/source/drivers/firebird/Util.cxx
+++ b/connectivity/source/drivers/firebird/Util.cxx
@@ -394,11 +394,13 @@ OUString firebird::escapeWith( const OUString& sText, const char aKey, const cha
{
OUString sRet(sText);
sal_Int32 aIndex = 0;
- while( (aIndex = sRet.indexOf(aKey, aIndex)) > 0 &&
- aIndex < sRet.getLength())
+ for (;;)
{
- sRet = sRet.replaceAt(aIndex, 1, OUStringChar(aEscapeChar) + OUStringChar(aKey) );
- aIndex+= 2;
+ aIndex = sRet.indexOf(aKey, aIndex);
+ if ( aIndex <= 0 || aIndex >= sRet.getLength())
+ break;
+ sRet = sRet.replaceAt(aIndex, 1, OUStringChar(aEscapeChar) + OUStringChar(aKey) );
+ aIndex += 2;
}
return sRet;