feat: min code change linux support
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
#include "Utility.h"
|
||||
#include "../Crypto/RealmCrypt.h"
|
||||
|
||||
#ifdef __linux__
|
||||
typedef float float_t;
|
||||
#endif
|
||||
|
||||
class ByteBuffer {
|
||||
public:
|
||||
ByteBuffer( const std::vector< uint8_t > &data );
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "Utility.h"
|
||||
|
||||
@@ -62,6 +64,7 @@ std::string Util::IPFromAddr( const sockaddr_in &addr )
|
||||
return {};
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
std::string Util::WideToUTF8( const std::wstring &wstr )
|
||||
{
|
||||
if( wstr.empty() ) return {};
|
||||
@@ -95,3 +98,20 @@ std::wstring Util::UTF8ToWide( const std::string &str )
|
||||
);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
std::string Util::WideToUTF8( const std::wstring &wstr )
|
||||
{
|
||||
if( wstr.empty() ) return {};
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> conv;
|
||||
return conv.to_bytes(wstr);
|
||||
}
|
||||
|
||||
std::wstring Util::UTF8ToWide( const std::string &str )
|
||||
{
|
||||
if( str.empty() ) return {};
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> conv;
|
||||
return conv.from_bytes(str);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,17 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
#include <WinSock2.h>
|
||||
#endif
|
||||
|
||||
namespace Util
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user