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

Unified Diff: fpdfsdk/src/javascript/Field.cpp

Issue 1243883003: Fix else-after-returns throughout pdfium. (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
Index: fpdfsdk/src/javascript/Field.cpp
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp
index 8393d9d5ff16ee16116885ed57ef241da053f904..c66f349d64eadde7ee780bbe1f438cdeb9fd9e56 100644
--- a/fpdfsdk/src/javascript/Field.cpp
+++ b/fpdfsdk/src/javascript/Field.cpp
@@ -365,13 +365,13 @@ FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabe
CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField)
{
- ASSERT(pFormField != NULL);
- if(!pFormField->CountControls() || m_nFormControlIndex>=pFormField->CountControls()) return NULL;
+ if (!pFormField->CountControls() || m_nFormControlIndex >= pFormField->CountControls())
+ return NULL;
- if (m_nFormControlIndex<0)
+ if (m_nFormControlIndex < 0)
return pFormField->GetControl(0);
- else
- return pFormField->GetControl(m_nFormControlIndex);
+
+ return pFormField->GetControl(m_nFormControlIndex);
}
/* ---------------------------------------- property ---------------------------------------- */
@@ -1543,46 +1543,46 @@ FX_BOOL Field::exportValues(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString
CFX_PtrArray FieldArray;
GetFormFields(m_FieldName,FieldArray);
- if (FieldArray.GetSize() <= 0) return FALSE;
+ if (FieldArray.GetSize() <= 0)
+ return FALSE;
CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
- ASSERT(pFormField != NULL);
-
if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX &&
pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON)
return FALSE;
if (vp.IsSetting())
{
- if (!m_bCanSet) return FALSE;
- if (!vp.IsArrayObject())return FALSE;
+ if (!m_bCanSet)
+ return FALSE;
+
+ if (!vp.IsArrayObject())
+ return FALSE;
}
else
{
CJS_Array ExportValusArray(m_isolate);
-
if (m_nFormControlIndex < 0)
{
for (int i=0,sz=pFormField->CountControls(); i<sz; i++)
{
CPDF_FormControl* pFormControl = pFormField->GetControl(i);
- ASSERT(pFormControl != NULL);
-
ExportValusArray.SetElement(i, CJS_Value(m_isolate,pFormControl->GetExportValue().c_str()));
}
}
else
{
- if(m_nFormControlIndex >= pFormField->CountControls()) return FALSE;
+ if (m_nFormControlIndex >= pFormField->CountControls())
+ return FALSE;
+
CPDF_FormControl* pFormControl = pFormField->GetControl(m_nFormControlIndex);
- if (!pFormControl) return FALSE;
+ if (!pFormControl)
+ return FALSE;
ExportValusArray.SetElement(0, CJS_Value(m_isolate,pFormControl->GetExportValue().c_str()));
}
-
vp << ExportValusArray;
}
-
return TRUE;
}
@@ -1592,21 +1592,20 @@ FX_BOOL Field::fileSelect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
CFX_PtrArray FieldArray;
GetFormFields(m_FieldName, FieldArray);
- if (FieldArray.GetSize() <= 0) return FALSE;
+ if (FieldArray.GetSize() <= 0)
+ return FALSE;
CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
- ASSERT(pFormField != NULL);
-
if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
return FALSE;
if (vp.IsSetting())
{
- if (!m_bCanSet) return FALSE;
+ if (!m_bCanSet)
+ return FALSE;
bool bVP;
vp >> bVP;
-
}
else
{
@@ -1615,7 +1614,6 @@ FX_BOOL Field::fileSelect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
else
vp << false;
}
-
return TRUE;
}
@@ -1626,19 +1624,22 @@ FX_BOOL Field::fillColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
CJS_Array crArray(m_isolate);
CFX_PtrArray FieldArray;
- GetFormFields(m_FieldName,FieldArray);
- if (FieldArray.GetSize() <= 0) return FALSE;
+ GetFormFields(m_FieldName, FieldArray);
+ if (FieldArray.GetSize() <= 0)
+ return FALSE;
if (vp.IsSetting())
{
- if (!m_bCanSet) return FALSE;
- if (!vp.IsArrayObject()) return FALSE;
+ if (!m_bCanSet)
+ return FALSE;
+
+ if (!vp.IsArrayObject())
+ return FALSE;
vp >> crArray;
CPWL_Color color;
color::ConvertArrayToPWLColor(crArray, color);
-
if (m_bDelay)
{
AddDelay_Color(FP_FILLCOLOR, color);
@@ -1654,13 +1655,13 @@ FX_BOOL Field::fillColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
ASSERT(pFormField != NULL);
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
- if (!pFormControl)return FALSE;
+ if (!pFormControl)
+ return FALSE;
int iColorType;
pFormControl->GetBackgroundColor(iColorType);
CPWL_Color color;
-
if (iColorType == COLORTYPE_TRANSPARENT)
{
color = CPWL_Color(COLORTYPE_TRANSPARENT);

Powered by Google App Engine
This is Rietveld 408576698