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

Side by Side Diff: fpdfsdk/src/fxedit/fxet_edit.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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/fsdk_baseannot.cpp ('k') | fpdfsdk/src/javascript/Document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/include/fxedit/fxet_edit.h" 7 #include "fpdfsdk/include/fxedit/fxet_edit.h"
8 #include "fpdfsdk/include/fxedit/fxet_stub.h" 8 #include "fpdfsdk/include/fxedit/fxet_stub.h"
9 9
10 #define FX_EDIT_UNDO_MAXITEM 10000 10 #define FX_EDIT_UNDO_MAXITEM 10000
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 m_bOprNotify(FALSE), 807 m_bOprNotify(FALSE),
808 m_pGroupUndoItem(NULL) { 808 m_pGroupUndoItem(NULL) {
809 ASSERT(pVT); 809 ASSERT(pVT);
810 } 810 }
811 811
812 CFX_Edit::~CFX_Edit() { 812 CFX_Edit::~CFX_Edit() {
813 delete m_pVTProvide; 813 delete m_pVTProvide;
814 m_pVTProvide = NULL; 814 m_pVTProvide = NULL;
815 delete m_pIterator; 815 delete m_pIterator;
816 m_pIterator = NULL; 816 m_pIterator = NULL;
817 ASSERT(m_pGroupUndoItem == NULL); 817 ASSERT(!m_pGroupUndoItem);
818 } 818 }
819 819
820 // public methods 820 // public methods
821 821
822 void CFX_Edit::Initialize() { 822 void CFX_Edit::Initialize() {
823 m_pVT->Initialize(); 823 m_pVT->Initialize();
824 SetCaret(m_pVT->GetBeginWordPlace()); 824 SetCaret(m_pVT->GetBeginWordPlace());
825 SetCaretOrigin(); 825 SetCaretOrigin();
826 } 826 }
827 827
(...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 return wp; 3082 return wp;
3083 } 3083 }
3084 3084
3085 int32_t CFX_Edit::GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset) { 3085 int32_t CFX_Edit::GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset) {
3086 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) 3086 if (IFX_Edit_FontMap* pFontMap = GetFontMap())
3087 return pFontMap->CharSetFromUnicode(word, nOldCharset); 3087 return pFontMap->CharSetFromUnicode(word, nOldCharset);
3088 return nOldCharset; 3088 return nOldCharset;
3089 } 3089 }
3090 3090
3091 void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) { 3091 void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) {
3092 ASSERT(m_pGroupUndoItem == NULL); 3092 ASSERT(!m_pGroupUndoItem);
3093 3093
3094 m_pGroupUndoItem = new CFX_Edit_GroupUndoItem(sTitle); 3094 m_pGroupUndoItem = new CFX_Edit_GroupUndoItem(sTitle);
3095 } 3095 }
3096 3096
3097 void CFX_Edit::EndGroupUndo() { 3097 void CFX_Edit::EndGroupUndo() {
3098 m_pGroupUndoItem->UpdateItems(); 3098 m_pGroupUndoItem->UpdateItems();
3099 m_Undo.AddItem(m_pGroupUndoItem); 3099 m_Undo.AddItem(m_pGroupUndoItem);
3100 if (m_bOprNotify && m_pOprNotify) 3100 if (m_bOprNotify && m_pOprNotify)
3101 m_pOprNotify->OnAddUndo(m_pGroupUndoItem); 3101 m_pOprNotify->OnAddUndo(m_pGroupUndoItem);
3102 m_pGroupUndoItem = NULL; 3102 m_pGroupUndoItem = NULL;
3103 } 3103 }
3104 3104
3105 void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) { 3105 void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) {
3106 if (m_pGroupUndoItem) 3106 if (m_pGroupUndoItem)
3107 m_pGroupUndoItem->AddUndoItem(pEditUndoItem); 3107 m_pGroupUndoItem->AddUndoItem(pEditUndoItem);
3108 else { 3108 else {
3109 m_Undo.AddItem(pEditUndoItem); 3109 m_Undo.AddItem(pEditUndoItem);
3110 if (m_bOprNotify && m_pOprNotify) 3110 if (m_bOprNotify && m_pOprNotify)
3111 m_pOprNotify->OnAddUndo(pEditUndoItem); 3111 m_pOprNotify->OnAddUndo(pEditUndoItem);
3112 } 3112 }
3113 } 3113 }
3114 3114
3115 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) { 3115 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) {
3116 m_Undo.AddItem(pUndoItem); 3116 m_Undo.AddItem(pUndoItem);
3117 if (m_bOprNotify && m_pOprNotify) 3117 if (m_bOprNotify && m_pOprNotify)
3118 m_pOprNotify->OnAddUndo(pUndoItem); 3118 m_pOprNotify->OnAddUndo(pUndoItem);
3119 } 3119 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_baseannot.cpp ('k') | fpdfsdk/src/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698