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

Unified Diff: core/fpdfdoc/cpvt_generateap.cpp

Issue 2001783003: Get rid of CPDF_Object::GetArray(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_parser/include/cpdf_object.h ('k') | core/fpdfdoc/doc_formfield.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpvt_generateap.cpp
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index aa49f79c124769eee0d8c6d383f7b536fe03490a..db2ee6c01dbbe15435c65b81e2663c59a4ffa823 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -344,15 +344,10 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
pDoc, pStreamDict ? pStreamDict->GetDictBy("Resources") : nullptr,
pDefFont, sFontName.Right(sFontName.GetLength() - 1));
CPDF_VariableText::Provider prd(&map);
- CPDF_Array* pOpts = FPDF_GetFieldAttr(pAnnotDict, "Opt")
- ? FPDF_GetFieldAttr(pAnnotDict, "Opt")->GetArray()
- : nullptr;
- CPDF_Array* pSels = FPDF_GetFieldAttr(pAnnotDict, "I")
- ? FPDF_GetFieldAttr(pAnnotDict, "I")->GetArray()
- : nullptr;
- int32_t nTop = FPDF_GetFieldAttr(pAnnotDict, "TI")
- ? FPDF_GetFieldAttr(pAnnotDict, "TI")->GetInteger()
- : 0;
+ CPDF_Array* pOpts = ToArray(FPDF_GetFieldAttr(pAnnotDict, "Opt"));
+ CPDF_Array* pSels = ToArray(FPDF_GetFieldAttr(pAnnotDict, "I"));
+ CPDF_Object* pTi = FPDF_GetFieldAttr(pAnnotDict, "TI");
+ int32_t nTop = pTi ? pTi->GetInteger() : 0;
CFX_ByteTextBuf sBody;
if (pOpts) {
FX_FLOAT fy = rcBody.top;
@@ -415,11 +410,10 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
}
}
if (sBody.GetSize() > 0) {
- sAppStream << "/Tx BMC\n"
- << "q\n";
- sAppStream << rcBody.left << " " << rcBody.bottom << " "
- << rcBody.Width() << " " << rcBody.Height() << " re\nW\nn\n";
- sAppStream << sBody.AsStringC() << "Q\nEMC\n";
+ sAppStream << "/Tx BMC\nq\n"
+ << rcBody.left << " " << rcBody.bottom << " "
+ << rcBody.Width() << " " << rcBody.Height() << " re\nW\nn\n"
+ << sBody.AsStringC() << "Q\nEMC\n";
}
} break;
}
« no previous file with comments | « core/fpdfapi/fpdf_parser/include/cpdf_object.h ('k') | core/fpdfdoc/doc_formfield.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698