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

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

Issue 396173003: Adjust null object check (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: clean up 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 | « no previous file | core/src/fpdfdoc/doc_formfield.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/fpdfdoc/fpdf_vt.h" 8 #include "../../include/fpdfdoc/fpdf_vt.h"
9 #include "pdf_vt.h" 9 #include "pdf_vt.h"
10 #include "../../include/fpdfdoc/fpdf_ap.h" 10 #include "../../include/fpdfdoc/fpdf_ap.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict , const FX_INT32 & nWidgetType) 247 static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict , const FX_INT32 & nWidgetType)
248 { 248 {
249 CPDF_Dictionary* pFormDict = NULL; 249 CPDF_Dictionary* pFormDict = NULL;
250 if (CPDF_Dictionary * pRootDict = pDoc->GetRoot()) { 250 if (CPDF_Dictionary * pRootDict = pDoc->GetRoot()) {
251 pFormDict = pRootDict->GetDict("AcroForm"); 251 pFormDict = pRootDict->GetDict("AcroForm");
252 } 252 }
253 if (!pFormDict) { 253 if (!pFormDict) {
254 return FALSE; 254 return FALSE;
255 } 255 }
256 CFX_ByteString DA = FPDF_GetFieldAttr(pAnnotDict, "DA") ? FPDF_GetFieldAttr( pAnnotDict, "DA")->GetString() : CFX_ByteString(); 256 CFX_ByteString DA;
257 if (CPDF_Object* pDAObj = FPDF_GetFieldAttr(pAnnotDict, "DA")) {
258 DA = pDAObj->GetString();
259 }
257 if (DA.IsEmpty()) { 260 if (DA.IsEmpty()) {
258 DA = pFormDict->GetString("DA"); 261 DA = pFormDict->GetString("DA");
259 } 262 }
260 if (DA.IsEmpty()) { 263 if (DA.IsEmpty()) {
261 return FALSE; 264 return FALSE;
262 } 265 }
263 CPDF_SimpleParser syntax(DA); 266 CPDF_SimpleParser syntax(DA);
264 syntax.FindTagParam("Tf", 2); 267 syntax.FindTagParam("Tf", 2);
265 CFX_ByteString sFontName = syntax.GetWord(); 268 CFX_ByteString sFontName = syntax.GetWord();
266 sFontName = PDF_NameDecode(sFontName); 269 sFontName = PDF_NameDecode(sFontName);
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 case CT_GRAY: 802 case CT_GRAY:
800 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") << "\n"; 803 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") << "\n";
801 break; 804 break;
802 case CT_CMYK: 805 case CT_CMYK:
803 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo r.fColor3 << " " << color.fColor4 << " " 806 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo r.fColor3 << " " << color.fColor4 << " "
804 << (bFillOrStroke ? "k" : "K") << "\n"; 807 << (bFillOrStroke ? "k" : "K") << "\n";
805 break; 808 break;
806 } 809 }
807 return sColorStream.GetByteString(); 810 return sColorStream.GetByteString();
808 } 811 }
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfdoc/doc_formfield.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698