diff options
author | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2016-12-26 13:43:15 +0300 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2017-12-18 01:07:54 -0500 |
commit | eb3dd8fbb2ffd8465dcfd43f81445489054e91e5 (patch) | |
tree | bc9f89835ebbc08a691a948b3ac7727067a7814f /desktop | |
parent | 3c4333c24882d6699b65d109f2cfbf7daf3122c6 (diff) |
Fix inefficient usage of string::find() in condition (CWE597)
string::compare() will be faster when string::find's result is
compared with 0, because it will not scan the whole string.
Change-Id: I78596a6d796fe9779f88b7c7b91da09aa27b7035
Reviewed-on: https://gerrit.libreoffice.org/32430
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
(cherry picked from commit 8885343a33365d2570513073c3666428aa79dbdf)
(cherry picked from commit 0f839fba28a2e50d5bfa0a131c68d493903045c0)
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 3cd8e1220753..0256126c19d6 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -394,7 +394,7 @@ struct RectangleAndPart static RectangleAndPart Create(const std::string& rPayload) { RectangleAndPart aRet; - if (rPayload.find("EMPTY") == 0) // payload starts with "EMPTY" + if (rPayload.compare(0, 5, "EMPTY") == 0) // payload starts with "EMPTY" { aRet.m_aRectangle = Rectangle(0, 0, SfxLokHelper::MaxTwips, SfxLokHelper::MaxTwips); if (comphelper::LibreOfficeKit::isPartInInvalidation()) |