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

Side by Side Diff: core/fpdfdoc/cpvt_sectioninfo.cpp

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase Created 4 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 | « core/fpdfdoc/cpdf_variabletext.cpp ('k') | core/fpdfdoc/cpvt_wordinfo.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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "core/fpdfdoc/cpvt_sectioninfo.h" 7 #include "core/fpdfdoc/cpvt_sectioninfo.h"
8 #include "third_party/base/ptr_util.h"
8 9
9 CPVT_SectionInfo::CPVT_SectionInfo() : rcSection(), nTotalLine(0) {} 10 CPVT_SectionInfo::CPVT_SectionInfo() : rcSection(), nTotalLine(0) {}
10 11
11 CPVT_SectionInfo::~CPVT_SectionInfo() {} 12 CPVT_SectionInfo::~CPVT_SectionInfo() {}
12 13
13 CPVT_SectionInfo::CPVT_SectionInfo(const CPVT_SectionInfo& other) { 14 CPVT_SectionInfo::CPVT_SectionInfo(const CPVT_SectionInfo& other) {
14 operator=(other); 15 operator=(other);
15 } 16 }
16 17
17 void CPVT_SectionInfo::operator=(const CPVT_SectionInfo& other) { 18 void CPVT_SectionInfo::operator=(const CPVT_SectionInfo& other) {
18 if (this == &other) 19 if (this == &other)
19 return; 20 return;
20 21
21 rcSection = other.rcSection; 22 rcSection = other.rcSection;
22 nTotalLine = other.nTotalLine; 23 nTotalLine = other.nTotalLine;
23 if (other.pSecProps) 24 if (other.pSecProps)
24 pSecProps.reset(new CPVT_SecProps(*other.pSecProps)); 25 pSecProps = pdfium::MakeUnique<CPVT_SecProps>(*other.pSecProps);
25 else 26 else
26 pSecProps.reset(); 27 pSecProps.reset();
28
27 if (other.pWordProps) 29 if (other.pWordProps)
28 pWordProps.reset(new CPVT_WordProps(*other.pWordProps)); 30 pWordProps = pdfium::MakeUnique<CPVT_WordProps>(*other.pWordProps);
29 else 31 else
30 pWordProps.reset(); 32 pWordProps.reset();
31 } 33 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/cpdf_variabletext.cpp ('k') | core/fpdfdoc/cpvt_wordinfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698