diff options
author | John Abd-El-Malek <jam@chromium.org> | 2014-12-15 12:13:45 -0800 |
---|---|---|
committer | John Abd-El-Malek <jam@chromium.org> | 2014-12-15 12:13:45 -0800 |
commit | 207299b5d46e3e0612dd6a0264fb7647177312bb (patch) | |
tree | 796aeeeab94a2cac2676e3fb359078609c82f809 /fpdfsdk | |
parent | 0d4fdc1bbf2c23999271617413f89f059d4a71c9 (diff) | |
download | pdfium-207299b5d46e3e0612dd6a0264fb7647177312bb.tar.xz |
XFA: merge patch from issue 801913002 and 804463003
Simplify PDFium by removing code that's not used in the open source repo.
-remove parameter from FPDF_InitLibrary
-remove a bunch of ifdefs that are unused
Fix build after previous commit.
TBR=tsepez@chromium.org
BUG=
Review URL: https://codereview.chromium.org/809513002
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/include/fpdfoom.h | 61 | ||||
-rw-r--r-- | fpdfsdk/include/fpdfview.h | 4 | ||||
-rw-r--r-- | fpdfsdk/include/fsdk_define.h | 87 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfeditpage.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfoom.cpp | 27 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfppo.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfview.cpp | 73 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/Document.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/JS_Runtime.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/app.cpp | 20 | ||||
-rw-r--r-- | fpdfsdk/src/jsapi/fxjs_v8.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_FontMap.cpp | 6 |
12 files changed, 33 insertions, 273 deletions
diff --git a/fpdfsdk/include/fpdfoom.h b/fpdfsdk/include/fpdfoom.h deleted file mode 100644 index dd14b74b4f..0000000000 --- a/fpdfsdk/include/fpdfoom.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef _FPDFOOM_H_ -#define _FPDFOOM_H_ - -#ifndef _FPDFVIEW_H_ -#include "fpdfview.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _OOM_INFO -{ - /** - * Version number of the interface. Currently must be 1. - **/ - int version; - - /** - * Method: FSDK_OOM_Handler - * Out-Of-Memory handling function. - * Interface Version: - * 1 - * Implementation Required: - * Yes - * Parameters: - * pThis - Pointer to the interface structure itself. - * Return value: - * None. - * */ - - void(*FSDK_OOM_Handler)(_OOM_INFO* pThis); -}OOM_INFO; - - -/** - * Function: FSDK_SetOOMHandler - * Setup A Out-Of-Memory handler for foxit sdk. - * Parameters: - * oomInfo - Pointer to a OOM_INFO structure. - * Return Value: - * TRUE means successful. FALSE means fails. - **/ - -DLLEXPORT FPDF_BOOL STDCALL FSDK_SetOOMHandler(OOM_INFO* oomInfo); - - -#ifdef __cplusplus -}; -#endif - - - - -#endif diff --git a/fpdfsdk/include/fpdfview.h b/fpdfsdk/include/fpdfview.h index 04a3af928d..34c3f522a4 100644 --- a/fpdfsdk/include/fpdfview.h +++ b/fpdfsdk/include/fpdfview.h @@ -155,13 +155,13 @@ extern "C" { // Function: FPDF_InitLibrary // Initialize the FPDFSDK library // Parameters: -// hInstance - For WIN32 system only: the instance of the executable or DLL module. +// None // Return value: // None. // Comments: // You have to call this function before you can call any PDF processing functions. -DLLEXPORT void STDCALL FPDF_InitLibrary(void* hInstance); +DLLEXPORT void STDCALL FPDF_InitLibrary(); // Function: FPDF_DestroyLibary diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index b95d63eab4..3509e8e2ab 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -12,66 +12,33 @@ #include <math.h> #endif -//#define API5 -#define API6 -#define _FPDFAPI_ASYNC_PARSING_ -#define _FXSDK_OPENSOURCE_ - -#ifdef _FPDFEMB_WCE_ - #include "../../core/include/fpdfapi/fpdfapi.h" - #include "../../core/include/fpdfapi/fpdf_parser.h" - #include "../../core/include/fpdfapi/fpdf_module.h" - #include "../../core/include/fpdfapi/fpdf_render.h" - #include "../../core/include/fpdfapi/fpdf_pageobj.h" - #include "../../core/include/fpdfapi/fpdf_serial.h" - - #include "../../core/include/fpdftext/fpdf_text.h" - - #include "../../core/include/fxge/fx_ge_win32.h" - #include "../../core/include/fxge/fx_ge.h" - - #include "../../core/include/fxcodec/fx_codec.h" - - #include "../../core/include/fpdfdoc/fpdf_doc.h" - #include "../../core/include/fpdfdoc/fpdf_vt.h" - - #include "../../core/include/fxcrt/fx_xml.h" - #include "../../core/include/fxcrt/fx_crypt.h" - -#else - #ifdef API6 - #include "../../core/include/fpdfapi/fpdf_parser.h" - #include "../../core/include/fpdfapi/fpdfapi.h" - #include "../../core/include/fpdfapi/fpdf_parser.h" - #include "../../core/include/fpdfapi/fpdf_module.h" - #include "../../core/include/fpdfapi/fpdf_render.h" - #include "../../core/include/fpdfapi/fpdf_pageobj.h" - #include "../../core/include/fpdfapi/fpdf_serial.h" - - #include "../../core/include/fpdftext/fpdf_text.h" - - #include "../../core/include/fxge/fx_ge_win32.h" - #include "../../core/include/fxge/fx_ge.h" - - #include "../../core/include/fxcodec/fx_codec.h" - - #include "../../core/include/fpdfdoc/fpdf_doc.h" - #include "../../core/include/fpdfdoc/fpdf_vt.h" - - #include "../../core/include/fxcrt/fx_xml.h" - #include "../../xfa/include/fxbarcode/BC_BarCode.h" - #include "../../xfa/include/fxjse/fxjse.h" - #include "../../xfa/include/fxgraphics/fx_graphics.h" - #include "../../xfa/include/fxfa/fxfa.h" - - #include "../../xfa/include/fwl/core/fwl_error.h" - #include "../../xfa/include/fwl/core/fwl_timer.h" - #include "../../xfa/include/fwl/adapter/fwl_adaptertimermgr.h" - #ifdef _LICENSED_BUILD_ - #include "../../cryptopp/Cryptlib.h" - #endif - #endif -#endif +#include "../../core/include/fpdfapi/fpdf_parser.h" +#include "../../core/include/fpdfapi/fpdfapi.h" +#include "../../core/include/fpdfapi/fpdf_parser.h" +#include "../../core/include/fpdfapi/fpdf_module.h" +#include "../../core/include/fpdfapi/fpdf_render.h" +#include "../../core/include/fpdfapi/fpdf_pageobj.h" +#include "../../core/include/fpdfapi/fpdf_serial.h" + +#include "../../core/include/fpdftext/fpdf_text.h" + +#include "../../core/include/fxge/fx_ge_win32.h" +#include "../../core/include/fxge/fx_ge.h" + +#include "../../core/include/fxcodec/fx_codec.h" + +#include "../../core/include/fpdfdoc/fpdf_doc.h" +#include "../../core/include/fpdfdoc/fpdf_vt.h" + +#include "../../core/include/fxcrt/fx_xml.h" +#include "../../xfa/include/fxbarcode/BC_BarCode.h" +#include "../../xfa/include/fxjse/fxjse.h" +#include "../../xfa/include/fxgraphics/fx_graphics.h" +#include "../../xfa/include/fxfa/fxfa.h" + +#include "../../xfa/include/fwl/core/fwl_error.h" +#include "../../xfa/include/fwl/core/fwl_timer.h" +#include "../../xfa/include/fwl/adapter/fwl_adaptertimermgr.h" #ifndef FX_GetAValue diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp index 68dad9dbfe..43d74aad04 100644 --- a/fpdfsdk/src/fpdfeditpage.cpp +++ b/fpdfsdk/src/fpdfeditpage.cpp @@ -4,7 +4,6 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -// #include "x:/pdf/fpdfapi5/include/fpdfapi.h" #include "../include/fsdk_define.h" #include "../include/fpdfedit.h" #include "../include/fpdfformfill.h" @@ -48,11 +47,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() { if(FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr)); -#ifdef FOXIT_CHROME_BUILD - pInfoDict->SetAt("Creator",FX_NEW CPDF_String(L"Google")); -#else - pInfoDict->SetAt("Creator",FX_NEW CPDF_String(L"Foxit PDF SDK DLL 2.0 - Foxit Software")); -#endif + pInfoDict->SetAt("Creator",FX_NEW CPDF_String(L"PDFium")); } CPDFXFA_App* pApp = FPDFXFA_GetApp(); diff --git a/fpdfsdk/src/fpdfoom.cpp b/fpdfsdk/src/fpdfoom.cpp deleted file mode 100644 index 2b202ba2eb..0000000000 --- a/fpdfsdk/src/fpdfoom.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "../include/fsdk_define.h" -#include "../include/fpdfoom.h" - -void OOM_Handler(void* param) -{ - if (!param) return; - ((OOM_INFO*)param)->FSDK_OOM_Handler((OOM_INFO*)param); -} - - -DLLEXPORT FX_BOOL STDCALL FSDK_SetOOMHandler(OOM_INFO* oomInfo) -{ -#ifndef _FXSDK_OPENSOURCE_ - if (!oomInfo || oomInfo->version!=1) - return FALSE; - FXMEM_SetOOMHandler(FXMEM_GetDefaultMgr(),OOM_Handler,oomInfo); - return TRUE; -#else - return TRUE; -#endif -} diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp index ed0c8565c0..b3bc0f144e 100644 --- a/fpdfsdk/src/fpdfppo.cpp +++ b/fpdfsdk/src/fpdfppo.cpp @@ -50,12 +50,7 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document return FALSE; CFX_ByteString producerstr; - -#ifdef FOXIT_CHROME_BUILD - producerstr.Format("Google"); -#else - producerstr.Format("Foxit PDF SDK %s - Foxit Corporation", "2.0"); -#endif + producerstr.Format("PDFium"); DInfoDict->SetAt("Producer", new CPDF_String(producerstr)); //Set type//////////////////////////////////////////////////////////////// diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index ae8f3ccd91..5ff201f170 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -211,40 +211,8 @@ public: CFontMapper* g_pFontMapper = NULL; #endif // #if _FX_OS_ == _FX_LINUX_EMBEDDED_ -DLLEXPORT void STDCALL FPDF_InitLibrary(FX_LPVOID hInstance) +DLLEXPORT void STDCALL FPDF_InitLibrary() { -#ifdef API5 - CPDF_ModuleMgr::Create(); - g_pModuleMgr = CPDF_ModuleMgr::Get(); - #if _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_LINUX_EMBEDDED_ - g_pModuleMgr->InitEmbedded(); - #ifdef _GB1_CMAPS_ - g_pModuleMgr->LoadEmbeddedGB1CMaps(); - #endif - #ifdef _GB1_CMAPS_4_ - g_pModuleMgr->LoadEmbeddedGB1CMaps_4(); - #endif - #ifdef _CNS1_CMAPS_ - g_pModuleMgr->LoadEmbeddedCNS1CMaps(); - #endif - #ifdef _JAPAN1_CMAPS_ - g_pModuleMgr->LoadEmbeddedJapan1CMaps(); - #endif - #ifdef _JAPAN1_CMAPS_6_ - g_pModuleMgr->LoadEmbeddedJapan1CMaps_6(); - #endif - #ifdef _KOREA1_CMAPS_ - g_pModuleMgr->LoadEmbeddedKorea1CMaps(); - #endif - #ifdef _JPX_DECODER_ - g_pModuleMgr->InitJpxModule(); - g_pModuleMgr->InitJbig2Module(); - // g_pModuleMgr->InitIccModule(); - #endif - #else - g_pModuleMgr->InitDesktop(); - #endif -#else g_pCodecModule = CCodec_ModuleMgr::Create(); CFX_GEModule::Create(); @@ -254,42 +222,9 @@ DLLEXPORT void STDCALL FPDF_InitLibrary(FX_LPVOID hInstance) CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule); CPDF_ModuleMgr::Get()->InitPageModule(); CPDF_ModuleMgr::Get()->InitRenderModule(); -#ifdef FOXIT_CHROME_BUILD - CPDF_ModuleMgr * pModuleMgr = CPDF_ModuleMgr::Get(); - if ( pModuleMgr ) - { - pModuleMgr->LoadEmbeddedGB1CMaps(); - pModuleMgr->LoadEmbeddedJapan1CMaps(); - pModuleMgr->LoadEmbeddedCNS1CMaps(); - pModuleMgr->LoadEmbeddedKorea1CMaps(); - } -#endif -#endif CPDFXFA_App* pAppProvider = FPDFXFA_GetApp(); pAppProvider->Initialize(); - -#ifdef _WIN32 - // Get module path - TCHAR app_path[MAX_PATH]; - ::GetModuleFileName((HINSTANCE)hInstance, app_path, MAX_PATH); - size_t len = _tcslen(app_path); - for (size_t i = len; i >= 0; i --) - if (app_path[i] == '\\') { - app_path[i] = 0; - break; - } - -#ifdef _UNICODE - #ifndef _FXSDK_OPENSOURCE_ - CPDF_ModuleMgr::Get()->SetModulePath(NULL, CFX_ByteString::FromUnicode(app_path)); - #endif -#else -#ifndef _FXSDK_OPENSOURCE_ - CPDF_ModuleMgr::Get()->SetModulePath(NULL, app_path); -#endif -#endif -#endif } @@ -307,11 +242,6 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary() CFX_GEModule::Destroy(); g_pCodecModule->Destroy(); #endif -#ifndef _FXSDK_OPENSOURCE_ - FXMEM_CollectAll(FXMEM_GetDefaultMgr()); -#else - -#endif } #ifndef _WIN32 @@ -864,7 +794,6 @@ DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap) void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags,FX_BOOL bNeedToRestore, IFSDK_PAUSE_Adapter * pause ) { -//#ifdef _LICENSED_BUILD_ CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); if (pPage == NULL) return; diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 3bbd3f0115..9ee9639813 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -1763,9 +1763,6 @@ FX_BOOL Document::removeIcon(OBJ_METHOD_PARAMS) if(!m_pIconTree) return FALSE; CFX_WideString swIconName = params[0].operator CFX_WideString(); -#ifndef FOXIT_CHROME_BUILD - m_pIconTree->DeleteIconElement(swIconName); -#endif return TRUE; } @@ -2155,11 +2152,7 @@ FX_BOOL Document::deletePages(OBJ_METHOD_PARAMS) -#ifndef FOXIT_CHROME_BUILD - return m_pDocument->DeletePages(nStart, nEnd - nStart + 1); -#else return TRUE; -#endif } FX_BOOL Document::extractPages(OBJ_METHOD_PARAMS) diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp index 197d7b4e6f..cf06f9aba6 100644 --- a/fpdfsdk/src/javascript/JS_Runtime.cpp +++ b/fpdfsdk/src/javascript/JS_Runtime.cpp @@ -27,11 +27,7 @@ #include "../../include/javascript/global.h" #include "../../include/javascript/console.h" #include "../../include/fpdfxfa/fpdfxfa_app.h" -#ifndef FOXIT_CHROME_BUILD -#include "../../../fxjse/value.h" -#else #include "../../../xfa/src/fxjse/src/value.h" -#endif #include <libplatform/libplatform.h> diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp index 03043e3a4d..602bfaee93 100644 --- a/fpdfsdk/src/javascript/app.cpp +++ b/fpdfsdk/src/javascript/app.cpp @@ -493,23 +493,7 @@ FX_BOOL app::popUpMenuEx(OBJ_METHOD_PARAMS) FX_BOOL app::fs(OBJ_PROP_PARAMS) { -#ifdef FOXIT_CHROME_BUILD return FALSE; -#else - CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); - CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - ASSERT(pRuntime != NULL); - - if (vp.IsGetting()) - { - return TRUE; - } - else - { - return TRUE; - } -#endif } FX_BOOL app::setInterval(OBJ_METHOD_PARAMS) @@ -1043,11 +1027,7 @@ FX_BOOL app::response(OBJ_METHOD_PARAMS) { CFX_WideString swQuestion = L""; CFX_WideString swLabel = L""; -#ifndef FOXIT_CHROME_BUILD - CFX_WideString swTitle = L"Foxit"; -#else CFX_WideString swTitle = L"PDF"; -#endif CFX_WideString swDefault = L""; bool bPassWord = false; diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp index f57465c92a..dcfe4c6663 100644 --- a/fpdfsdk/src/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp @@ -312,9 +312,6 @@ void JS_ReleaseRuntime(IJS_Runtime* pJSRuntime, v8::Persistent<v8::Context>& v8P void JS_Initial() { -//#ifndef FOXIT_CHROME_BUILD -// v8::V8::InitializeICU(); -//#endif } void JS_Release() { diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp index b5f50022f1..10549d583e 100644 --- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp @@ -312,11 +312,7 @@ FX_INT32 CPWL_FontMap::GetPWLFontIndex(FX_WORD word, FX_INT32 nCharset) } */ -#ifdef FOXIT_CHROME_BUILD - CFX_ByteString sAlias = EncodeFontAlias("Arial_Chrome", nCharset); -#else - CFX_ByteString sAlias = EncodeFontAlias("Arial_Foxit", nCharset); -#endif + CFX_ByteString sAlias = EncodeFontAlias("Arial_Chrome", nCharset); AddedFont(pNewFont, sAlias); return AddFontData(pNewFont, sAlias, nCharset); |