| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 return other.IsEmpty(); | 209 return other.IsEmpty(); |
| 210 | 210 |
| 211 if (other.IsEmpty()) | 211 if (other.IsEmpty()) |
| 212 return false; | 212 return false; |
| 213 | 213 |
| 214 return other.m_pData->m_nDataLength == m_pData->m_nDataLength && | 214 return other.m_pData->m_nDataLength == m_pData->m_nDataLength && |
| 215 FXSYS_memcmp(other.m_pData->m_String, m_pData->m_String, | 215 FXSYS_memcmp(other.m_pData->m_String, m_pData->m_String, |
| 216 m_pData->m_nDataLength) == 0; | 216 m_pData->m_nDataLength) == 0; |
| 217 } | 217 } |
| 218 | 218 |
| 219 bool CFX_ByteString::operator<(const CFX_ByteString& str) const { |
| 220 if (m_pData == str.m_pData) |
| 221 return false; |
| 222 |
| 223 int result = FXSYS_memcmp(c_str(), str.c_str(), |
| 224 std::min(GetLength(), str.GetLength())); |
| 225 return result < 0 || (result == 0 && GetLength() < str.GetLength()); |
| 226 } |
| 227 |
| 219 bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const { | 228 bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const { |
| 220 if (!m_pData) | 229 if (!m_pData) |
| 221 return str.IsEmpty(); | 230 return str.IsEmpty(); |
| 222 | 231 |
| 223 FX_STRSIZE len = str.GetLength(); | 232 FX_STRSIZE len = str.GetLength(); |
| 224 if (m_pData->m_nDataLength != len) | 233 if (m_pData->m_nDataLength != len) |
| 225 return false; | 234 return false; |
| 226 | 235 |
| 227 const uint8_t* pThis = (const uint8_t*)m_pData->m_String; | 236 const uint8_t* pThis = (const uint8_t*)m_pData->m_String; |
| 228 const uint8_t* pThat = str.raw_str(); | 237 const uint8_t* pThat = str.raw_str(); |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 fraction %= scale; | 1000 fraction %= scale; |
| 992 scale /= 10; | 1001 scale /= 10; |
| 993 } | 1002 } |
| 994 return buf_size; | 1003 return buf_size; |
| 995 } | 1004 } |
| 996 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { | 1005 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { |
| 997 FX_CHAR buf[32]; | 1006 FX_CHAR buf[32]; |
| 998 FX_STRSIZE len = FX_ftoa(d, buf); | 1007 FX_STRSIZE len = FX_ftoa(d, buf); |
| 999 return CFX_ByteString(buf, len); | 1008 return CFX_ByteString(buf, len); |
| 1000 } | 1009 } |
| OLD | NEW |