Fix circular dependencies between optional, array_view, and rtc_base.
This splits things out of rtc_base and makes dependencies explicit. Bug: webrtc:6828 Change-Id: Ib813c7bd9e4de7ab015acb917bc09ee7204ba7bd Reviewed-on: https://webrtc-review.googlesource.com/31940 Commit-Queue: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21245}
This commit is contained in:
committed by
Commit Bot
parent
10a8e7a9b5
commit
a9e0924fa7
@ -46,50 +46,9 @@ namespace rtc {
|
||||
const char* win32_inet_ntop(int af, const void *src, char* dst, socklen_t size);
|
||||
int win32_inet_pton(int af, const char* src, void *dst);
|
||||
|
||||
inline std::wstring ToUtf16(const char* utf8, size_t len) {
|
||||
int len16 = ::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast<int>(len),
|
||||
nullptr, 0);
|
||||
wchar_t* ws = STACK_ARRAY(wchar_t, len16);
|
||||
::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast<int>(len), ws, len16);
|
||||
return std::wstring(ws, len16);
|
||||
}
|
||||
|
||||
inline std::wstring ToUtf16(const std::string& str) {
|
||||
return ToUtf16(str.data(), str.length());
|
||||
}
|
||||
|
||||
inline std::string ToUtf8(const wchar_t* wide, size_t len) {
|
||||
int len8 = ::WideCharToMultiByte(CP_UTF8, 0, wide, static_cast<int>(len),
|
||||
nullptr, 0, nullptr, nullptr);
|
||||
char* ns = STACK_ARRAY(char, len8);
|
||||
::WideCharToMultiByte(CP_UTF8, 0, wide, static_cast<int>(len), ns, len8,
|
||||
nullptr, nullptr);
|
||||
return std::string(ns, len8);
|
||||
}
|
||||
|
||||
inline std::string ToUtf8(const wchar_t* wide) {
|
||||
return ToUtf8(wide, wcslen(wide));
|
||||
}
|
||||
|
||||
inline std::string ToUtf8(const std::wstring& wstr) {
|
||||
return ToUtf8(wstr.data(), wstr.length());
|
||||
}
|
||||
|
||||
// Convert FILETIME to time_t
|
||||
void FileTimeToUnixTime(const FILETIME& ft, time_t* ut);
|
||||
|
||||
// Convert time_t to FILETIME
|
||||
void UnixTimeToFileTime(const time_t& ut, FILETIME * ft);
|
||||
|
||||
// Convert a Utf8 path representation to a non-length-limited Unicode pathname.
|
||||
bool Utf8ToWindowsFilename(const std::string& utf8, std::wstring* filename);
|
||||
|
||||
// Convert a FILETIME to a UInt64
|
||||
inline uint64_t ToUInt64(const FILETIME& ft) {
|
||||
ULARGE_INTEGER r = {{ft.dwLowDateTime, ft.dwHighDateTime}};
|
||||
return r.QuadPart;
|
||||
}
|
||||
|
||||
enum WindowsMajorVersions {
|
||||
kWindows2000 = 5,
|
||||
kWindowsVista = 6,
|
||||
|
||||
Reference in New Issue
Block a user