diff options
author | Eike Rathke <erack@redhat.com> | 2013-03-18 18:57:05 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-03-18 19:01:19 +0100 |
commit | 9377aeb5fade9baee55fb3301b057f203a62124b (patch) | |
tree | 535f9609b21ebf2f9edeaa9d57e2d5b5b9d0f606 /svl | |
parent | 1c0ea49edb8b798aa6a18b14a7acf957703f504a (diff) |
use switch instead of multiple ifs
Change-Id: Ib928f7e80aa185119c37b400e8a3e002619ffd41
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zformat.cxx | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 87b7740f17ff..869b724c1543 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1292,20 +1292,24 @@ sal_Unicode toUniChar(sal_uInt8 n) return sal_Unicode(c); } -bool IsSingleSymbol(OUStringBuffer& rStringBuffer, sal_Int32 nPos) +bool IsSingleSymbol( OUStringBuffer& rStringBuffer, sal_Int32 nPos ) { - bool ret = false; + bool bRet = false; while (nPos >= 0) { - if(rStringBuffer[nPos] == '*' || rStringBuffer[nPos] == '\\' || rStringBuffer[nPos] == '_') + switch (rStringBuffer[nPos]) { - ret = !ret; - nPos--; + case '*': + case '\\': + case '_': + bRet = !bRet; + --nPos; + break; + default: + return bRet; } - else - return ret; } - return ret; + return bRet; } } // namespace @@ -1556,7 +1560,7 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString, } break; case SsGetString: - if (cToken == ';' && (nPos < 2 || !IsSingleSymbol(rString, nPos-2))) + if (cToken == ';' && (nPos < 2 || !IsSingleSymbol( rString, nPos-2))) { eState = SsStop; } |