diff options
author | tsepez <tsepez@chromium.org> | 2016-09-15 11:55:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-15 11:55:00 -0700 |
commit | 8f53f54a9ccada2ea8651f2786f1bbee323f09b7 (patch) | |
tree | e5592afacbaa9e862c0934549faf908bb100c5bd /core/fxcrt/include/fx_string.h | |
parent | 38fd84428a1ea007a043be0b7d9b289e47aa5da0 (diff) | |
download | pdfium-8f53f54a9ccada2ea8651f2786f1bbee323f09b7.tar.xz |
Add short-cut in CFX_{Byte,Wide}String::Operator<()
Strings are never less than themselves, and this will occur given
the shared CoW nature of these strings.
Review-Url: https://codereview.chromium.org/2347433004
Diffstat (limited to 'core/fxcrt/include/fx_string.h')
-rw-r--r-- | core/fxcrt/include/fx_string.h | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h index c1bd82dd74..48378586d3 100644 --- a/core/fxcrt/include/fx_string.h +++ b/core/fxcrt/include/fx_string.h @@ -88,11 +88,7 @@ class CFX_ByteString { return !(*this == other); } - bool operator<(const CFX_ByteString& str) const { - int result = FXSYS_memcmp(c_str(), str.c_str(), - std::min(GetLength(), str.GetLength())); - return result < 0 || (result == 0 && GetLength() < str.GetLength()); - } + bool operator<(const CFX_ByteString& str) const; const CFX_ByteString& operator=(const FX_CHAR* str); const CFX_ByteString& operator=(const CFX_ByteStringC& bstrc); @@ -295,11 +291,7 @@ class CFX_WideString { return !(*this == other); } - bool operator<(const CFX_WideString& str) const { - int result = - wmemcmp(c_str(), str.c_str(), std::min(GetLength(), str.GetLength())); - return result < 0 || (result == 0 && GetLength() < str.GetLength()); - } + bool operator<(const CFX_WideString& str) const; FX_WCHAR GetAt(FX_STRSIZE nIndex) const { return m_pData ? m_pData->m_String[nIndex] : 0; |