| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cctype> | 10 #include <cctype> |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 bool CFX_WideString::operator==(const CFX_WideStringC& str) const { | 174 bool CFX_WideString::operator==(const CFX_WideStringC& str) const { |
| 175 if (!m_pData) | 175 if (!m_pData) |
| 176 return str.IsEmpty(); | 176 return str.IsEmpty(); |
| 177 | 177 |
| 178 return m_pData->m_nDataLength == str.GetLength() && | 178 return m_pData->m_nDataLength == str.GetLength() && |
| 179 wmemcmp(m_pData->m_String, str.c_str(), str.GetLength()) == 0; | 179 wmemcmp(m_pData->m_String, str.c_str(), str.GetLength()) == 0; |
| 180 } | 180 } |
| 181 | 181 |
| 182 bool CFX_WideString::operator==(const CFX_WideString& other) const { | 182 bool CFX_WideString::operator==(const CFX_WideString& other) const { |
| 183 if (m_pData == other.m_pData) |
| 184 return true; |
| 185 |
| 183 if (IsEmpty()) | 186 if (IsEmpty()) |
| 184 return other.IsEmpty(); | 187 return other.IsEmpty(); |
| 185 | 188 |
| 186 if (other.IsEmpty()) | 189 if (other.IsEmpty()) |
| 187 return false; | 190 return false; |
| 188 | 191 |
| 189 return other.m_pData->m_nDataLength == m_pData->m_nDataLength && | 192 return other.m_pData->m_nDataLength == m_pData->m_nDataLength && |
| 190 wmemcmp(other.m_pData->m_String, m_pData->m_String, | 193 wmemcmp(other.m_pData->m_String, m_pData->m_String, |
| 191 m_pData->m_nDataLength) == 0; | 194 m_pData->m_nDataLength) == 0; |
| 192 } | 195 } |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, nullptr, 0); | 1003 FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, nullptr, 0); |
| 1001 CFX_WideString wstr; | 1004 CFX_WideString wstr; |
| 1002 if (dest_len) { | 1005 if (dest_len) { |
| 1003 FX_WCHAR* dest_buf = wstr.GetBuffer(dest_len); | 1006 FX_WCHAR* dest_buf = wstr.GetBuffer(dest_len); |
| 1004 FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, dest_buf, | 1007 FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, dest_buf, |
| 1005 dest_len); | 1008 dest_len); |
| 1006 wstr.ReleaseBuffer(dest_len); | 1009 wstr.ReleaseBuffer(dest_len); |
| 1007 } | 1010 } |
| 1008 return wstr; | 1011 return wstr; |
| 1009 } | 1012 } |
| OLD | NEW |