Chromium Code Reviews| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 ConcatInPlace(str.GetLength(), str.GetPtr()); | 198 ConcatInPlace(str.GetLength(), str.GetPtr()); |
| 199 return *this; | 199 return *this; |
| 200 } | 200 } |
| 201 bool CFX_WideString::Equal(const wchar_t* ptr) const { | 201 bool CFX_WideString::Equal(const wchar_t* ptr) const { |
| 202 if (!m_pData) { | 202 if (!m_pData) { |
| 203 return !ptr || ptr[0] == L'\0'; | 203 return !ptr || ptr[0] == L'\0'; |
| 204 } | 204 } |
| 205 if (!ptr) { | 205 if (!ptr) { |
| 206 return m_pData->m_nDataLength == 0; | 206 return m_pData->m_nDataLength == 0; |
| 207 } | 207 } |
| 208 return wcslen(ptr) == m_pData->m_nDataLength && | 208 return wcslen(ptr) == static_cast<unsigned int>(m_pData->m_nDataLength) && |
|
Tom Sepez
2016/03/11 00:30:28
wcslen() returns a size_t, so maybe we want to cas
Wei Li
2016/03/11 04:11:36
Done.
| |
| 209 wmemcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0; | 209 wmemcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0; |
| 210 } | 210 } |
| 211 bool CFX_WideString::Equal(const CFX_WideStringC& str) const { | 211 bool CFX_WideString::Equal(const CFX_WideStringC& str) const { |
| 212 if (!m_pData) { | 212 if (!m_pData) { |
| 213 return str.IsEmpty(); | 213 return str.IsEmpty(); |
| 214 } | 214 } |
| 215 return str.GetLength() == m_pData->m_nDataLength && | 215 return str.GetLength() == m_pData->m_nDataLength && |
| 216 wmemcmp(str.GetPtr(), m_pData->m_String, m_pData->m_nDataLength) == 0; | 216 wmemcmp(str.GetPtr(), m_pData->m_String, m_pData->m_nDataLength) == 0; |
| 217 } | 217 } |
| 218 bool CFX_WideString::Equal(const CFX_WideString& other) const { | 218 bool CFX_WideString::Equal(const CFX_WideString& other) const { |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1041 int dest_len = | 1041 int dest_len = |
| 1042 FXSYS_MultiByteToWideChar(codepage, 0, bstr, src_len, nullptr, 0); | 1042 FXSYS_MultiByteToWideChar(codepage, 0, bstr, src_len, nullptr, 0); |
| 1043 CFX_WideString wstr; | 1043 CFX_WideString wstr; |
| 1044 if (dest_len) { | 1044 if (dest_len) { |
| 1045 FX_WCHAR* dest_buf = wstr.GetBuffer(dest_len); | 1045 FX_WCHAR* dest_buf = wstr.GetBuffer(dest_len); |
| 1046 FXSYS_MultiByteToWideChar(codepage, 0, bstr, src_len, dest_buf, dest_len); | 1046 FXSYS_MultiByteToWideChar(codepage, 0, bstr, src_len, dest_buf, dest_len); |
| 1047 wstr.ReleaseBuffer(dest_len); | 1047 wstr.ReleaseBuffer(dest_len); |
| 1048 } | 1048 } |
| 1049 return wstr; | 1049 return wstr; |
| 1050 } | 1050 } |
| OLD | NEW |