Strength-reduce ReplaceOneChar parameter from string to single character

Change-Id: I890d101ba671e91870ab18e82553c8ed8aa75f86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106572
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2020-11-25 09:56:07 +01:00
parent b1404b5919
commit 0a94c20e2c

View File

@@ -973,7 +973,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccTextBase::put_XInterface(hyper pXInterface
LEAVE_PROTECTED_BLOCK LEAVE_PROTECTED_BLOCK
} }
static OUString ReplaceOneChar(OUString const & oldOUString, OUString const & replacedChar, OUString const & replaceStr) static OUString ReplaceOneChar(OUString const & oldOUString, sal_Unicode replacedChar, OUString const & replaceStr)
{ {
auto s = oldOUString; auto s = oldOUString;
int iReplace = s.lastIndexOf(replacedChar); int iReplace = s.lastIndexOf(replacedChar);
@@ -991,11 +991,11 @@ static OUString ReplaceOneChar(OUString const & oldOUString, OUString const & re
static OUString ReplaceFourChar(OUString const & oldOUString) static OUString ReplaceFourChar(OUString const & oldOUString)
{ {
auto s = oldOUString; auto s = oldOUString;
s = ReplaceOneChar(s, "\\", "\\\\"); s = ReplaceOneChar(s, '\\', "\\\\");
s = ReplaceOneChar(s, ";", "\\;"); s = ReplaceOneChar(s, ';', "\\;");
s = ReplaceOneChar(s, "=", "\\="); s = ReplaceOneChar(s, '=', "\\=");
s = ReplaceOneChar(s, ",", "\\,"); s = ReplaceOneChar(s, ',', "\\,");
s = ReplaceOneChar(s, ":", "\\:"); s = ReplaceOneChar(s, ':', "\\:");
return s; return s;
} }