diff options
author | thestig <thestig@chromium.org> | 2016-06-07 17:53:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-07 17:53:06 -0700 |
commit | 1cd352e0a4bc19f96df199b0acfa32a344240d5e (patch) | |
tree | be24d7a4bd135c2ab5568148ab318b7bf648edda /fpdfsdk/fxedit | |
parent | a4fdfc5ed0e8d2e6acc52cc34eac42c6072f0ccc (diff) | |
download | pdfium-1cd352e0a4bc19f96df199b0acfa32a344240d5e.tar.xz |
Get rid of NULLs in fpdfsdk/
Review-Url: https://codereview.chromium.org/2031653003
Diffstat (limited to 'fpdfsdk/fxedit')
-rw-r--r-- | fpdfsdk/fxedit/fxet_ap.cpp | 11 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.cpp | 34 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_list.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_pageobjs.cpp | 10 | ||||
-rw-r--r-- | fpdfsdk/fxedit/include/fx_edit.h | 18 | ||||
-rw-r--r-- | fpdfsdk/fxedit/include/fxet_edit.h | 22 | ||||
-rw-r--r-- | fpdfsdk/fxedit/include/fxet_list.h | 2 |
7 files changed, 51 insertions, 52 deletions
diff --git a/fpdfsdk/fxedit/fxet_ap.cpp b/fpdfsdk/fxedit/fxet_ap.cpp index 563acb65b5..5420b46218 100644 --- a/fpdfsdk/fxedit/fxet_ap.cpp +++ b/fpdfsdk/fxedit/fxet_ap.cpp @@ -56,12 +56,11 @@ static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, return sRet.MakeString(); } -CFX_ByteString IFX_Edit::GetEditAppearanceStream( - IFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange /* = NULL*/, - FX_BOOL bContinuous /* = TRUE*/, - uint16_t SubWord /* = 0*/) { +CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, + const CFX_FloatPoint& ptOffset, + const CPVT_WordRange* pRange, + FX_BOOL bContinuous, + uint16_t SubWord) { CFX_ByteTextBuf sEditStream, sWords; CFX_FloatPoint ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f); diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 0124913c5f..589ac1bd41 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -339,7 +339,7 @@ IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(int32_t nIndex) { if (nIndex >= 0 && nIndex < m_UndoItemStack.GetSize()) return m_UndoItemStack.GetAt(nIndex); - return NULL; + return nullptr; } void CFX_Edit_Undo::RemoveHeads() { @@ -576,8 +576,8 @@ void CFXEU_Clear::Undo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wrSel.BeginPos); - m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, NULL, NULL, FALSE, - TRUE); + m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, nullptr, nullptr, + FALSE, TRUE); m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos); } } @@ -1079,83 +1079,83 @@ void CFX_Edit::SetRichText(FX_BOOL bRichText, FX_BOOL bPaint) { FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) { CPVT_WordProps WordProps; WordProps.nFontIndex = nFontIndex; - return SetRichTextProps(EP_FONTINDEX, NULL, &WordProps); + return SetRichTextProps(EP_FONTINDEX, nullptr, &WordProps); } FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) { CPVT_WordProps WordProps; WordProps.fFontSize = fFontSize; - return SetRichTextProps(EP_FONTSIZE, NULL, &WordProps); + return SetRichTextProps(EP_FONTSIZE, nullptr, &WordProps); } FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) { CPVT_WordProps WordProps; WordProps.dwWordColor = dwColor; - return SetRichTextProps(EP_WORDCOLOR, NULL, &WordProps); + return SetRichTextProps(EP_WORDCOLOR, nullptr, &WordProps); } FX_BOOL CFX_Edit::SetRichTextScript(CPDF_VariableText::ScriptType nScriptType) { CPVT_WordProps WordProps; WordProps.nScriptType = nScriptType; - return SetRichTextProps(EP_SCRIPTTYPE, NULL, &WordProps); + return SetRichTextProps(EP_SCRIPTTYPE, nullptr, &WordProps); } FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) { CPVT_WordProps WordProps; if (bBold) WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; - return SetRichTextProps(EP_BOLD, NULL, &WordProps); + return SetRichTextProps(EP_BOLD, nullptr, &WordProps); } FX_BOOL CFX_Edit::SetRichTextItalic(FX_BOOL bItalic) { CPVT_WordProps WordProps; if (bItalic) WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; - return SetRichTextProps(EP_ITALIC, NULL, &WordProps); + return SetRichTextProps(EP_ITALIC, nullptr, &WordProps); } FX_BOOL CFX_Edit::SetRichTextUnderline(FX_BOOL bUnderline) { CPVT_WordProps WordProps; if (bUnderline) WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; - return SetRichTextProps(EP_UNDERLINE, NULL, &WordProps); + return SetRichTextProps(EP_UNDERLINE, nullptr, &WordProps); } FX_BOOL CFX_Edit::SetRichTextCrossout(FX_BOOL bCrossout) { CPVT_WordProps WordProps; if (bCrossout) WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; - return SetRichTextProps(EP_CROSSOUT, NULL, &WordProps); + return SetRichTextProps(EP_CROSSOUT, nullptr, &WordProps); } FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) { CPVT_WordProps WordProps; WordProps.fCharSpace = fCharSpace; - return SetRichTextProps(EP_CHARSPACE, NULL, &WordProps); + return SetRichTextProps(EP_CHARSPACE, nullptr, &WordProps); } FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale) { CPVT_WordProps WordProps; WordProps.nHorzScale = nHorzScale; - return SetRichTextProps(EP_HORZSCALE, NULL, &WordProps); + return SetRichTextProps(EP_HORZSCALE, nullptr, &WordProps); } FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) { CPVT_SecProps SecProps; SecProps.fLineLeading = fLineLeading; - return SetRichTextProps(EP_LINELEADING, &SecProps, NULL); + return SetRichTextProps(EP_LINELEADING, &SecProps, nullptr); } FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) { CPVT_SecProps SecProps; SecProps.fLineIndent = fLineIndent; - return SetRichTextProps(EP_LINEINDENT, &SecProps, NULL); + return SetRichTextProps(EP_LINEINDENT, &SecProps, nullptr); } FX_BOOL CFX_Edit::SetRichTextAlignment(int32_t nAlignment) { CPVT_SecProps SecProps; SecProps.nAlignment = nAlignment; - return SetRichTextProps(EP_ALIGNMENT, &SecProps, NULL); + return SetRichTextProps(EP_ALIGNMENT, &SecProps, nullptr); } FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, @@ -2961,7 +2961,7 @@ void CFX_Edit::EndGroupUndo() { m_Undo.AddItem(m_pGroupUndoItem); if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnAddUndo(m_pGroupUndoItem); - m_pGroupUndoItem = NULL; + m_pGroupUndoItem = nullptr; } void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) { diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp index 383b84f27f..1385d57680 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -74,7 +74,7 @@ CFX_WideString CFX_ListItem::GetText() const { } CFX_List::CFX_List() - : m_fFontSize(0.0f), m_pFontMap(NULL), m_bMultiple(FALSE) {} + : m_fFontSize(0.0f), m_pFontMap(nullptr), m_bMultiple(FALSE) {} CFX_List::~CFX_List() { Empty(); @@ -125,7 +125,7 @@ IFX_Edit* CFX_List::GetItemEdit(int32_t nIndex) const { return pListItem->GetEdit(); } - return NULL; + return nullptr; } int32_t CFX_List::GetCount() const { @@ -378,7 +378,7 @@ void CPLST_Select::Done() { } CFX_ListCtrl::CFX_ListCtrl() - : m_pNotify(NULL), + : m_pNotify(nullptr), m_bNotifyFlag(FALSE), m_ptScrollPos(0.0f, 0.0f), m_nSelItem(-1), diff --git a/fpdfsdk/fxedit/fxet_pageobjs.cpp b/fpdfsdk/fxedit/fxet_pageobjs.cpp index f12fffb373..29ad135bca 100644 --- a/fpdfsdk/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp @@ -190,7 +190,7 @@ void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, rcUnderline.right, rcUnderline.top); - pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, color, 0, + pDevice->DrawPath(&pathUnderline, pUser2Device, nullptr, color, 0, FXFILL_WINDING); } } @@ -275,7 +275,7 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, word.ptWord.x, line.ptLine.y + line.fLineDescent, word.ptWord.x + word.fWidth, line.ptLine.y + line.fLineAscent); - pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, + pDevice->DrawPath(&pathSelBK, pUser2Device, nullptr, crSelBK, 0, FXFILL_WINDING); } } @@ -387,7 +387,7 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, word.ptWord.x + word.fWidth + ptOffset.x, line.ptLine.y + line.fLineAscent + ptOffset.y); - pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, + pDevice->DrawPath(&pathSelBK, pUser2Device, nullptr, crSelBK, 0, FXFILL_WINDING); } @@ -419,7 +419,7 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, rcUnderline.right, rcUnderline.top); - pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0, + pDevice->DrawPath(&pathUnderline, pUser2Device, nullptr, crCurText, 0, FXFILL_WINDING); } @@ -429,7 +429,7 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, pathCrossout.AppendRect(rcCrossout.left, rcCrossout.bottom, rcCrossout.right, rcCrossout.top); - pDevice->DrawPath(&pathCrossout, pUser2Device, NULL, crCurText, 0, + pDevice->DrawPath(&pathCrossout, pUser2Device, nullptr, crCurText, 0, FXFILL_WINDING); } diff --git a/fpdfsdk/fxedit/include/fx_edit.h b/fpdfsdk/fxedit/include/fx_edit.h index 5f0283f06f..710c06f809 100644 --- a/fpdfsdk/fxedit/include/fx_edit.h +++ b/fpdfsdk/fxedit/include/fx_edit.h @@ -366,23 +366,23 @@ class IFX_Edit { // put text into edit. virtual void SetText(const FX_WCHAR* text, int32_t charset = DEFAULT_CHARSET, - const CPVT_SecProps* pSecProps = NULL, - const CPVT_WordProps* pWordProps = NULL) = 0; + const CPVT_SecProps* pSecProps = nullptr, + const CPVT_WordProps* pWordProps = nullptr) = 0; // insert a word into the edit. virtual FX_BOOL InsertWord(uint16_t word, int32_t charset = DEFAULT_CHARSET, - const CPVT_WordProps* pWordProps = NULL) = 0; + const CPVT_WordProps* pWordProps = nullptr) = 0; // insert a return into the edit. - virtual FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = NULL, - const CPVT_WordProps* pWordProps = NULL) = 0; + virtual FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = nullptr, + const CPVT_WordProps* pWordProps = nullptr) = 0; // insert text into the edit. virtual FX_BOOL InsertText(const FX_WCHAR* text, int32_t charset = DEFAULT_CHARSET, - const CPVT_SecProps* pSecProps = NULL, - const CPVT_WordProps* pWordProps = NULL) = 0; + const CPVT_SecProps* pSecProps = nullptr, + const CPVT_WordProps* pWordProps = nullptr) = 0; // do backspace operation. virtual FX_BOOL Backspace() = 0; @@ -476,13 +476,13 @@ class IFX_Edit { static CFX_ByteString GetEditAppearanceStream( IFX_Edit* pEdit, const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange = NULL, + const CPVT_WordRange* pRange = nullptr, FX_BOOL bContinuous = TRUE, uint16_t SubWord = 0); static CFX_ByteString GetSelectAppearanceStream( IFX_Edit* pEdit, const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange = NULL); + const CPVT_WordRange* pRange = nullptr); static void DrawEdit(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, IFX_Edit* pEdit, diff --git a/fpdfsdk/fxedit/include/fxet_edit.h b/fpdfsdk/fxedit/include/fxet_edit.h index c7500a05fb..71431de90a 100644 --- a/fpdfsdk/fxedit/include/fxet_edit.h +++ b/fpdfsdk/fxedit/include/fxet_edit.h @@ -102,7 +102,7 @@ class CFX_Edit_LineRectArray { CFX_Edit_LineRect* GetAt(int32_t nIndex) const { if (nIndex < 0 || nIndex >= m_LineRects.GetSize()) - return NULL; + return nullptr; return m_LineRects.GetAt(nIndex); } @@ -138,7 +138,7 @@ class CFX_Edit_RectArray { CFX_FloatRect* GetAt(int32_t nIndex) const { if (nIndex < 0 || nIndex >= m_Rects.GetSize()) - return NULL; + return nullptr; return m_Rects.GetAt(nIndex); } @@ -570,20 +570,20 @@ class CFX_Edit : public IFX_Edit { void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) override; void SetText(const FX_WCHAR* text, int32_t charset = DEFAULT_CHARSET, - const CPVT_SecProps* pSecProps = NULL, - const CPVT_WordProps* pWordProps = NULL) override; + const CPVT_SecProps* pSecProps = nullptr, + const CPVT_WordProps* pWordProps = nullptr) override; FX_BOOL InsertWord(uint16_t word, int32_t charset = DEFAULT_CHARSET, - const CPVT_WordProps* pWordProps = NULL) override; - FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = NULL, - const CPVT_WordProps* pWordProps = NULL) override; + const CPVT_WordProps* pWordProps = nullptr) override; + FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = nullptr, + const CPVT_WordProps* pWordProps = nullptr) override; FX_BOOL Backspace() override; FX_BOOL Delete() override; FX_BOOL Clear() override; FX_BOOL InsertText(const FX_WCHAR* text, int32_t charset = DEFAULT_CHARSET, - const CPVT_SecProps* pSecProps = NULL, - const CPVT_WordProps* pWordProps = NULL) override; + const CPVT_SecProps* pSecProps = nullptr, + const CPVT_WordProps* pWordProps = nullptr) override; FX_BOOL Redo() override; FX_BOOL Undo() override; int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override; @@ -701,8 +701,8 @@ class CFX_Edit : public IFX_Edit { inline CFX_FloatRect EditToVT(const CFX_FloatRect& rect) const; void Refresh(REFRESH_PLAN_E ePlan, - const CPVT_WordRange* pRange1 = NULL, - const CPVT_WordRange* pRange2 = NULL); + const CPVT_WordRange* pRange1 = nullptr, + const CPVT_WordRange* pRange2 = nullptr); void RefreshPushLineRects(const CPVT_WordRange& wr); void RefreshPushRandomRects(const CPVT_WordRange& wr); diff --git a/fpdfsdk/fxedit/include/fxet_list.h b/fpdfsdk/fxedit/include/fxet_list.h index 58aa94c5b6..ab4605169b 100644 --- a/fpdfsdk/fxedit/include/fxet_list.h +++ b/fpdfsdk/fxedit/include/fxet_list.h @@ -193,7 +193,7 @@ class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> { TYPE GetAt(int32_t nIndex) const { if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); - return NULL; + return nullptr; } void RemoveAt(int32_t nIndex) { if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) |