summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdf_ext.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-22 14:59:55 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-22 14:59:55 -0700
commit7cc97521db1e52d5927f5605de5f9a7102f8af40 (patch)
treedf96cf98cd470e794c7817f347511f3c554c96e4 /fpdfsdk/src/fpdf_ext.cpp
parentb05f1fd710496dea44b001bb905fa1c16a39bb28 (diff)
downloadpdfium-7cc97521db1e52d5927f5605de5f9a7102f8af40.tar.xz
Fix else-after-returns throughout pdfium.
Driven by CS search for pcre:yes file:third_party/pdfium/ -file:pdfium/third_party/ \breturn\b[^;]*;\s*\n*\s*\}*\s*\n*\r*else Note: Care is required to ensure the preceding block is not an else-if. As usual, removed any tabs I saw. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1243883003 .
Diffstat (limited to 'fpdfsdk/src/fpdf_ext.cpp')
-rw-r--r--fpdfsdk/src/fpdf_ext.cpp330
1 files changed, 165 insertions, 165 deletions
diff --git a/fpdfsdk/src/fpdf_ext.cpp b/fpdfsdk/src/fpdf_ext.cpp
index 9afe9b5ea8..0d8db417ac 100644
--- a/fpdfsdk/src/fpdf_ext.cpp
+++ b/fpdfsdk/src/fpdf_ext.cpp
@@ -13,205 +13,205 @@
class CFSDK_UnsupportInfo_Adapter
{
public:
- CFSDK_UnsupportInfo_Adapter(UNSUPPORT_INFO* unsp_info){ m_unsp_info = unsp_info;}
-// FX_BOOL NeedToPauseNow();
- void ReportError(int nErrorType);
+ CFSDK_UnsupportInfo_Adapter(UNSUPPORT_INFO* unsp_info){ m_unsp_info = unsp_info;}
+// FX_BOOL NeedToPauseNow();
+ void ReportError(int nErrorType);
private:
- UNSUPPORT_INFO* m_unsp_info;
+ UNSUPPORT_INFO* m_unsp_info;
};
void CFSDK_UnsupportInfo_Adapter::ReportError(int nErrorType)
{
- if(m_unsp_info && m_unsp_info->FSDK_UnSupport_Handler)
- {
- m_unsp_info->FSDK_UnSupport_Handler(m_unsp_info,nErrorType);
- }
+ if(m_unsp_info && m_unsp_info->FSDK_UnSupport_Handler)
+ {
+ m_unsp_info->FSDK_UnSupport_Handler(m_unsp_info,nErrorType);
+ }
}
void FreeUnsupportInfo(void* pData)
{
- CFSDK_UnsupportInfo_Adapter * pAdapter = (CFSDK_UnsupportInfo_Adapter *)pData;
- delete pAdapter;
+ CFSDK_UnsupportInfo_Adapter * pAdapter = (CFSDK_UnsupportInfo_Adapter *)pData;
+ delete pAdapter;
}
FX_BOOL FPDF_UnSupportError(int nError)
{
- CFSDK_UnsupportInfo_Adapter * pAdapter = (CFSDK_UnsupportInfo_Adapter *)CPDF_ModuleMgr::Get()->GetPrivateData((void *)FPDFSDK_UNSUPPORT_CALL);
+ CFSDK_UnsupportInfo_Adapter * pAdapter = (CFSDK_UnsupportInfo_Adapter *)CPDF_ModuleMgr::Get()->GetPrivateData((void *)FPDFSDK_UNSUPPORT_CALL);
- if(!pAdapter)
- return FALSE;
- pAdapter->ReportError(nError);
- return TRUE;
+ if(!pAdapter)
+ return FALSE;
+ pAdapter->ReportError(nError);
+ return TRUE;
}
DLLEXPORT FPDF_BOOL STDCALL FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info)
{
- if (!unsp_info || unsp_info->version!=1)
- return FALSE;
- CFSDK_UnsupportInfo_Adapter * pAdapter = new CFSDK_UnsupportInfo_Adapter(unsp_info);
+ if (!unsp_info || unsp_info->version!=1)
+ return FALSE;
+ CFSDK_UnsupportInfo_Adapter * pAdapter = new CFSDK_UnsupportInfo_Adapter(unsp_info);
- CPDF_ModuleMgr::Get()->SetPrivateData((void *)FPDFSDK_UNSUPPORT_CALL,pAdapter, &FreeUnsupportInfo);
+ CPDF_ModuleMgr::Get()->SetPrivateData((void *)FPDFSDK_UNSUPPORT_CALL,pAdapter, &FreeUnsupportInfo);
- return TRUE;
+ return TRUE;
}
void CheckUnSupportAnnot(CPDF_Document * pDoc, CPDF_Annot* pPDFAnnot)
{
- CFX_ByteString cbSubType = pPDFAnnot->GetSubType();
- if(cbSubType.Compare("3D") == 0)
- {
- FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT);
- }
- else if(cbSubType.Compare("Screen") ==0)
- {
- CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
- CFX_ByteString cbString;
- if(pAnnotDict->KeyExist("IT"))
- cbString = pAnnotDict->GetString("IT");
- if(cbString.Compare("Img") != 0)
- FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_MEDIA);
- }
- else if(cbSubType.Compare("Movie") ==0)
- {
- FPDF_UnSupportError(FPDF_UNSP_ANNOT_MOVIE);
- }
- else if(cbSubType.Compare("Sound") ==0)
- {
- FPDF_UnSupportError(FPDF_UNSP_ANNOT_SOUND);
- }
- else if(cbSubType.Compare("RichMedia") ==0)
- {
- FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA);
- }
- else if(cbSubType.Compare("FileAttachment") ==0)
- {
- FPDF_UnSupportError(FPDF_UNSP_ANNOT_ATTACHMENT);
- }
- else if(cbSubType.Compare("Widget") ==0)
- {
- CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
- CFX_ByteString cbString;
- if(pAnnotDict->KeyExist("FT"))
- {
- cbString = pAnnotDict->GetString("FT");
- }
- if(cbString.Compare("Sig") == 0)
- {
- FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG);
- }
- }
+ CFX_ByteString cbSubType = pPDFAnnot->GetSubType();
+ if(cbSubType.Compare("3D") == 0)
+ {
+ FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT);
+ }
+ else if(cbSubType.Compare("Screen") ==0)
+ {
+ CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
+ CFX_ByteString cbString;
+ if(pAnnotDict->KeyExist("IT"))
+ cbString = pAnnotDict->GetString("IT");
+ if(cbString.Compare("Img") != 0)
+ FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_MEDIA);
+ }
+ else if(cbSubType.Compare("Movie") ==0)
+ {
+ FPDF_UnSupportError(FPDF_UNSP_ANNOT_MOVIE);
+ }
+ else if(cbSubType.Compare("Sound") ==0)
+ {
+ FPDF_UnSupportError(FPDF_UNSP_ANNOT_SOUND);
+ }
+ else if(cbSubType.Compare("RichMedia") ==0)
+ {
+ FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA);
+ }
+ else if(cbSubType.Compare("FileAttachment") ==0)
+ {
+ FPDF_UnSupportError(FPDF_UNSP_ANNOT_ATTACHMENT);
+ }
+ else if(cbSubType.Compare("Widget") ==0)
+ {
+ CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
+ CFX_ByteString cbString;
+ if(pAnnotDict->KeyExist("FT"))
+ {
+ cbString = pAnnotDict->GetString("FT");
+ }
+ if(cbString.Compare("Sig") == 0)
+ {
+ FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG);
+ }
+ }
}
FX_BOOL CheckSharedForm(CXML_Element * pElement, CFX_ByteString cbName)
{
- int count = pElement->CountAttrs();
- int i=0;
- for (i = 0; i < count; i++)
- {
- CFX_ByteString space, name;
- CFX_WideString value;
- pElement->GetAttrByIndex(i, space, name, value);
- if (space == FX_BSTRC("xmlns") && name == FX_BSTRC("adhocwf") && value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/")
- {
- CXML_Element *pVersion = pElement->GetElement("adhocwf",cbName);
- if (!pVersion)
- continue;
- CFX_WideString wsContent = pVersion->GetContent(0); // == 1.1
- int nType = wsContent.GetInteger();
- switch(nType)
- {
- case 1:
- FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_ACROBAT);
- break;
- case 2:
- FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM);
- break;
- case 0:
- FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_EMAIL);
- break;
- }
- }
- }
-
- FX_DWORD nCount = pElement->CountChildren();
- for(i=0; i<(int)nCount; i++)
- {
- CXML_Element::ChildType childType = pElement->GetChildType(i);
- if(childType == CXML_Element::Element)
- {
- CXML_Element * pChild = pElement->GetElement(i);
- if(CheckSharedForm(pChild, cbName))
- return TRUE;
- }
- }
- return FALSE;
+ int count = pElement->CountAttrs();
+ int i=0;
+ for (i = 0; i < count; i++)
+ {
+ CFX_ByteString space, name;
+ CFX_WideString value;
+ pElement->GetAttrByIndex(i, space, name, value);
+ if (space == FX_BSTRC("xmlns") && name == FX_BSTRC("adhocwf") && value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/")
+ {
+ CXML_Element *pVersion = pElement->GetElement("adhocwf",cbName);
+ if (!pVersion)
+ continue;
+ CFX_WideString wsContent = pVersion->GetContent(0); // == 1.1
+ int nType = wsContent.GetInteger();
+ switch(nType)
+ {
+ case 1:
+ FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_ACROBAT);
+ break;
+ case 2:
+ FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM);
+ break;
+ case 0:
+ FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_EMAIL);
+ break;
+ }
+ }
+ }
+
+ FX_DWORD nCount = pElement->CountChildren();
+ for(i=0; i<(int)nCount; i++)
+ {
+ CXML_Element::ChildType childType = pElement->GetChildType(i);
+ if(childType == CXML_Element::Element)
+ {
+ CXML_Element * pChild = pElement->GetElement(i);
+ if(CheckSharedForm(pChild, cbName))
+ return TRUE;
+ }
+ }
+ return FALSE;
}
void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code)
{
- // Security
- if(err_code == FPDF_ERR_SECURITY)
- {
- FPDF_UnSupportError(FPDF_UNSP_DOC_SECURITY);
- return ;
- }
- if(!pDoc)
- return ;
-
- // Portfolios and Packages
- CPDF_Dictionary * pRootDict = pDoc->GetRoot();
- if(pRootDict)
- {
- CFX_ByteString cbString;
- if(pRootDict->KeyExist("Collection"))
- {
- FPDF_UnSupportError(FPDF_UNSP_DOC_PORTABLECOLLECTION);
- return ;
- }
- if(pRootDict->KeyExist("Names"))
- {
- CPDF_Dictionary* pNameDict = pRootDict->GetDict("Names");
- if (pNameDict && pNameDict->KeyExist("EmbeddedFiles"))
- {
- FPDF_UnSupportError(FPDF_UNSP_DOC_ATTACHMENT);
- return;
- }
- else if (pNameDict && pNameDict->KeyExist("JavaScript"))
- {
- CPDF_Dictionary* pJSDict = pNameDict->GetDict("JavaScript");
- CPDF_Array * pArray = pJSDict ? pJSDict->GetArray("Names") : NULL;
- if (pArray) {
- int nCount = pArray->GetCount();
- for(int i=0; i<nCount; i++)
- {
- CFX_ByteString cbStr = pArray->GetString(i);
- if(cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0)
- {
- FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW);
- return;
- }
- }
- }
- }
- }
- }
-
- // SharedForm
- CPDF_Metadata metaData;
- metaData.LoadDoc(pDoc);
- CXML_Element * pElement = metaData.GetRoot();
- if(pElement)
- CheckSharedForm(pElement, "workflowType");
-
- // XFA Forms
- CPDF_InterForm * pInterForm = new CPDF_InterForm(pDoc,FALSE);
- if (pInterForm->HasXFAForm())
- {
- FPDF_UnSupportError(FPDF_UNSP_DOC_XFAFORM);
- }
- delete pInterForm;
+ // Security
+ if(err_code == FPDF_ERR_SECURITY)
+ {
+ FPDF_UnSupportError(FPDF_UNSP_DOC_SECURITY);
+ return ;
+ }
+ if(!pDoc)
+ return ;
+
+ // Portfolios and Packages
+ CPDF_Dictionary * pRootDict = pDoc->GetRoot();
+ if(pRootDict)
+ {
+ CFX_ByteString cbString;
+ if(pRootDict->KeyExist("Collection"))
+ {
+ FPDF_UnSupportError(FPDF_UNSP_DOC_PORTABLECOLLECTION);
+ return ;
+ }
+ if(pRootDict->KeyExist("Names"))
+ {
+ CPDF_Dictionary* pNameDict = pRootDict->GetDict("Names");
+ if (pNameDict && pNameDict->KeyExist("EmbeddedFiles"))
+ {
+ FPDF_UnSupportError(FPDF_UNSP_DOC_ATTACHMENT);
+ return;
+ }
+ if (pNameDict && pNameDict->KeyExist("JavaScript"))
+ {
+ CPDF_Dictionary* pJSDict = pNameDict->GetDict("JavaScript");
+ CPDF_Array * pArray = pJSDict ? pJSDict->GetArray("Names") : NULL;
+ if (pArray) {
+ int nCount = pArray->GetCount();
+ for(int i=0; i<nCount; i++)
+ {
+ CFX_ByteString cbStr = pArray->GetString(i);
+ if(cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0)
+ {
+ FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW);
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // SharedForm
+ CPDF_Metadata metaData;
+ metaData.LoadDoc(pDoc);
+ CXML_Element * pElement = metaData.GetRoot();
+ if(pElement)
+ CheckSharedForm(pElement, "workflowType");
+
+ // XFA Forms
+ CPDF_InterForm * pInterForm = new CPDF_InterForm(pDoc,FALSE);
+ if (pInterForm->HasXFAForm())
+ {
+ FPDF_UnSupportError(FPDF_UNSP_DOC_XFAFORM);
+ }
+ delete pInterForm;
}
DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document)