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

Side by Side Diff: fpdfsdk/include/fsdk_mgr.h

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/include/fsdk_baseform.h ('k') | fpdfsdk/javascript/Document.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 #ifndef FPDFSDK_INCLUDE_FSDK_MGR_H_ 7 #ifndef FPDFSDK_INCLUDE_FSDK_MGR_H_
8 #define FPDFSDK_INCLUDE_FSDK_MGR_H_ 8 #define FPDFSDK_INCLUDE_FSDK_MGR_H_
9 9
10 #include <map> 10 #include <map>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return (nFlag & FWL_EVENTFLAG_ControlKey) != 0; 104 return (nFlag & FWL_EVENTFLAG_ControlKey) != 0;
105 } 105 }
106 106
107 FX_BOOL FFI_IsALTKeyDown(uint32_t nFlag) const { 107 FX_BOOL FFI_IsALTKeyDown(uint32_t nFlag) const {
108 return (nFlag & FWL_EVENTFLAG_AltKey) != 0; 108 return (nFlag & FWL_EVENTFLAG_AltKey) != 0;
109 } 109 }
110 110
111 FPDF_PAGE FFI_GetPage(FPDF_DOCUMENT document, int nPageIndex) { 111 FPDF_PAGE FFI_GetPage(FPDF_DOCUMENT document, int nPageIndex) {
112 if (m_pInfo && m_pInfo->FFI_GetPage) 112 if (m_pInfo && m_pInfo->FFI_GetPage)
113 return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex); 113 return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex);
114 return NULL; 114 return nullptr;
115 } 115 }
116 116
117 FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document) { 117 FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document) {
118 if (m_pInfo && m_pInfo->FFI_GetCurrentPage) 118 if (m_pInfo && m_pInfo->FFI_GetCurrentPage)
119 return m_pInfo->FFI_GetCurrentPage(m_pInfo, document); 119 return m_pInfo->FFI_GetCurrentPage(m_pInfo, document);
120 return NULL; 120 return nullptr;
121 } 121 }
122 122
123 int FFI_GetRotation(FPDF_PAGE page) { 123 int FFI_GetRotation(FPDF_PAGE page) {
124 if (m_pInfo && m_pInfo->FFI_GetRotation) 124 if (m_pInfo && m_pInfo->FFI_GetRotation)
125 return m_pInfo->FFI_GetRotation(m_pInfo, page); 125 return m_pInfo->FFI_GetRotation(m_pInfo, page);
126 return 0; 126 return 0;
127 } 127 }
128 128
129 void FFI_ExecuteNamedAction(const FX_CHAR* namedAction) { 129 void FFI_ExecuteNamedAction(const FX_CHAR* namedAction) {
130 if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction) 130 if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 void FFI_SetCurrentPage(FPDF_DOCUMENT document, int iCurPage) { 175 void FFI_SetCurrentPage(FPDF_DOCUMENT document, int iCurPage) {
176 if (m_pInfo && m_pInfo->FFI_SetCurrentPage) 176 if (m_pInfo && m_pInfo->FFI_SetCurrentPage)
177 m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage); 177 m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage);
178 } 178 }
179 179
180 CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); } 180 CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); }
181 181
182 CFX_WideString FFI_GetPlatform() { 182 CFX_WideString FFI_GetPlatform() {
183 if (m_pInfo && m_pInfo->FFI_GetPlatform) { 183 if (m_pInfo && m_pInfo->FFI_GetPlatform) {
184 int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, NULL, 0); 184 int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, nullptr, 0);
185 if (nRequiredLen <= 0) 185 if (nRequiredLen <= 0)
186 return L""; 186 return L"";
187 187
188 char* pbuff = new char[nRequiredLen]; 188 char* pbuff = new char[nRequiredLen];
189 memset(pbuff, 0, nRequiredLen); 189 memset(pbuff, 0, nRequiredLen);
190 int nActualLen = m_pInfo->FFI_GetPlatform(m_pInfo, pbuff, nRequiredLen); 190 int nActualLen = m_pInfo->FFI_GetPlatform(m_pInfo, pbuff, nRequiredLen);
191 if (nActualLen <= 0 || nActualLen > nRequiredLen) { 191 if (nActualLen <= 0 || nActualLen > nRequiredLen) {
192 delete[] pbuff; 192 delete[] pbuff;
193 return L""; 193 return L"";
194 } 194 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 FPDF_WIDESTRING uploadTo) { 268 FPDF_WIDESTRING uploadTo) {
269 if (m_pInfo && m_pInfo->FFI_UploadTo) 269 if (m_pInfo && m_pInfo->FFI_UploadTo)
270 m_pInfo->FFI_UploadTo(m_pInfo, fileHandler, fileFlag, uploadTo); 270 m_pInfo->FFI_UploadTo(m_pInfo, fileHandler, fileFlag, uploadTo);
271 } 271 }
272 272
273 FPDF_FILEHANDLER* FFI_OpenFile(int fileType, 273 FPDF_FILEHANDLER* FFI_OpenFile(int fileType,
274 FPDF_WIDESTRING wsURL, 274 FPDF_WIDESTRING wsURL,
275 const char* mode) { 275 const char* mode) {
276 if (m_pInfo && m_pInfo->FFI_OpenFile) 276 if (m_pInfo && m_pInfo->FFI_OpenFile)
277 return m_pInfo->FFI_OpenFile(m_pInfo, fileType, wsURL, mode); 277 return m_pInfo->FFI_OpenFile(m_pInfo, fileType, wsURL, mode);
278 return NULL; 278 return nullptr;
279 } 279 }
280 280
281 CFX_WideString FFI_GetFilePath(FPDF_FILEHANDLER* pFileHandler) const { 281 CFX_WideString FFI_GetFilePath(FPDF_FILEHANDLER* pFileHandler) const {
282 return L""; 282 return L"";
283 } 283 }
284 284
285 int FFI_GetDocumentCount() const { return 0; } 285 int FFI_GetDocumentCount() const { return 0; }
286 int FFI_GetCurDocument() const { return 0; } 286 int FFI_GetCurDocument() const { return 0; }
287 287
288 IFX_FileRead* FFI_DownloadFromURL(const FX_WCHAR* url) { 288 IFX_FileRead* FFI_DownloadFromURL(const FX_WCHAR* url) {
289 if (m_pInfo && m_pInfo->FFI_DownloadFromURL) { 289 if (m_pInfo && m_pInfo->FFI_DownloadFromURL) {
290 CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode(); 290 CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode();
291 FPDF_WIDESTRING wsURL = 291 FPDF_WIDESTRING wsURL =
292 (FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength()); 292 (FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength());
293 293
294 FPDF_LPFILEHANDLER fileHandler = 294 FPDF_LPFILEHANDLER fileHandler =
295 m_pInfo->FFI_DownloadFromURL(m_pInfo, wsURL); 295 m_pInfo->FFI_DownloadFromURL(m_pInfo, wsURL);
296 296
297 return new CFPDF_FileStream(fileHandler); 297 return new CFPDF_FileStream(fileHandler);
298 } 298 }
299 return NULL; 299 return nullptr;
300 } 300 }
301 301
302 CFX_WideString FFI_PostRequestURL(const FX_WCHAR* wsURL, 302 CFX_WideString FFI_PostRequestURL(const FX_WCHAR* wsURL,
303 const FX_WCHAR* wsData, 303 const FX_WCHAR* wsData,
304 const FX_WCHAR* wsContentType, 304 const FX_WCHAR* wsContentType,
305 const FX_WCHAR* wsEncode, 305 const FX_WCHAR* wsEncode,
306 const FX_WCHAR* wsHeader) { 306 const FX_WCHAR* wsHeader) {
307 if (m_pInfo && m_pInfo->FFI_PostRequestURL) { 307 if (m_pInfo && m_pInfo->FFI_PostRequestURL) {
308 CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode(); 308 CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode();
309 FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength()); 309 FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 FPDF_WIDESTRING encode = 354 FPDF_WIDESTRING encode =
355 (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength()); 355 (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength());
356 356
357 return m_pInfo->FFI_PutRequestURL(m_pInfo, URL, data, encode); 357 return m_pInfo->FFI_PutRequestURL(m_pInfo, URL, data, encode);
358 } 358 }
359 return FALSE; 359 return FALSE;
360 } 360 }
361 361
362 CFX_WideString FFI_GetLanguage() { 362 CFX_WideString FFI_GetLanguage() {
363 if (m_pInfo && m_pInfo->FFI_GetLanguage) { 363 if (m_pInfo && m_pInfo->FFI_GetLanguage) {
364 int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, NULL, 0); 364 int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, nullptr, 0);
365 if (nRequiredLen <= 0) 365 if (nRequiredLen <= 0)
366 return L""; 366 return L"";
367 367
368 char* pbuff = new char[nRequiredLen]; 368 char* pbuff = new char[nRequiredLen];
369 memset(pbuff, 0, nRequiredLen); 369 memset(pbuff, 0, nRequiredLen);
370 int nActualLen = m_pInfo->FFI_GetLanguage(m_pInfo, pbuff, nRequiredLen); 370 int nActualLen = m_pInfo->FFI_GetLanguage(m_pInfo, pbuff, nRequiredLen);
371 if (nActualLen <= 0 || nActualLen > nRequiredLen) { 371 if (nActualLen <= 0 || nActualLen > nRequiredLen) {
372 delete[] pbuff; 372 delete[] pbuff;
373 return L""; 373 return L"";
374 } 374 }
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 FX_BOOL m_bTakeOverPage; 631 FX_BOOL m_bTakeOverPage;
632 #endif // PDF_ENABLE_XFA 632 #endif // PDF_ENABLE_XFA
633 FX_BOOL m_bEnterWidget; 633 FX_BOOL m_bEnterWidget;
634 FX_BOOL m_bExitWidget; 634 FX_BOOL m_bExitWidget;
635 FX_BOOL m_bOnWidget; 635 FX_BOOL m_bOnWidget;
636 FX_BOOL m_bValid; 636 FX_BOOL m_bValid;
637 FX_BOOL m_bLocked; 637 FX_BOOL m_bLocked;
638 }; 638 };
639 639
640 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_ 640 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_
OLDNEW
« no previous file with comments | « fpdfsdk/include/fsdk_baseform.h ('k') | fpdfsdk/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698