Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: core/src/fxcrt/fx_basic_bstring.cpp

Issue 733693003: Getting rid of more (FX_LPCWSTR) casts and fixing two bugs revealed by this. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Simplified GetAttrValue to just assign *pValue and to share code. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdfdoc/doc_form.cpp ('k') | core/src/fxcrt/fx_basic_buffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_form.cpp ('k') | core/src/fxcrt/fx_basic_buffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698