diff options
Diffstat (limited to 'xfa')
25 files changed, 212 insertions, 264 deletions
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index ecdaf67120..4bdf8df1c0 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -899,10 +899,10 @@ void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) { int32_t nTotalCharCount = 0; int32_t i = 0; for (i = ParagPosBgn.nParagIndex; i <= ParagPosEnd.nParagIndex; i++) { - CFDE_TxtEdtParag* pParag = m_ParagPtrArray[i]; - pParag->CalcLines(); - nTotalLineCount += pParag->GetLineCount(); - nTotalCharCount += pParag->GetTextLength(); + CFDE_TxtEdtParag* pTextParag = m_ParagPtrArray[i]; + pTextParag->CalcLines(); + nTotalLineCount += pTextParag->GetLineCount(); + nTotalCharCount += pTextParag->GetTextLength(); } m_pTxtBuf->Delete(nStart, nCount); int32_t nNextParagIndex = (ParagPosBgn.nCharIndex == 0 && bLastParag) diff --git a/xfa/fde/cfx_wordbreak.cpp b/xfa/fde/cfx_wordbreak.cpp index 5b220df60e..a9aa75b622 100644 --- a/xfa/fde/cfx_wordbreak.cpp +++ b/xfa/fde/cfx_wordbreak.cpp @@ -2859,17 +2859,14 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter, } if (!(bFromNext || pIter->IsEOF(bPrev))) { pIter->Next(!bPrev); - FX_WCHAR wcTemp = pIter->GetChar(); - ePreType = GetWordBreakProperty(wcTemp); + ePreType = GetWordBreakProperty(pIter->GetChar()); pIter->Next(bPrev); } - FX_WCHAR wcTemp = pIter->GetChar(); - eCurType = GetWordBreakProperty(wcTemp); + eCurType = GetWordBreakProperty(pIter->GetChar()); FX_BOOL bFirst = TRUE; do { pIter->Next(bPrev); - FX_WCHAR wcTemp = pIter->GetChar(); - eNextType = GetWordBreakProperty(wcTemp); + eNextType = GetWordBreakProperty(pIter->GetChar()); uint16_t wBreak = gs_FX_WordBreak_Table[eCurType] & ((uint16_t)(1 << eNextType)); if (wBreak) { @@ -2929,8 +2926,7 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter, } ASSERT(nFlags <= 2); pIter->Next(bPrev); - wcTemp = pIter->GetChar(); - eNextType = (FX_WordBreakProp)GetWordBreakProperty(wcTemp); + eNextType = (FX_WordBreakProp)GetWordBreakProperty(pIter->GetChar()); if (!((nFlags == 1 && eNextType == FX_WordBreakProp_ALetter) || (nFlags == 2 && eNextType == FX_WordBreakProp_Numberic))) { pIter->Next(!bPrev); diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index c7d82ac0f4..1cf9226409 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -735,16 +735,14 @@ void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) { FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); FX_FLOAT fLineStopS = bVertical ? rect.right() : rect.bottom(); int32_t iLines = m_ttoLines.GetSize(); - if (iLines < 1) { + if (iLines < 1) return; - } - CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(iLines - 1); - FDE_TTOPIECE* pPiece = pLine->GetPtrAt(0); - if (pPiece == NULL) { + FDE_TTOPIECE* pFirstPiece = m_ttoLines.GetPtrAt(iLines - 1)->GetPtrAt(0); + if (!pFirstPiece) return; - } + FX_FLOAT fLineStopD = - bVertical ? pPiece->rtPiece.right() : pPiece->rtPiece.bottom(); + bVertical ? pFirstPiece->rtPiece.right() : pFirstPiece->rtPiece.bottom(); FX_FLOAT fInc = fLineStopS - fLineStopD; if (m_iAlignment >= FDE_TTOALIGNMENT_CenterLeft && m_iAlignment < FDE_TTOALIGNMENT_BottomLeft) { @@ -752,19 +750,17 @@ void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) { } else if (m_iAlignment < FDE_TTOALIGNMENT_CenterLeft) { fInc = 0.0f; } - if (fInc < 1.0f) { + if (fInc < 1.0f) return; - } for (int32_t i = 0; i < iLines; i++) { CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); int32_t iPieces = pLine->GetSize(); for (int32_t j = 0; j < iPieces; j++) { FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j); - if (bVertical) { + if (bVertical) pPiece->rtPiece.left += fInc; - } else { + else pPiece->rtPiece.top += fInc; - } } } } diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp index 803bede6e5..5432e527d2 100644 --- a/xfa/fgas/font/fgas_gefont.cpp +++ b/xfa/fgas/font/fgas_gefont.cpp @@ -494,11 +494,11 @@ int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, CFX_WideString wsFamily; GetFamilyName(wsFamily); #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - IFX_Font* pFont = m_pFontMgr->GetDefFontByUnicode(wUnicode, GetFontStyles(), - wsFamily.c_str()); + pFont = m_pFontMgr->GetDefFontByUnicode(wUnicode, GetFontStyles(), + wsFamily.c_str()); #else - IFX_Font* pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), - wsFamily.c_str()); + pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), + wsFamily.c_str()); if (!pFont) pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), NULL); #endif diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index dcb3c3953a..30a9c5a150 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -1095,8 +1095,7 @@ void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine, pNextLine->m_iStart = pCurLine->m_iStart; pNextLine->m_iWidth = pCurLine->GetLineEnd() - iEndPos; pCurLine->m_iWidth = iEndPos; - CFX_RTFChar* tc = curChars.GetDataPtr(iCharPos - 1); - tc->m_nBreakType = FX_LBT_UNKNOWN; + curChars.GetDataPtr(iCharPos - 1)->m_nBreakType = FX_LBT_UNKNOWN; iCount = nextChars.GetSize(); CFX_RTFChar* pNextChars = nextChars.GetData(); for (int32_t i = 0; i < iCount; i++) { diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index c5a1c2fdcc..d30d105253 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -1439,10 +1439,10 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, uint32_t dwLastProps = FX_GetUnicodeProperties(wLast); if ((dwLastProps & FX_CHARTYPEBITSMASK) == FX_CHARTYPE_Combination) { - CFX_Rect rtBBox; - rtBBox.Reset(); - if (pFont->GetCharBBox(wLast, rtBBox, FALSE)) { - pCharPos->m_OriginY -= fFontSize * rtBBox.height / iMaxHeight; + CFX_Rect rtBox; + rtBox.Reset(); + if (pFont->GetCharBBox(wLast, rtBox, FALSE)) { + pCharPos->m_OriginY -= fFontSize * rtBox.height / iMaxHeight; } } } diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index 34e98fa38a..8d4ac452f7 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -660,20 +660,20 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel); static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) ->GetItemText(hItem, wsText); - CFWL_ThemeText param; - param.m_pWidget = m_pInterface; - param.m_iPart = CFWL_Part::Caption; - param.m_dwStates = m_iBtnState; - param.m_pGraphics = pGraphics; - param.m_matrix.Concat(*pMatrix); - param.m_rtPart = rtTextBk; - param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) - ? CFWL_PartState_Selected - : CFWL_PartState_Normal; - param.m_wsText = wsText; - param.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; - param.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; - pTheme->DrawText(¶m); + CFWL_ThemeText theme_text; + theme_text.m_pWidget = m_pInterface; + theme_text.m_iPart = CFWL_Part::Caption; + theme_text.m_dwStates = m_iBtnState; + theme_text.m_pGraphics = pGraphics; + theme_text.m_matrix.Concat(*pMatrix); + theme_text.m_rtPart = rtTextBk; + theme_text.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) + ? CFWL_PartState_Selected + : CFWL_PartState_Normal; + theme_text.m_wsText = wsText; + theme_text.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; + theme_text.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; + pTheme->DrawText(&theme_text); } } { diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp index 6e2b4dee99..c6cef1c37d 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp @@ -326,10 +326,6 @@ void CFWL_DateTimeCalendarImpDelegate::OnLButtonUpEx(CFWL_MsgMouse* pMsg) { iCurSel); pPicker->ShowMonthCalendar(FALSE); } else if (m_bFlag && (!rt.Contains(pMsg->m_fx, pMsg->m_fy))) { - IFWL_DateTimePicker* pIPicker = - static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter); - CFWL_DateTimePickerImp* pPicker = - static_cast<CFWL_DateTimePickerImp*>(pIPicker->GetImpl()); pPicker->ShowMonthCalendar(FALSE); } m_bFlag = 0; diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index 639a46c87b..34628aa82c 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -743,9 +743,9 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) { if (!bAutoSize) { CFX_RectF rtItem; rtItem.Set(m_rtClient.left, m_rtClient.top + fs.y, r.width, r.height); - IFWL_ListBoxDP* pData = + IFWL_ListBoxDP* pBox = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); - pData->SetItemRect(m_pInterface, pItem, rtItem); + pBox->SetItemRect(m_pInterface, pItem, rtItem); } fs.y += r.height; if (fs.x < r.width) { diff --git a/xfa/fxbarcode/BC_TwoDimWriter.cpp b/xfa/fxbarcode/BC_TwoDimWriter.cpp index efab589ddc..c2fb37e091 100644 --- a/xfa/fxbarcode/BC_TwoDimWriter.cpp +++ b/xfa/fxbarcode/BC_TwoDimWriter.cpp @@ -46,10 +46,9 @@ void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device, CFX_PathData rect; rect.AppendRect((FX_FLOAT)leftPos + x, (FX_FLOAT)topPos + y, (FX_FLOAT)(leftPos + x + 1), (FX_FLOAT)(topPos + y + 1)); - CFX_GraphStateData stateData; if (m_output->Get(x, y)) { - device->DrawPath(&rect, &matri, &stateData, m_barColor, 0, - FXFILL_WINDING); + CFX_GraphStateData data; + device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING); } } } diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp index 81abd56370..f31a54747f 100644 --- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp +++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp @@ -197,9 +197,9 @@ CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorMagnitudes( FX_BOOL dataMatrix, int32_t& e) { int32_t s = errorLocations->GetSize(); - CFX_Int32Array* temp = new CFX_Int32Array; - temp->SetSize(s); - std::unique_ptr<CFX_Int32Array> result(temp); + CFX_Int32Array* tempArray = new CFX_Int32Array; + tempArray->SetSize(s); + std::unique_ptr<CFX_Int32Array> result(tempArray); for (int32_t i = 0; i < s; i++) { int32_t xiInverse = m_field->Inverse(errorLocations->operator[](i), e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); @@ -212,7 +212,7 @@ CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorMagnitudes( xiInverse))); } } - int32_t temp = m_field->Inverse(denominator, temp); + int32_t temp = m_field->Inverse(denominator, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); (*result)[i] = m_field->Multiply(errorEvaluator->EvaluateAt(xiInverse), temp); diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp index 6b7680d1a8..a41e46afc9 100644 --- a/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp +++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp @@ -40,17 +40,15 @@ CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, ECBlocks* ecBlocks = version->GetECBlocks(); int32_t totalBlocks = 0; const CFX_ArrayTemplate<ECB*>& ecBlockArray = ecBlocks->GetECBlocks(); - int32_t i; - for (i = 0; i < ecBlockArray.GetSize(); i++) { + for (int32_t i = 0; i < ecBlockArray.GetSize(); i++) { totalBlocks += ecBlockArray[i]->GetCount(); } std::unique_ptr<CFX_ArrayTemplate<CBC_DataMatrixDataBlock*>> result( new CFX_ArrayTemplate<CBC_DataMatrixDataBlock*>()); result->SetSize(totalBlocks); int32_t numResultBlocks = 0; - int32_t j; - for (j = 0; j < ecBlockArray.GetSize(); j++) { - for (i = 0; i < ((ECB*)ecBlockArray[j])->GetCount(); i++) { + for (int32_t j = 0; j < ecBlockArray.GetSize(); j++) { + for (int32_t i = 0; i < ((ECB*)ecBlockArray[j])->GetCount(); i++) { int32_t numDataCodewords = ((ECB*)ecBlockArray[j])->GetDataCodewords(); int32_t numBlockCodewords = ecBlocks->GetECCodewords() + numDataCodewords; CFX_ByteArray codewords; @@ -60,14 +58,11 @@ CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, codewords.SetSize(0); } } - int32_t longerBlocksTotalCodewords = (*result)[0]->GetCodewords()->GetSize(); int32_t longerBlocksNumDataCodewords = - longerBlocksTotalCodewords - ecBlocks->GetECCodewords(); - int32_t shorterBlocksNumDataCodewords = longerBlocksNumDataCodewords - 1; + (*result)[0]->GetCodewords()->GetSize() - ecBlocks->GetECCodewords(); int32_t rawCodewordsOffset = 0; - for (i = 0; i < shorterBlocksNumDataCodewords; i++) { - int32_t j; - for (j = 0; j < numResultBlocks; j++) { + for (int32_t i = 0; i < longerBlocksNumDataCodewords - 1; i++) { + for (int32_t j = 0; j < numResultBlocks; j++) { if (rawCodewordsOffset < rawCodewords->GetSize()) { (*result)[j]->GetCodewords()->operator[](i) = (*rawCodewords)[rawCodewordsOffset++]; @@ -76,17 +71,16 @@ CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, } const bool specialVersion = version->GetVersionNumber() == 24; int32_t numLongerBlocks = specialVersion ? 8 : numResultBlocks; - for (j = 0; j < numLongerBlocks; j++) { + for (int32_t j = 0; j < numLongerBlocks; j++) { if (rawCodewordsOffset < rawCodewords->GetSize()) { (*result)[j]->GetCodewords()->operator[](longerBlocksNumDataCodewords - 1) = (*rawCodewords)[rawCodewordsOffset++]; } } - int32_t max = (*result)[0]->GetCodewords()->GetSize(); - for (i = longerBlocksNumDataCodewords; i < max; i++) { - int32_t j; - for (j = 0; j < numResultBlocks; j++) { + for (int32_t i = longerBlocksNumDataCodewords; + i < (*result)[0]->GetCodewords()->GetSize(); i++) { + for (int32_t j = 0; j < numResultBlocks; j++) { int32_t iOffset = specialVersion && j > 7 ? i - 1 : i; if (rawCodewordsOffset < rawCodewords->GetSize()) { (*result)[j]->GetCodewords()->operator[](iOffset) = @@ -100,6 +94,7 @@ CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, } return result.release(); } + int32_t CBC_DataMatrixDataBlock::GetNumDataCodewords() { return m_numDataCodewords; } diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp index 4276066444..ffa0a4d9d1 100644 --- a/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp @@ -57,13 +57,12 @@ CBC_CommonDecoderResult* CBC_DataMatrixDecoder::Decode( BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); int32_t dataBlocksCount = dataBlocks->GetSize(); int32_t totalBytes = 0; - int32_t i, j; - for (i = 0; i < dataBlocksCount; i++) { + for (int32_t i = 0; i < dataBlocksCount; i++) { totalBytes += (*dataBlocks)[i]->GetNumDataCodewords(); } CFX_ByteArray resultBytes; resultBytes.SetSize(totalBytes); - for (j = 0; j < dataBlocksCount; j++) { + for (int32_t j = 0; j < dataBlocksCount; j++) { CFX_ByteArray* codewordBytes = (*dataBlocks)[j]->GetCodewords(); int32_t numDataCodewords = (*dataBlocks)[j]->GetNumDataCodewords(); CorrectErrors(*codewordBytes, numDataCodewords, e); @@ -74,12 +73,11 @@ CBC_CommonDecoderResult* CBC_DataMatrixDecoder::Decode( delete dataBlocks; return nullptr; } - int32_t i; - for (i = 0; i < numDataCodewords; i++) { + for (int32_t i = 0; i < numDataCodewords; i++) { resultBytes[i * dataBlocksCount + j] = (*codewordBytes)[i]; } } - for (i = 0; i < (dataBlocks->GetSize()); i++) { + for (int32_t i = 0; i < (dataBlocks->GetSize()); i++) { delete (*dataBlocks)[i]; } delete dataBlocks; diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp index 7b1cc50d72..8580650223 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp @@ -345,10 +345,9 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, CFX_PathData rect; rect.AppendRect((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)(x + 1), (FX_FLOAT)(y + 1)); - CFX_GraphStateData stateData; if (m_output->Get(x, y)) { - device->DrawPath(&rect, &matri, &stateData, m_barColor, 0, - FXFILL_WINDING); + CFX_GraphStateData data; + device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING); } } } diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index beb7dec1a3..d8b65c4c5b 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -721,8 +721,7 @@ FX_BOOL CXFA_FFDocView::RunEventLayoutReady() { return TRUE; } void CXFA_FFDocView::RunBindItems() { - int32_t iCount = m_BindItems.GetSize(); - for (int32_t i = 0; i < iCount; i++) { + for (int32_t i = 0; i < m_BindItems.GetSize(); i++) { if (m_BindItems[i]->HasFlag(XFA_NODEFLAG_HasRemoved)) continue; @@ -757,8 +756,8 @@ void CXFA_FFDocView::RunBindItems() { CFX_WideString wsValue; CFX_WideString wsLabel; uint32_t uValueHash = FX_HashCode_GetW(wsValueRef, false); - for (int32_t i = 0; i < iCount; i++) { - CXFA_Object* refObj = rs.nodes[i]; + for (int32_t j = 0; j < iCount; j++) { + CXFA_Object* refObj = rs.nodes[j]; if (!refObj->IsNode()) { continue; } diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 2a9638e817..8e10189f8c 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -1345,9 +1345,8 @@ static void XFA_BOX_GetFillPath(CXFA_Box box, return; } FX_BOOL bSameStyles = TRUE; - int32_t i; CXFA_Stroke stroke1 = strokes[0]; - for (i = 1; i < 8; i++) { + for (int32_t i = 1; i < 8; i++) { CXFA_Stroke stroke2 = strokes[i]; if (!stroke1.SameStyles(stroke2)) { bSameStyles = FALSE; @@ -1357,7 +1356,7 @@ static void XFA_BOX_GetFillPath(CXFA_Box box, } if (bSameStyles) { stroke1 = strokes[0]; - for (i = 2; i < 8; i += 2) { + for (int32_t i = 2; i < 8; i += 2) { CXFA_Stroke stroke2 = strokes[i]; if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence | XFA_STROKE_SAMESTYLE_Corner)) { @@ -1839,9 +1838,8 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box, } FX_BOOL bClose = FALSE; FX_BOOL bSameStyles = TRUE; - int32_t i; CXFA_Stroke stroke1 = strokes[0]; - for (i = 1; i < 8; i++) { + for (int32_t i = 1; i < 8; i++) { CXFA_Stroke stroke2 = strokes[i]; if (!stroke1.SameStyles(stroke2)) { bSameStyles = FALSE; @@ -1852,7 +1850,7 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box, if (bSameStyles) { stroke1 = strokes[0]; bClose = TRUE; - for (i = 2; i < 8; i += 2) { + for (int32_t i = 2; i < 8; i += 2) { CXFA_Stroke stroke2 = strokes[i]; if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence | XFA_STROKE_SAMESTYLE_Corner)) { @@ -1874,12 +1872,12 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box, FX_BOOL bStart = TRUE; CFX_Path path; path.Create(); - for (i = 0; i < 8; i++) { - CXFA_Stroke stroke1 = strokes[i]; - if ((i % 1) == 0 && stroke1.GetRadius() < 0) { + for (int32_t i = 0; i < 8; i++) { + CXFA_Stroke stroke = strokes[i]; + if ((i % 1) == 0 && stroke.GetRadius() < 0) { FX_BOOL bEmpty = path.IsEmpty(); if (!bEmpty) { - XFA_BOX_StrokePath(stroke1, &path, pGS, pMatrix); + XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix); path.Clear(); } bStart = TRUE; @@ -1887,9 +1885,9 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box, } XFA_BOX_GetPath(box, strokes, rtWidget, path, i, bStart, !bSameStyles); CXFA_Stroke stroke2 = strokes[(i + 1) % 8]; - bStart = !stroke1.SameStyles(stroke2); + bStart = !stroke.SameStyles(stroke2); if (bStart) { - XFA_BOX_StrokePath(stroke1, &path, pGS, pMatrix); + XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix); path.Clear(); } } diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index fe72e29c05..fa300f1721 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -1042,12 +1042,11 @@ FX_BOOL CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) { } FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { - if (m_pLoader == NULL || iBlock < 0 || iBlock >= CountBlocks()) { + if (m_pLoader == NULL || iBlock < 0 || iBlock >= CountBlocks()) return FALSE; - } - if (m_pLoader->m_fWidth < 1) { + if (m_pLoader->m_fWidth < 1) return FALSE; - } + m_pLoader->m_iTotalLines = -1; m_iLines = 0; FX_FLOAT fLinePos = 0; @@ -1056,9 +1055,8 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { int32_t iCount = m_Blocks.GetSize(); int32_t iBlocksHeightCount = m_pLoader->m_BlocksHeight.GetSize(); iBlocksHeightCount /= 2; - if (iBlock < iBlocksHeightCount) { + if (iBlock < iBlocksHeightCount) return TRUE; - } if (iBlock == iBlocksHeightCount) { Unload(); m_pBreak.reset(CreateBreak(TRUE)); @@ -1067,18 +1065,15 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { fLinePos -= m_pLoader->m_BlocksHeight.ElementAt(i * 2 + 1); } m_pLoader->m_iChar = 0; - if (iCount > 1) { + if (iCount > 1) m_pLoader->m_iTotalLines = m_Blocks.ElementAt(iBlock * 2 + 1); - } Loader(szText, fLinePos, TRUE); - if (iCount == 0 && m_pLoader->m_fStartLineOffset < 0.1f) { + if (iCount == 0 && m_pLoader->m_fStartLineOffset < 0.1f) UpdateAlign(szText.y, fLinePos); - } } else if (m_pTextDataNode) { iBlock *= 2; - if (iBlock < iCount - 2) { + if (iBlock < iCount - 2) m_pLoader->m_iTotalLines = m_Blocks.ElementAt(iBlock + 1); - } m_pBreak->Reset(); if (m_bRichText) { CFDE_XMLNode* pContainerNode = GetXMLContainerNode(); @@ -1086,48 +1081,40 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) { return TRUE; } CFDE_XMLNode* pXMLNode = m_pLoader->m_pXMLNode; - if (pXMLNode == NULL) { + if (!pXMLNode) return TRUE; - } CFDE_XMLNode* pSaveXMLNode = m_pLoader->m_pXMLNode; for (; pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { - FX_BOOL bFlag = LoadRichText(pXMLNode, szText, fLinePos, - m_pLoader->m_pParentStyle, TRUE); - if (!bFlag) { + if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle, + TRUE)) { break; } } - while (pXMLNode == NULL) { + while (!pXMLNode) { pXMLNode = pSaveXMLNode->GetNodeItem(CFDE_XMLNode::Parent); - if (pXMLNode == pContainerNode) { + if (pXMLNode == pContainerNode) break; - } - FX_BOOL bFlag = - LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle, - TRUE, NULL, FALSE); - if (!bFlag) { + if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle, + TRUE, NULL, FALSE)) { break; } pSaveXMLNode = pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling); - if (!pXMLNode) { + if (!pXMLNode) continue; - } for (; pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { - FX_BOOL bFlag = LoadRichText(pXMLNode, szText, fLinePos, - m_pLoader->m_pParentStyle, TRUE); - if (!bFlag) { + if (!LoadRichText(pXMLNode, szText, fLinePos, + m_pLoader->m_pParentStyle, TRUE)) { break; } } } } else { pNode = m_pLoader->m_pNode; - if (pNode == NULL) { + if (!pNode) return TRUE; - } LoadText(pNode, szText, fLinePos, TRUE); } } @@ -1839,7 +1826,6 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, if (iChars > 0) { CFX_PointF pt1, pt2; FX_FLOAT fEndY = pCharPos[0].m_OriginY + 1.05f; - int32_t i = 0; if (pPiece->iPeriod == XFA_ATTRIBUTEENUM_Word) { for (int32_t i = 0; i < pPiece->iUnderline; i++) { for (int32_t j = 0; j < iChars; j++) { @@ -1866,7 +1852,7 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, pt1.x = pCharPos[0].m_OriginX; pt2.x = pCharPos[iChars - 1].m_OriginX + pCharPos[iChars - 1].m_FontCharWidth * pPiece->fFontSize / 1000.0f; - for (i = 0; i < pPiece->iLineThrough; i++) { + for (int32_t i = 0; i < pPiece->iLineThrough; i++) { pt1.y = pt2.y = fEndY; pPath->AddLine(pt1, pt2); fEndY += 2.0f; @@ -1917,14 +1903,13 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, CFX_PointF pt1, pt2; pt1.x = fOrgX, pt2.x = fEndX; FX_FLOAT fEndY = pCharPos[0].m_OriginY + 1.05f; - int32_t i = 0; - for (i = 0; i < pPiece->iUnderline; i++) { + for (int32_t i = 0; i < pPiece->iUnderline; i++) { pt1.y = pt2.y = fEndY; pPath->AddLine(pt1, pt2); fEndY += 2.0f; } fEndY = pCharPos[0].m_OriginY - pPiece->rtPiece.height * 0.25f; - for (i = 0; i < pPiece->iLineThrough; i++) { + for (int32_t i = 0; i < pPiece->iLineThrough; i++) { pt1.y = pt2.y = fEndY; pPath->AddLine(pt1, pt2); fEndY += 2.0f; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index a31a5a189a..a9b296eb3f 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -647,8 +647,8 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get()); FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { - for (int32_t i = 2; i < iLength; i++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, + for (int32_t j = 2; j < iLength; j++) { + FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, jsObjectValue.get()); GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); if (!FXJSE_Value_IsNull(newPropertyValue.get())) @@ -657,8 +657,8 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, } else { CFX_ByteString propertyStr; FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); - for (int32_t i = 2; i < iLength; i++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, + for (int32_t j = 2; j < iLength; j++) { + FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, jsObjectValue.get()); FXJSE_Value_GetObjectProp(jsObjectValue.get(), propertyStr.AsStringC(), @@ -730,8 +730,8 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get()); FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { - for (int32_t i = 2; i < iLength; i++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, + for (int32_t j = 2; j < iLength; j++) { + FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, jsObjectValue.get()); GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); if (FXJSE_Value_IsNull(newPropertyValue.get())) @@ -744,8 +744,8 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, } else { CFX_ByteString propertyStr; FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); - for (int32_t i = 2; i < iLength; i++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, + for (int32_t j = 2; j < iLength; j++) { + FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, jsObjectValue.get()); FXJSE_Value_GetObjectProp(jsObjectValue.get(), propertyStr.AsStringC(), @@ -812,8 +812,8 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get()); FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { - for (int32_t i = 2; i < iLength; i++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, + for (int32_t j = 2; j < iLength; j++) { + FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, jsObjectValue.get()); GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); if (FXJSE_Value_IsNull(newPropertyValue.get())) @@ -826,8 +826,8 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, } else { CFX_ByteString propertyStr; FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); - for (int32_t i = 2; i < iLength; i++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, + for (int32_t j = 2; j < iLength; j++) { + FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, jsObjectValue.get()); FXJSE_Value_GetObjectProp(jsObjectValue.get(), propertyStr.AsStringC(), @@ -1943,21 +1943,21 @@ FX_BOOL CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData, } if (*(pData + iIndex) == '.') { ++iIndex; - FX_CHAR strTemp[4]; - strTemp[3] = '\0'; + FX_CHAR strSec[4]; + strSec[3] = '\0'; if (*(pData + iIndex) > '9' || *(pData + iIndex) < '0') { return iRet; } - strTemp[0] = *(pData + iIndex); + strSec[0] = *(pData + iIndex); if (*(pData + iIndex + 1) > '9' || *(pData + iIndex + 1) < '0') { return iRet; } - strTemp[1] = *(pData + iIndex + 1); + strSec[1] = *(pData + iIndex + 1); if (*(pData + iIndex + 2) > '9' || *(pData + iIndex + 2) < '0') { return iRet; } - strTemp[2] = *(pData + iIndex + 2); - iMilliSecond = FXSYS_atoi(strTemp); + strSec[2] = *(pData + iIndex + 2); + iMilliSecond = FXSYS_atoi(strSec); if (iMilliSecond > 100) { iMilliSecond = 0; return iRet; @@ -3033,9 +3033,9 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t argc = args.GetLength(); if (argc > 1) { + v8::Isolate* pIsolate = pContext->GetScriptRuntime(); std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); FX_BOOL argOneIsNull = FALSE; int32_t iIndex = 0; @@ -3245,8 +3245,8 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); if (args.GetLength() == 1) { + v8::Isolate* pIsolate = pContext->GetScriptRuntime(); std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, args, 0); CFX_ByteString utf8ScriptString; ValueToUTF8String(scriptValue.get(), utf8ScriptString); @@ -3259,16 +3259,16 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, CXFA_FM2JSContext::Translate( CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(), wsJavaScriptBuf, wsError); - CFXJSE_Context* pContext = + CFXJSE_Context* pNewContext = FXJSE_Context_Create(pIsolate, nullptr, nullptr); std::unique_ptr<CFXJSE_Value> returnValue(new CFXJSE_Value(pIsolate)); javaScript = wsJavaScriptBuf.AsStringC(); FXJSE_ExecuteScript( - pContext, + pNewContext, FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()).c_str(), returnValue.get()); FXJSE_Value_Set(args.GetReturnValue(), returnValue.get()); - FXJSE_Context_Release(pContext); + FXJSE_Context_Release(pNewContext); } } else { pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Eval"); @@ -3517,32 +3517,32 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, GetSimpleValue(pThis, args, 1); CFX_ByteString unitTempString; ValueToUTF8String(unitValue.get(), unitTempString); - const FX_CHAR* pData = unitTempString.c_str(); - int32_t u = 0; - while (*(pData + u) == ' ' || *(pData + u) == 0x09 || - *(pData + u) == 0x0B || *(pData + u) == 0x0C || - *(pData + u) == 0x0A || *(pData + u) == 0x0D) { - ++u; + const FX_CHAR* pChar = unitTempString.c_str(); + int32_t uVal = 0; + while (*(pChar + uVal) == ' ' || *(pChar + uVal) == 0x09 || + *(pChar + uVal) == 0x0B || *(pChar + uVal) == 0x0C || + *(pChar + uVal) == 0x0A || *(pChar + uVal) == 0x0D) { + ++uVal; } - while (u < unitTempString.GetLength()) { - if ((*(pData + u) > '9' || *(pData + u) < '0') && - *(pData + u) != '.') { + while (uVal < unitTempString.GetLength()) { + if ((*(pChar + uVal) > '9' || *(pChar + uVal) < '0') && + *(pChar + uVal) != '.') { break; } - ++u; + ++uVal; } - while (*(pData + u) == ' ' || *(pData + u) == 0x09 || - *(pData + u) == 0x0B || *(pData + u) == 0x0C || - *(pData + u) == 0x0A || *(pData + u) == 0x0D) { - ++u; + while (*(pChar + uVal) == ' ' || *(pChar + uVal) == 0x09 || + *(pChar + uVal) == 0x0B || *(pChar + uVal) == 0x0C || + *(pChar + uVal) == 0x0A || *(pChar + uVal) == 0x0D) { + ++uVal; } - int32_t uLen = unitTempString.GetLength(); - while (u < uLen) { - if (*(pData + u) == ' ') { + int32_t uValLen = unitTempString.GetLength(); + while (uVal < uValLen) { + if (*(pChar + uVal) == ' ') { break; } - strUnit += (*(pData + u)); - ++u; + strUnit += (*(pChar + uVal)); + ++uVal; } strUnit.MakeLower(); } else { @@ -4614,10 +4614,10 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, } else { wsTestPattern = FX_WSTRC(L"text{") + wsPattern; wsTestPattern += FX_WSTRC(L"}"); - CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsTestPattern, - pLocale, (CXFA_LocaleMgr*)pMgr); - if (localeValue.IsValid()) { - szParsedValue = FX_UTF8Encode(localeValue.GetValue()); + CXFA_LocaleValue localeValue2(XFA_VT_TEXT, wsValue, wsTestPattern, + pLocale, (CXFA_LocaleMgr*)pMgr); + if (localeValue2.IsValid()) { + szParsedValue = FX_UTF8Encode(localeValue2.GetValue()); FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue.AsStringC()); } else { @@ -5296,14 +5296,12 @@ void CXFA_FM2JSContext::WordUS(const CFX_ByteStringC& szData, if (iInteger < iLength) { strBuf << " And "; iIndex = iInteger + 1; - int32_t iCount = 0; while (iIndex < iLength) { - iCount = (iLength - iIndex) % 12; - if (!iCount && iLength - iIndex > 0) { - iCount = 12; - } - TrillionUS(CFX_ByteStringC(pData + iIndex, iCount), strBuf); - iIndex += iCount; + int32_t iSize = (iLength - iIndex) % 12; + if (!iSize && iLength - iIndex > 0) + iSize = 12; + TrillionUS(CFX_ByteStringC(pData + iIndex, iSize), strBuf); + iIndex += iSize; if (iIndex < iLength) { strBuf << " Trillion "; } diff --git a/xfa/fxfa/fm2js/xfa_fmparse.cpp b/xfa/fxfa/fm2js/xfa_fmparse.cpp index efbf224a40..5fd6c06613 100644 --- a/xfa/fxfa/fm2js/xfa_fmparse.cpp +++ b/xfa/fxfa/fm2js/xfa_fmparse.cpp @@ -555,10 +555,8 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression( if (m_pToken->m_type != TOKrparen) { pArray.reset(new CFX_ArrayTemplate<CXFA_FMSimpleExpression*>()); while (m_pToken->m_type != TOKrparen) { - CXFA_FMSimpleExpression* e = ParseSimpleExpression(); - if (e) { - pArray->Add(e); - } + if (CXFA_FMSimpleExpression* expr = ParseSimpleExpression()) + pArray->Add(expr); if (m_pToken->m_type == TOKcomma) { NextToken(); } else if (m_pToken->m_type == TOKeof || diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 03643cd988..7d7b50fb3f 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -811,7 +811,7 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( sNodeIterator.MoveToNext(); } else { CFX_MapPtrTemplate<CXFA_Node*, CXFA_Node*> subformMapArray; - CXFA_NodeArray subformArray; + CXFA_NodeArray nodeArray; for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) { FX_BOOL bSelfMatch = FALSE; XFA_ATTRIBUTEENUM eBindMatch = XFA_ATTRIBUTEENUM_None; @@ -830,11 +830,11 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( XFA_DataMerge_CreateDataBinding(pSubformNode, pDataNode); ASSERT(pSubformNode); subformMapArray.SetAt(pSubformNode, pDataNode); - subformArray.Add(pSubformNode); + nodeArray.Add(pSubformNode); } subformMapArray.GetStartPosition(); - for (int32_t iIndex = 0; iIndex < subformArray.GetSize(); iIndex++) { - CXFA_Node* pSubform = subformArray[iIndex]; + for (int32_t iIndex = 0; iIndex < nodeArray.GetSize(); iIndex++) { + CXFA_Node* pSubform = nodeArray[iIndex]; CXFA_Node* pDataNode = reinterpret_cast<CXFA_Node*>(subformMapArray.GetValueAt(pSubform)); for (CXFA_Node* pTemplateChild = diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index 497c8216dd..d7b8bf04d9 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -336,13 +336,12 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( pNode->GetClassID() == XFA_ELEMENT_Items) { wsChildren.clear(); bSaveXML = TRUE; - CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); - while (pChildNode) { - XFA_DataExporter_RegenerateFormFile_Changed(pChildNode, newBuf, - bSaveXML); + CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); + while (pChild) { + XFA_DataExporter_RegenerateFormFile_Changed(pChild, newBuf, bSaveXML); wsChildren += newBuf.AsStringC(); newBuf.Clear(); - pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); + pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); } } break; diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 7b7ecf4ba7..509bf630e9 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -154,11 +154,11 @@ FX_BOOL CXFA_ItemLayoutProcessor::FindLayoutItemSplitPos( (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { FX_FLOAT fChildOffset = fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y; - FX_BOOL bAppChange = FALSE; + FX_BOOL bChange = FALSE; if (FindLayoutItemSplitPos(pChildItem, fChildOffset, fRelSplitPos, - bAppChange, bCalculateMargin)) { + bChange, bCalculateMargin)) { if (fRelSplitPos - fChildOffset < XFA_LAYOUT_FLOAT_PERCISION && - bAppChange) { + bChange) { fProposedSplitPos = fRelSplitPos - fCurTopMargin; } else { fProposedSplitPos = fRelSplitPos + fCurBottomMargin; @@ -1922,13 +1922,13 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow( } static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( CXFA_ItemLayoutProcessor* pThis, - CXFA_ItemLayoutProcessor*& pProcessor, + CXFA_ItemLayoutProcessor* pProcessor, FX_BOOL bContainerWidthAutoSize, FX_BOOL bContainerHeightAutoSize, FX_FLOAT fContainerHeight, XFA_ATTRIBUTEENUM eFlowStrategy, uint8_t& uCurHAlignState, - CFX_ArrayTemplate<CXFA_ContentLayoutItem*>(&rgCurLineLayoutItems)[3], + CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3], FX_BOOL bUseBreakControl, FX_FLOAT fAvailHeight, FX_FLOAT fRealHeight, @@ -2266,6 +2266,7 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( } return XFA_ItemLayoutProcessorResult_Done; } + XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( FX_BOOL bUseBreakControl, XFA_ATTRIBUTEENUM eFlowStrategy, @@ -2445,7 +2446,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( pLayoutChild = NULL; } while (m_pCurChildNode) { - CXFA_ItemLayoutProcessor* pProcessor = NULL; + CXFA_ItemLayoutProcessor* pProcessor = nullptr; FX_BOOL bAddedItemInRow = FALSE; fContentCurRowY += XFA_ItemLayoutProcessor_InsertPendingItems(this, m_pFormNode); @@ -2477,18 +2478,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, TRUE); } else { - CXFA_ItemLayoutProcessor* pProcessor = - new CXFA_ItemLayoutProcessor(pTrailerNode, NULL); + std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( + new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); XFA_ItemLayoutProcessor_InsertFlowedItem( - this, pProcessor, bContainerWidthAutoSize, + this, pTempProcessor.get(), bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, uCurHAlignState, rgCurLineLayoutItems, FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, fContentWidthLimit, fContentCurRowAvailWidth, fContentCurRowHeight, bAddedItemInRow, bForceEndPage, pContext); - delete pProcessor; - pProcessor = NULL; } } XFA_ItemLayoutProcessor_GotoNextContainerNode( @@ -2507,18 +2506,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( bCreatePage) && m_pFormNode->GetClassID() != XFA_ELEMENT_Form) { if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { - CXFA_ItemLayoutProcessor* pProcessor = - new CXFA_ItemLayoutProcessor(pTrailerNode, NULL); + std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( + new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); XFA_ItemLayoutProcessor_InsertFlowedItem( - this, pProcessor, bContainerWidthAutoSize, + this, pTempProcessor.get(), bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, uCurHAlignState, rgCurLineLayoutItems, FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, fContentWidthLimit, fContentCurRowAvailWidth, fContentCurRowHeight, bAddedItemInRow, bForceEndPage, pContext); - delete pProcessor; - pProcessor = NULL; } if (!bCreatePage) { if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { @@ -2528,18 +2525,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( fContentCalculatedWidth, fContentCalculatedHeight, fContentCurRowY, fContentCurRowHeight, fContentWidthLimit); rgCurLineLayoutItems->RemoveAll(); - CXFA_ItemLayoutProcessor* pProcessor = - new CXFA_ItemLayoutProcessor(pLeaderNode, NULL); + std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( + new CXFA_ItemLayoutProcessor(pLeaderNode, nullptr)); XFA_ItemLayoutProcessor_InsertFlowedItem( - this, pProcessor, bContainerWidthAutoSize, + this, pTempProcessor.get(), bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, uCurHAlignState, rgCurLineLayoutItems, FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, fContentWidthLimit, fContentCurRowAvailWidth, fContentCurRowHeight, bAddedItemInRow, bForceEndPage, pContext); - delete pProcessor; - pProcessor = NULL; } } else { if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { @@ -2715,6 +2710,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( : (bIsManualBreak ? XFA_ItemLayoutProcessorResult_ManualBreak : XFA_ItemLayoutProcessorResult_PageFullBreak); } + FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition( CFX_ArrayTemplate<CXFA_ContentLayoutItem*>(&rgCurLineLayoutItems)[3], XFA_ATTRIBUTEENUM eFlowStrategy, diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp index 02bc0a8469..4b36bc8e4c 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp @@ -140,30 +140,29 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot, int32_t iSpliteIndex = 0; FX_BOOL bTargetAllFind = TRUE; while (iSpliteIndex != -1) { - CFX_WideString wsTargetExpr; + CFX_WideString wsExpr; int32_t iSpliteNextIndex = 0; if (!bTargetAllFind) { iSpliteNextIndex = wsTargetAll.Find(' ', iSpliteIndex); - wsTargetExpr = - wsTargetAll.Mid(iSpliteIndex, iSpliteNextIndex - iSpliteIndex); + wsExpr = wsTargetAll.Mid(iSpliteIndex, iSpliteNextIndex - iSpliteIndex); } else { - wsTargetExpr = wsTargetAll; + wsExpr = wsTargetAll; } - if (wsTargetExpr.IsEmpty()) + if (wsExpr.IsEmpty()) return nullptr; bTargetAllFind = FALSE; - if (wsTargetExpr.GetAt(0) == '#') { + if (wsExpr.GetAt(0) == '#') { CXFA_Node* pNode = pDocument->GetNodeByID( ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)), - wsTargetExpr.Mid(1).AsStringC()); + wsExpr.Mid(1).AsStringC()); if (pNode) return pNode; } else if (bNewExprStyle) { - CFX_WideString wsProcessedTarget = wsTargetExpr; - if (wsTargetExpr.Left(4) == FX_WSTRC(L"som(") && - wsTargetExpr.Right(1) == FX_WSTRC(L")")) { - wsProcessedTarget = wsTargetExpr.Mid(4, wsTargetExpr.GetLength() - 5); + CFX_WideString wsProcessedTarget = wsExpr; + if (wsExpr.Left(4) == FX_WSTRC(L"som(") && + wsExpr.Right(1) == FX_WSTRC(L")")) { + wsProcessedTarget = wsExpr.Mid(4, wsExpr.GetLength() - 5); } XFA_RESOLVENODE_RS rs; int32_t iCount = pDocument->GetScriptContext()->ResolveObjects( @@ -893,7 +892,6 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, CXFA_Node*& pLeaderTemplate, CXFA_Node*& pTrailerTemplate, FX_BOOL bCreatePage) { - CFX_WideStringC wsOverflowLeader, wsOverflowTrailer; CXFA_Node* pContainer = pOverflowNode->GetNodeItem(XFA_NODEITEM_Parent, XFA_OBJECTTYPE_ContainerNode) @@ -937,6 +935,8 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, } return NULL; } else if (pOverflowNode->GetClassID() == XFA_ELEMENT_Overflow) { + CFX_WideStringC wsOverflowLeader; + CFX_WideStringC wsOverflowTrailer; CFX_WideStringC wsOverflowTarget; pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); @@ -967,8 +967,9 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, } return pOverflowNode; } - return NULL; + return nullptr; } + FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode, CXFA_Node*& pLeaderNode, CXFA_Node*& pTrailerNode, @@ -1718,11 +1719,11 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { pDocument, pContainerItem->m_pFormNode->GetClassID(), pContainerItem->m_pFormNode->GetNameHash(), pParentNode); CXFA_ContainerIterator sIterator(pExistingNode); - for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; - pNode = sIterator.MoveToNext()) { - if (pNode->GetClassID() != XFA_ELEMENT_ContentArea) { + for (CXFA_Node* pIter = sIterator.GetCurrent(); pIter; + pIter = sIterator.MoveToNext()) { + if (pIter->GetClassID() != XFA_ELEMENT_ContentArea) { CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( - pNode->GetUserData(XFA_LAYOUTITEMKEY)); + pIter->GetUserData(XFA_LAYOUTITEMKEY)); if (pLayoutItem) { pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); delete pLayoutItem; diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index f3bb4fefb2..cfe65ed864 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -1393,8 +1393,8 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( if (!pValueNode) { return; } - XFA_ELEMENT eType = pValueNode->GetClassID(); - if (eType == XFA_ELEMENT_Value) { + XFA_ELEMENT eNodeType = pValueNode->GetClassID(); + if (eNodeType == XFA_ELEMENT_Value) { bNeedFindContainer = true; CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); if (pNode && pNode->IsContainerNode()) { @@ -1407,7 +1407,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( pNode->GetNodeItem(XFA_NODEITEM_Parent)); } } else { - if (eType == XFA_ELEMENT_Items) { + if (eNodeType == XFA_ELEMENT_Items) { CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); if (pNode && pNode->IsContainerNode()) { pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); @@ -4190,12 +4190,10 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, CXFA_NodeArray nodeArray; pBind->GetBindItems(nodeArray); for (int32_t i = 0; i < nodeArray.GetSize(); i++) { - CXFA_Node* pNode = nodeArray[i]; - if (pNode == this) { - continue; + if (nodeArray[i] != this) { + nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, + bScriptModify, FALSE); } - pNode->SetScriptContent(wsContent, wsContent, bNotify, - bScriptModify, FALSE); } } break; @@ -4215,11 +4213,10 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, CXFA_NodeArray nodeArray; pBindNode->GetBindItems(nodeArray); for (int32_t i = 0; i < nodeArray.GetSize(); i++) { - CXFA_Node* pNode = nodeArray[i]; - if (pNode == this) { - continue; + if (nodeArray[i] != this) { + nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true, + FALSE); } - pNode->SetScriptContent(wsContent, wsContent, bNotify, true, FALSE); } } pBindNode = nullptr; @@ -4280,9 +4277,8 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, CXFA_NodeArray nodeArray; pBindNode->GetBindItems(nodeArray); for (int32_t i = 0; i < nodeArray.GetSize(); i++) { - CXFA_Node* pNode = nodeArray[i]; - pNode->SetScriptContent(wsContent, wsContent, bNotify, bScriptModify, - FALSE); + nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, + bScriptModify, FALSE); } } return TRUE; diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index 357566ed9c..528758f6f8 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -219,10 +219,10 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, XFA_HashCode uHashCode = static_cast<XFA_HashCode>( FX_HashCode_GetW(wsPropName.AsStringC(), false)); if (uHashCode != XFA_HASHCODE_Layout) { - CXFA_Object* pObject = + CXFA_Object* pObj = lpScriptContext->GetDocument()->GetXFAObject(uHashCode); - if (pObject) { - FXJSE_Value_Set(pValue, lpScriptContext->GetJSValueFromMap(pObject)); + if (pObj) { + FXJSE_Value_Set(pValue, lpScriptContext->GetJSValueFromMap(pObj)); return; } } @@ -335,12 +335,12 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, } if (pPropOrChild) { CFX_WideString wsDefaultName(L"{default}"); - const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = + const XFA_SCRIPTATTRIBUTEINFO* lpAttrInfo = XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(), wsDefaultName.AsStringC()); - if (lpAttributeInfo) { - (pPropOrChild->*(lpAttributeInfo->lpfnCallback))( - pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); + if (lpAttrInfo) { + (pPropOrChild->*(lpAttrInfo->lpfnCallback))( + pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttrInfo->eAttribute); return; } } |