diff options
author | Stéphane Lenclud <github@lenclud.com> | 2019-05-19 16:31:08 +0200 |
---|---|---|
committer | Stéphane Lenclud <github@lenclud.com> | 2019-05-19 16:31:38 +0200 |
commit | 1579a97c480578dcd14691cd3e40f56fd508204e (patch) | |
tree | 4eac0cff9eda3e07e13377f647b0cd915cae2480 | |
parent | 48b80fb28b9e6e44267c9d1edb8a9968ff81fea5 (diff) |
Easy Tracker: Fix #945 trivial warnings.
Also fixing broken build.
-rw-r--r-- | tracker-easy/point-extractor.cpp | 12 | ||||
-rw-r--r-- | tracker-easy/preview.cpp | 4 | ||||
-rw-r--r-- | tracker-easy/tracker-easy.cpp | 2 | ||||
-rw-r--r-- | tracker-easy/tracker-easy.h | 2 |
4 files changed, 12 insertions, 8 deletions
diff --git a/tracker-easy/point-extractor.cpp b/tracker-easy/point-extractor.cpp index 4b54fd25..34d93b52 100644 --- a/tracker-easy/point-extractor.cpp +++ b/tracker-easy/point-extractor.cpp @@ -143,7 +143,7 @@ namespace EasyTracker while (aPoints.size() > aNeededPointCount) // Until we have no more than three points { int maxY = 0; - unsigned index = (unsigned)-1; + size_t index = std::numeric_limits<size_t>::max(); // Search for the point with highest Y coordinate for (size_t i = 0; i < aPoints.size(); i++) @@ -154,9 +154,13 @@ namespace EasyTracker index = i; } } - - // Discard it - aPoints.erase(aPoints.begin() + index); + + if (index < aPoints.size()) // Defensive + { + // Discard it + aPoints.erase(aPoints.begin() + index); + } + } } diff --git a/tracker-easy/preview.cpp b/tracker-easy/preview.cpp index 198f838b..1dad7d84 100644 --- a/tracker-easy/preview.cpp +++ b/tracker-easy/preview.cpp @@ -72,7 +72,7 @@ namespace EasyTracker QImage Preview::get_bitmap() { - int stride = iFrameWidget.step.p[0]; + size_t stride = iFrameWidget.step.p[0]; if (stride < 64 || stride < iFrameWidget.cols * 4) { @@ -96,7 +96,7 @@ namespace EasyTracker return QImage((const unsigned char*)iFrameWidget.data, iFrameWidget.cols, iFrameWidget.rows, - stride, + (int)stride, QImage::Format_ARGB32); } diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp index 614eb55c..23e68397 100644 --- a/tracker-easy/tracker-easy.cpp +++ b/tracker-easy/tracker-easy.cpp @@ -353,7 +353,7 @@ namespace EasyTracker // If we are ever going to support color buffer we will need another implementation. if (iFrame.channels == 1) { - iPointExtractor.ExtractPoints(iMatFrame, (doPreview ? &iPreview.iFrameRgb : nullptr), iModel.size(), iPoints); + iPointExtractor.ExtractPoints(iMatFrame, (doPreview ? &iPreview.iFrameRgb : nullptr), (int)iModel.size(), iPoints); } diff --git a/tracker-easy/tracker-easy.h b/tracker-easy/tracker-easy.h index 952f05a4..a0478afc 100644 --- a/tracker-easy/tracker-easy.h +++ b/tracker-easy/tracker-easy.h @@ -81,7 +81,7 @@ namespace EasyTracker // - bool maybe_reopen_camera(); + bool CheckCamera(); void set_fov(int value); void SetFps(int aFps); void DoSetFps(int aFps); |