| 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 <cctype> | 9 #include <cctype> |
| 10 | 10 |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 | 815 |
| 816 // static | 816 // static |
| 817 CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str, | 817 CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str, |
| 818 FX_STRSIZE len) { | 818 FX_STRSIZE len) { |
| 819 FX_STRSIZE str_len = len >= 0 ? len : FXSYS_wcslen(str); | 819 FX_STRSIZE str_len = len >= 0 ? len : FXSYS_wcslen(str); |
| 820 return FromUnicode(CFX_WideString(str, str_len)); | 820 return FromUnicode(CFX_WideString(str, str_len)); |
| 821 } | 821 } |
| 822 | 822 |
| 823 // static | 823 // static |
| 824 CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) { | 824 CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) { |
| 825 return CFX_CharMap::GetByteString(0, str); | 825 return CFX_CharMap::GetByteString(0, str.AsWideStringC()); |
| 826 } | 826 } |
| 827 | 827 |
| 828 int CFX_ByteString::Compare(const CFX_ByteStringC& str) const { | 828 int CFX_ByteString::Compare(const CFX_ByteStringC& str) const { |
| 829 if (!m_pData) { | 829 if (!m_pData) { |
| 830 return str.IsEmpty() ? 0 : -1; | 830 return str.IsEmpty() ? 0 : -1; |
| 831 } | 831 } |
| 832 int this_len = m_pData->m_nDataLength; | 832 int this_len = m_pData->m_nDataLength; |
| 833 int that_len = str.GetLength(); | 833 int that_len = str.GetLength(); |
| 834 int min_len = this_len < that_len ? this_len : that_len; | 834 int min_len = this_len < that_len ? this_len : that_len; |
| 835 for (int i = 0; i < min_len; i++) { | 835 for (int i = 0; i < min_len; i++) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 fraction %= scale; | 979 fraction %= scale; |
| 980 scale /= 10; | 980 scale /= 10; |
| 981 } | 981 } |
| 982 return buf_size; | 982 return buf_size; |
| 983 } | 983 } |
| 984 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { | 984 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { |
| 985 FX_CHAR buf[32]; | 985 FX_CHAR buf[32]; |
| 986 FX_STRSIZE len = FX_ftoa(d, buf); | 986 FX_STRSIZE len = FX_ftoa(d, buf); |
| 987 return CFX_ByteString(buf, len); | 987 return CFX_ByteString(buf, len); |
| 988 } | 988 } |
| OLD | NEW |