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

Side by Side Diff: xfa/fde/css/fde_csssyntax.cpp

Issue 2024463002: Avoid two C-style FX_WCHAR* casts in pdfium (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | xfa/fgas/font/fgas_stdfontmgr.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 "xfa/fde/css/fde_csssyntax.h" 7 #include "xfa/fde/css/fde_csssyntax.h"
8 8
9 #include "xfa/fde/css/fde_cssdatatable.h" 9 #include "xfa/fde/css/fde_cssdatatable.h"
10 #include "xfa/fgas/crt/fgas_codepage.h" 10 #include "xfa/fgas/crt/fgas_codepage.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 void CFDE_CSSTextBuf::Reset() { 419 void CFDE_CSSTextBuf::Reset() {
420 if (!m_bExtBuf) { 420 if (!m_bExtBuf) {
421 FX_Free(m_pBuffer); 421 FX_Free(m_pBuffer);
422 m_pBuffer = NULL; 422 m_pBuffer = NULL;
423 } 423 }
424 m_iDatPos = m_iDatLen = m_iBufLen; 424 m_iDatPos = m_iDatLen = m_iBufLen;
425 } 425 }
426 FX_BOOL CFDE_CSSTextBuf::AttachBuffer(const FX_WCHAR* pBuffer, 426 FX_BOOL CFDE_CSSTextBuf::AttachBuffer(const FX_WCHAR* pBuffer,
427 int32_t iBufLen) { 427 int32_t iBufLen) {
428 Reset(); 428 Reset();
429 m_pBuffer = (FX_WCHAR*)pBuffer; 429 m_pBuffer = const_cast<FX_WCHAR*>(pBuffer);
430 m_iDatLen = m_iBufLen = iBufLen; 430 m_iDatLen = m_iBufLen = iBufLen;
431 return m_bExtBuf = TRUE; 431 return m_bExtBuf = TRUE;
432 } 432 }
433 FX_BOOL CFDE_CSSTextBuf::EstimateSize(int32_t iAllocSize) { 433 FX_BOOL CFDE_CSSTextBuf::EstimateSize(int32_t iAllocSize) {
434 ASSERT(iAllocSize > 0); 434 ASSERT(iAllocSize > 0);
435 Clear(); 435 Clear();
436 m_bExtBuf = FALSE; 436 m_bExtBuf = FALSE;
437 return ExpandBuf(iAllocSize); 437 return ExpandBuf(iAllocSize);
438 } 438 }
439 int32_t CFDE_CSSTextBuf::LoadFromStream(IFX_Stream* pTxtStream, 439 int32_t CFDE_CSSTextBuf::LoadFromStream(IFX_Stream* pTxtStream,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 if (iLength > m_iDatLen - iStart) { 475 if (iLength > m_iDatLen - iStart) {
476 iLength = m_iDatLen - iStart; 476 iLength = m_iDatLen - iStart;
477 } 477 }
478 if (iLength < 0) { 478 if (iLength < 0) {
479 iLength = 0; 479 iLength = 0;
480 } else { 480 } else {
481 FXSYS_memmove(m_pBuffer, m_pBuffer + iStart, iLength * sizeof(FX_WCHAR)); 481 FXSYS_memmove(m_pBuffer, m_pBuffer + iStart, iLength * sizeof(FX_WCHAR));
482 } 482 }
483 m_iDatLen = iLength; 483 m_iDatLen = iLength;
484 } 484 }
OLDNEW
« no previous file with comments | « no previous file | xfa/fgas/font/fgas_stdfontmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698