diff --git a/bindings/wp8/MegaSDK.cpp b/bindings/wp8/MegaSDK.cpp index 2545f53b6c..f3d4f28a28 100644 --- a/bindings/wp8/MegaSDK.cpp +++ b/bindings/wp8/MegaSDK.cpp @@ -48,8 +48,7 @@ MegaSDK::MegaSDK(String^ appKey, String^ userAgent, MRandomNumberProvider ^rando unsigned char randomData[REQUIRED_ENTROPY]; if (randomProvider != nullptr) randomProvider->GenerateRandomBlock(::Platform::ArrayReference(randomData, REQUIRED_ENTROPY)); - MegaApi::addEntropy((char *)randomData, REQUIRED_ENTROPY); - + std::string utf8appKey; if(appKey != nullptr) MegaApi::utf16ToUtf8(appKey->Data(), appKey->Length(), &utf8appKey); @@ -61,6 +60,8 @@ MegaSDK::MegaSDK(String^ appKey, String^ userAgent, MRandomNumberProvider ^rando megaApi = new MegaApi((appKey != nullptr) ? utf8appKey.c_str() : NULL, (const char *)NULL, (userAgent != nullptr) ? utf8userAgent.c_str() : NULL); + megaApi->addEntropy((char *)randomData, REQUIRED_ENTROPY); + InitializeCriticalSectionEx(&listenerMutex, 0, 0); InitializeCriticalSectionEx(&loggerMutex, 0, 0); } @@ -75,8 +76,7 @@ MegaSDK::MegaSDK(String^ appKey, String^ userAgent, String^ basePath, MRandomNum unsigned char randomData[REQUIRED_ENTROPY]; if (randomProvider != nullptr) randomProvider->GenerateRandomBlock(::Platform::ArrayReference(randomData, REQUIRED_ENTROPY)); - MegaApi::addEntropy((char *)randomData, REQUIRED_ENTROPY); - + std::string utf8appKey; if (appKey != nullptr) MegaApi::utf16ToUtf8(appKey->Data(), appKey->Length(), &utf8appKey); @@ -93,6 +93,8 @@ MegaSDK::MegaSDK(String^ appKey, String^ userAgent, String^ basePath, MRandomNum (basePath != nullptr) ? utf8basePath.c_str() : NULL, (userAgent != nullptr) ? utf8userAgent.c_str() : NULL); + megaApi->addEntropy((char *)randomData, REQUIRED_ENTROPY); + InitializeCriticalSectionEx(&listenerMutex, 0, 0); InitializeCriticalSectionEx(&loggerMutex, 0, 0); } @@ -107,8 +109,7 @@ MegaSDK::MegaSDK(String^ appKey, String^ userAgent, String^ basePath, MRandomNum unsigned char randomData[REQUIRED_ENTROPY]; if (randomProvider != nullptr) randomProvider->GenerateRandomBlock(::Platform::ArrayReference(randomData, REQUIRED_ENTROPY)); - MegaApi::addEntropy((char *)randomData, REQUIRED_ENTROPY); - + std::string utf8appKey; if (appKey != nullptr) MegaApi::utf16ToUtf8(appKey->Data(), appKey->Length(), &utf8appKey); @@ -130,6 +131,8 @@ MegaSDK::MegaSDK(String^ appKey, String^ userAgent, String^ basePath, MRandomNum (basePath != nullptr) ? utf8basePath.c_str() : NULL, (userAgent != nullptr) ? utf8userAgent.c_str() : NULL); + megaApi->addEntropy((char *)randomData, REQUIRED_ENTROPY); + InitializeCriticalSectionEx(&listenerMutex, 0, 0); InitializeCriticalSectionEx(&loggerMutex, 0, 0); } diff --git a/bindings/wp8/vs2013/mega.vcxproj b/bindings/wp8/vs2013/mega.vcxproj index da5d65afdc..6e1e206bd4 100644 --- a/bindings/wp8/vs2013/mega.vcxproj +++ b/bindings/wp8/vs2013/mega.vcxproj @@ -370,6 +370,7 @@ + @@ -462,11 +463,13 @@ + + @@ -477,7 +480,6 @@ - @@ -518,4 +520,4 @@ - + \ No newline at end of file diff --git a/bindings/wp8/vs2013/mega.vcxproj.filters b/bindings/wp8/vs2013/mega.vcxproj.filters index 4e6c17ca52..1377e457bb 100644 --- a/bindings/wp8/vs2013/mega.vcxproj.filters +++ b/bindings/wp8/vs2013/mega.vcxproj.filters @@ -297,6 +297,9 @@ Bindings + + SDK\Header + @@ -524,9 +527,6 @@ SDK\Source - - SDK\Source - Bindings @@ -545,5 +545,11 @@ Bindings + + SDK\Source + + + SDK\Source + - + \ No newline at end of file diff --git a/bindings/wp8/vs2015/mega.vcxproj b/bindings/wp8/vs2015/mega.vcxproj index 109a872ed7..f50647df3f 100644 --- a/bindings/wp8/vs2015/mega.vcxproj +++ b/bindings/wp8/vs2015/mega.vcxproj @@ -64,6 +64,7 @@ + @@ -162,6 +163,7 @@ + diff --git a/bindings/wp8/vs2015/mega.vcxproj.filters b/bindings/wp8/vs2015/mega.vcxproj.filters index 24d1fa93c4..e994efc3b5 100644 --- a/bindings/wp8/vs2015/mega.vcxproj.filters +++ b/bindings/wp8/vs2015/mega.vcxproj.filters @@ -301,6 +301,9 @@ Bindings + + SDK\Header + @@ -555,5 +558,8 @@ Bindings + + SDK\Source + diff --git a/include/mega/utils.h b/include/mega/utils.h index 111967b70b..35a1ba5fcf 100644 --- a/include/mega/utils.h +++ b/include/mega/utils.h @@ -25,6 +25,16 @@ #include "types.h" #include "mega/logging.h" +// Needed for Windows Phone (MSVS 2013 - C++ version 9.8) +#if defined(_WIN32) && _MSC_VER <= 1800 && __cplusplus < 201103L && !defined(_TIMESPEC_DEFINED) && ! __struct_timespec_defined +struct timespec +{ + long long tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; +# define __struct_timespec_defined 1 +#endif + namespace mega { // convert 2...8 character ID to int64 integer (endian agnostic) #define MAKENAMEID2(a, b) (nameid)(((a) << 8) + (b)) diff --git a/src/logging.cpp b/src/logging.cpp index 34d3b6ccf7..60ff8c8172 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -22,10 +22,18 @@ * Public License, see http://www.gnu.org/copyleft/gpl.txt for details. */ +#if defined(WINDOWS_PHONE) && !defined(__STDC_LIMIT_MACROS) +#define __STDC_LIMIT_MACROS +#endif + #include "mega/logging.h" #include #include +#if defined(WINDOWS_PHONE) +#include +#endif + namespace mega { // static member initialization diff --git a/src/raid.cpp b/src/raid.cpp index 20fc495a8b..92d0d237a3 100644 --- a/src/raid.cpp +++ b/src/raid.cpp @@ -30,7 +30,7 @@ namespace mega { -constexpr unsigned RAID_ACTIVE_CHANNEL_FAIL_THRESHOLD = 5; +const unsigned RAID_ACTIVE_CHANNEL_FAIL_THRESHOLD = 5; struct FaultyServers {