summaryrefslogtreecommitdiff
path: root/core/src/fxcrt/fx_basic_wstring.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-13 14:16:51 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-13 14:16:51 -0700
commitfdc5e691745cf16fb105f3ad4a9fb5f8f64f56b4 (patch)
tree5d484297c58ef03ec594cce66383fdcdfcebb9c4 /core/src/fxcrt/fx_basic_wstring.cpp
parent2a47d8d6eef22d117ac3475e84c3a52b5ca41a3c (diff)
downloadpdfium-fdc5e691745cf16fb105f3ad4a9fb5f8f64f56b4.tar.xz
Fix comparison of CFX_ByteString and CFX_WideString against empty literals.
Also corrects some ASSERT_'s to EXPECT_'s in the test. BUG=pdfium:160 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1141763002
Diffstat (limited to 'core/src/fxcrt/fx_basic_wstring.cpp')
-rw-r--r--core/src/fxcrt/fx_basic_wstring.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp
index ce3166b196..0511b847e3 100644
--- a/core/src/fxcrt/fx_basic_wstring.cpp
+++ b/core/src/fxcrt/fx_basic_wstring.cpp
@@ -206,10 +206,10 @@ const CFX_WideString& CFX_WideString::operator+=(const CFX_WideStringC& string)
bool CFX_WideString::Equal(const wchar_t* ptr) const
{
if (!m_pData) {
- return !ptr;
+ return !ptr || ptr[0] == L'\0';
}
if (!ptr) {
- return false;
+ return m_pData->m_nDataLength == 0;
}
return wcslen(ptr) == m_pData->m_nDataLength &&
wmemcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
@@ -224,10 +224,10 @@ bool CFX_WideString::Equal(const CFX_WideStringC& str) const
}
bool CFX_WideString::Equal(const CFX_WideString& other) const
{
- if (!m_pData) {
+ if (IsEmpty()) {
return other.IsEmpty();
}
- if (!other.m_pData) {
+ if (other.IsEmpty()) {
return false;
}
return other.m_pData->m_nDataLength == m_pData->m_nDataLength &&