OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 2691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2702 | 2702 |
2703 // ---------------------------------------------------------------------------- | 2703 // ---------------------------------------------------------------------------- |
2704 // WideToUTF8 | 2704 // WideToUTF8 |
2705 // ---------------------------------------------------------------------------- | 2705 // ---------------------------------------------------------------------------- |
2706 | 2706 |
2707 char* AudioMixerManager::WideToUTF8(const TCHAR* src) const { | 2707 char* AudioMixerManager::WideToUTF8(const TCHAR* src) const { |
2708 #ifdef UNICODE | 2708 #ifdef UNICODE |
2709 const size_t kStrLen = sizeof(_str); | 2709 const size_t kStrLen = sizeof(_str); |
2710 memset(_str, 0, kStrLen); | 2710 memset(_str, 0, kStrLen); |
2711 // Get required size (in bytes) to be able to complete the conversion. | 2711 // Get required size (in bytes) to be able to complete the conversion. |
2712 int required_size = WideCharToMultiByte(CP_UTF8, 0, src, -1, _str, 0, 0, 0); | 2712 unsigned int required_size = (unsigned int)WideCharToMultiByte(CP_UTF8, 0, s
rc, -1, _str, 0, 0, 0); |
2713 if (required_size <= kStrLen) | 2713 if (required_size <= kStrLen) |
2714 { | 2714 { |
2715 // Process the entire input string, including the terminating null char. | 2715 // Process the entire input string, including the terminating null char. |
2716 if (WideCharToMultiByte(CP_UTF8, 0, src, -1, _str, kStrLen, 0, 0) == 0) | 2716 if (WideCharToMultiByte(CP_UTF8, 0, src, -1, _str, kStrLen, 0, 0) == 0) |
2717 memset(_str, 0, kStrLen); | 2717 memset(_str, 0, kStrLen); |
2718 } | 2718 } |
2719 return _str; | 2719 return _str; |
2720 #else | 2720 #else |
2721 return const_cast<char*>(src); | 2721 return const_cast<char*>(src); |
2722 #endif | 2722 #endif |
2723 } | 2723 } |
2724 | 2724 |
2725 } // namespace webrtc | 2725 } // namespace webrtc |
OLD | NEW |