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

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

Issue 1080633008: Merge to XFA: Kill CFX_StringBufTemplate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 8 months 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/include/fxcrt/fx_string.h ('k') | no next file » | 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/base/numerics/safe_math.h" 8 #include "../../../third_party/base/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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 scale /= 10; 1130 scale /= 10;
1131 } 1131 }
1132 return buf_size; 1132 return buf_size;
1133 } 1133 }
1134 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) 1134 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision)
1135 { 1135 {
1136 FX_CHAR buf[32]; 1136 FX_CHAR buf[32];
1137 FX_STRSIZE len = FX_ftoa(d, buf); 1137 FX_STRSIZE len = FX_ftoa(d, buf);
1138 return CFX_ByteString(buf, len); 1138 return CFX_ByteString(buf, len);
1139 } 1139 }
1140 void CFX_StringBufBase::Copy(FX_BSTR str)
1141 {
1142 m_Size = str.GetLength();
1143 if (m_Size > m_Limit) {
1144 m_Size = m_Limit;
1145 }
1146 FX_CHAR* pBuffer = (FX_CHAR*)(this + 1);
1147 FXSYS_memcpy32(pBuffer, str.GetPtr(), m_Size);
1148 }
1149 void CFX_StringBufBase::Append(FX_BSTR str)
1150 {
1151 int len = str.GetLength();
1152 if (len > m_Limit - m_Size) {
1153 len = m_Limit - m_Size;
1154 }
1155 FX_CHAR* pBuffer = (FX_CHAR*)(this + 1);
1156 FXSYS_memcpy32(pBuffer + m_Size, str.GetPtr(), len);
1157 m_Size += len;
1158 }
1159 void CFX_StringBufBase::Append(int i, FX_DWORD flags)
1160 {
1161 char buf[32];
1162 int len = _Buffer_itoa(buf, i, flags);
1163 Append(CFX_ByteStringC(buf, len));
1164 }
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698