Skip to content

Commit 44afbd0

Browse files
authored
Merge pull request #2911 from Wovchena/demos/cpp-fix-warnings
demos/cpp: fix warnings
2 parents 8441861 + 7dbe67a commit 44afbd0

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

demos/common/cpp/monitors/src/cpu_monitor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#include "query_wrapper.h"
1010
#include <string>
1111
#include <system_error>
12-
#include <pdhmsg.h>
13-
#include <windows.h>
12+
#include <PdhMsg.h>
13+
#include <Windows.h>
1414

1515
namespace {
1616
const std::size_t nCores = []() {
@@ -168,7 +168,7 @@ void CpuMonitor::setHistorySize(std::size_t size) {
168168
performanceCounter.reset();
169169
}
170170
historySize = size;
171-
std::size_t newSize = std::min(size, cpuLoadHistory.size());
171+
std::ptrdiff_t newSize = static_cast<std::ptrdiff_t>(std::min(size, cpuLoadHistory.size()));
172172
cpuLoadHistory.erase(cpuLoadHistory.begin(), cpuLoadHistory.end() - newSize);
173173
}
174174

demos/common/cpp/monitors/src/memory_monitor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ struct MemState {
1313
#include <algorithm>
1414
#define PSAPI_VERSION 2
1515
#include <system_error>
16-
#include <windows.h>
17-
#include <pdhmsg.h>
18-
#include <psapi.h>
16+
#include <Windows.h>
17+
#include <PdhMsg.h>
18+
#include <Psapi.h>
1919

2020
namespace {
2121
double getMemTotal() {

demos/common/cpp/monitors/src/query_wrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include "query_wrapper.h"
66

7-
#include <windows.h>
7+
#include <Windows.h>
88
#include <system_error>
99

1010
QueryWrapper::QueryWrapper() {

demos/common/cpp/monitors/src/query_wrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#pragma once
66

7-
#include <pdh.h>
7+
#include <Pdh.h>
88
class QueryWrapper {
99
public:
1010
QueryWrapper();

demos/common/cpp/utils/src/images_capture.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,12 @@ class VideoCapWrapper : public ImagesCapture {
183183
class CameraCapWrapper : public ImagesCapture {
184184
cv::VideoCapture cap;
185185
size_t nextImgId;
186-
const double initialImageId;
187186
size_t readLengthLimit;
188187

189188
public:
190-
CameraCapWrapper(const std::string &input, bool loop, size_t initialImageId, size_t readLengthLimit,
189+
CameraCapWrapper(const std::string &input, bool loop, size_t readLengthLimit,
191190
cv::Size cameraResolution)
192-
: ImagesCapture{loop}, nextImgId{0}, initialImageId{static_cast<double>(initialImageId)} {
191+
: ImagesCapture{loop}, nextImgId{0} {
193192

194193
try {
195194
if (cap.open(std::stoi(input))) {
@@ -244,7 +243,7 @@ std::unique_ptr<ImagesCapture> openImagesCapture(const std::string &input, bool
244243
catch (const InvalidInput& e) { invalidInputs.push_back(e.what()); }
245244
catch (const OpenError& e) { openErrors.push_back(e.what()); }
246245

247-
try { return std::unique_ptr<ImagesCapture>(new CameraCapWrapper{input, loop, initialImageId, readLengthLimit, cameraResolution}); }
246+
try { return std::unique_ptr<ImagesCapture>(new CameraCapWrapper{input, loop, readLengthLimit, cameraResolution}); }
248247
catch (const InvalidInput& e) { invalidInputs.push_back(e.what()); }
249248
catch (const OpenError& e) { openErrors.push_back(e.what()); }
250249

demos/common/cpp/utils/src/w_dirent.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
# define NOMINMAX
1111
#endif
1212

13-
#include <winsock2.h>
14-
#include <windows.h>
13+
#include <WinSock2.h>
14+
#include <Windows.h>
1515
#include <stdlib.h>
1616

1717
#else

0 commit comments

Comments
 (0)