remove warnings
authorsangho park <sangho.g.park@samsung.com>
Mon, 24 May 2021 05:08:00 +0000 (14:08 +0900)
committerInki Dae <inki.dae@samsung.com>
Fri, 4 Jun 2021 03:00:10 +0000 (12:00 +0900)
Change-Id: Ie93b8373b224b65a2c091ffc35931712b2f5b753
Signed-off-by: sangho park <sangho.g.park@samsung.com>
test/testsuites/face/face_test_suite.c

index 4dbf387..b20e620 100644 (file)
@@ -538,21 +538,17 @@ int perform_mv_face_recognition_model_add_face_example(
                }
 
                DIR *dir;
-               struct dirent ent;
                struct dirent *dent;
                if ((dir = opendir(in_file_name)) != NULL) {
                        char file_path[1024] = "";
 
                        /* Traverses all the files and directories within source directory */
-                       while (!readdir_r(dir, &ent, &dent) && dent) {
-                               /* Determine current entry name */
-                               const char *file_name = ent.d_name;
-
+                       while ((dent = readdir(dir))) {
                                /* If current entry is directory, or hidden object, skip the step: */
-                               if (file_name[0] == '.')
+                               if (strcmp(dent->d_name, ".") != 0)
                                        continue;
 
-                               snprintf(file_path, 1024, "%s/%s", in_file_name, file_name);
+                               snprintf(file_path, 1024, "%s/%s", in_file_name, dent->d_name);
                                err = add_single_example(model, file_path, NULL, &face_label);
 
                                if (MEDIA_VISION_ERROR_NONE != err) {
@@ -910,27 +906,23 @@ int perform_model_evaluation(mv_face_recognition_model_h model)
 
        for (i = 0; i < dir_n; ++i) {
                DIR *dir;
-               struct dirent ent;
                struct dirent *dent;
                printf("Processing %s...\n", directories[i]);
                if ((dir = opendir(directories[i])) != NULL) {
                        char file_path[1024] = "";
 
                        /* Traverses all the files and directories within source directory */
-                       while (!readdir_r(dir, &ent, &dent) && dent) {
-                               /* Determine current entry name */
-                               const char *file_name = ent.d_name;
-
+                       while ((dent = readdir(dir))) {
                                /* If current entry is directory, or hidden object, skip the step: */
-                               if (file_name[0] == '.')
+                               if (strcmp(dent->d_name, ".") != 0)
                                        continue;
 
-                               snprintf(file_path, 1024, "%s/%s", directories[i], file_name);
+                               snprintf(file_path, 1024, "%s/%s", directories[i], dent->d_name);
                                err = load_mv_source_from_file(file_path, source);
                                if (MEDIA_VISION_ERROR_NONE != err) {
                                        printf(TEXT_RED "Failed to test on example from %s. "
                                                                        "Example will not affect the evaluation. "
-                                                                       "Error code: %i.\n" TEXT_RESET,
+                                                                       "Error code: %i\n" TEXT_RESET,
                                                                        file_path, err);
                                } else {
                                        err = mv_face_recognize(source, model, NULL, NULL, evaluation_cb, &(labels[i]));
@@ -1181,7 +1173,7 @@ void video_1_sample_cb(
 
                const int err = mv_source_fill_by_buffer(
                                                        source,
-                                                       buffer,
+                                                       (unsigned char*)buffer,
                                                        buffer_size,
                                                        image_data.image_width,
                                                        image_data.image_height,
@@ -1604,7 +1596,7 @@ void track_on_sample_cb(
 
        err = mv_source_fill_by_buffer(
                                                source,
-                                               buffer,
+                                               (unsigned char*)buffer,
                                                buffer_size,
                                                image_data.image_width,
                                                image_data.image_height,
@@ -1821,10 +1813,8 @@ int process_image_file(
        int frame_idx;
        int err = MEDIA_VISION_ERROR_NONE;
        int frames_counter = 0;
-       char (*frames)[FILE_PATH_SIZE] = (char **)malloc(0);
+       char (*frames)[FILE_PATH_SIZE] = malloc(0);
 
-       int ret = 0;
-       struct dirent ent;
        struct dirent *ent_eof;
        DIR *dir = opendir(track_target_file_name);
 
@@ -1833,18 +1823,18 @@ int process_image_file(
                return MEDIA_VISION_ERROR_INVALID_PATH;
        }
 
-       while ((ret = readdir_r(dir, &ent, &ent_eof)) == 0 && ent_eof != NULL) {
-               if (ent.d_name[0] == '.' || strlen(ent.d_name) < 4)
+       while ((ent_eof = readdir(dir))) {
+               if (ent_eof->d_name[0] == '.' || strlen(ent_eof->d_name) < 4)
                        continue;
 
-               if (strcmp(".jpg", ent.d_name + strlen(ent.d_name) -4) != 0)
+               if (strcmp(".jpg", ent_eof->d_name + strlen(ent_eof->d_name) -4) != 0)
                        continue;
 
                frames_counter++;
-               frames = (char **) realloc(frames, frames_counter * FILE_PATH_SIZE);
+               frames = realloc(frames, frames_counter * FILE_PATH_SIZE);
 
                snprintf(frames[frames_counter -1], FILE_PATH_SIZE, "%s/%s",
-                       track_target_file_name, ent.d_name);
+                       track_target_file_name, ent_eof->d_name);
        }
        closedir(dir);