Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2413)

Unified Diff: core/fxcrt/fx_basic_bstring.cpp

Issue 2347433004: Add short-cut in CFX_{Byte,Wide}String::Operator<() (Closed)
Patch Set: Logic goof Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/fx_basic_bstring.cpp
diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp
index 0b9d9873d8dc02f647d615916a6f35beab136fcf..c5979a7466ccee096568cb738a75a5ec791f2c80 100644
--- a/core/fxcrt/fx_basic_bstring.cpp
+++ b/core/fxcrt/fx_basic_bstring.cpp
@@ -216,6 +216,15 @@ bool CFX_ByteString::operator==(const CFX_ByteString& other) const {
m_pData->m_nDataLength) == 0;
}
+bool CFX_ByteString::operator<(const CFX_ByteString& str) const {
+ if (m_pData == str.m_pData)
+ return false;
+
+ int result = FXSYS_memcmp(c_str(), str.c_str(),
+ std::min(GetLength(), str.GetLength()));
+ return result < 0 || (result == 0 && GetLength() < str.GetLength());
+}
+
bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const {
if (!m_pData)
return str.IsEmpty();
« no previous file with comments | « no previous file | core/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698