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

Unified Diff: fpdfsdk/src/fpdfeditpage.cpp

Issue 1414793016: Merge to XFA: Cleanup: Remove some NULL checks in fpdfsdk. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month 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 | « fpdfsdk/src/formfiller/FFL_IFormFiller.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfeditpage.cpp
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp
index 531d37247de16652d02e55950791575e4ea26540..b3a52991d265589124b5e001439d8064424d826a 100644
--- a/fpdfsdk/src/fpdfeditpage.cpp
+++ b/fpdfsdk/src/fpdfeditpage.cpp
@@ -96,37 +96,21 @@ DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) {
return -1;
}
CPDF_Dictionary* pDict = pPage->m_pFormDict;
+ if (!pDict)
+ return -1;
- int rotate = 0;
- if (pDict != NULL) {
- if (pDict->KeyExist("Rotate"))
- rotate = pDict->GetElement("Rotate")->GetDirect()
- ? pDict->GetElement("Rotate")->GetDirect()->GetInteger() / 90
- : 0;
- else {
- if (pDict->KeyExist("Parent")) {
- CPDF_Dictionary* pPages =
- ToDictionary(pDict->GetElement("Parent")->GetDirect());
- while (pPages) {
- if (pPages->KeyExist("Rotate")) {
- rotate =
- pPages->GetElement("Rotate")->GetDirect()
- ? pPages->GetElement("Rotate")->GetDirect()->GetInteger() /
- 90
- : 0;
- break;
- } else if (pPages->KeyExist("Parent"))
- pPages = ToDictionary(pPages->GetElement("Parent")->GetDirect());
- else
- break;
- }
- }
+ while (pDict) {
+ if (pDict->KeyExist("Rotate")) {
+ CPDF_Object* pRotateObj = pDict->GetElement("Rotate")->GetDirect();
+ return pRotateObj ? pRotateObj->GetInteger() / 90 : 0;
}
- } else {
- return -1;
+ if (!pDict->KeyExist("Parent"))
+ break;
+
+ pDict = ToDictionary(pDict->GetElement("Parent")->GetDirect());
}
- return rotate;
+ return 0;
}
DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page,
@@ -139,7 +123,7 @@ DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page,
return;
}
CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_obj;
- if (pPageObj == NULL)
+ if (!pPageObj)
return;
FX_POSITION LastPersition = pPage->GetLastObjectPosition();
@@ -262,7 +246,7 @@ DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
double e,
double f) {
CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object;
- if (pPageObj == NULL)
+ if (!pPageObj)
return;
CFX_AffineMatrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_IFormFiller.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698