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}
diff --git a/modules/audio_device/win/audio_device_core_win.cc b/modules/audio_device/win/audio_device_core_win.cc
index 0d5ceff..f95e1f0 100644
--- a/modules/audio_device/win/audio_device_core_win.cc
+++ b/modules/audio_device/win/audio_device_core_win.cc
@@ -4177,25 +4177,7 @@
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 {
diff --git a/modules/audio_device/win/audio_device_core_win.h b/modules/audio_device/win/audio_device_core_win.h
index 6ae5988..81db3d8 100644
--- a/modules/audio_device/win/audio_device_core_win.h
+++ b/modules/audio_device/win/audio_device_core_win.h
@@ -233,10 +233,6 @@
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 @@
AudioDeviceModule::WindowsDeviceType _outputDevice;
uint16_t _inputDeviceIndex;
uint16_t _outputDeviceIndex;
-
- mutable char _str[512];
};
#endif // #if (_MSC_VER >= 1400)