Delete AudioDeviceWindowsCore::WideToUTF8, replaced with rtc::ToUtf8

Bug: None
Change-Id: I4152693622cc27a73ccd8526216d78532e110698
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149837
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28927}
This commit is contained in:
Niels Möller
2019-08-20 16:58:49 +02:00
committed by Commit Bot
parent 70efddeced
commit f69bd5f184
2 changed files with 1 additions and 25 deletions

View File

@ -4177,25 +4177,7 @@ void AudioDeviceWindowsCore::_TraceCOMError(HRESULT hr) const {
RTC_LOG(LS_ERROR) << "Core Audio method failed (hr=" << hr << ")";
StringCchPrintfW(buf, MAXERRORLENGTH, L"Error details: ");
StringCchCatW(buf, MAXERRORLENGTH, errorText);
RTC_LOG(LS_ERROR) << WideToUTF8(buf);
}
// ----------------------------------------------------------------------------
// WideToUTF8
// ----------------------------------------------------------------------------
char* AudioDeviceWindowsCore::WideToUTF8(const wchar_t* src) const {
const size_t kStrLen = sizeof(_str);
memset(_str, 0, kStrLen);
// Get required size (in bytes) to be able to complete the conversion.
unsigned int required_size =
(unsigned int)WideCharToMultiByte(CP_UTF8, 0, src, -1, _str, 0, 0, 0);
if (required_size <= kStrLen) {
// Process the entire input string, including the terminating null char.
if (WideCharToMultiByte(CP_UTF8, 0, src, -1, _str, kStrLen, 0, 0) == 0)
memset(_str, 0, kStrLen);
}
return _str;
RTC_LOG(LS_ERROR) << rtc::ToUtf8(buf);
}
bool AudioDeviceWindowsCore::KeyPressed() const {

View File

@ -233,10 +233,6 @@ class AudioDeviceWindowsCore : public AudioDeviceGeneric {
int32_t _GetDefaultDevice(EDataFlow dir, ERole role, IMMDevice** ppDevice);
int32_t _GetListDevice(EDataFlow dir, int index, IMMDevice** ppDevice);
// Converts from wide-char to UTF-8 if UNICODE is defined.
// Does nothing if UNICODE is undefined.
char* WideToUTF8(const wchar_t* src) const;
int32_t InitRecordingDMO();
ScopedCOMInitializer _comInit;
@ -310,8 +306,6 @@ class AudioDeviceWindowsCore : public AudioDeviceGeneric {
AudioDeviceModule::WindowsDeviceType _outputDevice;
uint16_t _inputDeviceIndex;
uint16_t _outputDeviceIndex;
mutable char _str[512];
};
#endif // #if (_MSC_VER >= 1400)