summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-23 11:23:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-04-23 19:56:53 +0200
commit1e3d0a57689006cd7244481958025177c01e4d09 (patch)
treeda42b50e8d212b20a4318b21f2d67d44113ced49
parent7482a400cc90ddb8bf1d53d7655a4027e50fe593 (diff)
fix bad comparison in StrCmp/StrLess
comment from Miklos: > Won't this do a comparison of two null-terminated strings, while > the strings here are utf16, i.e. abc is a\0b\0c\0? That would mean > in practice you compare the first char only. introduced in commit 003d11f410b7e515981b3efbd65d936d94d87121 Date: Sat Apr 20 08:32:33 2019 +0200 tdf#81765 slow loading of .ods with >1000 of conditional formats Change-Id: I60ea18772753f50f880c65d8cff594267d724e76 Reviewed-on: https://gerrit.libreoffice.org/71114 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/core/data/patattr.cxx10
1 files changed, 2 insertions, 8 deletions
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index bff76e330233..13639a9977e3 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -117,10 +117,7 @@ static bool StrCmp( const OUString* pStr1, const OUString* pStr2 )
return false;
if (!pStr1 && pStr2)
return false;
- // we don't care about a proper lexicographic ordering, we just care about a stable order, and
- // this is faster
- return strcmp(reinterpret_cast<const char*>(pStr1->getStr()),
- reinterpret_cast<const char*>(pStr2->getStr())) == 0;
+ return *pStr1 == *pStr2;
}
static bool StrLess( const OUString* pStr1, const OUString* pStr2 )
@@ -131,10 +128,7 @@ static bool StrLess( const OUString* pStr1, const OUString* pStr2 )
return false;
if (!pStr1 && pStr2)
return true;
- // we don't care about a proper lexicographic ordering, we just care about a stable order, and
- // this is faster
- return strcmp(reinterpret_cast<const char*>(pStr1->getStr()),
- reinterpret_cast<const char*>(pStr2->getStr())) < 0;
+ return *pStr1 < *pStr2;
}
static bool EqualPatternSets( const SfxItemSet& rSet1, const SfxItemSet& rSet2 )