[C++] Fix coverity issues (#15348)

* [C++] Fix coverity issues

* Merge master with this branch

* [C++] Reapply changes that got eaten during merge

* Update samples/cpp/benchmark_app/main.cpp

Co-authored-by: Ilya Churaev <ilyachur@gmail.com>

* [C++] Add missing const keyword

---------

Co-authored-by: Ilya Churaev <ilyachur@gmail.com>
This commit is contained in:
Piotr KrzemińskiandIlya Churaev authored and GitHub committed 2023-01-31 13:13:35 +04:00
1 parent b2ce43a172
commit 7e3e0ff003
2 files changed
+13 -13

No files matched your search

+2 -2
View File
@@ -437,7 +437,7 @@ int main(int argc, char* argv[]) {
std::stringstream strm(it_device_nstreams->second);
std::map<std::string, std::string> devices_property;
ov::util::Read<std::map<std::string, std::string>>{}(strm, devices_property);
for (auto it : devices_property) {
for (const auto& it : devices_property) {
if (device_config.find(it.first) == device_config.end() ||
(is_load_config && is_dev_set_property[it.first])) {
// Create ov::device::properties with ov::num_stream and
@@ -513,7 +513,7 @@ int main(int argc, char* argv[]) {
std::stringstream strm(it_device_infer_precision->second);
std::map<std::string, std::string> devices_property;
ov::util::Read<std::map<std::string, std::string>>{}(strm, devices_property);
for (auto it : devices_property) {
for (const auto& it : devices_property) {
if (device_config.find(it.first) == device_config.end() ||
(is_load_config && is_dev_set_property[it.first])) {
// Create ov::device::properties with ov::inference_precision and
@@ -607,10 +607,10 @@ static UNUSED void printPerformanceCounts(const std::map<std::string, ov::Profil
}
stream << std::setw(20) << std::left << "Total time: " + std::to_string(totalTime.count()) << " microseconds"
<< std::endl;
std::cout << std::endl;
std::cout << "Full device name: " << deviceName << std::endl;
std::cout << std::endl;
std::cout.flags(fmt);
stream << std::endl;
stream << "Full device name: " << deviceName << std::endl;
stream << std::endl;
stream.flags(fmt);
}
/**
@@ -1063,7 +1063,7 @@ static UNUSED void printPerformanceCounts(std::vector<ov::ProfilingInfo> perform
stream << std::endl;
stream << "Full device name: " << deviceName << std::endl;
stream << std::endl;
std::cout.flags(fmt);
stream.flags(fmt);
}
static UNUSED void printPerformanceCounts(ov::InferRequest request,
@@ -1230,10 +1230,10 @@ static UNUSED void printPerformanceCountsSort(std::vector<ov::ProfilingInfo> per
}
}
}
stream << std::setw(25) << std::left << "Total time: " << totalTime.count() / 1000.0 << " milliseconds"
<< std::endl;
std::cout << std::endl;
std::cout << "Full device name: " << deviceName << std::endl;
std::cout << std::endl;
std::cout.flags(fmt);
stream << std::setw(25) << std::left << "Total time: " + std::to_string(totalTime.count() / 1000.0)
<< " milliseconds" << std::endl;
stream << std::endl;
stream << "Full device name: " << deviceName << std::endl;
stream << std::endl;
stream.flags(fmt);
}