summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/src/formfiller/FFL_IFormFiller.cpp27
-rw-r--r--fpdfsdk/src/fpdf_transformpage.cpp33
-rw-r--r--fpdfsdk/src/fpdfdoc.cpp2
-rw-r--r--fpdfsdk/src/fpdfeditimg.cpp4
-rw-r--r--fpdfsdk/src/fpdfeditpage.cpp2
-rw-r--r--fpdfsdk/src/fpdfformfill.cpp6
-rw-r--r--fpdfsdk/src/fpdfview.cpp1
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp1
8 files changed, 34 insertions, 42 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
index 69ff93280e..ce0a67f4fe 100644
--- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
@@ -509,23 +509,15 @@ FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) {
}
FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) {
- ASSERT(pWidget != NULL);
-
if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
return TRUE;
- else {
- CPDF_Page* pPage = pWidget->GetPDFPage();
- ASSERT(pPage != NULL);
-
- CPDF_Document* pDocument = pPage->m_pDocument;
- ASSERT(pDocument != NULL);
- FX_DWORD dwPermissions = pDocument->GetUserPermissions();
- return (dwPermissions & FPDFPERM_FILL_FORM) ||
- (dwPermissions & FPDFPERM_ANNOT_FORM) ||
- (dwPermissions & FPDFPERM_MODIFY);
- }
- return TRUE;
+ CPDF_Page* pPage = pWidget->GetPDFPage();
+ CPDF_Document* pDocument = pPage->m_pDocument;
+ FX_DWORD dwPermissions = pDocument->GetUserPermissions();
+ return (dwPermissions & FPDFPERM_FILL_FORM) ||
+ (dwPermissions & FPDFPERM_ANNOT_FORM) ||
+ (dwPermissions & FPDFPERM_MODIFY);
}
CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot,
@@ -802,13 +794,10 @@ void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget,
FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) {
- ASSERT(pPageView != NULL);
- ASSERT(pAnnot != NULL);
-
if (pPageView)
return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot());
- else
- return FALSE;
+
+ return FALSE;
}
void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList,
diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp
index 614c7a48fe..d0dee59d0d 100644
--- a/fpdfsdk/src/fpdf_transformpage.cpp
+++ b/fpdfsdk/src/fpdf_transformpage.cpp
@@ -9,6 +9,10 @@
namespace {
+CPDF_Page* GetPageFromFPDFPage(FPDF_PAGE page) {
+ return static_cast<CPDF_Page*>(page);
+}
+
void SetBoundingBox(CPDF_Page* page,
const CFX_ByteStringC& key,
float left,
@@ -49,11 +53,11 @@ DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page,
float bottom,
float right,
float top) {
- if (!page)
+ CPDF_Page* pPage = GetPageFromFPDFPage(page);
+ if (!pPage)
return;
- SetBoundingBox(static_cast<CPDF_Page*>(page), "MediaBox", left, bottom, right,
- top);
+ SetBoundingBox(pPage, "MediaBox", left, bottom, right, top);
}
DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page,
@@ -61,11 +65,11 @@ DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page,
float bottom,
float right,
float top) {
- if (!page)
+ CPDF_Page* pPage = GetPageFromFPDFPage(page);
+ if (!pPage)
return;
- SetBoundingBox(static_cast<CPDF_Page*>(page), "CropBox", left, bottom, right,
- top);
+ SetBoundingBox(pPage, "CropBox", left, bottom, right, top);
}
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page,
@@ -73,8 +77,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page,
float* bottom,
float* right,
float* top) {
- return page && GetBoundingBox(static_cast<CPDF_Page*>(page), "MediaBox", left,
- bottom, right, top);
+ CPDF_Page* pPage = GetPageFromFPDFPage(page);
+ return pPage && GetBoundingBox(pPage, "MediaBox", left, bottom, right, top);
}
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page,
@@ -82,14 +86,15 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page,
float* bottom,
float* right,
float* top) {
- return page && GetBoundingBox(static_cast<CPDF_Page*>(page), "CropBox", left,
- bottom, right, top);
+ CPDF_Page* pPage = GetPageFromFPDFPage(page);
+ return pPage && GetBoundingBox(pPage, "CropBox", left, bottom, right, top);
}
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
FS_MATRIX* matrix,
FS_RECTF* clipRect) {
- if (!page)
+ CPDF_Page* pPage = GetPageFromFPDFPage(page);
+ if (!pPage)
return FALSE;
CFX_ByteTextBuf textBuf;
@@ -107,7 +112,6 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
matrix->d, matrix->e, matrix->f);
textBuf << bsMatix;
- CPDF_Page* pPage = (CPDF_Page*)page;
CPDF_Dictionary* pPageDic = pPage->m_pFormDict;
CPDF_Object* pContentObj = pPageDic ? pPageDic->GetElement("Contents") : NULL;
if (!pContentObj)
@@ -263,9 +267,10 @@ void OutputPath(CFX_ByteTextBuf& buf, CPDF_Path path) {
DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,
FPDF_CLIPPATH clipPath) {
- if (!page)
+ CPDF_Page* pPage = GetPageFromFPDFPage(page);
+ if (!pPage)
return;
- CPDF_Page* pPage = (CPDF_Page*)page;
+
CPDF_Dictionary* pPageDic = pPage->m_pFormDict;
CPDF_Object* pContentObj = pPageDic ? pPageDic->GetElement("Contents") : NULL;
if (!pContentObj)
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp
index 97f5cf3c6d..4e2e7f3d0b 100644
--- a/fpdfsdk/src/fpdfdoc.cpp
+++ b/fpdfsdk/src/fpdfdoc.cpp
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "../include/fsdk_define.h"
#include "../../public/fpdf_doc.h"
+#include "../include/fsdk_define.h"
namespace {
diff --git a/fpdfsdk/src/fpdfeditimg.cpp b/fpdfsdk/src/fpdfeditimg.cpp
index 3b5272cace..bb710789cc 100644
--- a/fpdfsdk/src/fpdfeditimg.cpp
+++ b/fpdfsdk/src/fpdfeditimg.cpp
@@ -22,7 +22,7 @@ FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages,
int nCount,
FPDF_PAGEOBJECT image_object,
FPDF_FILEACCESS* fileAccess) {
- if (!image_object || !fileAccess)
+ if (!image_object || !fileAccess || !pages)
return FALSE;
IFX_FileRead* pFile = new CPDF_CustomAccess(fileAccess);
@@ -61,7 +61,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,
int nCount,
FPDF_PAGEOBJECT image_object,
FPDF_BITMAP bitmap) {
- if (!image_object || !bitmap)
+ if (!image_object || !bitmap || !pages)
return FALSE;
CFX_DIBitmap* pBmp = NULL;
pBmp = (CFX_DIBitmap*)bitmap;
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp
index 0219c9ca7e..8796d0e2b1 100644
--- a/fpdfsdk/src/fpdfeditpage.cpp
+++ b/fpdfsdk/src/fpdfeditpage.cpp
@@ -5,6 +5,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../public/fpdf_edit.h"
+#include "../../public/fpdf_formfill.h"
#include "../include/fsdk_define.h"
#if _FX_OS_ == _FX_ANDROID_
@@ -274,6 +275,7 @@ DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object;
if (pPageObj == NULL)
return;
+
CFX_AffineMatrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
(FX_FLOAT)e, (FX_FLOAT)f);
pPageObj->Transform(matrix);
diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp
index 272e781cc2..cca4834f54 100644
--- a/fpdfsdk/src/fpdfformfill.cpp
+++ b/fpdfsdk/src/fpdfformfill.cpp
@@ -322,14 +322,8 @@ DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page,
CPDFSDK_PageView* pPageView = pSDKDoc->GetPageView(pPage, FALSE);
if (pPageView) {
CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv();
- ASSERT(pEnv != NULL);
-
CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander();
- ASSERT(pActionHandler != NULL);
-
CPDF_Dictionary* pPageDict = pPage->m_pFormDict;
- ASSERT(pPageDict != NULL);
-
CPDF_AAction aa = pPageDict->GetDict(FX_BSTRC("AA"));
FX_BOOL bExistOAAction = FALSE;
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index b050e033cd..dfa91d1243 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -121,6 +121,7 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary() {
#endif
CPDF_ModuleMgr::Destroy();
CFX_GEModule::Destroy();
+
delete g_pCodecModule;
g_pCodecModule = nullptr;
}
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index 33e56de00d..b7962d57f7 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -223,6 +223,7 @@ CPDFDoc_Environment::~CPDFDoc_Environment() {
delete m_pAnnotHandlerMgr;
m_pAnnotHandlerMgr = NULL;
+
delete m_pActionHandler;
m_pActionHandler = NULL;
}