Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: core/src/fpdftext/fpdf_text.cpp

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfdoc/doc_utils.cpp ('k') | core/src/fpdftext/fpdf_text_int.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdftext/fpdf_text.cpp
diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp
index 9a967e62fdecc2410184850b6bbf09d0509cfddc..1e56bf901d48248bf18ea91a8f5378e1dce8b78f 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;
« no previous file with comments | « core/src/fpdfdoc/doc_utils.cpp ('k') | core/src/fpdftext/fpdf_text_int.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698