Revert "Fix circular dependencies between optional, array_view, and rtc_base."
This reverts commit a9e0924fa7688c4e4558e179c6608ce1093e15f8. Reason for revert: Breaks because of RTC_LAST_SYSTEM_ERROR Original change's description: > 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} TBR=phoglund@webrtc.org,kwiberg@webrtc.org Change-Id: I1a5dcf2223f00ae7c46f9f2a12b990ab3a84397d No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:6828 Reviewed-on: https://webrtc-review.googlesource.com/32760 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Commit-Queue: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21251}
This commit is contained in:
committed by
Commit Bot
parent
1de4b62955
commit
d37709b659
@ -19,7 +19,6 @@
|
||||
#if defined(WEBRTC_WIN)
|
||||
#include <malloc.h>
|
||||
#include <wchar.h>
|
||||
#include <windows.h>
|
||||
#define alloca _alloca
|
||||
#endif // WEBRTC_WIN
|
||||
|
||||
@ -296,43 +295,6 @@ struct Traits<wchar_t> {
|
||||
|
||||
#endif // WEBRTC_WIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// UTF helpers (Windows only)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(WEBRTC_WIN)
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
#endif // WEBRTC_WIN
|
||||
|
||||
// Replaces all occurrences of "search" with "replace".
|
||||
void replace_substrs(const char *search,
|
||||
size_t search_len,
|
||||
|
||||
Reference in New Issue
Block a user