diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-27 09:45:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-29 08:31:10 +0200 |
commit | 560a0f2fbe452d25fe78d6756919c11ec67f630f (patch) | |
tree | 71453d01203c6ecf28bc1eeed0987ee3d25cd6ad | |
parent | 9eae555542ce01cb289b9e736454abcf835b8394 (diff) |
tdf#63640 FILEOPEN/FILESAVE: particular .odt loads/saves very slow, part3
Reduce time spent constructing strings from char arrays just to do a
comparison
Change-Id: I7af99747530d91d57e1a5b789ca9989a616428fc
Reviewed-on: https://gerrit.libreoffice.org/71464
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | svx/source/unodraw/unoprov.cxx | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 0d31e6e04231..0bb5d1363d45 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -1542,16 +1542,33 @@ static bool SvxUnoConvertResourceString(const char **pSourceResIds, const char** for (int i = 0; i < nCount; ++i) { - const OUString aCompare = bToApi ? SvxResId(pSourceResIds[i]) : OUString::createFromAscii(pSourceResIds[i]); - if( aShortString == aCompare ) + if (bToApi) { - rString = rString.replaceAt( 0, aShortString.getLength(), bToApi ? OUString::createFromAscii(pDestResIds[i]) : SvxResId(pDestResIds[i]) ); - return true; + const OUString & aCompare = SvxResId(pSourceResIds[i]); + if( aShortString == aCompare ) + { + rString = rString.replaceAt( 0, aShortString.getLength(), OUString::createFromAscii(pDestResIds[i]) ); + return true; + } + else if( rString == aCompare ) + { + rString = OUString::createFromAscii(pDestResIds[i]); + return true; + } } - else if( rString == aCompare ) + else { - rString = bToApi ? OUString::createFromAscii(pDestResIds[i]) : SvxResId(pDestResIds[i]); - return true; + auto pCompare = pSourceResIds[i]; + if( aShortString.equalsAscii(pCompare) ) + { + rString = rString.replaceAt( 0, aShortString.getLength(), SvxResId(pDestResIds[i]) ); + return true; + } + else if( rString.equalsAscii(pCompare) ) + { + rString = SvxResId(pDestResIds[i]); + return true; + } } } |