Fix gcc warning 24/250824/1
authorKwang Son <k.son@samsung.com>
Tue, 5 Jan 2021 04:23:31 +0000 (13:23 +0900)
committerKwang Son <k.son@samsung.com>
Tue, 5 Jan 2021 04:23:31 +0000 (13:23 +0900)
 - printf formatting
 - sprintf truncation

Change-Id: I2371d525fdbd665a413892993b95769ad16be0fd

test/testsuites/face/face_test_suite.c
test/testsuites/inference/inference_test_suite.c

index f74b21c..a4339f1 100644 (file)
@@ -509,7 +509,7 @@ int perform_mv_face_recognition_model_add_face_example(
                                                "choose images with only faces. I.e. face has to cover\n"
                                                "approximately 95-100%% of the image (passport photos\n"
                                                "are the best example :)). Note that if this value is\n"
-                                               "less than 95%, accuracy can be significantly reduced.\n"
+                                               "less than 95%%, accuracy can be significantly reduced.\n"
                                                "In real code such images can be achieved by cropping\n"
                                                "faces from images with face detection functionality.\n"
                        TEXT_RESET);
@@ -1570,9 +1570,12 @@ void track_cb(
                }
        } else {
                char out_file_name[FILE_PATH_SIZE];
-               snprintf(out_file_name, FILE_PATH_SIZE, "%s_%03d.jpg",
+               if(snprintf(out_file_name, FILE_PATH_SIZE, "%s_%03d.jpg",
                                        cb_data->out_file_path,
-                                       cb_data->frame_number);
+                                       cb_data->frame_number) < 0)
+                                       {
+                                               printf("Output file name truncated.");
+                                       }
 
                err = save_image_from_buffer(out_file_name, out_buffer, &image_data, 100);
                if (MEDIA_VISION_ERROR_NONE != err) {
index cc03f8c..804c618 100644 (file)
@@ -1049,7 +1049,7 @@ int perform_image_classification()
                        if (MEDIA_VISION_ERROR_NONE != err) {
                                int err2 = mv_destroy_source(mvSource);
                                if (err2 != MEDIA_VISION_ERROR_NONE)
-                                       printf("Fail to destroy mvSource.\n", err2);
+                                       printf("Fail to destroy mvSource. error code:%i\n", err2);
                                mvSource = NULL;
                                free(in_file_name);
                                break;
@@ -1103,7 +1103,7 @@ int perform_image_classification()
 
                int do_another = 0;
                if (err != MEDIA_VISION_ERROR_NONE) {
-                       printf("ERROR: Action is finished with error code: %i\n");
+                       printf("ERROR: Action is finished with error code:%i\n", err);
                }
 
                sel_opt = 0;
@@ -1536,7 +1536,7 @@ int perform_object_detection()
 
                int do_another = 0;
                if (err != MEDIA_VISION_ERROR_NONE) {
-                       printf("ERROR: Action is finished with error code: %i\n");
+                       printf("ERROR: Action is finished with error code:%i\n", err);
                }
 
                sel_opt = 0;
@@ -1897,7 +1897,7 @@ int perform_face_detection()
                        if (err != MEDIA_VISION_ERROR_NONE) {
                                int err2 = mv_destroy_source(mvSource);
                                if (err2 != MEDIA_VISION_ERROR_NONE)
-                                       printf("Fail to destroy mvSource.\n", err2);
+                                       printf("Fail to destroy mvSource. error code:%i\n", err2);
                                mvSource = NULL;
                                free(in_file_name);
                                break;
@@ -1950,7 +1950,7 @@ int perform_face_detection()
 
                int do_another = 0;
                if (err != MEDIA_VISION_ERROR_NONE) {
-                       printf("ERROR: Action is finished with error code: %i\n");
+                       printf("ERROR: Action is finished with error code:%i\n", err);
                }
 
                sel_opt = 0;
@@ -2227,7 +2227,7 @@ int perform_facial_landmark_detection()
                        if (err != MEDIA_VISION_ERROR_NONE) {
                                int err2 = mv_destroy_source(mvSource);
                                if (err2 != MEDIA_VISION_ERROR_NONE)
-                                       printf("Fail to destroy mvSource.\n", err2);
+                                       printf("Fail to destroy mvSource. error code:%i\n", err2);
                                mvSource = NULL;
                                free(in_file_name);
                                break;
@@ -2280,7 +2280,7 @@ int perform_facial_landmark_detection()
 
                int do_another = 0;
                if (err != MEDIA_VISION_ERROR_NONE) {
-                       printf("ERROR: Action is finished with error code: %i\n");
+                       printf("ERROR: Action is finished with error code:%i\n", err);
                }
 
                sel_opt = 0;