From 3343d146f2d9cd2f9eaa3a40fed3a5b94f3f107e Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 2 Nov 2015 09:54:54 -0800 Subject: Fix XFA compilation noise, part 1. Mainly: volatile/override/method shadowing. unused variables. intialization list init order. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1422113003 . --- xfa/src/fee/src/fee/fde_txtedtbuf.cpp | 10 ++++------ xfa/src/fee/src/fee/fde_txtedtengine.cpp | 25 ++++++++----------------- xfa/src/fee/src/fee/fde_txtedtengine.h | 3 +-- xfa/src/fee/src/fee/fde_txtedtpage.cpp | 15 +++++---------- xfa/src/fee/src/fee/fde_txtedtpage.h | 2 +- xfa/src/fee/src/fee/fde_txtedtparag.cpp | 6 ++---- 6 files changed, 21 insertions(+), 40 deletions(-) (limited to 'xfa/src/fee') diff --git a/xfa/src/fee/src/fee/fde_txtedtbuf.cpp b/xfa/src/fee/src/fee/fde_txtedtbuf.cpp index 86ff1f3e1b..cedc5b2517 100644 --- a/xfa/src/fee/src/fee/fde_txtedtbuf.cpp +++ b/xfa/src/fee/src/fee/fde_txtedtbuf.cpp @@ -18,17 +18,15 @@ CFDE_TxtEdtBufIter::CFDE_TxtEdtBufIter(CFDE_TxtEdtBuf* pBuf, #else CFDE_TxtEdtBufIter::CFDE_TxtEdtBufIter(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias) #endif - : m_nCurChunk(0), + : m_pBuf(pBuf), + m_nCurChunk(0), m_nCurIndex(0), m_nIndex(0), - m_pBuf(pBuf) + m_bInField(FALSE), #ifdef FDE_USEFORMATBLOCK - , m_bForDisplay(bForDisplay), - m_nAliasCount(0) + m_nAliasCount(0), #endif - , - m_bInField(FALSE), m_Alias(wcAlias) { FXSYS_assert(m_pBuf); } diff --git a/xfa/src/fee/src/fee/fde_txtedtengine.cpp b/xfa/src/fee/src/fee/fde_txtedtengine.cpp index 7efd95d54a..2eb3f1ae4f 100644 --- a/xfa/src/fee/src/fee/fde_txtedtengine.cpp +++ b/xfa/src/fee/src/fee/fde_txtedtengine.cpp @@ -31,7 +31,8 @@ IFDE_TxtEdtEngine* IFDE_TxtEdtEngine::Create() { return new CFDE_TxtEdtEngine(); } CFDE_TxtEdtEngine::CFDE_TxtEdtEngine() - : m_nPageLineCount(20), + : m_pTextBreak(nullptr), + m_nPageLineCount(20), m_nLineCount(0), m_nAnchorPos(-1), m_nLayoutPos(0), @@ -39,19 +40,16 @@ CFDE_TxtEdtEngine::CFDE_TxtEdtEngine() m_nCaret(0), m_bBefore(TRUE), m_nCaretPage(0), + m_dwFindFlags(0), m_bLock(FALSE), m_nLimit(0), m_wcAliasChar(L'*'), - m_pTextBreak(NULL) #ifdef FDE_USEFORMATBLOCK - , - m_nFixLength(-1) + m_nFixLength(-1), // FIXME: no such member => USEFORMATBLOCK can't work. #endif - , - m_dwFindFlags(0), m_nFirstLineEnd(FDE_TXTEDIT_LINEEND_Auto), - m_wLineEnd(FDE_UNICODE_PARAGRAPH_SPERATOR), - m_bAutoLineEnd(TRUE) { + m_bAutoLineEnd(TRUE), + m_wLineEnd(FDE_UNICODE_PARAGRAPH_SPERATOR) { FXSYS_memset(&m_rtCaret, 0, sizeof(CFX_RectF)); m_pTxtBuf = new CFDE_TxtEdtBuf(); m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto); @@ -278,8 +276,6 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, m_nAnchorPos = -1; } FX_BOOL bVertical = m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical; - int32_t nCaret = m_nCaret; - int32_t nCaretPage = m_nCaretPage; switch (eMoveCaret) { case MC_Left: { if (bVertical) { @@ -575,7 +571,6 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, FX_BOOL bPart = FALSE; if (m_nLimit > 0) { int32_t nTotalLength = GetTextBufLength(); - int32_t nDelLength = 0; int32_t nCount = m_SelRangePtrArr.GetSize(); for (int32_t i = 0; i < nCount; i++) { FDE_LPTXTEDTSELRANGE lpSelRange = m_SelRangePtrArr.GetAt(i); @@ -1346,7 +1341,6 @@ void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) { nTotalCharCount += pParag->m_nCharCount; } m_pTxtBuf->Delete(nStart, nCount); - CFDE_TxtEdtParag* pEndParag = m_ParagPtrArray[ParagPosEnd.nParagIndex]; int32_t nNextParagIndex = (ParagPosBgn.nCharIndex == 0 && bLastParag) ? ParagPosBgn.nParagIndex : (ParagPosBgn.nParagIndex + 1); @@ -1411,11 +1405,8 @@ void CFDE_TxtEdtEngine::ResetEngine() { void CFDE_TxtEdtEngine::RebuildParagraphs() { RemoveAllParags(); FX_WCHAR wChar = L' '; - FX_WCHAR wCharPre = L' '; int32_t nParagStart = 0; - int32_t nCount = m_pTxtBuf->GetTextLength(); int32_t nIndex = 0; - CFDE_TxtEdtParag* pParag = NULL; IFX_CharIter* pIter = new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)m_pTxtBuf); pIter->SetAt(0); do { @@ -2508,10 +2499,10 @@ CFDE_TxtEdtDoRecord_DeleteRange::CFDE_TxtEdtDoRecord_DeleteRange( const CFX_WideString& wsRange, FX_BOOL bSel) : m_pEngine(pEngine), + m_bSel(bSel), m_nIndex(nIndex), m_nCaret(nCaret), - m_wsRange(wsRange), - m_bSel(bSel) { + m_wsRange(wsRange) { FXSYS_assert(pEngine); } CFDE_TxtEdtDoRecord_DeleteRange::~CFDE_TxtEdtDoRecord_DeleteRange() {} diff --git a/xfa/src/fee/src/fee/fde_txtedtengine.h b/xfa/src/fee/src/fee/fde_txtedtengine.h index eef5129e38..086168d7ae 100644 --- a/xfa/src/fee/src/fee/fde_txtedtengine.h +++ b/xfa/src/fee/src/fee/fde_txtedtengine.h @@ -199,6 +199,7 @@ class CFDE_TxtEdtEngine : public IFDE_TxtEdtEngine { FX_BOOL IsSelect(); void DeleteSelect(); + IFDE_TxtEdtBuf* m_pTxtBuf; IFX_TxtBreak* m_pTextBreak; FDE_TXTEDTPARAMS m_Param; @@ -215,14 +216,12 @@ class CFDE_TxtEdtEngine : public IFDE_TxtEdtEngine { int32_t m_nCaretPage; CFX_RectF m_rtCaret; FX_DWORD m_dwFindFlags; - FX_BOOL m_bLock; int32_t m_nLimit; FX_WCHAR m_wcAliasChar; int32_t m_nFirstLineEnd; FX_BOOL m_bAutoLineEnd; FX_WCHAR m_wLineEnd; - FDE_TXTEDT_TEXTCHANGE_INFO m_ChangeInfo; }; class CFDE_TxtEdtDoRecord_Insert : public IFDE_TxtEdtDoRecord { diff --git a/xfa/src/fee/src/fee/fde_txtedtpage.cpp b/xfa/src/fee/src/fee/fde_txtedtpage.cpp index cc1013e962..d6ec7df252 100644 --- a/xfa/src/fee/src/fee/fde_txtedtpage.cpp +++ b/xfa/src/fee/src/fee/fde_txtedtpage.cpp @@ -123,17 +123,17 @@ int32_t CFDE_TxtEdtTextSet::GetCharRects_Impl(FDE_HVISUALOBJ hText, return pEngine->GetTextBreak()->GetCharRects(&tr, rtArray, bBBox); } CFDE_TxtEdtPage::CFDE_TxtEdtPage(IFDE_TxtEdtEngine* pEngine, int32_t nPageIndex) - : m_pIter(NULL), - m_pTextSet(NULL), + : m_pIter(nullptr), + m_pTextSet(nullptr), + m_pBgnParag(nullptr), + m_pEndParag(nullptr), m_nRefCount(0), m_nPageStart(-1), m_nCharCount(0), m_nPageIndex(nPageIndex), m_bLoaded(FALSE), m_bLastPage(FALSE), - m_pCharWidth(NULL), - m_pBgnParag(NULL), - m_pEndParag(NULL) { + m_pCharWidth(nullptr) { FXSYS_memset(&m_rtPage, 0, sizeof(CFX_RectF)); FXSYS_memset(&m_rtPageMargin, 0, sizeof(CFX_RectF)); FXSYS_memset(&m_rtPageContents, 0, sizeof(CFX_RectF)); @@ -331,7 +331,6 @@ void CFDE_TxtEdtPage::CalcRangeRectArray(int32_t nStart, } CFX_RectFArray rcArr; m_pTextSet->GetCharRects((FDE_HVISUALOBJ)piece, rcArr); - int32_t nSize = rcArr.GetSize(); CFX_RectF rectPiece = rcArr[nStart - piece->nStart]; rectPiece.Union(rcArr[nRangeEnd]); RectFArr.Add(rectPiece); @@ -396,9 +395,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(FX_LPCRECTF pClipBox, IFX_Pause* pPause) { IFX_TxtBreak* pBreak = m_pEditEngine->GetTextBreak(); pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); pBreak->ClearBreakPieces(); - int32_t nLineCount = m_pEditEngine->GetLineCount(); int32_t nPageLineCount = m_pEditEngine->GetPageLineCount(); - int32_t nLength = pBuf->GetTextLength(); int32_t nStartLine = nPageLineCount * m_nPageIndex; int32_t nEndLine = FX_MIN((nStartLine + nPageLineCount - 1), (m_pEditEngine->GetLineCount() - 1)); @@ -429,7 +426,6 @@ int32_t CFDE_TxtEdtPage::LoadPage(FX_LPCRECTF pClipBox, IFX_Pause* pPause) { } m_PieceMassArr.RemoveAll(TRUE); FX_DWORD dwBreakStatus = FX_TXTBREAK_None; - int32_t nLineStart = nPageStart; int32_t nPieceStart = 0; if (m_pCharWidth != NULL) { delete[] m_pCharWidth; @@ -444,7 +440,6 @@ int32_t CFDE_TxtEdtPage::LoadPage(FX_LPCRECTF pClipBox, IFX_Pause* pPause) { IFX_CharIter* pIter = m_pIter->Clone(); pIter->SetAt(nPageStart); m_pIter->SetAt(nPageStart); - int32_t nTextEnd = m_pEditEngine->GetTextBufLength(); FX_BOOL bFirstPiece = TRUE; do { if (bReload) { diff --git a/xfa/src/fee/src/fee/fde_txtedtpage.h b/xfa/src/fee/src/fee/fde_txtedtpage.h index 30f717e8bc..67e2e982b9 100644 --- a/xfa/src/fee/src/fee/fde_txtedtpage.h +++ b/xfa/src/fee/src/fee/fde_txtedtpage.h @@ -22,7 +22,7 @@ enum FDE_TXTEDT_CHARTYPE { FDE_TXTEDT_CHARTYPE_Char, FDE_TXTEDT_CHARTYPE_CJK, }; -static FDE_TXTEDT_CHARTYPE FDE_GetEditSelCharType(FX_WCHAR wChar) { +inline FDE_TXTEDT_CHARTYPE FDE_GetEditSelCharType(FX_WCHAR wChar) { if (wChar == 0x9) { return FDE_TXTEDT_CHARTYPE_Tab; } else if (wChar == 0x20 || wChar == 0xA0) { diff --git a/xfa/src/fee/src/fee/fde_txtedtparag.cpp b/xfa/src/fee/src/fee/fde_txtedtparag.cpp index 9c9f5b10cd..cf6fa77acc 100644 --- a/xfa/src/fee/src/fee/fde_txtedtparag.cpp +++ b/xfa/src/fee/src/fee/fde_txtedtparag.cpp @@ -12,9 +12,9 @@ #include "fde_txtedtengine.h" #include "fde_txtedtbuf.h" CFDE_TxtEdtParag::CFDE_TxtEdtParag(CFDE_TxtEdtEngine* pEngine) - : m_nLineCount(0), - m_nCharStart(0), + : m_nCharStart(0), m_nCharCount(0), + m_nLineCount(0), m_lpData(NULL), m_pEngine(pEngine) { FXSYS_assert(m_pEngine); @@ -43,7 +43,6 @@ void CFDE_TxtEdtParag::LoadParag() { CFX_ArrayTemplate LineBaseArr; FX_BOOL bReload = FALSE; FX_DWORD dwBreakStatus = FX_TXTBREAK_None; - int32_t nTextEnd = m_pEngine->GetTextBufLength(); do { if (bReload) { dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); @@ -108,7 +107,6 @@ void CFDE_TxtEdtParag::CalcLines() { int32_t nEndIndex = m_nCharStart + m_nCharCount; pIter->SetAt(m_nCharStart); FX_BOOL bReload = FALSE; - int32_t nTextEnd = m_pEngine->GetTextBufLength(); do { if (bReload) { dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); -- cgit v1.2.3