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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 StringData::Create(reinterpret_cast<const FX_CHAR*>(pStr), nLen)); | 92 StringData::Create(reinterpret_cast<const FX_CHAR*>(pStr), nLen)); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 CFX_ByteString::CFX_ByteString(char ch) { | 96 CFX_ByteString::CFX_ByteString(char ch) { |
97 m_pData.Reset(StringData::Create(1)); | 97 m_pData.Reset(StringData::Create(1)); |
98 m_pData->m_String[0] = ch; | 98 m_pData->m_String[0] = ch; |
99 } | 99 } |
100 | 100 |
101 CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& stringSrc) { | 101 CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& stringSrc) { |
102 if (!stringSrc.IsEmpty()) { | 102 if (!stringSrc.IsEmpty()) |
103 m_pData.Reset(StringData::Create(stringSrc.c_str(), stringSrc.GetLength())); | 103 m_pData.Reset(StringData::Create(stringSrc.c_str(), stringSrc.GetLength())); |
104 } | |
105 } | 104 } |
106 | 105 |
107 CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1, | 106 CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1, |
108 const CFX_ByteStringC& str2) { | 107 const CFX_ByteStringC& str2) { |
109 int nNewLen = str1.GetLength() + str2.GetLength(); | 108 int nNewLen = str1.GetLength() + str2.GetLength(); |
110 if (nNewLen == 0) | 109 if (nNewLen == 0) |
111 return; | 110 return; |
112 | 111 |
113 m_pData.Reset(StringData::Create(nNewLen)); | 112 m_pData.Reset(StringData::Create(nNewLen)); |
114 m_pData->CopyContents(str1.c_str(), str1.GetLength()); | 113 m_pData->CopyContents(str1.c_str(), str1.GetLength()); |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 fraction %= scale; | 995 fraction %= scale; |
997 scale /= 10; | 996 scale /= 10; |
998 } | 997 } |
999 return buf_size; | 998 return buf_size; |
1000 } | 999 } |
1001 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { | 1000 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { |
1002 FX_CHAR buf[32]; | 1001 FX_CHAR buf[32]; |
1003 FX_STRSIZE len = FX_ftoa(d, buf); | 1002 FX_STRSIZE len = FX_ftoa(d, buf); |
1004 return CFX_ByteString(buf, len); | 1003 return CFX_ByteString(buf, len); |
1005 } | 1004 } |
OLD | NEW |