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

Side by Side Diff: xfa/fee/fde_txtedtengine.cpp

Issue 1986373002: Remove Release() from IFX_CharIter, use unique_ptrs. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nit Created 4 years, 7 months 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 | « xfa/fee/fde_txtedtbuf.cpp ('k') | xfa/fee/fde_txtedtpage.h » ('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 "xfa/fee/fde_txtedtengine.h" 7 #include "xfa/fee/fde_txtedtengine.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 ClearSelection(); 947 ClearSelection();
948 m_nCaret = 0; 948 m_nCaret = 0;
949 m_pTxtBuf->Clear(FALSE); 949 m_pTxtBuf->Clear(FALSE);
950 m_nCaret = 0; 950 m_nCaret = 0;
951 } 951 }
952 void CFDE_TxtEdtEngine::RebuildParagraphs() { 952 void CFDE_TxtEdtEngine::RebuildParagraphs() {
953 RemoveAllParags(); 953 RemoveAllParags();
954 FX_WCHAR wChar = L' '; 954 FX_WCHAR wChar = L' ';
955 int32_t nParagStart = 0; 955 int32_t nParagStart = 0;
956 int32_t nIndex = 0; 956 int32_t nIndex = 0;
957 IFX_CharIter* pIter = new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)m_pTxtBuf); 957 std::unique_ptr<IFX_CharIter> pIter(
958 new CFDE_TxtEdtBufIter(static_cast<CFDE_TxtEdtBuf*>(m_pTxtBuf)));
958 pIter->SetAt(0); 959 pIter->SetAt(0);
959 do { 960 do {
960 wChar = pIter->GetChar(); 961 wChar = pIter->GetChar();
961 nIndex = pIter->GetAt(); 962 nIndex = pIter->GetAt();
962 if (wChar == m_wLineEnd) { 963 if (wChar == m_wLineEnd) {
963 CFDE_TxtEdtParag* pParag = new CFDE_TxtEdtParag(this); 964 CFDE_TxtEdtParag* pParag = new CFDE_TxtEdtParag(this);
964 pParag->SetStartIndex(nParagStart); 965 pParag->SetStartIndex(nParagStart);
965 pParag->SetTextLength(nIndex - nParagStart + 1); 966 pParag->SetTextLength(nIndex - nParagStart + 1);
966 pParag->SetLineCount(-1); 967 pParag->SetLineCount(-1);
967 m_ParagPtrArray.Add(pParag); 968 m_ParagPtrArray.Add(pParag);
968 nParagStart = nIndex + 1; 969 nParagStart = nIndex + 1;
969 } 970 }
970 } while (pIter->Next()); 971 } while (pIter->Next());
971 pIter->Release();
972 } 972 }
973 973
974 void CFDE_TxtEdtEngine::RemoveAllParags() { 974 void CFDE_TxtEdtEngine::RemoveAllParags() {
975 int32_t nCount = m_ParagPtrArray.GetSize(); 975 int32_t nCount = m_ParagPtrArray.GetSize();
976 for (int i = 0; i < nCount; ++i) 976 for (int i = 0; i < nCount; ++i)
977 delete m_ParagPtrArray[i]; 977 delete m_ParagPtrArray[i];
978 m_ParagPtrArray.RemoveAll(); 978 m_ParagPtrArray.RemoveAll();
979 } 979 }
980 980
981 void CFDE_TxtEdtEngine::RemoveAllPages() { 981 void CFDE_TxtEdtEngine::RemoveAllPages() {
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 int32_t nEngine = 0; 1751 int32_t nEngine = 0;
1752 ArchiveLoader >> nEngine; 1752 ArchiveLoader >> nEngine;
1753 m_pEngine = (CFDE_TxtEdtEngine*)(uintptr_t)nEngine; 1753 m_pEngine = (CFDE_TxtEdtEngine*)(uintptr_t)nEngine;
1754 int32_t iSel = 0; 1754 int32_t iSel = 0;
1755 ArchiveLoader >> iSel; 1755 ArchiveLoader >> iSel;
1756 m_bSel = !!iSel; 1756 m_bSel = !!iSel;
1757 ArchiveLoader >> m_nIndex; 1757 ArchiveLoader >> m_nIndex;
1758 ArchiveLoader >> m_nCaret; 1758 ArchiveLoader >> m_nCaret;
1759 ArchiveLoader >> m_wsRange; 1759 ArchiveLoader >> m_wsRange;
1760 } 1760 }
OLDNEW
« no previous file with comments | « xfa/fee/fde_txtedtbuf.cpp ('k') | xfa/fee/fde_txtedtpage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698