summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-22 15:10:28 -0700
committerLei Zhang <thestig@chromium.org>2015-06-22 15:10:28 -0700
commitf55771af6429ecf14beed1cae5ec2340ef7f37ad (patch)
tree96f83002cb0e831e5091920925998bcc9fcea55d /fpdfsdk/src
parentf2d3911ce1a07812d75e7671e038d0922a823528 (diff)
downloadpdfium-f55771af6429ecf14beed1cae5ec2340ef7f37ad.tar.xz
Delete dead code for deleting pages and icons.
1) Document::deletePages() 2) CPDFSDK_Document::DeletePages() 3) Document::removeIcon() 4) IconTree::DeleteIconElement() Originally (1) called (2), but only when FOXIT_CHROME_BUILD was not defined. Since it was always defined for PDFium, this was effectively dead code the whole time. Ditto for (3) and (4). The functions were deemed unsafe in https://crbug.com/67100 R=jam@chromium.org Review URL: https://codereview.chromium.org/1193323002.
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp19
-rw-r--r--fpdfsdk/src/javascript/Document.cpp104
2 files changed, 4 insertions, 119 deletions
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index 003753223f..ad27aeb92f 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -517,25 +517,6 @@ FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag)
return FALSE;
}
-FX_BOOL CPDFSDK_Document::DeletePages(int nStart, int nCount)
-{
- if ( nStart < 0 || nStart >= GetPageCount() || nCount <= 0 )
- {
- return FALSE;
- }
-
- CPDF_Page * pTempPage = NULL;
- for ( int i = nCount-1; i >= 0; i-- )
- {
- pTempPage = GetPage(nStart+i);
- if ( pTempPage != NULL )
- {
- ReMovePageView(pTempPage);
- }
- }
- return TRUE;
-}
-
void CPDFSDK_Document::OnCloseDocument()
{
KillFocusAnnot();
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 7c77e82e06..1d2dca5a3d 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -1420,47 +1420,6 @@ IconElement* IconTree::operator [](int iIndex)
return NULL;
}
-void IconTree::DeleteIconElement(CFX_WideString swIconName)
-{
- IconElement* pTemp = m_pHead;
- int iLoopCount = m_iLength;
- for (int i = 0; i < iLoopCount - 1; i++)
- {
- if (pTemp == m_pEnd)
- break;
-
- if (m_pHead->IconName == swIconName)
- {
- m_pHead = m_pHead->NextIcon;
- delete pTemp;
- m_iLength--;
- pTemp = m_pHead;
- }
- if (pTemp->NextIcon->IconName == swIconName)
- {
- if (pTemp->NextIcon == m_pEnd)
- {
- m_pEnd = pTemp;
- delete pTemp->NextIcon;
- m_iLength--;
- pTemp->NextIcon = NULL;
- }
- else
- {
- IconElement* pElement = pTemp->NextIcon;
- pTemp->NextIcon = pTemp->NextIcon->NextIcon;
- delete pElement;
- m_iLength--;
- pElement = NULL;
- }
-
- continue;
- }
-
- pTemp = pTemp->NextIcon;
- }
-}
-
FX_BOOL Document::addIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
CJS_Context* pContext = (CJS_Context*)cc;
@@ -1581,16 +1540,8 @@ FX_BOOL Document::getIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
FX_BOOL Document::removeIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
- CJS_Context* pContext = (CJS_Context *)cc;
- if (params.size() != 1) {
- sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
- return FALSE;
- }
-
- if(!m_pIconTree)
- return FALSE;
- CFX_WideString swIconName = params[0].ToCFXWideString();
- return TRUE;
+ // Unsafe, no supported.
+ return FALSE;
}
FX_BOOL Document::createDataObject(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
@@ -1854,55 +1805,8 @@ FX_BOOL Document::zoomType(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
FX_BOOL Document::deletePages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
- v8::Isolate* isolate = GetIsolate(cc);
- ASSERT(m_pDocument != NULL);
-
- if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) ||
- m_pDocument->GetPermissions(FPDFPERM_ASSEMBLE))) return FALSE;
-
- int iSize = params.size();
-
- int nStart = 0;
- int nEnd = 0;
-
- if (iSize < 1)
- {
- }
- else if (iSize == 1)
- {
- if (params[0].GetType() == VT_object)
- {
- JSObject pObj = params[0].ToV8Object();
- v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"nStart");
- nStart = CJS_Value(m_isolate, pValue, GET_VALUE_TYPE(pValue)).ToInt();
-
- pValue = JS_GetObjectElement(isolate, pObj, L"nEnd");
- nEnd = CJS_Value(m_isolate, pValue, GET_VALUE_TYPE(pValue)).ToInt();
- }
- else
- {
- nStart = params[0].ToInt();
- }
- }
- else
- {
- nStart = params[0].ToInt();
- nEnd = params[1].ToInt();
- }
-
- int nTotal = m_pDocument->GetPageCount();
-
- if (nStart < 0) nStart = 0;
- if (nStart >= nTotal) nStart = nTotal - 1;
-
- if (nEnd < 0) nEnd = 0;
- if (nEnd >= nTotal) nEnd = nTotal - 1;
-
- if (nEnd < nStart) nEnd = nStart;
-
-
-
- return TRUE;
+ // Unsafe, no supported.
+ return FALSE;
}
FX_BOOL Document::extractPages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)