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

Side by Side Diff: core/src/fxcrt/fx_extension.cpp

Issue 1471323004: Inflict PPDF_ENABLE_XFA ifdefs on XFA core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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
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 "core/include/fxcrt/fx_basic.h" 7 #include "core/include/fxcrt/fx_basic.h"
8 #include "core/include/fxcrt/fx_ext.h" 8 #include "core/include/fxcrt/fx_ext.h"
9 #include "extension.h" 9 #include "extension.h"
10 10
11 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 11 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
12 #include <wincrypt.h> 12 #include <wincrypt.h>
13 #else 13 #else
14 #include <ctime> 14 #include <ctime>
15 #endif 15 #endif
16 16
17 #ifdef PDF_ENABLE_XFA
17 IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) { 18 IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) {
18 if (wsPath.GetLength() == 0) 19 if (wsPath.GetLength() == 0)
19 return NULL; 20 return NULL;
20 21
21 CFX_CRTFileAccess* pFA = NULL; 22 CFX_CRTFileAccess* pFA = NULL;
22 pFA = new CFX_CRTFileAccess; 23 pFA = new CFX_CRTFileAccess;
23 if (NULL == pFA) 24 if (NULL == pFA)
24 return NULL; 25 return NULL;
25 26
26 pFA->Init(wsPath); 27 pFA->Init(wsPath);
27 return pFA; 28 return pFA;
28 } 29 }
30 #endif
29 IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes) { 31 IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes) {
30 IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(); 32 IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create();
31 if (!pFA) { 33 if (!pFA) {
32 return NULL; 34 return NULL;
33 } 35 }
34 if (!pFA->Open(filename, dwModes)) { 36 if (!pFA->Open(filename, dwModes)) {
35 pFA->Release(); 37 pFA->Release();
36 return NULL; 38 return NULL;
37 } 39 }
38 return new CFX_CRTFileStream(pFA); 40 return new CFX_CRTFileStream(pFA);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 return TRUE; 298 return TRUE;
297 } 299 }
298 #endif 300 #endif
299 void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) { 301 void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) {
300 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 302 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
301 FX_GenerateCryptoRandom(pBuffer, iCount); 303 FX_GenerateCryptoRandom(pBuffer, iCount);
302 #else 304 #else
303 FX_Random_GenerateBase(pBuffer, iCount); 305 FX_Random_GenerateBase(pBuffer, iCount);
304 #endif 306 #endif
305 } 307 }
308 #ifdef PDF_ENABLE_XFA
306 309
307 void FX_GUID_CreateV4(FX_LPGUID pGUID) { 310 void FX_GUID_CreateV4(FX_LPGUID pGUID) {
308 #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ 311 #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
309 _FX_OS_ == _FX_WIN64_) 312 _FX_OS_ == _FX_WIN64_)
310 #ifdef _FX_WINAPI_PARTITION_DESKTOP_ 313 #ifdef _FX_WINAPI_PARTITION_DESKTOP_
311 if (!FX_GenerateCryptoRandom((FX_DWORD*)pGUID, 4)) { 314 if (!FX_GenerateCryptoRandom((FX_DWORD*)pGUID, 4)) {
312 FX_Random_GenerateMT((FX_DWORD*)pGUID, 4); 315 FX_Random_GenerateMT((FX_DWORD*)pGUID, 4);
313 } 316 }
314 #else 317 #else
315 FX_Random_GenerateMT((FX_DWORD*)pGUID, 4); 318 FX_Random_GenerateMT((FX_DWORD*)pGUID, 4);
(...skipping 13 matching lines...) Expand all
329 for (int32_t i = 0; i < 16; i++) { 332 for (int32_t i = 0; i < 16; i++) {
330 b = ((const uint8_t*)pGUID)[i]; 333 b = ((const uint8_t*)pGUID)[i];
331 *pBuf++ = gs_FX_pHexChars[b >> 4]; 334 *pBuf++ = gs_FX_pHexChars[b >> 4];
332 *pBuf++ = gs_FX_pHexChars[b & 0x0F]; 335 *pBuf++ = gs_FX_pHexChars[b & 0x0F];
333 if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) { 336 if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) {
334 *pBuf++ = L'-'; 337 *pBuf++ = L'-';
335 } 338 }
336 } 339 }
337 bsStr.ReleaseBuffer(bSeparator ? 36 : 32); 340 bsStr.ReleaseBuffer(bSeparator ? 36 : 32);
338 } 341 }
342 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698