From 698aed79d6ad6e8e3a0c7a500c108d69f944b82d Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 26 Sep 2017 16:24:49 -0400 Subject: Cleanup FX macros This CL renames the FX_OS defines to have _OS_ in their names and drops the _DESKTOP suffix. The FXM defines have been changed to just FX. Change-Id: Iab172fba541713b5f6d14fb8098baf68e3364c74 Reviewed-on: https://pdfium-review.googlesource.com/14833 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fxcrt/fx_random.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'core/fxcrt/fx_random.cpp') diff --git a/core/fxcrt/fx_random.cpp b/core/fxcrt/fx_random.cpp index 483a56bbf4..56f84d59b3 100644 --- a/core/fxcrt/fx_random.cpp +++ b/core/fxcrt/fx_random.cpp @@ -16,12 +16,12 @@ #define MT_Upper_Mask 0x80000000 #define MT_Lower_Mask 0x7fffffff -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ #include -#else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ #include #include -#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ namespace { @@ -33,7 +33,7 @@ struct MTContext { bool g_bHaveGlobalSeed = false; uint32_t g_nGlobalSeed = 0; -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ bool GenerateSeedFromCryptoRandom(uint32_t* pSeed) { HCRYPTPROV hCP = 0; if (!::CryptAcquireContext(&hCP, nullptr, nullptr, PROV_RSA_FULL, 0) || @@ -50,30 +50,30 @@ uint32_t GenerateSeedFromEnvironment() { char c; uintptr_t p = reinterpret_cast(&c); uint32_t seed = ~static_cast(p >> 3); -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ SYSTEMTIME st; GetSystemTime(&st); seed ^= static_cast(st.wSecond) * 1000000; seed ^= static_cast(st.wMilliseconds) * 1000; seed ^= GetCurrentProcessId(); -#else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ struct timeval tv; gettimeofday(&tv, 0); seed ^= static_cast(tv.tv_sec) * 1000000; seed ^= static_cast(tv.tv_usec); seed ^= static_cast(getpid()); -#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ return seed; } void* ContextFromNextGlobalSeed() { if (!g_bHaveGlobalSeed) { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ if (!GenerateSeedFromCryptoRandom(&g_nGlobalSeed)) g_nGlobalSeed = GenerateSeedFromEnvironment(); -#else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ g_nGlobalSeed = GenerateSeedFromEnvironment(); -#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ g_bHaveGlobalSeed = true; } return FX_Random_MT_Start(++g_nGlobalSeed); -- cgit v1.2.3