Fix gcc warning 76/259876/4
authorKwang Son <k.son@samsung.com>
Wed, 16 Jun 2021 07:55:52 +0000 (16:55 +0900)
committerKwang Son <k.son@samsung.com>
Tue, 22 Jun 2021 02:23:43 +0000 (11:23 +0900)
Change-Id: I2c98fb88ee4247c8976f316baf5c6592b03f5b65
Signed-off-by: Kwang Son <k.son@samsung.com>
mv_machine_learning/mv_inference/inference/include/Joint.h
mv_machine_learning/mv_inference/inference/src/Bvh.cpp
mv_machine_learning/mv_inference/inference/src/BvhParser.cpp
mv_machine_learning/mv_inference/inference/src/Inference.cpp
mv_machine_learning/mv_inference/inference/src/PostProcess.cpp
mv_surveillance/surveillance/src/mv_absdiff.c
test/testsuites/surveillance/surveillance_test_suite.c

index d28a70c..6f4512b 100644 (file)
@@ -202,9 +202,8 @@ namespace inference
     const std::vector<std::string> get_channels_name() const {
       std::vector<std::string> channel_names;
 
-      for (int i = 0; i < channels_order_.size(); i++)
-        channel_names.push_back(channel_name_str[static_cast<int>(
-            channels_order_[i])]);
+      for (const auto &channel : channels_order_)
+        channel_names.push_back(channel_name_str[static_cast<int>(channel)]);
 
       return channel_names;
     }
index 80d75df..1322eac 100644 (file)
@@ -46,12 +46,12 @@ namespace inference
 
     std::vector<std::vector<float>> data = start_joint->channel_data();
 
-    for (int i = 0; i < num_frames_; i++) {
+    for (unsigned i = 0; i < num_frames_; i++) {
       cv::Mat offmat = offmat_backup; // offset matrix
       cv::Mat rmat = cv::Mat::eye(4,4,CV_32F);  // identity matrix set on rotation matrix
       cv::Mat tmat = cv::Mat::eye(4,4,CV_32F);  // identity matrix set on translation matrix
 
-      for (int j = 0;  j < start_joint->channels_order().size(); j++) {
+      for (size_t j = 0;  j < start_joint->channels_order().size(); j++) {
         if (start_joint->channels_order()[j] == Joint::Channel::XPOSITION)
           tmat.at<float>(0,3) = data[i][j];
         else if (start_joint->channels_order()[j] == Joint::Channel::YPOSITION)
index 6205c83..66c040b 100644 (file)
@@ -333,7 +333,7 @@ namespace inference
       for (int i = 0; i < frames_num; i++) {
         for (auto joint : bvh_->joints()) {
           std::vector <float> data;
-          for (int j = 0; j < joint->num_channels(); j++) {
+          for (unsigned j = 0; j < joint->num_channels(); j++) {
             file >> number;
             data.push_back(number);
           }
index 063a981..0ce6306 100755 (executable)
@@ -798,7 +798,7 @@ namespace inference
                                auto *ori_buf = static_cast<unsigned char *>(
                                                tensorBuffers->buffer);
 
-                               for (int j = 0; j < tensor_info.size; j++) {
+                               for (size_t j = 0; j < tensor_info.size; j++) {
                                        new_buf[j] = static_cast<float>(ori_buf[j]) / 255.0f;
                                }
 
@@ -819,7 +819,7 @@ namespace inference
                                auto *ori_buf =
                                                static_cast<short *>(tensorBuffers->buffer);
 
-                               for (int j = 0; j < tensor_info.size; j++) {
+                               for (size_t j = 0; j < tensor_info.size; j++) {
                                        new_buf[j] = static_cast<float>(ori_buf[j]);
                                }
 
@@ -1081,10 +1081,10 @@ namespace inference
                } else {
                        cvRoi.x = roi->point.x;
                        cvRoi.y = roi->point.y;
-                       cvRoi.width = (roi->point.x + roi->width) >= width ?
+                       cvRoi.width = unsigned(roi->point.x + roi->width) >= width ?
                                                                  width - roi->point.x :
                                                                  roi->width;
-                       cvRoi.height = (roi->point.y + roi->height) >= height ?
+                       cvRoi.height = unsigned(roi->point.y + roi->height) >= height ?
                                                                   height - roi->point.y :
                                                                   roi->height;
                        cvSource = cv::Mat(cv::Size(width, height), CV_MAKETYPE(CV_8U, 3),
@@ -1245,7 +1245,7 @@ namespace inference
                                top_result_pq.push(std::pair<float, int>(value, i));
 
                                // If at capacity, kick the smallest value out.
-                               if (top_result_pq.size() > mOutputNumbers) {
+                               if (top_result_pq.size() > (size_t)mOutputNumbers) {
                                        top_result_pq.pop();
                                }
                        }
@@ -1260,10 +1260,10 @@ namespace inference
                        int classIdx = -1;
                        ImageClassificationResults results;
                        results.number_of_classes = 0;
-                       for (int idx = 0; idx < top_results.size(); ++idx) {
+                       for (size_t idx = 0; idx < top_results.size(); ++idx) {
                                if (top_results[idx].first < mThreshold)
                                        continue;
-                               LOGI("idx:%d", idx);
+                               LOGI("idx:%lu", idx);
                                LOGI("classIdx: %d", top_results[idx].second);
                                LOGI("classProb: %f", top_results[idx].first);
 
index 00059b4..b3a4a96 100755 (executable)
@@ -58,7 +58,7 @@ namespace inference
                LOGI("ENTER");
 
                mScore.push(std::pair<float, int>(value, index));
-               if (mScore.size() > mMaxScoreSize) {
+               if (mScore.size() > (size_t)mMaxScoreSize) {
                        mScore.pop();
                }
 
index 9e122e6..416016a 100644 (file)
@@ -14,8 +14,9 @@
  * limitations under the License.
  */
 
-#include "mv_absdiff.h"
+#include <stdlib.h>
 
+#include "mv_absdiff.h"
 #include "mv_common.h"
 #include "mv_private.h"
 
@@ -62,9 +63,6 @@ int mv_absdiff(
                }
 #else
                for (column = 0; column < width; ++column) {
-                       uint8_t gray1 = *src1;
-                       uint8_t gray2 = *src2;
-
                        (*dst) = abs((*src1) - (*src2));
 
                        ++src1;
index 5d80753..0a86b98 100644 (file)
@@ -291,7 +291,7 @@ int create_trigger_handle_by_event_name(
        for (; i < NUMBER_OF_TYPES; ++i)
                printf("#%d. %s\n", i, EVENT_TYPES_NAMES[i]);
 
-       unsigned int event_id = 0u;
+       size_t event_id = 0ul;
        while (input_size("Input event type (unsigned integer value):",
                                NUMBER_OF_TYPES - 1, &event_id) == -1) {
                PRINT_R("Incorrect input! Try again.\n List of supported events is:");