summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_transformpage.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-06-02 15:48:15 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-02 15:48:16 -0700
commitdb444d2063df6c574882d9263e885c4fe1134133 (patch)
tree27ce4a3f181ae0b5ad4eff6893016e7d49dfce0a /fpdfsdk/fpdf_transformpage.cpp
parentad700c2c1fc3c3843dae71e5982f462e42efc987 (diff)
downloadpdfium-db444d2063df6c574882d9263e885c4fe1134133.tar.xz
Fix all the code which has duplicate variable declarations
When there are duplicate variable declarations, the inner names shadow the outter ones. This is error prone and harder to read. Remove all the instances found by /analyze. BUG=chromium:613623, chromium:427616 Review-Url: https://codereview.chromium.org/2027273002
Diffstat (limited to 'fpdfsdk/fpdf_transformpage.cpp')
-rw-r--r--fpdfsdk/fpdf_transformpage.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 5fe6e4ebcc..b78c79c3fc 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -138,7 +138,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
pDoc->AddIndirectObject(pEndStream);
CPDF_Array* pContentArray = nullptr;
- if (CPDF_Array* pArray = ToArray(pContentObj)) {
+ CPDF_Array* pArray = ToArray(pContentObj);
+ if (pArray) {
pContentArray = pArray;
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
@@ -146,8 +147,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
} else if (CPDF_Reference* pReference = ToReference(pContentObj)) {
CPDF_Object* pDirectObj = pReference->GetDirect();
if (pDirectObj) {
- if (CPDF_Array* pArray = pDirectObj->AsArray()) {
- pContentArray = pArray;
+ CPDF_Array* pObjArray = pDirectObj->AsArray();
+ if (pObjArray) {
+ pContentArray = pObjArray;
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
pContentArray->AddReference(pDoc, pEndStream);
@@ -175,8 +177,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
CPDF_Dictionary* pDict = nullptr;
if (pObj->IsDictionary())
pDict = pObj->AsDictionary();
- else if (CPDF_Stream* pStream = pObj->AsStream())
- pDict = pStream->GetDict();
+ else if (CPDF_Stream* pObjStream = pObj->AsStream())
+ pDict = pObjStream->GetDict();
else
continue;
@@ -307,15 +309,17 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,
pDoc->AddIndirectObject(pStream);
CPDF_Array* pContentArray = nullptr;
- if (CPDF_Array* pArray = ToArray(pContentObj)) {
+ CPDF_Array* pArray = ToArray(pContentObj);
+ if (pArray) {
pContentArray = pArray;
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
} else if (CPDF_Reference* pReference = ToReference(pContentObj)) {
CPDF_Object* pDirectObj = pReference->GetDirect();
if (pDirectObj) {
- if (CPDF_Array* pArray = pDirectObj->AsArray()) {
- pContentArray = pArray;
+ CPDF_Array* pObjArray = pDirectObj->AsArray();
+ if (pObjArray) {
+ pContentArray = pObjArray;
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
} else if (pDirectObj->IsStream()) {