summaryrefslogtreecommitdiff
path: root/core/fxcrt/widestring.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-03-14 18:08:36 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-03-14 18:08:36 +0000
commit40c223e4ed41e991f81281ca08b3085e218c52dc (patch)
treeec78574acb09e871d62cfd5d9662fff242d1a21b /core/fxcrt/widestring.cpp
parent2c3cfa734d034a0f0c78e658e98ed1113eba29a8 (diff)
downloadpdfium-40c223e4ed41e991f81281ca08b3085e218c52dc.tar.xz
Fix bad return value in WideString::Compare().chromium/3371
When comparing L"a" vs L"ab", the return value should be -1 or 1, not 0 or 1. Add a regression test for this case. BUG=chromium:821454 Change-Id: I38e2d7ca62319b7a62f8d8afeb231b8ed3bd9e86 Reviewed-on: https://pdfium-review.googlesource.com/28570 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcrt/widestring.cpp')
-rw-r--r--core/fxcrt/widestring.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 8d47564e13..7b5bf66fd3 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -924,7 +924,7 @@ int WideString::Compare(const WideString& str) const {
return result;
if (this_len == that_len)
return 0;
- return this_len < that_len;
+ return this_len < that_len ? -1 : 1;
}
int WideString::CompareNoCase(const wchar_t* lpsz) const {