From 8779fa8578cf3336ddd4473f833900aba2e595fb Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 12 Oct 2016 12:05:44 -0700 Subject: Cleanup env variable names This CL cleans up any old m_pEnv variables to be correctly named m_pFormFillEnv. Review-Url: https://codereview.chromium.org/2412523002 --- fpdfsdk/fpdfxfa/cpdfxfa_app.cpp | 87 +++++++++++++++-------------- fpdfsdk/fpdfxfa/cpdfxfa_app.h | 6 +- fpdfsdk/fpdfxfa/cpdfxfa_document.cpp | 2 +- fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp | 8 +-- fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h | 5 +- 5 files changed, 55 insertions(+), 53 deletions(-) (limited to 'fpdfsdk/fpdfxfa') diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp index d1a3bd0112..626a07eb29 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp @@ -38,7 +38,7 @@ CPDFXFA_App::CPDFXFA_App() : m_bJavaScriptInitialized(FALSE), m_pIsolate(nullptr), m_csAppType(JS_STR_VIEWERTYPE_STANDARD) { - m_pEnvList.RemoveAll(); + m_pFormFillEnvList.RemoveAll(); } CPDFXFA_App::~CPDFXFA_App() { @@ -64,21 +64,22 @@ FX_BOOL CPDFXFA_App::Initialize(v8::Isolate* pIsolate) { return TRUE; } -FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFSDK_FormFillEnvironment* pEnv) { - if (!pEnv) +FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv) { + if (!pFormFillEnv) return FALSE; - m_pEnvList.Add(pEnv); + m_pFormFillEnvList.Add(pFormFillEnv); return TRUE; } -FX_BOOL CPDFXFA_App::RemoveFormFillEnv(CPDFSDK_FormFillEnvironment* pEnv) { - if (!pEnv) +FX_BOOL CPDFXFA_App::RemoveFormFillEnv( + CPDFSDK_FormFillEnvironment* pFormFillEnv) { + if (!pFormFillEnv) return FALSE; - int nFind = m_pEnvList.Find(pEnv); + int nFind = m_pFormFillEnvList.Find(pFormFillEnv); if (nFind != -1) { - m_pEnvList.RemoveAt(nFind); + m_pFormFillEnvList.RemoveAt(nFind); return TRUE; } @@ -90,10 +91,9 @@ void CPDFXFA_App::GetAppType(CFX_WideString& wsAppType) { } void CPDFXFA_App::GetAppName(CFX_WideString& wsName) { - CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); - if (pEnv) { - wsName = pEnv->FFI_GetAppName(); - } + CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); + if (pFormFillEnv) + wsName = pFormFillEnv->FFI_GetAppName(); } void CPDFXFA_App::SetAppType(const CFX_WideStringC& wsAppType) { @@ -101,15 +101,15 @@ void CPDFXFA_App::SetAppType(const CFX_WideStringC& wsAppType) { } void CPDFXFA_App::GetLanguage(CFX_WideString& wsLanguage) { - CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); - if (pEnv) - wsLanguage = pEnv->GetLanguage(); + CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); + if (pFormFillEnv) + wsLanguage = pFormFillEnv->GetLanguage(); } void CPDFXFA_App::GetPlatform(CFX_WideString& wsPlatform) { - CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); - if (pEnv) { - wsPlatform = pEnv->GetPlatform(); + CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); + if (pFormFillEnv) { + wsPlatform = pFormFillEnv->GetPlatform(); } } @@ -122,9 +122,9 @@ void CPDFXFA_App::GetVersion(CFX_WideString& wsVersion) { } void CPDFXFA_App::Beep(uint32_t dwType) { - CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); - if (pEnv) { - pEnv->JS_appBeep(dwType); + CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); + if (pFormFillEnv) { + pFormFillEnv->JS_appBeep(dwType); } } @@ -132,8 +132,8 @@ int32_t CPDFXFA_App::MsgBox(const CFX_WideString& wsMessage, const CFX_WideString& wsTitle, uint32_t dwIconType, uint32_t dwButtonType) { - CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); - if (!pEnv) + CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); + if (!pFormFillEnv) return -1; uint32_t iconType = 0; @@ -166,8 +166,8 @@ int32_t CPDFXFA_App::MsgBox(const CFX_WideString& wsMessage, iButtonType |= 3; break; } - int32_t iRet = pEnv->JS_appAlert(wsMessage.c_str(), wsTitle.c_str(), - iButtonType, iconType); + int32_t iRet = pFormFillEnv->JS_appAlert(wsMessage.c_str(), wsTitle.c_str(), + iButtonType, iconType); switch (iRet) { case 1: return XFA_IDOK; @@ -186,13 +186,13 @@ CFX_WideString CPDFXFA_App::Response(const CFX_WideString& wsQuestion, const CFX_WideString& wsDefaultAnswer, FX_BOOL bMark) { CFX_WideString wsAnswer; - CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); - if (pEnv) { + CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); + if (pFormFillEnv) { int nLength = 2048; char* pBuff = new char[nLength]; - nLength = pEnv->JS_appResponse(wsQuestion.c_str(), wsTitle.c_str(), - wsDefaultAnswer.c_str(), nullptr, bMark, - pBuff, nLength); + nLength = pFormFillEnv->JS_appResponse(wsQuestion.c_str(), wsTitle.c_str(), + wsDefaultAnswer.c_str(), nullptr, + bMark, pBuff, nLength); if (nLength > 0) { nLength = nLength > 2046 ? 2046 : nLength; pBuff[nLength] = 0; @@ -207,8 +207,8 @@ CFX_WideString CPDFXFA_App::Response(const CFX_WideString& wsQuestion, } IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideString& wsURL) { - CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); - return pEnv ? pEnv->DownloadFromURL(wsURL.c_str()) : nullptr; + CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); + return pFormFillEnv ? pFormFillEnv->DownloadFromURL(wsURL.c_str()) : nullptr; } FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideString& wsURL, @@ -217,22 +217,23 @@ FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideString& wsURL, const CFX_WideString& wsEncode, const CFX_WideString& wsHeader, CFX_WideString& wsResponse) { - CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); - if (!pEnv) + CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); + if (!pFormFillEnv) return FALSE; - wsResponse = - pEnv->PostRequestURL(wsURL.c_str(), wsData.c_str(), wsContentType.c_str(), - wsEncode.c_str(), wsHeader.c_str()); + wsResponse = pFormFillEnv->PostRequestURL(wsURL.c_str(), wsData.c_str(), + wsContentType.c_str(), + wsEncode.c_str(), wsHeader.c_str()); return TRUE; } FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideString& wsURL, const CFX_WideString& wsData, const CFX_WideString& wsEncode) { - CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); - return pEnv && - pEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(), wsEncode.c_str()); + CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); + return pFormFillEnv && + pFormFillEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(), + wsEncode.c_str()); } void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) { @@ -334,8 +335,8 @@ void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) { IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { CXFA_FWLAdapterTimerMgr* pAdapter = nullptr; - CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); - if (pEnv) - pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); + CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); + if (pFormFillEnv) + pAdapter = new CXFA_FWLAdapterTimerMgr(pFormFillEnv); return pAdapter; } diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_app.h b/fpdfsdk/fpdfxfa/cpdfxfa_app.h index 3d5256381c..6deaeacff0 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_app.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_app.h @@ -23,8 +23,8 @@ class CPDFXFA_App : public IXFA_AppProvider { FX_BOOL Initialize(v8::Isolate* pIsolate); CXFA_FFApp* GetXFAApp() { return m_pXFAApp.get(); } - FX_BOOL AddFormFillEnv(CPDFSDK_FormFillEnvironment* pEnv); - FX_BOOL RemoveFormFillEnv(CPDFSDK_FormFillEnvironment* pEnv); + FX_BOOL AddFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv); + FX_BOOL RemoveFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv); FX_BOOL IsJavaScriptInitialized() const { return m_bJavaScriptInitialized; } void SetJavaScriptInitialized(FX_BOOL bInitialized) { @@ -67,7 +67,7 @@ class CPDFXFA_App : public IXFA_AppProvider { void LoadString(int32_t iStringID, CFX_WideString& wsString) override; IFWL_AdapterTimerMgr* GetTimerMgr() override; - CFX_ArrayTemplate m_pEnvList; + CFX_ArrayTemplate m_pFormFillEnvList; protected: FX_BOOL m_bJavaScriptInitialized; diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp index c768b591ba..df0da31beb 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp @@ -44,7 +44,7 @@ CPDFXFA_Document::~CPDFXFA_Document() { if (m_pFormFillEnv) { m_pFormFillEnv->ClearAllFocusedAnnots(); - // Once we're deleted the SDKDocument will point at a bad underlying + // Once we're deleted the FormFillEnvironment will point at a bad underlying // doc so we need to reset it ... m_pFormFillEnv->ResetXFADocument(); m_pFormFillEnv = nullptr; diff --git a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp index 8d9356990b..4c390ae917 100644 --- a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp +++ b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp @@ -17,10 +17,10 @@ FWL_Error CXFA_FWLAdapterTimerMgr::Start(IFWL_Timer* pTimer, uint32_t dwElapse, bool bImmediately, IFWL_TimerInfo** pTimerInfo) { - if (!m_pEnv) + if (!m_pFormFillEnv) return FWL_Error::Indefinite; - int32_t id_event = m_pEnv->SetTimer(dwElapse, TimerProc); + int32_t id_event = m_pFormFillEnv->SetTimer(dwElapse, TimerProc); if (!s_TimerArray) s_TimerArray = new std::vector; @@ -30,11 +30,11 @@ FWL_Error CXFA_FWLAdapterTimerMgr::Start(IFWL_Timer* pTimer, } FWL_Error CXFA_FWLAdapterTimerMgr::Stop(IFWL_TimerInfo* pTimerInfo) { - if (!pTimerInfo || !m_pEnv) + if (!pTimerInfo || !m_pFormFillEnv) return FWL_Error::Indefinite; CFWL_TimerInfo* pInfo = static_cast(pTimerInfo); - m_pEnv->KillTimer(pInfo->idEvent); + m_pFormFillEnv->KillTimer(pInfo->idEvent); if (s_TimerArray) { auto it = std::find(s_TimerArray->begin(), s_TimerArray->end(), pInfo); if (it != s_TimerArray->end()) { diff --git a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h index 5c046b5bdd..5f5017b5d8 100644 --- a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h +++ b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h @@ -21,7 +21,8 @@ struct CFWL_TimerInfo; class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr { public: - CXFA_FWLAdapterTimerMgr(CPDFSDK_FormFillEnvironment* pEnv) : m_pEnv(pEnv) {} + CXFA_FWLAdapterTimerMgr(CPDFSDK_FormFillEnvironment* pFormFillEnv) + : m_pFormFillEnv(pFormFillEnv) {} FWL_Error Start(IFWL_Timer* pTimer, uint32_t dwElapse, @@ -33,7 +34,7 @@ class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr { static void TimerProc(int32_t idEvent); static std::vector* s_TimerArray; - CPDFSDK_FormFillEnvironment* const m_pEnv; + CPDFSDK_FormFillEnvironment* const m_pFormFillEnv; }; struct CFWL_TimerInfo : public IFWL_TimerInfo { -- cgit v1.2.3