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

Side by Side Diff: core/src/fpdfdoc/pdf_vt.h

Issue 1192743004: Cleanup: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 6 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 | « core/src/fpdfdoc/doc_vt.cpp ('k') | core/src/fxcodec/codec/fx_codec_icc.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 #ifndef CORE_SRC_FPDFDOC_PDF_VT_H_ 7 #ifndef CORE_SRC_FPDFDOC_PDF_VT_H_
8 #define CORE_SRC_FPDFDOC_PDF_VT_H_ 8 #define CORE_SRC_FPDFDOC_PDF_VT_H_
9 9
10 class CPVT_Size; 10 class CPVT_Size;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return top - bottom; 77 return top - bottom;
78 return bottom - top; 78 return bottom - top;
79 } 79 }
80 }; 80 };
81 struct CPVT_SectionInfo { 81 struct CPVT_SectionInfo {
82 CPVT_SectionInfo() : rcSection(), nTotalLine(0), pSecProps(NULL), pWordProps (NULL) 82 CPVT_SectionInfo() : rcSection(), nTotalLine(0), pSecProps(NULL), pWordProps (NULL)
83 { 83 {
84 } 84 }
85 virtual ~CPVT_SectionInfo() 85 virtual ~CPVT_SectionInfo()
86 { 86 {
87 if (pSecProps) { 87 delete pSecProps;
88 delete pSecProps; 88 delete pWordProps;
89 }
90 if (pWordProps) {
91 delete pWordProps;
92 }
93 } 89 }
94 CPVT_SectionInfo(const CPVT_SectionInfo & other): rcSection(), nTotalLine(0) , pSecProps(NULL), pWordProps(NULL) 90 CPVT_SectionInfo(const CPVT_SectionInfo & other): rcSection(), nTotalLine(0) , pSecProps(NULL), pWordProps(NULL)
95 { 91 {
96 operator = (other); 92 operator = (other);
97 } 93 }
98 void operator = (const CPVT_SectionInfo & other) 94 void operator = (const CPVT_SectionInfo & other)
99 { 95 {
100 if (this == &other) { 96 if (this == &other) {
101 return; 97 return;
102 } 98 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps( NULL) 137 fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps( NULL)
142 { 138 {
143 } 139 }
144 CPVT_WordInfo(FX_WORD word, int32_t charset, int32_t fontIndex, CPVT_WordPro ps * pProps): 140 CPVT_WordInfo(FX_WORD word, int32_t charset, int32_t fontIndex, CPVT_WordPro ps * pProps):
145 Word(word), nCharset(charset), fWordX(0.0f), fWordY(0.0f), fWordTail(0.0 f), 141 Word(word), nCharset(charset), fWordX(0.0f), fWordY(0.0f), fWordTail(0.0 f),
146 nFontIndex(fontIndex), pWordProps(pProps) 142 nFontIndex(fontIndex), pWordProps(pProps)
147 { 143 {
148 } 144 }
149 virtual ~CPVT_WordInfo() 145 virtual ~CPVT_WordInfo()
150 { 146 {
151 if (pWordProps) { 147 delete pWordProps;
152 delete pWordProps;
153 }
154 } 148 }
155 CPVT_WordInfo(const CPVT_WordInfo & word): Word(0), nCharset(0), 149 CPVT_WordInfo(const CPVT_WordInfo & word): Word(0), nCharset(0),
156 fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps( NULL) 150 fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps( NULL)
157 { 151 {
158 operator = (word); 152 operator = (word);
159 } 153 }
160 void operator = (const CPVT_WordInfo & word) 154 void operator = (const CPVT_WordInfo & word)
161 { 155 {
162 if (this == &word) { 156 if (this == &word) {
163 return; 157 return;
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 const CPVT_WordPlace & GetAt() const 623 const CPVT_WordPlace & GetAt() const
630 { 624 {
631 return m_CurPos; 625 return m_CurPos;
632 }; 626 };
633 private: 627 private:
634 CPVT_WordPlace m_CurPos ; 628 CPVT_WordPlace m_CurPos ;
635 CPDF_VariableText * m_pVT; 629 CPDF_VariableText * m_pVT;
636 }; 630 };
637 631
638 #endif // CORE_SRC_FPDFDOC_PDF_VT_H_ 632 #endif // CORE_SRC_FPDFDOC_PDF_VT_H_
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_vt.cpp ('k') | core/src/fxcodec/codec/fx_codec_icc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698