summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-06-05 15:54:51 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-05 15:54:51 +0000
commiteaba5af84597164281ddd972a5e98631b18d783b (patch)
tree4ae287d9093e3775b6f32b8ea9c41e3e2bbae5ad
parent6cec70acf4ed6839c4a865c41381a6ac37de97e8 (diff)
downloadpdfium-eaba5af84597164281ddd972a5e98631b18d783b.tar.xz
Clean up CFX_TxtBreak
Removed some unused assignments and now unused variables. Also rewrote a for loop so that its secondary condition is now in the control block. The static analyzer was claiming it was possible for a division by 0, though following the control path it was claiming, I am pretty sure it should have exited early. This reorganizing of the code makes it a bit more readable and eliminates the div by 0 warning from the static analyzer. Issues found with Clang Static Analyzer. Change-Id: I91f1b42374734665b06724e9fafa6490e06bd3da Reviewed-on: https://pdfium-review.googlesource.com/33910 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--xfa/fgas/layout/cfx_txtbreak.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp
index 76a36c90da..7633c4c91e 100644
--- a/xfa/fgas/layout/cfx_txtbreak.cpp
+++ b/xfa/fgas/layout/cfx_txtbreak.cpp
@@ -456,7 +456,7 @@ void CFX_TxtBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
else
ttp.m_iStartPos = iStart;
- for (int32_t j = 0; j < ttp.m_iChars; j++) {
+ for (int32_t j = 0; j < ttp.m_iChars && iGapChars > 0; j++, iGapChars--) {
CFX_Char* pTC = ttp.GetChar(j);
if (pTC->m_nBreakType != FX_LBT_DIRECT_BRK || pTC->m_iCharWidth < 0)
continue;
@@ -465,9 +465,6 @@ void CFX_TxtBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
pTC->m_iCharWidth += k;
ttp.m_iWidth += k;
iOffset -= k;
- iGapChars--;
- if (iGapChars < 1)
- break;
}
iStart += ttp.m_iWidth;
}
@@ -804,7 +801,6 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
if (chartype < FX_CHARTYPE_ArabicAlef)
bLam = false;
- dwProps = FX_GetUnicodeProperties(wForm);
bool bEmptyChar =
(chartype >= FX_CHARTYPE_Tab && chartype <= FX_CHARTYPE_Control);
if (wForm == 0xFEFF)
@@ -928,7 +924,6 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
int32_t iLength = pTxtRun->iLength;
CFX_RectF rect(*pTxtRun->pRect);
float fFontSize = pTxtRun->fFontSize;
- int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
float fScale = fFontSize / 1000.0f;
RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont;
if (!pFont)
@@ -964,10 +959,8 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
wch == L'\n')) {
bRet = false;
}
- if (bRet) {
- iCharSize = iFontSize * 500;
+ if (bRet)
fCharSize = fFontSize / 2.0f;
- }
rect.left = fStart;
if (bRTLPiece) {
rect.left -= fCharSize;