| 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 ASSERT(nIndex < m_pData->m_nDataLength); | 813 ASSERT(nIndex < m_pData->m_nDataLength); |
| 814 ReallocBeforeWrite(m_pData->m_nDataLength); | 814 ReallocBeforeWrite(m_pData->m_nDataLength); |
| 815 m_pData->m_String[nIndex] = ch; | 815 m_pData->m_String[nIndex] = ch; |
| 816 } | 816 } |
| 817 | 817 |
| 818 CFX_WideString CFX_ByteString::UTF8Decode() const { | 818 CFX_WideString CFX_ByteString::UTF8Decode() const { |
| 819 CFX_UTF8Decoder decoder; | 819 CFX_UTF8Decoder decoder; |
| 820 for (FX_STRSIZE i = 0; i < GetLength(); i++) { | 820 for (FX_STRSIZE i = 0; i < GetLength(); i++) { |
| 821 decoder.Input((uint8_t)m_pData->m_String[i]); | 821 decoder.Input((uint8_t)m_pData->m_String[i]); |
| 822 } | 822 } |
| 823 return decoder.GetResult(); | 823 return CFX_WideString(decoder.GetResult()); |
| 824 } | 824 } |
| 825 | 825 |
| 826 // static | 826 // static |
| 827 CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str, | 827 CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str, |
| 828 FX_STRSIZE len) { | 828 FX_STRSIZE len) { |
| 829 FX_STRSIZE str_len = len >= 0 ? len : FXSYS_wcslen(str); | 829 FX_STRSIZE str_len = len >= 0 ? len : FXSYS_wcslen(str); |
| 830 return FromUnicode(CFX_WideString(str, str_len)); | 830 return FromUnicode(CFX_WideString(str, str_len)); |
| 831 } | 831 } |
| 832 | 832 |
| 833 // static | 833 // static |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 fraction %= scale; | 976 fraction %= scale; |
| 977 scale /= 10; | 977 scale /= 10; |
| 978 } | 978 } |
| 979 return buf_size; | 979 return buf_size; |
| 980 } | 980 } |
| 981 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { | 981 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { |
| 982 FX_CHAR buf[32]; | 982 FX_CHAR buf[32]; |
| 983 FX_STRSIZE len = FX_ftoa(d, buf); | 983 FX_STRSIZE len = FX_ftoa(d, buf); |
| 984 return CFX_ByteString(buf, len); | 984 return CFX_ByteString(buf, len); |
| 985 } | 985 } |
| OLD | NEW |