Fix bad return value in WideString::Compare().
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>
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 8d47564..7b5bf66 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -924,7 +924,7 @@
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 {