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 "../../include/fxcrt/fx_basic.h" | 7 #include "../../include/fxcrt/fx_basic.h" |
8 #include "../../../third_party/numerics/safe_math.h" | 8 #include "../../../third_party/numerics/safe_math.h" |
9 | 9 |
10 static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) | 10 static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 { | 964 { |
965 if (len < 0) { | 965 if (len < 0) { |
966 len = (FX_STRSIZE)FXSYS_wcslen(str); | 966 len = (FX_STRSIZE)FXSYS_wcslen(str); |
967 } | 967 } |
968 CFX_ByteString bstr; | 968 CFX_ByteString bstr; |
969 bstr.ConvertFrom(CFX_WideString(str, len)); | 969 bstr.ConvertFrom(CFX_WideString(str, len)); |
970 return bstr; | 970 return bstr; |
971 } | 971 } |
972 CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) | 972 CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) |
973 { | 973 { |
974 return FromUnicode((FX_LPCWSTR)str, str.GetLength()); | 974 return FromUnicode(str.c_str(), str.GetLength()); |
975 } | 975 } |
976 void CFX_ByteString::ConvertFrom(const CFX_WideString& str, CFX_CharMap* pCharMa
p) | 976 void CFX_ByteString::ConvertFrom(const CFX_WideString& str, CFX_CharMap* pCharMa
p) |
977 { | 977 { |
978 if (pCharMap == NULL) { | 978 if (pCharMap == NULL) { |
979 pCharMap = CFX_CharMap::GetDefaultMapper(); | 979 pCharMap = CFX_CharMap::GetDefaultMapper(); |
980 } | 980 } |
981 *this = (*pCharMap->m_GetByteString)(pCharMap, str); | 981 *this = (*pCharMap->m_GetByteString)(pCharMap, str); |
982 } | 982 } |
983 int CFX_ByteString::Compare(FX_BSTR str) const | 983 int CFX_ByteString::Compare(FX_BSTR str) const |
984 { | 984 { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 FX_CHAR* pBuffer = (FX_CHAR*)(this + 1); | 1169 FX_CHAR* pBuffer = (FX_CHAR*)(this + 1); |
1170 FXSYS_memcpy32(pBuffer + m_Size, str.GetPtr(), len); | 1170 FXSYS_memcpy32(pBuffer + m_Size, str.GetPtr(), len); |
1171 m_Size += len; | 1171 m_Size += len; |
1172 } | 1172 } |
1173 void CFX_StringBufBase::Append(int i, FX_DWORD flags) | 1173 void CFX_StringBufBase::Append(int i, FX_DWORD flags) |
1174 { | 1174 { |
1175 char buf[32]; | 1175 char buf[32]; |
1176 int len = _Buffer_itoa(buf, i, flags); | 1176 int len = _Buffer_itoa(buf, i, flags); |
1177 Append(CFX_ByteStringC(buf, len)); | 1177 Append(CFX_ByteStringC(buf, len)); |
1178 } | 1178 } |
OLD | NEW |