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

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

Issue 1115493002: Merge to XFA: Make CFX_WideString::LockBuffer() completely unused. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 7 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/src/fpdfdoc/doc_bookmark.cpp ('k') | core/src/fxcrt/fx_basic_wstring.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/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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 nNewLength = (FX_STRSIZE)FXSYS_strlen((FX_LPCSTR)m_pData->m_String); 334 nNewLength = (FX_STRSIZE)FXSYS_strlen((FX_LPCSTR)m_pData->m_String);
335 } 335 }
336 if (nNewLength == 0) { 336 if (nNewLength == 0) {
337 Empty(); 337 Empty();
338 return; 338 return;
339 } 339 }
340 FXSYS_assert(nNewLength <= m_pData->m_nAllocLength); 340 FXSYS_assert(nNewLength <= m_pData->m_nAllocLength);
341 m_pData->m_nDataLength = nNewLength; 341 m_pData->m_nDataLength = nNewLength;
342 m_pData->m_String[nNewLength] = 0; 342 m_pData->m_String[nNewLength] = 0;
343 } 343 }
344 FX_LPSTR CFX_ByteString::LockBuffer()
345 {
346 if (m_pData == NULL) {
347 return NULL;
348 }
349 FX_LPSTR lpsz = GetBuffer(0);
350 m_pData->m_nRefs = -1;
351 return lpsz;
352 }
353 void CFX_ByteString::Reserve(FX_STRSIZE len) 344 void CFX_ByteString::Reserve(FX_STRSIZE len)
354 { 345 {
355 GetBuffer(len); 346 GetBuffer(len);
356 ReleaseBuffer(GetLength()); 347 ReleaseBuffer(GetLength());
357 } 348 }
358 FX_LPSTR CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) 349 FX_LPSTR CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength)
359 { 350 {
360 if (m_pData == NULL && nMinBufLength == 0) { 351 if (m_pData == NULL && nMinBufLength == 0) {
361 return NULL; 352 return NULL;
362 } 353 }
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 scale /= 10; 1121 scale /= 10;
1131 } 1122 }
1132 return buf_size; 1123 return buf_size;
1133 } 1124 }
1134 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) 1125 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision)
1135 { 1126 {
1136 FX_CHAR buf[32]; 1127 FX_CHAR buf[32];
1137 FX_STRSIZE len = FX_ftoa(d, buf); 1128 FX_STRSIZE len = FX_ftoa(d, buf);
1138 return CFX_ByteString(buf, len); 1129 return CFX_ByteString(buf, len);
1139 } 1130 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_bookmark.cpp ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698