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

Unified Diff: fpdfsdk/src/fpdfppo.cpp

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/fpdfdoc.cpp ('k') | fpdfsdk/src/fpdfsave.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfppo.cpp
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp
index 2e92d4a1533836f235abc52b514c5a0ee14d7d0c..40d56b304d8167cc0041905bba1869c776302f20 100644
--- a/fpdfsdk/src/fpdfppo.cpp
+++ b/fpdfsdk/src/fpdfppo.cpp
@@ -185,9 +185,9 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
CPDF_Dictionary* pDict,
CFX_ByteString nSrctag)
{
- if (!pDict || !pDict->KeyExist("Type") || nSrctag.IsEmpty())
+ if (!pDict || nSrctag.IsEmpty())
return nullptr;
- if (!pDict->KeyExist("Parent"))
+ if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type"))
return nullptr;
CPDF_Object* pType = pDict->GetElement("Type")->GetDirect();
@@ -200,19 +200,19 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
if (!pParent || pParent->GetType() != PDFOBJ_DICTIONARY)
return nullptr;
- CPDF_Dictionary* pp = (CPDF_Dictionary*)pParent;
-
if (pDict->KeyExist((const char*)nSrctag))
return pDict->GetElement((const char*)nSrctag);
+ CPDF_Dictionary* pp = (CPDF_Dictionary*)pParent;
while (pp) {
if (pp->KeyExist((const char*)nSrctag)) {
return pp->GetElement((const char*)nSrctag);
- } else if (pp->KeyExist("Parent")) {
- pp = (CPDF_Dictionary*)pp->GetElement("Parent")->GetDirect();
- if (pp->GetType() == PDFOBJ_NULL)
- break;
- } else {
+ }
+ if (!pp->KeyExist("Parent")) {
+ break;
+ }
+ pp = (CPDF_Dictionary*)pp->GetElement("Parent")->GetDirect();
+ if (pp->GetType() == PDFOBJ_NULL) {
break;
}
}
@@ -259,12 +259,10 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
FX_DWORD count = pArray->GetCount();
for (FX_DWORD i = 0; i < count; ++i) {
CPDF_Object* pNextObj = pArray->GetElement(i);
- if (pNextObj) {
- if (!UpdateReference(pNextObj, pDoc, pObjNumberMap))
- return FALSE;
- } else {
+ if (!pNextObj)
+ return FALSE;
+ if (!UpdateReference(pNextObj, pDoc, pObjNumberMap))
return FALSE;
- }
}
break;
}
@@ -316,7 +314,8 @@ FX_DWORD CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc,
if (!FXSYS_stricmp(strType, "Pages")) {
pDictClone->Release();
return 4;
- } else if (!FXSYS_stricmp(strType, "Page")) {
+ }
+ if (!FXSYS_stricmp(strType, "Page")) {
pDictClone->Release();
return 0;
}
@@ -373,10 +372,9 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring,
nStartPageNum >nEndPageNum ||
nEndPageNum > nCount) {
return FALSE;
- } else {
- for (int i = nStartPageNum; i <= nEndPageNum; ++i) {
- pageArray->Add(i);
- }
+ }
+ for (int i = nStartPageNum; i <= nEndPageNum; ++i) {
+ pageArray->Add(i);
}
}
nStringFrom = nStringTo + 1;
« no previous file with comments | « fpdfsdk/src/fpdfdoc.cpp ('k') | fpdfsdk/src/fpdfsave.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698