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

Unified Diff: core/src/fxcrt/fx_extension.cpp

Issue 1398383002: core/ difference with XFA (for information only). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 2015-11-24 version Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxcrt/fx_basic_buffer.cpp ('k') | core/src/fxcrt/fx_unicode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcrt/fx_extension.cpp
diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp
index 37437ae9ed587e91c6d7e3b193d197f216c9b898..c796a57102c0f5d96599e234bcdfff31202c43d3 100644
--- a/core/src/fxcrt/fx_extension.cpp
+++ b/core/src/fxcrt/fx_extension.cpp
@@ -14,6 +14,20 @@
#include <ctime>
#endif
+#ifdef PDF_ENABLE_XFA
+IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) {
+ if (wsPath.GetLength() == 0)
+ return NULL;
+
+ CFX_CRTFileAccess* pFA = NULL;
+ pFA = new CFX_CRTFileAccess;
+ if (NULL == pFA)
+ return NULL;
+
+ pFA->Init(wsPath);
+ return pFA;
+}
+#endif
IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes) {
IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create();
if (!pFA) {
@@ -291,3 +305,38 @@ void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) {
FX_Random_GenerateBase(pBuffer, iCount);
#endif
}
+#ifdef PDF_ENABLE_XFA
+
+void FX_GUID_CreateV4(FX_LPGUID pGUID) {
+#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
+ _FX_OS_ == _FX_WIN64_)
+#ifdef _FX_WINAPI_PARTITION_DESKTOP_
+ if (!FX_GenerateCryptoRandom((FX_DWORD*)pGUID, 4)) {
+ FX_Random_GenerateMT((FX_DWORD*)pGUID, 4);
+ }
+#else
+ FX_Random_GenerateMT((FX_DWORD*)pGUID, 4);
+#endif
+#else
+ FX_Random_GenerateMT((FX_DWORD*)pGUID, 4);
+#endif
+ uint8_t& b = ((uint8_t*)pGUID)[6];
+ b = (b & 0x0F) | 0x40;
+}
+const FX_CHAR* gs_FX_pHexChars = "0123456789ABCDEF";
+void FX_GUID_ToString(FX_LPCGUID pGUID,
+ CFX_ByteString& bsStr,
+ FX_BOOL bSeparator) {
+ FX_CHAR* pBuf = bsStr.GetBuffer(40);
+ uint8_t b;
+ for (int32_t i = 0; i < 16; i++) {
+ b = ((const uint8_t*)pGUID)[i];
+ *pBuf++ = gs_FX_pHexChars[b >> 4];
+ *pBuf++ = gs_FX_pHexChars[b & 0x0F];
+ if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) {
+ *pBuf++ = L'-';
+ }
+ }
+ bsStr.ReleaseBuffer(bSeparator ? 36 : 32);
+}
+#endif
« no previous file with comments | « core/src/fxcrt/fx_basic_buffer.cpp ('k') | core/src/fxcrt/fx_unicode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698