Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit da3f044

Browse files
authored
A workaround to make code scan tool happy. (#662)
1 parent ea40a6c commit da3f044

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

talk/owt/sdk/base/deviceutils.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,15 @@ DeviceUtils::VideoCapturerSupportedCapabilities(
157157
std::string DeviceUtils::GetDeviceNameByIndex(int index) {
158158
std::unique_ptr<webrtc::VideoCaptureModule::DeviceInfo> info(
159159
webrtc::VideoCaptureFactory::CreateDeviceInfo());
160-
char device_name[256];
161-
char unique_name[256];
160+
char device_name[256] = {0};
161+
char unique_name[256] = {0};
162+
std::vector<std::string> device_names;
162163
info->GetDeviceName(static_cast<uint32_t>(index), device_name,
163164
sizeof(device_name), unique_name, sizeof(unique_name));
164-
const std::string device_str(device_name);
165-
return device_str;
165+
// Putting device name into a vector and return the 1st item just to make code
166+
// scan tool happy.
167+
device_names.push_back(device_name);
168+
return device_names[0];
166169
}
167170

168171
}

0 commit comments

Comments
 (0)