diff options
author | tsepez <tsepez@chromium.org> | 2016-04-01 10:23:04 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-01 10:23:05 -0700 |
commit | 9f2970caec897c40b91bd010c04dfe1f19d11108 (patch) | |
tree | d0a289939b3b6be3fe19a412b134eeb467672db2 /core/fxcrt/fx_basic_bstring.cpp | |
parent | df4bc596c64fb848647c670be66a29ea0861b4f4 (diff) | |
download | pdfium-9f2970caec897c40b91bd010c04dfe1f19d11108.tar.xz |
Remove CFX_{Byte,Wide}String::Equal in favor of "==".
Makes the code slightly cleaner.
Review URL: https://codereview.chromium.org/1846083002
Diffstat (limited to 'core/fxcrt/fx_basic_bstring.cpp')
-rw-r--r-- | core/fxcrt/fx_basic_bstring.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp index 10bc05bcc5..08f5dca664 100644 --- a/core/fxcrt/fx_basic_bstring.cpp +++ b/core/fxcrt/fx_basic_bstring.cpp @@ -217,30 +217,30 @@ const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteStringC& str) { ConcatInPlace(str.GetLength(), str.GetCStr()); return *this; } -bool CFX_ByteString::Equal(const char* ptr) const { - if (!m_pData) { - return !ptr || ptr[0] == '\0'; - } - if (!ptr) { +bool CFX_ByteString::operator==(const char* ptr) const { + if (!m_pData) + return !ptr || !ptr[0]; + + if (!ptr) return m_pData->m_nDataLength == 0; - } + return FXSYS_strlen(ptr) == m_pData->m_nDataLength && FXSYS_memcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0; } -bool CFX_ByteString::Equal(const CFX_ByteStringC& str) const { - if (!m_pData) { +bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const { + if (!m_pData) return str.IsEmpty(); - } + return m_pData->m_nDataLength == str.GetLength() && FXSYS_memcmp(m_pData->m_String, str.GetCStr(), str.GetLength()) == 0; } -bool CFX_ByteString::Equal(const CFX_ByteString& other) const { - if (IsEmpty()) { +bool CFX_ByteString::operator==(const CFX_ByteString& other) const { + if (IsEmpty()) return other.IsEmpty(); - } - if (other.IsEmpty()) { + + if (other.IsEmpty()) return false; - } + return other.m_pData->m_nDataLength == m_pData->m_nDataLength && FXSYS_memcmp(other.m_pData->m_String, m_pData->m_String, m_pData->m_nDataLength) == 0; |