From 412e908082a361d0fd9591eab939e96a882212f1 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 14 Dec 2015 18:34:00 -0800 Subject: Merge to XFA: Get rid of most instance of 'foo == NULL' TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1520063002 . (cherry picked from commit e385244f8cd6ae376f6b3cf1265a0795d5d30eff) Review URL: https://codereview.chromium.org/1528763003 . --- core/src/fpdftext/fpdf_text.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'core/src/fpdftext/fpdf_text.cpp') diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp index 9a967e62fd..1e56bf901d 100644 --- a/core/src/fpdftext/fpdf_text.cpp +++ b/core/src/fpdftext/fpdf_text.cpp @@ -168,7 +168,7 @@ CTextBaseLine* CTextPage::InsertTextBox(CTextBaseLine* pBaseLine, if (str.GetLength() == 0) { return NULL; } - if (pBaseLine == NULL) { + if (!pBaseLine) { int i; for (i = 0; i < m_BaseLines.GetSize(); i++) { CTextBaseLine* pExistLine = m_BaseLines.GetAt(i); @@ -180,7 +180,7 @@ CTextBaseLine* CTextPage::InsertTextBox(CTextBaseLine* pBaseLine, break; } } - if (pBaseLine == NULL) { + if (!pBaseLine) { pBaseLine = new CTextBaseLine; pBaseLine->m_BaseLine = basey; m_BaseLines.InsertAt(i, pBaseLine); @@ -448,17 +448,17 @@ void CTextPage::FindColumns() { for (int j = 0; j < pBaseLine->m_TextList.GetSize(); j++) { CTextBox* pTextBox = pBaseLine->m_TextList.GetAt(j); CTextColumn* pColumn = FindColumn(pTextBox->m_Right); - if (pColumn == NULL) { + if (pColumn) { + pColumn->m_AvgPos = + (pColumn->m_Count * pColumn->m_AvgPos + pTextBox->m_Right) / + (pColumn->m_Count + 1); + pColumn->m_Count++; + } else { pColumn = new CTextColumn; pColumn->m_Count = 1; pColumn->m_AvgPos = pTextBox->m_Right; pColumn->m_TextPos = -1; m_TextColumns.Add(pColumn); - } else { - pColumn->m_AvgPos = - (pColumn->m_Count * pColumn->m_AvgPos + pTextBox->m_Right) / - (pColumn->m_Count + 1); - pColumn->m_Count++; } } } @@ -726,7 +726,7 @@ void PDF_GetPageText_Unicode(CFX_WideStringArray& lines, int iMinWidth, FX_DWORD flags) { lines.RemoveAll(); - if (pPage == NULL) { + if (!pPage) { return; } CPDF_Page page; -- cgit v1.2.3