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

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: After bidi Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: core/src/fxcrt/fx_extension.cpp
diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp
index d64a06d08b7fcc2dfc6f070037e73f76bb1aa7b4..fad63082771b58e49fcc2c1f375bd4a7a5a91c63 100644
--- a/core/src/fxcrt/fx_extension.cpp
+++ b/core/src/fxcrt/fx_extension.cpp
@@ -13,6 +13,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) {
@@ -300,3 +314,43 @@ void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) {
#ifdef __cplusplus
}
#endif
+#ifdef PDF_ENABLE_XFA
+#ifdef __cplusplus
+extern "C" {
+#endif
+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);
+}
+#ifdef __cplusplus
+}
+#endif
+#endif

Powered by Google App Engine
This is Rietveld 408576698