Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: fpdfsdk/fpdfxfa/fpdfxfa_app.cpp

Issue 2031653003: Get rid of NULLs in fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_core
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fpdfview_embeddertest.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" 7 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h"
8 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" 8 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
9 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" 9 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h"
10 #include "fpdfsdk/include/fsdk_define.h" 10 #include "fpdfsdk/include/fsdk_define.h"
11 #include "fpdfsdk/include/fsdk_mgr.h" 11 #include "fpdfsdk/include/fsdk_mgr.h"
12 #include "public/fpdf_formfill.h" 12 #include "public/fpdf_formfill.h"
13 #include "xfa/fxbarcode/include/BC_Library.h" 13 #include "xfa/fxbarcode/include/BC_Library.h"
14 #include "xfa/fxfa/include/xfa_ffapp.h" 14 #include "xfa/fxfa/include/xfa_ffapp.h"
15 #include "xfa/fxfa/include/xfa_fontmgr.h" 15 #include "xfa/fxfa/include/xfa_fontmgr.h"
16 16
17 CPDFXFA_App* CPDFXFA_App::g_pApp = NULL; 17 CPDFXFA_App* CPDFXFA_App::g_pApp = nullptr;
18 18
19 CPDFXFA_App* CPDFXFA_App::GetInstance() { 19 CPDFXFA_App* CPDFXFA_App::GetInstance() {
20 if (!g_pApp) { 20 if (!g_pApp) {
21 g_pApp = new CPDFXFA_App(); 21 g_pApp = new CPDFXFA_App();
22 } 22 }
23 return g_pApp; 23 return g_pApp;
24 } 24 }
25 25
26 void CPDFXFA_App::ReleaseInstance() { 26 void CPDFXFA_App::ReleaseInstance() {
27 delete g_pApp; 27 delete g_pApp;
28 g_pApp = NULL; 28 g_pApp = nullptr;
29 } 29 }
30 30
31 CPDFXFA_App::CPDFXFA_App() 31 CPDFXFA_App::CPDFXFA_App()
32 : m_bJavaScriptInitialized(FALSE), 32 : m_bJavaScriptInitialized(FALSE),
33 m_pXFAApp(NULL), 33 m_pXFAApp(nullptr),
34 m_pIsolate(nullptr), 34 m_pIsolate(nullptr),
35 m_csAppType(JS_STR_VIEWERTYPE_STANDARD) { 35 m_csAppType(JS_STR_VIEWERTYPE_STANDARD) {
36 m_pEnvList.RemoveAll(); 36 m_pEnvList.RemoveAll();
37 } 37 }
38 38
39 CPDFXFA_App::~CPDFXFA_App() { 39 CPDFXFA_App::~CPDFXFA_App() {
40 delete m_pXFAApp; 40 delete m_pXFAApp;
41 m_pXFAApp = NULL; 41 m_pXFAApp = nullptr;
42 42
43 FXJSE_Runtime_Release(m_pIsolate); 43 FXJSE_Runtime_Release(m_pIsolate);
44 m_pIsolate = nullptr; 44 m_pIsolate = nullptr;
45 45
46 FXJSE_Finalize(); 46 FXJSE_Finalize();
47 BC_Library_Destory(); 47 BC_Library_Destory();
48 } 48 }
49 49
50 FX_BOOL CPDFXFA_App::Initialize(v8::Isolate* pIsolate) { 50 FX_BOOL CPDFXFA_App::Initialize(v8::Isolate* pIsolate) {
51 BC_Library_Init(); 51 BC_Library_Init();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 CFX_WideString CPDFXFA_App::Response(const CFX_WideString& wsQuestion, 183 CFX_WideString CPDFXFA_App::Response(const CFX_WideString& wsQuestion,
184 const CFX_WideString& wsTitle, 184 const CFX_WideString& wsTitle,
185 const CFX_WideString& wsDefaultAnswer, 185 const CFX_WideString& wsDefaultAnswer,
186 FX_BOOL bMark) { 186 FX_BOOL bMark) {
187 CFX_WideString wsAnswer; 187 CFX_WideString wsAnswer;
188 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 188 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
189 if (pEnv) { 189 if (pEnv) {
190 int nLength = 2048; 190 int nLength = 2048;
191 char* pBuff = new char[nLength]; 191 char* pBuff = new char[nLength];
192 nLength = pEnv->JS_appResponse(wsQuestion.c_str(), wsTitle.c_str(), 192 nLength = pEnv->JS_appResponse(wsQuestion.c_str(), wsTitle.c_str(),
193 wsDefaultAnswer.c_str(), NULL, bMark, pBuff, 193 wsDefaultAnswer.c_str(), nullptr, bMark,
194 nLength); 194 pBuff, nLength);
195 if (nLength > 0) { 195 if (nLength > 0) {
196 nLength = nLength > 2046 ? 2046 : nLength; 196 nLength = nLength > 2046 ? 2046 : nLength;
197 pBuff[nLength] = 0; 197 pBuff[nLength] = 0;
198 pBuff[nLength + 1] = 0; 198 pBuff[nLength + 1] = 0;
199 wsAnswer = CFX_WideString::FromUTF16LE( 199 wsAnswer = CFX_WideString::FromUTF16LE(
200 reinterpret_cast<const unsigned short*>(pBuff), 200 reinterpret_cast<const unsigned short*>(pBuff),
201 nLength / sizeof(unsigned short)); 201 nLength / sizeof(unsigned short));
202 } 202 }
203 delete[] pBuff; 203 delete[] pBuff;
204 } 204 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 L"The value you entered for %s is invalid. To ignore validations for " 343 L"The value you entered for %s is invalid. To ignore validations for "
344 L"%s, click Ignore."; 344 L"%s, click Ignore.";
345 return; 345 return;
346 case XFA_IDS_ValidateError: 346 case XFA_IDS_ValidateError:
347 wsString = L"The value you entered for %s is invalid."; 347 wsString = L"The value you entered for %s is invalid.";
348 return; 348 return;
349 } 349 }
350 } 350 }
351 351
352 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { 352 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() {
353 CXFA_FWLAdapterTimerMgr* pAdapter = NULL; 353 CXFA_FWLAdapterTimerMgr* pAdapter = nullptr;
354 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 354 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
355 if (pEnv) 355 if (pEnv)
356 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); 356 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv);
357 return pAdapter; 357 return pAdapter;
358 } 358 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfview_embeddertest.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698