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

Side by Side Diff: core/src/fpdfdoc/doc_annot.cpp

Issue 361553002: Remove "this==NULL" and adjust corresponding callers (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix if check warning Created 6 years, 5 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/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp ('k') | core/src/fpdfdoc/doc_ap.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 "../../include/fpdfdoc/fpdf_doc.h" 7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 #include "../../include/fpdfapi/fpdf_pageobj.h" 8 #include "../../include/fpdfapi/fpdf_pageobj.h"
9 CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) 9 CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
10 { 10 {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 while (pos) { 158 while (pos) {
159 void* pForm; 159 void* pForm;
160 void* pObjects; 160 void* pObjects;
161 m_APMap.GetNextAssoc(pos, pForm, pObjects); 161 m_APMap.GetNextAssoc(pos, pForm, pObjects);
162 delete (CPDF_PageObjects*)pObjects; 162 delete (CPDF_PageObjects*)pObjects;
163 } 163 }
164 m_APMap.RemoveAll(); 164 m_APMap.RemoveAll();
165 } 165 }
166 CFX_ByteString CPDF_Annot::GetSubType() const 166 CFX_ByteString CPDF_Annot::GetSubType() const
167 { 167 {
168 return m_pAnnotDict->GetConstString(FX_BSTRC("Subtype")); 168 return m_pAnnotDict ? m_pAnnotDict->GetConstString(FX_BSTRC("Subtype")) : CF X_ByteStringC();
169 } 169 }
170 void CPDF_Annot::GetRect(CPDF_Rect& rect) const 170 void CPDF_Annot::GetRect(CPDF_Rect& rect) const
171 { 171 {
172 if (m_pAnnotDict == NULL) { 172 if (m_pAnnotDict == NULL) {
173 return; 173 return;
174 } 174 }
175 rect = m_pAnnotDict->GetRect("Rect"); 175 rect = m_pAnnotDict->GetRect("Rect");
176 rect.Normalize(); 176 rect.Normalize();
177 } 177 }
178 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, CPDF_Annot::Appeara nceMode mode) 178 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, CPDF_Annot::Appeara nceMode mode)
(...skipping 16 matching lines...) Expand all
195 return NULL; 195 return NULL;
196 } 196 }
197 CPDF_Stream* pStream = NULL; 197 CPDF_Stream* pStream = NULL;
198 if (psub->GetType() == PDFOBJ_STREAM) { 198 if (psub->GetType() == PDFOBJ_STREAM) {
199 pStream = (CPDF_Stream*)psub; 199 pStream = (CPDF_Stream*)psub;
200 } else if (psub->GetType() == PDFOBJ_DICTIONARY) { 200 } else if (psub->GetType() == PDFOBJ_DICTIONARY) {
201 CFX_ByteString as = pAnnotDict->GetString("AS"); 201 CFX_ByteString as = pAnnotDict->GetString("AS");
202 if (as.IsEmpty()) { 202 if (as.IsEmpty()) {
203 CFX_ByteString value = pAnnotDict->GetString(FX_BSTRC("V")); 203 CFX_ByteString value = pAnnotDict->GetString(FX_BSTRC("V"));
204 if (value.IsEmpty()) { 204 if (value.IsEmpty()) {
205 value = pAnnotDict->GetDict(FX_BSTRC("Parent"))->GetString(FX_BS TRC("V")); 205 CPDF_Dictionary* pDict = pAnnotDict->GetDict(FX_BSTRC("Parent")) ;
206 value = pDict ? pDict->GetString(FX_BSTRC("V")) : CFX_ByteString ();
206 } 207 }
207 if (value.IsEmpty() || !((CPDF_Dictionary*)psub)->KeyExist(value)) { 208 if (value.IsEmpty() || !((CPDF_Dictionary*)psub)->KeyExist(value)) {
208 as = FX_BSTRC("Off"); 209 as = FX_BSTRC("Off");
209 } else { 210 } else {
210 as = value; 211 as = value;
211 } 212 }
212 } 213 }
213 pStream = ((CPDF_Dictionary*)psub)->GetStream(as); 214 pStream = ((CPDF_Dictionary*)psub)->GetStream(as);
214 } 215 }
215 return pStream; 216 return pStream;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 if (pIRT != m_pAnnotDict) { 511 if (pIRT != m_pAnnotDict) {
511 continue; 512 continue;
512 } 513 }
513 if (count == index) { 514 if (count == index) {
514 return pAnnot; 515 return pAnnot;
515 } 516 }
516 count ++; 517 count ++;
517 } 518 }
518 return NULL; 519 return NULL;
519 } 520 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp ('k') | core/src/fpdfdoc/doc_ap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698