summaryrefslogtreecommitdiff
path: root/core/src/fpdftext/fpdf_text.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-14 18:34:00 -0800
committerLei Zhang <thestig@chromium.org>2015-12-14 18:34:00 -0800
commit412e908082a361d0fd9591eab939e96a882212f1 (patch)
tree11726052ae08f13dc5a05a82cbce870758580aeb /core/src/fpdftext/fpdf_text.cpp
parent96660d6f382204339d6b1aadc3913303d436e252 (diff)
downloadpdfium-412e908082a361d0fd9591eab939e96a882212f1.tar.xz
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 .
Diffstat (limited to 'core/src/fpdftext/fpdf_text.cpp')
-rw-r--r--core/src/fpdftext/fpdf_text.cpp18
1 files changed, 9 insertions, 9 deletions
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;