summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/pdfwindow
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-14 18:27:25 -0800
committerLei Zhang <thestig@chromium.org>2015-12-14 18:27:25 -0800
commit96660d6f382204339d6b1aadc3913303d436e252 (patch)
treeb5f84756e1a89251831cebc05b9d4e1f6cb2027b /fpdfsdk/src/pdfwindow
parentd983b09c3ae29a97cba8e9ec9c6351545f6087ee (diff)
downloadpdfium-96660d6f382204339d6b1aadc3913303d436e252.tar.xz
Merge to XFA: Get rid of most instance of 'foo != NULL'
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1512763013 . (cherry picked from commit e3c7c2b54348da4a6939f6672f6c6bff126815a7) Review URL: https://codereview.chromium.org/1529553003 .
Diffstat (limited to 'fpdfsdk/src/pdfwindow')
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp2
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_FontMap.cpp2
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Icon.cpp2
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Label.cpp3
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_ListBox.cpp4
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Note.cpp38
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp37
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Utils.cpp3
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Wnd.cpp4
9 files changed, 10 insertions, 85 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp
index 1c69f18b9f..8d54ae0a13 100644
--- a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp
@@ -27,7 +27,7 @@ CPWL_EditCtrl::CPWL_EditCtrl()
m_nCharSet(DEFAULT_CHARSET),
m_nCodePage(0) {
m_pEdit = IFX_Edit::NewEdit();
- ASSERT(m_pEdit != NULL);
+ ASSERT(m_pEdit);
}
CPWL_EditCtrl::~CPWL_EditCtrl() {
diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp
index cd65c383ff..d5ca376882 100644
--- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp
@@ -14,7 +14,7 @@
CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler)
: m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) {
- ASSERT(m_pSystemHandler != NULL);
+ ASSERT(m_pSystemHandler);
}
CPWL_FontMap::~CPWL_FontMap() {
diff --git a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp
index 61ad1f6913..db5355c59e 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp
@@ -137,7 +137,7 @@ void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
fBottom = 0.0f;
CPDF_Array* pA =
m_pIconFit->m_pDict ? m_pIconFit->m_pDict->GetArray("A") : NULL;
- if (pA != NULL) {
+ if (pA) {
FX_DWORD dwCount = pA->GetCount();
if (dwCount > 0)
fLeft = pA->GetNumber(0);
diff --git a/fpdfsdk/src/pdfwindow/PWL_Label.cpp b/fpdfsdk/src/pdfwindow/PWL_Label.cpp
index 23be536766..8ff7235701 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Label.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Label.cpp
@@ -13,8 +13,7 @@
CPWL_Label::CPWL_Label() : m_pEdit(NULL) {
m_pEdit = IFX_Edit::NewEdit();
-
- ASSERT(m_pEdit != NULL);
+ ASSERT(m_pEdit);
}
CPWL_Label::~CPWL_Label() {
diff --git a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp
index 9b62c471d7..685da4fd34 100644
--- a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp
@@ -20,7 +20,7 @@
/* ------------------------ CPWL_List_Notify ----------------------- */
CPWL_List_Notify::CPWL_List_Notify(CPWL_ListBox* pList) : m_pList(pList) {
- ASSERT(m_pList != NULL);
+ ASSERT(m_pList);
}
CPWL_List_Notify::~CPWL_List_Notify() {}
@@ -74,8 +74,6 @@ CPWL_ListBox::CPWL_ListBox()
m_bHoverSel(FALSE),
m_pFillerNotify(NULL) {
m_pList = IFX_List::NewList();
-
- ASSERT(m_pList != NULL);
}
CPWL_ListBox::~CPWL_ListBox() {
diff --git a/fpdfsdk/src/pdfwindow/PWL_Note.cpp b/fpdfsdk/src/pdfwindow/PWL_Note.cpp
index f15004dcd6..d87c3df916 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Note.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Note.cpp
@@ -47,8 +47,6 @@ void CPWL_Note_Options::SetTextColor(const CPWL_Color& color) {
void CPWL_Note_Options::RePosChildWnd() {
if (IsValid()) {
- ASSERT(m_pText != NULL);
-
CPDF_Rect rcClient = GetClientRect();
if (rcClient.Width() > 15.0f) {
@@ -103,8 +101,6 @@ void CPWL_Note_Options::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
CPDF_Rect CPWL_Note_Options::GetContentRect() const {
- ASSERT(m_pText != NULL);
-
CPDF_Rect rcText = m_pText->GetContentRect();
rcText.right += 15.0f;
return rcText;
@@ -661,10 +657,6 @@ void CPWL_NoteItem::CreateChildWnd(const PWL_CREATEPARAM& cp) {
void CPWL_NoteItem::RePosChildWnd() {
if (IsValid()) {
- ASSERT(m_pSubject != NULL);
- ASSERT(m_pDateTime != NULL);
- ASSERT(m_pContents != NULL);
-
CPDF_Rect rcClient = GetClientRect();
CPDF_Rect rcSubject = rcClient;
@@ -759,8 +751,6 @@ void CPWL_NoteItem::ResetSubjectName(int32_t nItemIndex) {
}
const CPWL_Note* pNote = GetNote();
- ASSERT(pNote != NULL);
-
CFX_WideString sSubject;
sSubject.Format(pNote->GetReplyString().c_str(), nItemIndex);
@@ -925,10 +915,6 @@ FX_FLOAT CPWL_NoteItem::GetItemHeight(FX_FLOAT fLimitWidth) {
m_bSizeChanged = FALSE;
- ASSERT(m_pSubject != NULL);
- ASSERT(m_pDateTime != NULL);
- ASSERT(m_pContents != NULL);
-
FX_FLOAT fRet = m_pDateTime->GetContentRect().Height();
FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
if (fLimitWidth > fBorderWidth * 2)
@@ -1156,17 +1142,6 @@ void CPWL_Note::RePosNoteChildren() {
m_bResizing = TRUE;
if (IsValid()) {
- ASSERT(m_pSubject != NULL);
- ASSERT(m_pDateTime != NULL);
- ASSERT(m_pContents != NULL);
- ASSERT(m_pAuthor != NULL);
- ASSERT(m_pCloseBox != NULL);
- ASSERT(m_pIcon != NULL);
- ASSERT(m_pLBBox != NULL);
- ASSERT(m_pRBBox != NULL);
- ASSERT(m_pContentsBar != NULL);
- ASSERT(m_pOptions != NULL);
-
CPDF_Rect rcClient = GetClientRect();
CPDF_Rect rcIcon = rcClient;
@@ -1267,21 +1242,10 @@ void CPWL_Note::RePosNoteChildren() {
m_bResizing = FALSE;
}
+// TODO(thestig): Make this return an enum.
// 0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close /
// 5-options
int32_t CPWL_Note::NoteHitTest(const CPDF_Point& point) const {
- ASSERT(m_pSubject != NULL);
- ASSERT(m_pDateTime != NULL);
- ASSERT(m_pContents != NULL);
- ASSERT(m_pAuthor != NULL);
- ASSERT(m_pIcon != NULL);
- ASSERT(m_pContentsBar != NULL);
-
- ASSERT(m_pCloseBox != NULL);
- ASSERT(m_pLBBox != NULL);
- ASSERT(m_pRBBox != NULL);
- ASSERT(m_pOptions != NULL);
-
GetClientRect();
if (m_pSubject->WndHitTest(m_pSubject->ParentToChild(point)))
diff --git a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
index f4d4baf6e9..b6a1bb3e6e 100644
--- a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
@@ -14,9 +14,6 @@
#define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
#define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
-/* ------------------------------- PWL_FLOATRANGE
- * ------------------------------- */
-
PWL_FLOATRANGE::PWL_FLOATRANGE() {
Default();
}
@@ -49,9 +46,6 @@ FX_FLOAT PWL_FLOATRANGE::GetWidth() const {
return fMax - fMin;
}
-/* ------------------------------- PWL_SCROLL_PRIVATEDATA
- * ------------------------------- */
-
PWL_SCROLL_PRIVATEDATA::PWL_SCROLL_PRIVATEDATA() {
Default();
}
@@ -113,9 +107,6 @@ void PWL_SCROLL_PRIVATEDATA::SubBig() {
SetPos(ScrollRange.fMin);
}
-/* ------------------------------- CPWL_SBButton -------------------------------
- */
-
CPWL_SBButton::CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType,
PWL_SBBUTTON_TYPE eButtonType) {
m_eScrollBarType = eScrollBarType;
@@ -405,8 +396,6 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
} break;
case PSBT_POS: {
- // CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device);
-
// draw border
CPDF_Rect rcDraw = rectWnd;
CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
@@ -532,14 +521,6 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight,
crStroke, 1.0f);
-
- /*
- ptLeft.y += 1.5f;
- ptRight.y += 1.5f;
-
- CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight,
- ArgbEncode(nTransparancy,150,150,150),1.0f);
- */
}
} break;
default:
@@ -580,24 +561,11 @@ FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) {
if (CPWL_Wnd* pParent = GetParentWindow()) {
pParent->OnNotify(this, PNM_MOUSEMOVE, 0, (intptr_t)&point);
-
- /*
- if (m_bMouseDown && (m_eSBButtonType == PSBT_MIN || m_eSBButtonType ==
- PSBT_MAX))
- {
- if
- (!pParent->OnNotify(this,PNM_LBUTTONDOWN,nFlags,(intptr_t)&point))
- return FALSE;
- }
- */
}
return TRUE;
}
-/* ------------------------------- CPWL_ScrollBar
- * ---------------------------------- */
-
CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType)
: m_sbType(sbType),
m_pMinButton(NULL),
@@ -923,9 +891,8 @@ void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep) {
}
void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) {
- ASSERT(m_pPosButton != NULL);
- ASSERT(m_pMinButton != NULL);
- ASSERT(m_pMaxButton != NULL);
+ ASSERT(m_pMinButton);
+ ASSERT(m_pMaxButton);
if (m_pPosButton->IsVisible()) {
CPDF_Rect rcClient;
diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
index 85593e11d4..71a9d474b7 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
@@ -528,9 +528,6 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream(
IPWL_SpellCheck* pSpellCheck,
const CPDF_Point& ptOffset,
const CPVT_WordRange* pRange) {
- ASSERT(pEdit != NULL);
- ASSERT(pSpellCheck != NULL);
-
CFX_ByteTextBuf sRet;
if (pRange && pRange->IsExist()) {
diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
index 002fc051af..baa24cb8bf 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
@@ -22,8 +22,8 @@ static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() {
CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached,
IFX_SystemHandler* pSystemHandler)
: m_nTimerID(0), m_pAttached(pAttached), m_pSystemHandler(pSystemHandler) {
- ASSERT(m_pAttached != NULL);
- ASSERT(m_pSystemHandler != NULL);
+ ASSERT(m_pAttached);
+ ASSERT(m_pSystemHandler);
}
CPWL_Timer::~CPWL_Timer() {